cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
80
Views
3
Helpful
2
Replies
Cisco Employee

Applying different configurations for different IOS-based platforms

Hi,

in some cases, the same "logical" configuration is applied differently across several IOS or IOS-XE platforms. For example, on some platform you can create subinterface, on some others you will have to create service instances and BDI or vlan interfaces etc.

The question is - what is the best way for a service (say Python-based) to find out what is the exact platform of the device configured with IOS NED and apply the right template accordingly?

Thanks in advance

2 REPLIES 2
Highlighted
Beginner

Re: Applying different configurations for different IOS-based platforms

Hi Djordje,

The best way in my opinion is using python mapping with templates. As you said, the configuration will be logically the same for all platforms - you define the variables which represent your service and push those variables to the template. So you can use the same template (same xml file) for all platforms and it would look something like this:

<config-template xmlns="http://tail-f.com/ns/config/1.0">

  <devices xmlns="http://tail-f.com/ns/ncs">

    <device>

      <name>{$DEVICE}</name>

      <config>

 

        <!-- IOS XR -->

        <interface xmlns="http://tail-f.com/ned/cisco-ios-xr">

             <GigabitEthernet>

               <id>{$INTF_NUM}</id>

               <description>{$DESCRIPTION}</description>

             </GigabitEthernet>

        </interface>

        <!-- JUNOS -->

        <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">

         <interfaces>

           <interface>

             <name>{$INTF_NUM}</name>

             <description>{$DESCRIPTION}</description>

           </interface>

         </interfaces>

       </configuration>

      </config>

    </device>

  </devices>

</config-template>

Template engine will know based on the device you push to the template ($DEVICE variable) what kind of platform it is, and then based on the namespace (e.g. http://tail-f.com/ned/cisco-ios-xr ), apply the correct configuration for the right device type.

Simon

Cisco Employee

Re: Applying different configurations for different IOS-based platforms

Hi,

Check the platform status information. It gets filled with the device platform name and os version. You can then use it in your service code.

See example using ALU but the same will work with Cisco.

To check your devices just perform (in basic mode): #show devices device MYDEVICE platform

Roque

<port xmlns="http://tail-f.com/ned/alu-sr" when=

      "{starts-with(/../../ncs:devices/ncs:device[ncs:name=/device]/ncs:platform/ncs:model,'7750')}">

        <port-id>{/port}</port-id>

          <ethernet>

            <egress-scheduler-policy>NO_CROZON</egress-scheduler-policy>

            <egress-scheduler-override>

              <max-rate>{/max-rate}</max-rate>

            </egress-scheduler-override>

          </ethernet>

          <shutdown>false</shutdown>

      </port>

     

      <port xmlns="http://tail-f.com/ned/alu-sr" when=

      "{starts-with(/../../ncs:devices/ncs:device[ncs:name=/device]/ncs:platform/ncs:model,'7705')}">

        <port-id>{/port}</port-id>

        <ethernet>

          <egress-rate>{/max-rate}</egress-rate>

        </ethernet>

        <shutdown>false</shutdown>

      </port>

     

      <port xmlns="http://tail-f.com/ned/alu-sr" when=

      "{starts-with(/../../ncs:devices/ncs:device[ncs:name=/device]/ncs:platform/ncs:model,'NETSIM')}">

        <port-id>{/port}</port-id>

        <ethernet>

          <egress-rate>{/max-rate}</egress-rate>

        </ethernet>

        <shutdown>true</shutdown>

      </port>