blob: 9262a5d312a2036bb3443dda3e5ea80d020f9c84 [file] [log] [blame]
Sushil Singhc5e9ebc2020-04-09 03:32:57 -05001*** Settings ***
2Documentation Management console utilities keywords.
3
Sushil Singh87e984c2020-10-20 01:43:47 -05004Resource ../../lib/bmc_redfish_utils.robot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -05005Library ../../lib/gen_robot_valid.py
6Library Collections
7Library ../../lib/bmc_ssh_utils.py
8Library SSHLibrary
9
10*** Variables ***
11&{daemon_command} start=systemctl start avahi-daemon
12 ... stop=systemctl stop avahi-daemon
13 ... status=systemctl status avahi-daemon -l
14&{daemon_message} start=Active: active (running)
15 ... stop=Active: inactive (dead)
16
17*** Keywords ***
18
19Set AvahiDaemon Service
20 [Documentation] To enable or disable avahi service.
21 [Arguments] ${command}
22
23 # Description of argument(s):
George Keishing1faaa462020-04-16 10:27:20 -050024 # command Get command from dictionary.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050025
26 ${service_command}= Get From Dictionary ${daemon_command} ${command}
27 ${resp} ${stderr} ${rc}= BMC Execute Command ${service_command} print_out=1
28 Should Be Equal As Integers ${rc} 0
29
30
31Verify AvahiDaemon Service Status
32 [Documentation] To check for avahi service.
33 [Arguments] ${message}
34
35 # Description of argument(s):
George Keishing1faaa462020-04-16 10:27:20 -050036 # message Get status message from dictionary.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050037
38 ${service_command}= Get From Dictionary ${daemon_command} status
39 ${service_message}= Get From Dictionary ${daemon_message} ${message}
40 ${resp} ${stderr} ${rc}= BMC Execute Command ${service_command} print_out=1
41 Should Contain ${resp} ${service_message}
Sushil Singhd03f2ce2020-09-17 08:54:41 -050042
43
Sushil Singh87e984c2020-10-20 01:43:47 -050044Create Session With ClientID
45 [Documentation] Create redifish session with client id.
46 [Arguments] ${client_id}
47
48 # Description of argument(s):
49 # client_id This client id can contain string value
50 # (e.g. 12345, "EXTERNAL-CLIENT").
51
52 ${session_info}= Create Dictionary
53 ${session_resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
54
55 Set To Dictionary ${session_info} SessionIDs ${session_resp['Id']}
56 Set To Dictionary ${session_info} ClientID ${session_resp["Oem"]["OpenBMC"]["ClientID"]}
57 Set To Dictionary ${session_info} SessionToken ${XAUTH_TOKEN}
58 Set To Dictionary ${session_info} SessionResp ${session_resp}
59
60 [Return] ${session_info}
61
62
63Create Session With List Of ClientID
64 [Documentation] Create redifish session with client id.
65 [Arguments] ${client_id}
66
67 # Description of argument(s):
68 # client_id This client id can contain string value
69 # (e.g. 12345, "EXTERNAL-CLIENT").
70
71 @{session_dict_list}= Create List
72 &{session_dict}= Create Dictionary
73
74 FOR ${client} IN @{client_id}
75 ${session_dict}= Create Session With ClientID ${client}
76 Append To List ${session_dict_list} ${session_dict}
77 END
78
79 [Return] ${session_dict_list}
80
81
82Verify A Session Created With ClientID
Sushil Singh5166ebd2021-05-31 01:24:16 -050083 [Documentation] Verify the session is created.
Sushil Singh87e984c2020-10-20 01:43:47 -050084 [Arguments] ${client_id} ${session_ids}
85
86 # Description of argument(s):
87 # client_id External client name.
88 # session_id This value is a session id.
89
90 # {
91 # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
92 # "@odata.type": "#Session.v1_0_2.Session",
93 # "Description": "Manager User Session",
94 # "Id": "H8q2ZKucSJ",
95 # "Name": "User Session",
96 # "Oem": {
97 # "OpenBMC": {
98 # "@odata.type": "#OemSession.v1_0_0.Session",
99 # "ClientID": "",
100 # "ClientOriginIP": "::ffff:x.x.x.x"
101 # }
102 # },
103 # "UserName": "root"
104 # }
105
106 FOR ${client} ${session} IN ZIP ${client_id} ${session_ids}
107 ${session_resp}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session["SessionIDs"]}
108 Rprint Vars session_resp
109 @{words} = Split String ${session_resp["ClientOriginIPAddress"]} :
110 ${ip_address}= Get Running System IP
111 Set Test Variable ${temp_ipaddr} ${words}[-1]
112 Valid Value client ['${session_resp["Oem"]["OpenBMC"]["ClientID"]}']
113 Valid Value session["SessionIDs"] ['${session_resp["Id"]}']
114 Valid Value temp_ipaddr ${ip_address}
115 END
116
117
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500118Get Lock Resource Information
119 [Documentation] Get lock resource information.
120
121 ${code_base_dir_path}= Get Code Base Dir Path
122 ${resource_lock_json}= Evaluate
123 ... json.load(open('${code_base_dir_path}data/resource_lock_table.json')) modules=json
124 Rprint Vars resource_lock_json
125
126 [Return] ${resource_lock_json}