blob: f39d1da7cabd926c074202de4c5f41ff47b700d9 [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
Matt Fischer6fb70d92023-10-24 19:06:33 -060012Test Tags SLP_Service_Test
Sweta Potthuri5db43e42017-06-15 05:36:44 -050013
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
Sridevi Ramesh39d03b52025-11-06 03:25:02 -060026
Prashanth Katti69773e72016-12-29 02:57:32 -060027 Verify Service Types
28
29Verify Service Agents For Service Types
30 [Documentation] Find And verify service agents.
31 [Tags] Verify_Service_Agents_For_Service_Types
Sushil Singh5dbaf9d2020-06-19 05:43:20 -050032
Prashanth Katti69773e72016-12-29 02:57:32 -060033 @{parameters}= Split String ${SLP_SERVICES} ${\n}
Sushil Singh5dbaf9d2020-06-19 05:43:20 -050034
35 FOR ${parameter} IN @{parameters}
36 ${output}= Run SLP command ${service_agents} ${parameter}
37 Verify Service Agents ${output} ${parameter}
38 END
Prashanth Katti69773e72016-12-29 02:57:32 -060039
40*** Keywords ***
41
Steven Sombarfac31e92017-12-15 09:40:34 -060042Suite Setup Execution
Prashanth Katti69773e72016-12-29 02:57:32 -060043 [Documentation] Get SLP services.
Sridevi Ramesh39d03b52025-11-06 03:25:02 -060044
Prashanth Katti69773e72016-12-29 02:57:32 -060045 ${output}= Run which slptool
46 Should Not Be Empty ${output}
47 ... msg=slptool not installed.
48 ${SLP_SERVICES}= Run SLP command ${service_types}
49 Set Suite Variable ${SLP_SERVICES}
50
51Run SLP Command
52 [Documentation] Run SLPTool command and return output.
53 [Arguments] ${cmd} ${param}=${EMPTY}
54 # cmd The SLP command to be run.
55 # param The SLP command parameters.
56
57 ${rc} ${output}= Run And Return Rc And Output
58 ... slptool -u ${OPENBMC_HOST} ${cmd} ${param}
59 Should Be Equal As Integers ${rc} 0
George Keishing409df052024-01-17 22:36:14 +053060 RETURN ${output}
Prashanth Katti69773e72016-12-29 02:57:32 -060061
62Verify Service Types
63 [Documentation] Verifies the output of service types.
64
65 ${remove_prefix}= Remove String ${SLP_SERVICES} service:
66 @{services}= Split String ${remove_prefix} ${\n}
67 ${service_count}= Get Length ${services}
68 Open Connection And Log In
69 ${stdout} ${stderr}= Execute Command ls ${service_path}
70 ... return_stderr=True
71 Should Be Empty ${stderr}
72 ${file_count}= Get Line Count ${stdout}
73 Should Be Equal ${service_count} ${file_count}
74 ... msg=Number of services on system & command are not equal.
Sushil Singh5dbaf9d2020-06-19 05:43:20 -050075
76 FOR ${service} IN @{services}
77 Should Contain ${stdout} ${service} msg=Services on system & command are not same.
78 END
Prashanth Katti69773e72016-12-29 02:57:32 -060079
80Verify Service Agents
81 [Documentation] Verifies the output of srvs.
82 [Arguments] ${output} ${service_agent}
Sridevi Ramesh39d03b52025-11-06 03:25:02 -060083
84 # Description of argument(s):
85 # output SLP service output.
86 # Example of output
87 # <service:service_name:tcp//xxx.xxx.xxx.xxx,2200>
88 # service_agent Service agent ('findsrvs').
Prashanth Katti69773e72016-12-29 02:57:32 -060089
90 Run Keywords Should Contain ${output} ${service_agent} AND
91 ... Should Contain ${output} ${OPENBMC_HOST},
92 ... msg=Expected process info missing.
93