blob: 969e5fef06b460713a05650c3cc657dd662f8661 [file] [log] [blame]
Prashanth Katti84647e52017-09-15 08:01:11 -05001*** Settings ***
2Documentation This program performs factory data reset, namely,
3... network, host and BMC factory reset on DHCP setup.
4
5Resource ../lib/rest_client.robot
6Resource ../lib/utils.robot
7Resource ../lib/connection_client.robot
8Resource ../lib/boot_utils.robot
9Resource ../lib/code_update_utils.robot
10Resource ../lib/ipmi_client.robot
11
12*** Test Cases ***
13
14Initiate Factory Reset And Verify
15 [Documentation] Factory reset the system.
16 [Tags] Initiate_Factory_Reset_And_Verify
17
18 Network Factory Reset
19 Software Manager Factory Reset
20
21 # Enable field mode.
22 Enable Field Mode And Verify Unmount
23
24 # Reboot BMC to apply BMC factory reset.
25 OBMC Reboot (off)
26
27 # Check BMC comes up with same IP address.
28 Ping Host ${OPENBMC_HOST}
29
30 # Check if factory reset has erased read-write and preserved volumes
31 # created by host BIOS and BMC.
32
33 # Sample output:
34 # Filesystem 1K-blocks Used Available Use% Mounted on
35 # dev 215188 0 215188 0% /dev
36 # tmpfs 216104 14372 201732 7% /run
37 # /dev/mtdblock4 14720 14720 0 100% /run/initramfs/ro
38 # /dev/mtdblock5 4096 300 3796 7% /run/initramfs/rw
39 # cow 4096 300 3796 7% /
40 # tmpfs 216104 0 216104 0% /dev/shm
41 # tmpfs 216104 0 216104 0% /sys/fs/cgroup
42 # tmpfs 216104 0 216104 0% /tmp
43 # tmpfs 216104 80 216024 0% /var/volatile
44 # tmpfs 216104 0 216104 0% /usr/local
45 # ubi7:pnor-rw-9ac69aca 13816 16 13052 0% /media/pnor-rw-9ac69aca
46 # /dev/ubiblock7_1 19584 19584 0 100% /media/pnor-ro-9ac69aca
47 # ubi7:pnor-prsv 972 32 872 4% /media/pnor-prsv
48 # ubi7:pnor-patch 13816 16 13056 0% /usr/local/share/pnor
49
50 # Check PNOR and BMC preserved volumes are not deleted.
51
52 ${cmd_output} ${stderr} ${rc}= BMC Execute Command df
53 Should Contain ${cmd_output} pnor-rw msg=Host factory reset failed.
54 Should Contain ${cmd_output} pnor-prsv msg=Host factory reset failed.
55 Should Contain ${cmd_output} var msg=BMC factory reset failed.
56
57 # Check PNOR read-write and preserved files are deleted.
58 ${cmd_output} ${stderr} ${rc}= BMC Execute Command ls /media/pnor-prsv
59 Should Be Empty ${cmd_output} msg=Host factory reset failed.
60
61 # Check flag "Boot Device Selector" comes up with default value
62 # "No override" after BMC factory reset.
63 ${resp}= Run IPMI Standard Command chassis bootparam get 5
64 ${boot_dev}= Get Lines Containing String ${resp} Boot Device Selector
65 Should Contain ${boot_dev} No override msg=BMC factory reset failed.
66
67*** Keywords ***
68
69Network Factory Reset
70 [Documentation] Network factory reset the BMC node.
71
72 ${data}= Create Dictionary data=@{EMPTY}
73 Run Keyword And Ignore Error OpenBMC Post Request
74 ... ${XYZ_NETWORK_MANAGER}/action/Reset data=${data}
75
76Software Manager Factory Reset
77 [Documentation] Software Manager Factory Reset.
78
79 ${data}= Create Dictionary data=@{EMPTY}
80 Run Keyword And Ignore Error OpenBMC Post Request
81 ... ${SOFTWARE_VERSION_URI}/action/Reset data=${data}
82