def physnodehandlelink(self, message): """ Broker handler. Snoop Link add messages to get node numbers of PhyiscalNodes and their nets. Physical nodes exist only on other servers, but a shadow object is created here for tracking node position. :param message: link message to handle :return: nothing """ if message.message_type == MessageTypes.LINK.value and message.flags & MessageFlags.ADD.value: nn = message.node_numbers() # first node is always link layer node in Link add message if nn[0] not in self.session.broker.network_nodes: return if nn[1] in self.session.broker.physical_nodes: # record the fact that this PhysicalNode is linked to a net dummy = PyCoreNode(session=self.session, objid=nn[1], name="n%d" % nn[1], start=False) self.addphys(nn[0], dummy)
def physnodehandlelink(self, msg): ''' Broker handler. Snoop Link add messages to get node numbers of PhyiscalNodes and their nets. Physical nodes exist only on other servers, but a shadow object is created here for tracking node position. ''' if msg.msgtype == coreapi.CORE_API_LINK_MSG and \ msg.flags & coreapi.CORE_API_ADD_FLAG: nn = msg.nodenumbers() # first node is always link layer node in Link add message if nn[0] not in self.session.broker.nets: return if nn[1] in self.session.broker.phys: # record the fact that this PhysicalNode is linked to a net dummy = PyCoreNode(session=self.session, objid=nn[1], name="n%d" % nn[1], start=False) self.addphys(nn[0], dummy)