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 | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 5 | Library ../../lib/gen_robot_valid.py |
| 6 | Library Collections |
| 7 | Library ../../lib/bmc_ssh_utils.py |
| 8 | Library 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 | |
| 19 | Set AvahiDaemon Service |
| 20 | [Documentation] To enable or disable avahi service. |
| 21 | [Arguments] ${command} |
| 22 | |
| 23 | # Description of argument(s): |
George Keishing | 1faaa46 | 2020-04-16 10:27:20 -0500 | [diff] [blame] | 24 | # command Get command from dictionary. |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 25 | |
| 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 | |
| 31 | Verify AvahiDaemon Service Status |
| 32 | [Documentation] To check for avahi service. |
| 33 | [Arguments] ${message} |
| 34 | |
| 35 | # Description of argument(s): |
George Keishing | 1faaa46 | 2020-04-16 10:27:20 -0500 | [diff] [blame] | 36 | # message Get status message from dictionary. |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 37 | |
| 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 Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 42 | |
| 43 | |
Sushil Singh | 87e984c | 2020-10-20 01:43:47 -0500 | [diff] [blame] | 44 | Create 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 | |
| 63 | Create 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 | |
| 82 | Verify A Session Created With ClientID |
| 83 | [Arguments] ${client_id} ${session_ids} |
| 84 | |
| 85 | # Description of argument(s): |
| 86 | # client_id External client name. |
| 87 | # session_id This value is a session id. |
| 88 | |
| 89 | # { |
| 90 | # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ", |
| 91 | # "@odata.type": "#Session.v1_0_2.Session", |
| 92 | # "Description": "Manager User Session", |
| 93 | # "Id": "H8q2ZKucSJ", |
| 94 | # "Name": "User Session", |
| 95 | # "Oem": { |
| 96 | # "OpenBMC": { |
| 97 | # "@odata.type": "#OemSession.v1_0_0.Session", |
| 98 | # "ClientID": "", |
| 99 | # "ClientOriginIP": "::ffff:x.x.x.x" |
| 100 | # } |
| 101 | # }, |
| 102 | # "UserName": "root" |
| 103 | # } |
| 104 | |
| 105 | FOR ${client} ${session} IN ZIP ${client_id} ${session_ids} |
| 106 | ${session_resp}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session["SessionIDs"]} |
| 107 | Rprint Vars session_resp |
| 108 | @{words} = Split String ${session_resp["ClientOriginIPAddress"]} : |
| 109 | ${ip_address}= Get Running System IP |
| 110 | Set Test Variable ${temp_ipaddr} ${words}[-1] |
| 111 | Valid Value client ['${session_resp["Oem"]["OpenBMC"]["ClientID"]}'] |
| 112 | Valid Value session["SessionIDs"] ['${session_resp["Id"]}'] |
| 113 | Valid Value temp_ipaddr ${ip_address} |
| 114 | END |
| 115 | |
| 116 | |
Sushil Singh | d03f2ce | 2020-09-17 08:54:41 -0500 | [diff] [blame] | 117 | Get Lock Resource Information |
| 118 | [Documentation] Get lock resource information. |
| 119 | |
| 120 | ${code_base_dir_path}= Get Code Base Dir Path |
| 121 | ${resource_lock_json}= Evaluate |
| 122 | ... json.load(open('${code_base_dir_path}data/resource_lock_table.json')) modules=json |
| 123 | Rprint Vars resource_lock_json |
| 124 | |
| 125 | [Return] ${resource_lock_json} |