Add TAP syntax/semantic validator
This commit is contained in:
22
unittest/test_tap.yaml
Normal file
22
unittest/test_tap.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
taps:
|
||||
tap0:
|
||||
description: "TAP with MAC, MTU and Bridge"
|
||||
mac: 00:01:02:03:04:05
|
||||
host:
|
||||
mtu: 9216
|
||||
name: vpp-tap0
|
||||
bridge: br0
|
||||
rx-ring-size: 256
|
||||
tx-ring-size: 256
|
||||
tap1:
|
||||
description: "TAP, no config other than mandatory host-name"
|
||||
host:
|
||||
name: vpp-tap1
|
||||
tap2:
|
||||
description: "TAP, which has an overlapping host-name"
|
||||
host:
|
||||
name: vpp-tap
|
||||
tap3:
|
||||
description: "TAP, which has an overlapping host-name"
|
||||
host:
|
||||
name: vpp-tap
|
19
unittest/yaml/correct-tap.yaml
Normal file
19
unittest/yaml/correct-tap.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
test:
|
||||
description: "A few correct examples of well formed TAP interfaces"
|
||||
errors:
|
||||
count: 0
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
description: "TAP with MAC, MTU and Bridge"
|
||||
host:
|
||||
name: vpp-tap0
|
||||
mac: 00:01:02:03:04:05
|
||||
mtu: 9216
|
||||
bridge: br0
|
||||
rx-ring-size: 256
|
||||
tx-ring-size: 256
|
||||
tap1:
|
||||
description: "TAP, no config other than mandatory host-name"
|
||||
host:
|
||||
name: vpp-tap1
|
19
unittest/yaml/error-tap1.yaml
Normal file
19
unittest/yaml/error-tap1.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
test:
|
||||
description: "Instance id must be between [0..1024]"
|
||||
errors:
|
||||
expected:
|
||||
- "tap .* has instance .* which is too large"
|
||||
count: 1
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
host:
|
||||
name: vpp-tap0
|
||||
tap1024:
|
||||
description: "Cool"
|
||||
host:
|
||||
name: vpp-tap1024
|
||||
tap1025:
|
||||
description: "Not cool"
|
||||
host:
|
||||
name: vpp-tap1025
|
14
unittest/yaml/error-tap2.yaml
Normal file
14
unittest/yaml/error-tap2.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
test:
|
||||
description: "RX and TX ring sizes must be power of two, at most 32K"
|
||||
errors:
|
||||
expected:
|
||||
- "tap .* rx-ring-size must be a power of two"
|
||||
- "tap .* tx-ring-size must be a power of two"
|
||||
count: 2
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
host:
|
||||
name: vpp-tap0
|
||||
rx-ring-size: 1023
|
||||
tx-ring-size: 32767
|
15
unittest/yaml/error-tap3.yaml
Normal file
15
unittest/yaml/error-tap3.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
test:
|
||||
description: "TAP host names must be unique"
|
||||
errors:
|
||||
expected:
|
||||
- "tap .* does not have a unique host name .*"
|
||||
count: 2
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
host:
|
||||
name: vpp-tap
|
||||
|
||||
tap1:
|
||||
host:
|
||||
name: vpp-tap
|
23
unittest/yaml/error-tap4.yaml
Normal file
23
unittest/yaml/error-tap4.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
test:
|
||||
description: "TAP host mac addresses cannot be multicast"
|
||||
errors:
|
||||
expected:
|
||||
- "tap .* host MAC address .* cannot be multicast"
|
||||
count: 1
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
description: "Cool, local MACs are fine"
|
||||
host:
|
||||
mac: 02:00:00:00:00:00
|
||||
name: vpp-tap0
|
||||
tap1:
|
||||
description: "Cool, global unicast MACs are fine"
|
||||
host:
|
||||
mac: 04:00:00:00:00:00
|
||||
name: vpp-tap1
|
||||
tap2:
|
||||
description: "Not cool, multicast MACs"
|
||||
host:
|
||||
mac: 01:00:00:00:00:00
|
||||
name: vpp-tap2
|
34
unittest/yaml/error-tap5.yaml
Normal file
34
unittest/yaml/error-tap5.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
test:
|
||||
description: "Creating bridge or namespace can only be asked if their name is specified"
|
||||
errors:
|
||||
expected:
|
||||
- "tap .* bridge-create can only be set if bridge is set"
|
||||
- "tap .* namespace-create can only be set if namespace is set"
|
||||
count: 2
|
||||
---
|
||||
taps:
|
||||
tap0:
|
||||
description: "Cool, create bridge and namespace"
|
||||
host:
|
||||
mac: 02:00:00:00:00:00
|
||||
name: vpp-tap0
|
||||
bridge: vpp-br0
|
||||
bridge-create: True
|
||||
namespace: vpp-test
|
||||
namespace-create: True
|
||||
tap1:
|
||||
description: "Cool, assuming the operator has created the bridge and namespace beforehand"
|
||||
host:
|
||||
name: vpp-tap1
|
||||
bridge: vpp-br1
|
||||
namespace: vpp-test
|
||||
tap2:
|
||||
description: "Not cool, asking to create a bridge without giving its name"
|
||||
host:
|
||||
name: vpp-tap2
|
||||
bridge-create: True
|
||||
tap3:
|
||||
description: "Not cool, asking to create a namespace without giving its name"
|
||||
host:
|
||||
name: vpp-tap3
|
||||
namespace-create: True
|
Reference in New Issue
Block a user