Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame^] | 1 | *** Settings *** |
| 2 | Documentation OpenBMC LDAP user management test. |
| 3 | |
| 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | |
| 7 | Suite Setup Suite Setup Execution |
| 8 | Test Teardown FFDC On Test Case Fail |
| 9 | |
| 10 | *** Variables **** |
| 11 | |
| 12 | *** Test Cases *** |
| 13 | |
| 14 | Verify LDAP Client Service Is Running And API Available |
| 15 | [Documentation] Verify LDAP client service is running and API available. |
| 16 | [Tags] Verify_LDAP_Client_Service_Is_Running_And_API_Available |
| 17 | |
| 18 | Check LDAP Service Running |
| 19 | ${resp}= Read Properties ${BMC_LDAP_URI} |
| 20 | Should Not Be Empty ${resp} |
| 21 | |
| 22 | |
| 23 | Verify LDAP Config Is Created |
| 24 | [Documentation] Verify LDAP config is created in BMC. |
| 25 | [Tags] Verify_LDAP_Config_Is_Created |
| 26 | |
| 27 | Populate All Attributes for LDAP Config |
| 28 | Check LDAP Config File Generated |
| 29 | |
| 30 | |
| 31 | Verify LDAP Config Is Deleted |
| 32 | [Documentation] Verify LDAP config is deleted in BMC. |
| 33 | [Tags] Verify_LDAP_Config_Is_Deleted |
| 34 | |
| 35 | Delete LDAP Config |
| 36 | Check LDAP Config File Deleted |
| 37 | |
| 38 | |
| 39 | Verify LDAP User Able To Login Using REST |
| 40 | [Documentation] Verify LDAP user able to login using REST. |
| 41 | [Tags] Verify_LDAP_User_Able_To_Login_Using_REST |
| 42 | |
| 43 | Populate All Attributes for LDAP Config |
| 44 | Check LDAP Config File Generated |
| 45 | |
| 46 | # REST Login to BMC with LDAP user and password. |
| 47 | Initialize OpenBMC OPENBMC_USER=${LDAP_USER} |
| 48 | ... OPENBMC_PASSWORD=${LDAP_USER_PASSWORD} |
| 49 | |
| 50 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list |
| 51 | Should Not Be Empty ${bmc_user_uris} |
| 52 | |
| 53 | |
| 54 | Verify LDAP User Able to Logout Using REST |
| 55 | [Documentation] Verify LDAP user able to logout using REST. |
| 56 | [Tags] Verify_LDAP_User_Able_To_Logout_Using_REST |
| 57 | |
| 58 | Populate All Attributes for LDAP Config |
| 59 | Check LDAP Config File Generated |
| 60 | |
| 61 | # REST Login to BMC with LDAP user and password. |
| 62 | Initialize OpenBMC OPENBMC_USER=${LDAP_USER} |
| 63 | ... OPENBMC_PASSWORD=${LDAP_USER_PASSWORD} |
| 64 | |
| 65 | # REST Logout from BMC. |
| 66 | Log Out OpenBMC |
| 67 | |
| 68 | Verify LDAP Secure_Mode Is Set |
| 69 | [Documentation] Verify LDAP Secure Mode is set using REST. |
| 70 | [Tags] Verify_LDAP_Secure_Mode_Is_Set |
| 71 | |
| 72 | ${ldap_mode}= Create Dictionary data=${False} |
| 73 | Write Attribute ${BMC_LDAP_URI}/config/attr/LDAPType data=${ldap_mode} |
| 74 | ... verify=${True} expected_value=${False} |
| 75 | |
| 76 | |
| 77 | *** Keywords *** |
| 78 | |
| 79 | Suite Setup Execution |
| 80 | [Documentation] Check for LDAP test readiness. |
| 81 | |
| 82 | Should Not Be Empty ${LDAP_SECURE_MODE} |
| 83 | Should Not Be Empty ${LDAP_SERVER_URI} |
| 84 | Should Not Be Empty ${LDAP_BIND_DN} |
| 85 | Should Not Be Empty ${LDAP_BASE_DN} |
| 86 | Should Not Be Empty ${LDAP_BIND_DN_PASSWORD} |
| 87 | Should Not Be Empty ${LDAP_SEARCH_SCOPE} |
| 88 | Should Not Be Empty ${LDAP_SERVER_TYPE} |
| 89 | Check LDAP Service Running |
| 90 | |
| 91 | Check LDAP Service Running |
| 92 | [Documentation] Check LDAP service running in BMC. |
| 93 | |
| 94 | BMC Execute Command systemctl | grep -in ldap |
| 95 | |
| 96 | Populate All Attributes for LDAP Config |
| 97 | [Documentation] Populate all attributes for LDAP configuration. |
| 98 | |
| 99 | @{ldap_parm_list}= Create List xyz.openbmc_project.User.Ldap.Create |
| 100 | ... ${LDAP_SECURE_MODE} ${LDAP_SERVER_URI} ${LDAP_BIND_DN} |
| 101 | ... ${LDAP_BASE_DN} ${LDAP_BIND_DN_PASSWORD} ${LDAP_SEARCH_SCOPE} |
| 102 | ... ${LDAP_SERVER_TYPE} |
| 103 | |
| 104 | ${data}= Create Dictionary data=@{ldap_parm_list} |
| 105 | |
| 106 | ${resp}= OpenBMC Post Request |
| 107 | ... ${BMC_LDAP_URI}/action/CreateConfig data=${data} |
| 108 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 109 | |
| 110 | Check LDAP Config File Generated |
| 111 | [Documentation] Check LDAP file nslcd.conf generated. |
| 112 | [Arguments] ${ldap_server}=${LDAP_SERVER_URI} |
| 113 | |
| 114 | ${ldap_server_config} ${stderr} ${rc}= BMC Execute Command |
| 115 | ... cat /etc/nslcd.conf |
| 116 | |
| 117 | Should Contain ${ldap_server_config} ${ldap_server} |
| 118 | ... msg=${ldap_server} is not configured. |
| 119 | |
| 120 | Delete LDAP Config |
| 121 | [Documentation] Delete LDAP Config from REST. |
| 122 | |
| 123 | ${data}= Create Dictionary data=@{EMPTY} |
| 124 | ${resp}= OpenBMC Post Request |
| 125 | ... ${BMC_LDAP_URI}/action/delete data=${data} |
| 126 | |
| 127 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 128 | |
| 129 | Check LDAP Config File Deleted |
| 130 | [Documentation] Check LDAP file nslcd.conf deleted. |
| 131 | |
| 132 | BMC Execute Command [ ! -f /etc/nslcd.conf ] |