-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
When checking configurations, there are configuration lines that are not unique within the running-configuration.
Below is an example configuration for OSPF and all ip ospf commands are standard to all OSPF interfaces:
interface Ethernet4/1/1.2000
description "To switch port Eth 49/1.2000"
mtu 9214
encapsulation dot1q vlan 2000
ip address 161.3.5.1/30
ipv6 enable
ipv6 address 2001::161:3:5:1/126
ip ospf network point-to-point
ip ospf authentication message-digest
ip ospf area 0.0.0.0
!
If we check a configuration for ip ospf area 0.0.0.0, it's impossible to ensure interface Ethernet4/1/1.2000 has OSPF enabled.
In order to do this we need one of 2 options:
- Be able to match multiple lines of config.
In this scenrio my match would be:
anta.tests.configuration:
- VerifyRunningConfigLines:
regex_patterns:
- |
interface Ethernet4/1/1.2000
description "To switch port Eth 49/1.2000"
mtu 9214
encapsulation dot1q vlan 2000
ip address 161.3.5.1/30
ipv6 enable
ipv6 address 2001::161:3:5:1/126
ip ospf network point-to-point
ip ospf authentication message-digest
ip ospf area 0.0.0.0
The problem with scenario is we only want to validate a single line, but we need to input 10 lines.
- Provide what stanza the interesting line is in.
anta.tests.configuration:
- VerifyRunningConfigLines:
interesting_stanza: interface Ethernet4/1/1.2000
regex_patterns:
- ip ospf area 0.0.0.0