diff --git a/brian_polling_manager/inventory.py b/brian_polling_manager/inventory.py index 1b6ceae885b7802bfb7229aa5b778e32fbd9d3bb..7fd483f541f9e54b8e8387500cf373e6c36fbaa6 100644 --- a/brian_polling_manager/inventory.py +++ b/brian_polling_manager/inventory.py @@ -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'] } },