• Support
  • Articles
  • Resources
  • Products

Backup & restore BIOS setup on HP G7 material using ILO&RBSU

Moderator: boris

2 postsPage 1 of 1

hwarin
Newbie

Posts:
2
Joined: Sat Oct 13, 2012 4:34 pm
by hwarin » Sat Oct 13, 2012 4:57 pm
Hi,

I just wanted to share with interested peoples my last script - Please update me if you're using it, find it usefull, make some improvements, and/or have interesting comments ..

First : the "read me" part
==================

First comment : Apologies for my poor English ...
Second comment : I have found nowhere on the web any similar tool and explainations one the subject are very limited - TeraTerm seems to be the only Windows utility able to smartly script something with SSH. Please be free to experiment, use, and improve it; I would be very happy to know that sharing it whould have helped someone over the planet, so, please, let me know when you'll use it and the details of your usage.

Purpose of this script : Take an "out of band" full backup from a HP blade's BIOS configuration in order to deploy (replicate) this setup on many other similar blades. This script can be used on a blade having an OS already installed or on a brand new hardware.

Limitations :
- Currently, this have been only tested on BL460c G7 blades. This should work directly on any G7 HP hardwares embeding ILO3 device (BLxxxG7). It should be "quite easily" adaptable to any other ILO2 or ILO4 (G8 ? Never played yet with it) similar kind of material ...
- Entering to RBSU means that the blade will have to reboot ....

Motivations to have written this script :
- Many similar "non standard" configurations to be setup in a very limited delay.
- Avoid manual actions in order to avoid waste of time & always possible and uncontrolable mistakes when "manual" operates.
- Keep track of all action dones
- CONREP for WinPE 3.0 (from last HP's SSTK) is not 100% working (until now, I had not been unable to backup the full BIOS setup, including the disable on internal RAID board, using this tool; as much as enable/disable PXE) - Only a very partial subset of whole configurable items appears to be backupable/restorable with CONREP.
- My unability to use unix/linux as I have found that C-Kermit (university of Columbia) had published a quite similar tool that I can't manage !
- Usual non awareness of BIOS configuration details ... take default values as default ... even in big compagnies !
- Usual "I'm the customer, I can request anything"'s ITIL nonsense (whatever the workload behind).

Prerequisites :
- Target ILO must have minimal @IP setup to be normaly reachable from network
- Have an administrator account on target ILO
- TeraTerm correctly setup on the deployment server

Other things to view to complete the subject :
- HP's bladeblaster tools/scripts - With this scripts, it can help on blades mass deployment projects
- Setup ILO firmware
- Setup ILO configuration
- Boot once a blade on a poerticular CD (MemTest, WinPE, etc)
- What's next ?
Naturly, a "deploy many" script .....

Improvements to be done :
- In "load" mode, setup current's time/date to BIOS
- Have a look at blade's power status at starting of te script - currently, the blade must be powered on - an improvement would be to handle a powered off blade (powering it on at the start, then off at the end)
- Have a better control on answers from ILO (result OK/failed of each command). Currently, control can only be done by analysing resulting LOG file, so, no direct retry is possible yet.

Now, usage :

1) SAVE mode --> Take a copy of actual's BIOS configuration

C:\Documents and Settings\hwarin>"C:\Program Files\teraterm\ttpmacro.exe" /i /v "c:\Program Files\teraterm\BladeBlaster_V1.ttl" SAVE 10.10.10.10 bladeblaster bladeblasterpassword

Where :
- 10.10.10.10 is the @IP of your ILO to backup
- BladeBlaster is your administrator's user name of your ILO to backup
- BladeBlasterPassword is the user name's password of the user's ILO to backup

