Skip to content

Commit

Permalink
tests: Implement send_garp using scapy.
Browse files Browse the repository at this point in the history
send_garp was implemented multiple time in ovn.at. Move a unique
implementation to ovn-macros.

Some tests were using ARP requests (opcode=1), and others use ARP
reply (opcode=2).
This patch does not change that behavior.

Signed-off-by: Xavier Simonart <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
simonartxavier authored and ovsrobot committed Dec 10, 2024
1 parent a099f58 commit bb6471b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 122 deletions.
16 changes: 16 additions & 0 deletions tests/ovn-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,22 @@ store_ip6_multicast_pkt() {
echo ${packet} >> ${outfile}
}

hex_to_mac() {
mac_hex=$1
echo $mac_hex | sed 's/../&:/g;s/:$//'
}

send_garp() {
local hv=$1 inport=$2 op=$3 eth_src=$4 eth_dst=$5 spa=$6 tpa=$7

local packet=$(fmt_pkt "Ether(dst='${eth_dst}', src='${eth_src}')/ \
ARP(op=$op, hwsrc='${eth_src}', hwdst='${eth_src}', \
psrc='${spa}', pdst='${tpa}')")
echo "Sending GARP($op) $eth_src $eth_dst $spa $tpa packet=$packet on $hv"
as $hv
ovs-appctl netdev-dummy/receive $inport $packet
}

# Wrapper on top of ovn-trace, stripping some things and storing the trace
# output to a file called 'trace'. For now it strips the rows starting
# with a '#'. This should correspond to the flow key and might be displayed
Expand Down
Loading

0 comments on commit bb6471b

Please sign in to comment.