cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
282
Views
0
Helpful
2
Replies

reconcile the existing configuration with the NSO service

BasharAziz
Level 1
Level 1

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

 

 

 
admin@ncs(config)# no services my-service asr1006x
admin@ncs(config)# commit dry-run outformat native
 
     name asr1006x
        data 
no hostname router01
        no line vty 5 15
        no line vty 0 4          
 
 

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.

 

 

 

 

2 Replies 2

cohult
Cisco Employee
Cisco Employee

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.

snovello
Cisco Employee
Cisco Employee

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.