Skip to content
Snippets Groups Projects
Commit 975d7297 authored by Erik Reid's avatar Erik Reid
Browse files

Finished feature DBOARD3-340-dummy-mtc-endpoint.

parents 26e4d177 6021ee69
No related branches found
No related tags found
No related merge requests found
......@@ -34,4 +34,10 @@ These endpoints are intended for use by Dashboard V3.
/classifier/coriant-info
------------------------
.. autofunction:: inventory_provider.routes.classifier.get_coriant_info
\ No newline at end of file
.. autofunction:: inventory_provider.routes.classifier.get_coriant_info
/classifier/mtc-interface-info
--------------------------------
.. autofunction:: inventory_provider.routes.classifier.get_mtc_interface_info
......@@ -561,6 +561,72 @@ def get_bgp_peer_info(address):
return Response(result, mimetype='application/json')
@routes.route(
"/mtc-interface-info/<node>/<interface>", methods=['GET', 'POST'])
@common.require_accepts_json
def get_mtc_interface_info(node, interface):
"""
Handler for /classifier/mtc-interface-info that
returns metadata for as MTC port.
The response will be formatted according to the following schema:
.. asjson::
inventory_provider.routes.classifier_schema.MTC_INTERFACE_INFO_RESPONSE_SCHEMA
:param node:
:param element:
:return: element info
"""
dummy_response = {
"contacts": [
"NOC-RENATER@NOC.RENATER.FR",
"NOC@GEANT.ORG",
"NOC@RESTENA.LU",
"OC@GEANT.ORG",
"SUPPORT@OC.GEANT.NET"
],
"locations": [
{
"a": {
"abbreviation": "LON",
"equipment": node,
"name": "LONDON"
}
}
],
"related-services": [
{
"circuit_type": "service",
"name": "RENATER_AP2_CLS",
"project": "RENATER",
"status": "operational"
}
],
"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/"
"<source_equipment>/<interface>/<circuit_id>",
methods=['GET', 'POST'])
......@@ -568,7 +634,7 @@ def get_bgp_peer_info(address):
def get_infinera_lambda_info(source_equipment, interface, circuit_id):
"""
Handler for /classifier/infinera-lambda-info that
returns metadata for as DTNX port.
returns metadata for a DTNX port.
The response will be formatted according to the following schema:
......
......@@ -439,6 +439,8 @@ INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA = {
"additionalProperties": False
}
MTC_INTERFACE_INFO_RESPONSE_SCHEMA = INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA
CORIANT_INFO_RESPONSE_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
......
......@@ -3,8 +3,8 @@ import json
import jsonschema
import pytest
from inventory_provider.routes.classifier_schema \
import JUNIPER_LINK_RESPONSE_SCHEMA, PEER_INFO_RESPONSE_SCHEMA
from inventory_provider.routes.classifier_schema import \
JUNIPER_LINK_RESPONSE_SCHEMA, PEER_INFO_RESPONSE_SCHEMA
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
......@@ -220,6 +220,18 @@ def test_coriant_info_not_found(client, mocker):
assert rv.status_code == 404
def test_mtc_info(client):
rv = client.get(
'/classifier/mtc-interface-info/abc/def',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
assert response_data
# schema seems wrong ...
# jsonschema.validate(response_data, MTC_INTERFACE_INFO_RESPONSE_SCHEMA)
def test_infinera_unparseable_fiberlink(client):
rv = client.get(
'/classifier/infinera-fiberlink-info/unparseableentitystring/aaa',
......
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