cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
129
Views
1
Helpful
3
Replies

Template tags

khgrant
Cisco Employee
Cisco Employee

Hello Team,

 

Below is interface configuration part of our service config template:

<interface xmlns="urn:ios">

<Port-channel when="{$interface-type = 'Port-channel'}">

<name>{$interface-name}</name>

<service>

<instance>

<id>{$evc-id}</id>

<rewrite>

<ingress>

<tag>

<mode>symmetric</mode>

<pop>1</pop>

</tag>

</ingress>

</rewrite>

<description>{$description}</description>

<encapsulation>

<dot1q>

<id>{$vlan-id}</id>

</dot1q>

</encapsulation>

<ethernet/>

</instance>

</service>

</Port-channel>

</interface>

 

 

With this template, we can successfully create service instances under some Port-channel interface, say Port-channel10.

 

 

When we remove the services on NSO, with delete of the last service instance, the entire interface Port-channel10 is also removed from the device with:

 

no interface Port-channel10

 

 

We thought that the intreface is recorded also as part of the service, therefore was removed when services are deleted. Removal of the interface is not acceptable and causing outage on the customer.

 

So, question is how can we protect the interface from getting deleted?

 

 

I thought to add the xml tag: tags="nocreate" in the line of Port-channel as:

 

<Port-channel tags="nocreate" when="{$interface-type = 'Port-channel'}">

 

But then, the template did not create any service instance under an existing Port-channel interface. So, this behaved like "nocreate" for the entire clause under Port-channel..

 

 

How can resolve this issue to have the interface stay on the device even after the last service instance deletion?

 

 

Please note; existence of the interface is already checked at the beginning of the service. So, we know that we are working on an already existing interface. Problem is to maintain the interface even after services removal.

 

2nd note: Like Port-channel, we have physical interfaces of gigabitEthernet. Same behavior ends up with a

 

"no interface GigabitEthernet0/0/4"

 

down to the device;which is obviously rejected by the device.

 

1 ACCEPTED SOLUTION

Accepted Solutions

khgrant
Cisco Employee
Cisco Employee

Below is interface configuration part of our service config template:

 

...

                                         

 

With this template, we can successfully create service instances under some Port-channel interface, say Port-channel10.

 

 

When we remove the services on NSO, with delete of the last service instance, the entire interface Port-channel10 is also removed from the device with:

 

no interface Port-channel10

 

 

We thought that the intreface is recorded also as part of the service, therefore was removed when services are deleted. Removal of the interface is not acceptable and causing outage on the customer.

 

So, question is how can we protect the interface from getting deleted?

 

 

I thought to add the xml tag: tags="nocreate" in the line of Port-channel as:

 

<Port-channel tags="nocreate" when="{$interface-type = 'Port-channel'}">

 

But then, the template did not create any service instance under an existing Port-channel interface. So, this behaved like "nocreate" for the entire clause under Port-channel..

 

 

That is exactly what this tag means.

 

 

How can resolve this issue to have the interface stay on the device even after the last service instance deletion?

 

 

You need to add another tags="merge" at the level where the nocreate should no longer apply. Note! This is typically needed for each top level item inside the interface structure, so in multiple locations.

 

View solution in original post

3 REPLIES 3

khgrant
Cisco Employee
Cisco Employee

Hi!

 

"So, this behaved like "nocreate" for the entire clause under Port-channel.." - yes, that is correct

 

Please add e.g. tags="merge" to subsequent elements, e.g.

 

<Port-channel ... tags="nocreate">

...

<instance tags="merge">...</instance>

khgrant
Cisco Employee
Cisco Employee

Below is interface configuration part of our service config template:

 

...

                                         

 

With this template, we can successfully create service instances under some Port-channel interface, say Port-channel10.

 

 

When we remove the services on NSO, with delete of the last service instance, the entire interface Port-channel10 is also removed from the device with:

 

no interface Port-channel10

 

 

We thought that the intreface is recorded also as part of the service, therefore was removed when services are deleted. Removal of the interface is not acceptable and causing outage on the customer.

 

So, question is how can we protect the interface from getting deleted?

 

 

I thought to add the xml tag: tags="nocreate" in the line of Port-channel as:

 

<Port-channel tags="nocreate" when="{$interface-type = 'Port-channel'}">

 

But then, the template did not create any service instance under an existing Port-channel interface. So, this behaved like "nocreate" for the entire clause under Port-channel..

 

 

That is exactly what this tag means.

 

 

How can resolve this issue to have the interface stay on the device even after the last service instance deletion?

 

 

You need to add another tags="merge" at the level where the nocreate should no longer apply. Note! This is typically needed for each top level item inside the interface structure, so in multiple locations.

 

khgrant
Cisco Employee
Cisco Employee

works, interface is not deleted:)

 

many thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: