Add test cases for local user and cert management
Test cases added:
- Verify Redfishtool CA Certificate Install Errors
- Verify Error While Uploding Same CA Certificate Via Redfishtool
- Verify Server Certificate View With Openssl Via Redfishtool
- Verify Error While Running Redfishtool With Incorrect Password
Change-Id: I53ffc4d78fe67d1d986320f09320cf67dfd8963e
Signed-off-by: Manash Sarma <manashsarma@in.ibm.com>
diff --git a/redfish/dmtf_tools/test_redfishtool_certificate.robot b/redfish/dmtf_tools/test_redfishtool_certificate.robot
index 69429d9..65ae4ab 100644
--- a/redfish/dmtf_tools/test_redfishtool_certificate.robot
+++ b/redfish/dmtf_tools/test_redfishtool_certificate.robot
@@ -98,6 +98,57 @@
Client Valid Certificate Empty Privatekey error
+Verify Redfishtool CA Certificate Install Errors
+ [Documentation] Verify error while installing invalid CA certificate.
+ [Tags] Verify_Redfishtool_CA_Certificate_Install_Errors
+ [Template] Verify Redfishtool Install Certificate
+
+ # cert_type cert_format expected_status
+ CA Empty Certificate error
+
+
+Verify Error While Uploding Same CA Certificate Via Redfishtool
+ [Documentation] Verify error while uploading same CA certificate two times.
+ [Tags] Verify_Error_While_Uploding_Same_CA_Certificate_Via_Redfishtool
+
+ # Create certificate file for uploading.
+ ${cert_file_path}= Generate Certificate File Via Openssl Valid Certificate 365
+ ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
+ ${file_data}= Decode Bytes To String ${bytes} UTF-8
+
+ # Install CA certificate.
+ Redfishtool Install Certificate File On BMC ${REDFISH_CA_CERTIFICATE_URI} ok data=${file_data}
+
+ # Adding delay after certificate installation.
+ Sleep 30s
+
+ # Check error while uploading same certificate.
+ Redfishtool Install Certificate File On BMC ${REDFISH_CA_CERTIFICATE_URI} error data=${file_data}
+
+
+Install Server Certificate Using Redfishtool And Verify Via OpenSSL
+ [Documentation] Install server certificate using Redfishtool and verify via OpenSSL.
+ [Tags] Install_Server_Certificate_Using_Redfishtool_And_Verify_Via_OpenSSL.
+
+ ${cert_file_path}= Generate Certificate File Via Openssl Valid Certificate Valid Privatekey
+ ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
+ ${file_data}= Decode Bytes To String ${bytes} UTF-8
+
+ ${certificate_dict}= Create Dictionary
+ ... @odata.id=/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/1
+
+ ${dict_objects}= Create Dictionary CertificateString=${file_data}
+ ... CertificateType=PEM CertificateUri=${certificate_dict}
+
+ ${string}= Convert To String ${dict_objects}
+ ${string}= Replace String ${string} ' "
+ ${payload}= Set Variable '${string}'
+
+ ${response}= Redfishtool Post
+ ... ${payload} /redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate
+
+ Wait Until Keyword Succeeds 2 mins 15 secs Verify Certificate Visible Via OpenSSL ${cert_file_path}
+
*** Keywords ***
diff --git a/redfish/dmtf_tools/test_redfishtool_local_user.robot b/redfish/dmtf_tools/test_redfishtool_local_user.robot
index 07bbb85..8a38dc4 100644
--- a/redfish/dmtf_tools/test_redfishtool_local_user.robot
+++ b/redfish/dmtf_tools/test_redfishtool_local_user.robot
@@ -135,6 +135,15 @@
Redfishtool Access Resource /redfish/v1/AccountService/Accounts "UserT100" "TestPwd123"
... ${HTTP_UNAUTHORIZED}
+
+Verify Error While Running Redfishtool With Incorrect Password
+ [Documentation] Verify error while running redfishtool with incorrect Password.
+ [Tags] Verify_Error_While_Running_Redfishtool_With_Incorrect_Password
+ [Teardown] Redfishtool Delete User "UserT100"
+
+ Redfishtool Create User "UserT100" "TestPwd123" "Administrator" true
+ Redfishtool Access Resource /redfish/v1/Systems/ "UserT100" "TestPwd234" ${HTTP_UNAUTHORIZED}
+
*** Keywords ***