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
PYTHON?=python3
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
Feature release:

View File

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

View File

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

View File

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