cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1153
Views
0
Helpful
5
Replies

REST API for live-status on ISIS model

scadora
Cisco Employee
Cisco Employee

Hi.

 

I'm using IOS XR with NETCONF NEDs.  I'd like to use the REST API for live-status to retrieve the source-address and sid-value from this model:

 

pyang -f tree Cisco-IOS-XR-clns-isis-oper.yang --tree-path isis/instances/instance/topologies/topology/ipv4-routes/ipv4-route/native-status/native-details/primary/source

module: Cisco-IOS-XR-clns-isis-oper

    +--ro isis

       +--ro instances

          +--ro instance* [instance-name]

             +--ro topologies

                +--ro topology*

                   +--ro ipv4-routes

                      +--ro ipv4-route*

                         +--ro native-status

                            +--ro native-details

                               +--ro primary

                                  +--ro source*

                                     +--ro source-lsp-id?    xr:Isis-lsp-id

                                     +--ro source-address?   Isis-ipv4-address

                                     +--ro tags*

                                     |  +--ro entry?  Isis-prefix-tag

                                     +--ro nodal-sid*

                                        +--ro sid-value?   Isis-nodal-sid-value

                                        +--ro rflag?       uint8

                                        +--ro nflag?       uint8

                                        +--ro pflag?       uint8

                                        +--ro eflag?       uint8

                                        +--ro vflag?       uint8

                                        +--ro lflag?       uint8

                                        +--ro algorithm?   uint8

 

This live-status CLI works (although it gives me all the leaves, not just the two that I want):

admin@ncs# show devices device P3 live-status clns-isis-oper:isis instances instance topologies topology ipv4-routes ipv4-route native-status native-details primary source         

 

However, if I try to convert that to the REST API like this:

server:8080/api/operational/devices/device/P3/live-status/clns-isis-oper:isis/instances/instance/ISIS-CORE/topologies/topology/ipv4-routes/ipv4-route/native-status/native-details/primary/source

 

Then I get a 404 error with this message:

        <error-message>wrong number of identifiers</error-message>

 

The following less specific query does return the data I want...but it returns a bunch of other stuff I don't want:

server:8080/api/operational/devices/device/P3/live-status/clns-isis-oper:isis/instances/instance/ISIS-CORE/topologies/topology?deep

 

How can I structure the REST query to just get the data I want?

 

Thanks,

Shelly

1 Accepted Solution

Accepted Solutions

Thanks for your help, Jan!  

 

After wrestling with the module name and the keyless lists in the model, I ended up with this query that now works:

 

curl -X GET \
'http://X.X.X.X:8080/restconf/data/devices/device=P3/live-status/Cisco-IOS-XR-clns-isis-oper:isis/instances/instance=ISIS-CORE/topologies/topology?fields=ipv4-routes/ipv4-route/native-status/native-details/primary/source&depth=5' \
-H 'Accept: application/vnd.yang.collection+xml' \
-H 'Authorization: Basic xxxxxxxxxxxxxx=' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/yang-data+xml' \
-H 'Postman-Token: xxxxxxxxxxxxxx'

 

And that gets me all the prefixes and nodal sids that ISIS knows about.

View solution in original post

5 Replies 5

Jan Lindblad
Cisco Employee
Cisco Employee

I would strongly suggest that you switch to the standardized RESTCONF API instead of the old, proprietary REST API. If you do and still have trouble, I will assist. See the NSO Northbound guide for initial details.

Hi, Jan.

 

Can you give an example of using RESTCONF with live status with YANG NEDs?

 

This REST API works:

/api/operational/devices/device/P3/live-status/clns-isis-oper:isis/instances/instance/ISIS-CORE

 

I assumed it would translate to this RESTCONF:

/restconf/data/devices/device=P3/live-status/clns-isis-oper:isis/instances/instance/instance-name=ISIS-CORE

 

But it returns this error:

<error-message>uri keypath not found</error-message>
<error-tag>invalid-value</error-tag>
<error-type>application</error-type>

 

Thanks,

Shelly

 

 

Almost. Try

/restconf/data/devices/device=P3/live-status/clns-isis-oper:isis/instances/instance=ISIS-CORE

Thanks for your help, Jan!  

 

After wrestling with the module name and the keyless lists in the model, I ended up with this query that now works:

 

curl -X GET \
'http://X.X.X.X:8080/restconf/data/devices/device=P3/live-status/Cisco-IOS-XR-clns-isis-oper:isis/instances/instance=ISIS-CORE/topologies/topology?fields=ipv4-routes/ipv4-route/native-status/native-details/primary/source&depth=5' \
-H 'Accept: application/vnd.yang.collection+xml' \
-H 'Authorization: Basic xxxxxxxxxxxxxx=' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/yang-data+xml' \
-H 'Postman-Token: xxxxxxxxxxxxxx'

 

And that gets me all the prefixes and nodal sids that ISIS knows about.

Hi, Jan.

 

Can you give an example of using RESTCONF with live status with YANG NEDs?

 

This REST API works:

/api/operational/devices/device/P3/live-status/clns-isis-oper:isis/instances/instance/ISIS-CORE

 

I assumed it would translate to this RESTCONF:

/restconf/data/devices/device=P3/live-status/clns-isis-oper:isis/instances/instance/instance-name=ISIS-CORE

 

But it returns this error:

<error-message>uri keypath not found</error-message>
<error-tag>invalid-value</error-tag>
<error-type>application</error-type>

 

Thanks,

Shelly