def do_irt(self, args): """irt <addr>""" args = args.split() if _debug: WhoIsRouterConsoleCmd._debug("do_irt %r", args) # build a request try: request = InitializeRoutingTable() request.pduDestination = Address(args[0]) except: print "invalid arguments" return # give it to the application this_application.request(this_application.nsap.adapters[0], request)
def do_irt(self, args): """ irt <addr> Send an empty Initialize-Routing-Table message to an address, a router will return an acknowledgement with its routing table configuration. """ args = args.split() if _debug: DiscoverConsoleCmd._debug("do_irt %r", args) # build a request try: request = InitializeRoutingTable() request.pduDestination = Address(args[0]) except: print("invalid arguments") return # give it to the network service element this_application.nse.request(this_application.nsap.local_adapter, request)
def init_routing_table(self, address): """ irt <addr> Send an empty Initialize-Routing-Table message to an address, a router will return an acknowledgement with its routing table configuration. """ # build a request self._log.info("Addr : {}".format(address)) try: request = InitializeRoutingTable() request.pduDestination = Address(address) except: self._log.error("invalid arguments") return iocb = IOCB((self.this_application.nsap.local_adapter, request)) # make an IOCB iocb.set_timeout(2) deferred(self.this_application.nse.request_io, iocb) iocb.wait()
def test_initialize_routing_table_empty(self): """Test the InitializeRoutingTable with no routing table entries.""" if _debug: TestNPDUCodec._debug("test_initialize_routing_table_empty") # Request successful pdu_bytes = xtob('01.80' # version, network layer message '06 00' # message type and list length ) self.request(InitializeRoutingTable()) self.indication(pduData=pdu_bytes) self.response(PDU(pdu_bytes)) self.confirmation(InitializeRoutingTable, irtTable=[])
def test_initialize_routing_table_01(self): """Test the RouterAvailableToNetwork with a routing table entry.""" if _debug: TestNPDUCodec._debug("test_initialize_routing_table_01") # build a routing table entry rte = RoutingTableEntry(1, 2, xtob('')) rt_entries = [rte] # Request successful pdu_bytes = xtob('01.80' # version, network layer message '06 01' # message type and list length '0001 02 00' # network, port number, port info ) self.request(InitializeRoutingTable(rt_entries)) self.indication(pduData=pdu_bytes) self.response(PDU(pdu_bytes)) self.confirmation(InitializeRoutingTable, irtTable=rt_entries)