Version 0.0.8 - support 'af-packet' for containerlab

This commit is contained in:
Pim van Pelt
2025-05-03 14:47:17 +02:00
parent 6879fa85dd
commit 641d0f0190
5 changed files with 27 additions and 16 deletions

View File

@ -1,4 +1,4 @@
VERSION=0.0.7 VERSION=0.0.8
VPPCFG:=vppcfg VPPCFG:=vppcfg
PYTHON?=python3 PYTHON?=python3
PIP?=pip PIP?=pip

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
vppcfg (0.0.8) unstable; urgency=low
Feature release:
* Support af-packet interfaces
-- Pim van Pelt <pim@ipng.nl> Sat, 03 May 2025 14:45:37 +0000
vppcfg (0.0.7) unstable; urgency=low vppcfg (0.0.7) unstable; urgency=low
Feature release: Feature release:

View File

@ -4,7 +4,7 @@ from setuptools import setup
setup( setup(
name="vppcfg", name="vppcfg",
version="0.0.7", version="0.0.8",
install_requires=[ install_requires=[
"requests", "requests",
'importlib-metadata; python_version >= "3.8"', 'importlib-metadata; python_version >= "3.8"',

View File

@ -57,7 +57,7 @@ interface:
l2xc: str(required=False) l2xc: str(required=False)
state: enum('up', 'down', required=False) state: enum('up', 'down', required=False)
mpls: bool(required=False) mpls: bool(required=False)
device-type: enum('dpdk', required=False) device-type: enum('dpdk', 'af-packet', required=False)
sflow: bool(required=False) sflow: bool(required=False)
--- ---
sub-interface: sub-interface:

View File

@ -123,6 +123,7 @@ class Dumper(VPPApi):
"bond", "bond",
"VXLAN", "VXLAN",
"dpdk", "dpdk",
"af-packet",
"virtio", "virtio",
"pg", "pg",
]: ]:
@ -155,7 +156,7 @@ class Dumper(VPPApi):
i["state"] = "down" i["state"] = "down"
if ( if (
iface.interface_dev_type == "dpdk" iface.interface_dev_type in ["dpdk", "af-packet"]
and iface.sub_number_of_tags == 0 and iface.sub_number_of_tags == 0
): ):
i["mac"] = str(iface.l2_address) i["mac"] = str(iface.l2_address)
@ -193,6 +194,10 @@ class Dumper(VPPApi):
config["interfaces"][sup_iface.interface_name]["sub-interfaces"][ config["interfaces"][sup_iface.interface_name]["sub-interfaces"][
iface.sub_id iface.sub_id
] = i ] = i
if iface.interface_dev_type in ["dpdk", "af-packet"]:
config["interfaces"][iface.interface_name][
"device-type"
] = iface.interface_dev_type
for idx, iface in self.cache["vxlan_tunnels"].items(): for idx, iface in self.cache["vxlan_tunnels"].items():
vpp_iface = self.cache["interfaces"][iface.sw_if_index] vpp_iface = self.cache["interfaces"][iface.sw_if_index]
@ -304,9 +309,9 @@ class Dumper(VPPApi):
acl_rule.srcport_or_icmptype_first acl_rule.srcport_or_icmptype_first
) )
else: else:
config_term["icmp-type"] = ( config_term[
f"{acl_rule.srcport_or_icmptype_first}-{maxval}" "icmp-type"
) ] = f"{acl_rule.srcport_or_icmptype_first}-{maxval}"
maxval = acl_rule.dstport_or_icmpcode_last maxval = acl_rule.dstport_or_icmpcode_last
if maxval > 255: if maxval > 255:
@ -319,9 +324,9 @@ class Dumper(VPPApi):
acl_rule.dstport_or_icmpcode_first acl_rule.dstport_or_icmpcode_first
) )
else: else:
config_term["icmp-code"] = ( config_term[
f"{acl_rule.dstport_or_icmpcode_first}-{maxval}" "icmp-code"
) ] = f"{acl_rule.dstport_or_icmpcode_first}-{maxval}"
elif acl_rule.proto in [6, 17]: elif acl_rule.proto in [6, 17]:
if acl_rule.proto == 6: if acl_rule.proto == 6:
config_term["protocol"] = "tcp" config_term["protocol"] = "tcp"
@ -335,9 +340,9 @@ class Dumper(VPPApi):
acl_rule.srcport_or_icmptype_first acl_rule.srcport_or_icmptype_first
) )
else: else:
config_term["source-port"] = ( config_term[
f"{acl_rule.srcport_or_icmptype_first}-{acl_rule.srcport_or_icmptype_last}" "source-port"
) ] = f"{acl_rule.srcport_or_icmptype_first}-{acl_rule.srcport_or_icmptype_last}"
if ( if (
acl_rule.dstport_or_icmpcode_first acl_rule.dstport_or_icmpcode_first
== acl_rule.dstport_or_icmpcode_last == acl_rule.dstport_or_icmpcode_last
@ -346,9 +351,9 @@ class Dumper(VPPApi):
acl_rule.dstport_or_icmpcode_first acl_rule.dstport_or_icmpcode_first
) )
else: else:
config_term["destination-port"] = ( config_term[
f"{acl_rule.dstport_or_icmpcode_first}-{acl_rule.dstport_or_icmpcode_last}" "destination-port"
) ] = f"{acl_rule.dstport_or_icmpcode_first}-{acl_rule.dstport_or_icmpcode_last}"
else: else:
config_term["protocol"] = int(acl_rule.proto) config_term["protocol"] = int(acl_rule.proto)