Skip to content

Commit

Permalink
Update portchannel_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
anilkpandey committed May 13, 2022
1 parent 7a1d74e commit 0c7f614
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/portchannel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,33 @@ def test_delete_portchannel_which_is_member_of_a_vlan(self):
db = Db()
obj = {'db':db.cfgdb}

# add a portchannel
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005"], obj=obj)
print(result.exit_code)
print(result.output)
assert result.exit_code == 0

# add portchannel to a vlan
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"], ["2000", "PortChannel0001"])
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"], ["2000", "PortChannel0005"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0

# try to delete the portchannel
result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0001"], obj=obj)
result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0005"], obj=obj)
print(result.exit_code)
print(result.output)
assert result.exit_code != 0
assert "PortChannel0001 has vlan Vlan2000 configured, remove vlan membership to proceed" in result.output
assert "PortChannel0005 has vlan Vlan2000 configured, remove vlan membership to proceed" in result.output

# remove portchannel from vlan
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["del"], ["2000", "PortChannel0001"])
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["del"], ["2000", "PortChannel0005"])
print(result.exit_code)
print(result.output)
assert result.exit_code == 0

# delete the portchannel
result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0005"], obj=obj)
print(result.exit_code)
print(result.output)
assert result.exit_code == 0
Expand Down

0 comments on commit 0c7f614

Please sign in to comment.