Skip to content
Snippets Groups Projects
Commit 7676f2d9 authored by Pelle Koster's avatar Pelle Koster
Browse files

HOTFIX: bypass IMS for FlexILS data

parent 17834bab
Branches
Tags
No related merge requests found
recursive-include inventory_provider/static *
include inventory_provider/logging_default_config.json
recursive-exclude test *
include inventory_provider/db/flexils_data.json
\ No newline at end of file
This diff is collapsed.
import functools
import json
import logging
import re
from collections import defaultdict
......@@ -73,6 +74,9 @@ SITE_LOCATION_SCHEMA = {
def get_flexils_by_circuitid(ds: IMS):
import pathlib
return json.loads((pathlib.Path(__file__).parent / 'flexils_data.json').read_text())
by_circuit = defaultdict(list)
found_keys = set()
for entity in ds.get_all_entities('FLEXILS_SCHF_SUBINTERFACES'):
......
......@@ -1367,6 +1367,8 @@ def transform_ims_data(data):
}]
def _add_flex_ils_details_to_port_id_services(_flex_ils_details, _circuit_id):
if circuit_id not in hierarchy:
return
circuit = hierarchy[circuit_id]
port_id_services[flex_ils_details['key']] = [{
'id': circuit['id'],
......
......@@ -10,6 +10,7 @@ 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):
......@@ -406,6 +407,7 @@ 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 = \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment