Skip to content

Commit

Permalink
check for vxlan mapping before removing vlan
Browse files Browse the repository at this point in the history
check for vxlan mapping before removing vlan
  • Loading branch information
ITJamie authored Sep 20, 2022
1 parent 0a7557b commit 348eff3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def del_vlan(db, vid):

if keys:
ctx.fail("VLAN ID {} can not be removed. First remove all members assigned to this VLAN.".format(vid))

vxlan_table = db.cfgdb.get_table('VXLAN_TUNNEL_MAP')
for vxmap_key, vxmap_data in vxlan_table.items():
if vxmap_data['vlan'] == 'Vlan{}'.format(vid):
ctx.fail("vlan: {} can not be removed. First remove vxlan mapping '{}' assigned to VLAN".format(vid, '|'.join(vxmap_key)) )

db.cfgdb.set_entry('VLAN', 'Vlan{}'.format(vid), None)

Expand Down

0 comments on commit 348eff3

Please sign in to comment.