Skip to content

Commit dc6f190

Browse files
committed
Fix VLAN_INTERFACE attach issue upon vlan id-name mismatch
1 parent b34bd1f commit dc6f190

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sonic-config-engine/minigraph.py

+6
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def parse_dpg(dpg, hname):
177177
vlan_attributes['dhcp_servers'] = vdhcpserver_list
178178

179179
sonic_vlan_name = "Vlan%s" % vlanid
180+
if sonic_vlan_name != vintfname:
181+
vlan_attributes['alias'] = vintfname
180182
vlans[sonic_vlan_name] = vlan_attributes
181183

182184
aclintfs = child.find(str(QName(ns, "AclInterfaces")))
@@ -398,9 +400,13 @@ def parse_xml(filename, platform=None, port_config_file=None):
398400
phyport_intfs = {}
399401
vlan_intfs = {}
400402
pc_intfs = {}
403+
vlan_invert_mapping = dict([[v['alias'],k] for k,v in vlans.items() if v.has_key('alias')])
404+
401405
for intf in intfs:
402406
if intf[0][0:4] == 'Vlan':
403407
vlan_intfs[intf] = {}
408+
elif vlan_invert_mapping.has_key(intf[0]):
409+
vlan_intfs[(vlan_invert_mapping[intf[0]], intf[1])] = {}
404410
elif intf[0][0:11] == 'PortChannel':
405411
pc_intfs[intf] = {}
406412
else:

0 commit comments

Comments
 (0)