Skip to content
Snippets Groups Projects
Commit 7b4cff8a authored by Sam Roberts's avatar Sam Roberts
Browse files

refactor nren-asn-map

parent ed91a4dc
No related branches found
No related tags found
1 merge request!1Feature/reporting 297 msr mdvpn endpoint
...@@ -184,11 +184,16 @@ CONFIG_SCHEMA = { ...@@ -184,11 +184,16 @@ CONFIG_SCHEMA = {
'items': {'$ref': '#/definitions/gws-direct-nren-isp'} 'items': {'$ref': '#/definitions/gws-direct-nren-isp'}
}, },
'nren-asn-map': { 'nren-asn-map': {
'type': 'object', 'type': 'array',
'patternProperties': { 'items': {
r'^\d+$': {'type': 'string'} 'type': 'object',
'properties': {
'nren': {'type': 'string'},
'asn': {'type': 'integer'}
},
'required': ['nren', 'asn'],
'additionalProperties': False
}, },
'additionalProperties': False
} }
}, },
......
...@@ -1057,9 +1057,9 @@ def mdvpn(): ...@@ -1057,9 +1057,9 @@ def mdvpn():
config = current_app.config['INVENTORY_PROVIDER_CONFIG'] config = current_app.config['INVENTORY_PROVIDER_CONFIG']
nren_asn_map = config['nren-asn-map'] nren_asn_map = config['nren-asn-map']
nren_details = [ nren_details = [
_peerings_for_nren(int(asn), _peerings_for_nren(pair['asn'],
bgplu_index, bgplu_index,
vpnrr_index) vpnrr_index)
for asn in nren_asn_map] for pair in nren_asn_map]
response = json.dumps(nren_details) response = json.dumps(nren_details)
return Response(response, mimetype='application/json') return Response(response, mimetype='application/json')
...@@ -66,11 +66,20 @@ def data_config_filename(): ...@@ -66,11 +66,20 @@ def data_config_filename():
} }
], ],
'gws-direct': {}, 'gws-direct': {},
'nren-asn-map': { 'nren-asn-map': [
"1930": "FOO", {
"680": "BAR", "nren": "FOO",
"2200": "BAT" "asn": 1930
} },
{
"nren": "BAR",
"asn": 680
},
{
"nren": "BAT",
"asn": 2200
}
]
} }
with open(os.path.join(TEST_DATA_DIRNAME, 'gws-direct.json')) as gws: with open(os.path.join(TEST_DATA_DIRNAME, 'gws-direct.json')) as gws:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment