mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-18 19:14:54 +00:00
scenario.py: Improve is_port_phantom logic in case there are two ports with one name in the output
Print out the name of the port which is phantom (if applicable) Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -60,9 +60,16 @@ class LoadScenario(Realm):
|
|||||||
return False
|
return False
|
||||||
port = self.name_to_eid(port_eid)
|
port = self.name_to_eid(port_eid)
|
||||||
port_data = self.json_get('/ports/%s/%s/%s' % (port[0], port[1], port[2]))
|
port_data = self.json_get('/ports/%s/%s/%s' % (port[0], port[1], port[2]))
|
||||||
if port_data['interface']['phantom']:
|
if 'interface' in port_data.keys():
|
||||||
print('%s is phantom' % port_eid)
|
if port_data['interface']['phantom']:
|
||||||
return True
|
print('%s is phantom' % port_eid)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
for port in port_data['interfaces']:
|
||||||
|
if port['phantom']:
|
||||||
|
print('%s is phantom' % port)
|
||||||
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def start_test(self):
|
def start_test(self):
|
||||||
@@ -165,10 +172,9 @@ def main():
|
|||||||
timeout=args.timeout,
|
timeout=args.timeout,
|
||||||
debug=args.debug)
|
debug=args.debug)
|
||||||
if args.check_phantom:
|
if args.check_phantom:
|
||||||
print(args.check_phantom)
|
|
||||||
for port in args.check_phantom:
|
for port in args.check_phantom:
|
||||||
if scenario.is_port_phantom(port):
|
if scenario.is_port_phantom(port):
|
||||||
print('Phantom ports detected')
|
print('%s is phantom' % port)
|
||||||
|
|
||||||
if args.quit_on_phantom:
|
if args.quit_on_phantom:
|
||||||
if scenario.are_any_ports_phantom():
|
if scenario.are_any_ports_phantom():
|
||||||
|
|||||||
Reference in New Issue
Block a user