Skip to content
Snippets Groups Projects
Commit 91572be9 authored by Robert Latta's avatar Robert Latta
Browse files

added bundle(e.g. ae10) interface is a member of

parent c99e4212
No related branches found
No related tags found
No related merge requests found
......@@ -213,12 +213,16 @@ def list_interfaces(netconf_config):
assert name is not None, "expected interface 'name' child element"
ifc = {
'name': name.text,
'description': ''
'description': '',
'bundle': []
}
description = e.find('description')
if description is not None:
ifc['description'] = description.text
for b in i.iterfind(".//bundle"):
ifc['bundle'].append(b.text)
ifc['ipv4'] = e.xpath('./family/inet/address/name/text()')
ifc['ipv6'] = e.xpath('./family/inet6/address/name/text()')
......
......@@ -337,10 +337,23 @@ def refresh_juniper_interface_list(hostname, netconf):
for k in r.keys('netconf-interfaces:%s:*' % hostname):
r.delete(k)
for k in r.keys('netconf-interface-bundles:%s:*' % hostname):
r.delete(k)
all_bundles = defaultdict(list)
for ifc in juniper.list_interfaces(netconf):
bundles = ifc.get('bundle', None)
for bundle in bundles:
if bundle:
all_bundles[bundle].append(ifc['name'])
r.set(
'netconf-interfaces:%s:%s' % (hostname, ifc['name']),
json.dumps(ifc))
for k, v in all_bundles.items():
r.set(
'netconf-interface-bundles:%s:%s' % (hostname, k),
json.dumps(v))
@app.task(base=InventoryTask, bind=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment