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