|
6 | 6 |
|
7 | 7 | """ |
8 | 8 |
|
9 | | -import infamy |
10 | 9 | import time |
| 10 | +import infamy |
| 11 | +import infamy.iface as iface |
| 12 | +from infamy import until |
11 | 13 |
|
12 | 14 | TEST_MESSAGES = [ |
13 | 15 | ("router1", "Message from router1"), |
|
91 | 93 | } |
92 | 94 | }) |
93 | 95 |
|
| 96 | + with test.step("Wait for server interface to be operational"): |
| 97 | + until(lambda: iface.get_param(server, server_link, "oper-status") == "up", attempts=20) |
| 98 | + |
| 99 | + with test.step("Verify server IP address is configured"): |
| 100 | + until(lambda: iface.address_exist(server, server_link, "10.0.0.1", proto="static"), attempts=20) |
| 101 | + |
| 102 | + with test.step("Verify syslog server is listening on UDP port 514"): |
| 103 | + until(lambda: "10.0.0.1:514" in serverssh.runsh("ss -ulnp 2>/dev/null | grep :514 || true").stdout, attempts=20) |
| 104 | + |
94 | 105 | with test.step("Configure client to forward logs to server"): |
95 | 106 | _, client_link = env.ltop.xlate("client", "link") |
96 | 107 |
|
|
131 | 142 | } |
132 | 143 | }) |
133 | 144 |
|
134 | | - time.sleep(2) |
| 145 | + with test.step("Wait for client interface to be operational"): |
| 146 | + until(lambda: iface.get_param(client, client_link, "oper-status") == "up", attempts=20) |
| 147 | + |
| 148 | + with test.step("Verify client IP address is configured"): |
| 149 | + until(lambda: iface.address_exist(client, client_link, "10.0.0.2", proto="static"), attempts=20) |
| 150 | + |
| 151 | + with test.step("Verify network connectivity between client and server"): |
| 152 | + until(lambda: clientssh.runsh("ping -c 1 -W 1 10.0.0.1 >/dev/null 2>&1").returncode == 0, attempts=10) |
135 | 153 |
|
136 | 154 | with test.step("Send log messages with different hostnames"): |
137 | 155 | for hostname, message in TEST_MESSAGES: |
138 | 156 | clientssh.runsh(f"logger -t test -p daemon.info -H {hostname} -h 10.0.0.1 '{message}'") |
139 | | - time.sleep(2) |
| 157 | + # Give extra time for messages to be received and written to disk on physical hardware |
| 158 | + time.sleep(5) |
140 | 159 |
|
141 | 160 | with test.step("Verify router1 log contains only router1 messages"): |
142 | 161 | rc = serverssh.runsh("cat /var/log/router1 2>/dev/null") |
|
0 commit comments