Skip to content

Commit

Permalink
tests: Add command to purge revalidators of flows.
Browse files Browse the repository at this point in the history
This patch adds a new 'ovs-appctl revalidator/purge' command which
flushes all flows from all datapaths, and updates the revalidator
udpif_key cache at the same time.

Update the ofproto-dpif fragment tests which may fail when ukeys are
created from handler threads.

Signed-off-by: Joe Stringer <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
joestringer committed Nov 22, 2014
1 parent 53e1d6f commit 98bb428
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
20 changes: 20 additions & 0 deletions ofproto/ofproto-dpif-upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ static void upcall_unixctl_set_flow_limit(struct unixctl_conn *conn, int argc,
const char *argv[], void *aux);
static void upcall_unixctl_dump_wait(struct unixctl_conn *conn, int argc,
const char *argv[], void *aux);
static void upcall_unixctl_purge(struct unixctl_conn *conn, int argc,
const char *argv[], void *aux);

static struct udpif_key *ukey_create(const struct nlattr *key, size_t key_len,
long long int used);
Expand Down Expand Up @@ -273,6 +275,8 @@ udpif_create(struct dpif_backer *backer, struct dpif *dpif)
upcall_unixctl_set_flow_limit, NULL);
unixctl_command_register("revalidator/wait", "", 0, 0,
upcall_unixctl_dump_wait, NULL);
unixctl_command_register("revalidator/purge", "", 0, 0,
upcall_unixctl_purge, NULL);
ovsthread_once_done(&once);
}

Expand Down Expand Up @@ -1768,3 +1772,19 @@ upcall_unixctl_dump_wait(struct unixctl_conn *conn,
unixctl_command_reply_error(conn, "can't wait on multiple udpifs.");
}
}

static void
upcall_unixctl_purge(struct unixctl_conn *conn, int argc OVS_UNUSED,
const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
{
struct udpif *udpif;

LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
int n;

for (n = 0; n < udpif->n_revalidators; n++) {
revalidator_purge(&udpif->revalidators[n]);
}
}
unixctl_command_reply(conn, "");
}
12 changes: 8 additions & 4 deletions tests/ofproto-dpif.at
Original file line number Diff line number Diff line change
Expand Up @@ -3410,7 +3410,8 @@ recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, b

mode=drop

AT_CHECK([ovs-appctl dpctl/del-flows], [0])
ovs-appctl revalidator/wait
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([ovs-ofctl set-frags br0 $mode])
for type in no first later; do
eval flow=\$${type}_flow
Expand All @@ -3427,7 +3428,8 @@ recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0,

mode=nx-match

AT_CHECK([ovs-appctl dpctl/del-flows], [0])
ovs-appctl revalidator/wait
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([ovs-ofctl set-frags br0 $mode])
for type in no first later; do
eval flow=\$${type}_flow
Expand Down Expand Up @@ -3513,7 +3515,8 @@ recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419
recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
])

AT_CHECK([ovs-appctl dpctl/del-flows], [0])
ovs-appctl revalidator/wait
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([ovs-ofctl set-frags br0 $mode])
for frag in 4000 6000 6008 4010; do
printf "\n%s\n" "----$mode $frag truncated transport header -----"
Expand All @@ -3527,7 +3530,8 @@ recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0), p
recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
])

AT_CHECK([ovs-appctl dpctl/del-flows], [0])
ovs-appctl revalidator/wait
AT_CHECK([ovs-appctl revalidator/purge], [0])
AT_CHECK([ovs-ofctl set-frags br0 $mode])
for frag in 4000 6000 6001 4002; do
printf "\n%s\n" "----$mode $frag missing transport header-----"
Expand Down

0 comments on commit 98bb428

Please sign in to comment.