Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Management console utilities keywords. |
| 3 | |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 4 | Resource ../../lib/bmc_redfish_utils.robot |
Sushil Singh | 84c8015 | 2023-02-06 02:02:48 -0600 | [diff] [blame] | 5 | Resource ../../lib/common_utils.robot |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 6 | Library ../../lib/gen_robot_valid.py |
| 7 | Library Collections |
| 8 | Library ../../lib/bmc_ssh_utils.py |
| 9 | Library 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 | |
| 20 | Set AvahiDaemon Service |
| 21 | [Documentation] To enable or disable avahi service. |
| 22 | [Arguments] ${command} |
| 23 | |
| 24 | # Description of argument(s): |
George Keishing | 1faaa46 | 2020-04-16 10:27:20 -0500 | [diff] [blame] | 25 | # command Get command from dictionary. |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 26 | |
| 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 | |
| 32 | Verify AvahiDaemon Service Status |
| 33 | [Documentation] To check for avahi service. |
| 34 | [Arguments] ${message} |
| 35 | |
| 36 | # Description of argument(s): |
George Keishing | 1faaa46 | 2020-04-16 10:27:20 -0500 | [diff] [blame] | 37 | # message Get status message from dictionary. |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 38 | |
| 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 Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 43 | |
| 44 | |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 45 | Create 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 Singh | f4de7d7 | 2023-07-21 08:59:20 -0500 | [diff] [blame] | 54 | |
| 55 | ${session_resp}= Redfish Login kwargs="Context":"${client_id}" |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 56 | |
| 57 | Set To Dictionary ${session_info} SessionIDs ${session_resp['Id']} |
Sushil Singh | f4de7d7 | 2023-07-21 08:59:20 -0500 | [diff] [blame] | 58 | Set To Dictionary ${session_info} ClientID ${session_resp["Context"]} |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 59 | Set To Dictionary ${session_info} SessionToken ${XAUTH_TOKEN} |
| 60 | Set To Dictionary ${session_info} SessionResp ${session_resp} |
| 61 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame^] | 62 | RETURN ${session_info} |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 63 | |
| 64 | |
| 65 | Create 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 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame^] | 81 | RETURN ${session_dict_list} |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 82 | |
| 83 | |
| 84 | Verify A Session Created With ClientID |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 85 | [Documentation] Verify the session is created. |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 86 | [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 Singh | f4de7d7 | 2023-07-21 08:59:20 -0500 | [diff] [blame] | 111 | |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 112 | ${ip_address}= Get Running System IP |
Sushil Singh | f4de7d7 | 2023-07-21 08:59:20 -0500 | [diff] [blame] | 113 | |
| 114 | Set Test Variable ${temp_ipaddr} ${session_resp["ClientOriginIPAddress"]} |
| 115 | Valid Value client ['${session_resp["Context"]}'] |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 116 | Valid Value session["SessionIDs"] ['${session_resp["Id"]}'] |
| 117 | Valid Value temp_ipaddr ${ip_address} |
| 118 | END |
| 119 | |
| 120 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 121 | Get 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 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame^] | 129 | RETURN ${resource_lock_json} |
Sushil Singh | b79142c | 2022-09-15 01:04:11 -0500 | [diff] [blame] | 130 | |