Skip to content

Commit

Permalink
fixed vlan number randomizer
Browse files Browse the repository at this point in the history
call `random_int(2, 4095)` may deliver by chance 4095. However, in EOS the vlan range is only supported up to 4094 and upon higher number causes the vlan command failure.
  • Loading branch information
dlyssenko authored Sep 16, 2024
1 parent 43e1210 commit 789f0df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/system/test_api_vlans.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_delete_and_return_false(self):

def test_default(self):
for dut in self.duts:
vid = str(random_int(2, 4095))
vid = str(random_int(2, 4094))
name = random_string(maxchar=20)
dut.config(['no vlan %s' % vid, 'vlan %s' % vid,
'vlan %s' % vid, 'name %s' % name])
Expand All @@ -99,7 +99,7 @@ def test_default(self):
def test_set_name(self):
for dut in self.duts:
name = random_string(maxchar=20)
vid = str(random_int(2, 4095))
vid = str(random_int(2, 4094))
dut.config(['no vlan %s' % vid, 'vlan %s' % vid])
result = dut.api('vlans').set_name(vid, name)
self.assertTrue(result, 'dut=%s' % dut)
Expand All @@ -109,7 +109,7 @@ def test_set_name(self):

def test_set_state_active(self):
for dut in self.duts:
vid = str(random_int(2, 4095))
vid = str(random_int(2, 4094))
dut.config(['no vlan %s' % vid, 'vlan %s' % vid, 'state suspend'])
result = dut.api('vlans').set_state(vid, 'active')
self.assertTrue(result, 'dut=%s' % dut)
Expand All @@ -119,7 +119,7 @@ def test_set_state_active(self):

def test_set_state_suspend(self):
for dut in self.duts:
vid = str(random_int(2, 4095))
vid = str(random_int(2, 4094))
dut.config(['no vlan %s' % vid, 'vlan %s' % vid, 'state active'])
result = dut.api('vlans').set_state(vid, 'suspend')
self.assertTrue(result, 'dut=%s' % dut)
Expand Down

0 comments on commit 789f0df

Please sign in to comment.