Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite is for testing System time in Open BMC. |
| 3 | |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 4 | Resource ../lib/rest_client.robot |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 5 | Resource ../lib/ipmi_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 6 | Resource ../lib/openbmc_ffdc.robot |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 7 | Resource ../lib/state_manager.robot |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 8 | Resource ../lib/resource.txt |
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 | Library OperatingSystem |
| 11 | Library DateTime |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 12 | |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 13 | Test Setup Open Connection And Log In |
| 14 | Test Teardown Post Test Case Execution |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
Sweta Potthuri | b163120 | 2017-08-28 04:11:34 -0500 | [diff] [blame] | 16 | Force Tags Clock_Time |
| 17 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 18 | *** Variables *** |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 19 | ${SYSTEM_TIME_INVALID} 01/01/1969 00:00:00 |
| 20 | ${SYSTEM_TIME_VALID} 02/29/2016 09:10:00 |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 21 | ${ALLOWED_TIME_DIFF} 3 |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 22 | # Equivalent epoch time for 02/17/2017 04:11:40 |
| 23 | ${SYSTEM_TIME_VALID_EPOCH} ${1487304700000000} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 24 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 25 | *** Test Cases *** |
| 26 | |
| 27 | Get System Time |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 28 | [Documentation] Get system time using IPMI and verify that it matches |
| 29 | ... with BMC date time. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 30 | [Tags] Get_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 32 | ${resp}= Run IPMI Standard Command sel time get |
| 33 | ${ipmidate}= Convert Date ${resp} date_format=%m/%d/%Y %H:%M:%S |
| 34 | ... exclude_millis=yes |
| 35 | ${bmcdate}= Get BMC Time Using IPMI |
| 36 | ${diff}= Subtract Date From Date ${bmcdate} ${ipmidate} |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 37 | ${diff}= Convert To Number ${diff} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 38 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} |
| 39 | ... Open BMC time does not match with IPMI sel time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | |
| 41 | Set Valid System Time |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 42 | [Documentation] Set system time using IPMI and verify that it is |
| 43 | ... correctly set in BMC. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 44 | [Tags] Set_Valid_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 46 | Set Time Owner ${HOST_OWNER} |
| 47 | Set Time Mode ${MANUAL_MODE} |
Rahul Maheshwari | 7588f87 | 2017-04-13 05:51:24 -0500 | [diff] [blame] | 48 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 49 | ${resp}= Run IPMI Standard Command sel time set "${SYSTEM_TIME_VALID}" |
| 50 | ${setdate}= Convert Date ${SYSTEM_TIME_VALID} |
| 51 | ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 52 | ${bmcdate}= Get BMC Time Using IPMI |
| 53 | ${diff}= Subtract Date From Date ${bmcdate} ${setdate} |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 54 | ${diff}= Convert To Number ${diff} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 55 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} |
| 56 | ... Open BMC time does not match with set time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 57 | |
| 58 | Set Invalid System Time |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 59 | [Documentation] Set system time with invalid time using IPMI and verify |
| 60 | ... that it should throw error. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 61 | [Tags] Set_Invalid_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 62 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 63 | Set Time Owner ${HOST_OWNER} |
| 64 | Set Time Mode ${MANUAL_MODE} |
Rahul Maheshwari | 7588f87 | 2017-04-13 05:51:24 -0500 | [diff] [blame] | 65 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 66 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 67 | ... sel time set "${SYSTEM_TIME_INVALID}" |
| 68 | Should Start With ${msg} Specified time could not be parsed |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 69 | |
| 70 | Set System Time with no time |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 71 | [Documentation] Set system time with no time using IPMI and verify |
| 72 | ... that it should throw error. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 73 | [Tags] Set_System_Time_with_no_time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 74 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 75 | Set Time Owner ${HOST_OWNER} |
| 76 | Set Time Mode ${MANUAL_MODE} |
Rahul Maheshwari | 7588f87 | 2017-04-13 05:51:24 -0500 | [diff] [blame] | 77 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 78 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 79 | ... sel time set "" |
| 80 | Should Start With ${msg} Specified time could not be parsed |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 81 | |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 82 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 83 | Set BMC Time With BMC And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 84 | [Documentation] Set BMC time when time owner is BMC and time mode is |
| 85 | ... manual. |
| 86 | [Tags] Set_BMC_Time_With_BMC_And_Manual |
| 87 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 88 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 89 | #Operation Owner Mode Status BMC Time Host Time |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 90 | Set BMC Time ${BMC_OWNER} ${MANUAL_MODE} ok Set Change |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 91 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 92 | |
| 93 | Set BMC Time With Both And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 94 | [Documentation] Set BMC time when time owner is Both and time mode is |
| 95 | ... manual. |
| 96 | [Tags] Set_BMC_Time_With_Both_And_Manual |
| 97 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 98 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 99 | #Operation Owner Mode Status BMC Time Host Time |
| 100 | Set BMC Time ${BOTH_OWNER} ${MANUAL_MODE} ok Set Change |
| 101 | |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 102 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 103 | Set BMC Time With Split And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 104 | [Documentation] Set BMC time when time owner is Split and time mode is |
| 105 | ... manual. |
| 106 | [Tags] Set_BMC_Time_With_Split_And_Manual |
| 107 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 108 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 109 | #Operation Owner Mode Status BMC Time Host Time |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 110 | Set BMC Time ${SPLIT_OWNER} ${MANUAL_MODE} ok Set No Change |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 111 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 112 | |
| 113 | Set BMC Time With BMC And NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 114 | [Documentation] Set BMC time when time owner is BMC and time mode is |
| 115 | ... NTP. |
| 116 | [Tags] Set_BMC_Time_With_BMC_And_NTP |
| 117 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 118 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 119 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 120 | Set BMC Time ${BMC_OWNER} ${NTP_MODE} error Not Set No Change |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 121 | |
| 122 | |
| 123 | Set BMC Time With Host And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 124 | [Documentation] Set BMC time when time owner is Host and time mode is |
| 125 | ... Manual. |
| 126 | [Tags] Set_BMC_Time_With_Host_And_Manual |
| 127 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 128 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 129 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 130 | Set BMC Time ${HOST_OWNER} ${MANUAL_MODE} error Not Set No Change |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 131 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 132 | |
| 133 | Set BMC Time With Both And NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 134 | [Documentation] Set BMC time when time owner is Both and time mode is |
| 135 | ... NTP. |
| 136 | [Tags] Set_BMC_Time_With_Both_And_NTP |
| 137 | [Template] Set Time Using REST |
| 138 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 139 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 140 | Set BMC Time ${BOTH_OWNER} ${NTP_MODE} error Not Set No Change |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 141 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 142 | |
| 143 | Set BMC Time With Split And NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 144 | [Documentation] Set BMC time when time owner is Split and time mode is |
| 145 | ... NTP. |
| 146 | [Tags] Set_BMC_Time_With_Split_And_NTP |
| 147 | [Template] Set Time Using REST |
| 148 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 149 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 150 | Set BMC Time ${SPLIT_OWNER} ${NTP_MODE} error Not Set No Change |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 151 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 152 | |
| 153 | Set BMC Time With Host And NTP |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 154 | [Documentation] Set BMC time when time owner is Host and time mode is |
| 155 | ... NTP. |
| 156 | [Tags] Set_BMC_Time_With_Host_And_NTP |
| 157 | [Template] Set Time Using REST |
| 158 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 159 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 160 | Set BMC Time ${HOST_OWNER} ${NTP_MODE} error Not Set No Change |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 161 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 162 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 163 | Set Host Time With Host And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 164 | [Documentation] Set host time when time owner is host and time mode is |
| 165 | ... manual. |
| 166 | [Tags] Set_Host_Time_With_Host_And_Manual |
| 167 | [Template] Set Time Using REST |
| 168 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 169 | #Operation Owner Mode Status BMC Time Host Time |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 170 | Set Host Time ${HOST_OWNER} ${MANUAL_MODE} ok Change Set |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 171 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 172 | |
| 173 | Set Host Time With Both And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 174 | [Documentation] Set host time when time owner is both and time mode is |
| 175 | ... manual. |
| 176 | [Tags] Set_Host_Time_With_Both_And_Manual |
| 177 | [Template] Set Time Using REST |
| 178 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 179 | #Operation Owner Mode Status BMC Time Host Time |
| 180 | Set Host Time ${BOTH_OWNER} ${MANUAL_MODE} ok Change Set |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 181 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 182 | |
| 183 | Set Host Time With Both And NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 184 | [Documentation] Set host time when time owner is both and time mode is |
| 185 | ... NTP. |
| 186 | [Tags] Set_Host_Time_With_Both_And_NTP |
| 187 | [Template] Set Time Using REST |
| 188 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 189 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 190 | Set Host Time ${BOTH_OWNER} ${NTP_MODE} error No Change Not Set |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 191 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 192 | |
| 193 | Set Host Time With Split And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 194 | [Documentation] Set host time when time owner is split and time mode is |
| 195 | ... manual. |
| 196 | [Tags] Set_Host_Time_With_Split_And_Manual |
| 197 | [Template] Set Time Using REST |
| 198 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 199 | #Operation Owner Mode Status BMC Time Host Time |
| 200 | Set Host Time ${SPLIT_OWNER} ${MANUAL_MODE} ok No Change Set |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 201 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 202 | |
| 203 | Set Host Time With Split And NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 204 | [Documentation] Set host time when time owner is split and time mode is |
| 205 | ... NTP. |
| 206 | [Tags] Set_Host_Time_With_Split_And_NTP |
| 207 | [Template] Set Time Using REST |
| 208 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 209 | #Operation Owner Mode Status BMC Time HOST Time |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 210 | Set Host Time ${SPLIT_OWNER} ${NTP_MODE} ok No Change Set |
| 211 | |
| 212 | |
| 213 | Set Host Time With BMC And Manual |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 214 | [Documentation] Set host time when time owner is BMC and time mode is |
| 215 | ... Manual. |
| 216 | [Tags] Set_Host_Time_With_BMC_And_Manual |
| 217 | [Template] Set Time Using REST |
| 218 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 219 | #Operation Owner Mode Status BMC Time HOST Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 220 | Set Host Time ${BMC_OWNER} ${MANUAL_MODE} error No Change Not Set |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 221 | |
| 222 | |
| 223 | Set Host Time With BMC Owner NTP |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 224 | [Documentation] Set host time when time owner is BMC and time mode is |
| 225 | ... NTP. |
| 226 | [Tags] Set_Host_Time_With_BMC_And_NTP |
| 227 | [Template] Set Time Using REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 228 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 229 | #Operation Owner Mode Status BMC Time HOST Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 230 | Set Host Time ${BMC_OWNER} ${NTP_MODE} error No Change Not Set |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 231 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 232 | |
| 233 | Set Host Time With Host And NTP |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 234 | [Documentation] Set host time when time owner is Host and time mode is |
| 235 | ... NTP. |
| 236 | [Tags] Set_Host_Time_With_Host_And_NTP |
| 237 | [Template] Set Time Using REST |
| 238 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 239 | #Operation Owner Mode Status BMC Time Host Time |
Rahul Maheshwari | 8cc4717 | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 240 | Set Host Time ${HOST_OWNER} ${NTP_MODE} error Not Change No Set |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 241 | |
| 242 | |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 243 | Set Invalid Time Mode |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 244 | [Documentation] Set time mode with invalid value using REST and verify |
| 245 | ... that it should throw error. |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 246 | [Tags] Set_Invalid_Time_Mode |
| 247 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 248 | ${timemode}= |
| 249 | ... Set Variable xyz.openbmc_project.Time.Synchronization.Method.abc |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 250 | ${valueDict}= Create Dictionary data=${timemode} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 251 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 252 | ${resp}= OpenBMC Put Request |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 253 | ... ${TIME_MANAGER_URI}sync_method/attr/TimeSyncMethod data=${valueDict} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 254 | ${jsondata}= to JSON ${resp.content} |
| 255 | Should Be Equal ${jsondata['status']} error |
| 256 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 257 | ${mode}= Read Attribute ${TIME_MANAGER_URI}sync_method TimeSyncMethod |
| 258 | Should Not Be Equal ${mode} |
| 259 | ... xyz.openbmc_project.Time.Synchronization.Method.abc |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 260 | |
| 261 | Set Invalid Time Owner |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 262 | [Documentation] Set time owner with invalid value using REST and verify |
| 263 | ... that it should throw error. |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 264 | [Tags] Set_Invalid_Time_Owner |
| 265 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 266 | ${timeowner}= Set Variable xyz.openbmc_project.Time.Owner.Owners.xyz |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 267 | ${valueDict}= Create Dictionary data=${timeowner} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 268 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 269 | ${resp}= OpenBMC Put Request |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 270 | ... ${TIME_MANAGER_URI}owner/attr/TimeOwner data=${valueDict} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 271 | ${jsondata}= to JSON ${resp.content} |
| 272 | Should Be Equal ${jsondata['status']} error |
| 273 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 274 | ${owner}= Read Attribute ${TIME_MANAGER_URI}owner TimeOwner |
| 275 | Should Not Be Equal ${owner} xyz.openbmc_project.Time.Owner.Owners.xyz |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 276 | |
| 277 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 278 | *** Keywords *** |
| 279 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 280 | Get BMC Time Using IPMI |
| 281 | [Documentation] Returns BMC time of the system via IPMI |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 282 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 283 | ${stdout} ${stderr} ${output}= |
| 284 | ... Execute Command date "+%m/%d/%Y %H:%M:%S" |
| 285 | ... return_stdout=True return_stderr= True return_rc=True |
| 286 | Should Be Equal ${output} ${0} msg=${stderr} |
| 287 | |
| 288 | ${resp}= Convert Date ${stdout} date_format=%m/%d/%Y %H:%M:%S |
| 289 | ... exclude_millis=yes |
| 290 | Should Not Be Empty ${resp} |
| 291 | [Return] ${resp} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 292 | |
| 293 | Set Time Owner |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 294 | [Arguments] ${args} |
| 295 | [Documentation] Set time owner of the system via REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 296 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 297 | ${timeowner}= Set Variable ${args} |
| 298 | ${valueDict}= Create Dictionary data=${timeowner} |
| 299 | |
| 300 | ${resp}= OpenBMC Put Request |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 301 | ... ${TIME_MANAGER_URI}owner/attr/TimeOwner data=${valueDict} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 302 | ${jsondata}= to JSON ${resp.content} |
| 303 | |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 304 | ${host_state}= Get Host State |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 305 | |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 306 | Run Keyword If '${host_state}' == 'Off' |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 307 | ... Log System is in off state so owner change will get applied. |
| 308 | ... ELSE Run keyword |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 309 | ... Initiate Host PowerOff |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 310 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 311 | ${owner}= Read Attribute ${TIME_MANAGER_URI}owner TimeOwner |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 312 | Should Be Equal ${owner} ${args} |
| 313 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 314 | [Return] ${jsondata['status']} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 315 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 316 | |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 317 | Set Time Mode |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 318 | [Arguments] ${args} |
| 319 | [Documentation] Set time mode of the system via REST |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 320 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 321 | ${timemode}= Set Variable ${args} |
| 322 | ${valueDict}= Create Dictionary data=${timemode} |
| 323 | |
| 324 | ${resp}= OpenBMC Put Request |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 325 | ... ${TIME_MANAGER_URI}sync_method/attr/TimeSyncMethod data=${valueDict} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 326 | ${jsondata}= to JSON ${resp.content} |
| 327 | Sleep 5s |
| 328 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 329 | ${mode}= Read Attribute ${TIME_MANAGER_URI}sync_method TimeSyncMethod |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 330 | Should Be Equal ${mode} ${args} |
| 331 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 332 | |
| 333 | Get BMC Time Using REST |
| 334 | [Documentation] Returns BMC time of the system via REST |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 335 | ... Time Format : epoch time in microseconds |
| 336 | ... e.g 1507809604687329 |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 337 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 338 | ${resp}= Read Attribute ${TIME_MANAGER_URI}/bmc Elapsed |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 339 | [Return] ${resp} |
| 340 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 341 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 342 | Get HOST Time Using REST |
| 343 | [Documentation] Returns HOST time of the system via REST |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 344 | ... Time Format : epoch time in microseconds |
| 345 | ... e.g 1507809604687329 |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 346 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 347 | ${resp}= Read Attribute ${TIME_MANAGER_URI}/host Elapsed |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 348 | [Return] ${resp} |
| 349 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 350 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 351 | Set Time Using REST |
| 352 | [Arguments] ${operation} ${owner} ${mode} ${status} ${bmc_time} |
| 353 | ... ${host_time} |
| 354 | [Documentation] Set BMC or Host time on system via REST. |
| 355 | ... Description of arguments: |
| 356 | ... operation : Set BMC/Host time |
| 357 | ... owner: Time owner |
| 358 | ... mode: Time mode |
| 359 | ... status: Expected status of set BMC time URI |
| 360 | ... bmc_time: Status of BMC time after operation |
| 361 | ... host_time: Status of HOST time after operation |
| 362 | ... Set - Given time is set |
| 363 | ... Not Set - Given time is not set |
| 364 | ... Change - time is change |
| 365 | ... No Change - time is not change |
| 366 | |
| 367 | Set Time Owner ${owner} |
| 368 | Set Time Mode ${mode} |
| 369 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 370 | ${setdate}= Set Variable ${SYSTEM_TIME_VALID_EPOCH} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 371 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 372 | ${time_owner_url}= Set Variable If |
| 373 | ... '${operation}' == 'Set BMC Time' ${TIME_MANAGER_URI}bmc |
| 374 | ... '${operation}' == 'Set Host Time' ${TIME_MANAGER_URI}host |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 375 | |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 376 | ${start_time}= Get Current Date |
| 377 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 378 | ${old_bmc_time}= Get BMC Time Using REST |
| 379 | ${old_host_time}= Get HOST Time Using REST |
| 380 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 381 | ${valueDict}= Create Dictionary data=${SYSTEM_TIME_VALID_EPOCH} |
| 382 | ${resp}= OpenBMC Put Request |
| 383 | ... ${time_owner_url}/attr/Elapsed data=${valueDict} |
| 384 | ${jsondata}= to JSON ${resp.content} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 385 | Should Be Equal As Strings ${jsondata['status']} ${status} |
| 386 | |
| 387 | ${new_bmc_time}= Get BMC Time Using REST |
| 388 | ${new_host_time}= Get HOST Time Using REST |
| 389 | |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 390 | ${end_time}= Get Current Date |
| 391 | ${time_duration}= Subtract Date From Date ${start_time} ${end_time} |
| 392 | ${time_duration} Evaluate abs(${time_duration}) |
| 393 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 394 | # Convert epoch to date format: YYYY-MM-DD hh:mm:ss.mil |
| 395 | ${setdate}= Convert epoch to date ${setdate} |
| 396 | ${new_bmc_time}= Convert epoch to date ${new_bmc_time} |
| 397 | ${old_bmc_time}= Convert epoch to date ${old_bmc_time} |
| 398 | ${new_host_time}= Convert epoch to date ${new_host_time} |
| 399 | ${old_host_time}= Convert epoch to date ${old_host_time} |
| 400 | |
| 401 | |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 402 | ${bmc_diff_set_new}= |
| 403 | ... Subtract Date From Date ${setdate} ${new_bmc_time} |
| 404 | ${bmc_diff_set_new}= Evaluate abs(${bmc_diff_set_new}) |
| 405 | ${bmc_diff_old_new}= |
| 406 | ... Subtract Date From Date ${old_bmc_time} ${new_bmc_time} |
| 407 | ${bmc_diff_old_new}= Evaluate abs(${bmc_diff_old_new}) |
| 408 | |
| 409 | ${host_diff_set_new}= |
| 410 | ... Subtract Date From Date ${setdate} ${new_host_time} |
| 411 | ${host_diff_set_new}= Evaluate abs(${host_diff_set_new}) |
| 412 | ${host_diff_old_new}= |
| 413 | ... Subtract Date From Date ${old_host_time} ${new_host_time} |
| 414 | ${host_diff_old_new}= Evaluate abs(${host_diff_old_new}) |
| 415 | |
| 416 | Run Keyword If '${bmc_time}' == 'Not Set' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 417 | ... Should Be True ${bmc_diff_set_new} >= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 418 | ... ELSE IF '${bmc_time}' == 'Set' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 419 | ... Should Be True ${bmc_diff_set_new} <= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 420 | ... ELSE IF '${bmc_time}' == 'No Change' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 421 | ... Should Be True ${bmc_diff_old_new} <= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 422 | ... ELSE IF '${bmc_time}' == 'Change' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 423 | ... Should Be True ${bmc_diff_old_new} >= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 424 | |
| 425 | Run Keyword If '${host_time}' == 'No Change' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 426 | ... Should Be True ${host_diff_old_new} <= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 427 | ... ELSE IF '${host_time}' == 'Change' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 428 | ... Should Be True ${host_diff_old_new} >= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 429 | ... ELSE IF '${host_time}' == 'Not Set' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 430 | ... Should Be True ${host_diff_set_new} >= ${time_duration} |
Rahul Maheshwari | f878590 | 2016-12-12 01:23:13 -0600 | [diff] [blame] | 431 | ... ELSE IF '${host_time}' == 'Set' |
Sridevi Ramesh | ae44482 | 2017-02-13 05:51:52 -0600 | [diff] [blame] | 432 | ... Should Be True ${host_diff_set_new} <= ${time_duration} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 433 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 434 | Convert epoch to date |
| 435 | [Documentation] Convert epoch time to date format. |
| 436 | [Arguments] ${epoch_time} |
| 437 | # Description of argument(s): |
Rahul Maheshwari | 7e86332 | 2018-02-02 06:03:06 -0600 | [diff] [blame] | 438 | # epoch_time epoch time in milliseconds. |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 439 | # (e.g. 1487304700000000) |
| 440 | |
Rahul Maheshwari | 7e86332 | 2018-02-02 06:03:06 -0600 | [diff] [blame] | 441 | # Convert epoch_time into floating point number. |
| 442 | ${epoch_time}= Convert To Number ${epoch_time} |
| 443 | |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 444 | # Convert epoch time from microseconds to seconds |
| 445 | ${epoch_time_sec}= Evaluate ${epoch_time}/1000000 |
| 446 | |
| 447 | # Convert epoch time to date format: YYYY-MM-DD hh:mm:ss.mil |
| 448 | # e.g. 2017-02-16 22:14:11.000 |
| 449 | ${date}= Convert Date ${epoch_time_sec} |
| 450 | |
| 451 | [Return] ${date} |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 452 | |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 453 | Post Test Case Execution |
| 454 | [Documentation] Do the post test teardown. |
| 455 | ... 1. Capture FFDC on test failure. |
| 456 | ... 2. Sets defaults for time mode and owner. |
| 457 | ... 3. Close all open SSH connections. |
Rahul Maheshwari | 93f6809 | 2016-10-24 02:42:12 -0500 | [diff] [blame] | 458 | |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 459 | FFDC On Test Case Fail |
Rahul Maheshwari | f486ae8 | 2017-10-24 06:10:14 -0500 | [diff] [blame] | 460 | Set Time Owner ${BMC_OWNER} |
| 461 | Set Time Mode ${NTP_MODE} |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 462 | Close All Connections |