ANTA catalog for VLAN 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
76 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 |
|
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
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 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 |
|