Commit 6f3b872b authored by Matous Holinka's avatar Matous Holinka Committed by Ondřej Zajíček

Test suits updated with log testing

parent 908d37c1
......@@ -53,3 +53,9 @@ def test_bird_routes_ipv4(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -53,3 +53,9 @@ def test_bird_routes_ipv4(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6", "primary")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -53,3 +53,9 @@ def test_bird_routes_ipv4(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -53,3 +53,9 @@ def test_bird_routes_ipv4(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6", "")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
import pytest
from typing import List
import tests.kernel as tk
import tests.config as cf
......@@ -6,6 +7,33 @@ import tests.config as cf
LIMIT = 60
EXPECTED_DEVICES = ("m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8")
LOGS_M1 = [
"<INFO> Started",
"<AUTH> ospf4: Authentication failed for nbr 10.0.0.3 on ve2 - wrong password",
"<AUTH> ospf5: Authentication failed for nbr 10.0.0.3 on ve2 - wrong authentication code",
"<AUTH> ospf6: Authentication failed for nbr 10.0.0.3 on ve2 - wrong authentication code"
]
LOGS_M3 = [
"<INFO> Started",
"<AUTH> ospf4: Authentication failed for nbr 10.0.0.1 on ve1 - wrong password",
"<AUTH> ospf5: Authentication failed for nbr 10.0.0.1 on ve1 - wrong authentication code",
"<AUTH> ospf6: Authentication failed for nbr 10.0.0.1 on ve1 - wrong authentication code",
]
LOGS_M6 = [
"<INFO> Started",
"<AUTH> ospf4: Authentication failed for nbr 10.0.0.8 on ve2 - wrong authentication code",
"<AUTH> ospf5: Authentication failed for nbr 10.0.0.8 on ve2 - wrong authentication code",
"<AUTH> ospf6: Authentication failed for nbr 10.0.0.8 on ve2 - wrong authentication code",
]
LOGS_M8 = [
"<INFO> Started",
"<AUTH> ospf4: Authentication failed for nbr 10.0.0.6 on ve1 - wrong authentication code",
"<AUTH> ospf5: Authentication failed for nbr 10.0.0.6 on ve1 - wrong authentication code",
"<AUTH> ospf6: Authentication failed for nbr 10.0.0.6 on ve1 - wrong authentication code",
]
@pytest.mark.skipif(cf.save == False, reason="mode: save")
......@@ -48,3 +76,21 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize(
"exp_devs, exp_messages",
[
pytest.param("m1", LOGS_M1),
pytest.param("m2", []),
pytest.param("m3", LOGS_M3),
pytest.param("m4", []),
pytest.param("m5", []),
pytest.param("m6", LOGS_M6),
pytest.param("m7", []),
pytest.param("m8", LOGS_M8)
],
)
def test_logging(exp_devs: str, exp_messages: List[str]):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, exp_messages)
......@@ -48,3 +48,9 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -48,3 +48,9 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -6,6 +6,13 @@ import tests.config as cf
LIMIT = 60
EXPECTED_DEVICES = ("m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8")
LOG_M = ["<WARN> ospf5: Cannot find next hop for LSA"]
LOG_M5 = ["<RMT> ospf6: Bad packet from .* via ve1 - wrong TTL \(1\)"]
LOG_M8 = [
"<RMT> ospf4: Bad packet from .* via ve1 - wrong TTL \(1\)",
"<RMT> ospf5: Bad packet from .* via ve1 - wrong TTL \(1\)",
"<RMT> ospf6: Bad packet from .* via ve1 - wrong TTL \(1\)",
]
@pytest.mark.skipif(cf.save == False, reason="mode: save")
......@@ -48,3 +55,21 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize(
"exp_devs, exp_messages",
[
pytest.param("m1", LOG_M),
pytest.param("m2", LOG_M),
pytest.param("m3", LOG_M),
pytest.param("m4", LOG_M),
pytest.param("m5", LOG_M5),
pytest.param("m6", []),
pytest.param("m7", []),
pytest.param("m8", LOG_M8),
],
)
def test_logging(exp_devs: str, exp_messages: List[str]):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, exp_messages)
......@@ -48,3 +48,9 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -6,6 +6,14 @@ import tests.config as cf
LIMIT = 60
EXPECTED_DEVICES = ("m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8")
LOG_M3 = [
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local"
]
@pytest.mark.skipif(cf.save == False, reason="mode: save")
......@@ -48,3 +56,21 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize(
"exp_devs, exp_messages",
[
pytest.param("m1", []),
pytest.param("m2", []),
pytest.param("m3", LOG_M3),
pytest.param("m4", []),
pytest.param("m5", []),
pytest.param("m6", []),
pytest.param("m7", []),
pytest.param("m8", []),
],
)
def test_logging(exp_devs: str, exp_messages: List[str]):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, exp_messages)
......@@ -42,3 +42,9 @@ def test_bird_routes_ipv4(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -48,3 +48,9 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -6,6 +6,14 @@ import tests.config as cf
LIMIT = 60
EXPECTED_DEVICES = ("m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8")
LOG_M = [
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf5: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local",
"<WARN> ospf6: Configured neighbor address .* should be link-local"
]
@pytest.mark.skipif(cf.save == False, reason="mode: save")
......@@ -48,3 +56,21 @@ def test_bird_routes_ipv4_ospf3(exp_devs: str):
def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize(
"exp_devs, exp_messages",
[
pytest.param("m1", []),
pytest.param("m2", []),
pytest.param("m3", LOG_M),
pytest.param("m4", []),
pytest.param("m5", LOG_M),
pytest.param("m6", []),
pytest.param("m7", []),
pytest.param("m8", []),
],
)
def test_logging(exp_devs: str, exp_messages: List[str]):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, exp_messages)
......@@ -18,9 +18,11 @@ def test_krt_routes_ipv4(exp_devs: str):
"""IPv4: get the content of KERNEL tables and check it"""
tk.test_krt_routes("krt4", exp_devs, "inet")
def test_krt_routes_ipv4_vrf2():
tk.test_krt_routes("krt4vrf2", "m1", "inet", "200")
def test_krt_routes_ipv4_vrf3():
tk.test_krt_routes("krt4vrf3", "m1", "inet", "300")
......@@ -30,9 +32,11 @@ def test_krt_routes_ipv6(exp_devs: str):
"""IPv6: get the content of KERNEL tables and check it"""
tk.test_krt_routes("krt6", exp_devs, "inet6")
def test_krt_routes_ipv6_vrf2():
tk.test_krt_routes("krt6vrf2", "m1", "inet6", "200")
def test_krt_routes_ipv6_vrf3():
tk.test_krt_routes("krt6vrf3", "m1", "inet6", "300")
......@@ -42,6 +46,7 @@ def test_bird_routes_ipv4(exp_devs: str):
"""IPv4: get the content of BIRD tables and check it"""
tk.test_bird_routes("master4", exp_devs, "master4")
@pytest.mark.parametrize("tab", ("t100v4", "t200v4", "t300v4"))
def test_bird_routes_ipv4_vrfs(tab: str):
tk.test_bird_routes(tab, "m1", tab)
......@@ -52,6 +57,13 @@ def test_bird_routes_ipv6(exp_devs: str):
"""IPv6: get the content of BIRD tables and check it"""
tk.test_bird_routes("master6", exp_devs, "master6")
@pytest.mark.parametrize("tab", ("t100v6", "t200v6", "t300v6"))
def test_bird_routes_ipv6_vrfs(tab: str):
tk.test_bird_routes(tab, "m1", tab)
@pytest.mark.parametrize("exp_devs", EXPECTED_DEVICES)
def test_logging(exp_devs: str):
"""Check the log files. There should only DBG, INFO and TRACE messages"""
tk.test_logs(exp_devs, [])
......@@ -119,4 +119,3 @@ def check_expected_logs(log_messages: List[str], logfile: str) -> bool:
if os.system(f"egrep '{message}' {logfile}"):
return False
return True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment