It is possible for the client to send several edits within a single <edit-config> or <copy-config>request.
Sometimes it is useful to make sure certain data structures are validated and processed before other data structures.
The "sil-priority" extension can be used to control the order that edits are processed.
The ywx:sil-priority extension is used within a configuration data node definition to set the SIL priority for an object. The lower the number of the SIL priority, the higher priority it is assigned.
SIL callbacks are normally invoked in the order that the edits appear in the edit request. If the sil-priority is set then the order SIL callbacks are invoked will be based on the numeric priority value instead.
YANG File: netconf/modules/yumaworks/yumaworks-extensions.yang
Argument:
prio: number from 1 to 255
To define the extension in the YANG modules that you do not want to modify, you can use the following options:
- What is the --deviation parameter and how is it used
- What is the --annotation parameter and how is it used?
For more information on how to use deviations and annotations follow instructions in How do I define YANG annotation or deviation modules?
The SIL priority can also be set at run-time with an API function. This allows SIL priority to be setup in platform-specific ways, without needing to alter the YANG file for this purpose.
/******************************************************************** * FUNCTION agt_cb_set_sil_priority * * Set the desired SIL priority with a callback instead of * using the YANG extension for this purpose * * INPUTS: * defpath == Xpath with default (or no) prefixes * sil_priority = SIL priority value to use (1..255) * RETURNS: * status *********************************************************************/ extern status_t agt_cb_set_sil_priority (const xmlChar *defpath, uint8 sil_priority);
Example: Set the SIL priority to 30 for the /interfaces/interface list.
status_t res = agt_cb_set_sil_priority((const xmlChar *)”/if:interfaces/if:interface”, 30);
Example: Assume we have the following YANG module
module prio-test { ... container C { list LI (sil-prio: 110) list L2 (sil-prio: 100) container C1 { list L3 (sil-prio: 90) list L4 (sil-prio: 80) } ... {
The sil-priority is competed within nodes belong to the same parent. Otherwise, it runs in a top down order.
The following order will be applied to the CREATE, for instance, edit on the above data tree:
C -> L2 -> L1 -> C1 -> L4-> L3.
The edit config to create a tree may look as follow:
<config> <C xmlns="http://netconfcentral.org/ns/prio-test"> <LI> <name>list LI</name> </LI> <L2> <name>list L2</name> </L2> <C1> <L3> <name>list L3</name> </L3> <L4> <name>list L4</name> </L4> </C1> </C> </config>
When you create the above containers and lists the server will apply priorities and the edits order in the Validate phase, for instance, would look as follows, from the server's log:
undo for create op on prio-test:C7 silcall for prio-test:C silcall for prio-test:L2 silcall for prio-test:LI silcall for prio-test:C1 silcall for prio-test:L4 silcall for prio-test:L3 Finished setup of transaction callbacks Start invoking validate SIL callback for create on prio-test:C (C) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:C Start invoking validate SIL callback for create on prio-test:L2 (L2) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:L2 Start invoking validate SIL callback for create on prio-test:LI (LI) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:LI Start invoking validate SIL callback for create on prio-test:C1 (C1) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:C1 Start invoking validate SIL callback for create on prio-test:L4 (L4) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:L4 Start invoking validate SIL callback for create on prio-test:L3 (L3) Enter EDIT-2 callback ------PHASE:validate;EDITOP:create Finished invoking user callback on prio-test:L3