blob: 20f8498532c5d1b059712c5f85f41d16e4163eb5 [file] [log] [blame]
George Keishing6a514ef2018-08-27 05:19:19 -05001*** Settings ***
2Documentation Remote logging test for rsyslog.
3
4# Program arguments:
5# REMOTE_LOG_SERVER_HOST The host name or IP address of the remote
6# logging server.
7# REMOTE_LOG_SERVER_PORT The port number for the remote logging server.
8
9Resource ../lib/resource.txt
10Resource ../lib/rest_client.robot
11Resource ../lib/utils.robot
12Resource ../lib/openbmc_ffdc.robot
13
14Suite Setup Suite Setup Execution
15Test Teardown FFDC On Test Case Fail
16
17*** Test Cases ***
18
19Test Remote Logging REST Interface And Verify Config
20 [Documentation] Test remote logging interface and configuration.
21 [Tags] Test_Remote_Logging_REST_Interface_And_Verify_Config
22
23 Configure Remote Logging Server
24 Verify Rsyslog Config On BMC
25
26 Configure Remote Logging Server remote_host=${EMPTY} remote_port=0
27 Verify Rsyslog Config On BMC remote_host=remote-host remote_port=port
28
29
30*** Keywords ***
31
32Suite Setup Execution
33 [Documentation] Do the suite setup.
34
35 Should Not Be Empty ${REMOTE_LOG_SERVER_HOST}
36 Should Not Be Empty ${REMOTE_LOG_SERVER_PORT}
37 Ping Host ${REMOTE_LOG_SERVER_HOST}
38 Remote Logging Interface Should Exist
39
40
41Remote Logging Interface Should Exist
42 [Documentation] Check that the remote logging URI exist.
43
44 ${resp}= OpenBMC Get Request ${REMOTE_LOGGING_URI}
45 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
46
47
48Configure Remote Logging Server
49 [Documentation] Configure the remote logging server on BMC.
50 [Arguments] ${remote_host}=${REMOTE_LOG_SERVER_HOST}
51 ... ${remote_port}=${REMOTE_LOG_SERVER_PORT}
52
53 # Description of argument(s):
54 # remote_host The host name or IP address of the remote logging server
55 # (e.g. "xx.xx.xx.xx").
56 # remote_port Remote ryslog server port number (e.g. "514").
57
58 # Example:
59 # https://xx.xx.xx.xx/xyz/openbmc_project/logging/config/remote
60 # Response code:200, Content:{
61 # "data": {
62 # "Address": "xx.xx.xx.xx",
63 # "Port": 514
64 # },
65 # "message": "200 OK",
66 # "status": "ok"
67 # }
68
69 ${host_dict}= Create Dictionary data=${remote_host}
70 Write Attribute ${REMOTE_LOGGING_URI} Address data=${host_dict}
71 ... verify=${TRUE} expected_value=${remote_host}
72
73 ${remote_port}= Convert To Integer ${remote_port}
74 ${port_dict}= Create Dictionary data=${remote_port}
75 Write Attribute ${REMOTE_LOGGING_URI} Port data=${port_dict}
76 ... verify=${TRUE} expected_value=${remote_port}
77
78
79Verify Rsyslog Config On BMC
80 [Documentation] Check if the rsyslog configuration on BMC is correct.
81 [Arguments] ${remote_host}=${REMOTE_LOG_SERVER_HOST}
82 ... ${remote_port}=${REMOTE_LOG_SERVER_PORT}
83
84 # Description of argument(s):
85 # remote_host The host name or IP address of the remote logging server
86 # (e.g. "xx.xx.xx.xx").
87 # remote_port Remote ryslog server port number (e.g. "514").
88
89 # Example:
90 # Configured:
91 # *.* @@xx.xx.xx.xx:514root@wsbmc123
92 # By default:
93 # #*.* @@remote-host:port
94
95 ${ryslog_conf} ${stderr} ${rc}= BMC Execute Command
96 ... cat /etc/rsyslog.d/server.conf
97
98 ${config}= Catenate @@${remote_host}:${remote_port}
99
100 Should Contain ${ryslog_conf} ${config}
101 ... msg=${remote_host} and ${remote_port} are not configured.