Skip to content

Commit

Permalink
[vlan] Add pytest case to add max vlan. (sonic-net#881)
Browse files Browse the repository at this point in the history
* [vlan] Add pytest case to add max vlan.

Signed-off-by: Emma Lin <emma_lin@edge-core.com>
  • Loading branch information
linemma authored and lguohan committed May 16, 2019
1 parent 95c197d commit 6f220e9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,30 @@ def test_AddVlanWithIncorrectValueType(self, dvs, testlog, test_input, expected)
#remove vlan
self.remove_vlan(vlan)

def test_AddMaxVlan(self, dvs, testlog):
self.setup_db(dvs)

min_vid = 2
max_vid = 4094

# create max vlan
vlan = min_vid
while vlan <= max_vid:
self.create_vlan(str(vlan))
vlan += 1

# check asic database
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN")
vlan_entries = [k for k in tbl.getKeys() if k != dvs.asicdb.default_vlan_id]
assert len(vlan_entries) == (4094-1)

# remove all vlan
vlan = min_vid
while vlan <= max_vid:
self.remove_vlan(str(vlan))
vlan += 1

# check asic database
tbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_VLAN")
vlan_entries = [k for k in tbl.getKeys() if k != dvs.asicdb.default_vlan_id]
assert len(vlan_entries) == 0

0 comments on commit 6f220e9

Please sign in to comment.