05-26-2020 11:31 PM - edited 05-28-2020 01:02 AM
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.
05-28-2020 03:06 AM
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.
05-28-2020 04:16 AM
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 ?
05-28-2020 07:55 AM
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:
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.
05-28-2020 08:40 AM
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.
06-03-2020 12:41 PM
We can use "ordered-by user" in the yang file.
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