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

include local asn if known, changed key names

parent 44642685
No related branches found
No related tags found
No related merge requests found
......@@ -218,7 +218,11 @@ def all_bgp_peers(netconf_config):
peer_as = neighbor_node.find('peer-as')
if peer_as is not None:
# lxml usage warning: can't just test `if peer_as:`
info['peer-as'] = int(peer_as.text)
info['remote-asn'] = int(peer_as.text)
local_as = neighbor_node.find('local-as')
if local_as is not None:
asn_value_node = local_as.find('as-number')
info['local-asn'] = int(asn_value_node.text)
description = neighbor_node.find('description')
if description is not None:
# lxml usage warning: can't just test `if description:`
......
......@@ -47,11 +47,12 @@ def test_bgp_peering_data(netconf_doc):
"group": {"type": "string"},
"description": {"type": "string"},
"address": {"type": "string"},
"peer-as": {"type": "integer"}
"remote-asn": {"type": "integer"},
"local-asn": {"type": "integer"}
},
# description is not always present, just based on
# empirical tests - not a problem
"required": ["instance", "group", "address", "peer-as"],
# description and-or local-asn is not always present,
# just based on empirical tests - not a problem
"required": ["instance", "group", "address", "remote-asn"],
"additionalProperties": False
},
"logical-system-peering": {
......@@ -61,9 +62,10 @@ def test_bgp_peering_data(netconf_doc):
"group": {"type": "string"},
"description": {"type": "string"},
"address": {"type": "string"},
"peer-as": {"type": "integer"}
"remote-asn": {"type": "integer"},
"local-asn": {"type": "integer"}
},
# peer-as and/or description are not always present,
# local/remote-asn and/or description are not always present,
# just based on empirical tests - not a problem
"required": ["logical-system", "group", "address"],
"additionalProperties": False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment