Test client CA certificate install and delete
Resolves openbmc/openbmc-test-automation#1475
Change-Id: I2e52f232728c6e10fb4f1014e2d83b4c27bd5953
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/certificate_utils.robot b/lib/certificate_utils.robot
index 942d722..54fb9db 100755
--- a/lib/certificate_utils.robot
+++ b/lib/certificate_utils.robot
@@ -56,12 +56,17 @@
[Return] ${result}
-Get Client Certificate File Content From BMC
- [Documentation] Get client certificate file content from BMC.
+Get Certificate File Content From BMC
+ [Documentation] Get required certificate file content from BMC.
+ [Arguments] ${cert_type}=Client
- ${certificate} ${stderr} ${rc}= BMC Execute Command
- ... cat /etc/nslcd/certs/cert.pem
- Should Be Equal ${rc} ${0} msg=${stderr}
+ # Description of argument(s):
+ # cert_type Certificate type (e.g. "Client" or "CA").
+
+ ${certificate} ${stderr} ${rc}= Run Keyword If '${cert_type}' == 'Client'
+ ... BMC Execute Command cat /etc/nslcd/certs/cert.pem
+ ... ELSE IF '${cert_type}' == 'CA'
+ ... BMC Execute Command cat /etc/ssl/certs/Root-CA.pem
[Return] ${certificate}
@@ -109,6 +114,13 @@
... Remove String ${file_content} ${cert_content} ${private_key_content}
... ELSE IF '${cert_format}' == 'Expired Certificate'
... OperatingSystem.Get File ${EXECDIR}${/}${cert_dir_name}${/}cert.pem
+ ... ELSE IF '${cert_format}' == 'Valid Certificate'
+ ... Remove String ${file_content} ${private_key_content}
+ ... -----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----
+ ... ELSE IF '${cert_format}' == 'Empty Certificate'
+ ... Remove String ${file_content} ${cert_content}
+ ... ${private_key_content} -----BEGIN PRIVATE KEY-----
+ ... -----END PRIVATE KEY-----
${random_name}= Generate Random String 8
${cert_name}= Catenate SEPARATOR= ${random_name} .pem