From 5a40909d06e29cd11d5651f0e4d55121fb0843ea Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Wed, 31 Oct 2018 17:50:10 -0700 Subject: [PATCH] [test]: Update VS portchannel tests to remove static conf file 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 --- platform/vs/tests/teamd/files/po01.conf | 14 -------- platform/vs/tests/teamd/test_portchannel.py | 37 ++++++++++----------- 2 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 platform/vs/tests/teamd/files/po01.conf diff --git a/platform/vs/tests/teamd/files/po01.conf b/platform/vs/tests/teamd/files/po01.conf deleted file mode 100644 index c2a1a4652aa2..000000000000 --- a/platform/vs/tests/teamd/files/po01.conf +++ /dev/null @@ -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": {} - } -} diff --git a/platform/vs/tests/teamd/test_portchannel.py b/platform/vs/tests/teamd/test_portchannel.py index 820651c1be65..7ce7fc6c41bb 100644 --- a/platform/vs/tests/teamd/test_portchannel.py +++ b/platform/vs/tests/teamd/test_portchannel.py @@ -4,34 +4,33 @@ 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 table in state db + tbl = swsscommon.Table(statdb, "LAG_TABLE") + (status, fvs) = tbl.get("PortChannel0001") assert status == True - # test lag member table in app db - tbl = swsscommon.Table(appdb, "LAG_MEMBER_TABLE") + # 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 - # test lag table in state db - confdb = swsscommon.DBConnector(6, dvs.redis_sock, 0) - - tbl = swsscommon.Table(confdb, "LAG_TABLE") + # remove the lag member + dvs.runcmd("config portchannel member del PortChannel0001 Ethernet112") - (status, fvs) = tbl.get("PortChannel0001") - - assert status == True + # remove the lag + dvs.runcmd("config portchannel del PortChannel0001")