Skip to content
Snippets Groups Projects
Commit 25da5b9a authored by Erik Reid's avatar Erik Reid
Browse files

check gigether-options active/inactive for bundle info

parent 47412fc8
No related branches found
No related tags found
1 merge request!24Feature/dboard3 833 handle inactive bundle config
...@@ -232,10 +232,10 @@ def list_interfaces(netconf_config): ...@@ -232,10 +232,10 @@ def list_interfaces(netconf_config):
def _ifc_info(e): def _ifc_info(e):
# warning: this structure should match the default # warning: this structure should match the default
# returned from routes.classifier.juniper_link_info # returned from routes.classifier.juniper_link_info
name = e.find('name') _name = e.find('name')
assert name is not None, "expected interface 'name' child element" assert _name is not None, "expected interface 'name' child element"
ifc = { ifc = {
'name': name.text, 'name': _name.text,
'description': '', 'description': '',
'bundle': [], 'bundle': [],
'speed': '' # set elsewhere but needs to be included to maintain default structure 'speed': '' # set elsewhere but needs to be included to maintain default structure
...@@ -244,12 +244,11 @@ def list_interfaces(netconf_config): ...@@ -244,12 +244,11 @@ def list_interfaces(netconf_config):
if description is not None: if description is not None:
ifc['description'] = description.text ifc['description'] = description.text
for b in i.iterfind(".//bundle"): ifc['bundle'] = e.xpath(
ifc['bundle'].append(b.text) "./gigether-options[not(@inactive='inactive')]"
"/ieee-802.3ad[not(@inactive='inactive')]/bundle/text()")
ifc['ipv4'] = e.xpath('./family/inet/address/name/text()') ifc['ipv4'] = e.xpath('./family/inet/address/name/text()')
ifc['ipv6'] = e.xpath('./family/inet6/address/name/text()') ifc['ipv6'] = e.xpath('./family/inet6/address/name/text()')
return ifc return ifc
def _inactive(interface_node): def _inactive(interface_node):
......
...@@ -110,6 +110,14 @@ def test_DBOARD3_833(): ...@@ -110,6 +110,14 @@ def test_DBOARD3_833():
with open(test_filename, 'r') as f: with open(test_filename, 'r') as f:
netconf_config = etree.XML(f.read()) netconf_config = etree.XML(f.read())
interfaces = {i['name']: i for i in juniper.list_interfaces(netconf_config)} interfaces = {
i['name']: i for i in juniper.list_interfaces(netconf_config)}
assert not interfaces['et-4/0/2']['bundle'] assert not interfaces['et-4/0/2']['bundle']
assert not interfaces['et-4/0/2.0']['bundle'] assert not interfaces['et-4/0/2.0']['bundle']
# additional sanity check: parent bundle should be empty or exactly one
for ifc in interfaces.values():
assert len(ifc['bundle']) in (0, 1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment