Skip to content
Snippets Groups Projects
Commit 9321ed3b authored by Release Webservice's avatar Release Webservice
Browse files

Finished release 0.53.

parents 0850e6b6 69e4afff
No related branches found
Tags 0.53
No related merge requests found
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [0.53] - 2020-09-23
- DBOARD-328: fixed improper response when router is unknown
## [0.52] - 2020-09-07 ## [0.52] - 2020-09-07
- POL1-228 (and others): - POL1-228 (and others):
- allow /poller/interfaces to be called without an argument - allow /poller/interfaces to be called without an argument
......
...@@ -33,24 +33,24 @@ def _remove_duplicates_from_list(all): ...@@ -33,24 +33,24 @@ def _remove_duplicates_from_list(all):
return list(tmp_dict.values()) return list(tmp_dict.values())
def _location_from_router(router_name): def _locations_from_router(router_name):
r = common.get_current_redis() r = common.get_current_redis()
result = r.get(f'opsdb:location:{router_name}') result = r.get(f'opsdb:location:{router_name}')
if not result: if not result:
logger.error(f'error looking up location for {router_name}') logger.error(f'error looking up location for {router_name}')
return None return []
result = json.loads(result.decode('utf-8')) result = json.loads(result.decode('utf-8'))
if not result: if not result:
logger.error(f'sanity failure: empty list for location {router_name}') logger.error(f'sanity failure: empty list for location {router_name}')
return None return []
return { return [{
'a': _LOCATION( 'a': _LOCATION(
equipment=result[0]['equipment-name'], equipment=result[0]['equipment-name'],
name=result[0]['pop']['name'], name=result[0]['pop']['name'],
abbreviation=result[0]['pop']['abbreviation']) abbreviation=result[0]['pop']['abbreviation'])
} }]
def _location_from_service_dict(s): def _location_from_service_dict(s):
...@@ -206,7 +206,7 @@ def get_juniper_link_info(source_equipment, interface): ...@@ -206,7 +206,7 @@ def get_juniper_link_info(source_equipment, interface):
result['related-services'] = top_level_services result['related-services'] = top_level_services
if not result['locations']: if not result['locations']:
result['locations'] = [_location_from_router(source_equipment)] result['locations'] = _locations_from_router(source_equipment)
result['locations'] = _remove_duplicates_from_list(result['locations']) result['locations'] = _remove_duplicates_from_list(result['locations'])
result = json.dumps(result) result = json.dumps(result)
...@@ -340,16 +340,14 @@ def peer_info(address): ...@@ -340,16 +340,14 @@ def peer_info(address):
info = info.decode('utf-8') info = info.decode('utf-8')
info = json.loads(info) info = json.loads(info)
result['ix-public-peer-info'] = ix_peering_info(info) result['ix-public-peer-info'] = ix_peering_info(info)
router_location = _location_from_router(info['router']) result['locations'] += _locations_from_router(info['router'])
result['locations'] += [router_location]
info = r.get('vpn_rr_peer:%s' % address) info = r.get('vpn_rr_peer:%s' % address)
if info: if info:
info = info.decode('utf-8') info = info.decode('utf-8')
info = json.loads(info) info = json.loads(info)
result['vpn-rr-peer-info'] = info result['vpn-rr-peer-info'] = info
router_location = _location_from_router(info['router']) result['locations'] += _locations_from_router(info['router'])
result['locations'] += [router_location]
interfaces = list(find_interfaces_and_services(address)) interfaces = list(find_interfaces_and_services(address))
if interfaces: if interfaces:
......
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='inventory-provider', name='inventory-provider',
version="0.52", version="0.53",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='Dashboard inventory provider', description='Dashboard inventory provider',
......
...@@ -174,7 +174,7 @@ JUNIPER_LINK_METADATA = { ...@@ -174,7 +174,7 @@ JUNIPER_LINK_METADATA = {
}, },
"locations": {"$ref": "#/definitions/locations-list"} "locations": {"$ref": "#/definitions/locations-list"}
}, },
# "required": ["interface"], "required": ["interface", "locations"],
"additionalProperties": False "additionalProperties": False
} }
...@@ -216,6 +216,28 @@ def test_juniper_link_info_not_found(client): ...@@ -216,6 +216,28 @@ def test_juniper_link_info_not_found(client):
} }
def test_juniper_link_unknown_router(client):
rv = client.get(
'/classifier/juniper-link-info/'
'unknown-router/unknown-interface-name',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, JUNIPER_LINK_METADATA)
assert response_data == {
'interface': {
'name': 'unknown-interface-name',
'description': '',
'ipv4': [],
'ipv6': [],
'bundle': [],
'bundle_members': []
},
'locations': []
}
VPN_RR_PEER_INFO_KEYS = {'vpn-rr-peer-info', 'locations'} VPN_RR_PEER_INFO_KEYS = {'vpn-rr-peer-info', 'locations'}
IX_PUBLIC_PEER_INFO_KEYS = {'ix-public-peer-info', 'interfaces', 'locations'} IX_PUBLIC_PEER_INFO_KEYS = {'ix-public-peer-info', 'interfaces', 'locations'}
......
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