Message ID | 20231010203400.1045353-5-mmichels@redhat.com |
---|---|
State | Changes Requested |
Headers | show |
Series | tests: Convert some tests to use fmt_pkt. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/github-robot-_ovn-kubernetes | fail | github build: failed |
On Tue, Oct 10, 2023 at 10:34 PM Mark Michelson <mmichels@redhat.com> wrote: > > ...passthru=true, ND/NA responder disabled. > > Note that in order to be able to get the solicited node multicast > address, we need access to the socket library. This commit imports the > socket library from python. To reduce the amount of text in OVN test > cases, we import *. > > Execution time: 2.290s > Execution time on "main" branch: 1.157s > > Signed-off-by: Mark Michelson <mmichels@redhat.com> > --- Hi Mark, there is one problem that causes CI failures, see below. > tests/ovn.at | 17 ++++++++++------- > tests/scapy-server.py | 1 + > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/tests/ovn.at b/tests/ovn.at > index df2b0c774..828fae487 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -3763,22 +3763,25 @@ AT_CHECK([grep -w "ls_in_arp_rsp" lsflows | sed 's/table=../table=??/' | sort], > > test_nd_na() { > local inport=$1 outport=$2 sha=$3 spa=$4 tpa=$5 reply_ha=$6 > - tag=8100fefe > - icmp_type=87 > - local request=ffffffffffff${sha}${tag}86dd6000000000183aff${spa}ff0200000000000000000001ff${tpa: -6}${icmp_type}007ea100000000${tpa} > + local request=$(fmt_pkt "Ether(dst='ff:ff:ff:ff:ff:ff', src='${sha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${spa}', dst=inet_ntop(AF_INET6, in6_getnsma(inet_pton(AF_INET6, '${tpa}'))))/ \ > + ICMPv6ND_NS(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$inport $request > echo $request >> $outport.expected > echo $request > > - icmp_type=88 > - local reply=${sha}${reply_ha}${tag}86dd6000000000183aff${tpa}${spa}${icmp_type}003da540000000${tpa} > + local reply=$(fmt_pkt "Ether(dst='${sha}', src='${reply_ha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${tpa}', dst='${spa}')/ \ > + ICMPv6ND_NA(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$outport $reply > echo $reply >> $inport.expected > echo $reply > } > > -test_nd_na 1 2 f00000000001 fe000000000000000000000000000001 fe000000000000000000000000000002 f00000000002 > -test_nd_na 2 1 f00000000002 fe000000000000000000000000000002 fe000000000000000000000000000001 f00000000001 > +test_nd_na 1 2 f0:00:00:00:00:01 fe00::1 fe00::2 f0:00:00:00:00:02 > +test_nd_na 2 1 f0:00:00:00:00:02 fe00::2 fe00::1 f0:00:00:00:00:01 > > for i in 1 2; do > OVN_CHECK_PACKETS([vif$i-tx.pcap], [$i.expected]) > diff --git a/tests/scapy-server.py b/tests/scapy-server.py > index a7255c84d..ab5558535 100755 > --- a/tests/scapy-server.py > +++ b/tests/scapy-server.py > @@ -7,6 +7,7 @@ import ovs.unixctl > import ovs.unixctl.server > > import binascii > +from socket import * #noqa: F401,F403 Pyhton needs two spaces before #, otherwise it causes the following during flake8 check: tests/scapy-server.py:10:1: F403 'from socket import *' used; unable to detect undefined names tests/scapy-server.py:10:1: F401 'socket.*' imported but unused tests/scapy-server.py:10:21: E261 at least two spaces before inline comment tests/scapy-server.py:10:22: E262 inline comment should start with '# ' > from scapy.all import * # noqa: F401,F403 > from scapy.all import raw > > -- > 2.40.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > Thanks, Ales
On Tue, Oct 10, 2023 at 4:34 PM Mark Michelson <mmichels@redhat.com> wrote: > ...passthru=true, ND/NA responder disabled. > > Note that in order to be able to get the solicited node multicast > address, we need access to the socket library. This commit imports the > Would scapy.utils6.in6_getLinkScopedMcastAddr serve your needs here? > socket library from python. To reduce the amount of text in OVN test > cases, we import *. > > Execution time: 2.290s > Execution time on "main" branch: 1.157s > > Signed-off-by: Mark Michelson <mmichels@redhat.com> > --- > tests/ovn.at | 17 ++++++++++------- > tests/scapy-server.py | 1 + > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/tests/ovn.at b/tests/ovn.at > index df2b0c774..828fae487 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -3763,22 +3763,25 @@ AT_CHECK([grep -w "ls_in_arp_rsp" lsflows | sed > 's/table=../table=??/' | sort], > > test_nd_na() { > local inport=$1 outport=$2 sha=$3 spa=$4 tpa=$5 reply_ha=$6 > - tag=8100fefe > - icmp_type=87 > - local > request=ffffffffffff${sha}${tag}86dd6000000000183aff${spa}ff0200000000000000000001ff${tpa: > -6}${icmp_type}007ea100000000${tpa} > + local request=$(fmt_pkt "Ether(dst='ff:ff:ff:ff:ff:ff', > src='${sha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${spa}', dst=inet_ntop(AF_INET6, > in6_getnsma(inet_pton(AF_INET6, '${tpa}'))))/ \ > + ICMPv6ND_NS(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$inport $request > echo $request >> $outport.expected > echo $request > > - icmp_type=88 > - local > reply=${sha}${reply_ha}${tag}86dd6000000000183aff${tpa}${spa}${icmp_type}003da540000000${tpa} > + local reply=$(fmt_pkt "Ether(dst='${sha}', src='${reply_ha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${tpa}', dst='${spa}')/ \ > + ICMPv6ND_NA(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$outport $reply > echo $reply >> $inport.expected > echo $reply > } > > -test_nd_na 1 2 f00000000001 fe000000000000000000000000000001 > fe000000000000000000000000000002 f00000000002 > -test_nd_na 2 1 f00000000002 fe000000000000000000000000000002 > fe000000000000000000000000000001 f00000000001 > +test_nd_na 1 2 f0:00:00:00:00:01 fe00::1 fe00::2 f0:00:00:00:00:02 > +test_nd_na 2 1 f0:00:00:00:00:02 fe00::2 fe00::1 f0:00:00:00:00:01 > > for i in 1 2; do > OVN_CHECK_PACKETS([vif$i-tx.pcap], [$i.expected]) > diff --git a/tests/scapy-server.py b/tests/scapy-server.py > index a7255c84d..ab5558535 100755 > --- a/tests/scapy-server.py > +++ b/tests/scapy-server.py > @@ -7,6 +7,7 @@ import ovs.unixctl > import ovs.unixctl.server > > import binascii > +from socket import * #noqa: F401,F403 > from scapy.all import * # noqa: F401,F403 > from scapy.all import raw > > -- > 2.40.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > >
On 10/12/23 17:06, Ihar Hrachyshka wrote: > On Tue, Oct 10, 2023 at 4:34 PM Mark Michelson <mmichels@redhat.com > <mailto:mmichels@redhat.com>> wrote: > > ...passthru=true, ND/NA responder disabled. > > Note that in order to be able to get the solicited node multicast > address, we need access to the socket library. This commit imports the > > > Would scapy.utils6.in6_getLinkScopedMcastAddr serve your needs here? I don't think it does. Looking at RFC 4489 (the RFC from which in6_getLinkScopedMcastAddr() is derived) and comparing that to RFC 4861 (IPv6 neighbor discovery), the ways the multicast addresses are derived is different. RFC 4861 refers to the solicited node multicast address defined in RFC 4291 and makes no mention of using RFC 4489-derived addresses. If we used RFC 4489 addresses, they would begin with "ff32" instead of "ff02", which I think would cause problems with OVN (and possibly other vendors). > > socket library from python. To reduce the amount of text in OVN test > cases, we import *. > > Execution time: 2.290s > Execution time on "main" branch: 1.157s > > Signed-off-by: Mark Michelson <mmichels@redhat.com > <mailto:mmichels@redhat.com>> > --- > tests/ovn.at <http://ovn.at> | 17 ++++++++++------- > tests/scapy-server.py | 1 + > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/tests/ovn.at <http://ovn.at> b/tests/ovn.at <http://ovn.at> > index df2b0c774..828fae487 100644 > --- a/tests/ovn.at <http://ovn.at> > +++ b/tests/ovn.at <http://ovn.at> > @@ -3763,22 +3763,25 @@ AT_CHECK([grep -w "ls_in_arp_rsp" lsflows | > sed 's/table=../table=??/' | sort], > > test_nd_na() { > local inport=$1 outport=$2 sha=$3 spa=$4 tpa=$5 reply_ha=$6 > - tag=8100fefe > - icmp_type=87 > - local > request=ffffffffffff${sha}${tag}86dd6000000000183aff${spa}ff0200000000000000000001ff${tpa: -6}${icmp_type}007ea100000000${tpa} > + local request=$(fmt_pkt "Ether(dst='ff:ff:ff:ff:ff:ff', > src='${sha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${spa}', > dst=inet_ntop(AF_INET6, in6_getnsma(inet_pton(AF_INET6, '${tpa}'))))/ \ > + ICMPv6ND_NS(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$inport $request > echo $request >> $outport.expected > echo $request > > - icmp_type=88 > - local > reply=${sha}${reply_ha}${tag}86dd6000000000183aff${tpa}${spa}${icmp_type}003da540000000${tpa} > + local reply=$(fmt_pkt "Ether(dst='${sha}', src='${reply_ha}')/ \ > + Dot1Q(vlan=0xefe)/ \ > + IPv6(src='${tpa}', dst='${spa}')/ \ > + ICMPv6ND_NA(tgt='${tpa}')") > ovs-appctl netdev-dummy/receive vif$outport $reply > echo $reply >> $inport.expected > echo $reply > } > > -test_nd_na 1 2 f00000000001 fe000000000000000000000000000001 > fe000000000000000000000000000002 f00000000002 > -test_nd_na 2 1 f00000000002 fe000000000000000000000000000002 > fe000000000000000000000000000001 f00000000001 > +test_nd_na 1 2 f0:00:00:00:00:01 fe00::1 fe00::2 f0:00:00:00:00:02 > +test_nd_na 2 1 f0:00:00:00:00:02 fe00::2 fe00::1 f0:00:00:00:00:01 > > for i in 1 2; do > OVN_CHECK_PACKETS([vif$i-tx.pcap], [$i.expected]) > diff --git a/tests/scapy-server.py b/tests/scapy-server.py > index a7255c84d..ab5558535 100755 > --- a/tests/scapy-server.py > +++ b/tests/scapy-server.py > @@ -7,6 +7,7 @@ import ovs.unixctl > import ovs.unixctl.server > > import binascii > +from socket import * #noqa: F401,F403 > from scapy.all import * # noqa: F401,F403 > from scapy.all import raw > > -- > 2.40.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org <mailto:dev@openvswitch.org> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > <https://mail.openvswitch.org/mailman/listinfo/ovs-dev> >
diff --git a/tests/ovn.at b/tests/ovn.at index df2b0c774..828fae487 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -3763,22 +3763,25 @@ AT_CHECK([grep -w "ls_in_arp_rsp" lsflows | sed 's/table=../table=??/' | sort], test_nd_na() { local inport=$1 outport=$2 sha=$3 spa=$4 tpa=$5 reply_ha=$6 - tag=8100fefe - icmp_type=87 - local request=ffffffffffff${sha}${tag}86dd6000000000183aff${spa}ff0200000000000000000001ff${tpa: -6}${icmp_type}007ea100000000${tpa} + local request=$(fmt_pkt "Ether(dst='ff:ff:ff:ff:ff:ff', src='${sha}')/ \ + Dot1Q(vlan=0xefe)/ \ + IPv6(src='${spa}', dst=inet_ntop(AF_INET6, in6_getnsma(inet_pton(AF_INET6, '${tpa}'))))/ \ + ICMPv6ND_NS(tgt='${tpa}')") ovs-appctl netdev-dummy/receive vif$inport $request echo $request >> $outport.expected echo $request - icmp_type=88 - local reply=${sha}${reply_ha}${tag}86dd6000000000183aff${tpa}${spa}${icmp_type}003da540000000${tpa} + local reply=$(fmt_pkt "Ether(dst='${sha}', src='${reply_ha}')/ \ + Dot1Q(vlan=0xefe)/ \ + IPv6(src='${tpa}', dst='${spa}')/ \ + ICMPv6ND_NA(tgt='${tpa}')") ovs-appctl netdev-dummy/receive vif$outport $reply echo $reply >> $inport.expected echo $reply } -test_nd_na 1 2 f00000000001 fe000000000000000000000000000001 fe000000000000000000000000000002 f00000000002 -test_nd_na 2 1 f00000000002 fe000000000000000000000000000002 fe000000000000000000000000000001 f00000000001 +test_nd_na 1 2 f0:00:00:00:00:01 fe00::1 fe00::2 f0:00:00:00:00:02 +test_nd_na 2 1 f0:00:00:00:00:02 fe00::2 fe00::1 f0:00:00:00:00:01 for i in 1 2; do OVN_CHECK_PACKETS([vif$i-tx.pcap], [$i.expected]) diff --git a/tests/scapy-server.py b/tests/scapy-server.py index a7255c84d..ab5558535 100755 --- a/tests/scapy-server.py +++ b/tests/scapy-server.py @@ -7,6 +7,7 @@ import ovs.unixctl import ovs.unixctl.server import binascii +from socket import * #noqa: F401,F403 from scapy.all import * # noqa: F401,F403 from scapy.all import raw
...passthru=true, ND/NA responder disabled. Note that in order to be able to get the solicited node multicast address, we need access to the socket library. This commit imports the socket library from python. To reduce the amount of text in OVN test cases, we import *. Execution time: 2.290s Execution time on "main" branch: 1.157s Signed-off-by: Mark Michelson <mmichels@redhat.com> --- tests/ovn.at | 17 ++++++++++------- tests/scapy-server.py | 1 + 2 files changed, 11 insertions(+), 7 deletions(-)