cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
761
Views
10
Helpful
2
Replies
ian.scheidler1
Enthusiast

Service Upgrade when Templates have changed / Multiple versions of templates

Hi,

in a PoC the customer has come up with the following question:

 

How does NSO handle or can NSO handle multiple versions of the same template?

Imagine the following scenario:

 

We have a NSO test installation and a production installation as well as a given service (e.g. VPN Provisoning).

The service template has been changed and tested on the test installation.

Now the service with the new template shall be rolled out in production. BUT the service with the new template shall be only productively rolled out in a few locations (with little impact on overall network). Other service instances should not be altered (i.e. use the old template version). Once the rollout in the test locations has been approved the new version of the service can be rolled out network wide.

 

How does NSO in general handle multiple versions of templates (if at all)?

 

In the given example how would NSO/Fastmap know how to delete an old service instance (i.e. using old template) if it isn't really aware of the old template anymore (I assume it needs that info to determine which config snippets to undo in case of a DELETE)?

 

Or would the above scenario have to be implemented by using a copy of the initial service. e.g. an old service "VPN" (old template) and a new service "VPNv2" (new template) with entirely different namespaces as not to affect service instances using the old template?

 

All help very much appreciated and any additional, more general info on service versioning mechanisms in NSO would also be welcome. Thanks.

 

P.S.: I have looked at the Service Upgrade example in examples.ncs (.../examples.ncs/getting-started/14-upgrade-service) as well as here in the Forum (service upgrade with python) but these examples seem to deal only with changes in the YANG model (from version to version), not with changes in the XML template(s).

1 ACCEPTED SOLUTION

Accepted Solutions
rogaglia
Cisco Employee

Hi,

When you load the new service package into NSO, the changes will be applied as you "redeploy" your service instances. What could be an issue is that your services instances that do have changes will be "out-of-sync" until you re-deploy them.

 

What I have done in a customer is to play with the template XML file name by adding the version as a suffix. So, I loaded the all the template versions into NSO and then do something like:

 

   def cb_create(self, tctx, root, service, proplist):
        self.log.info('Service create(service=', service._path, ')')
        current_version = service.current_config_version
        version_config_container = service.version[str(current_version)]
        template_version = version_config_container.template_version.string
        template_name = "l2vpn_v" + template_version
        vars = ncs.template.Variables()
        template = ncs.template.Template(version_config_container)
        template.apply(template_name, vars)

 

As you can see, the template version to be applied is chosen in the service API. With this info, you can migrate site by site in any way you want. This way you can also go back to apply the old template if you find any issue. Also, you can fix a default template version for new services and you only change it when you feel confident on the new configuration.

 

Roque

 

View solution in original post

2 REPLIES 2
rogaglia
Cisco Employee

Hi,

When you load the new service package into NSO, the changes will be applied as you "redeploy" your service instances. What could be an issue is that your services instances that do have changes will be "out-of-sync" until you re-deploy them.

 

What I have done in a customer is to play with the template XML file name by adding the version as a suffix. So, I loaded the all the template versions into NSO and then do something like:

 

   def cb_create(self, tctx, root, service, proplist):
        self.log.info('Service create(service=', service._path, ')')
        current_version = service.current_config_version
        version_config_container = service.version[str(current_version)]
        template_version = version_config_container.template_version.string
        template_name = "l2vpn_v" + template_version
        vars = ncs.template.Variables()
        template = ncs.template.Template(version_config_container)
        template.apply(template_name, vars)

 

As you can see, the template version to be applied is chosen in the service API. With this info, you can migrate site by site in any way you want. This way you can also go back to apply the old template if you find any issue. Also, you can fix a default template version for new services and you only change it when you feel confident on the new configuration.

 

Roque

 

View solution in original post

I could add that the template is not used for deletion, NSO tracks what was created and deletes (or decreases the reference counter on) exactly that, regardless of the templates. As long as the service code (or template processing instructions) knows when to apply which template, you're good.