Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • geant-swd/dashboardv3/inventory-provider
1 result
Select Git revision
Show changes
Commits on Source (9)
......@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
## [0.123] - 2024-06-25
- DBOARD3-965: tmp workaround for nokia parsing error
## [0.122] - 2024-06-20
- Remove use of functools caching for /msr/services endpoint and reuse fresh data instead
......
......@@ -3,7 +3,6 @@ import re
from ncclient import manager, xml_
logger = logging.getLogger(__name__)
......@@ -236,15 +235,16 @@ def get_lags_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):
for details_parent in e:
# example element
# <primary> # details_parent - not always primary
# <address>62.40.119.9</address>
# <prefix-length>32</prefix-length>
# </primary>
address = details_parent[0].text
prefix_length = details_parent[1].text
for _address_elem in _get_address_node_info(e):
address = _address_elem[0].text
prefix_length = _address_elem[1].text
ip_string = f'{address}/{prefix_length}'
yield ip_string
......
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='inventory-provider',
version="0.123",
version="0.124",
author='GEANT',
author_email='swd@geant.org',
description='Dashboard inventory provider',
......
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
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