Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VLAN_INTERFACE attach issue upon vlan id-name mismatch #1367

Merged
merged 3 commits into from
Feb 7, 2018
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def parse_dpg(dpg, hname):
vlan_attributes['dhcp_servers'] = vdhcpserver_list

sonic_vlan_name = "Vlan%s" % vlanid
if sonic_vlan_name != vintfname:
vlan_attributes['alias'] = vintfname
vlans[sonic_vlan_name] = vlan_attributes

aclintfs = child.find(str(QName(ns, "AclInterfaces")))
Expand Down Expand Up @@ -398,9 +400,13 @@ def parse_xml(filename, platform=None, port_config_file=None):
phyport_intfs = {}
vlan_intfs = {}
pc_intfs = {}
vlan_invert_mapping = dict([[v['alias'],k] for k,v in vlans.items() if v.has_key('alias')])
Copy link
Contributor

@pavel-shirshov pavel-shirshov Feb 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be written as following

vlan_invert_mapping = {v['alias']: k for k, v in vlans.items() if v.has_key('alias')}
``` #Resolved


for intf in intfs:
if intf[0][0:4] == 'Vlan':
vlan_intfs[intf] = {}
elif vlan_invert_mapping.has_key(intf[0]):
vlan_intfs[(vlan_invert_mapping[intf[0]], intf[1])] = {}
elif intf[0][0:11] == 'PortChannel':
pc_intfs[intf] = {}
else:
Expand Down