From 3c5cfde20a161c1496576c8f97789cd76995693b Mon Sep 17 00:00:00 2001 From: Myron Sosyak Date: Wed, 16 Feb 2022 09:05:22 -0800 Subject: [PATCH] Fix import statement in mclag.py --- config/mclag.py | 2 +- tests/mclag_test.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config/mclag.py b/config/mclag.py index 2a585d07fa..589bb61a20 100644 --- a/config/mclag.py +++ b/config/mclag.py @@ -85,7 +85,7 @@ def is_ipv4_addr_valid(addr): def check_if_interface_is_valid(db, interface_name): - from main import interface_name_is_valid + from .main import interface_name_is_valid if interface_name_is_valid(db,interface_name) is False: ctx.fail("Interface name is invalid. Please enter a valid interface name!!") diff --git a/tests/mclag_test.py b/tests/mclag_test.py index 2d10c0ae07..d68c25a82e 100644 --- a/tests/mclag_test.py +++ b/tests/mclag_test.py @@ -42,6 +42,9 @@ MCLAG_INVALID_SESSION_TMOUT_LBOUND = "2" MCLAG_INVALID_SESSION_TMOUT_UBOUND = "4000" +MCLAG_VALID_PEER_LINK_PORT = "Ethernet0" +MCLAG_VALID_PEER_LINK_PORTCHANNEL = "PortChannel1000" + MCLAG_INVALID_MCLAG_MEMBER = "Ethernet4" MCLAG_INVALID_PORTCHANNEL1 = "portchannel" MCLAG_INVALID_PORTCHANNEL2 = "PortChannelabcd" @@ -142,6 +145,23 @@ def test_add_mclag_with_invalid_peer_mcast_ip(self): result = runner.invoke(config.config.commands["mclag"].commands["add"], [MCLAG_DOMAIN_ID, MCLAG_SRC_IP, MCLAG_INVALID_PEER_IP2, MCLAG_PEER_LINK], obj=obj) assert result.exit_code != 0, "mclag invalid peer ip mcast test caase with code {}:{} Output:{}".format(type(result.exit_code), result.exit_code, result.output) + def test_add_mclag_with_valid_peer_link(self): + runner = CliRunner() + db = Db() + obj = {'db':db.cfgdb} + + # add mclag with valid port peer link + result = runner.invoke(config.config.commands["mclag"].commands["add"], [MCLAG_DOMAIN_ID, MCLAG_SRC_IP, MCLAG_PEER_IP, MCLAG_VALID_PEER_LINK_PORT], obj=obj) + assert result.exit_code == 0, "mclag valid peer link test case with code {}:{} Output:{}".format(type(result.exit_code), result.exit_code, result.output) + + runner = CliRunner() + db = Db() + obj = {'db':db.cfgdb} + + # add mclag with valid portchannel peer link + result = runner.invoke(config.config.commands["mclag"].commands["add"], [MCLAG_DOMAIN_ID, MCLAG_SRC_IP, MCLAG_PEER_IP, MCLAG_VALID_PEER_LINK_PORTCHANNEL], obj=obj) + assert result.exit_code == 0, "mclag valid peer link test case with code {}:{} Output:{}".format(type(result.exit_code), result.exit_code, result.output) + def test_add_mclag_with_invalid_peer_link(self): runner = CliRunner() db = Db()