Skip to content

Commit c38790c

Browse files
author
Myron Sosyak
committed
Fix test
1 parent e0ba9f6 commit c38790c

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

tests/dvslib/dvs_lag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self, adb, cdb, dvs):
88

99
def create_port_channel(self, lag_id, admin_status="up", mtu="1500", fast_rate=False):
1010
lag = "PortChannel{}".format(lag_id)
11-
lag_entry = {"admin_status": admin_status, "mtu": mtu, "fast_rate": str(fast_rate)}
11+
lag_entry = {"admin_status": admin_status, "mtu": mtu, "fast_rate": str(fast_rate).lower()}
1212
self.config_db.create_entry("PORTCHANNEL", lag, lag_entry)
1313

1414
def remove_port_channel(self, lag_id):

tests/test_portchannel.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,25 @@ def test_Portchannel(self, dvs, testlog):
9191
lagms = lagmtbl.getKeys()
9292
assert len(lagms) == 0
9393

94-
def test_Portchannel_fast_rate(self, dvs, testlog):
95-
portchannels = [("0003", "Ethernet16", False),
96-
("0004", "Ethernet20", True)]
94+
@pytest.mark.parametrize("fast_rate", ["Fasle", "True"])
95+
def test_Portchannel_fast_rate(self, dvs, testlog, fast_rate):
96+
po_id = "0003"
97+
po_member = "Ethernet16"
9798

98-
# Create PortChannels
99-
for portchannel in portchannels:
100-
self.dvs_lag.create_port_channel(portchannel[0], fast_rate=portchannel[2])
101-
self.dvs_lag.get_and_verify_port_channel(len(portchannels))
99+
# Create PortChannel
100+
self.dvs_lag.create_port_channel(po_id, fast_rate=fast_rate)
101+
self.dvs_lag.get_and_verify_port_channel(1)
102102

103-
# Add members to PortChannels
104-
for portchannel in portchannels:
105-
self.dvs_lag.create_port_channel_member(portchannel[0], portchannel[1])
106-
self.dvs_lag.get_and_verify_port_channel_members(len(portchannels))
103+
# Add member to PortChannel
104+
self.dvs_lag.create_port_channel_member(po_id, po_member)
105+
self.dvs_lag.get_and_verify_port_channel_members(1)
107106

108-
# test fast rate was not set on portchannel_slow
109-
for portchannel in portchannels:
110-
self.dvs_lag.get_and_verify_port_channel_fast_rate(portchannel[0], portchannel[2])
107+
# test fast rate configuration
108+
self.dvs_lag.get_and_verify_port_channel_fast_rate(po_id, fast_rate)
111109

112-
# remove PortChannel members
113-
for portchannel in portchannels:
114-
self.dvs_lag.remove_port_channel(portchannel[0])
110+
# remove PortChannel
111+
self.dvs_lag.create_port_channel_member(po_id, po_member)
112+
self.dvs_lag.remove_port_channel(po_id)
115113
self.dvs_lag.get_and_verify_port_channel(0)
116114

117115

0 commit comments

Comments
 (0)