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

added sanity check test of opsdb.get_circuits

parent 6e093833
No related branches found
No related tags found
No related merge requests found
......@@ -278,3 +278,80 @@ def test_lookup_lg_routers(connection, cached_test_data):
routers = list(opsdb.lookup_lg_routers(connection))
jsonschema.validate(routers, LG_ROUTERS_SCHEMA)
assert routers # shouldn't be empty
CIRCUIT_INFO_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"type": "object",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"},
"status": {
"type": "string",
"enum": ["operational", "installed", "planned", "ordered"]
},
"circuit_type": {
"type": "string",
"enum": ["path", "service", "l2circuit", "link-aggr-group"]
},
"service_type": {"type": "string"},
"project": {"type": "string"},
"equipment": {"type": "string"},
"pop": {"type": "string"},
"pop_abbreviation": {"type": "string"},
"other_end_pop": {"type": "string"},
"other_end_pop_abbreviation": {"type": "string"},
"other_end_equipment": {"type": "string"},
"port": {"type": "string"},
"other_end_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",
"enum": ["juniper", "coriant", "infinera",
"cisco", "hewlett packard",
"corsa", "graham smith uk ltd",
"intel", "dell", "mellanox technologies",
"unknown", ""]
},
"card_id": {"type": "string"},
"other_end_card_id": {"type": "string"},
"interface_name": {"type": "string"},
"other_end_interface_name": {"type": "string"},
# TODO: check what's changed: added to make tests pass
'other_end_pop_name': {"type": "string"},
'pop_name': {"type": "string"}
},
"required": [
"id", "name", "status", "circuit_type",
"service_type", "project",
"equipment", "other_end_equipment",
"card_id", "other_end_card_id",
"port", "other_end_port",
"logical_unit", "other_end_logical_unit",
"interface_name", "other_end_interface_name"
# "pop", "other_end_pop",
# "pop_name", "other_end_pop_name",
# "pop_abbreviation", "other_end_pop_abbreviation",
],
"additionalProperties": False
}
def test_get_circuits(connection, cached_test_data):
import re
for circuit in opsdb.get_circuits(connection):
jsonschema.validate(circuit, CIRCUIT_INFO_SCHEMA)
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