summaryrefslogtreecommitdiffstats
path: root/tests/units/anta_tests/test_profiles.py
blob: c0ebb57e5d20d1e7f4eeb3cf11e2ebf4bc52a6ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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.
"""
Tests for anta.tests.profiles.py
"""
from __future__ import annotations

from typing import Any

from anta.tests.profiles import VerifyTcamProfile, VerifyUnifiedForwardingTableMode
from tests.lib.anta import test  # noqa: F401; pylint: disable=W0611

DATA: list[dict[str, Any]] = [
    {
        "name": "success",
        "test": VerifyUnifiedForwardingTableMode,
        "eos_data": [{"uftMode": "2", "urpfEnabled": False, "chipModel": "bcm56870", "l2TableSize": 163840, "l3TableSize": 147456, "lpmTableSize": 32768}],
        "inputs": {"mode": 2},
        "expected": {"result": "success"},
    },
    {
        "name": "failure",
        "test": VerifyUnifiedForwardingTableMode,
        "eos_data": [{"uftMode": "2", "urpfEnabled": False, "chipModel": "bcm56870", "l2TableSize": 163840, "l3TableSize": 147456, "lpmTableSize": 32768}],
        "inputs": {"mode": 3},
        "expected": {"result": "failure", "messages": ["Device is not running correct UFT mode (expected: 3 / running: 2)"]},
    },
    {
        "name": "success",
        "test": VerifyTcamProfile,
        "eos_data": [
            {"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "test", "mode": "tcam"}}, "lastProgrammingStatus": {}}
        ],
        "inputs": {"profile": "test"},
        "expected": {"result": "success"},
    },
    {
        "name": "failure",
        "test": VerifyTcamProfile,
        "eos_data": [
            {"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "default", "mode": "tcam"}}, "lastProgrammingStatus": {}}
        ],
        "inputs": {"profile": "test"},
        "expected": {"result": "failure", "messages": ["Incorrect profile running on device: default"]},
    },
]