Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Myron Sosyak committed Jul 14, 2022
1 parent e0ba9f6 commit c38790c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/dvslib/dvs_lag.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, adb, cdb, dvs):

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

def remove_port_channel(self, lag_id):
Expand Down
32 changes: 15 additions & 17 deletions tests/test_portchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,25 @@ def test_Portchannel(self, dvs, testlog):
lagms = lagmtbl.getKeys()
assert len(lagms) == 0

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

# Create PortChannels
for portchannel in portchannels:
self.dvs_lag.create_port_channel(portchannel[0], fast_rate=portchannel[2])
self.dvs_lag.get_and_verify_port_channel(len(portchannels))
# Create PortChannel
self.dvs_lag.create_port_channel(po_id, fast_rate=fast_rate)
self.dvs_lag.get_and_verify_port_channel(1)

# Add members to PortChannels
for portchannel in portchannels:
self.dvs_lag.create_port_channel_member(portchannel[0], portchannel[1])
self.dvs_lag.get_and_verify_port_channel_members(len(portchannels))
# Add member to PortChannel
self.dvs_lag.create_port_channel_member(po_id, po_member)
self.dvs_lag.get_and_verify_port_channel_members(1)

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

# remove PortChannel members
for portchannel in portchannels:
self.dvs_lag.remove_port_channel(portchannel[0])
# remove PortChannel
self.dvs_lag.create_port_channel_member(po_id, po_member)
self.dvs_lag.remove_port_channel(po_id)
self.dvs_lag.get_and_verify_port_channel(0)


Expand Down

0 comments on commit c38790c

Please sign in to comment.