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

Finished release 0.131.

parents c1c75159 31495a06
No related branches found
No related tags found
No related merge requests found
......@@ -23,10 +23,15 @@ These endpoints are intended for use by Dashboard V3.
.. autofunction::
inventory_provider.routes.classifier.get_fiberlink_trap_metadata
/classifier/coriant-info
------------------------
/classifier/coriant-port-info
-----------------------------
.. autofunction:: inventory_provider.routes.classifier.get_coriant_port_info
/classifier/coriant-tp-info
---------------------------
.. autofunction:: inventory_provider.routes.classifier.get_coriant_info
.. autofunction:: inventory_provider.routes.classifier.get_coriant_tp_info
/classifier/mtc-interface-info
......@@ -985,8 +990,31 @@ def get_tnms_fibre_trap_metadata(enms_pc_name: str) -> Response:
@routes.route('/coriant-info/<equipment_name>/<path:entity_string>',
methods=['GET'])
@routes.route('/coriant-port-info/<equipment_name>/<path:entity_string>',
methods=['GET'])
@common.require_accepts_json
def get_coriant_port_info(equipment_name: str, entity_string: str) -> Response:
"""
Handler for /classifier/coriant-info that
returns metadata for a coriant path.
The response will be formatted according to the following schema:
.. asjson::
inventory_provider.routes.classifier_schema.CORIANT_INFO_RESPONSE_SCHEMA
:param equipment_name: grv hostname
:param entity_string: path name
:return:
"""
card_port_regex = r'^(\d+\-\d+)\.(\d+(\.\d+)*)'
return _get_coriant_info(equipment_name, entity_string, card_port_regex)
@routes.route('/coriant-tp-info/<equipment_name>/<path:entity_string>',
methods=['GET'])
@common.require_accepts_json
def get_coriant_info(equipment_name: str, entity_string: str) -> Response:
def get_coriant_tp_info(equipment_name: str, entity_string: str) -> Response:
"""
Handler for /classifier/coriant-info that
returns metadata for a coriant path.
......@@ -996,10 +1024,16 @@ def get_coriant_info(equipment_name: str, entity_string: str) -> Response:
.. asjson::
inventory_provider.routes.classifier_schema.CORIANT_INFO_RESPONSE_SCHEMA
:param source_equipment: grv hostname
:param equipment_name: grv hostname
:param entity_string: path name
:return:
"""
card_port_regex = r'^(\d+\-\d+)\.(\d+)'
return _get_coriant_info(equipment_name, entity_string, card_port_regex)
def _get_coriant_info(
equipment_name: str, entity_string: str, card_port_regex: str) -> Response:
r = common.get_current_redis()
......@@ -1013,7 +1047,7 @@ def get_coriant_info(equipment_name: str, entity_string: str) -> Response:
if not result:
m = re.match(r'^(\d+\-\d+)\.((\d+)(\.\d+)*)', ims_interface)
m = re.match(card_port_regex, ims_interface)
if not m:
logger.error(
f'invalid coriant entity string format: {ims_interface}')
......
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='inventory-provider',
version="0.130",
version="0.131",
author='GEANT',
author_email='swd@geant.org',
description='Dashboard inventory provider',
......
......@@ -121,14 +121,20 @@ def test_peer_not_found(client):
assert response_data == {'locations': [], "contacts": []}
@pytest.mark.parametrize('equipment,entity_name,expected_card_id,expected_port', [
('grv3.ams.nl.geant.net', '1-3.3.1-Optical-10GbE-TTP', '1/3', '3.1'),
('bogus-hostname.with&special.char',
'234-2345234.7878i234crazynamewithslash/1-2.3', '234/2345234', '7878')
@pytest.mark.parametrize('equipment,entity_name,expected_card_id,expected_port,endpoint', [
('grv3.ams.nl.geant.net', '1-3.3.1-Optical-10GbE-TTP',
'1/3', '3.1', 'coriant-port-info'),
('grv3.ams.nl.geant.net', '1-3.3.1-Optical-10GbE-TTP',
'1/3', '3.1', 'coriant-info'),
('grv3.ams.nl.geant.net', '1-1.3.1-100GbE-ODU4-TTP',
'1/1', '3', 'coriant-tp-info'),
('bogus-hostname.with&special.char', '234-2345234.7878i234crazynamewithslash/1-2.3',
'234/2345234', '7878', 'coriant-port-info')
])
def test_coriant_info(client, equipment, entity_name, expected_card_id, expected_port):
def test_coriant_info(
client, equipment, entity_name, expected_card_id, expected_port, endpoint):
rv = client.get(
f'/classifier/coriant-info/{equipment}/{entity_name}',
f'/classifier/{endpoint}/{equipment}/{entity_name}',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment