| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
"""Data for testing anta.tests.configuration.""" |
| 5 |
|
| 6 |
from __future__ import annotations |
| 7 |
|
| 8 |
import sys |
| 9 |
from typing import TYPE_CHECKING, Any |
| 10 |
|
| 11 |
from anta.models import AntaTest |
| 12 |
from anta.result_manager.models import AntaTestStatus |
| 13 |
from anta.tests.greent import VerifyGreenT, VerifyGreenTCounters |
| 14 |
from tests.units.anta_tests import test |
| 15 |
|
| 16 |
if TYPE_CHECKING: |
| 17 |
from tests.units.anta_tests import AntaUnitTestData |
| 18 |
|
| 19 |
DATA: AntaUnitTestData = { |
| 20 |
(VerifyGreenTCounters, "success"): { |
| 21 |
"eos_data": [{"sampleRcvd": 0, "sampleDiscarded": 0, "multiDstSampleRcvd": 0, "grePktSent": 1, "sampleSent": 0}], |
| 22 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 23 |
}, |
| 24 |
(VerifyGreenTCounters, "failure"): { |
| 25 |
"eos_data": [{"sampleRcvd": 0, "sampleDiscarded": 0, "multiDstSampleRcvd": 0, "grePktSent": 0, "sampleSent": 0}], |
| 26 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["GreenT counters are not incremented"]}, |
| 27 |
}, |
| 28 |
(VerifyGreenT, "success"): { |
| 29 |
"eos_data": [ |
| 30 |
{ |
| 31 |
"profiles": { |
| 32 |
"default": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}}, |
| 33 |
"testProfile": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}}, |
| 34 |
} |
| 35 |
} |
| 36 |
], |
| 37 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 38 |
}, |
| 39 |
(VerifyGreenT, "failure"): { |
| 40 |
"eos_data": [ |
| 41 |
{ |
| 42 |
"profiles": { |
| 43 |
"default": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}} |
| 44 |
} |
| 45 |
} |
| 46 |
], |
| 47 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No GreenT policy is created"]}, |
| 48 |
}, |
| 49 |
} |