enabled trace messages only when debugging

This commit is contained in:
Rod A Santiago 2016-08-22 16:45:50 -07:00
parent 695da8a153
commit 5934b23b18

View file

@ -184,7 +184,7 @@ class CoreApiBridge(object):
equivalent API2 message to send to the client
'''
'''
if self.handler.debug:
print "RegisterMessage"
print "\twireless=", regMsg.getWireless()
print "\tmobility=", regMsg.getMobility()
@ -193,7 +193,7 @@ class CoreApiBridge(object):
print "\tgui=", regMsg.getGui()
print "\temul=", regMsg.getEmulsrv()
print "\tsess=", regMsg.getSession()
'''
pass
def processLegacySessionMsg(self, sessMsg, api2msgs):
@ -202,7 +202,7 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
'''
if self.handler.debug:
print "SessionMessage"
print "\tnumber=", sessMsg.getNumber()
print "\tname=", sessMsg.getName()
@ -212,7 +212,7 @@ class CoreApiBridge(object):
print "\tthumb=", sessMsg.getThumb()
print "\tuser=", sessMsg.getUser()
print "\topaque=", sessMsg.getOpaque()
'''
sessions = sessMsg.getNumber().split("|")
port_num = int(sessions[-1])
newMsg = coreapi2.CoreMessage()
@ -245,7 +245,7 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
'''
if self.handler.debug:
print "Event:"
print "\tnode=", event.getNode()
print "\ttype=", event.getType()
@ -253,7 +253,7 @@ class CoreApiBridge(object):
print "\tdata=", event.getData()
print "\ttime=", event.getTime()
print "\tsessions=", event.getSession()
'''
if event.getType() == legacy.CORE_EVENT_RUNTIME_STATE:
newMsg = coreapi2.CoreMessage()
@ -275,6 +275,7 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
if self.handler.debug:
print "Config:"
print "\tobj=", confMsg.getObj()
print "\tnode=", confMsg.getNode()
@ -311,14 +312,13 @@ class CoreApiBridge(object):
def processLegacyNodeMsg(self, nodeMsg, api2msgs):
'''
Intercept an outgoing legacy node message generated by the CORE daemon and generate the equivalent
API2 messages to send to the client
'''
if self.handler.debug:
print "Node:"
print "\tnumber=", nodeMsg.getNumber()
print "\ttype=", nodeMsg.getType()
@ -425,14 +425,54 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
if self.handler.debug:
print "LinkMessage"
print "\tn1number", linkMsg.getN1number()
print "\tn2number", linkMsg.getN2number()
print "\tdelay", linkMsg.getDelay()
print "\tbw", linkMsg.getBw()
print "\tper", linkMsg.getPer()
print "\tdup", linkMsg.getDup()
print "\tjitter", linkMsg.getJitter()
print "\tmer", linkMsg.getMer()
print "\tburst", linkMsg.getBurst()
print "\tsession", linkMsg.getSession()
print "\tmburst", linkMsg.getMburst()
print "\ttype", linkMsg.getType()
print "\tguiattr", linkMsg.getGuiattr()
print "\temuid", linkMsg.getEmuid()
print "\tnetid", linkMsg.getNetid()
print "\tkey", linkMsg.getKey()
print "\tif1num", linkMsg.getIf1num()
print "\tif1ip4", linkMsg.getIf1ip4()
print "\tif1ip4mask", linkMsg.getIf1ip4mask()
print "\tif1mac", linkMsg.getIf1mac()
print "\tif1ip6", linkMsg.getIf1ip6()
print "\tif1ip6mask", linkMsg.getIf1ip6mask()
print "\tif2num", linkMsg.getIf2num()
print "\tif2ip4", linkMsg.getIf2ip4()
print "\tif2ip4mask", linkMsg.getIf2ip4mask()
print "\tif2ip4mask", linkMsg.getIf2mac()
print "\tif2ip6", linkMsg.getIf2ip6()
print "\tif2ip6mask", linkMsg.getIf2ip6mask()
print "\topaque", linkMsg.getOpaque()
# When collecting information for a complete experment (i.e. when joining an experiment),
# add information from legacy Link messages to the experiment message being constructed.
# Otherwise, send as an independent Channel message.
newMsg = None
if not self.collector:
newMsg = coreapi2.CoreMessage()
# TODO: Add code that will retrieve contextual information from the
# associated experiment. (See processLegacyNodeMsg)
# newMsg = coreapi2.CoreMessage()
# ....
return
# When collecting, a link message cannot be emitted by the CORE daemon
# prior to node messages. Thus, an experiment must have been created in
# the collector object, otherwise, we have a fault.
if not self.collector.experiment:
raise RuntimeError, 'Invalid collector'