cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2315
Views
10
Helpful
4
Replies

RESTCONF DELETE

RichardD2
Level 1
Level 1

I can deploy my service with:

HTTP GET call
http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:interface_migrate 

XML payload:
<interface_migrate xmlns="http://com/example/interface_migrate">
    <device>router2</device>
    <Bundle-Ether-interface>160</Bundle-Ether-interface>
    <shudown>true</shutdown>
</interface_migrate>

DELETE the service doesn't seem to work 

DELETE 
DELETE:
http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:interface_migrate

With or without payload

Returns

{
  "errors": {
    "error": [
      {
        "error-message": "uri keypath not found",
        "error-tag": "invalid-value",
        "error-type": "application"
      }
    ]
  }
}

When I check to see what's deployed on the device i can see

admin@ncs# show devices device router2 service-list                                                                                                                                                                                          
service-list [ "/ncs:services/interface_migrate {router2}" "/ncs:services/interface_migrate{router2 102}" ]

So how do I pass this in the URL? I have tried adding "router2 102",  {router 2 102}, =router2 and just about every other combination I could think of?

Anyone know what I am missing?

thank you in advance

1 Accepted Solution

Accepted Solutions

For get or delete of a multi-key instance you need to provide both keys comma-separated.

This should do it:

 

DELETE/GET:
http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:interface_migrate=router2,102

 

View solution in original post

4 Replies 4

lmanor
Cisco Employee
Cisco Employee

Hi Richard,

 

So assuming that your service interface_migrate is a list and the key looks like <device>router2<\device> is the key/instance identifier.

 

To delete this instance you'd need to add the key to your URL:

 

http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:interface_migrate=router2

should work.

 

It looks like in you DELETE's below, you have an added "_" in front of you service name - interface_migrate:_interface_migrate:

DELETE:
http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:_interface_migrate

 I'm not sure you you've gotten a {router2 102} as a service instance in your service list for the device, had you previously used that as a <device> value previously?

 

If you do your GET with accept "application/vnd.yang.collection+xml" does that instance get shown?

 

Hi Larry,

The leading _ was a typo on my part. Adding =router2 to the url just gives me the same results.

My YANG model looks like this:

list interface_migrate {
    key "device Bundle-Ether-interface";

#show devices device router2 service-list returns:

service-list [ "/ncs:services/interface_migrate{router2 102}" ]

So with both device and Bundle-Ether-interface as keys to the list, how would I include both in the URL as I seem to be unable to delete without both.

Thanks

Richard

For get or delete of a multi-key instance you need to provide both keys comma-separated.

This should do it:

 

DELETE/GET:
http://{{NSO_IP}}:{{NSO_HTTP_PORT}}/restconf/data/tailf-ncs:services/interface_migrate:interface_migrate=router2,102

 

Thanks Larry, that did it!
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: