1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

add the 'rtn' command which provides a static address the network layer

This commit is contained in:
Joel Bender 2016-06-29 09:42:52 -04:00
parent 219607336d
commit e624d40fb3
2 changed files with 33 additions and 0 deletions

View File

@ -131,6 +131,22 @@ class ReadPropertyConsoleCmd(ConsoleCmd):
except Exception as error: except Exception as error:
ReadPropertyConsoleCmd._exception("exception: %r", error) ReadPropertyConsoleCmd._exception("exception: %r", error)
def do_rtn(self, args):
"""rtn <addr> <net> ... """
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__ # __main__

View File

@ -214,6 +214,23 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
except Exception as error: except Exception as error:
ReadWritePropertyConsoleCmd._exception("exception: %r", error) ReadWritePropertyConsoleCmd._exception("exception: %r", error)
def do_rtn(self, args):
"""rtn <addr> <net> ... """
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__ # __main__
# #