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

handy to have a router to multiple networks

This commit is contained in:
Joel Bender 2021-08-13 17:56:55 -04:00
parent 172070fc85
commit c6fca99764

View File

@ -222,7 +222,7 @@ def main():
)
# add an argument for interval
parser.add_argument('net2', type=int,
parser.add_argument('net2', type=int, nargs='+',
help='network number of second network',
)
@ -252,11 +252,18 @@ def main():
local_address = Address(args.addr1)
local_network = args.net1
vlan_network = args.net2
# create the VLAN router, bind it to the local network
router = VLANRouter(local_address, local_network)
# add the dynamic property list
if args.plist:
RandomAnalogValueObject.properties.append(CurrentPropertyList())
# register it now that all its properties are defined
register_object_type(RandomAnalogValueObject, vendor_id=999)
for vlan_network in args.net2:
# create a VLAN
vlan = Network(broadcast_address=LocalBroadcast())
@ -271,13 +278,6 @@ def main():
# send network topology
deferred(router.nse.i_am_router_to_network)
# add the dynamic property list
if args.plist:
RandomAnalogValueObject.properties.append(CurrentPropertyList())
# register it now that all its properties are defined
register_object_type(RandomAnalogValueObject, vendor_id=999)
# make some devices
for device_number in range(2, 2 + args.count):
# device identifier is assigned from the address