12 Replies Latest reply on Jan 26, 2016 5:06 AM by alcapone489

    Script for HP/H3C Switches

    lls71

      Hi!

       

      I'm trying to backup the config of our new HP (H3C) Switches (5120, 5800, 10500). The script I created out of the Custom.Template is not working. The prompt of the switches is "<SWITCHNAME>", not "SWITCHNAME>" as in Ciscos IOS. So the script returns the error "Did not receive expected prompt when entering Enable mode".

      Has anybody managed to create a script that works with the HP H3C switches?

       

      Regards, lls71

        • Re: Script for HP/H3C Switches
          Steve Welsh

          What happens to the device prompt when you enter enable/privileged mode?   Does it change from <SWITCHNAME> to [SWITCHNAME] ?

           

          Did the CatTools provided HP.Switch.2500 device type not work for these HP switches?

           

          Steve

            • Re: Script for HP/H3C Switches
              lls71

              Hi Steve,

               

              the 5200, 5800, 10500 are H3C switch models that HP took into their portfolio. The 2500 switch is a HP ProCurve switch. The command line interface is not the same.

               

              After usename & password the switch responds with

               

              <SWITCHNAME>

               

              When you issue the command "system-view" the switch answers with

               

              [SWITCHNAME]

               

              as you already guessed.

               

              Regards, Leonardo

                • Re: Script for HP/H3C Switches
                  Steve Welsh

                  Hi Leonardo,

                   

                  From your custom script, I can tell that the error message you are seeing will occur if you reach the timeout value (default is 30 seconds) after the CR is sent to execute the enable mode command:  "system-view".

                   

                  What should be happening is CatTools should be detecting one of the following responses:

                   

                      ' Expected possible default return values in order we want to test for them

                      rgMult(1) = cl.DeviceEnablePrompt

                      rgMult(2) = cl.DeviceVTYPrompt

                      rgMult(3) = DEVICE_PASSWORDPROMPT     (being "password: ")

                      rgMult(4) = DEVICE_USERNAMEPROMPT      (being "login as: ")

                   

                  (Unless you have overridden the prompts in rgMult(3) or rgMult(4) in the 'Prompts' tab of the device set-up.)

                   

                  If you turn on 'File > Enable Capture Mode' a device debuglog file will be generated in the \Debug folder which may give you an idea as to what the device is getting stuck on.

                  At the end of the session capture, you should see the expected values of cl.DeviceEnablePrompt and cl.DeviceVTYPrompt.

                   

                  Steve

                    • Re: Script for HP/H3C Switches
                      lls71

                      Here's the result:


                      <NEWSESSION CatTools 3.6.0 28.09.2012 07:55:16>
                      <PROTOCOL=SSH2>
                      <DEVICE TYPE=Custom.HP.H3CSwitch>
                      <ACTIVITY TYPE=Device.ConnectivityTest.Login>
                      <ACTIVITY SCRIPT=C:\Programme\CatTools3\Scripts\Client.Device.ConnectivityTest.Login.txt>
                      <USERS NAME FOR DEVICE=PVIESWFB0001>
                      <C OK 07:55:16><R-07:55:16>[13][10]******************************************************************************[13][10]* Copyright (c) 2010-2012 Hewlett-Packard Development Company, L.P.          *[13][10]* Without the owner's prior written consent,                                 *[13][10]* no decompiling or reverse-engineering shall be allowed.                    *[13][10]******************************************************************************[13][10][13][10]<PVIESWFB0001><W-07:55:16>[13]<R-07:55:16>[13][10]<PVIESWFB0001><W-07:55:17>[13]<R-07:55:17>[13][10]<PVIESWFB0001><W-07:55:17>system-view<R-07:55:17>s<R-07:55:17>ystem-view<W-07:55:17>[13]<R-07:55:17>[13][10]System View: return to User View with Ctrl+Z.<R-07:55:17>[13][10][PVIESWFB0001]<W-07:55:17>[13]<R-07:55:17>[13][10][PVIESWFB0001]<W-07:55:17>[13]<R-07:55:17>[13][10][PVIESWFB0001]
                      ================================================================================
                      WFMDRetVal=1 Waiting for: "<PVIESWFB0001>"
                      WFMDRetVal=2 Waiting for: "<PVIESWFB0001]"
                      WFMDRetVal=3 Waiting for: "<PVIESWFB0001]"
                      WFMDRetVal=4 Waiting for: "(config-"
                      WFMDBuffer="[13][10][pvieswfb0001]"
                      ================================================================================
                      <W-07:55:47>quit[13]<D 07:55:47>
                      <SCRIPT VALUES>
                      <HOSTNAME="<PVIESWFB0001">
                      <PROMPT VTY="<PVIESWFB0001>">
                      <PROMPT ENABLE="<PVIESWFB0001]">
                      <PROMPT CONFIG="<PVIESWFB0001]">

                       

                      So the script is waiting for the wrong prompt value...

                       

                      Regards, Leonardo

                        • Re: Script for HP/H3C Switches
                          Steve Welsh

                          You need to override the cl.DeviceEnablePrompt and cl.DeviceVTYPrompt prompt values to switch the first character '<' with a '['.


                          Steve

                            • Re: Script for HP/H3C Switches
                              max1

                              Hi Steve,

                               

                              I am having the same problem.

                               

                               

                              I keep getting the error message: "Failed to enter enable mode".

                               

                              I have a HP SW 5900. I know that I need to change the script from "enable" to "system view". But can't figure out how to do/change it. The file is encrypted.

                               

                              How do you change the script?

                              I am looking at the script: C:\Program Files (x86)\CatTools3\Scripts\Client.Device.Backup.Running Config.txt but the file is encrypted.

                               

                              Please help!

                               

                              Thanks!

                          • Re: Script for HP/H3C Switches
                            linklight

                            Did you ever get your H3C/A Series scripts to work? I am actually trying to get this done right now.

                      • Re: Script for HP/H3C Switches
                        bkyle

                        I would recommend trying version 3.10.0.  Support for newer HP switches was added:

                         

                        This version includes the following enhancements:

                        • Variations added to the following device types: Cisco Router.General, Cisco.Switch.IOS.
                        • Variations added to the following device types: Dell.Switch.CLI, HP.Switch.2500, and Enterasys.SecureStack.
                        • Monthly Scheduling options on Activites.
                        • Support for Cisco Small Business devices.
                        • Support for HP Devices 12000, 12500, and 3500.
                        • New option to ignore a block of text from comparison during Device Running Config activity.
                        • Support for Windows Server 2012 R2
                        • Newest SolarWinds licensing framework adopted
                        1 of 1 people found this helpful
                        • Re: Script for HP/H3C Switches
                          lmodin

                          Hi, did anyone ever get this to work? I have a couple of HP/H3C 5120 SI switches that I want to pull the configuration from.

                           

                          I'm using 3.10 version, but I can't get it to work.

                            • Re: Script for HP/H3C Switches
                              bkyle

                              Please do the following:

                               

                              1. Use the CatTools File menu to select the "Enable capture mode" option.

                              2. Run the activity you are having trouble with. This should create a debug file in the \CatTools3\Debug folder.

                              3. Remember to deselect the "enable capture mode" option again.

                               

                              Remove any sensitive information, and upload the file.

                            • Re: Script for HP/H3C Switches
                              shaun jensen

                              Here is a final working script for H3C switches such as the HP v1910 series and 3COM 2900 series. The key changes from your script are:

                              Once logged in with the _cmdline-mode on command you are at a privileged prompt.

                               

                              Private Const DEVICE_PRIVILEGEDPROMPT = ">"

                               

                              system-view is the config mode instead of the enable mode

                               

                              Private Const COMMAND_ENTERENABLEMODE = ""

                              Private Const COMMAND_EXITENABLEMODE = ""

                              Private Const COMMAND_ENTERCONFIG = "system-view"

                              Private Const COMMAND_EXITCONFIG = "quit"

                               

                              To send the -cmdline-mode on command add this line to Function SendPostLoginCommands()

                               

                              cl.SendData "_cmdline-mode on" & vbCr & "Y" & vbCr & "512900" & vbCr

                               

                              Final script is attached.

                                • Re: Script for HP/H3C Switches
                                  alcapone489

                                  Hi shaun,

                                   

                                  I just tried to implement your script, but don't get it working.

                                   

                                  How can I use it?


                                  I tried to import it as activity, even as device type but either the first nor the second possibility is working.


                                  Can you describe me how to use / import it?

                                   

                                  Thanks in advance,

                                  Patrick