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

Finished feature DBOARD3-965-nokia-trunk-index-out-of-range.

parents 7ecfeb42 ac39c22b
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ import re ...@@ -3,7 +3,6 @@ import re
from ncclient import manager, xml_ from ncclient import manager, xml_
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -236,15 +235,16 @@ def get_lags_config(netconf_config): ...@@ -236,15 +235,16 @@ def get_lags_config(netconf_config):
def get_interfaces_config(netconf_config): def get_interfaces_config(netconf_config):
def _get_address_node_info(_e):
# HACKHACK: quick workaround for DBOARD3-965
# TODO: fix this properly
yield from _e.xpath('n:address', namespaces=NS)
yield from _e.xpath('n:primary', namespaces=NS)
def _get_ip_address(e): def _get_ip_address(e):
for details_parent in e: for _address_elem in _get_address_node_info(e):
# example element address = _address_elem[0].text
# <primary> # details_parent - not always primary prefix_length = _address_elem[1].text
# <address>62.40.119.9</address>
# <prefix-length>32</prefix-length>
# </primary>
address = details_parent[0].text
prefix_length = details_parent[1].text
ip_string = f'{address}/{prefix_length}' ip_string = f'{address}/{prefix_length}'
yield ip_string yield ip_string
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
import os
from lxml import etree
import pytest
from inventory_provider import nokia
def _load_netconf_config(hostname):
filename = os.path.join(
os.path.dirname(__file__),
'data',
'DBOARD3-965',
f'{hostname}-netconf.xml')
with open(filename) as f:
return etree.fromstring(f.read())
@pytest.mark.parametrize(
'nokia_router_hostname', [
'rt0.lon2.uk.geant.net',
'rt0.lon.uk.geant.net',
'rt0.gen.ch.geant.net',
'rt0.fra.de.geant.net',
'rt0.ams.nl.geant.net'])
def test_DBOARD3_965(nokia_router_hostname):
netconf_doc = _load_netconf_config(hostname=nokia_router_hostname)
for ifc in nokia.get_interfaces_config(netconf_doc):
assert ifc['interface-name'] # trivial sanity check, TODO: proper test
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment