6 Replies Latest reply: Apr 10, 2013 11:30 PM by wanine39 RSS

Cisco IOS download via NCM TFTP

kad200

Has anyone ever used an NCM script to copy the IOS file from the SolarWinds server via TFTP to a Cisco Switch?

 

I am looking for an example to implement.

 

Thanks a mil

 
  • Re: Cisco IOS download via NCM TFTP
    Goliath

    Yup, works a treat. Commands used differ depending on the model of switch though, which models are you looking to test?

    • Re: Cisco IOS download via NCM TFTP
      kad200

      Cisco 2950 switch

      • Re: Cisco IOS download via NCM TFTP
        Goliath

        OK, you'll need to use the archive download-sw IOS command and make sure you have the relevant *.TAR image file in the \TFTP-Root directory of your Core server (the newer Cisco switches don't really like the old "copy tftp:<IOS filename.bin> flash:" commands - they use a subfolder in the flash: directory these days for the actual image file).

         

        The following script will ask you for the full IOS TAR filename as a variable when you fire it off via the Config Change Template (note that the IOS versions I've listed below may not be your versions, I've just put these in so I don't have to switch windows when I'm updating an IOS cos' I'm a lazy sod):

         

        /*

        .CHANGE_TEMPLATE_DESCRIPTION

                This template allows the upgrade of the IOS and associated web management tools on Cisco Catalyst switches.

        .PLATFORM_DESCRIPTION

                This runs on Cisco IOS devices.

         

         

        .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.

         

         

        .PARAMETER_LABEL @IOS_FILENAME

                The File Name of the new IOS Version.

        .PARAMETER_DESCRIPTION @IOS_FILENAME

                This should be a valid Cisco IOS File. No spaces are allowed, a script will not be generated for a Cisco IOS Filename that includes a space. Current IOS versions held on the server are:

                2960: c2960-lanbasek9-tar.122-58.SE2.tar

                3560: c3560-ipbaselmk9-tar.122-55.SE5.tar

                3560G: c3560-ipbasek9-tar.122-55.SE5.tar

                3750v1: c3750-ipbaselmk9-tar.122-55.SE4.tar

                3750v2: c3750-ipbasek9-tar.122-58.SE2.tar

         

         

        */

         

         

        script UpgradeIOS (

                                 NCM.Nodes @ContextNode,

                                 string @IOS_FILENAME )

        {

         

         

        string @CommandLine = 'archive download-sw /overwrite tftp://${StorageAddress}/' + @IOS_FILENAME

         

         

        if (@IOS_FILENAME contains ' ')

        {}

         

         

        else

        {

         

         

          foreach ( @node in @ContextNode )

          {

         

         

            if ( @node.Vendor == 'Cisco' )

            {

                CLI

                {

                  @CommandLine

                }

            }

          }

        }

         

         

        }

         

         

        If you want the switch to reload and take the new image immediately then you can add the /reload variable to the command line - I like to check that the IOS has uploaded successfully first to be honest then reload the switch early in the morning etc.

         

        Regards,

        John

    • Re: Cisco IOS download via NCM TFTP
      wanine39

      also be aware of flash and flash0, some IOS 15 reelease treat these as the same others are very picky