diff --git a/test/test_classifier_routes.py b/test/test_classifier_routes.py index f44770dccb53f7716de92e4d5a9ace03880e3bee..4608dd2ed189b197bf3cc1eda7eafcf401a201f0 100644 --- a/test/test_classifier_routes.py +++ b/test/test_classifier_routes.py @@ -32,14 +32,52 @@ JUNIPER_LINK_METADATA = { "properties": { "name": {"type": "string"}, "description": {"type": "string"}, - "ipv4": {"$ref": "#/definitions/ipv4-interface-addres"}, - "ipv4": {"$ref": "#/definitions/ipv6-interface-addres"}, + "ipv4": { + "type": "array", + "items": {"$ref": "#/definitions/ipv4-interface-address"} + }, + "ipv6": { + "type": "array", + "items": {"$ref": "#/definitions/ipv6-interface-address"} + } }, "required": ["name", "description", "ipv4", "ipv6"], "additionalProperties": False }, + # TODO: modify service-info so that "" entries are just omitted + # (... rather than requiring 'oneOf') "service-info": { - "type": "object" + "type": "object", + "properties": { + "id": {"type": "integer"}, + "name": {"type": "string"}, + "status": {"type": "string"}, + "circuit_type": {"type": "string"}, + "service_type": {"type": "string"}, + "project": {"type": "string"}, + "equipment": {"type": "string"}, + "other_end_equipment": {"type": "string"}, + "port": {"type": "string"}, + "logical_unit": { + "oneOf": [ + {"type": "integer"}, + {"type": "string", "maxLength": 0} + ] + }, + "other_end_logical_unit": { + "oneOf": [ + {"type": "integer"}, + {"type": "string", "maxLength": 0} + ] + }, + "manufacturer": {"type": "string"}, + "card_id": {"type": "string"}, + "other_end_card_id": {"type": "string"}, + "interface_name": {"type": "string"}, + "other_end_interface_name": {"type": "string"} + }, + # "required": ["name", "description", "ipv4", "ipv6"], + "additionalProperties": False } }, @@ -60,17 +98,13 @@ JUNIPER_LINK_METADATA = { def test_trap_metadata(client_with_mocked_data): - response_schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object" - } rv = client_with_mocked_data.get( '/classifier/trap-metadata/mx1.ams.nl.geant.net/ae15.1500', headers=DEFAULT_REQUEST_HEADERS) assert rv.status_code == 200 assert rv.is_json response_data = json.loads(rv.data.decode('utf-8')) - jsonschema.validate(response_data, response_schema) + jsonschema.validate(response_data, JUNIPER_LINK_METADATA) VPN_RR_PEER_INFO_KEYS = {'vpn-rr-peer-info'}