A network automation engineer issues an HTTP GET request to a Cisco IOS-XE RESTCONF API endpoint to retrieve BGP neighbor status details. The router returns the following JSON-encoded response:
{
"Cisco-IOS-XE-bgp:bgp-state-data": {
"bgp-neighbors": [
{
"neighbor-id": "192.168.10.1",
"remote-as": 65001,
"state": "Established",
"address-family": [
{
"af-name": "ipv4-unicast",
"prefixes": {
"accepted": 42,
"sent": 15
}
},
{
"af-name": "vpnv4-unicast",
"prefixes": {
"accepted": 120,
"sent": 88
}
}
]
},
{
"neighbor-id": "192.168.20.2",
"remote-as": 65002,
"state": "Active",
"address-family": [
{
"af-name": "ipv4-unicast",
"prefixes": {
"accepted": 0,
"sent": 0
}
}
]
}
]
}
}
Match each Python dictionary lookup / data extraction expression on the left to its corresponding value or evaluated data type on the right based on the JSON response payload.
- data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["address-family"][1]["prefixes"]["accepted"]120
- data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][1]["remote-as"]65002 (integer)
- type(data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["neighbor-id"])str (string)
- data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["address-family"][0]["af-name"]"ipv4-unicast"