| 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 | 
|  | 31 | @{parameters}=  Split String  ${SLP_SERVICES}  ${\n} | 
|  | 32 | :FOR  ${parameter}  IN  @{parameters} | 
|  | 33 | \  ${output}=  Run SLP command  ${service_agents}  ${parameter} | 
|  | 34 | \  Verify Service Agents  ${output}  ${parameter} | 
|  | 35 |  | 
|  | 36 | *** Keywords *** | 
|  | 37 |  | 
| Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 38 | Suite Setup Execution | 
| Prashanth Katti | 69773e7 | 2016-12-29 02:57:32 -0600 | [diff] [blame] | 39 | [Documentation]  Get SLP services. | 
|  | 40 | ${output}=  Run  which slptool | 
|  | 41 | Should Not Be Empty  ${output} | 
|  | 42 | ...  msg=slptool not installed. | 
|  | 43 | ${SLP_SERVICES}=  Run SLP command  ${service_types} | 
|  | 44 | Set Suite Variable  ${SLP_SERVICES} | 
|  | 45 |  | 
|  | 46 | Run SLP Command | 
|  | 47 | [Documentation]  Run SLPTool command and return output. | 
|  | 48 | [Arguments]      ${cmd}  ${param}=${EMPTY} | 
|  | 49 | # cmd    The SLP command to be run. | 
|  | 50 | # param  The SLP command parameters. | 
|  | 51 |  | 
|  | 52 | ${rc}  ${output}=  Run And Return Rc And Output | 
|  | 53 | ...   slptool -u ${OPENBMC_HOST} ${cmd} ${param} | 
|  | 54 | Should Be Equal As Integers  ${rc}  0 | 
|  | 55 | [Return]  ${output} | 
|  | 56 |  | 
|  | 57 | Verify Service Types | 
|  | 58 | [Documentation]  Verifies the output of service types. | 
|  | 59 |  | 
|  | 60 | ${remove_prefix}=  Remove String  ${SLP_SERVICES}  service: | 
|  | 61 | @{services}=  Split String  ${remove_prefix}  ${\n} | 
|  | 62 | ${service_count}=  Get Length  ${services} | 
|  | 63 | Open Connection And Log In | 
|  | 64 | ${stdout}  ${stderr}=  Execute Command  ls ${service_path} | 
|  | 65 | ...  return_stderr=True | 
|  | 66 | Should Be Empty  ${stderr} | 
|  | 67 | ${file_count}=  Get Line Count  ${stdout} | 
|  | 68 | Should Be Equal  ${service_count}  ${file_count} | 
|  | 69 | ...  msg=Number of services on system & command are not equal. | 
|  | 70 | :FOR  ${service}  IN  @{services} | 
|  | 71 | \  Should Contain  ${stdout}  ${service} | 
|  | 72 | ...  msg=Services on system & command are not same. | 
|  | 73 |  | 
|  | 74 | Verify Service Agents | 
|  | 75 | [Documentation]  Verifies the output of srvs. | 
|  | 76 | [Arguments]      ${output}  ${service_agent} | 
|  | 77 | # Example of output | 
|  | 78 | # <service:service_name:tcp//xxx.xxx.xxx.xxx,2200> | 
|  | 79 |  | 
|  | 80 | Run Keywords  Should Contain  ${output}  ${service_agent}  AND | 
|  | 81 | ...  Should Contain  ${output}  ${OPENBMC_HOST}, | 
|  | 82 | ...  msg=Expected process info missing. | 
|  | 83 |  |