blob: fb95aa12c9d29cd1c9d5232ba243b001fea9613c [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
Sushil Singh5dbaf9d2020-06-19 05:43:20 -050031
Prashanth Katti69773e72016-12-29 02:57:32 -060032 @{parameters}= Split String ${SLP_SERVICES} ${\n}
Sushil Singh5dbaf9d2020-06-19 05:43:20 -050033
34 FOR ${parameter} IN @{parameters}
35 ${output}= Run SLP command ${service_agents} ${parameter}
36 Verify Service Agents ${output} ${parameter}
37 END
Prashanth Katti69773e72016-12-29 02:57:32 -060038
39*** Keywords ***
40
Steven Sombarfac31e92017-12-15 09:40:34 -060041Suite Setup Execution
Prashanth Katti69773e72016-12-29 02:57:32 -060042 [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
49Run 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
60Verify 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 Singh5dbaf9d2020-06-19 05:43:20 -050073
74 FOR ${service} IN @{services}
75 Should Contain ${stdout} ${service} msg=Services on system & command are not same.
76 END
Prashanth Katti69773e72016-12-29 02:57:32 -060077
78Verify 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