Added code to change datetime format
Changes:
- Added code to change datetime format due to
recent changes in datetime utility and older format
is not supported in redfish.
Tested:
- Ran the test case from sandbox successfully.
Change-Id: Ic166a864b8994221ea88a1a9ea593d019fb0d4f0
Signed-off-by: sarandev3 <saranyad@in.ibm.com>
diff --git a/lib/bmc_date_and_time_utils.robot b/lib/bmc_date_and_time_utils.robot
index 5e086ec..9f532fe 100644
--- a/lib/bmc_date_and_time_utils.robot
+++ b/lib/bmc_date_and_time_utils.robot
@@ -42,8 +42,17 @@
... '${date_time}' == '${EMPTY}' Get Current Date time_zone=UTC
... ELSE
... Set Variable ${date_time}
- Wait Until Keyword Succeeds 1min 5sec
- ... Redfish.Patch ${REDFISH_BASE_URI}Managers/${MANAGER_ID} body={'DateTime': '${date_time}'} &{kwargs}
+ # Change date format to 2024-03-07T07:58:50+00:00 from 2024-03-07 07:58:50.000.
+ IF "T" in "${date_time}"
+ Wait Until Keyword Succeeds 1min 5sec
+ ... Redfish.Patch ${REDFISH_BASE_URI}Managers/${MANAGER_ID} body={'DateTime': '${date_time}'}
+ ... &{kwargs} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
+ ELSE
+ ${date_time_formatted}= Convert Date ${date_time} result_format=%Y-%m-%dT%H:%M:%S+00:00
+ Wait Until Keyword Succeeds 1min 5sec
+ ... Redfish.Patch ${REDFISH_BASE_URI}Managers/${MANAGER_ID} body={'DateTime': '${date_time_formatted}'}
+ ... &{kwargs} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
+ END
Set Time To Manual Mode