2025-03-17 07:33:51 +01:00
|
|
|
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
2025-02-05 11:32:35 +01:00
|
|
|
# Use of this source code is governed by the Apache License 2.0
|
|
|
|
# that can be found in the LICENSE file.
|
2025-02-05 11:39:09 +01:00
|
|
|
"""Test inputs for anta.tests.multicast."""
|
|
|
|
|
2025-02-05 11:32:35 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2025-05-15 09:34:30 +02:00
|
|
|
import sys
|
|
|
|
from typing import TYPE_CHECKING, Any
|
2025-02-05 11:32:35 +01:00
|
|
|
|
2025-05-15 09:34:30 +02:00
|
|
|
from anta.models import AntaTest
|
|
|
|
from anta.result_manager.models import AntaTestStatus
|
2025-02-05 11:32:35 +01:00
|
|
|
from anta.tests.multicast import VerifyIGMPSnoopingGlobal, VerifyIGMPSnoopingVlans
|
2025-02-05 11:54:55 +01:00
|
|
|
from tests.units.anta_tests import test
|
2025-02-05 11:32:35 +01:00
|
|
|
|
2025-05-15 09:34:30 +02:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
from tests.units.anta_tests import AntaUnitTestDataDict
|
|
|
|
|
|
|
|
DATA: AntaUnitTestDataDict = {
|
|
|
|
(VerifyIGMPSnoopingVlans, "success-enabled"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"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": [],
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"vlans": {1: True, 42: True}},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingVlans, "success-disabled"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"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,
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
|
|
|
"robustness": 2,
|
|
|
|
"immediateLeave": "enabled",
|
|
|
|
"reportFloodingSwitchPorts": [],
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"vlans": {42: False}},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingVlans, "failure-missing-vlan"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"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,
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
|
|
|
"robustness": 2,
|
|
|
|
"immediateLeave": "enabled",
|
|
|
|
"reportFloodingSwitchPorts": [],
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"vlans": {1: False, 42: False}},
|
2025-03-17 07:33:51 +01:00
|
|
|
"expected": {
|
2025-05-15 09:34:30 +02:00
|
|
|
"result": AntaTestStatus.FAILURE,
|
2025-03-17 07:33:51 +01:00
|
|
|
"messages": ["VLAN1 - Incorrect IGMP state - Expected: disabled Actual: enabled", "Supplied vlan 42 is not present on the device"],
|
|
|
|
},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingVlans, "failure-wrong-state"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"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,
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
|
|
|
"robustness": 2,
|
|
|
|
"immediateLeave": "enabled",
|
|
|
|
"reportFloodingSwitchPorts": [],
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"vlans": {1: True}},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VLAN1 - Incorrect IGMP state - Expected: enabled Actual: disabled"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingGlobal, "success-enabled"): {
|
|
|
|
"eos_data": [{"reportFlooding": "disabled", "igmpSnoopingState": "enabled", "robustness": 2, "immediateLeave": "enabled", "reportFloodingSwitchPorts": []}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"enabled": True},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingGlobal, "success-disabled"): {
|
|
|
|
"eos_data": [{"reportFlooding": "disabled", "igmpSnoopingState": "disabled"}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"enabled": False},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
(VerifyIGMPSnoopingGlobal, "failure-wrong-state"): {
|
|
|
|
"eos_data": [{"reportFlooding": "disabled", "igmpSnoopingState": "disabled"}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"enabled": True},
|
2025-05-15 09:34:30 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["IGMP state is not valid - Expected: enabled Actual: disabled"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:30 +02:00
|
|
|
}
|