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,16 +184,16 @@ class CoreApiBridge(object):
equivalent API2 message to send to the client
'''
'''
print "RegisterMessage"
print "\twireless=", regMsg.getWireless()
print "\tmobility=", regMsg.getMobility()
print "\tutility=", regMsg.getUtility()
print "\texec=", regMsg.getExecsrv()
print "\tgui=", regMsg.getGui()
print "\temul=", regMsg.getEmulsrv()
print "\tsess=", regMsg.getSession()
'''
if self.handler.debug:
print "RegisterMessage"
print "\twireless=", regMsg.getWireless()
print "\tmobility=", regMsg.getMobility()
print "\tutility=", regMsg.getUtility()
print "\texec=", regMsg.getExecsrv()
print "\tgui=", regMsg.getGui()
print "\temul=", regMsg.getEmulsrv()
print "\tsess=", regMsg.getSession()
pass
def processLegacySessionMsg(self, sessMsg, api2msgs):
@ -202,17 +202,17 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
'''
print "SessionMessage"
print "\tnumber=", sessMsg.getNumber()
print "\tname=", sessMsg.getName()
print "\tfile=", sessMsg.getFile()
print "\tnodecount=", sessMsg.getNodecount()
print "\tdate=", sessMsg.getDate()
print "\tthumb=", sessMsg.getThumb()
print "\tuser=", sessMsg.getUser()
print "\topaque=", sessMsg.getOpaque()
'''
if self.handler.debug:
print "SessionMessage"
print "\tnumber=", sessMsg.getNumber()
print "\tname=", sessMsg.getName()
print "\tfile=", sessMsg.getFile()
print "\tnodecount=", sessMsg.getNodecount()
print "\tdate=", sessMsg.getDate()
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,15 +245,15 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
'''
print "Event:"
print "\tnode=", event.getNode()
print "\ttype=", event.getType()
print "\tname=", event.getName()
print "\tdata=", event.getData()
print "\ttime=", event.getTime()
print "\tsessions=", event.getSession()
'''
if self.handler.debug:
print "Event:"
print "\tnode=", event.getNode()
print "\ttype=", event.getType()
print "\tname=", event.getName()
print "\tdata=", event.getData()
print "\ttime=", event.getTime()
print "\tsessions=", event.getSession()
if event.getType() == legacy.CORE_EVENT_RUNTIME_STATE:
newMsg = coreapi2.CoreMessage()
@ -275,19 +275,20 @@ class CoreApiBridge(object):
API2 messages to send to the client
'''
print "Config:"
print "\tobj=", confMsg.getObj()
print "\tnode=", confMsg.getNode()
print "\ttype=", confMsg.getType()
print "\tdata=", confMsg.getData()
print "\tvalues=", confMsg.getValues()
print "\tcaptions=", confMsg.getCaptions()
print "\tbitmap=", confMsg.getBitmap()
print "\tposs values=", confMsg.getPossible()
print "\tgroups=", confMsg.getGroups()
print "\tsession=", confMsg.getSession()
print "\tnetid=", confMsg.getNetid()
print "\topaque=", confMsg.getOpaque()
if self.handler.debug:
print "Config:"
print "\tobj=", confMsg.getObj()
print "\tnode=", confMsg.getNode()
print "\ttype=", confMsg.getType()
print "\tdata=", confMsg.getData()
print "\tvalues=", confMsg.getValues()
print "\tcaptions=", confMsg.getCaptions()
print "\tbitmap=", confMsg.getBitmap()
print "\tposs values=", confMsg.getPossible()
print "\tgroups=", confMsg.getGroups()
print "\tsession=", confMsg.getSession()
print "\tnetid=", confMsg.getNetid()
print "\topaque=", confMsg.getOpaque()
# The CONFIG message will have its 'object' field set to the string literal
@ -311,35 +312,34 @@ 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
'''
print "Node:"
print "\tnumber=", nodeMsg.getNumber()
print "\ttype=", nodeMsg.getType()
print "\tname=", nodeMsg.getName()
print "\tipaddr=", nodeMsg.getIpaddr()
print "\tmacaddr=", nodeMsg.getMacaddr()
print "\tip6addr=", nodeMsg.getIp6addr()
print "\tmodel=", nodeMsg.getModel()
print "\temusrv=", nodeMsg.getEmusrv()
print "\tsession=", nodeMsg.getSession()
print "\txpos=", nodeMsg.getXpos()
print "\typos=", nodeMsg.getYpos()
print "\tcanvas=", nodeMsg.getCanvas()
print "\temuid=", nodeMsg.getEmuid()
print "\tnetid=", nodeMsg.getNetid()
print "\tservices=", nodeMsg.getServices()
print "\tlat=", nodeMsg.getLat()
print "\tlon=", nodeMsg.getLong()
print "\talt=", nodeMsg.getAlt()
print "\ticon=", nodeMsg.getIcon()
print "\topaque=", nodeMsg.getOpaque()
if self.handler.debug:
print "Node:"
print "\tnumber=", nodeMsg.getNumber()
print "\ttype=", nodeMsg.getType()
print "\tname=", nodeMsg.getName()
print "\tipaddr=", nodeMsg.getIpaddr()
print "\tmacaddr=", nodeMsg.getMacaddr()
print "\tip6addr=", nodeMsg.getIp6addr()
print "\tmodel=", nodeMsg.getModel()
print "\temusrv=", nodeMsg.getEmusrv()
print "\tsession=", nodeMsg.getSession()
print "\txpos=", nodeMsg.getXpos()
print "\typos=", nodeMsg.getYpos()
print "\tcanvas=", nodeMsg.getCanvas()
print "\temuid=", nodeMsg.getEmuid()
print "\tnetid=", nodeMsg.getNetid()
print "\tservices=", nodeMsg.getServices()
print "\tlat=", nodeMsg.getLat()
print "\tlon=", nodeMsg.getLong()
print "\talt=", nodeMsg.getAlt()
print "\ticon=", nodeMsg.getIcon()
print "\topaque=", nodeMsg.getOpaque()
api2_node=None
api2_dev=None
@ -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'