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 = {
'items': {'$ref': '#/definitions/gws-direct-nren-isp'}
},
'nren-asn-map': {
'type': 'object',
'patternProperties': {
r'^\d+$': {'type': 'string'}
'type': 'array',
'items': {
'type': 'object',
'properties': {
'nren': {'type': 'string'},
'asn': {'type': 'integer'}
},
'required': ['nren', 'asn'],
'additionalProperties': False
},
'additionalProperties': False
}
},
......
......@@ -1057,9 +1057,9 @@ def mdvpn():
config = current_app.config['INVENTORY_PROVIDER_CONFIG']
nren_asn_map = config['nren-asn-map']
nren_details = [
_peerings_for_nren(int(asn),
_peerings_for_nren(pair['asn'],
bgplu_index,
vpnrr_index)
for asn in nren_asn_map]
for pair in nren_asn_map]
response = json.dumps(nren_details)
return Response(response, mimetype='application/json')
......@@ -66,11 +66,20 @@ def data_config_filename():
}
],
'gws-direct': {},
'nren-asn-map': {
"1930": "FOO",
"680": "BAR",
"2200": "BAT"
}
'nren-asn-map': [
{
"nren": "FOO",
"asn": 1930
},
{
"nren": "BAR",
"asn": 680
},
{
"nren": "BAT",
"asn": 2200
}
]
}
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