1 Reply Latest reply on Sep 27, 2018 8:00 AM by 21122012

    Config Change Template LLDP Script

    21122012

      Hello all, is it possible to create a CCT that adds information to the description of the interfaces based on LLDP?
      Also, doing the same with CDP results with the FQDN and the full interface name.
      Is it possible to have just the name of the device and the interface abbreviation meaning
      instead of "mydevice1.domain.com GigabitEthernet1/1" to have "mydevice1 Gi1/1"

      Here is the script I am using for adding interfaces description based on CDP information.

       

      /*

      .CHANGE_TEMPLATE_DESCRIPTION

              This CCT adds information from CDP to interface description.

      .CHANGE_TEMPLATE_TAGS

          Cisco, CDP

      .PLATFORM_DESCRIPTION

              Cisco IOS

       

      .PARAMETER_LABEL @ContextNode

              NCM node

      .PARAMETER_DESCRIPTION @ContextNode

              The node the template will operate on.  All templates require this by default. The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.

       

      */

       

      script ConfigureCDPInterfacesDescription  (NCM.Nodes @ContextNode)

      {

         CLI

        {

          configure terminal

        }

       

      foreach (@cdpItem in @ContextNode.CiscoCdp)

      {

        

        foreach (@interfaceItem in @ContextNode.Interfaces)

        {

           if (@interfaceItem.InterfaceIndex== @cdpItem.IfIndex)

          {

            CLI

                {

                   interface @interfaceItem.InterfaceDescription

               description @cdpItem.RemoteDevice @cdpItem.RemotePort

               exit

                }

          }

        }

      }

       

        CLI

        {

          end

        }

      }

        • Re: Config Change Template LLDP Script
          21122012

          Hi, I made some changes but I still need your assistance:

          Basically I still need to automatically set the description of the interfaces based on the CDP name.

          The script  consist of 2 sections (green-blue) that are working fine when they are separately but not when they are together. So I am missing something in spite the validation is ok.

          One section is when the CDP neighbor contains the word "nap" (for Access Points) and the other the domain "contoso".

          Can you help me to combine these 2 sections and make the script work?
          I guess if this works it will be very useful to all of us, with a few clicks you will be able to set the CDP information into the interface description.

           

          /*

          .CHANGE_TEMPLATE_DESCRIPTION

                  This CCT adds information from CDP to interface description.

          .CHANGE_TEMPLATE_TAGS

              Cisco, CDP

          .PLATFORM_DESCRIPTION

                  Cisco IOS

          .PARAMETER_LABEL @ContextNode

                  NCM node

          .PARAMETER_DESCRIPTION @ContextNode

                  Node Selection

          */

          script ConfigureCDPInterfacesDescription  (NCM.Nodes @ContextNode)

           

          {

            CLI

            {

              configure terminal

            }

          string @underscore='_'

          string @newname

          string @newnameAP

          string @nap='nap'

          string @domain='contoso'

          foreach (@cdpItem in @ContextNode.CiscoCdp)

          {

           

            foreach (@interfaceItem in @ContextNode.Interfaces)

            {

              if (@interfaceItem.InterfaceIndex== @cdpItem.IfIndex)

                  {

                if (@cdpItem.RemoteDevice contains @nap)

                @newnameAP = Substring(@cdpItem.RemoteDevice,1,10)

                CLI

                    {

                      interface @interfaceItem.InterfaceDescription

                  description @newnameAP+@underscore+@cdpItem.RemotePort

                  exit

                    }

              }

              else if (@interfaceItem.InterfaceIndex== @cdpItem.IfIndex)

              {

                if (@cdpItem.RemoteDevice contains @domain)

                @newname = Substring(@cdpItem.RemoteDevice,1,12)

                CLI

                    {

                      interface @interfaceItem.InterfaceDescription

                  description @newname+@underscore+@cdpItem.RemotePort

                  exit

                    }

              }

            }

          }

           

            CLI

            {

              end

            }

          }