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

made schemas minimal for our needs

parent 3fca09a9
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ import requests
logger = logging.getLogger(__name__)
# minimal inventory response schema
# minimal inventory response schema for our purposes
INVENTORY_VERSION_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
......@@ -29,50 +29,23 @@ INVENTORY_VERSION_SCHEMA = {
'additionalProperties': True
}
# minimal inventory response schema for our purposes
INVENTORY_INTERFACES_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'service': {
'type': 'object',
'properties': {
'id': {'type': 'integer'},
'name': {'type': 'string'},
'type': {'type': 'string'},
'status': {'type': 'string'},
},
'required': ['id', 'name', 'type', 'status'],
'additionalProperties': False
},
'interface': {
'type': 'object',
'properties': {
'router': {'type': 'string'},
'name': {'type': 'string'},
'description': {'type': 'string'},
'snmp-index': {
'type': 'integer',
'minimum': 1
},
'bundle': {
'type': 'array',
'items': {'type': 'string'}
},
'bundle-parents': {
'type': 'array',
'items': {'type': 'string'}
},
'circuits': {
'type': 'array',
'items': {'$ref': '#/definitions/service'}
}
},
'required': [
'router', 'name', 'description',
'snmp-index', 'bundle', 'bundle-parents',
'circuits'],
'additionalProperties': False
},
'required': ['router', 'name', 'snmp-index'],
}
},
'type': 'array',
......@@ -80,33 +53,11 @@ INVENTORY_INTERFACES_SCHEMA = {
}
# minimal inventory response schema for our purposes
GWS_DIRECT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'definitions': {
'oid': {
'type': 'string',
'pattern': r'^(\d+\.)*\d+$'
},
'counter': {
'type': 'object',
'properties': {
'field': {
'enum': [
'discards_in',
'discards_out',
'errors_in',
'errors_out',
'traffic_in',
'traffic_out'
]
},
'oid': {'$ref': '#/definitions/oid'},
'community': {'type': 'string'}
},
'required': ['field', 'oid', 'community'],
'additionalProperties': False
},
'interface-counters': {
'type': 'object',
'properties': {
......@@ -117,15 +68,8 @@ GWS_DIRECT_SCHEMA = {
},
'hostname': {'type': 'string'},
'tag': {'type': 'string'},
'counters': {
'type': 'array',
'items': {'$ref': '#/definitions/counter'},
'minItems': 1
}
},
'required': [
'nren', 'isp', 'hostname', 'tag', 'counters'],
'additionalProperties': False
'required': ['nren', 'isp', 'hostname', 'tag']
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment