blob: d6ccd3d2bd820a165bfc6e539ae6b1a7966a45f7 [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.
10Suite Setup Get Service Types Output
11
12*** Variables ***
13${service_types} findsrvtypes
14${service_agents} findsrvs
15${service_path} /etc/slp/services
16# SLP_SERVICES Services listed by slptool, by default Empty.
17${SLP_SERVICES} ${EMPTY}
18
19*** Test Cases ***
20
21Verify SLP Service Types
22 [Documentation] Find services supported by system.
23 [Tags] Verify_SLP_Service_Types
24 Verify Service Types
25
26Verify Service Agents For Service Types
27 [Documentation] Find And verify service agents.
28 [Tags] Verify_Service_Agents_For_Service_Types
29 @{parameters}= Split String ${SLP_SERVICES} ${\n}
30 :FOR ${parameter} IN @{parameters}
31 \ ${output}= Run SLP command ${service_agents} ${parameter}
32 \ Verify Service Agents ${output} ${parameter}
33
34*** Keywords ***
35
36Get Service Types Output
37 [Documentation] Get SLP services.
38 ${output}= Run which slptool
39 Should Not Be Empty ${output}
40 ... msg=slptool not installed.
41 ${SLP_SERVICES}= Run SLP command ${service_types}
42 Set Suite Variable ${SLP_SERVICES}
43
44Run SLP Command
45 [Documentation] Run SLPTool command and return output.
46 [Arguments] ${cmd} ${param}=${EMPTY}
47 # cmd The SLP command to be run.
48 # param The SLP command parameters.
49
50 ${rc} ${output}= Run And Return Rc And Output
51 ... slptool -u ${OPENBMC_HOST} ${cmd} ${param}
52 Should Be Equal As Integers ${rc} 0
53 [Return] ${output}
54
55Verify Service Types
56 [Documentation] Verifies the output of service types.
57
58 ${remove_prefix}= Remove String ${SLP_SERVICES} service:
59 @{services}= Split String ${remove_prefix} ${\n}
60 ${service_count}= Get Length ${services}
61 Open Connection And Log In
62 ${stdout} ${stderr}= Execute Command ls ${service_path}
63 ... return_stderr=True
64 Should Be Empty ${stderr}
65 ${file_count}= Get Line Count ${stdout}
66 Should Be Equal ${service_count} ${file_count}
67 ... msg=Number of services on system & command are not equal.
68 :FOR ${service} IN @{services}
69 \ Should Contain ${stdout} ${service}
70 ... msg=Services on system & command are not same.
71
72Verify Service Agents
73 [Documentation] Verifies the output of srvs.
74 [Arguments] ${output} ${service_agent}
75 # Example of output
76 # <service:service_name:tcp//xxx.xxx.xxx.xxx,2200>
77
78 Run Keywords Should Contain ${output} ${service_agent} AND
79 ... Should Contain ${output} ${OPENBMC_HOST},
80 ... msg=Expected process info missing.
81