Debian Codegraph @

tests/units/anta_tests/test_profiles.py

raw symbols SCIP
1 # Copyright (c) 2023-2026 Arista Networks, Inc.
2 # Use of this source code is governed by the Apache License 2.0
3 # that can be found in the LICENSE file.
4 """Tests for anta.tests.profiles.py."""
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.profiles import VerifyTcamProfile, VerifyUnifiedForwardingTableMode
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 (VerifyUnifiedForwardingTableMode, "success"): {
21 "eos_data": [{"uftMode": "2", "urpfEnabled": False, "chipModel": "bcm56870", "l2TableSize": 163840, "l3TableSize": 147456, "lpmTableSize": 32768}],
22 "inputs": {"mode": 2},
23 "expected": {"result": AntaTestStatus.SUCCESS},
24 },
25 (VerifyUnifiedForwardingTableMode, "failure"): {
26 "eos_data": [{"uftMode": "2", "urpfEnabled": False, "chipModel": "bcm56870", "l2TableSize": 163840, "l3TableSize": 147456, "lpmTableSize": 32768}],
27 "inputs": {"mode": 3},
28 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Not running the correct UFT mode - Expected: 3 Actual: 2"]},
29 },
30 (VerifyTcamProfile, "success"): {
31 "eos_data": [
32 {"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "test", "mode": "tcam"}}, "lastProgrammingStatus": {}}
33 ],
34 "inputs": {"profile": "test"},
35 "expected": {"result": AntaTestStatus.SUCCESS},
36 },
37 (VerifyTcamProfile, "failure-pmf-profiles-not-found"): {
38 "eos_data": [{"pmfProfiles": {}, "lastProgrammingStatus": {}}],
39 "inputs": {"profile": "test"},
40 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TCAM profile found"]},
41 },
42 (VerifyTcamProfile, "failure"): {
43 "eos_data": [
44 {
45 "pmfProfiles": {
46 "Linecard3": {"config": "default", "configType": "System Profile", "status": "default", "mode": "tcam"},
47 "Linecard4": {"config": "default", "configType": "System Profile", "status": "default", "mode": "tcam"},
48 "FixedSystem": {"config": "default", "configType": "System Profile", "status": "default", "mode": "tcam"},
49 },
50 }
51 ],
52 "inputs": {"profile": "test"},
53 "expected": {
54 "result": AntaTestStatus.FAILURE,
55 "messages": [
56 "Linecard3 - Incorrect profile running on device - Expected: test Actual: default",
57 "Linecard4 - Incorrect profile running on device - Expected: test Actual: default",
58 "FixedSystem - Incorrect profile running on device - Expected: test Actual: default",
59 ],
60 },
61 },
62 }