cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2232
Views
10
Helpful
2
Replies

NSO, Convert a Service Request from REST API to RESTCONF

bfinnema
Cisco Employee
Cisco Employee

I am converting to RESTCONF, and I have success with RESTCONF calls to device setup, check-sync, etc., but not services.

I have NSO services, which I call over the REST API, e.g. like this:

http://{{host}}:8080/api/running/open-net-access/inventory?deep

using Content-Type and Accept application/vnd.yang.data+json

 

In this specific case the inventory is  container in the open-net-access service, and the data structure looks like this:

path "/open-net:open-net-access/open-net:inventory/....."
 
I have trouble figuring out how to convert this to RESTCONF. I looked at the documentation and this post: https://community.cisco.com/t5/nso-developer-hub-discussions/difference-between-rest-and-restconf/td-p/3506582
and this:
however, do not get it yet.
I think it is something like:
http://{{host}}:8080/restconf/data/open-net:open-net-access/inventory
using Content-Type and Accept application/yang-data+json
but I get:
{
  "errors": {
    "error": [
      {
        "error-message": "uri keypath not found",
        "error-tag": "invalid-value",
        "error-type": "application"
      }
    ]
  }
}
And I have tried several other uri's, but all with errors.
 
Do you know how to convert it to RESTCONF?
1 Accepted Solution

Accepted Solutions

lmanor
Cisco Employee
Cisco Employee

Usually the first thing to check is that the 'namespace identifier' e.g. the 'open-net' in your example:

open-net:open-net-access

Changes when converting from REST -> RESTCONF

In RESTCONF this needs to be the name of the module, not the prefix defined in the module as would be the case for REST.

Is your service, open-net-access a container, i.e. not a list? 

If it is a list, you'll need to specify the key, here's and example (this service is augmented under the services tree):

http://127.0.0.1:8080/restconf/data/tailf-ncs:services/l2vpnpy:l2vpn=BD-109/customer_id

l2vpn is the service in module l2vpnpy.

 

 

View solution in original post

2 Replies 2

lmanor
Cisco Employee
Cisco Employee

Usually the first thing to check is that the 'namespace identifier' e.g. the 'open-net' in your example:

open-net:open-net-access

Changes when converting from REST -> RESTCONF

In RESTCONF this needs to be the name of the module, not the prefix defined in the module as would be the case for REST.

Is your service, open-net-access a container, i.e. not a list? 

If it is a list, you'll need to specify the key, here's and example (this service is augmented under the services tree):

http://127.0.0.1:8080/restconf/data/tailf-ncs:services/l2vpnpy:l2vpn=BD-109/customer_id

l2vpn is the service in module l2vpnpy.

 

 

Thank you very much for the response. It made me understand what was wrong and how to do it.

open-net-access is a container, not a list. And the module is also called open-net-access.

This a GET of the inventory that works: http://{{host}}:8080/restconf/data/open-net-access:open-net-access/inventory

And this is used for POST and PATCH as well of new items in the inventory with details in the body of course.

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?