ANTA catalog for VLAN tests
Tests¶
Module related to VLAN tests.
VerifyDynamicVlanSource ¶
Verifies dynamic VLAN allocation for specified VLAN sources.
This test performs the following checks for each specified VLAN source:
- Validates source exists in dynamic VLAN table.
- Verifies at least one VLAN is allocated to the source.
- When strict mode is enabled (
strict: true
), ensures no other sources have VLANs allocated.
Expected Results
- Success: The test will pass if all of the following conditions are met:
- Each specified source exists in dynamic VLAN table.
- Each specified source has at least one VLAN allocated.
- In strict mode: No other sources have VLANs allocated.
- Failure: The test will fail if any of the following conditions is met:
- Specified source not found in configuration.
- Source exists but has no VLANs allocated.
- In strict mode: Non-specified sources have VLANs allocated.
Examples
anta.tests.vlan:
- VerifyDynamicVlanSource:
sources:
- evpn
- mlagsync
strict: False
Inputs¶
Name | Type | Description | Default |
---|---|---|---|
sources |
list[DynamicVlanSource]
|
The dynamic VLAN source list.
|
- |
strict |
bool
|
If True, only specified sources are allowed to have VLANs allocated. Default is False.
|
False
|
Source code in anta/tests/vlan.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
VerifyVlanInternalPolicy ¶
Verifies if the VLAN internal allocation policy is ascending or descending and if the VLANs are within the specified range.
Expected Results
- Success: The test will pass if the VLAN internal allocation policy is either ascending or descending and the VLANs are within the specified range.
- Failure: The test will fail if the VLAN internal allocation policy is neither ascending nor descending or the VLANs are outside the specified range.
Examples
anta.tests.vlan:
- VerifyVlanInternalPolicy:
policy: ascending
start_vlan_id: 1006
end_vlan_id: 4094
Inputs¶
Source code in anta/tests/vlan.py
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
VerifyVlanStatus ¶
Verifies the administrative status of specified VLANs.
Expected Results
- Success: The test will pass if all specified VLANs exist in the configuration and their administrative status is correct.
- Failure: The test will fail if any of the specified VLANs is not found in the configuration or if its administrative status is incorrect.
Examples
anta.tests.vlan:
- VerifyVlanStatus:
vlans:
- vlan_id: 10
status: suspended
- vlan_id: 4094
status: active
Source code in anta/tests/vlan.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
Input models¶
Module containing input models for VLAN tests.
Vlan ¶
Model for a VLAN.
Source code in anta/input_models/vlan.py
15 16 17 18 19 20 21 22 23 24 25 26 |
|