1bbfc394bSGeorge Keishing*** Settings *** 2bbfc394bSGeorge KeishingDocumentation Remote syslog utilities keywords. 3bbfc394bSGeorge Keishing 4839a0c27SSandhya SomashekarResource ../lib/resource.robot 5bbfc394bSGeorge KeishingResource ../lib/rest_client.robot 6bbfc394bSGeorge KeishingResource ../lib/utils.robot 7bbfc394bSGeorge Keishing 8bbfc394bSGeorge Keishing*** Keywords *** 9bbfc394bSGeorge Keishing 10bbfc394bSGeorge KeishingConfigure Remote Log Server With Parameters 11bbfc394bSGeorge Keishing [Documentation] Configure the remote logging server on BMC. 12bbfc394bSGeorge Keishing [Arguments] ${remote_host}=${REMOTE_LOG_SERVER_HOST} 13bbfc394bSGeorge Keishing ... ${remote_port}=${REMOTE_LOG_SERVER_PORT} 14bbfc394bSGeorge Keishing 15bbfc394bSGeorge Keishing # Description of argument(s): 16bbfc394bSGeorge Keishing # remote_host The host name or IP address of the remote logging server 17bbfc394bSGeorge Keishing # (e.g. "xx.xx.xx.xx"). 18bbfc394bSGeorge Keishing # remote_port Remote ryslog server port number (e.g. "514"). 19bbfc394bSGeorge Keishing 20bbfc394bSGeorge Keishing # Example: 21bbfc394bSGeorge Keishing # https://xx.xx.xx.xx/xyz/openbmc_project/logging/config/remote 22bbfc394bSGeorge Keishing # Response code:200, Content:{ 23bbfc394bSGeorge Keishing # "data": { 24bbfc394bSGeorge Keishing # "Address": "xx.xx.xx.xx", 25bbfc394bSGeorge Keishing # "Port": 514 26bbfc394bSGeorge Keishing # }, 27bbfc394bSGeorge Keishing # "message": "200 OK", 28bbfc394bSGeorge Keishing # "status": "ok" 29bbfc394bSGeorge Keishing # } 30bbfc394bSGeorge Keishing 31bbfc394bSGeorge Keishing ${host_dict}= Create Dictionary data=${remote_host} 32bbfc394bSGeorge Keishing Write Attribute ${REMOTE_LOGGING_URI} Address data=${host_dict} 33bbfc394bSGeorge Keishing ... verify=${TRUE} expected_value=${remote_host} 34bbfc394bSGeorge Keishing 355e5f1786SGeorge Keishing Sleep 20s 36bbfc394bSGeorge Keishing 37bbfc394bSGeorge Keishing ${remote_port}= Convert To Integer ${remote_port} 38bbfc394bSGeorge Keishing ${port_dict}= Create Dictionary data=${remote_port} 39bbfc394bSGeorge Keishing Write Attribute ${REMOTE_LOGGING_URI} Port data=${port_dict} 40bbfc394bSGeorge Keishing ... verify=${TRUE} expected_value=${remote_port} 41bbfc394bSGeorge Keishing 425e5f1786SGeorge Keishing Sleep 20s 43bbfc394bSGeorge Keishing 44bbfc394bSGeorge Keishing 45bbfc394bSGeorge KeishingConfigure Remote Log Server 46bbfc394bSGeorge Keishing [Documentation] Configure the remote logging server on BMC. 47bbfc394bSGeorge Keishing [Arguments] ${remote_host}=${REMOTE_LOG_SERVER_HOST} 48bbfc394bSGeorge Keishing ... ${remote_port}=${REMOTE_LOG_SERVER_PORT} 49bbfc394bSGeorge Keishing 50bbfc394bSGeorge Keishing # Description of argument(s): 51bbfc394bSGeorge Keishing # remote_host The host name or IP address of the remote logging server 52bbfc394bSGeorge Keishing # (e.g. "xx.xx.xx.xx"). 53bbfc394bSGeorge Keishing # remote_port Remote ryslog server port number (e.g. "514"). 54bbfc394bSGeorge Keishing 55bbfc394bSGeorge Keishing @{remote_parm_list}= Create List ${remote_host} ${remote_port} 56bbfc394bSGeorge Keishing 57bbfc394bSGeorge Keishing ${data}= Create Dictionary data=@{remote_parm_list} 58bbfc394bSGeorge Keishing 59bbfc394bSGeorge Keishing ${resp}= OpenBMC Post Request 60bbfc394bSGeorge Keishing ... ${REMOTE_LOGGING_CONFIG_URI}/action/remote data=${data} 61bbfc394bSGeorge Keishing 62bbfc394bSGeorge Keishing Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 63bbfc394bSGeorge Keishing 64bbfc394bSGeorge Keishing 65bbfc394bSGeorge KeishingVerify Rsyslog Config On BMC 66bbfc394bSGeorge Keishing [Documentation] Check if the rsyslog configuration on BMC is correct. 67bbfc394bSGeorge Keishing [Arguments] ${remote_host}=${REMOTE_LOG_SERVER_HOST} 68bbfc394bSGeorge Keishing ... ${remote_port}=${REMOTE_LOG_SERVER_PORT} 69bbfc394bSGeorge Keishing 70bbfc394bSGeorge Keishing # Description of argument(s): 71bbfc394bSGeorge Keishing # remote_host The host name or IP address of the remote logging server 72bbfc394bSGeorge Keishing # (e.g. "xx.xx.xx.xx"). 73bbfc394bSGeorge Keishing # remote_port Remote ryslog server port number (e.g. "514"). 74bbfc394bSGeorge Keishing 75bbfc394bSGeorge Keishing # Example: 76bbfc394bSGeorge Keishing # Configured: 7796904c4eSGeorge Keishing # *.* @@xx.xx.xx.xx:514root@bmchostname 78bbfc394bSGeorge Keishing # By default: 79bbfc394bSGeorge Keishing # #*.* @@remote-host:port 80bbfc394bSGeorge Keishing 81bbfc394bSGeorge Keishing ${ryslog_conf} ${stderr} ${rc}= BMC Execute Command 82bbfc394bSGeorge Keishing ... cat /etc/rsyslog.d/server.conf 83bbfc394bSGeorge Keishing 84bbfc394bSGeorge Keishing ${config}= Catenate @@${remote_host}:${remote_port} 85bbfc394bSGeorge Keishing 86bbfc394bSGeorge Keishing Should Contain ${ryslog_conf} ${config} 87bbfc394bSGeorge Keishing ... msg=${remote_host} and ${remote_port} are not configured. 88bbfc394bSGeorge Keishing 89bbfc394bSGeorge Keishing 90bbfc394bSGeorge KeishingRemote Logging Server Execute Command 91bbfc394bSGeorge Keishing [Documentation] Login to remote logging server. 92bbfc394bSGeorge Keishing [Arguments] ${command} 93bbfc394bSGeorge Keishing ... ${remote_host}=${REMOTE_LOG_SERVER_HOST} 94bbfc394bSGeorge Keishing ... ${username}=${REMOTE_USERNAME} 95bbfc394bSGeorge Keishing ... ${password}=${REMOTE_PASSWORD} 96bbfc394bSGeorge Keishing 97bbfc394bSGeorge Keishing # Description of argument(s): 98bbfc394bSGeorge Keishing # command Command line string. 99bbfc394bSGeorge Keishing # remote_host The host name or IP address of the remote logging server 100bbfc394bSGeorge Keishing # (e.g. "xx.xx.xx.xx"). 101bbfc394bSGeorge Keishing # username Remote rsyslog server user name. 102bbfc394bSGeorge Keishing # password Remote rsyslog server password. 103bbfc394bSGeorge Keishing 104bbfc394bSGeorge Keishing ${remote_dict}= Create Dictionary host=${remote_host} 105bbfc394bSGeorge Keishing Open Connection And Log In ${username} ${password} 106bbfc394bSGeorge Keishing ... &{remote_dict} 107bbfc394bSGeorge Keishing ${stdout} ${stderr}= Execute Command ${command} return_stderr=True 108bbfc394bSGeorge Keishing Should Be Empty ${stderr} 109*409df05dSGeorge Keishing RETURN ${stdout} 110bbfc394bSGeorge Keishing 111bbfc394bSGeorge Keishing 112bbfc394bSGeorge KeishingGet Remote Log Server Configured 113bbfc394bSGeorge Keishing [Documentation] Check that remote logging server is not configured. 114bbfc394bSGeorge Keishing 115bbfc394bSGeorge Keishing ${address}= Read Attribute ${REMOTE_LOGGING_URI} Address 116bbfc394bSGeorge Keishing Should Not Be Equal ${address} ${REMOTE_LOG_SERVER_HOST} 117bbfc394bSGeorge Keishing 118bbfc394bSGeorge Keishing ${port_number}= Convert To Integer ${REMOTE_LOG_SERVER_PORT} 119bbfc394bSGeorge Keishing ${port}= Read Attribute ${REMOTE_LOGGING_URI} Port 120bbfc394bSGeorge Keishing Should Not Be Equal ${port} ${port_number} 121