Skip to content

Commit

Permalink
Fix for adding L3 interface to Vlan group (sonic-net#826)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Bitton <shlomibi@mellanox.com>
  • Loading branch information
shlomibitton authored Mar 24, 2020
1 parent 668c116 commit 6e3679b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ def add_vlan_member(ctx, vid, interface_name, untagged):
db = ctx.obj['db']
vlan_name = 'Vlan{}'.format(vid)
vlan = db.get_entry('VLAN', vlan_name)
interface_table = db.get_table('INTERFACE')

if get_interface_naming_mode() == "alias":
interface_name = interface_alias_to_name(interface_name)
Expand All @@ -1084,6 +1085,10 @@ def add_vlan_member(ctx, vid, interface_name, untagged):
else:
ctx.fail("{} is already a member of {}".format(interface_name,
vlan_name))
for entry in interface_table:
if (interface_name == entry[0]):
ctx.fail("{} is a L3 interface!".format(interface_name))

members.append(interface_name)
vlan['members'] = members
db.set_entry('VLAN', vlan_name, vlan)
Expand Down

0 comments on commit 6e3679b

Please sign in to comment.