syslog: Update test texts for test specification

This commit is contained in:
Mattias Walström
2024-10-02 22:58:06 +02:00
parent b21945f38a
commit 19d40af20a
7 changed files with 25 additions and 26 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
=== Syslog Basic
==== Description
- Add syslog actions to log to local files
- Verify new log files have been created
Add syslog actions to log to local files, then verify new log files have been created.
==== Topology
ifdef::topdoc[]
@@ -16,9 +15,9 @@ image::topology.png[Syslog Basic topology]
endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initializing ...
. Add new syslog file action
. Verify log files have been created ...
. Initializing
. Configure DUT
. Verify log files /var/log/bar.log and /var/log/bar.log have been created
<<<
+4 -5
View File
@@ -2,22 +2,21 @@
"""
Syslog Basic
- Add syslog actions to log to local files
- Verify new log files have been created
Add syslog actions to log to local files, then verify new log files have been created.
"""
import infamy
import infamy.ssh as ssh
with infamy.Test() as test:
with test.step("Initializing ..."):
with test.step("Initializing"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
factory = env.get_password("target")
address = target.get_mgmt_ip()
with test.step("Add new syslog file action"):
with test.step("Configure DUT"):
target.put_config_dict("ietf-syslog", {
"syslog": {
"actions": {
@@ -59,7 +58,7 @@ with infamy.Test() as test:
}
})
with test.step("Verify log files have been created ..."):
with test.step("Verify log files /var/log/bar.log and /var/log/bar.log have been created"):
user = tgtssh.runsh("ls /var/log/{foo,bar.log}").stdout
if "/var/log/foo" not in user:
test.fail()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

+3 -3
View File
@@ -16,9 +16,9 @@ endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initialize
. Topology setup
. Syslog setup
. Verify logging from client to server
. Configure DUTs
. Send security:notice log message from client
. Verify reception of client log message, incl. sorting to /log/security on server
<<<
+10 -9
View File
@@ -14,15 +14,15 @@ with infamy.Test() as test:
clientssh = env.attach("client", "mgmt", "ssh")
serverssh = env.attach("server", "mgmt", "ssh")
with test.step("Topology setup"):
_, client_e1 = env.ltop.xlate("client", "to_server")
_, server_e0 = env.ltop.xlate("server", "to_client")
with test.step("Configure DUTs"):
_, client_link = env.ltop.xlate("client", "link")
_, server_link = env.ltop.xlate("server", "link")
client.put_config_dict("ietf-interfaces", {
"interfaces": {
"interface": [
{
"name": client_e1,
"name": client_link,
"enabled": True,
"ipv4": {
"address": [
@@ -41,7 +41,7 @@ with infamy.Test() as test:
"interfaces": {
"interface": [
{
"name": server_e0,
"name": server_link,
"type": "infix-if-type:bridge",
"enabled": True,
"ipv4": {
@@ -57,7 +57,6 @@ with infamy.Test() as test:
}
})
with test.step("Syslog setup"):
client.put_config_dict("ietf-syslog", {
"syslog": {
"actions": {
@@ -146,9 +145,11 @@ with infamy.Test() as test:
}
})
with test.step("Verify logging from client to server"):
clientssh.runsh("logger -t test -m client -p security.notice Hej")
with test.step("Send security:notice log message from client"):
clientssh.runsh("logger -t test -m client -p security.notice TestMessage")
with test.step("Verify reception of client log message, incl. sorting to /log/security on server"):
infamy.until(lambda: serverssh.runsh(
"grep 'test - client - Hej' /log/security").returncode == 0)
"grep 'test - client - TestMessage' /log/security").returncode == 0)
test.succeed()
+4 -4
View File
@@ -7,24 +7,24 @@ graph "2x2" {
edge [color="cornflowerblue", penwidth="2"];
host [
label="host | { <cli_mgmt> cli_mgmt | <ser_mgmt> ser_mgmt }",
label="host | { <client_mgmt> client_mgmt | <server_mgmt> server_mgmt }",
pos="0,12!",
kind="controller",
];
client [
label="{ <mgmt> mgmt | <to_server> to_server} | client",
label="{ <mgmt> mgmt | <link> ĺink} | client",
pos="15,18!",
kind="infix",
];
server [
label="{ <to_client> to_client | <mgmt> mgmt } | server",
label="{ <link> link | <mgmt> mgmt } | server",
pos="15,6!",
kind="infix",
];
host:cli_mgmt -- client:mgmt [kind=mgmt]
host:ser_mgmt -- server:mgmt [kind=mgmt]
client:to_server -- server:to_client [color=black, fontcolor=black, taillabel="10.0.0.2/24", headlabel="10.0.0.1/24"]
client:link -- server:link [color=black, fontcolor=black, taillabel="10.0.0.2/24", headlabel="10.0.0.1/24"]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB