Skip to content
Snippets Groups Projects

Feature/DBOARD3-917 Add endpoint for error report interfaces list

Merged Pelle Koster requested to merge feature/DBOARD3-917-error-report-interfaces into develop
7 files
+ 452
34
Compare changes
  • Side-by-side
  • Inline
Files
7
  • 3feb929a
    Merge branch 'develop' of... · 3feb929a
    Pelle Koster authored
    Merge branch 'develop' of gitlab.software.geant.org:geant-swd/dashboardv3/inventory-provider into feature/DBOARD3-917-error-report-interfaces
@@ -23,7 +23,6 @@ from inventory_provider.routes.common import _ignore_cache_or_retrieve
logger = logging.getLogger(__name__)
routes = Blueprint('mic-support-routes', __name__)
ALL_DATA_SCHEMA = {
"schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
@@ -52,7 +51,7 @@ ALL_DATA_SCHEMA = {
"type": "array",
"items": {"type": "string"}
},
"third_party_id": {"type": "string"}
"third_party_id": {"type": "string"}
},
"required": ["id", "sid", "status", "name",
"service_type", "contacts",
@@ -68,6 +67,79 @@ ALL_DATA_SCHEMA = {
"additionalProperties": False
}
THIRD_PARTY_RESPONSE_SCHEMA = {
"schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"circuit_hierarchy": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {"type": "integer"},
"status": {"type": "string"},
"name": {"type": "string"},
"service_type": {"type": "string"},
"contacts": {
"type": "array",
"items": {"type": "string"}
},
"planned_work_contacts": {
"type": "array",
"items": {"type": "string"}
},
"third_party_id": {"type": "string"}
},
"required": ["id", "status", "name", "service_type", "contacts", "planned_work_contacts",
"third_party_id"],
"additionalProperties": False
}
},
"interface_services": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {"type": "integer"},
"sid": {"type": "string"},
"status": {"type": "string"},
"name": {"type": "string"},
"service_type": {"type": "string"},
"contacts": {
"type": "array",
"items": {"type": "string"}
},
"planned_work_contacts": {
"type": "array",
"items": {"type": "string"}
},
"third_party_id": {"type": "string"}
},
"required": ["id", "sid", "status", "name", "service_type", "contacts",
"planned_work_contacts", "third_party_id"],
"additionalProperties": False
}
}
}
}
}
}
}
}
},
"required": ["circuit_hierarchy", "interface_services"],
"additionalProperties": False
}
@routes.route("/all-data")
def get_everything():
@@ -81,3 +153,17 @@ def get_everything():
status=404,
mimetype="text/html")
return Response(result, mimetype='application/json')
@routes.route("/third-party-data")
def get_third_party_data():
cache_key = "mic:impact:third-party-data"
logger.debug(cache_key)
r = common.get_current_redis()
result = _ignore_cache_or_retrieve(request, cache_key, r)
if not result:
return Response(
response='no data found',
status=404,
mimetype="text/html")
return Response(result, mimetype='application/json')
Loading