You will have :
- Target blade rebooted !
- A file containing the complete detailed log of actions done
C:\Documents and Settings\hwarin\Local Settings\Application Data\TTLEdit\Temp_TTL\console_<@IP>_<userName>_<Date>-<Time>.log
- A file containing backuped data
C:\Documents and Settings\hwarin\Local Settings\Application Data\TTLEdit\Temp_TTL\CONFIG_READ_FROM_BIOS_<@IP>_<userName>_<Date>-<Time>.log
==> Resulting file contains :
# SHOW PCI DEVICE ENABLE/DISABLE
# set pci device enable/disable <Device#> <State (0=Disable/1=Enable)>
# SHOW NIC PERSONALITY OPTIONS
# set nic personality options <Device#> <Protocol (1=iSCSI/2=FCoE)>
rbsu> SHOW DATE
10/12/12
rbsu> SHOW TIME
14:52
rbsu> SHOW SN
S/N: CZJ225xxxx
rbsu> SHOW PCI DEVICE ENABLE/DISABLE
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Enabled
2| PCI Embedded HP Smart Array P410i Controller Enabled
rbsu> SHOW NIC PERSONALITY OPTIONS
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 3 iSCSI
2| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 4 iSCSI
rbsu> SHOW CONFIG SCRIPT
SET CONFIG Advanced Memory Protection Advanced ECC Support
SET CONFIG Embedded Serial Port Disabled
.
.
.
.
SET BOOT 02 15333C10 00 02 00 03
SET BOOT 03 45323C10 00 0C 00 00

==> You'll have to slightly change this file before deploying it to any target blade :
- Any # will be treated as a comment in "load" mode (remaining characters of the line including # will be discarded)
- Lines with RBSU>, DATE, TIME, and S/N have to be commented or discarded (they're only here for tracking)
- About "PCI devices" & "NIC personality" : Help yourself with the commented reminder and replace accordingly RBSU's output. IE - Replace rbsu> SHOW PCI DEVICE ENABLE/DISABLE
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Enabled
2| PCI Embedded HP Smart Array P410i Controller Enabled
rbsu> SHOW NIC PERSONALITY OPTIONS
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 3 iSCSI
2| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 4 iSCSI
... by
set pci device enable/disable 1 1
set pci device enable/disable 2 0
set nic personality options 1 1
set nic personality options 2 1


2) LOAD mode --> Deploy a previously backed up BIOS configuration to a target blade

C:\Documents and Settings\hwarin>"C:\Program Files\teraterm\ttpmacro.exe" /i /v "c:\Program Files\teraterm\BladeBlaster_V1.ttl" C:\_BIOSCONF_\CONFIG_G7_ESX.txt 10.10.10.10 bladeblaster bladeblasterpassword

Where :
- C:\_BIOSCONF_\CONFIG_G7_ESX.txt is the complete file name of configuration to be deployed, aranged as described on "SAVE" section
- 10.10.10.10 is the @IP of your ILO to backup
- BladeBlaster is your administrator's user name of your ILO to backup
- BladeBlasterPassword is the user name's password of the user's ILO to backup

You will have :
- Targe blade rebooted !
- A file containing the complete detailed log of actions done
C:\Documents and Settings\hwarin\Local Settings\Application Data\TTLEdit\Temp_TTL\console_<@IP>_<userName>_<Date>-<Time>.log
- A file containing deployed data
C:\Documents and Settings\hwarin\Local Settings\Application Data\TTLEdit\Temp_TTL\WRITTEN_TO_BIOS_<@IP>_<userName>_<Date>-<Time>.log
==> Resulting file contains :
rbsu> SET PCI DEVICE ENABLE/DISABLE 2 0
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Enabled
2| PCI Embedded HP Smart Array P410i Controller Disabled
rbsu> SET NIC PERSONALITY OPTIONS 1 2
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 3 FCoE
2| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 4 FCoE
rbsu> SET NIC PERSONALITY OPTIONS 2 2
1| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 3 FCoE
2| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 4 FCoE
rbsu> SET CONFIG ADVANCED MEMORY PROTECTION ADVANCED ECC SUPPORT
Advanced Memory Protection
1|Advanced ECC Support <=
2|Online Spare with Advanced ECC Support
3|Mirrored Memory with Advanced ECC Support
4|Lockstep Mode with Advanced ECC Support
rbsu> SET CONFIG EMBEDDED SERIAL PORT COM 2; IRQ3; IO: 2F8H-2FFH
Embedded Serial Port
1|COM 1; IRQ4; IO: 3F8h-3FFh
.
.
.
.
5| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 1
6| PCI Embedded HP NC553i 10Gb 2-port FlexFabric Adapter Port 2
rbsu> SET BOOT 01 45323C10 00 0C 00 00
rbsu> SET BOOT 02 15333C10 00 02 00 02
==> In a mass deployment scheme, you'll have to compare (FC) whole resulting files to track for any issue ... (any different file !)




