sonic-buildimage/platform/vs/tests/teamd/test_portchannel.py
Shuotian Cheng ecca7e9697 [vs]: Add time.sleep(1) to make test stable (#2274)
time.sleep(1) after running the command to enslave member port

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
2018-11-19 12:03:57 -08:00

38 lines
1.1 KiB
Python

from swsscommon import swsscommon
import time
import re
import json
def test_PortChannel(dvs, testlog):
appldb = swsscommon.DBConnector(0, dvs.redis_sock, 0)
statdb = swsscommon.DBConnector(6, dvs.redis_sock, 0)
# create the lag
dvs.runcmd("config portchannel add PortChannel0001")
time.sleep(1)
# test lag table in appl db
tbl = swsscommon.Table(appldb, "LAG_TABLE")
(status, fvs) = tbl.get("PortChannel0001")
assert status == True
# test lag table in state db
tbl = swsscommon.Table(statdb, "LAG_TABLE")
(status, fvs) = tbl.get("PortChannel0001")
assert status == True
# create the lag member
dvs.runcmd("config portchannel member add PortChannel0001 Ethernet112")
time.sleep(1)
# test lag member table in appl db
tbl = swsscommon.Table(appldb, "LAG_MEMBER_TABLE")
(status, fvs) = tbl.get("PortChannel0001:Ethernet112")
assert status == True
# remove the lag member
dvs.runcmd("config portchannel member del PortChannel0001 Ethernet112")
# remove the lag
dvs.runcmd("config portchannel del PortChannel0001")