-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[minigraph]: Add portchannels/vlans dictionary and update teamd templates #408
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,6 +180,7 @@ def parse_dpg(dpg, hname): | |
|
||
pcintfs = child.find(str(QName(ns, "PortChannelInterfaces"))) | ||
pc_intfs = [] | ||
pcs = {} | ||
for pcintf in pcintfs.findall(str(QName(ns, "PortChannel"))): | ||
pcintfname = pcintf.find(str(QName(ns, "Name"))).text | ||
pcintfmbr = pcintf.find(str(QName(ns, "AttachTo"))).text | ||
|
@@ -191,6 +192,7 @@ def parse_dpg(dpg, hname): | |
for addrtuple in pc_map.get(pcintfname, []): | ||
pc_attributes.update(addrtuple) | ||
pc_intfs.append(copy.deepcopy(pc_attributes)) | ||
pcs[pcintfname] = pc_attributes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to keep 'members' (and 'vlanid') information duplicated in both minigraph_xxx_interfaces and minigraph_xxx? Or shall we let minigraph_xxx_interfaces to have only the same information with minigraph_interfaces? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which means, name, alias, addr, mask, subnet, and peer_addr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would vote for removing the duplicated information but not here in this commit. i'll submit a separate pull request to address this as well as adding some unit tests to make sure that the generated configuration files are not changed before/after new code changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. |
||
|
||
lointfs = child.find(str(QName(ns, "LoopbackIPInterfaces"))) | ||
lo_intfs = [] | ||
|
@@ -221,6 +223,7 @@ def parse_dpg(dpg, hname): | |
|
||
vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) | ||
vlan_intfs = [] | ||
vlans = {} | ||
for vintf in vlanintfs.findall(str(QName(ns, "VlanInterface"))): | ||
vintfname = vintf.find(str(QName(ns, "Name"))).text | ||
vlanid = vintf.find(str(QName(ns, "VlanID"))).text | ||
|
@@ -233,9 +236,10 @@ def parse_dpg(dpg, hname): | |
for addrtuple in vlan_map.get(vintfname, []): | ||
vlan_attributes.update(addrtuple) | ||
vlan_intfs.append(copy.deepcopy(vlan_attributes)) | ||
vlans[vintfname] = vlan_attributes | ||
|
||
|
||
return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs | ||
return intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs | ||
return None, None, None, None, None | ||
|
||
def parse_cpg(cpg, hname): | ||
|
@@ -362,6 +366,8 @@ def parse_xml(filename, platform=None): | |
intfs = None | ||
vlan_intfs = None | ||
pc_intfs = None | ||
vlans = None | ||
pcs = None | ||
mgmt_intf = None | ||
lo_intf = None | ||
neighbors = None | ||
|
@@ -386,7 +392,7 @@ def parse_xml(filename, platform=None): | |
|
||
for child in root: | ||
if child.tag == str(QName(ns, "DpgDec")): | ||
(intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs) = parse_dpg(child, hostname) | ||
(intfs, lo_intfs, mgmt_intf, vlan_intfs, pc_intfs, vlans, pcs) = parse_dpg(child, hostname) | ||
elif child.tag == str(QName(ns, "CpgDec")): | ||
(bgp_sessions, bgp_asn) = parse_cpg(child, hostname) | ||
elif child.tag == str(QName(ns, "PngDec")): | ||
|
@@ -409,6 +415,8 @@ def parse_xml(filename, platform=None): | |
results['minigraph_interfaces'] = sorted(intfs, key=lambda x: x['name']) | ||
results['minigraph_vlan_interfaces'] = vlan_intfs | ||
results['minigraph_portchannel_interfaces'] = pc_intfs | ||
results['minigraph_vlans'] = vlans | ||
results['minigraph_portchannels'] = pcs | ||
results['minigraph_mgmt_interface'] = mgmt_intf | ||
results['minigraph_lo_interfaces'] = lo_intfs | ||
results['minigraph_neighbors'] = neighbors | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As PC interfaces are no longer in minigraph_interfaces (actually not in this PR but in #381), I think we need to update zebra.conf.j2 as well to configure bgp on pc interfaces correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated. please check.