From e624d40fb3e97e005ce66d02fecf06dfbf6823e6 Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Wed, 29 Jun 2016 09:42:52 -0400 Subject: [PATCH] add the 'rtn' command which provides a static address the network layer --- samples/ReadProperty.py | 16 ++++++++++++++++ samples/ReadWriteProperty.py | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/samples/ReadProperty.py b/samples/ReadProperty.py index a1f3714..482aec2 100755 --- a/samples/ReadProperty.py +++ b/samples/ReadProperty.py @@ -131,6 +131,22 @@ class ReadPropertyConsoleCmd(ConsoleCmd): except Exception as error: ReadPropertyConsoleCmd._exception("exception: %r", error) + def do_rtn(self, args): + """rtn ... """ + args = args.split() + if _debug: ReadPropertyConsoleCmd._debug("do_rtn %r", args) + + # safe to assume only one adapter + adapter = this_application.nsap.adapters[0] + if _debug: ReadPropertyConsoleCmd._debug(" - adapter: %r", adapter) + + # provide the address and a list of network numbers + router_address = Address(args[0]) + network_list = [int(arg) for arg in args[1:]] + + # pass along to the service access point + this_application.nsap.add_router_references(adapter, router_address, network_list) + # # __main__ diff --git a/samples/ReadWriteProperty.py b/samples/ReadWriteProperty.py index e0d913b..9b3a28e 100755 --- a/samples/ReadWriteProperty.py +++ b/samples/ReadWriteProperty.py @@ -214,6 +214,23 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd): except Exception as error: ReadWritePropertyConsoleCmd._exception("exception: %r", error) + def do_rtn(self, args): + """rtn ... """ + args = args.split() + if _debug: ReadWritePropertyConsoleCmd._debug("do_rtn %r", args) + + # safe to assume only one adapter + adapter = this_application.nsap.adapters[0] + if _debug: ReadWritePropertyConsoleCmd._debug(" - adapter: %r", adapter) + + # provide the address and a list of network numbers + router_address = Address(args[0]) + network_list = [int(arg) for arg in args[1:]] + + # pass along to the service access point + this_application.nsap.add_router_references(adapter, router_address, network_list) + + # # __main__ #