Skip to content
Snippets Groups Projects
Commit 5a857e7c authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 0.128.

parents cae47dd5 1ebaa4eb
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
## [0.128] - 2024-08-22
- Small fix to DBOARD3-1005
## [0.127] - 2024-08-21
- DBOARD3-1005: Temporarily use a local snapshot of flexils data
......
......@@ -73,9 +73,22 @@ SITE_LOCATION_SCHEMA = {
}
def _transform_key(key):
if key == "null":
return None
try:
return int(key)
except ValueError:
return key
def get_flexils_by_circuitid(ds: IMS):
import pathlib
return json.loads((pathlib.Path(__file__).parent / 'flexils_data.json').read_text())
raw_data = json.loads(
(pathlib.Path(__file__).parent / "flexils_data.json").read_text()
)
return {_transform_key(k): v for k, v in raw_data.items()}
by_circuit = defaultdict(list)
found_keys = set()
......
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='inventory-provider',
version="0.127",
version="0.128",
author='GEANT',
author_email='swd@geant.org',
description='Dashboard inventory provider',
......
......@@ -10,7 +10,6 @@ from inventory_provider.db.ims_data import lookup_lg_routers, \
get_port_id_services, get_port_details, \
get_circuit_hierarchy, get_ids_and_sids, NODE_LOCATION_SCHEMA, \
get_flexils_by_circuitid, SITE_LOCATION_SCHEMA, get_site_locations
import pytest
def _json_test_data(filename):
......@@ -407,7 +406,6 @@ def test_get_circuit_ids_and_sids(mocker):
assert res == expected_response
@pytest.mark.xfail(reason="Temporary using ims bypass for flexils")
def test_get_flexils_by_circuit_id(mocker):
ims = mocker.patch('inventory_provider.db.ims.IMS')
ims.return_value.get_all_entities.return_value = \
......@@ -447,22 +445,23 @@ def test_get_flexils_by_circuit_id(mocker):
"customproperties": {}
}
]
expected_result = {
702203: [
{
'node_name': 'CAM01-MTC6-3',
'full_port_name': '1-A-1-S1-1',
'key': 'CAM01-MTC6-3:1-A-1-S1-1'
},
{
'node_name': 'CAM01-MTC6-3',
'full_port_name': '1-A-1-L1-1',
'key': 'CAM01-MTC6-3:1-A-1-L1-1'
}
]
}
# expected_result = {
# 702203: [
# {
# 'node_name': 'CAM01-MTC6-3',
# 'full_port_name': '1-A-1-S1-1',
# 'key': 'CAM01-MTC6-3:1-A-1-S1-1'
# },
# {
# 'node_name': 'CAM01-MTC6-3',
# 'full_port_name': '1-A-1-L1-1',
# 'key': 'CAM01-MTC6-3:1-A-1-L1-1'
# }
# ]
# }
ds = inventory_provider.db.ims.IMS(
'dummy_base', 'dummy_username', 'dummy_password')
res = get_flexils_by_circuitid(ds)
assert res == expected_result
assert all(isinstance(k, (int, type(None))) for k in res)
# assert res == expected_result
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