summaryrefslogtreecommitdiffstats
path: root/tests/units/anta_tests/test_multicast.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-28 06:11:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-28 06:11:39 +0000
commit1fd6a618b60d7168fd8f37585d5d39d22d775afd (patch)
treefbc6d0c213b8acdd0a31deafe5c5fc0d05a3a312 /tests/units/anta_tests/test_multicast.py
parentInitial commit. (diff)
downloadanta-1fd6a618b60d7168fd8f37585d5d39d22d775afd.tar.xz
anta-1fd6a618b60d7168fd8f37585d5d39d22d775afd.zip
Adding upstream version 0.13.0.upstream/0.13.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/units/anta_tests/test_multicast.py')
-rw-r--r--tests/units/anta_tests/test_multicast.py175
1 files changed, 175 insertions, 0 deletions
diff --git a/tests/units/anta_tests/test_multicast.py b/tests/units/anta_tests/test_multicast.py
new file mode 100644
index 0000000..9276a9f
--- /dev/null
+++ b/tests/units/anta_tests/test_multicast.py
@@ -0,0 +1,175 @@
+# Copyright (c) 2023-2024 Arista Networks, Inc.
+# Use of this source code is governed by the Apache License 2.0
+# that can be found in the LICENSE file.
+"""Test inputs for anta.tests.multicast"""
+from __future__ import annotations
+
+from typing import Any
+
+from anta.tests.multicast import VerifyIGMPSnoopingGlobal, VerifyIGMPSnoopingVlans
+from tests.lib.anta import test # noqa: F401; pylint: disable=unused-import
+
+DATA: list[dict[str, Any]] = [
+ {
+ "name": "success-enabled",
+ "test": VerifyIGMPSnoopingVlans,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "enabled",
+ "vlans": {
+ "1": {
+ "reportFlooding": "disabled",
+ "proxyActive": False,
+ "groupsOverrun": False,
+ "multicastRouterLearningMode": "pim-dvmrp",
+ "igmpSnoopingState": "enabled",
+ "pruningActive": False,
+ "maxGroups": 65534,
+ "immediateLeave": "default",
+ "floodingTraffic": True,
+ },
+ "42": {
+ "reportFlooding": "disabled",
+ "proxyActive": False,
+ "groupsOverrun": False,
+ "multicastRouterLearningMode": "pim-dvmrp",
+ "igmpSnoopingState": "enabled",
+ "pruningActive": False,
+ "maxGroups": 65534,
+ "immediateLeave": "default",
+ "floodingTraffic": True,
+ },
+ },
+ "robustness": 2,
+ "immediateLeave": "enabled",
+ "reportFloodingSwitchPorts": [],
+ }
+ ],
+ "inputs": {"vlans": {1: True, 42: True}},
+ "expected": {"result": "success"},
+ },
+ {
+ "name": "success-disabled",
+ "test": VerifyIGMPSnoopingVlans,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "enabled",
+ "vlans": {
+ "42": {
+ "reportFlooding": "disabled",
+ "proxyActive": False,
+ "groupsOverrun": False,
+ "multicastRouterLearningMode": "pim-dvmrp",
+ "igmpSnoopingState": "disabled",
+ "pruningActive": False,
+ "maxGroups": 65534,
+ "immediateLeave": "default",
+ "floodingTraffic": True,
+ }
+ },
+ "robustness": 2,
+ "immediateLeave": "enabled",
+ "reportFloodingSwitchPorts": [],
+ }
+ ],
+ "inputs": {"vlans": {42: False}},
+ "expected": {"result": "success"},
+ },
+ {
+ "name": "failure-missing-vlan",
+ "test": VerifyIGMPSnoopingVlans,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "enabled",
+ "vlans": {
+ "1": {
+ "reportFlooding": "disabled",
+ "proxyActive": False,
+ "groupsOverrun": False,
+ "multicastRouterLearningMode": "pim-dvmrp",
+ "igmpSnoopingState": "enabled",
+ "pruningActive": False,
+ "maxGroups": 65534,
+ "immediateLeave": "default",
+ "floodingTraffic": True,
+ },
+ },
+ "robustness": 2,
+ "immediateLeave": "enabled",
+ "reportFloodingSwitchPorts": [],
+ }
+ ],
+ "inputs": {"vlans": {1: False, 42: False}},
+ "expected": {"result": "failure", "messages": ["IGMP state for vlan 1 is enabled", "Supplied vlan 42 is not present on the device."]},
+ },
+ {
+ "name": "failure-wrong-state",
+ "test": VerifyIGMPSnoopingVlans,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "enabled",
+ "vlans": {
+ "1": {
+ "reportFlooding": "disabled",
+ "proxyActive": False,
+ "groupsOverrun": False,
+ "multicastRouterLearningMode": "pim-dvmrp",
+ "igmpSnoopingState": "disabled",
+ "pruningActive": False,
+ "maxGroups": 65534,
+ "immediateLeave": "default",
+ "floodingTraffic": True,
+ },
+ },
+ "robustness": 2,
+ "immediateLeave": "enabled",
+ "reportFloodingSwitchPorts": [],
+ }
+ ],
+ "inputs": {"vlans": {1: True}},
+ "expected": {"result": "failure", "messages": ["IGMP state for vlan 1 is disabled"]},
+ },
+ {
+ "name": "success-enabled",
+ "test": VerifyIGMPSnoopingGlobal,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "enabled",
+ "robustness": 2,
+ "immediateLeave": "enabled",
+ "reportFloodingSwitchPorts": [],
+ }
+ ],
+ "inputs": {"enabled": True},
+ "expected": {"result": "success"},
+ },
+ {
+ "name": "success-disabled",
+ "test": VerifyIGMPSnoopingGlobal,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "disabled",
+ }
+ ],
+ "inputs": {"enabled": False},
+ "expected": {"result": "success"},
+ },
+ {
+ "name": "failure-wrong-state",
+ "test": VerifyIGMPSnoopingGlobal,
+ "eos_data": [
+ {
+ "reportFlooding": "disabled",
+ "igmpSnoopingState": "disabled",
+ }
+ ],
+ "inputs": {"enabled": True},
+ "expected": {"result": "failure", "messages": ["IGMP state is not valid: disabled"]},
+ },
+]