Skip to content

Configuration

ANTA catalog for configuration tests

Test functions related to the device configuration

VerifyRunningConfigDiffs

Bases: AntaTest

Verifies there is no difference between the running-config and the startup-config

Source code in anta/tests/configuration.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class VerifyRunningConfigDiffs(AntaTest):
    """
    Verifies there is no difference between the running-config and the startup-config
    """

    name = "VerifyRunningConfigDiffs"
    description = "Verifies there is no difference between the running-config and the startup-config"
    categories = ["configuration"]
    commands = [AntaCommand(command="show running-config diffs", ofmt="text")]

    @AntaTest.anta_test
    def test(self) -> None:
        command_output = self.instance_commands[0].output
        if command_output is None or command_output == "":
            self.result.is_success()
        else:
            self.result.is_failure()
            self.result.is_failure(str(command_output))

VerifyZeroTouch

Bases: AntaTest

Verifies ZeroTouch is disabled

Source code in anta/tests/configuration.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class VerifyZeroTouch(AntaTest):
    """
    Verifies ZeroTouch is disabled
    """

    name = "VerifyZeroTouch"
    description = "Verifies ZeroTouch is disabled"
    categories = ["configuration"]
    commands = [AntaCommand(command="show zerotouch")]

    @AntaTest.anta_test
    def test(self) -> None:
        command_output = self.instance_commands[0].output
        assert isinstance(command_output, dict)
        if command_output["mode"] == "disabled":
            self.result.is_success()
        else:
            self.result.is_failure("ZTP is NOT disabled")