cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1866
Views
0
Helpful
5
Replies

Deletion of service instance

kbarve
Cisco Employee
Cisco Employee

Hi,

Where is the logic of deletion of service instance?

Issue that I am facing is: I used cisco-ios ned and configured net flow related configuration using service model. When i try to delete, it tries to clear the config with below clis :  Here it tries to delete interface also which is incorrect and it fails here.

native {

    device {

        name ISR

        data flow monitor MONITOR

              no exporter NTOP-EXPORTER

             !

             no flow exporter NTOP-EXPORTER

             interface GigabitEthernet0/0/0

              no ip flow monitor MONITOR input

              no ip flow monitor MONITOR output

             exit

             no flow monitor MONITOR

             no flow record RECORD

             no interface GigabitEthernet0/0/0 <<<<<

    }

}

So i would like to know where can I comment out "no interface GigabitEthernet0/0/0" in the ios ned?

1 Accepted Solution

Accepted Solutions

Jan Lindblad
Cisco Employee
Cisco Employee

The beauty of FastMap is that there is no delete code. And no modify code either. NSO will figure it out. The way NSO figures this out is by recording what your create() code did, and undo exactly that. So if NSO is deleting the interface as part of the service, that means the interface was created by the service.

So ensure interfaces are not created by your service. If your service uses a template, that usually means adding a tags="nocreate" on the interface, then a tags="merge" on the content inside the interface that should be created by the service instance.

View solution in original post

5 Replies 5

Jan Lindblad
Cisco Employee
Cisco Employee

The beauty of FastMap is that there is no delete code. And no modify code either. NSO will figure it out. The way NSO figures this out is by recording what your create() code did, and undo exactly that. So if NSO is deleting the interface as part of the service, that means the interface was created by the service.

So ensure interfaces are not created by your service. If your service uses a template, that usually means adding a tags="nocreate" on the interface, then a tags="merge" on the content inside the interface that should be created by the service instance.

kbarve
Cisco Employee
Cisco Employee

Thanks Jan.

What I was missing was doing a sync-from from device, Hence NSO was trying to create the interface and then eventually delete. When I did sync-from, everything is working fine.

Good that you pinpointed the problem! My comment still applies, however. You should ensure that your template has tags="nocreate" on the interface and any other elements that you don't want to belong to the service, and (usually) tags="merge" on what belongs to the service instance. Get into the habit of using the template tags correctly. Not being precise about these things may bite you again later.

On a related note. One issue we are facing with certain device platform (nbe200) where if an access-list rule is deleted for ACL in device, it deletes the complete ACL itself. So I was wondering, if there's any way to tell NSO that create a service, but don't allow "no" of that service. Basically to prevent the situation we see in this particular device. Can pre_mod solve the problem here?

There are ways to disallow service deletion, perhaps the best one is by restricting the users rights through aaa.

In your case there might be other ways of solving the root problem though. For instance if there is config that you want to keep forever once a service has been created once even if it si deleted, you can put the creation in pre_mod. This is slightly dangerous from a design standpoint, because it makes the service a bit “unclean”, but in some cases it might be the right thing for you.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: