cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1629
Views
5
Helpful
2
Replies

'wait-for-lock' by config or ncs.conf

Koji Yokoe
Cisco Employee
Cisco Employee

Hi. I want an advice from someone who are familiar with 'wait-for-lock' which has been implemented since NSO 4.4.2 as follows.

- ncs: 'sync-from'/'sync-to'/'check-sync'/'partial-sync-from' actions now
have a 'wait-for-lock' parameter that can be used to specify a timeout
that the action waits until the device lock is released and any commit
queue items that contain the device are done. If the 'wait-for-lock'
parameter is not specified, the action will fail immediately for the
device if the lock is taken for the device or if the device is placed
in the commit queue.

A commit now use the /devices/global-settings/commit-retries to wait
for any device lock to be released.

(Issue tracker: #27591)

When compare-config and sync-to are executed almost at the same time (compare-config first, sync-to second), sync-to fails as follows because device is locked in a compare-config-operation.

# devices device R1 sync-to
result false
info R1: Device is locked in a compare-config operation by session 328060

This can be solved by adding 'wait-for-lock' option as follows.

# devices device R1 sync-to wait-for-lock { timeout 60 }
# (Success after waiting for device unlocked)

I was expecting this is also achieved by /devices/global-settings/commit-retries setting because above statement says so.

(config)# devices global-settings commit-retries timeout 60
(config)# commit
Commit complete.

But it doesn't work as follows.

# devices device R1 sync-to
result false
info R1: Device is locked in a compare-config operation by session 328630

Is it any way to achieve it by config or ncs.conf setting?

1 Accepted Solution

Accepted Solutions

gmuloche
Cisco Employee
Cisco Employee

According to the YANG model in my NSO 5.2.0.3 install for devices you can configure it at the global-settings level:

  revision 2019-04-09 {
    description
      "Released as part of NCS-5.1.
       ...
       Added 'wait-for-lock' choice under
       'device-profile-parameters'
       grouping.

 

 

And the mentioned grouping:

 

    grouping device-profile-parameters {
      description
        "A set of parameters to use when communicating with a device.

         These parameters can be set on:

           o  global-settings
           o  device-profile
           o  device

         If a parameter is set on the device, its value is used.
         Otherwise, if the paramater is set in the device's
         device-profile, its value is used.  Otherwise, the global
         setting is used, if set.  Otherwise, the value used depends on
         the NED type.";

      uses timeouts;

      uses wait-for-lock{
          refine wait-for-lock-choice{
            description
              "When an action accepting the wait-for-lock parameter is
               called without providing the wait-for-lock parameter, the
               wait-for-lock-choice device setting is going to be used.";
          }
      }

I checked NSO 4.7.4.2 YANG model and this is not present so it seems you can achieve what you want starting with NSO 5.1

 

 

 

View solution in original post

2 Replies 2

gmuloche
Cisco Employee
Cisco Employee

According to the YANG model in my NSO 5.2.0.3 install for devices you can configure it at the global-settings level:

  revision 2019-04-09 {
    description
      "Released as part of NCS-5.1.
       ...
       Added 'wait-for-lock' choice under
       'device-profile-parameters'
       grouping.

 

 

And the mentioned grouping:

 

    grouping device-profile-parameters {
      description
        "A set of parameters to use when communicating with a device.

         These parameters can be set on:

           o  global-settings
           o  device-profile
           o  device

         If a parameter is set on the device, its value is used.
         Otherwise, if the paramater is set in the device's
         device-profile, its value is used.  Otherwise, the global
         setting is used, if set.  Otherwise, the value used depends on
         the NED type.";

      uses timeouts;

      uses wait-for-lock{
          refine wait-for-lock-choice{
            description
              "When an action accepting the wait-for-lock parameter is
               called without providing the wait-for-lock parameter, the
               wait-for-lock-choice device setting is going to be used.";
          }
      }

I checked NSO 4.7.4.2 YANG model and this is not present so it seems you can achieve what you want starting with NSO 5.1

 

 

 

Hi Guillaume.

Thank you for your kind advice.

Yes. You are right. In NSO 5.2.0.3, I could configure 'wait-for-lock' and it worked as expected.

Here is a log from my test.

 

admin@ncs# show ncs-state version
ncs-state version 5.2.0.3

 

First, I executed 'compare-config'

admin@ncs# devices device vCPE001 compare-config

 

Right after this, I executed 'check-sync'. It failed as I expected due to the lock by 'compare-config'

admin@ncs# devices device vCPE001 check-sync
result error
info vCPE001: Device is locked in a compare-config operation by session 39

 

Then I added 'wait-for-lock' option to the command.

Of course it works (same as NSO 4.7)

admin@ncs# devices device vCPE001 check-sync wait-for-lock { timeout 60 }
result in-sync

 

Then I configured 'wait-for-lock' which is newly implemented at NSO 5.x

 

admin@ncs# config
Entering configuration mode terminal

admin@ncs(config)# devices global-settings wait-for-lock timeout 60
admin@ncs(config)# commit
Commit complete.
admin@ncs(config)# exit

 

Then I executed check-sync without 'wait-for-lock' option right after compare-config.

It worked as I expected.

admin@ncs# devices device vCPE001 check-sync
result in-sync

 

I would be glad if it was implemented at NSO 4.x

 

Thank you again Guillaume