Second :the "script" part
=================


Code: Select all

  1.  
  2. ; Param2 = Save/<FileName to load>      SAVE    or      C:\_BIOSCONF_\CONFIG_G7_ESX.txt
  3. ; Param3 = ILO's @IP                    10.10.10.10
  4. ; Param4 = ILO's User                   BladeBlaster
  5. ; Param5 = User's password              BladeBlasterPassword
  6.  
  7. username = 'BladeBlaster'       ; Erased by param4
  8. hostname = '10.10.10.10'        ; Erased by param 3
  9.  
  10. strdim HelloText 500            ; 500 lines of LOG buffer --> Will fail after !
  11. FirstLine = 0                   ; First valuable line in LOG buffer
  12.  
  13. strdim SaveRBSU 7               ; Last entry should be empty ...
  14. SaveRBSU[0]='show date'
  15. SaveRBSU[1]='show time'
  16. SaveRBSU[2]='show sn'
  17. SaveRBSU[3]='show pci device enable/disable'
  18. SaveRBSU[4]='show nic personality options'
  19. SaveRBSU[5]='show config script'
  20. SaveRBSU[6]=''
  21.  
  22. RBSUState = 0                   ; Line count in RBSU actions [Load/Save]
  23.  
  24. ILOstate=0                      ; State within ILO prompt phase
  25. ; 0 = Entering ILO
  26. ; 1 = Reset blade
  27. ; 2 = Entering VSP
  28. ; 3 = ??? Entered to VSP ... []
  29. ; 4 = Exit- finished
  30.  
  31. WaitPrompt=0                    ; Global state
  32. ; 0 = ILO prompt
  33. ; 1 = Console VSP (Attends 'Esc (')
  34. ; 2 = Boot cycle (Attends 'key for network boot')
  35. ; 3 = RBSU prompt (Attends 'RBSU>') [SAVE]
  36. ; 4 = RBSU prompt (Attends 'RBSU>') [LOAD]
  37. ; 5 = RBSU completed [Load/Save]
  38.  
  39. FileName='<No log created ! >'
  40. RemChar = "#"                   ; Comment in config files while loading to BIOS
  41. LoadSpeed = 2                   ; Number of seconds to wait before/after each line sent to RBSU in LOAD mode
  42. SaveSpeed = 3                   ; Number of seconds to wait before/after each line sent to RBSU in SAVE mode
  43. WaitDelay = 60                  ; Delay at end of RBSU (seconds)
  44. ActionLoad = 0                  ; 0 => SAVE / >0 LOAD (handdle)
  45. Debug=0                         ; 0 ==> No debug prompt / 1 Some debug prompt + default params
  46. ; waitprompt=4                  ; Directly start in RBSU to speedup debuging
  47.  
  48. strlen param2
  49. if result=0 then
  50.   if Debug=1 then
  51.       ActionLoad=0                  ; ==> Save mode by default in debug mode
  52.   else
  53.     messagebox "Param 2 missing : SAVE/<FileNameToLoad>" "ERROR"
  54.     end
  55.   endif
  56. else
  57.   toupper param2 param2
  58.   strcompare param2 "SAVE"
  59.   if result<>0 then
  60.     filestat param2 FileSize
  61.     if Result=-1 then
  62.       messagebox "Param 2 <FileNameToLoad> : (not found ?)" "ERROR"
  63.       end
  64.     elseif FileSize=0 then
  65.       messagebox "Param 2 <FileNameToLoad> : EmptyFile" "ERROR"
  66.       end
  67.     else
  68.       ActionLoad=1                      ; ==> Contains file handle ==> >0 means "LOAD"
  69.       fileopen ActionLoad param2 0
  70.       if ActionLoad < 1 then
  71.         messagebox "Param 2 <FileNameToLoad> : (fileopen)" "ERROR"
  72.         end
  73.       endif
  74.     endif
  75.   else
  76.     ActionLoad=0    ; 0 means "Save"
  77.   endif
  78. endif
  79.  
  80. strlen param3
  81. if result=0 then
  82.   if Debug = 1 then
  83.     ; Nothing - Keep hostname as is
  84.   else
  85.     messagebox "Param 3 missing : <ILO's @IP>" "ERROR"
  86.     end
  87.   endif
  88. else
  89.   hostname=param3
  90. endif
  91.  
  92.  
  93. strlen param4
  94. if result=0 then
  95.   if Debug = 1 then
  96.     ; Nothing - Keep hostname as is
  97.   else
  98.     messagebox "Param 4 missing : <ILO_User>" "ERROR"
  99.     end
  100.   endif
  101. else
  102.   username=param4
  103. endif
  104.  
  105.  
  106. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  107. statusbox 'Connecting' 'Status'
  108.  
  109. strlen param5
  110. if result =0 then
  111.   msg = 'Enter password for user '
  112.   strconcat msg username
  113.   passwordbox msg 'Get password'
  114.   MyPassword=inputstr
  115. else
  116.   MyPassword = Param5
  117. endif
  118.  
  119. msg = hostname
  120. strconcat msg ':22 /ssh /auth=password /user='
  121. strconcat msg username
  122. strconcat msg ' /passwd='
  123. strconcat msg MyPassword
  124. strconcat msg ' /nosecuritywarning'
  125.  
  126. connect msg
  127. testlink
  128. if result = 2 then
  129.    setsync 1
  130.    timeout = 60
  131.  
  132.   getenv 'USERNAME' username
  133.   gettime timestr "%Y%m%d-%H%M%S"
  134.   getdir mdir
  135.   sprintf2 filename '%s\console_%s_%s_%s.log' mdir hostname username timestr
  136.   logopen filename 0 0
  137.   logwrite 'Log start'#13#10
  138.   logwrite '*****************************************************'#13#10
  139.  
  140.    statusbox 'SSH Connected' 'Status'
  141.    result=1
  142.    a=0
  143.    recvln
  144.    sendln ''
  145. ;   flushrecv
  146.    while result=1
  147.      strlen InputStr
  148.      if result >0 then
  149.        HelloText[a] = InputStr
  150.        toupper TempTxt InputStr
  151.        ; yesnobox TempTxt 'Received line'
  152.        if WaitPrompt = 0 then               ; Waiting ILO prompt ...
  153.            strscan TempTxt 'HPILO'
  154.            if result then
  155.              statusbox 'HPILO prompt reached' 'Status'
  156.              ;       messagebox TempTXT 'Recu'
  157.              if ILOState=0 then             ; on ILO prompt, first, reset
  158.                statusbox 'Sent RESET -> Wait next ILO prompt' 'Status'
  159.                sendln 'power reset'
  160.                ILOState=1
  161.                result = 1
  162.                pause 30
  163.              elseif ILOState=1 then         ; On ILO prompt, goto to text console
  164.                statusbox "Sent VSP -> Wait Esc '('" 'Status'
  165.                ; sendln 'vsp'
  166.                sendln 'start /system1/oemhp_vsp1'
  167.                ILOState=2
  168.                result = 1
  169.              elseif ILOState=2 then         ; On ILO prompt, one more [enter] key
  170.                statusbox "??? -> Wait Esc '('" 'Status'
  171.                ILOState=3
  172.                result=1
  173.                WaitPrompt = 1               ; We're entering in console mode
  174.              elseif ILOState=3 then         ; We've finished with console, let's exit cleanly [should never happend !]
  175.                statusbox 'Exit ILO' 'Status'
  176.                sendln 'exit'
  177.                ILOState=4
  178.                result = 2
  179.                pause 10
  180.              endif
  181.            else
  182.              ;     Not reached ILO prompt
  183.            endif
  184.         elseif WaitPrompt = 1 then      ; Waiting to enter VSP console
  185.            strscan TempTxt "PRESS 'ESC ('"
  186.            if result then
  187.              statusbox 'VSP reached -> Wait boot cycle' 'Status'
  188.              result = 1
  189.              WaitPrompt = 2
  190.              pause 45
  191.            else
  192.              ;     Not reached Console prompt
  193.            endif
  194.         elseif WaitPrompt = 2 then      ; Waiting boot cycle
  195.            strscan TempTxt "KEY FOR NETWORK BOOT"     ; "ESC+9"
  196.            if result then
  197.              statusbox 'Boot cycle reached -> Wait RBSU prompt' 'Status'
  198.              if ActionLoad=0 then
  199.                WaitPrompt = 3           ; RBSU [Save] action
  200.              else
  201.                WaitPrompt = 4           ; RBSU [Load] action
  202.              endif
  203.              pause 1
  204.              send 27
  205.              pause 1
  206.              send '9'    
  207.              pause 3
  208.              sendln      
  209.              result = 1
  210.            else
  211.              a=a-1
  212.              ; Don't keep previous line in log as this is a BIOS starting message
  213.              ;     (Not yet reached Boot cycle)
  214.            endif
  215.         elseif WaitPrompt = 3 then              ; Save RBSU .....
  216.            strscan TempTxt "RBSU>"
  217.            if result then
  218.              if RBSUState = 0 then
  219.                statusbox 'RBSU prompt (Save)' 'Status'
  220.                FirstLine=a
  221.              endif
  222.              pause SaveSpeed
  223.              sendln SaveRBSU[RBSUState]
  224.              pause SaveSpeed
  225.              strlen SaveRBSU[RBSUState]
  226.              if result > 0 then
  227.                result=1
  228.              else
  229.                result = 1
  230.                WaitPrompt = 5
  231.              endif
  232.              RBSUState = RBSUState + 1
  233.            else
  234.              ;     Not reached RBSU prompt
  235.            endif
  236.         elseif WaitPrompt = 4 then              ; Load RBSU .....
  237.            strscan TempTxt "RBSU>"
  238.            if result then
  239.              if RBSUState = 0 then
  240.                statusbox 'RBSU prompt (Load)' 'Status'
  241.                FirstLine=a
  242.                RBSUState = 1
  243.              endif
  244.              DoBreak = 0
  245.              do
  246.                filereadln ActionLoad MyLine
  247. ;              messagebox MyLine ActionLoad
  248.                if result then               ; EOF reached
  249. ;                messagebox MyLine EOF
  250.                  pause LoadSpeed
  251.                  sendln
  252.                  WaitPrompt = 5         ; Finished with RBSU
  253.                  DoBreak = 1
  254.                  result = 1
  255.               else
  256.                  strlen MyLine
  257.                  if result > 0 then
  258.                    strscan MyLine RemChar
  259.                    if result > 0 then
  260.                      strcopy MyLine 1 result-1 MyLine
  261. ;                    messagebox myline "stripped"
  262.                    endif
  263.                  endif
  264.                  strlen MyLine
  265.                  if result > 0 then
  266.                    pause LoadSpeed
  267.                    sendln MyLine        ; Send current line
  268.                    DoBreak = 1          ; And wait next prompt
  269.                    pause LoadSpeed
  270.                  endif
  271.                  result = 1
  272.                endif
  273.              loop while DoBreak = 0     ; Read next line as current line was empty
  274.            else
  275.              ;     Not reached RBSU prompt
  276.            endif
  277.         elseif WaitPrompt = 5 then              ; End of RBSU .....
  278.           strscan TempTxt "RBSU>"
  279.           if result then
  280.             statusbox 'RBSU prompt (Finished)' 'Status'
  281.             result = 2                          ; finished without timeout
  282.           else
  283.             result = 1
  284.           endif
  285.         endif
  286.      else
  287.        a = a-1              ; Don't keep previous line in log as this is an empty line
  288.      endif
  289.      if result <2 then      ; Result = 0/1 --> TimeOut, = 2 --> Clean end
  290.        a=a+1
  291.        recvln
  292.      endif
  293.   endwhile                  ; result = 0 => TimeOut
  294. endif
  295.  
  296. if ActionLoad>0 then
  297.    fileclose ActionLoad             ; If a CONFIG file was being read, close it.
  298. endif
  299.  
  300. if FirstLine>0 then                 ; If we reached the time were interesting things are logged
  301.   getenv 'USERNAME' username
  302.   gettime timestr "%Y%m%d-%H%M%S"
  303.   getdir mdir
  304.   if ActionLoad=0 then              ; SAVE mode
  305.     sprintf2 filename '%s\CONFIG_READ_FROM_BIOS_%s_%s_%s.log' mdir hostname username timestr
  306.     fileopen fhandle filename 0
  307.     filewriteln fhandle '# SHOW PCI DEVICE ENABLE/DISABLE'
  308.     filewriteln fhandle '# set pci device enable/disable <Perith#> <Etat (0=Disable/1=Enable)>'
  309.     filewriteln fhandle '# SHOW NIC PERSONALITY OPTIONS'
  310.     filewriteln fhandle '# set nic personality options <Periph#> <Protocole (1=iSCSI/2=FCoE)>'
  311.   else                              ; LOAD mode
  312.     sprintf2 filename '%s\WRITTEN_TO_BIOS_%s_%s_%s.log' mdir hostname username timestr
  313.     fileopen fhandle filename 0
  314.   endif
  315.  
  316.   for x FirstLine+1 a-1
  317.     filewriteln fhandle HelloText[x]
  318.   next
  319.   fileclose fhandle
  320. endif
  321. testlink
  322. if result=2 then
  323.   logwrite '*END_LOG*********************************************'#13#10
  324.   logclose
  325. endif
  326.  
  327. if waitprompt > 0 then
  328.   if waitprompt = 5 then            ; Finished cleanly with RBSU
  329.     if debug = 1 then
  330.       messagebox "Reached end of RBSU - Click to exit" "Debug"
  331.       pause WaitDelay        
  332.     else
  333.       pause LoadSpeed
  334.       pause LoadSpeed
  335.       pause LoadSpeed
  336.     endif
  337.     sendln
  338.     sendln "exit"                   ; Send 'Exit' to apply changes [server with boot]
  339.     pause LoadSpeed
  340.   endif
  341.   send 27 40                        ; Exit from VSP Console to ILO prompt [only 1 console openned at a time]
  342.   pause LoadSpeed
  343.   waitprompt = 0
  344.   ILOState = 4
  345. endif
  346.  
  347. if ILOState > 0 then                ; Exit from ILO prompt (try to)
  348.   sendln "exit"
  349.   pause LoadSpeed
  350. endif
  351. ; setsync 0
  352. if Debug = 1 then
  353.   messagebox filename 'LogFile created'
  354. else
  355.   testlink
  356.   if result=2 then
  357.     closett
  358.     end
  359.   endif
  360. endif
  361. end
  362.  
  363.  
  364.  
