Removing hard-coded path to Root-CA.pem file
Changes from topic 'TLS Auth' will introduce ability to install
multiple certificates in TrustStore. It will be possible becase
the Root-CA.pem file will be replaced by folder.
This changerequest updates existing tests using template named:
'Install And Verify Certificate Via Redfish' by removing hardcoded
path to Root-CA.pem.
Tested:
Tests under name 'Verify Client Certificate Install' are passing.
Signed-off-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com>
Change-Id: I0bc7aa4e0944a6aff3e9a649bae0379e9d09ee2a
diff --git a/redfish/managers/test_certificate.robot b/redfish/managers/test_certificate.robot
index 889b699..8a767e4 100644
--- a/redfish/managers/test_certificate.robot
+++ b/redfish/managers/test_certificate.robot
@@ -16,6 +16,7 @@
*** Variables ***
${invalid_value} abc
+${ROOT_CA_FILE_PATH} /etc/ssl/certs/authority/*
** Test Cases **
@@ -167,14 +168,15 @@
... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI}
... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI}
- Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data}
+ ${cert_id}= Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data}
+ Logging Installed certificate id: ${cert_id}
# Adding delay after certificate installation.
Sleep 30s
${cert_file_content}= OperatingSystem.Get File ${cert_file_path}
${bmc_cert_content}= Run Keyword If '${expected_status}' == 'ok' redfish_utils.Get Attribute
- ... ${certificate_uri}/1 CertificateString
+ ... ${certificate_uri}/${cert_id} CertificateString
Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content}
@@ -198,6 +200,8 @@
Set To Dictionary ${kwargs} headers ${headers}
${ret}= Post Request openbmc ${uri} &{kwargs}
+ ${content_json}= To JSON ${ret.content}
+ ${cert_id}= Set Variable If '${ret.status_code}' == '${HTTP_OK}' ${content_json["Id"]} -1
Run Keyword If '${status}' == 'ok'
... Should Be Equal As Strings ${ret.status_code} ${HTTP_OK}
@@ -206,6 +210,7 @@
Delete All Sessions
+ [Return] ${cert_id}
Replace Certificate Via Redfish
[Documentation] Test 'replace certificate' operation in the BMC via Redfish.
@@ -304,7 +309,7 @@
... Set Variable /etc/nslcd/certs/cert.pem phosphor-certificate-manager@nslcd.service
... ${REDFISH_LDAP_CERTIFICATE_URI}
... ELSE IF '${cert_type}' == 'CA'
- ... Set Variable /etc/ssl/certs/Root-CA.pem phosphor-certificate-manager@authority.service
+ ... Set Variable ${ROOT_CA_FILE_PATH} phosphor-certificate-manager@authority.service
... ${REDFISH_CA_CERTIFICATE_URI}
${file_status} ${stderr} ${rc}= BMC Execute Command
@@ -313,8 +318,9 @@
Return From Keyword If "${file_status}" != "Found"
BMC Execute Command rm ${certificate_file_path}
BMC Execute Command systemctl restart ${certificate_service}
+ BMC Execute Command systemctl daemon-reload
Wait Until Keyword Succeeds 1 min 10 sec
- ... Redfish.Get ${certificate_uri}/1 valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
+ ... Redfish.Get ${certificate_uri}/1 valid_status_codes=[${HTTP_NOT_FOUND}, ${HTTP_INTERNAL_SERVER_ERROR}]
Suite Setup Execution