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 equivalent API2 message to send to the client
''' '''
''' if self.handler.debug:
print "RegisterMessage" print "RegisterMessage"
print "\twireless=", regMsg.getWireless() print "\twireless=", regMsg.getWireless()
print "\tmobility=", regMsg.getMobility() print "\tmobility=", regMsg.getMobility()
print "\tutility=", regMsg.getUtility() print "\tutility=", regMsg.getUtility()
print "\texec=", regMsg.getExecsrv() print "\texec=", regMsg.getExecsrv()
print "\tgui=", regMsg.getGui() print "\tgui=", regMsg.getGui()
print "\temul=", regMsg.getEmulsrv() print "\temul=", regMsg.getEmulsrv()
print "\tsess=", regMsg.getSession() print "\tsess=", regMsg.getSession()
'''
pass pass
def processLegacySessionMsg(self, sessMsg, api2msgs): def processLegacySessionMsg(self, sessMsg, api2msgs):
@ -202,17 +202,17 @@ class CoreApiBridge(object):
API2 messages to send to the client API2 messages to send to the client
''' '''
''' if self.handler.debug:
print "SessionMessage" print "SessionMessage"
print "\tnumber=", sessMsg.getNumber() print "\tnumber=", sessMsg.getNumber()
print "\tname=", sessMsg.getName() print "\tname=", sessMsg.getName()
print "\tfile=", sessMsg.getFile() print "\tfile=", sessMsg.getFile()
print "\tnodecount=", sessMsg.getNodecount() print "\tnodecount=", sessMsg.getNodecount()
print "\tdate=", sessMsg.getDate() print "\tdate=", sessMsg.getDate()
print "\tthumb=", sessMsg.getThumb() print "\tthumb=", sessMsg.getThumb()
print "\tuser=", sessMsg.getUser() print "\tuser=", sessMsg.getUser()
print "\topaque=", sessMsg.getOpaque() print "\topaque=", sessMsg.getOpaque()
'''
sessions = sessMsg.getNumber().split("|") sessions = sessMsg.getNumber().split("|")
port_num = int(sessions[-1]) port_num = int(sessions[-1])
newMsg = coreapi2.CoreMessage() newMsg = coreapi2.CoreMessage()
@ -245,15 +245,15 @@ class CoreApiBridge(object):
API2 messages to send to the client API2 messages to send to the client
''' '''
''' if self.handler.debug:
print "Event:" print "Event:"
print "\tnode=", event.getNode() print "\tnode=", event.getNode()
print "\ttype=", event.getType() print "\ttype=", event.getType()
print "\tname=", event.getName() print "\tname=", event.getName()
print "\tdata=", event.getData() print "\tdata=", event.getData()
print "\ttime=", event.getTime() print "\ttime=", event.getTime()
print "\tsessions=", event.getSession() print "\tsessions=", event.getSession()
'''
if event.getType() == legacy.CORE_EVENT_RUNTIME_STATE: if event.getType() == legacy.CORE_EVENT_RUNTIME_STATE:
newMsg = coreapi2.CoreMessage() newMsg = coreapi2.CoreMessage()
@ -275,19 +275,20 @@ class CoreApiBridge(object):
API2 messages to send to the client API2 messages to send to the client
''' '''
print "Config:" if self.handler.debug:
print "\tobj=", confMsg.getObj() print "Config:"
print "\tnode=", confMsg.getNode() print "\tobj=", confMsg.getObj()
print "\ttype=", confMsg.getType() print "\tnode=", confMsg.getNode()
print "\tdata=", confMsg.getData() print "\ttype=", confMsg.getType()
print "\tvalues=", confMsg.getValues() print "\tdata=", confMsg.getData()
print "\tcaptions=", confMsg.getCaptions() print "\tvalues=", confMsg.getValues()
print "\tbitmap=", confMsg.getBitmap() print "\tcaptions=", confMsg.getCaptions()
print "\tposs values=", confMsg.getPossible() print "\tbitmap=", confMsg.getBitmap()
print "\tgroups=", confMsg.getGroups() print "\tposs values=", confMsg.getPossible()
print "\tsession=", confMsg.getSession() print "\tgroups=", confMsg.getGroups()
print "\tnetid=", confMsg.getNetid() print "\tsession=", confMsg.getSession()
print "\topaque=", confMsg.getOpaque() print "\tnetid=", confMsg.getNetid()
print "\topaque=", confMsg.getOpaque()
# The CONFIG message will have its 'object' field set to the string literal # 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): def processLegacyNodeMsg(self, nodeMsg, api2msgs):
''' '''
Intercept an outgoing legacy node message generated by the CORE daemon and generate the equivalent Intercept an outgoing legacy node message generated by the CORE daemon and generate the equivalent
API2 messages to send to the client API2 messages to send to the client
''' '''
print "Node:" if self.handler.debug:
print "\tnumber=", nodeMsg.getNumber() print "Node:"
print "\ttype=", nodeMsg.getType() print "\tnumber=", nodeMsg.getNumber()
print "\tname=", nodeMsg.getName() print "\ttype=", nodeMsg.getType()
print "\tipaddr=", nodeMsg.getIpaddr() print "\tname=", nodeMsg.getName()
print "\tmacaddr=", nodeMsg.getMacaddr() print "\tipaddr=", nodeMsg.getIpaddr()
print "\tip6addr=", nodeMsg.getIp6addr() print "\tmacaddr=", nodeMsg.getMacaddr()
print "\tmodel=", nodeMsg.getModel() print "\tip6addr=", nodeMsg.getIp6addr()
print "\temusrv=", nodeMsg.getEmusrv() print "\tmodel=", nodeMsg.getModel()
print "\tsession=", nodeMsg.getSession() print "\temusrv=", nodeMsg.getEmusrv()
print "\txpos=", nodeMsg.getXpos() print "\tsession=", nodeMsg.getSession()
print "\typos=", nodeMsg.getYpos() print "\txpos=", nodeMsg.getXpos()
print "\tcanvas=", nodeMsg.getCanvas() print "\typos=", nodeMsg.getYpos()
print "\temuid=", nodeMsg.getEmuid() print "\tcanvas=", nodeMsg.getCanvas()
print "\tnetid=", nodeMsg.getNetid() print "\temuid=", nodeMsg.getEmuid()
print "\tservices=", nodeMsg.getServices() print "\tnetid=", nodeMsg.getNetid()
print "\tlat=", nodeMsg.getLat() print "\tservices=", nodeMsg.getServices()
print "\tlon=", nodeMsg.getLong() print "\tlat=", nodeMsg.getLat()
print "\talt=", nodeMsg.getAlt() print "\tlon=", nodeMsg.getLong()
print "\ticon=", nodeMsg.getIcon() print "\talt=", nodeMsg.getAlt()
print "\topaque=", nodeMsg.getOpaque() print "\ticon=", nodeMsg.getIcon()
print "\topaque=", nodeMsg.getOpaque()
api2_node=None api2_node=None
api2_dev=None api2_dev=None
@ -425,14 +425,54 @@ class CoreApiBridge(object):
API2 messages to send to the client 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), # 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. # add information from legacy Link messages to the experiment message being constructed.
# Otherwise, send as an independent Channel message. # Otherwise, send as an independent Channel message.
newMsg = None newMsg = None
if not self.collector: 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: if not self.collector.experiment:
raise RuntimeError, 'Invalid collector' raise RuntimeError, 'Invalid collector'