OSDN Git Service

selftests: openvswitch: support key masks
authorAdrian Moreno <amorenoz@redhat.com>
Tue, 1 Aug 2023 21:22:23 +0000 (17:22 -0400)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 3 Aug 2023 13:05:41 +0000 (15:05 +0200)
commit9f1179fbbd84d5269f57659152e24bd4b03fd095
tree7dd4b368ab4ff5c74440475d672cfd611792f24f
parent918423fda910380a19a1bcadd858e3e42fb501bb
selftests: openvswitch: support key masks

The default value for the mask actually depends on the value (e.g: if
the value is non-null, the default is full-mask), so change the convert
functions to accept the full, possibly masked string and let them figure
out how to parse the different values.

Also, implement size-aware int parsing.

With this patch we can now express flows such as the following:
"eth(src=0a:ca:fe:ca:fe:0a/ff:ff:00:00:ff:00)"
"eth(src=0a:ca:fe:ca:fe:0a)" -> mask = ff:ff:ff:ff:ff:ff
"ipv4(src=192.168.1.1)" -> mask = 255.255.255.255
"ipv4(src=192.168.1.1/24)"
"ipv4(src=192.168.1.1/255.255.255.0)"
"tcp(src=8080)" -> mask = 0xffff
"tcp(src=8080/0xf0f0)"

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/openvswitch/ovs-dpctl.py