cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1984
Views
0
Helpful
4
Replies

RESTCONF get request fails with Colon in URI OPENCONFIG YANG

Tyche
Level 1
Level 1

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

 

4 Replies 4

Alex Stevenson
Cisco Employee
Cisco Employee

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"

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 ...

Alex Stevenson
Cisco Employee
Cisco Employee

 

I could also be the content-type

 

See attachment

Hello Alex,

 

I am using json in my headers: 

 

"Content-Type:application/yang-data+json"

"Accept:application/yang-data+json"

 

Tyche