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

fixed & debugged snmp redis data format schema

parent fcc18cf9
No related branches found
No related tags found
No related merge requests found
......@@ -458,20 +458,20 @@ Any non-empty responses are JSON formatted messages.
"properties": {
"v4Address": {
"type": "string",
"pattern": "^(\d+\.){3}\d+$"
"pattern": r'^(\d+\.){3}\d+$'
},
"v4Mask": {
"type": "string",
"pattern": "^(\d+\.){3}\d+$"
"pattern": r'^(\d+\.){3}\d+$'
},
"v4InterfaceName": {:"type", "string"},
"index": {`
"v4InterfaceName": {"type": "string"},
"index": {
"type": "string",
"pattern": "^\d+$"
"pattern": r'^\d+$'
}
},
"required": [
"v4Address", "v4Mask", "v4InterfaceName", "index],
"v4Address", "v4Mask", "v4InterfaceName", "index"],
"additionalProperties": False
},
"v6ifc": {
......@@ -479,30 +479,30 @@ Any non-empty responses are JSON formatted messages.
"properties": {
"v6Address": {
"type": "string",
"pattern": "^[\d:]+$"
"pattern": r'^[a-f\d:]+$'
},
"v6Mask": {
"type": "string",
"pattern": "^\d+$"
"pattern": r'^\d+$'
},
"v6InterfaceName": {:"type", "string"},
"index": {`
"v6InterfaceName": {"type": "string"},
"index": {
"type": "string",
"pattern": "^\d+$"
"pattern": r'^\d+$'
}
},
"required": [
"v6Address", "v6Mask", "v6InterfaceName", "index],
"v6Address", "v6Mask", "v6InterfaceName", "index"],
"additionalProperties": False
}
},
"type": "array",
"items": {
"anyOf": {
"$ref": "#/definitions/v4Ifc",
"$ref": "#/definitions/v6Ifc"
}
"anyOf": [
{"$ref": "#/definitions/v4ifc"},
{"$ref": "#/definitions/v6ifc"}
]
}
}
```
......@@ -744,33 +744,3 @@ Any non-empty responses are JSON formatted messages.
"additionalProperties": False
}
```
* `vpn_rr_peers/<address>`
* key examples
* `ix_public_peer:193.203.0.203`
* valid values:
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ip-address": {
"type": "string",
"oneOf": [
{"pattern": r'^(\d+\.){3}\d+$'},
{"pattern": r'^([a-f\d]{4}:){7}[a-f\d]{4}$'}
]
}
},
"type": "object",
"properties": {
"name": {"$ref": "#/definitions/ip-address"},
"description": {"type": "string"},
"peer-as": {"type": "integer"}
},
"required": ["name", "description"],
"additionalProperties": False
}
```
......@@ -26,20 +26,58 @@ def test_snmp_interfaces(mocker, data_config, snmp_walk_responses):
expected_result_schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"v4Address": {"type": "string"},
"v4Mask": {"type": "string"},
"v4InterfaceName": {"type": "string"},
"v6Address": {"type": "string"},
"v6Mask": {"type": "string"},
"v6InterfaceName": {"type": "string"},
"index": {"type": "string"}
"definitions": {
"v4ifc": {
"type": "object",
"properties": {
"v4Address": {
"type": "string",
"pattern": r'^(\d+\.){3}\d+$'
},
"v4Mask": {
"type": "string",
"pattern": r'^(\d+\.){3}\d+$'
},
"v4InterfaceName": {"type": "string"},
"index": {
"type": "string",
"pattern": r'^\d+$'
}
},
"required": [
"v4Address", "v4Mask", "v4InterfaceName", "index"],
"additionalProperties": False
},
"required": ["index"],
"additionalProperties": False
"v6ifc": {
"type": "object",
"properties": {
"v6Address": {
"type": "string",
"pattern": r'^[a-f\d:]+$'
},
"v6Mask": {
"type": "string",
"pattern": r'^\d+$'
},
"v6InterfaceName": {"type": "string"},
"index": {
"type": "string",
"pattern": r'^\d+$'
}
},
"required": [
"v6Address", "v6Mask", "v6InterfaceName", "index"],
"additionalProperties": False
}
},
"type": "array",
"items": {
"anyOf": [
{"$ref": "#/definitions/v4ifc"},
{"$ref": "#/definitions/v6ifc"}
]
}
}
......@@ -57,13 +95,3 @@ def test_snmp_interfaces(mocker, data_config, snmp_walk_responses):
jsonschema.validate(interfaces, expected_result_schema)
assert interfaces, "interface list isn't empty"
for ifc in interfaces:
if 'v4Address' in ifc \
and 'v4Mask' in ifc \
and 'v4InterfaceName' in ifc:
continue
if 'v6Address' in ifc \
and 'v6Mask' in ifc \
and 'v6InterfaceName' in ifc:
continue
assert False, "address details not found in interface dict"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment