Skip to content
Snippets Groups Projects
Commit 2798ae5c authored by Sam Roberts's avatar Sam Roberts
Browse files

Merge branch 'develop' into hotfix/POL1-753-timeout-and-none

parents 9d47b351 e9277c75
No related branches found
No related tags found
1 merge request!23address issues with some speeds not being recognised, a timeout issue not...
......@@ -233,10 +233,10 @@ def list_interfaces(netconf_config):
def _ifc_info(e):
# warning: this structure should match the default
# returned from routes.classifier.juniper_link_info
name = e.find('name')
assert name is not None, "expected interface 'name' child element"
_name = e.find('name')
assert _name is not None, "expected interface 'name' child element"
ifc = {
'name': name.text,
'name': _name.text,
'description': '',
'bundle': [],
'speed': '' # set elsewhere but needs to be included to maintain default structure
......@@ -245,12 +245,11 @@ def list_interfaces(netconf_config):
if description is not None:
ifc['description'] = description.text
for b in i.iterfind(".//bundle"):
ifc['bundle'].append(b.text)
ifc['bundle'] = e.xpath(
"./gigether-options[not(@inactive='inactive')]"
"/ieee-802.3ad[not(@inactive='inactive')]/bundle/text()")
ifc['ipv4'] = e.xpath('./family/inet/address/name/text()')
ifc['ipv6'] = e.xpath('./family/inet6/address/name/text()')
return ifc
def _inactive(interface_node):
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
import ast
import netifaces
import ipaddress
import os
from lxml import etree
import pytest
from inventory_provider import juniper
......@@ -89,3 +91,32 @@ def test_asn_to_int_functionality():
with pytest.raises(ValueError):
asn_to_int('66512.2')
asn_to_int('Test')
def test_DBOARD3_833():
"""Test that the bundle inactive attribute is handled correctly.
The test data contains an interface: et-4/0/2 with the bundle
configuration (for ae6) marked as 'inactive'. et-4/0/2 also
has a logical interface configured.
This test confirms that neither et-4/0/2 nor et-4/0/2.0 are
part of a bundle.
"""
test_filename = os.path.join(
os.path.dirname(__file__),
'data',
'DBOARD3-833.xml')
with open(test_filename, 'r') as f:
netconf_config = etree.XML(f.read())
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.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