01-30-2020 05:42 PM
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>'
<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>
Solved! Go to Solution.
01-30-2020 05:59 PM
01-30-2020 05:59 PM
01-30-2020 08:16 PM
Thanks, I tried DELETE actions, it is not accepted/supported.
01-30-2020 08:58 PM
01-31-2020 08:26 AM
So, it looks like you create a service instance of service 'static-nat' called nsonatrulename (presuming that the service is a list and rule_name is the instance identifier (key to list))
After creation of your service instance as shown below, the delete of that instance would be accomplished by:
curl -i -X DELETE -u admin:admin http://localhost:8080/restconf/data/static-nat:static-nat=nsonatrulename
Simple example ('name' is key for service 'hostname' list):
$ curl -i -X POST http://localhost:8080/restconf/data/ -u admin:admin -H "Content-Type: application/yang-data+xml" -d '<hostname xmlns="http://com/example/hostname"> <name>hn1</name> <device>j-0</device> <zone>zone1</zone> <location>Boston</location> </hostname>'
HTTP/1.1 201 Created
$ curl -i -X DELETE -u admin:admin http://localhost:8080/restconf/data/hostname:hostname=hn1
HTTP/1.1 204 No Content
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide