cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
152
Views
1
Helpful
4
Replies
Highlighted
Cisco Employee

Template tags

 

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.

 

 

Regards,

 

-Fatih

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

 

Fatih,

 

 

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.

 

 

Best Regards,

 

/jan

 

View solution in original post

4 REPLIES 4
Highlighted
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>

 

 

Fredrik

 

Highlighted
Cisco Employee

 

Fatih,

 

 

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.

 

 

Best Regards,

 

/jan

 

View solution in original post

Highlighted
Cisco Employee

 

Thanks Fredrik, Jan,

 

Will try this now.

 

Regards,

 

-Fatih

 

Highlighted
Cisco Employee

 

works, interface is not deleted:)

 

many thanks

 

Regards,

 

-Fatih

 

Content for Community-Ad
Cisco Community October 2020 Spotlight Award Winners