Skip to content

Commit

Permalink
ovn: Reduce duplicated process termination code in test scripts.
Browse files Browse the repository at this point in the history
This change set introduces new macros to simplify and consolidate
process termination handling for OVN test cases.

Signed-off-by: Lance Richardson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
hlrichardson authored and blp committed Jul 3, 2016
1 parent 7ecefc4 commit 7a8f15e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 271 deletions.
47 changes: 47 additions & 0 deletions tests/ofproto-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,53 @@ as() {
fi
}

# OVN_CLEANUP_VSWITCH(sim)
#
# Gracefully terminate vswitch daemons in the
# specified sandbox.
m4_define([OVN_CLEANUP_VSWITCH],[
as $1
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
])

# OVN_CLEANUP_SBOX(sbox)
#
# Gracefully terminate OVN daemons in the specified
# sandbox instance. The sandbox name "vtep" is treated
# as a special case, and is assumed to have ovn-controller-vtep
# and ovs-vtep daemons running instead of ovn-controller.
m4_define([OVN_CLEANUP_SBOX],[
as $1
if test "$1" = "vtep"; then
OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep])
OVS_APP_EXIT_AND_WAIT([ovs-vtep])
else
OVS_APP_EXIT_AND_WAIT([ovn-controller])
fi
OVN_CLEANUP_VSWITCH([$1])
])

# OVN_CLEANUP(sim [, sim ...])
#
# Gracefully terminate all OVN daemons, including those in the
# specified sandbox instances.
m4_define([OVN_CLEANUP],[
m4_foreach([sbox], [$@], [
OVN_CLEANUP_SBOX([sbox])
])
as ovn-sb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as ovn-nb
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as northd
OVS_APP_EXIT_AND_WAIT([ovn-northd])

OVN_CLEANUP_VSWITCH([main])
])

# ovn_init_db DATABASE
#
# Creates and initializes the given DATABASE (one of "ovn-sb" or "ovn-nb"),
Expand Down
11 changes: 2 additions & 9 deletions tests/ovn-controller.at
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,8 @@ AT_CHECK([ovn-sbctl \
check_patches

# Gracefully terminate daemons
as hv
OVS_APP_EXIT_AND_WAIT([ovn-controller])
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

as main
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])

OVN_CLEANUP_SBOX([hv])
OVN_CLEANUP_VSWITCH([main])
as ovn-sb
OVS_APP_EXIT_AND_WAIT_BY_TARGET([$ovs_base/ovn-sb/ovsdb-server-2.ctl], [$ovs_base/ovn-sb/ovsdb-server-2.pid])
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
Expand Down
Loading

0 comments on commit 7a8f15e

Please sign in to comment.