blob: c2b33c21c198375b9078c94646f44ac82a438d48 [file] [log] [blame]
Prashanth Katti69773e72016-12-29 02:57:32 -06001*** Settings ***
2Documentation Find services and service agents on the system.
3Library OperatingSystem
4Library Collections
5Library String
6
7Resource ../lib/utils.robot
8
9# Get the SLP services available, make it suite global.
Steven Sombarfac31e92017-12-15 09:40:34 -060010Suite Setup Suite Setup Execution
Prashanth Katti69773e72016-12-29 02:57:32 -060011
Sweta Potthuri5db43e42017-06-15 05:36:44 -050012Force Tags SLP_Service_Test
13
Prashanth Katti69773e72016-12-29 02:57:32 -060014*** 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
23Verify SLP Service Types
24 [Documentation] Find services supported by system.
25 [Tags] Verify_SLP_Service_Types
26 Verify Service Types
27
28Verify 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 Sombarfac31e92017-12-15 09:40:34 -060038Suite Setup Execution
Prashanth Katti69773e72016-12-29 02:57:32 -060039 [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
46Run 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
57Verify 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
74Verify 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