From 181a19483120155022c6e0e6d7e4f53a05eeda2e Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Tue, 10 Oct 2023 16:33:48 -0400 Subject: [PATCH] tests: Use fmt_pkt in 3 HVs, 1 LS, 3 lports/HV. This only uses fmt_pkt in test_arp(). test_packet() purposely sends packets with odd and/or malformed ethertypes, which makes it a poor fit for fmt_pkt(). We could use some sort of raw packet method of scapy, but that seems like a roundabout way of getting what we already have in the test. Execution time: 10.313s Execution time on "main" branch: 8.575s Signed-off-by: Mark Michelson Signed-off-by: 0-day Robot --- tests/ovn.at | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index 6057217083..e89e58514b 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2474,7 +2474,8 @@ test_packet() { # SPA and TPA are each 8 hex digits. test_arp() { local inport=$1 sha=$2 spa=$3 tpa=$4 reply_ha=$5 - local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa} + local request=$(fmt_pkt "Ether(dst='ff:ff:ff:ff:ff:ff', src='${sha}')/ \ + ARP(hwsrc='${sha}', hwdst='ff:ff:ff:ff:ff:ff', psrc='${spa}', pdst='${tpa}')") hv=`vif_to_hv $inport` as $hv ovs-appctl netdev-dummy/receive vif$inport $request @@ -2491,7 +2492,8 @@ test_arp() { done else # Expect to receive the reply, if any. - local reply=${sha}${reply_ha}08060001080006040002${reply_ha}${tpa}${sha}${spa} + local reply=$(fmt_pkt "Ether(dst='${sha}', src='${reply_ha}') / + ARP(op=2, hwsrc='${reply_ha}', hwdst='${sha}', psrc='${tpa}', pdst='${spa}')") echo $reply >> $inport.expected fi } @@ -2579,23 +2581,23 @@ for is in 1 2 3; do bacl2="$bacl2 $acl2" bacl3="$bacl3 $acl3" - sip=`ip_to_hex 192 168 0 $is$js` - tip=`ip_to_hex 192 168 0 $id$jd` - tip_unknown=`ip_to_hex 11 11 11 11` + sip="192.168.0.$is$js" + tip="192.168.0.$id$jd" + tip_unknown="11.11.11.11" reply_ha=; if test $d != $s; then if test $jd != 1; then - reply_ha=f000000000$d + reply_ha="f0:00:00:00:00:$d" fi fi - test_arp $s f000000000$s $sip $tip $reply_ha #9 - test_arp $s f000000000$s $sip $tip_unknown #10 + test_arp $s f0:00:00:00:00:$s $sip $tip $reply_ha #9 + test_arp $s f0:00:00:00:00:$s $sip $tip_unknown #10 if test $jd = 3; then # lsp[123]3 has an additional ip 192.169.0.[123]3. - tip=`ip_to_hex 192 169 0 $id$jd` - test_arp $s f000000000$s $sip $tip $reply_ha #9 + tip="192.169.0.$id$jd" + test_arp $s f0:00:00:00:00:$s $sip $tip $reply_ha #9 fi done done @@ -2625,13 +2627,13 @@ done # lp13 should be configured with only 192.168.0.13. check ovn-nbctl --wait=hv lsp-set-addresses lp13 "f0:00:00:00:00:13 192.168.0.13 invalid 192.169.0.13" -sip=`ip_to_hex 192 168 0 11` -tip=`ip_to_hex 192 168 0 13` -test_arp 11 f00000000011 $sip $tip f00000000013 +sip="192.168.0.11" +tip="192.168.0.13" +test_arp 11 f0:00:00:00:00:11 $sip $tip f0:00:00:00:00:13 -tip=`ip_to_hex 192 169 0 13` +tip="192.169.0.13" #arp request for 192.169.0.13 should be flooded -test_arp 11 f00000000011 $sip $tip +test_arp 11 f0:00:00:00:00:11 $sip $tip # dump information and flows with counters ovn-sbctl dump-flows -- list multicast_group > sbflows