Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config][mclag] Fix import statement in mclag.py #2073

Merged
merged 3 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/mclag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!!")

Expand Down
20 changes: 20 additions & 0 deletions tests/mclag_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down