[test]: Update VS portchannel tests to remove static conf file (#2219)

Currently, the teamd configuration is no longer used in SONiC. The
configuration is dynamically generated and stored in the configuration
database, which is picked up by the teammgrd.

To create new portchannels, and the members, the command:
config portchannel add
config portchannel member add
are used.

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
This commit is contained in:
Shuotian Cheng 2018-11-02 19:22:05 -07:00 committed by lguohan
parent 8b67424101
commit 8b5892f6d6
2 changed files with 21 additions and 36 deletions

View File

@ -1,14 +0,0 @@
{
"device": "PortChannel0001",
"hwaddr": "ec:f4:bb:fe:80:90",
"runner": {
"name": "loadbalance",
"tx_hash": ["eth", "ipv4", "ipv6"]
},
"link_watch": {
"name": "ethtool"
},
"ports": {
"Ethernet112": {}
}
}

View File

@ -4,34 +4,33 @@ import re
import json
def test_PortChannel(dvs):
appldb = swsscommon.DBConnector(0, dvs.redis_sock, 0)
statdb = swsscommon.DBConnector(6, dvs.redis_sock, 0)
dvs.copy_file("/etc/teamd/", "teamd/files/po01.conf")
dvs.runcmd("teamd -f /etc/teamd/po01.conf -d")
dvs.runcmd("ifconfig PortChannel0001 up")
# create the lag
dvs.runcmd("config portchannel add PortChannel0001")
time.sleep(1)
# test lag table in app db
appdb = swsscommon.DBConnector(0, dvs.redis_sock, 0)
tbl = swsscommon.Table(appdb, "LAG_TABLE")
# test lag table in appl db
tbl = swsscommon.Table(appldb, "LAG_TABLE")
(status, fvs) = tbl.get("PortChannel0001")
assert status == True
# test lag member table in app db
tbl = swsscommon.Table(appdb, "LAG_MEMBER_TABLE")
(status, fvs) = tbl.get("PortChannel0001:Ethernet112")
assert status == True
# test lag table in state db
confdb = swsscommon.DBConnector(6, dvs.redis_sock, 0)
tbl = swsscommon.Table(confdb, "LAG_TABLE")
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")
# 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")