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

How to delete configuration on Junos via NSO

oldcreek12
Level 1
Level 1

Hi,

I am new to NSO, so apologize for my ignorance. I recently downloaded NSO 5.3 and I was able to successfully develop a static NAT service with real device being a Juniper vSRX, I can call API to successfully create a valid static NAT entry on vSRX, for example, 

 
$curl -i -X POST http://localhost:8080/restconf/data/ -u admin:admin -H "Content-Type: application/yang-data+xml" -d '<static_nat xmlns="http://com/example/static_nat">
>         <rule_name>nsonatrulename</rule_name>
>         <ext_pub_ip>192.168.1.3</ext_pub_ip>
>         <int_pri_ip>10.1.1.3</int_pri_ip>
>         <device>jnpr-dev-vsrx</device>
>  </static_nat>'
 
Now I wanted to delete this above NAT entry, it worked find on NSO CLI with "no static_nat nsonatrulename",  commit dry-run outputformat xml shows that corresponding XML snippet for this change is,
 
<static_nat xmlns="http://com/example/static_nat"
xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
nc:operation="delete">
<rule_name>nsonatrulename</rule_name>
</static_nat>
 
Now when I POST the above XML to API, I always get "HTTP/1.1 500 Internal Server Error", where did I do wrong?
1 Accepted Solution

Accepted Solutions

vleijon
Cisco Employee
Cisco Employee
So, the dry-run with the delete tag is a netconf payload, which you cannot send over the RESTCONF API. You can move to NETCONF but a way to achieve the same over the RESTCONF API is to use the DELETE action instead of POST, you can look at examples.ncs/getting-started/developing-with-ncs/13-restconf in your NSO install.

View solution in original post