04-09-2021 11:18 AM
Hello,
Using Postman, I am trying to extract the BGP section of a router configuration using the Openconfig Yang model.
Here is the GET and the unfiltered output:
GET: https://{{ip_address}}:{{port}}/restconf/data/openconfig-network-instance:network-instances/network-instance=default/protocols
{ "openconfig-network-instance:protocols": { "protocol": [ { "identifier": "openconfig-policy-types:BGP", "name": "10", "config": { "identifier": "openconfig-policy-types:BGP", "name": "10" ............ output omitted............. }, }, { "identifier": "openconfig-policy-types:STATIC", "name": "DEFAULT", "config": { "identifier": "openconfig-policy-types:STATIC", "name": "DEFAULT" }, ................output omitted................. }, { "identifier": "openconfig-policy-types:DIRECTLY_CONNECTED", "name": "DEFAULT", "config": { "identifier": "openconfig-policy-types:DIRECTLY_CONNECTED", "name": "DEFAULT" } } ] } }
Below my URL to filter the BGP section and the output
Note: %3A represents the colon
GET: https://{{ip_address}}:{{port}}/restconf/data/openconfig-network-instance:network-instances/network-instance=default/protocols/protocol=openconfig-policy-types%3ABGP
{ "errors": { "error": [ { "error-message": "uri keypath not found", "error-tag": "invalid-value", "error-type": "application" } ] } }
Any idea how to retrieve the BGP section, if at all possible?
It seems the colon is the issue here as I am able to filter similar formatted data structures successfully.
Tyche
04-19-2021 11:11 AM
Have you tried sending the request, either with Postman or cURL, without the special formatting of the colon? E.g. use ":" in the URI instead of "%3A"
04-22-2021 10:22 AM
Thank you for the suggestions.
I tried with ":" in Postman and also in Python using the 'requests' library. I get the same error message: 'uri keypath not found'.
Could it be that because of the way the data is structured, it is not possible to access the BGP section?
That would seem to defeat the purpose of using structured data ...
04-21-2021 02:33 PM
04-22-2021 10:28 AM
Hello Alex,
I am using json in my headers:
"Content-Type:application/yang-data+json"
"Accept:application/yang-data+json"
Tyche
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide