cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2617
Views
7
Helpful
2
Replies

nc:operation="delete" in XML template discouraged?

tnomura
Cisco Employee
Cisco Employee

Can I use nc:operation="delete" in XML template for deleting config?

The template will be called from Java code kiked from json rpc.

<Background>

I want to delete a config from NSO using XML template.

Device is ACI, NSO is 4.4.2 and NED is APIC NED 3.0.34.

This is how I get the XML template to do the job.

admin@ncs(config)# no devices device kws-VIM-A config cisco-apicdc:apic infraInfra infraPortTrackPol default adminSt on

admin@ncs(config)# commit dry-run outformat xml   

result-xml {

    local-node {

        data <devices xmlns="http://tail-f.com/ns/ncs">

               <device>

                 <name>kws-VIM-A</name>

                 <config>

                   <apic xmlns="http://tail-f.com/ned/cisco-apicdc">

                     <infraInfra>

                       <infraPortTrackPol>

                         <name>default</name>

                         <adminSt xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"

                                  nc:operation="delete"/>

                       </infraPortTrackPol>

                     </infraInfra>

                   </apic>

                 </config>

               </device>

             </devices>

    }

}

admin@ncs(config)#

The XML template I extracted from above output worked just fine.

But I found several past discussions discouraging the use of nc:operation="delete" and encouraging to use tags="delete" instead.

Couldn't quite figure out why the nc:operation="delete" was discouraged and if these discussions also apply to my case either.

(These discussions generally talks about "no shutdown" for IOS NED though.)

It would be very much appreciated if you can shed a light.

BTW, I also tried tags="delete", but it didn't work.

Probably a bug of APIC NED, but I am not going into that here.

Thank you very much in advance.

Takeru Nomura

1 Accepted Solution

Accepted Solutions

Jan Lindblad
Cisco Employee
Cisco Employee

Can I use nc:operation="delete" in XML template for deleting config?

No, templates are not NETCONF messages. They manipulate the CDB database.


But I found several past discussions discouraging the use of nc:operation="delete" and encouraging to use tags="delete" instead.

Couldn't quite figure out why the nc:operation="delete" was discouraged and if these discussions also apply to my case either.

(These discussions generally talks about "no shutdown" for IOS NED though.)

It would be very much appreciated if you can shed a light.

Well, if you are in a template, you need to use the template operation attributes, i.e. tags=... These templates have little to do with NETCONF, so NETCONF operation attributes have no effect here. These templates may be applied from the NSO CLI, update the CDB database and be sent to the device as a JSON/REST message. No NETCONF involved anywhere in the chain.

BTW, I also tried tags="delete", but it didn't work.

Probably a bug of APIC NED, but I am not going into that here.

NSO services work best when the service change is creating new data. Then NSO knows which service it belongs to, and will restore the config when the service is deleted. When a service deletes things, this tracking is not working the same way.

View solution in original post

2 Replies 2

Jan Lindblad
Cisco Employee
Cisco Employee

Can I use nc:operation="delete" in XML template for deleting config?

No, templates are not NETCONF messages. They manipulate the CDB database.


But I found several past discussions discouraging the use of nc:operation="delete" and encouraging to use tags="delete" instead.

Couldn't quite figure out why the nc:operation="delete" was discouraged and if these discussions also apply to my case either.

(These discussions generally talks about "no shutdown" for IOS NED though.)

It would be very much appreciated if you can shed a light.

Well, if you are in a template, you need to use the template operation attributes, i.e. tags=... These templates have little to do with NETCONF, so NETCONF operation attributes have no effect here. These templates may be applied from the NSO CLI, update the CDB database and be sent to the device as a JSON/REST message. No NETCONF involved anywhere in the chain.

BTW, I also tried tags="delete", but it didn't work.

Probably a bug of APIC NED, but I am not going into that here.

NSO services work best when the service change is creating new data. Then NSO knows which service it belongs to, and will restore the config when the service is deleted. When a service deletes things, this tracking is not working the same way.

Thank you for thorough explanation!