Skip to content
Snippets Groups Projects
Commit 6079da8e authored by Robert Latta's avatar Robert Latta
Browse files

Merge branch 'develop' into feature/DBOARD3-306

parents 160df951 f07ef2c6
Branches
Tags
No related merge requests found
......@@ -214,7 +214,7 @@ def get_interface_services_and_locs(ims_source_equipment, ims_interface, r):
if not result['services']:
result.pop('services', None)
if result['related-services']:
for r in result['related-services']:
for r in result['related-services']:
r.pop('id', None)
else:
result.pop('related-services', None)
......
......@@ -185,7 +185,7 @@ def netconf_refresh_config(self, hostname):
self.log_info(f'netconf info loaded from {hostname}')
def _unmanaged_interfaces(self):
def _unmanaged_interfaces():
def _convert(d):
# the config file keys are more readable than
......@@ -770,6 +770,10 @@ def _build_subnet_db(update_callback=lambda s: None):
entry = subnets.setdefault(ifc['interface address'], [])
entry.append(ifc)
for ifc in _unmanaged_interfaces():
entry = subnets.setdefault(ifc['interface address'], [])
entry.append(ifc)
update_callback('saving {} subnets'.format(len(subnets)))
rp = r.pipeline()
......
......@@ -54,6 +54,20 @@ def data_config_filename():
"password": "ims_password"
},
"managed-routers": "bogus url",
"unmanaged-interfaces": [
{
"address": "99.99.99.99",
"network": "99.99.99.0/24",
"interface": "ABC/0/0/0",
"router": "bogus.host.name"
},
{
"address": "999.999.999.99",
"network": "999.999.999.0/24",
"interface": "ZZZ/9/a/x:0.123",
"router": "another.bogus.host.name"
}
]
}
f.write(json.dumps(config).encode('utf-8'))
......
......@@ -4,8 +4,7 @@ import pytest
from inventory_provider.routes.classifier_schema \
import JUNIPER_LINK_RESPONSE_SCHEMA, PEER_INFO_RESPONSE_SCHEMA, \
INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA, CORIANT_INFO_RESPONSE_SCHEMA, \
INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA
INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA, CORIANT_INFO_RESPONSE_SCHEMA
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
......@@ -175,7 +174,8 @@ def test_infinera_fiberlink_not_found(client):
# assert rv.status_code == 200
# assert rv.is_json
# response_data = json.loads(rv.data.decode('utf-8'))
# jsonschema.validate(response_data, INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA)
# jsonschema.validate(
# response_data, INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA)
def test_infinera_lambda(client):
......
......@@ -3,8 +3,8 @@ import jsonschema
import pytest
from inventory_provider.routes.msr import ACCESS_SERVICES_LIST_SCHEMA, \
PEERING_LIST_SCHEMA, PEERING_GROUP_LIST_SCHEMA
from inventory_provider.routes.msr import PEERING_LIST_SCHEMA, \
PEERING_GROUP_LIST_SCHEMA
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
......
......@@ -11,6 +11,7 @@ import jsonschema
from inventory_provider.tasks import worker
from inventory_provider.tasks import common
from inventory_provider.routes import msr
from inventory_provider import config
def backend_db():
......@@ -23,7 +24,7 @@ def backend_db():
}).db
def test_build_subnet_db(mocked_worker_module):
def test_build_subnet_db(mocked_worker_module, data_config_filename):
"""
Verify that valid reverse subnet objects are created.
......@@ -52,6 +53,16 @@ def test_build_subnet_db(mocked_worker_module):
'items': {"$ref": "#/definitions/interface"},
}
all_subnet_interfaces = set()
unmanaged_interfaces = set()
with open(data_config_filename) as f:
params = config.load(f)
for ifc in params.get('unmanaged-interfaces', []):
ifc_key = (f'{ifc["router"].lower()}'
f':{ifc["interface"].lower()}'
f':{ifc["network"]}')
unmanaged_interfaces.add(ifc_key)
db = backend_db() # also forces initialization
def _x(k):
......@@ -80,8 +91,16 @@ def test_build_subnet_db(mocked_worker_module):
for ifc in value:
assert ifc['interface address'] == address
ifc_key = (f'{ifc["router"]}'
f':{ifc["interface name"]}'
f':{ifc["interface address"]}')
all_subnet_interfaces.add(ifc_key)
assert found_record
assert unmanaged_interfaces <= all_subnet_interfaces
def test_build_juniper_peering_db(mocked_worker_module):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment