feature: add device-type to the schema

This attribute of the 'interface' schema allows the user to prompt what
type of PHY they are expecting this interface to be. It will serve an
immediate and a future purpose.

Immediate: presence of the 'dpdk' device-type in a list of interfaces
will help an upcoming vppapy.mockconfig() to generate a cache without
having to talk to the API. This is useful to generate a pre-compute a
complete vpp.exec based off of an empty VPP dataplane

Future: addition of different PHY types, notably RDMA and
VirtualEthernet types

TESTED:
- Added a unit test to ensure that only is_phy() eligable interfaces
  receive the device-type attribute.
- All unit and YAML tests pass.
This commit is contained in:
Pim van Pelt
2022-12-03 13:46:30 +00:00
parent 628dc62b15
commit 490c294014
18 changed files with 109 additions and 0 deletions

@ -447,6 +447,10 @@ def validate_interfaces(yaml):
)
result = False
if "device-type" in iface and not is_phy(yaml, ifname):
msgs.append(f"interface {ifname} is not a PHY, cannot set device-type")
result = False
iface_mtu = get_mtu(yaml, ifname)
iface_lcp = get_lcp(yaml, ifname)
iface_address = has_address(yaml, ifname)

@ -1,20 +1,24 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 1500
mac: 00:25:90:0c:05:00
state: down
description: Not Used
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 1500
mac: 00:25:90:0c:05:01
state: down
description: Not Used
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 1500
mac: b4:96:91:b3:b1:10
state: down
description: Not Used
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 1500
mac: b4:96:91:b3:b1:11
state: down

@ -6,13 +6,16 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
lcp: "ice0"
mtu: 9000
addresses: [ 192.0.2.17/30, 2001:db8:3::1/64 ]
@ -32,6 +35,7 @@ interfaces:
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 2000
description: "Bridged"

@ -6,16 +6,20 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
description: Not Used
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
description: Not Used
BondEthernet0:

@ -4,17 +4,21 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 1500
description: "bridged with tap"
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
description: Not Used
BondEthernet0:

@ -6,13 +6,16 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
lcp: "ice12-0-0"
mtu: 9000
addresses: [ 192.0.2.17/30, 2001:db8:3::1/64 ]
@ -32,6 +35,7 @@ interfaces:
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 2000
description: "Bridged"

@ -5,13 +5,16 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
lcp: "ice0"
mtu: 9000
addresses: [ 192.0.2.17/30, 2001:db8:3::1/64 ]
@ -31,6 +34,7 @@ interfaces:
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 2000
description: "Bridged"

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
state: up
sub-interfaces:
@ -7,16 +8,19 @@ interfaces:
mtu: 9000
l2xc: tap100
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 1500
mac: 00:25:90:0c:05:01
state: down
description: Not Used
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 1500
mac: b4:96:91:b3:b1:10
state: down
description: Not Used
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 1500
mac: b4:96:91:b3:b1:11
state: down

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
sub-interfaces:
100:
description: "Sub-int"
@ -20,6 +21,7 @@ interfaces:
exact-match: true
GigabitEthernet3/0/1:
device-type: "dpdk"
sub-interfaces:
100:
description: "Sub-int"
@ -34,6 +36,7 @@ interfaces:
inner-dot1q: 100
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
sub-interfaces:
100:
description: "Sub-int"
@ -48,6 +51,7 @@ interfaces:
inner-dot1q: 100
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
sub-interfaces:
100:
description: "Sub-int"

@ -6,14 +6,18 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: LAG
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: LAG
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 2500
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
description: Not Used
BondEthernet1:

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mac: 12:00:ba:03:00:00
mtu: 9216
sub-interfaces:
@ -7,8 +8,10 @@ interfaces:
mtu: 2000
l2xc: HundredGigabitEthernet13/0/1.100
GigabitEthernet3/0/1:
device-type: "dpdk"
description: Not Used
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -20,6 +23,7 @@ interfaces:
inner-dot1q: 200
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -9,9 +10,11 @@ interfaces:
mtu: 1500
l2xc: vxlan_tunnel1
GigabitEthernet3/0/1:
device-type: "dpdk"
lcp: "e3-0-1"
addresses: [ 10.0.0.1/24 ]
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -23,6 +26,7 @@ interfaces:
inner-dot1q: 200
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 9216
vxlan_tunnel0:
mtu: 2000

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -8,9 +9,11 @@ interfaces:
101:
mtu: 3000
GigabitEthernet3/0/1:
device-type: "dpdk"
lcp: "e3-0-1"
addresses: [ 10.0.0.1/24 ]
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -22,6 +25,7 @@ interfaces:
inner-dot1q: 200
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 9216
vxlan_tunnel0:
mtu: 2000

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mac: 02:ff:ba:03:00:00
mtu: 9216
sub-interfaces:
@ -9,8 +10,10 @@ interfaces:
101:
mtu: 3000
GigabitEthernet3/0/1:
device-type: "dpdk"
description: Not Used
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -22,6 +25,7 @@ interfaces:
inner-dot1q: 200
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 9216
vxlan_tunnel0:
mtu: 2000

@ -1,5 +1,6 @@
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -8,8 +9,10 @@ interfaces:
101:
mtu: 3000
GigabitEthernet3/0/1:
device-type: "dpdk"
description: Not Used
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:
@ -21,6 +24,7 @@ interfaces:
inner-dot1q: 200
exact-match: True
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
mtu: 9216
sub-interfaces:
100:

@ -5,17 +5,21 @@ bondethernets:
interfaces:
GigabitEthernet3/0/0:
device-type: "dpdk"
mtu: 9000
description: "LAG #1"
GigabitEthernet3/0/1:
device-type: "dpdk"
mtu: 9000
description: "LAG #2"
HundredGigabitEthernet13/0/0:
device-type: "dpdk"
mac: 02:ff:ba:12:00:00
lcp: "ice0"
HundredGigabitEthernet13/0/1:
device-type: "dpdk"
lcp: "ice1"
mtu: 9000
addresses: [ 192.0.2.17/30, 2001:db8:3::1/64 ]

@ -50,6 +50,7 @@ interface:
sub-interfaces: map(include('sub-interface'),key=int(min=1,max=4294967295),required=False)
l2xc: str(required=False)
state: enum('up', 'down', required=False)
device-type: enum('dpdk', required=False)
---
sub-interface:
description: str(exclude='\'"',len=64,required=False)

@ -0,0 +1,44 @@
test:
description: "Device types can be set on physical interface only"
errors:
expected:
- ".*interface BondEthernet0 is not a PHY, cannot set device-type"
- ".*interface vxlan_tunnel0 is not a PHY, cannot set device-type"
count: 2
---
bondethernets:
BondEthernet0:
mac: 00:01:02:03:04:05
description: "Infra: xsw0.lab.ipng.ch LACP"
interfaces: [ GigabitEthernet2/0/0, GigabitEthernet2/0/1 ]
interfaces:
GigabitEthernet1/0/0:
device-type: 'dpdk'
GigabitEthernet2/0/0:
description: "Infra: LAG to xsw0"
GigabitEthernet2/0/1:
description: "Infra: LAG to xsw1"
BondEthernet0:
device-type: 'dpdk' ## bond-ethernets cannot have device-type set
description: "Bond, James Bond!"
vxlan_tunnel0:
device-type: 'dpdk'
mtu: 1500
vxlan_tunnels:
vxlan_tunnel0:
local: 192.0.2.1
remote: 192.0.2.2
vni: 100
loopbacks:
loop0:
description: "Core: example.ipng.ch"
mtu: 9216
lcp: "loop0"
addresses: [ 192.0.2.1/32, 2001:db8:1::1/128 ]