Skip to content

Commit

Permalink
fixing system test issue where non-existent interface could be selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Lyssenko committed Aug 14, 2024
1 parent 39041bc commit b4c5523
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/lib/systestlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ def sort_dict_by_keys(self, d):


def random_interface(dut, exclude=None):
# interfaces read in 'show run all' and those actually present may differ,
# thus interface list must be picked from the actually present
if not getattr( random_interface, 'present', False ):
random_interface.present = dut.run_commands(
'show interfaces', send_enable=False )[ 0 ][ 'interfaces' ].keys()
exclude = [] if exclude is None else exclude
interfaces = dut.api('interfaces')
names = [name for name in list(interfaces.keys()) if name.startswith('Et')]
names = [ name for name in list(interfaces.keys()) if name.startswith('Et') ]
names = [ name for name in names if name in random_interface.present ]

exclude_interfaces = dut.settings.get('exclude_interfaces', [])
if exclude_interfaces:
Expand Down

0 comments on commit b4c5523

Please sign in to comment.