Hide disabled ports and ports on disabled devices

This commit is contained in:
Benjamin Collet 2018-03-13 09:15:23 +01:00
parent 13d7c782ed
commit 9bac5487ef

View file

@ -44,8 +44,12 @@ def search_ports(args):
return return
for port in data['ports'].itervalues(): for port in data['ports'].itervalues():
print "=" * 80
device = call_api(params, 'devices/%s' % port['device_id']) device = call_api(params, 'devices/%s' % port['device_id'])
if device['device']['disabled'] == "1": continue
if port['disabled'] == "1": continue
print "=" * 80
print_data("Device", device['device']['hostname']) print_data("Device", device['device']['hostname'])
print_data("", "%s/device/device=%s" % (params['base_url'], port['device_id'])) print_data("", "%s/device/device=%s" % (params['base_url'], port['device_id']))
print_data("Port", port['port_label_short']) print_data("Port", port['port_label_short'])