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)