09-04-2024 07:09 AM
I want to reconcile the existing configuration with the NSO service. NSO is trying to delete line vty 0 4, which is not allowed by the router since it is part of the Day 0 configuration to establish an SSH session.
<vty>
<first>0</first>
<last>4</last>
<access-class>
<access-list>
<direction>in</direction>
<access-list>100</access-list>
</access-list>
</access-class>
</vty>
admin@ncs(config)# services my-service asr1006x re-deploy reconcile
line vty 0 4
! Refcount: 1
! Backpointer: [ /ncs:services/my-service:my-service[my-service:device='asr1006x'] ]
exec prompt timestamp
! Refcount: 1
Aborted: by user
Question:
How can I reconcile the vty line 0 4 with a refcount of 2?
With create, NSO makes the refcount 2, while with reconcile, it makes it 1. that's why with no services my-service asr1006x tries to delete hardcoded config.
09-06-2024 05:59 AM
One variant to avoid this issue is to have a separate service read and set (take ownership) of the "day 0 configuration" so that another service will not delete it.
09-09-2024 04:16 AM
Another is to use the pre modification callback to create the 'line vty 0 4' config, so that when the create callback is called, this config is already present. The effect will be that the service removal even when you reconcile the service does not remove this config.
See https://developer.cisco.com/docs/nso/guides/services-deep-dive/#service-callbacks
and https://developer.cisco.com/docs/nso/guides/templates/#service-callpoints-and-templates
it might be enough to just define a template for this pre-modification callback.
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