From c4fadb7ef96e13bbcea809c49e1e67c5d534fdba Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Sat, 23 Jan 2021 13:59:18 +0100 Subject: [PATCH] added asn to peer-info response schema --- test/test_classifier_routes.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/test/test_classifier_routes.py b/test/test_classifier_routes.py index fb9f3aa6..8b76c1b5 100644 --- a/test/test_classifier_routes.py +++ b/test/test_classifier_routes.py @@ -250,16 +250,18 @@ def test_juniper_link_unknown_router(client): VPN_RR_PEER_INFO_KEYS = {'vpn-rr-peer-info', 'locations', 'snmp'} IX_PUBLIC_PEER_INFO_KEYS = { - 'ix-public-peer-info', 'interfaces', 'locations', 'snmp'} + 'ix-public-peer-info', 'interfaces', 'locations', 'snmp', 'asn'} @pytest.mark.parametrize('peer_address,expected_response_keys', [ - ('147.91.0.117', VPN_RR_PEER_INFO_KEYS), + # MDVPN, asn=13092 + ('147.91.0.117', VPN_RR_PEER_INFO_KEYS | {'asn'}), + # MDVPN, no asn ('62.40.96.18', VPN_RR_PEER_INFO_KEYS | {'interfaces'}), ('2001:07f8:0036:0000:0000:3417:0000:0001', IX_PUBLIC_PEER_INFO_KEYS), ('2001:07f8:0030:0000:0002:0002:0003:2934', IX_PUBLIC_PEER_INFO_KEYS), ('195.66.227.154', IX_PUBLIC_PEER_INFO_KEYS), - ('149.29.9.9', {'interfaces', 'locations', 'snmp'}), + ('149.29.9.9', {'interfaces', 'locations', 'snmp', 'asn'}), ('62.40.125.142', {'interfaces', 'locations', 'snmp'}) ]) def test_peer_info( @@ -358,6 +360,28 @@ def test_peer_info( }, "required": ["oid", "community", "hostname"], "additionalProperties": False + }, + "asn-group-member": { + "type": "object", + "properties": { + "router": {"type": "string"}, + "address": {"type": "string"}, + "group": {"type": "string"} + }, + "required": ["router", "address", "group"], + "additionalProperties": False + }, + "asn-group": { + "type": "object", + "properties": { + "asn": {"type": "integer"}, + "peers": { + "type": "array", + "items": {"$ref": "#/definitions/asn-group-member"} + } + }, + "required": ["asn", "peers"], + "additionalProperties": False } } response_schema = { @@ -381,7 +405,8 @@ def test_peer_info( "snmp": { "type": "array", "items": {"$ref": "#/definitions/snmp-info"} - } + }, + "asn": {"$ref": "#/definitions/asn-group"} }, "additionalProperties": False } -- GitLab