Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Find services and service agents on the system. |
| 3 | Library OperatingSystem |
| 4 | Library Collections |
| 5 | Library String |
| 6 | |
| 7 | Resource ../lib/utils.robot |
| 8 | |
| 9 | # Get the SLP services available, make it suite global. |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 11 | |
Sweta Potthuri | 5db43e4 | 2017-06-15 05:36:44 -0500 | [diff] [blame] | 12 | Force Tags SLP_Service_Test |
| 13 | |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 14 | *** Variables *** |
| 15 | ${service_types} findsrvtypes |
| 16 | ${service_agents} findsrvs |
| 17 | ${service_path} /etc/slp/services |
| 18 | # SLP_SERVICES Services listed by slptool, by default Empty. |
| 19 | ${SLP_SERVICES} ${EMPTY} |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | |
| 23 | Verify SLP Service Types |
| 24 | [Documentation] Find services supported by system. |
| 25 | [Tags] Verify_SLP_Service_Types |
| 26 | Verify Service Types |
| 27 | |
| 28 | Verify Service Agents For Service Types |
| 29 | [Documentation] Find And verify service agents. |
| 30 | [Tags] Verify_Service_Agents_For_Service_Types |
Sushil Singh | 5dbaf9d | 2020-06-19 05:43:20 -0500 | [diff] [blame] | 31 | |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 32 | @{parameters}= Split String ${SLP_SERVICES} ${\n} |
Sushil Singh | 5dbaf9d | 2020-06-19 05:43:20 -0500 | [diff] [blame] | 33 | |
| 34 | FOR ${parameter} IN @{parameters} |
| 35 | ${output}= Run SLP command ${service_agents} ${parameter} |
| 36 | Verify Service Agents ${output} ${parameter} |
| 37 | END |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 38 | |
| 39 | *** Keywords *** |
| 40 | |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 41 | Suite Setup Execution |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 42 | [Documentation] Get SLP services. |
| 43 | ${output}= Run which slptool |
| 44 | Should Not Be Empty ${output} |
| 45 | ... msg=slptool not installed. |
| 46 | ${SLP_SERVICES}= Run SLP command ${service_types} |
| 47 | Set Suite Variable ${SLP_SERVICES} |
| 48 | |
| 49 | Run SLP Command |
| 50 | [Documentation] Run SLPTool command and return output. |
| 51 | [Arguments] ${cmd} ${param}=${EMPTY} |
| 52 | # cmd The SLP command to be run. |
| 53 | # param The SLP command parameters. |
| 54 | |
| 55 | ${rc} ${output}= Run And Return Rc And Output |
| 56 | ... slptool -u ${OPENBMC_HOST} ${cmd} ${param} |
| 57 | Should Be Equal As Integers ${rc} 0 |
| 58 | [Return] ${output} |
| 59 | |
| 60 | Verify Service Types |
| 61 | [Documentation] Verifies the output of service types. |
| 62 | |
| 63 | ${remove_prefix}= Remove String ${SLP_SERVICES} service: |
| 64 | @{services}= Split String ${remove_prefix} ${\n} |
| 65 | ${service_count}= Get Length ${services} |
| 66 | Open Connection And Log In |
| 67 | ${stdout} ${stderr}= Execute Command ls ${service_path} |
| 68 | ... return_stderr=True |
| 69 | Should Be Empty ${stderr} |
| 70 | ${file_count}= Get Line Count ${stdout} |
| 71 | Should Be Equal ${service_count} ${file_count} |
| 72 | ... msg=Number of services on system & command are not equal. |
Sushil Singh | 5dbaf9d | 2020-06-19 05:43:20 -0500 | [diff] [blame] | 73 | |
| 74 | FOR ${service} IN @{services} |
| 75 | Should Contain ${stdout} ${service} msg=Services on system & command are not same. |
| 76 | END |
Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 77 | |
| 78 | Verify Service Agents |
| 79 | [Documentation] Verifies the output of srvs. |
| 80 | [Arguments] ${output} ${service_agent} |
| 81 | # Example of output |
| 82 | # <service:service_name:tcp//xxx.xxx.xxx.xxx,2200> |
| 83 | |
| 84 | Run Keywords Should Contain ${output} ${service_agent} AND |
| 85 | ... Should Contain ${output} ${OPENBMC_HOST}, |
| 86 | ... msg=Expected process info missing. |
| 87 | |