Skip to content

Commit

Permalink
[test]: Clean up LAGs after finishing the test (sonic-net#666)
Browse files Browse the repository at this point in the history
After the creation of the LAG and the LAG member, clean
the application database and verify that the LAG and member
are removed from the ASIC database.

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
  • Loading branch information
Shuotian Cheng authored Nov 1, 2018
1 parent 863b69c commit 44a4460
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/test_portchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ def test_PortChannel(dvs, testlog):

time.sleep(1)

# check asic db table
# check asic db
asicdb = swsscommon.DBConnector(1, dvs.redis_sock, 0)

lagtbl = swsscommon.Table(asicdb, "ASIC_STATE:SAI_OBJECT_TYPE_LAG")

lags = lagtbl.getKeys()
assert len(lags) == 1

lagmtbl = swsscommon.Table(asicdb, "ASIC_STATE:SAI_OBJECT_TYPE_LAG_MEMBER")

lagms = lagmtbl.getKeys()
assert len(lagms) == 1

Expand All @@ -41,3 +39,20 @@ def test_PortChannel(dvs, testlog):
assert dvs.asicdb.portoidmap[fv[1]] == "Ethernet0"
else:
assert False

# remove port channel member
ps = swsscommon.ProducerStateTable(db, "LAG_MEMBER_TABLE")
ps._del("PortChannel0001:Ethernet0")

# remove port channel
ps = swsscommon.ProducerStateTable(db, "LAG_TABLE")
ps._del("PortChannel0001")

time.sleep(1)

# check asic db
lags = lagtbl.getKeys()
assert len(lags) == 0

lagms = lagmtbl.getKeys()
assert len(lagms) == 0

0 comments on commit 44a4460

Please sign in to comment.