2018-05-17 13:12:59 -05:00
|
|
|
from swsscommon import swsscommon
|
|
|
|
import time
|
|
|
|
import re
|
|
|
|
import json
|
|
|
|
|
|
|
|
def test_PortChannel(dvs):
|
2018-11-02 21:22:05 -05:00
|
|
|
appldb = swsscommon.DBConnector(0, dvs.redis_sock, 0)
|
|
|
|
statdb = swsscommon.DBConnector(6, dvs.redis_sock, 0)
|
2018-05-17 13:12:59 -05:00
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# create the lag
|
|
|
|
dvs.runcmd("config portchannel add PortChannel0001")
|
2018-05-17 13:12:59 -05:00
|
|
|
time.sleep(1)
|
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# test lag table in appl db
|
|
|
|
tbl = swsscommon.Table(appldb, "LAG_TABLE")
|
2018-05-17 13:12:59 -05:00
|
|
|
(status, fvs) = tbl.get("PortChannel0001")
|
2018-11-02 21:22:05 -05:00
|
|
|
assert status == True
|
2018-05-17 13:12:59 -05:00
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# test lag table in state db
|
|
|
|
tbl = swsscommon.Table(statdb, "LAG_TABLE")
|
|
|
|
(status, fvs) = tbl.get("PortChannel0001")
|
2018-05-17 13:12:59 -05:00
|
|
|
assert status == True
|
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# create the lag member
|
|
|
|
dvs.runcmd("config portchannel member add PortChannel0001 Ethernet112")
|
2018-05-17 13:12:59 -05:00
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# test lag member table in appl db
|
|
|
|
tbl = swsscommon.Table(appldb, "LAG_MEMBER_TABLE")
|
2018-05-17 13:12:59 -05:00
|
|
|
(status, fvs) = tbl.get("PortChannel0001:Ethernet112")
|
|
|
|
assert status == True
|
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# remove the lag member
|
|
|
|
dvs.runcmd("config portchannel member del PortChannel0001 Ethernet112")
|
2018-05-17 13:12:59 -05:00
|
|
|
|
2018-11-02 21:22:05 -05:00
|
|
|
# remove the lag
|
|
|
|
dvs.runcmd("config portchannel del PortChannel0001")
|