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 |
| 54 | ${session_resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} |
| 55 | |
| 56 | Set To Dictionary ${session_info} SessionIDs ${session_resp['Id']} |
| 57 | Set To Dictionary ${session_info} ClientID ${session_resp["Oem"]["OpenBMC"]["ClientID"]} |
| 58 | Set To Dictionary ${session_info} SessionToken ${XAUTH_TOKEN} |
| 59 | Set To Dictionary ${session_info} SessionResp ${session_resp} |
| 60 | |
| 61 | [Return] ${session_info} |
| 62 | |
| 63 | |
| 64 | Create Session With List Of ClientID |
| 65 | [Documentation] Create redifish session with client id. |
| 66 | [Arguments] ${client_id} |
| 67 | |
| 68 | # Description of argument(s): |
| 69 | # client_id This client id can contain string value |
| 70 | # (e.g. 12345, "EXTERNAL-CLIENT"). |
| 71 | |
| 72 | @{session_dict_list}= Create List |
| 73 | &{session_dict}= Create Dictionary |
| 74 | |
| 75 | FOR ${client} IN @{client_id} |
| 76 | ${session_dict}= Create Session With ClientID ${client} |
| 77 | Append To List ${session_dict_list} ${session_dict} |
| 78 | END |
| 79 | |
| 80 | [Return] ${session_dict_list} |
| 81 | |
| 82 | |
| 83 | Verify A Session Created With ClientID |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 84 | [Documentation] Verify the session is created. |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 85 | [Arguments] ${client_id} ${session_ids} |
| 86 | |
| 87 | # Description of argument(s): |
| 88 | # client_id External client name. |
| 89 | # session_id This value is a session id. |
| 90 | |
| 91 | # { |
| 92 | # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ", |
| 93 | # "@odata.type": "#Session.v1_0_2.Session", |
| 94 | # "Description": "Manager User Session", |
| 95 | # "Id": "H8q2ZKucSJ", |
| 96 | # "Name": "User Session", |
| 97 | # "Oem": { |
| 98 | # "OpenBMC": { |
| 99 | # "@odata.type": "#OemSession.v1_0_0.Session", |
| 100 | # "ClientID": "", |
| 101 | # "ClientOriginIP": "::ffff:x.x.x.x" |
| 102 | # } |
| 103 | # }, |
| 104 | # "UserName": "root" |
| 105 | # } |
| 106 | |
| 107 | FOR ${client} ${session} IN ZIP ${client_id} ${session_ids} |
| 108 | ${session_resp}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session["SessionIDs"]} |
| 109 | Rprint Vars session_resp |
| 110 | @{words} = Split String ${session_resp["ClientOriginIPAddress"]} : |
| 111 | ${ip_address}= Get Running System IP |
| 112 | Set Test Variable ${temp_ipaddr} ${words}[-1] |
| 113 | Valid Value client ['${session_resp["Oem"]["OpenBMC"]["ClientID"]}'] |
| 114 | Valid Value session["SessionIDs"] ['${session_resp["Id"]}'] |
| 115 | Valid Value temp_ipaddr ${ip_address} |
| 116 | END |
| 117 | |
| 118 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 119 | Get Lock Resource Information |
| 120 | [Documentation] Get lock resource information. |
| 121 | |
| 122 | ${code_base_dir_path}= Get Code Base Dir Path |
| 123 | ${resource_lock_json}= Evaluate |
| 124 | ... json.load(open('${code_base_dir_path}data/resource_lock_table.json')) modules=json |
| 125 | Rprint Vars resource_lock_json |
| 126 | |
| 127 | [Return] ${resource_lock_json} |
Sushil Singh | b79142c | 2022-09-15 01:04:11 -0500 | [diff] [blame] | 128 | |