blob: f5f451236409344f17f0fc17d155852ec79822ff [file] [log] [blame]
Sushma M M98fa8772020-07-09 02:38:33 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "Certificates" sub-menu of "Security and access".
Sushma M M98fa8772020-07-09 02:38:33 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
manashsarmab9feda72020-10-05 10:40:12 -05006Resource ../../../lib/certificate_utils.robot
Sushma M M98fa8772020-07-09 02:38:33 -05007
Rahul Maheshwari612f8dc2020-10-28 21:34:43 -05008Suite Setup Suite Setup Execution
Sushma M M98fa8772020-07-09 02:38:33 -05009Suite Teardown Close Browser
10Test Setup Test Setup Execution
11
George Keishing0302e9a2023-10-12 21:48:35 +053012Force Tags Certificates_Sub_Menu
Sushma M M98fa8772020-07-09 02:38:33 -050013
14*** Variables ***
15
Rahul Maheshwari142642d2021-08-24 00:00:15 -050016${xpath_certificate_heading} //h1[text()="Certificates"]
manashsarma23d4ddc2020-10-05 05:35:29 -050017${xpath_add_certificate_button} //button[contains(text(),"Add new certificate")]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050018${xpath_generate_csr_button} //*[@data-test-id='certificates-button-generateCsr']
manashsarma23d4ddc2020-10-05 05:35:29 -050019${xpath_generate_csr_heading} //h5[contains(text(), "Generate a Certificate Signing Request")]
20${xpath_select_certificate_type} //*[@data-test-id='modalGenerateCsr-select-certificateType']
21${xpath_select_country} //*[@data-test-id='modalGenerateCsr-select-country']
22${xpath_input_state} //*[@data-test-id='modalGenerateCsr-input-state']
23${xpath_input_city} //*[@data-test-id='modalGenerateCsr-input-city']
24${xpath_input_company_name} //*[@data-test-id='modalGenerateCsr-input-companyName']
25${xpath_input_company_unit} //*[@data-test-id='modalGenerateCsr-input-companyUnit']
26${xpath_input_common_name} //*[@data-test-id='modalGenerateCsr-input-commonName']
27${xpath_input_challenge_password} //*[@data-test-id='modalGenerateCsr-input-challengePassword']
28${xpath_input_contact_person} //*[@data-test-id='modalGenerateCsr-input-contactPerson']
29${xpath_input_email_address} //*[@data-test-id='modalGenerateCsr-input-emailAddress']
30${xpath_generate_csr_submit} //*[@data-test-id='modalGenerateCsr-button-ok']
manashsarma4e02bfc2020-11-02 03:03:29 -060031${xpath_csr_cancel_button} //button[contains(text(),"Cancel")]
manashsarma23d4ddc2020-10-05 05:35:29 -050032${xpath_input_alternate_name} //input[@id='alternate-name']
33${xpath_select_algorithm_button} //*[@data-test-id='modalGenerateCsr-select-keyPairAlgorithm']
Sushma M M98fa8772020-07-09 02:38:33 -050034
35*** Test Cases ***
36
Rahul Maheshwari142642d2021-08-24 00:00:15 -050037Verify Navigation To Certificate Page
38 [Documentation] Verify navigation to certificate page.
39 [Tags] Verify_Navigation_To_Certificate_Page
Sushma M M26302992020-08-31 01:15:26 -050040
41 Page Should Contain Element ${xpath_certificate_heading}
42
43
Sushma M M98fa8772020-07-09 02:38:33 -050044Verify Existence Of All Sections In Certificate Page
45 [Documentation] Verify existence of all sections in certificate page.
46 [Tags] Verify_Existence_Of_All_Sections_In_Certificate_Page
47
48 Page should contain Certificate
49 Page should contain Valid from
50 Page should contain Valid until
51
52
53Verify Existence Of Add Certificate Button
54 [Documentation] Verify existence of add certificate button.
55 [Tags] Verify_Existence_Of_Add_Certificate_Button
56
57 Page Should Contain Element ${xpath_add_certificate_button}
58
manashsarma23d4ddc2020-10-05 05:35:29 -050059Verify Generate CSR Certificate Button
60 [Documentation] Verify existence of all the fields of CSR generation.
61 [Tags] Verify_Generate_CSR_Certificate_Button
manashsarma4e02bfc2020-11-02 03:03:29 -060062 [Teardown] Click Element ${xpath_csr_cancel_button}
manashsarma23d4ddc2020-10-05 05:35:29 -050063
manashsarma4e02bfc2020-11-02 03:03:29 -060064 Page Should Contain Element ${xpath_generate_csr_button}
65 Click Element ${xpath_generate_csr_button}
66 Wait Until Page Contains Element ${xpath_generate_csr_heading}
67 Page Should Contain Element ${xpath_select_certificate_type}
68 Page Should Contain Element ${xpath_select_country}
69 Page Should Contain Element ${xpath_input_state}
70 Page Should Contain Element ${xpath_input_city}
71 Page Should Contain Element ${xpath_input_company_name}
72 Page Should Contain Element ${xpath_input_common_name}
73 Page Should Contain Element ${xpath_input_challenge_password}
74 Page Should Contain Element ${xpath_input_contact_person}
75 Page Should Contain Element ${xpath_input_email_address}
76 Page Should Contain Element ${xpath_input_alternate_name}
77 Page Should Contain Element ${xpath_select_algorithm_button}
78 Page Should Contain Element ${xpath_generate_csr_submit}
manashsarma23d4ddc2020-10-05 05:35:29 -050079
Sushma M M98fa8772020-07-09 02:38:33 -050080
manashsarmab9feda72020-10-05 10:40:12 -050081Verify Installed CA Certificate
82 [Documentation] Install CA certificate and verify the same via GUI.
83 [Tags] Verify_Installed_CA_Certificate
84
85 Delete All CA Certificate Via Redfish
86
87 # Install CA certificate via Redfish.
manashsarmab56a2532020-11-17 06:17:40 -060088 ${file_data}= Generate Certificate File Data CA
rramyasr-in10e4f102023-03-17 00:13:06 -050089 Install And Verify Certificate Via Redfish CA Valid Certificate ok
manashsarmab9feda72020-10-05 10:40:12 -050090
Ashwini Chandrappa8dcd93d2021-09-22 08:41:45 -050091 # Refresh GUI and verify CA certificate availability in GUI.
92 Refresh GUI
manashsarmad2376442020-12-16 05:14:10 -060093 Wait Until Page Contains CA Certificate timeout=10
manashsarmab9feda72020-10-05 10:40:12 -050094
95
manashsarmae07858a2020-10-16 06:09:46 -050096Verify Installed HTTPS Certificate
97 [Documentation] Install HTTPS certificate via Redfish and verify it in GUI.
98 [Tags] Verify_Installed_HTTPS_Certificate
99
Ashwini Chandrappa6b20ffa2021-08-04 03:18:37 -0500100 # Replace HTTPS certificate.
rramyasr-in8fa81a92022-12-06 10:45:25 -0600101 Redfish.Login
Ashwini Chandrappa6b20ffa2021-08-04 03:18:37 -0500102 Replace Certificate Via Redfish Server Valid Certificate Valid Privatekey ok
rramyasr-in8fa81a92022-12-06 10:45:25 -0600103 Redfish.Logout
manashsarmae07858a2020-10-16 06:09:46 -0500104
105 # Verify certificate is available in GUI.
manashsarmad2376442020-12-16 05:14:10 -0600106 Wait Until Page Contains HTTPS Certificate timeout=10
manashsarmae07858a2020-10-16 06:09:46 -0500107
108
109Verify Installed LDAP Certificate
110 [Documentation] Install LDAP certificate via Redfish and verify it in GUI.
111 [Tags] Verify_Installed_LDAP_Certificate
112
rramyasr-in0b058b52023-04-04 05:03:29 -0500113 Redfish.Login
manashsarmae07858a2020-10-16 06:09:46 -0500114 Delete Certificate Via BMC CLI Client
115
116 # Install LDAP certificate.
manashsarmab56a2532020-11-17 06:17:40 -0600117 ${file_data}= Generate Certificate File Data Client
rramyasr-in10e4f102023-03-17 00:13:06 -0500118 Install And Verify Certificate Via Redfish Client Valid Certificate Valid Privatekey ok
rramyasr-in0b058b52023-04-04 05:03:29 -0500119 Redfish.Logout
manashsarmae07858a2020-10-16 06:09:46 -0500120
Ashwini Chandrappa8dcd93d2021-09-22 08:41:45 -0500121 # Refresh GUI and verify certificate is available in GUI.
122 Refresh GUI
manashsarmad2376442020-12-16 05:14:10 -0600123 Wait Until Page Contains LDAP Certificate timeout=10
manashsarmae07858a2020-10-16 06:09:46 -0500124
125
Sushma M M98fa8772020-07-09 02:38:33 -0500126*** Keywords ***
127
manashsarmab9feda72020-10-05 10:40:12 -0500128Generate Certificate File Data
129 [Documentation] Generate data of certificate file.
130
manashsarmab56a2532020-11-17 06:17:40 -0600131 [Arguments] ${cert_type}
132
133 # Description of Arguments(s):
134 # cert_type Certificate type (e.g. "Client" or "CA").
135
136 ${cert_file_path}= Run Keyword If '${cert_type}' == 'Client' or 'Server'
137 ... Generate Certificate File Via Openssl Valid Certificate Valid Privatekey
138 ... ELSE IF '${cert_type}' == 'CA'
139 ... Generate Certificate File Via Openssl Valid Certificate
manashsarmab9feda72020-10-05 10:40:12 -0500140 ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
141 ${file_data}= Decode Bytes To String ${bytes} UTF-8
142
143 [return] ${file_data}
144
145
Sushma M M98fa8772020-07-09 02:38:33 -0500146Test Setup Execution
147 [Documentation] Do test case setup tasks.
148
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500149 Click Element ${xpath_secuity_and_accesss_menu}
150 Click Element ${xpath_certificates_sub_menu}
151 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain certificates
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600152 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
manashsarmab9feda72020-10-05 10:40:12 -0500153
154
155Suite Setup Execution
156 [Documentation] Do test case suite setup tasks.
157
158 Launch Browser And Login GUI
159 Create Directory certificate_dir