Skip to content

Commit

Permalink
tests: move trim_zeros() to ovn-macros
Browse files Browse the repository at this point in the history
trim_zeros was redefined multiple times in ovn.at, and was
undefined for one test.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
simonartxavier authored and dceara committed Oct 6, 2023
1 parent 4f7359e commit f8df558
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 49 deletions.
4 changes: 4 additions & 0 deletions tests/ovn-macros.at
Expand Up @@ -890,6 +890,10 @@ wake_up_ovsdb() {
AT_CHECK([kill -CONT $(cat $1/ovsdb-server.pid)])
}

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

OVS_END_SHELL_HELPERS

m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])])
Expand Down
49 changes: 0 additions & 49 deletions tests/ovn.at
Expand Up @@ -7289,10 +7289,6 @@ check ovn-nbctl --wait=hv sync
# Start with 0 because the first request will not have NXT_RESUME
n_resume=0

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# This shell function sends a DHCPv6 request packet
# test_dhcpv6 INPORT SRC_MAC SRC_LLA DHCPv6_MSG_TYPE OFFER_IP OUTPORT...
# The OUTPORTs (zero or more) list the VIFs on which the original DHCPv6
Expand Down Expand Up @@ -9013,10 +9009,6 @@ packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111
# Send IP packet destined to 8.8.8.8 from lsp1lp2
as hv1 ovs-appctl netdev-dummy/receive hv1-ls1lp2 $packet

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# ARP packet should be received with Target IP Address set to 192.168.1.254 and
# not 8.8.8.8

Expand Down Expand Up @@ -9072,9 +9064,6 @@ AT_CAPTURE_FILE([sbflows])

# Wait for packet to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 140])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros |sort | uniq > packets
AT_CHECK([sort packets], [0], [dnl
fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001
Expand Down Expand Up @@ -9271,9 +9260,6 @@ ovn-nbctl list logical_router_port lrp0
ovn-nbctl show
# Wait for packet to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 50])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | sort | uniq > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
echo $expected > expout
Expand All @@ -9294,9 +9280,6 @@ ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router" exclud

# Wait for packets to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 250])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
g0="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
Expand Down Expand Up @@ -10715,10 +10698,6 @@ OVN_POPULATE_ARP
wait_for_ports_up
check ovn-nbctl --wait=hv sync

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# Send ip packets between foo1 and bar1
# (East-west traffic should flow normally)
src_mac="f00000010203"
Expand Down Expand Up @@ -12200,9 +12179,6 @@ OVN_WAIT_PATCH_PORT_FLOWS(["ln_port"], ["hv2"])

# Wait for packets to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
echo $expected > expout
Expand Down Expand Up @@ -12236,9 +12212,6 @@ ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"

# Wait for packets to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 250])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | sort | uniq > packets
garp_1="fffffffffffff0000000000308060001080006040001f00000000003c0a80003000000000000c0a80003"
Expand Down Expand Up @@ -13865,9 +13838,6 @@ ovn-nbctl --wait=hv lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="rout

# Wait for packets to be received through hv2.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

only_broadcast_from_lrp1() {
grep "fffffffffffff00000000001"
Expand Down Expand Up @@ -13911,9 +13881,6 @@ ovn-nbctl --wait=hv \
as hv3 reset_pcap_file br-phys_n1 hv3/br-phys_n1
as hv1 reset_pcap_file snoopvif hv1/snoopvif

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# Wait for packets to be received.
OVS_WAIT_UNTIL(
Expand Down Expand Up @@ -13960,9 +13927,6 @@ logical_port=lrp0-rp | grep is_chassis | wc -l`])

# Wait for packets to be received.
OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100])
trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

garp="fffffffffffff00000000001810007de08060001080006040001f00000000001c0a80064000000000000c0a80064"
echo $garp > expout
Expand Down Expand Up @@ -14317,10 +14281,6 @@ wc -l], [0], [4
chassis_uuid=$(fetch_column Chassis _uuid name=hv1)
wait_row_count Port_Binding 1 logical_port=cr-ip6_public chassis=$chassis_uuid

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# Test the IPv6 Neighbor Solicitation (NS) - nd_ns action for unknown MAC
# addresses. ovn-controller should generate an IPv6 NS request for IPv6
# packets whose MAC is unknown (in the ARP_REQUEST router pipeline stage.
Expand Down Expand Up @@ -19786,11 +19746,6 @@ test_dhcp() {
as hv1 ovs-appctl netdev-dummy/receive hv${inport}-ext${inport} $request
}


trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

# This shell function sends a DHCPv6 request packet
# test_dhcpv6 INPORT SRC_MAC SRC_LLA DHCPv6_MSG_TYPE OFFER_IP OUTPORT...
# The OUTPORTs (zero or more) list the VIFs on which the original DHCPv6
Expand Down Expand Up @@ -31449,10 +31404,6 @@ send_icmp_packet() {
as hv$hv ovs-appctl netdev-dummy/receive hv$hv-vif$inport $packet
}

trim_zeros() {
sed 's/\(00\)\{1,\}$//'
}

AS_BOX([Wait for all ports to be up])
wait_for_ports_up

Expand Down

0 comments on commit f8df558

Please sign in to comment.