hwarin
Newbie

Posts:
2
Joined: Sat Oct 13, 2012 4:34 pm
by hwarin » Thu Oct 18, 2012 10:57 pm
Hi,

In addition to my previous script, here is a quick & dirty derivative allowing to deploy/create a generic administrator account on any blade's ILO inserted into a c7000 enclosure, provided that you have the correct credentials on the hosting OnboardAdmin.

I have not provided a "SSH connect" part, you have to manually connect to your target (then confirm that you've got the good one), start this macro, and press once [enter] into the terminal window, let it make the job and review LOG file once completed, as usual. [Note : admin & password is hard coded ...]

I also have to add that I've finally been able to make work correctly SSSTK from WinPE to perform similar tasks as previous script - Main differences between 2 methods are
+ TeraTerm : Log files
+ TeraTerm : Quick, no boot time on a WinPe ISO, no ISO to maintain
+ TeraTerm : Could be run from a "DoMany" script such as this one
- TeraTerm : Is not recognised yet as a professionnal solution, only a hack that would be suported by no-one [did any one had support from HP on SSSTK ?]

Now, the script

Code: Select all

  1.  
  2. ;
  3. ; V1.1 - Prise en compte des lame sur plusieurs slots (BL680cG7 ...)
  4. ;
  5.  
  6. usrname = 'Admin'
  7. password = 'password'
  8. hostname = '10.10.10.10'
  9.  
  10. strdim HelloText 500            ; 500 lines of LOG buffer --> Will fail after !
  11. FirstLine = 0                   ; First valuable line in LOG buffer
  12.  
  13.  
  14. ILOstate=0                      ; State within ILO prompt phase
  15. WaitPrompt=0                    ; Global state
  16. ; 1 = ILO prompt
  17. ; 0 = OA prompt
  18.  
  19. FileName='<No log created ! >'
  20. RemChar = "#"                   ; Comment in config files while loading to BIOS
  21. LoadSpeed = 2                   ; Number of seconds to wait before/after each line sent to RBSU in LOAD mode
  22. SaveSpeed = 3                   ; Number of seconds to wait before/after each line sent to RBSU in SAVE mode
  23. WaitDelay = 60                  ; Delay at end of RBSU (seconds)
  24. ActionLoad = 0                  ; 0 => SAVE / >0 LOAD (handdle)
  25. Debug=0                         ; 0 ==> No debug prompt / 1 Some debug prompt + default params
  26. MaxBlade=16
  27. CurBlade=0
  28.  
  29. a=0
  30.  
  31. testlink
  32. if result = 2 then
  33.    setsync 1
  34.    timeout = 60
  35.  
  36.   getenv 'USERNAME' username
  37.   gettime timestr "%Y%m%d-%H%M%S"
  38.   getdir mdir
  39.   sprintf2 filename '%s\DeployAdmin_%s_%s_%s.log' mdir hostname username timestr
  40.   logopen filename 0 0
  41.   logwrite 'Log start'#13#10
  42.   logwrite '*****************************************************'#13#10
  43.  
  44.    statusbox 'SSH Connected' 'Status'
  45.    result=1
  46.    a=0
  47.    sendln
  48.    recvln
  49. ;   flushrecv
  50.    while result=1
  51.      strlen InputStr
  52.      if result >0 then
  53.        HelloText[a] = InputStr
  54.        toupper TempTxt InputStr
  55.        ; yesnobox TempTxt 'Received line'
  56.        if WaitPrompt = 0 then               ; Waiting ILO prompt ...
  57.          if CurBlade<MaxBlade then
  58.            CurBlade=CurBlade+1
  59.            int2str ValCurBlade CurBlade
  60.            sendln 'connect server 'ValCurBlade
  61.            statusbox 'Trying to connect to blade ' ValCurBlade
  62.            pause 6 * LoadSpeed
  63.            sendln
  64.            WaitPrompt = 1
  65.            ILOState=0
  66.            result = 1
  67.          else
  68.            result = 2
  69.          endif
  70.        elseif WaitPrompt = 1 then
  71.            strscan TempTxt 'BLADE IS NOT PRESENT'
  72.            if result then
  73.              statusbox 'BLADE IS NOT PRESENT' 'Status'
  74.              WaitPrompt = 0
  75.              result=1
  76.            else
  77.              strscan TempTxt 'CONNECTING TO BAY'
  78.                if result then
  79.                statusbox 'Connecting to bay' 'Status'
  80.                WaitPrompt=2             ; Goto ILO prompt
  81.                result=1
  82.              else
  83.                strscan TempTxt 'IS SUBSUMED'
  84.                if result then
  85.                  statusbox 'Blade is subsumed' 'Status'
  86.                  WaitPrompt=0
  87.                  result=1
  88.                else
  89.                  result=1
  90.                endif
  91.              endif
  92.            endif
  93.        elseif WaitPrompt = 2 then
  94.            strscan TempTxt 'HPILO'
  95.            if result then
  96.              statusbox 'HPILO prompt reached' 'Status'
  97.              ;       messagebox TempTXT 'Recu'
  98.              if ILOState=0 then             ; on ILO prompt, first, reset
  99.                statusbox 'Sent CD /Map1/Accounts' 'Status'
  100.                sendln 'cd /map1/accounts1'
  101.                ILOState=1
  102.                result = 1
  103.                pause LoadSpeed
  104.              elseif ILOState=1 then         ; On ILO prompt, goto to text console
  105.                statusbox "Sent delete user" 'Status'
  106.                ; sendln 'vsp'
  107.                sendln 'delete 'usrname
  108.                pause LoadSpeed
  109.                ILOState=2
  110.                result = 1
  111.              elseif ILOState=2 then         ; On ILO prompt, one more [enter] key
  112.                statusbox "Sent create user" 'Status'
  113.                sendln 'create username='usrname' password='password' name='usrname' group=admin,config,oemhp_power,oemhp_rc,oemhp_vm'
  114.                pause LoadSpeed
  115.                ILOState=3
  116.                result=1
  117.              elseif ILOState=3 then         ; We've finished with console, let's exit cleanly [should never happend !]
  118.                statusbox 'Exit ILO' 'Status'
  119.                sendln 'exit'
  120.                pause LoadSpeed
  121.                ILOState=4
  122.                result = 1
  123.              elseif ILOState=4 then         ; We've finished with console, let's exit cleanly [should never happend !]
  124.                statusbox 'Exited ILO' 'Status'
  125.                pause LoadSpeed
  126.                ILOState=5
  127.                result = 1
  128.                WaitPrompt = 0
  129.              endif
  130.            else
  131.              ;     Not reached ILO prompt
  132. ;        messagebox TempTXT 'Recu'
  133.            endif
  134.  
  135.        else
  136.            messagebox "AutreQueWaitPrompt0" 'Recu'
  137.        endif
  138.      else
  139. ;messagebox 'LigneVide' 'Recu'
  140.        a = a-1              ; Don't keep previous line in log as this is an empty line
  141.      endif
  142.      if result <2 then      ; Result = 0/1 --> TimeOut, = 2 --> Clean end
  143.        a=a+1
  144.        recvln
  145.      endif
  146.   endwhile                  ; result = 0 => TimeOut
  147. endif
  148.  
  149. testlink
  150. if result=2 then
  151.   logwrite '*END_LOG*********************************************'#13#10
  152.   logclose
  153. endif
  154.  
  155.  
  156. if ILOState > 0 then                ; Exit from ILO prompt (try to)
  157.   sendln "exit"
  158.   pause LoadSpeed
  159. endif
  160. ; setsync 0
  161. if Debug = 1 then
  162.   messagebox filename 'LogFile created'
  163. else
  164.   testlink
  165.   if result=2 then
  166.     closett
  167.     end
  168.   endif
  169. endif
  170. end
  171.  
  172.  
Display posts from previous:
Sort by:

2 postsPage 1 of 1

Users browsing this forum: No registered users