Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation This testsuite is for testing boot policy function. |
| 4 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 5 | Resource ../lib/rest_client.robot |
| 6 | Resource ../lib/ipmi_client.robot |
| 7 | Resource ../lib/utils.robot |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 8 | Resource ../lib/openbmc_ffdc.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 10 | Suite Setup Open Connection And Log In |
| 11 | Suite Teardown Close All Connections |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 12 | Test Setup Initialize DBUS cmd "boot_policy" |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 13 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 16 | ${HOST_SETTINGS} ${SETTINGS_URI}host0 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 17 | |
| 18 | *** Test Cases *** |
| 19 | |
| 20 | Set Onetime boot policy using REST |
| 21 | [Documentation] This testcase is to set onetime boot policy using REST |
| 22 | ... URI and then verify using REST API and ipmitool.\n |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 23 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | Set Boot Policy ONETIME |
| 25 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 26 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | Should Be Equal ${boot} ONETIME |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 28 | ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True |
| 29 | Should Be Empty ${stderr} |
| 30 | Should Contain ${output} ONETIME |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | |
| 32 | Set Permanent boot policy using REST |
| 33 | [Documentation] This testcase is to set permanent boot policy using REST |
| 34 | ... URI and then verify using REST API and ipmitool.\n |
| 35 | |
| 36 | Set Boot Policy PERMANENT |
| 37 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 38 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | Should Be Equal ${boot} PERMANENT |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 40 | ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True |
| 41 | Should Be Empty ${stderr} |
| 42 | Should Contain ${output} PERMANENT |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 43 | |
| 44 | Set Onetime boot policy using IPMITOOL |
| 45 | [Documentation] This testcase is to set boot policy to onetime boot using ipmitool |
| 46 | ... and then verify using REST URI and ipmitool.\n |
| 47 | |
| 48 | Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00 |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 49 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 50 | Should Be Equal ${boot} ONETIME |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 51 | ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True |
| 52 | Should Be Empty ${stderr} |
| 53 | Should Contain ${output} ONETIME |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 54 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 55 | Set Permanent boot policy using IPMITOOL |
| 56 | [Documentation] This testcase is to set boot policy to permanent using ipmitool |
| 57 | ... and then verify using REST URI and ipmitool. |
| 58 | |
| 59 | Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00 |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 60 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 61 | Should Be Equal ${boot} PERMANENT |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 62 | ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True |
| 63 | Should Be Empty ${stderr} |
| 64 | Should Contain ${output} PERMANENT |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 65 | |
| 66 | Boot order with permanent boot policy |
| 67 | [Documentation] This testcase is to verify that boot order does not change |
| 68 | ... after first boot when boot policy set to permanent |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 69 | [Tags] chassisboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 70 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 71 | Initiate Power Off |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 72 | |
| 73 | Set Boot Policy PERMANENT |
| 74 | |
| 75 | Set Boot Device CDROM |
| 76 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 77 | Initiate Power On |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 78 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 79 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 80 | Should Be Equal ${boot} PERMANENT |
| 81 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 82 | ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 83 | Should Be Equal ${flag} CDROM |
| 84 | |
George Keishing | d320688 | 2016-11-29 04:41:14 -0600 | [diff] [blame] | 85 | Persist ONETIME Boot Policy After Reset |
| 86 | [Documentation] Verify ONETIME boot policy order does not change |
| 87 | ... on warm reset. |
| 88 | [Tags] chassisboot Persist_ONETIME Boot_Policy_After_Reset |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 89 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 90 | Initiate Power On |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 91 | |
| 92 | Set Boot Policy ONETIME |
| 93 | |
| 94 | Set Boot Device Network |
| 95 | |
| 96 | Trigger Warm Reset |
| 97 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 98 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 99 | Should Be Equal ${boot} ONETIME |
| 100 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 101 | ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 102 | Should Be Equal ${flag} Network |
| 103 | |
George Keishing | d320688 | 2016-11-29 04:41:14 -0600 | [diff] [blame] | 104 | Persist PERMANENT Boot Policy After Reset |
| 105 | [Documentation] Verify PERMANENT boot policy order does not change |
| 106 | ... on warm reset. |
| 107 | [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 108 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 109 | Initiate Power On |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 110 | |
| 111 | Set Boot Policy PERMANENT |
| 112 | |
| 113 | Set Boot Device CDROM |
| 114 | |
| 115 | Trigger Warm Reset |
| 116 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 117 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 118 | Should Be Equal ${boot} PERMANENT |
| 119 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 120 | ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 121 | Should Be Equal ${flag} CDROM |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 122 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 123 | Set boot policy to invalid value |
George Keishing | 5f62a4a | 2016-11-16 02:09:17 -0600 | [diff] [blame] | 124 | [Documentation] This testcase verify that the boot policy doesn't get |
| 125 | ... updated with invalid policy supplied by user. |
| 126 | [Tags] Set_boot_policy_to_invalid_value |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 127 | |
George Keishing | 5f62a4a | 2016-11-16 02:09:17 -0600 | [diff] [blame] | 128 | Run Keyword and Ignore Error Set Boot Policy abc |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 129 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 130 | ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy |
George Keishing | 314cf85 | 2016-08-26 09:02:16 -0500 | [diff] [blame] | 131 | Should Not Be Equal ${boot} abc |
| 132 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 133 | *** Keywords *** |
| 134 | |
| 135 | Set Boot Policy |
| 136 | [Arguments] ${args} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 137 | ${bootpolicy}= Set Variable ${args} |
| 138 | ${valueDict}= create dictionary data=${bootpolicy} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 139 | Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 140 | |
| 141 | Set Boot Device |
| 142 | [Arguments] ${args} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 143 | ${bootDevice} = Set Variable ${args} |
| 144 | ${valueDict} = create dictionary data=${bootDevice} |
| 145 | Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict} |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 146 | |
| 147 | |
| 148 | |