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

added MTC endpoint implementation

parent 8706040d
No related branches found
No related tags found
No related merge requests found
...@@ -578,53 +578,31 @@ def get_mtc_interface_info(node, interface): ...@@ -578,53 +578,31 @@ def get_mtc_interface_info(node, interface):
:param element: :param element:
:return: element info :return: element info
""" """
dummy_response = {
"contacts": [ r = common.get_current_redis()
"NOC-RENATER@NOC.RENATER.FR", interface = interface.rsplit('-', 1)[0]
"NOC@GEANT.ORG",
"NOC@RESTENA.LU", # ims_source_equipment = get_ims_equipment_name(equipment_name, r)
"OC@GEANT.ORG", # ims_interface = get_ims_interface(entity_string)
"SUPPORT@OC.GEANT.NET"
], cache_key = f'classifier-cache:mtc:{node}:{interface}'
"locations": [
{ result = _ignore_cache_or_retrieve(request, cache_key, r)
"a": {
"abbreviation": "LON", if not result:
"equipment": node, result = get_interface_services_and_loc(node, interface, r)
"name": "LONDON"
} if not result['locations'] and 'services' not in result:
} result = {}
],
"related-services": [ if not result:
{ return Response(
"circuit_type": "service", response="no available info for "
"name": "RENATER_AP2_CLS", f"{node} {interface}",
"project": "RENATER", status=404,
"status": "operational" mimetype="text/html")
}
], return Response(json.dumps(result), mimetype="application/json")
"services": [
{
"card_id": "",
"circuit_type": "circuit",
"equipment": node,
"id": 669120,
"logical_unit": "",
"name": "AMS-LON_EEX_ESNET_1424",
"other_end_equipment": "",
"other_end_pop_abbreviation": "",
"other_end_pop_name": "",
"other_end_port": "",
"pop_abbreviation": "LON",
"pop_name": "LONDON",
"port": interface,
"project": "RENATER",
"service_type": "ETHERNET",
"status": "operational"
}
]
}
return Response(json.dumps(dummy_response), mimetype='application/json')
@routes.route("/infinera-lambda-info/" @routes.route("/infinera-lambda-info/"
......
...@@ -449,7 +449,7 @@ _infinera_lambda_response_schema_definitions = { ...@@ -449,7 +449,7 @@ _infinera_lambda_response_schema_definitions = {
}, },
"circuit_type": { "circuit_type": {
"type": "string", "type": "string",
"enum": ["path", "service", "l2circuit"] "enum": ["path", "service", "l2circuit", "circuit"]
}, },
"service_type": {"type": "string"}, "service_type": {"type": "string"},
"project": {"type": "string"}, "project": {"type": "string"},
......
...@@ -5,7 +5,7 @@ import pytest ...@@ -5,7 +5,7 @@ import pytest
from inventory_provider.routes.classifier_schema \ from inventory_provider.routes.classifier_schema \
import JUNIPER_LINK_RESPONSE_SCHEMA, PEER_INFO_RESPONSE_SCHEMA, \ import JUNIPER_LINK_RESPONSE_SCHEMA, PEER_INFO_RESPONSE_SCHEMA, \
INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA, CORIANT_INFO_RESPONSE_SCHEMA, \ INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA, CORIANT_INFO_RESPONSE_SCHEMA, \
INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA, MTC_INTERFACE_INFO_RESPONSE_SCHEMA
DEFAULT_REQUEST_HEADERS = { DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json", "Content-type": "application/json",
...@@ -147,14 +147,14 @@ def test_coriant_info_not_found(client): ...@@ -147,14 +147,14 @@ def test_coriant_info_not_found(client):
def test_mtc_info(client): def test_mtc_info(client):
rv = client.get( rv = client.get(
'/classifier/mtc-interface-info/abc/def', '/classifier/mtc-interface-info/MAD01-MTC6-1/1-A-1-S1-1',
headers=DEFAULT_REQUEST_HEADERS) headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200 assert rv.status_code == 200
assert rv.is_json assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8')) response_data = json.loads(rv.data.decode('utf-8'))
assert response_data assert response_data
# schema seems wrong ... # schema seems wrong ...
# jsonschema.validate(response_data, MTC_INTERFACE_INFO_RESPONSE_SCHEMA) jsonschema.validate(response_data, MTC_INTERFACE_INFO_RESPONSE_SCHEMA)
def test_infinera_unparseable_fiberlink(client): def test_infinera_unparseable_fiberlink(client):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment