Add l2xc support, including extensive tests to validate correct usage of the feature

This commit is contained in:
Pim van Pelt
2022-03-15 20:45:27 +00:00
parent b9a7bb697e
commit c5872880fe
9 changed files with 246 additions and 0 deletions

View File

@ -0,0 +1,41 @@
test:
description: "A few correct ways of setting L2 cross connects"
errors:
count: 0
---
bondethernets:
BondEthernet0:
interfaces: [ GigabitEthernet3/0/0, GigabitEthernet3/0/1 ]
interfaces:
GigabitEthernet1/0/0:
description: "Cross connected to Gi1/0/1"
l2xc: GigabitEthernet1/0/1
GigabitEthernet1/0/1:
description: "Cross connected to Gi1/0/0"
l2xc: GigabitEthernet1/0/0
GigabitEthernet2/0/0:
description: "Cross connected to Gi2/0/1.100"
l2xc: GigabitEthernet2/0/1.100
GigabitEthernet2/0/1:
description: "Main phy with a subint"
sub-interfaces:
100:
description: "Cross connected to Gi2/0/0"
l2xc: GigabitEthernet2/0/0
GigabitEthernet3/0/0:
mtu: 3000
GigabitEthernet3/0/1:
mtu: 3000
BondEthernet0:
description: "BE0 with two xconnected sub-ints"
sub-interfaces:
100:
description: "Cross connected to BE0.101"
l2xc: BondEthernet0.101
101:
description: "Cross connected to BE0.100"
l2xc: BondEthernet0.100

View File

@ -0,0 +1,22 @@
test:
description: "An interface that is in a bridgedomain, cannot also be an l2 cross connect"
errors:
expected:
- "interface .* l2xc target .* is in a bridgedomain"
count: 1
---
interfaces:
GigabitEthernet1/0/0:
mtu: 3000
GigabitEthernet1/0/1:
mtu: 3000
GigabitEthernet1/0/1:
mtu: 3000
l2xc: GigabitEthernet1/0/0
bridgedomains:
bd10:
description: "Bridge Domain 10 has Gi1/0/0 which is also a target of an L2XC"
mtu: 3000
interfaces: [ GigabitEthernet1/0/0, GigabitEthernet1/0/1 ]

18
unittest/error-l2xc1.yaml Normal file
View File

@ -0,0 +1,18 @@
test:
description: "L2 cross connect targets cannot occur more than once"
errors:
expected:
- "interface .* l2xc target .* is not unique"
count: 2
---
interfaces:
GigabitEthernet1/0/0:
description: "Cross connected to Gi1/0/1"
l2xc: GigabitEthernet1/0/1
GigabitEthernet1/0/1:
description: "Cross connected to Gi1/0/0"
l2xc: GigabitEthernet1/0/0
GigabitEthernet2/0/0:
description: "Cross connected to Gi1/0/0 as well"
l2xc: GigabitEthernet1/0/0

14
unittest/error-l2xc2.yaml Normal file
View File

@ -0,0 +1,14 @@
test:
description: "L2 cross connect targets must exist"
errors:
expected:
- "interface .* l2xc target .* does not exist"
count: 1
---
interfaces:
GigabitEthernet1/0/0:
description: "Cross connected to Gi1/0/1"
l2xc: GigabitEthernet1/0/1
GigabitEthernet1/0/1:
description: "Cross connected to Gi1/0/2, which does not exist"
l2xc: GigabitEthernet1/0/2

18
unittest/error-l2xc3.yaml Normal file
View File

@ -0,0 +1,18 @@
test:
description: "L2 cross connect targets cannot also occur in a bridgedomain"
errors:
expected:
- "interface .* l2xc target .* in a bridgedomain"
count: 1
---
interfaces:
GigabitEthernet1/0/0:
description: "Cross connected to Gi1/0/1"
l2xc: GigabitEthernet1/0/1
GigabitEthernet1/0/1:
description: "In a Bridge Domain, so cannot be a target of L2XC"
bridgedomains:
bd10:
description: "A Bridge with gi1/0/0 which also occurs as an L2XC target"
interfaces: [ GigabitEthernet1/0/1 ]

18
unittest/error-l2xc4.yaml Normal file
View File

@ -0,0 +1,18 @@
test:
description: "L2 cross connect targets cannot have an IP address or LCP"
errors:
expected:
- "interface .* l2xc so it cannot be an LCP"
- "interface .* l2xc so it cannot have an address"
count: 3
---
interfaces:
GigabitEthernet1/0/0:
description: "Cross connected to Gi1/0/1, but should not have an LCP"
l2xc: GigabitEthernet1/0/1
lcp: "e1-0-0"
GigabitEthernet1/0/1:
description: "Cross connected to Gi1/0/0, but should not have address and LCP"
l2xc: GigabitEthernet1/0/0
lcp: "e1-0-1"
addresses: [ 192.0.2.1/30 ]

18
unittest/error-l2xc5.yaml Normal file
View File

@ -0,0 +1,18 @@
test:
description: "L2 cross connect from a phy cannot also have sub-interfaces"
errors:
expected:
- "interface .* l2xc so it cannot have sub-interfaces"
count: 1
---
interfaces:
GigabitEthernet1/0/0:
l2xc: GigabitEthernet1/0/1.100
sub-interfaces:
100:
description: "If the parent is cross connected, it should not have sub-interfaces"
GigabitEthernet1/0/1:
sub-interfaces:
100:
l2xc: GigabitEthernet1/0/0