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

How to control the order of deletion of list entries when DELETE is issued for an entire list?

ajbharad
Cisco Employee
Cisco Employee

How to control the order of deletion of list entires when DELETE is issued for an entire list ?
We have implemented get_next function which returns list keys in desired order. 
But, DELETE is called on list keys based on Alphabetical order. 

5 Replies 5

KJ Rossavik
Cisco Employee
Cisco Employee

The nature of a transaction is that the system carrying out the transaction can do it in any order (or parallel) as it sees fit. If a client system wants to control a sequence of events, then it would need to issue individual transactions in the required order.

Its not possible in our case.

We cannot ask customer to follow a specific order while deleting. 

From code, how to differentiate DELETE of LIST Entry VS DELETE of entire LIST ?

Is there any other way in which we can achieve this ? 

Perhaps you can provide some more detail on you use-case and what you are currently attempting

Is this list a from a device yang model? a particular config item?

If you delete the entire list in an NSO transaction all list entries (and resulting device configuration) will get deleted in that same transaction regardless of the order..

There are ways in yang to order the list.. for example from Yang RFC 7950:

7.7.7.2. ordered-by user

   The entries in the list are ordered according to an order defined by
   the user.  In NETCONF, this order is controlled by using special XML
   attributes in the <edit-config> request.  See Section 7.7.9 for
   details.

Just not sure it is applicable to you case due to lack of details on what you are trying to do.

 

Thanks for the reply. 

Our model is like this : 

list Interfaces {

    key name;

    leaf name {

        type string;

    }

    leaf parent {

       type string;

    }   

We have registered callback functions for this list.

We want to delete interfaces in a specific order. 

Interfaces with parent as NONE should be deleted first and then interfaces with those as parent and the logic goes in same recursive way..... 

 

When DELETE is issued on the entire list, NSO is doing "get_next".

We are returning the interfaces names in proper order. 

But, still NSO chose to delete in Alphabetic order. 

This is creating issue in our DELETE function.

We can use "ordered-by user" in the yang file.