diff --git a/inventory_provider/routes/classifier_schema.py b/inventory_provider/routes/classifier_schema.py index 3d2ca9e1fd986318e751fc95bbe69629f7700059..60cc97eee631e1f2fcf6d4d23c8aaa4e46bed341 100644 --- a/inventory_provider/routes/classifier_schema.py +++ b/inventory_provider/routes/classifier_schema.py @@ -1,5 +1,104 @@ +_common_ims_schema_definitions = { + "status": { + "type": "string", + "enum": [ + "planned", + "installed", + "operational", + "terminated", + "disposed"] + } +} + +_common_schema_definitions = { + "status": { + "type": "string", + "enum": [ + "planned", + "installed", + "operational", + "terminated", + "disposed"] + }, + "service": { + "type": "object", + "properties": { + "id": {"type": "integer"}, + "name": {"type": "string"}, + "status": {"$ref": "#/definitions/status"}, + "circuit_type": {"type": "string"}, + "service_type": {"type": "string"}, + "project": {"type": "string"}, + "pop_name": {"type": "string"}, + "pop_abbreviation": {"type": "string"}, + "equipment": {"type": "string"}, + "other_end_pop_name": {"type": "string"}, + "other_end_pop_abbreviation": {"type": "string"}, + "other_end_equipment": {"type": "string"}, + }, + "additionalProperties": False + }, + "related-service-info": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "status": {"$ref": "#/definitions/status"}, + "circuit_type": { + "type": "string", + "enum": ["circuit", "service"] + }, + "project": {"type": "string"} + }, + "additionalProperties": False + }, + + "location-endpoint": { + "type": "object", + "properties": { + "equipment": {"type": "string"}, + "name": {"type": "string"}, + "abbreviation": {"type": "string"} + }, + "required": ["equipment", "name", "abbreviation"], + "additionalProperties": False + }, + "location": { + "type": "object", + "properties": { + "a": {"$ref": "#/definitions/location-endpoint"}, + "b": {"$ref": "#/definitions/location-endpoint"} + }, + "required": ["a"], + "additionalProperties": False + }, + "locations-list": { + "type": "array", + "items": {"$ref": "#/definitions/location"} + }, + "pop-info": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "abbreviation": {"type": "string"}, + "country": {"type": "string"}, + "city": {"type": "string"}, + "longitude": {"type": "number"}, + "latitude": {"type": "number"} + }, + "required": [ + "name", + "abbreviation", + "country", + "city", + "longitude", + "latitude" + ], + "additionalProperties": False + }, +} + _common_locations_schema_definitions = { "location-endpoint": { "type": "object", @@ -439,54 +538,40 @@ INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA = { "additionalProperties": False } -CORIANT_INFO_RESPONSE_SCHEMA = { +INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA = { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "definitions": { - "location-endpoint": { - "type": "object", - "properties": { - "equipment": {"type": "string"}, - "name": {"type": "string"}, - "abbreviation": {"type": "string"} - }, - "required": ["equipment", "name", "abbreviation"], - "additionalProperties": False - }, - "location": { - "type": "object", - "properties": { - "a": {"$ref": "#/definitions/location-endpoint"}, - "b": {"$ref": "#/definitions/location-endpoint"} - }, - "required": ["a"], - "additionalProperties": False - }, - "locations-list": { + **_common_schema_definitions + }, + + "type": "object", + "properties": { + "related-services": { "type": "array", - "items": {"$ref": "#/definitions/location"} + "items": {"$ref": "#/definitions/related-service-info"} }, - "pop-info": { + "df_route": { "type": "object", "properties": { + "id": {"type": "integer"}, "name": {"type": "string"}, - "abbreviation": {"type": "string"}, - "country": {"type": "string"}, - "city": {"type": "string"}, - "longitude": {"type": "number"}, - "latitude": {"type": "number"} - }, - "required": [ - "name", - "abbreviation", - "country", - "city", - "longitude", - "latitude" - ], - "additionalProperties": False + "status": {"$ref": "#/definitions/status"} + } }, + "locations": {"$ref": "#/definitions/locations-list"} + }, + "required": ["df_route", "locations", "ends"] +} + +CORIANT_INFO_RESPONSE_SCHEMA = { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + + "definitions": { + + **_common_schema_definitions, "endpoint": { "type": "object", "properties": { @@ -519,22 +604,6 @@ CORIANT_INFO_RESPONSE_SCHEMA = { "a", "b"], "additionalProperties": False - }, - "related-service-info": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "status": { - "type": "string", - "enum": ["operational", "installed", "planned", "ordered"] - }, - "circuit_type": { - "type": "string", - "enum": ["path", "service", "l2circuit"] - }, - "project": {"type": "string"} - }, - "additionalProperties": False } }, @@ -543,7 +612,12 @@ CORIANT_INFO_RESPONSE_SCHEMA = { "equipment name": {"type": "string"}, "card id": {"type": "string"}, "port number": {"type": "string"}, + "locations": {"$ref": "#/definitions/locations-list"}, "path": {"$ref": "#/definitions/path"}, + "services": { + "type": "array", + "items": {"$ref": "#/definitions/service"} + }, "related-services": { "type": "array", "items": {"$ref": "#/definitions/related-service-info"}