Skip to content

Commit

Permalink
[test]: test vlan tag for vlan member port (sonic-net#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
lguohan authored Dec 7, 2017
1 parent ff90429 commit 833178e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def __init__(self, dvs):
# build port oid to front port name mapping
self.portoidmap = {}
self.portnamemap = {}
self.hostifoidmap = {}
self.hostifnamemap = {}
atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF")
keys = atbl.getKeys()

Expand All @@ -41,6 +43,8 @@ def __init__(self, dvs):

self.portoidmap[port_oid] = port_name
self.portnamemap[port_name] = port_oid
self.hostifoidmap[k] = port_name
self.hostifnamemap[port_name] = k

# get default acl table and acl rules
atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_TABLE")
Expand Down
10 changes: 10 additions & 0 deletions tests/test_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@ def test_VlanMemberCreation(dvs):
for fv in fvs:
if fv[0] == "SAI_PORT_ATTR_PORT_VLAN_ID":
assert fv[1] == "2"

# check vlan tag for the host interface
atbl = swsscommon.Table(adb, "ASIC_STATE:SAI_OBJECT_TYPE_HOSTIF")
(status, fvs) = atbl.get(dvs.asicdb.hostifnamemap["Ethernet0"])
assert status == True

assert "SAI_HOSTIF_ATTR_VLAN_TAG" in [fv[0] for fv in fvs]
for fv in fvs:
if fv[0] == "SAI_HOSTIF_ATTR_VLAN_TAG":
assert fv[1] == "SAI_HOSTIF_VLAN_TAG_KEEP"

0 comments on commit 833178e

Please sign in to comment.