Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions config/vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def add_vlan_member(db, vid, port, untagged):
(not is_port and clicommon.is_pc_router_interface(db.cfgdb, port)):
ctx.fail("{} is a router interface!".format(port))

portchannel_member_table = db.cfgdb.get_table('PORTCHANNEL_MEMBER')

if (is_port and clicommon.interface_is_in_portchannel(portchannel_member_table, port)):
ctx.fail("{} is part of portchannel!".format(port))

if (clicommon.interface_is_untagged_member(db.cfgdb, port) and untagged):
ctx.fail("{} is already untagged member!".format(port))

Expand Down
10 changes: 10 additions & 0 deletions tests/vlan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,16 @@ def test_config_set_router_port_on_member_interface(self):
assert result.exit_code == 0
assert 'Interface Ethernet4 is a member of vlan' in result.output

def test_config_vlan_add_member_of_portchannel(self):
runner = CliRunner()
db = Db()

result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"], \
["1000", "Ethernet32", "--untagged"], obj=db)
print(result.exit_code)
print(result.output)
assert result.exit_code != 0
assert "Error: Ethernet32 is part of portchannel!" in result.output

@classmethod
def teardown_class(cls):
Expand Down