12-04-2018 05:00 AM
Hello,
Does someone have an example of how to call a user defined function using Netfconf?
Currently, I am using REST API (please see below), requirement from customer is to use NETCONF:
POST
http://192.168.137.235:8080/api/running/EXAMPLE_ACTION/_operations/add-device-and-service
<input>
<device>
<name>MANOLAB-CPE-3</name>
<address>172.16.2.43</address>
<device_type>CISCO</device_type>
</device>
<VLANx>204</VLANx>
<PE_device>MANOLAB-PE</PE_device>
<IP_PE>10.0.1.205</IP_PE>
<IP_CPE>10.0.1.206</IP_CPE>
</input>
Solved! Go to Solution.
12-04-2018 10:46 AM
Hi,
Sure, you can invoke actions over NETCONF as well. Since the introduction of YANG 1.1 there is a standard RPC to do this, using your example the syntax would be (note that you need the correct namespace or you will get an error message):
<action xmlns="urn:ietf:params:xml:ns:yang:1"> <EXAMPLE_ACTION xmlns="http://correct/namespace/for/your/model"> <add-device-and-service> <device> <name>MANOLAB-CPE-3</name> <address>172.16.2.43</address> <device_type>CISCO</device_type> </device> <VLANx>204</VLANx> <PE_device>MANOLAB-PE</PE_device> <IP_PE>10.0.1.205</IP_PE> <IP_CPE>10.0.1.206</IP_CPE> </add-device-and-service> </EXAMPLE_ACTION> </action>
(Just for reference, since NSO supported actions before the YANG 1.1 standard, there is a custom way to invoke actions too - but it should only be used towards old versions of NSO or ConfD that does not support the new standard):
<action xmlns="http://tail-f.com/ns/netconf/actions/1.0"> <data> <EXAMPLE_ACTION xmlns="http://correct/namespace/for/your/model"> <add-device-and-service> <device> ... </add-device-and-service> </EXAMPLE_ACTION> </data> </action>
Hope that helps!
/Sebastian
12-04-2018 10:46 AM
Hi,
Sure, you can invoke actions over NETCONF as well. Since the introduction of YANG 1.1 there is a standard RPC to do this, using your example the syntax would be (note that you need the correct namespace or you will get an error message):
<action xmlns="urn:ietf:params:xml:ns:yang:1"> <EXAMPLE_ACTION xmlns="http://correct/namespace/for/your/model"> <add-device-and-service> <device> <name>MANOLAB-CPE-3</name> <address>172.16.2.43</address> <device_type>CISCO</device_type> </device> <VLANx>204</VLANx> <PE_device>MANOLAB-PE</PE_device> <IP_PE>10.0.1.205</IP_PE> <IP_CPE>10.0.1.206</IP_CPE> </add-device-and-service> </EXAMPLE_ACTION> </action>
(Just for reference, since NSO supported actions before the YANG 1.1 standard, there is a custom way to invoke actions too - but it should only be used towards old versions of NSO or ConfD that does not support the new standard):
<action xmlns="http://tail-f.com/ns/netconf/actions/1.0"> <data> <EXAMPLE_ACTION xmlns="http://correct/namespace/for/your/model"> <add-device-and-service> <device> ... </add-device-and-service> </EXAMPLE_ACTION> </data> </action>
Hope that helps!
/Sebastian
12-05-2018 10:01 AM
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