blob: 5b1c0ac5673bdf82a0d91ea5b57de23e90d29f57 [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 Singh84c80152023-02-06 02:02:48 -06005Resource ../../lib/common_utils.robot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -05006Library ../../lib/gen_robot_valid.py
7Library Collections
8Library ../../lib/bmc_ssh_utils.py
9Library SSHLibrary
10
11*** Variables ***
12&{daemon_command} start=systemctl start avahi-daemon
13 ... stop=systemctl stop avahi-daemon
14 ... status=systemctl status avahi-daemon -l
15&{daemon_message} start=Active: active (running)
16 ... stop=Active: inactive (dead)
17
18*** Keywords ***
19
20Set AvahiDaemon Service
21 [Documentation] To enable or disable avahi service.
22 [Arguments] ${command}
23
24 # Description of argument(s):
George Keishing1faaa462020-04-16 10:27:20 -050025 # command Get command from dictionary.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050026
27 ${service_command}= Get From Dictionary ${daemon_command} ${command}
28 ${resp} ${stderr} ${rc}= BMC Execute Command ${service_command} print_out=1
29 Should Be Equal As Integers ${rc} 0
30
31
32Verify AvahiDaemon Service Status
33 [Documentation] To check for avahi service.
34 [Arguments] ${message}
35
36 # Description of argument(s):
George Keishing1faaa462020-04-16 10:27:20 -050037 # message Get status message from dictionary.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050038
39 ${service_command}= Get From Dictionary ${daemon_command} status
40 ${service_message}= Get From Dictionary ${daemon_message} ${message}
41 ${resp} ${stderr} ${rc}= BMC Execute Command ${service_command} print_out=1
42 Should Contain ${resp} ${service_message}
Sushil Singhd03f2ce2020-09-17 08:54:41 -050043
44
Sushil Singh87e984c2020-10-20 01:43:47 -050045Create Session With ClientID
46 [Documentation] Create redifish session with client id.
47 [Arguments] ${client_id}
48
49 # Description of argument(s):
50 # client_id This client id can contain string value
51 # (e.g. 12345, "EXTERNAL-CLIENT").
52
53 ${session_info}= Create Dictionary
Sushil Singhf4de7d72023-07-21 08:59:20 -050054
55 ${session_resp}= Redfish Login kwargs="Context":"${client_id}"
Sushil Singh87e984c2020-10-20 01:43:47 -050056
57 Set To Dictionary ${session_info} SessionIDs ${session_resp['Id']}
Sushil Singhf4de7d72023-07-21 08:59:20 -050058 Set To Dictionary ${session_info} ClientID ${session_resp["Context"]}
Sushil Singh87e984c2020-10-20 01:43:47 -050059 Set To Dictionary ${session_info} SessionToken ${XAUTH_TOKEN}
60 Set To Dictionary ${session_info} SessionResp ${session_resp}
61
62 [Return] ${session_info}
63
64
65Create Session With List Of ClientID
66 [Documentation] Create redifish session with client id.
67 [Arguments] ${client_id}
68
69 # Description of argument(s):
70 # client_id This client id can contain string value
71 # (e.g. 12345, "EXTERNAL-CLIENT").
72
73 @{session_dict_list}= Create List
74 &{session_dict}= Create Dictionary
75
76 FOR ${client} IN @{client_id}
77 ${session_dict}= Create Session With ClientID ${client}
78 Append To List ${session_dict_list} ${session_dict}
79 END
80
81 [Return] ${session_dict_list}
82
83
84Verify A Session Created With ClientID
Sushil Singh5166ebd2021-05-31 01:24:16 -050085 [Documentation] Verify the session is created.
Sushil Singh87e984c2020-10-20 01:43:47 -050086 [Arguments] ${client_id} ${session_ids}
87
88 # Description of argument(s):
89 # client_id External client name.
90 # session_id This value is a session id.
91
92 # {
93 # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
94 # "@odata.type": "#Session.v1_0_2.Session",
95 # "Description": "Manager User Session",
96 # "Id": "H8q2ZKucSJ",
97 # "Name": "User Session",
98 # "Oem": {
99 # "OpenBMC": {
100 # "@odata.type": "#OemSession.v1_0_0.Session",
101 # "ClientID": "",
102 # "ClientOriginIP": "::ffff:x.x.x.x"
103 # }
104 # },
105 # "UserName": "root"
106 # }
107
108 FOR ${client} ${session} IN ZIP ${client_id} ${session_ids}
109 ${session_resp}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session["SessionIDs"]}
110 Rprint Vars session_resp
Sushil Singhf4de7d72023-07-21 08:59:20 -0500111
Sushil Singh87e984c2020-10-20 01:43:47 -0500112 ${ip_address}= Get Running System IP
Sushil Singhf4de7d72023-07-21 08:59:20 -0500113
114 Set Test Variable ${temp_ipaddr} ${session_resp["ClientOriginIPAddress"]}
115 Valid Value client ['${session_resp["Context"]}']
Sushil Singh87e984c2020-10-20 01:43:47 -0500116 Valid Value session["SessionIDs"] ['${session_resp["Id"]}']
117 Valid Value temp_ipaddr ${ip_address}
118 END
119
120
Sushil Singhd03f2ce2020-09-17 08:54:41 -0500121Get Lock Resource Information
122 [Documentation] Get lock resource information.
123
124 ${code_base_dir_path}= Get Code Base Dir Path
125 ${resource_lock_json}= Evaluate
126 ... json.load(open('${code_base_dir_path}data/resource_lock_table.json')) modules=json
127 Rprint Vars resource_lock_json
128
129 [Return] ${resource_lock_json}
Sushil Singhb79142c2022-09-15 01:04:11 -0500130