cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1195
Views
5
Helpful
2
Replies

Calling User Defined Actions using Netconf

cabottch@cisco.com
Cisco Employee
Cisco Employee

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>

 

 

1 Accepted Solution

Accepted Solutions

sstrollo
Cisco Employee
Cisco Employee

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

View solution in original post

2 Replies 2

sstrollo
Cisco Employee
Cisco Employee

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

Thanks so much for your help!!