Hi,
could figure it out by myself:
this doesn't work because getSubDevices in class ipnetworks doesn't work:
net=context.getSubNetworks():
for dev in net.getSubDevices():
loc=dev. getLocationName()
The primary root cause is: there are no objects of type "device" linked from an ipnetwork but objects of type ipaddress - and ipaddresses are linked to interfaces - and interfaces are linked to devices. So I have to trace this chain to get a location for an ipnetwork:
ipnetwork -> ipadress -> interface -> device -> location
def findLocation(net):
location="unknown"
for ipaddress in net.ipaddresses.objectValuesGen():
dev=ipaddress.device()
if dev:
location=dev.getLocationName()
return location
regards,
Christian