diff options
author | Damijan Skvarc <damjan.skvarc@gmail.com> | 2019-12-23 10:38:57 +0100 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2020-01-07 12:13:38 -0800 |
commit | c3428f4399cc98885175bda89d3388859552241a (patch) | |
tree | 59188caf14442fe67debe5faee114746f22196d9 /tests | |
parent | a13a0209750c424556189796061c40d08c689467 (diff) | |
download | openvswitch-c3428f4399cc98885175bda89d3388859552241a.tar.gz |
tests: introduced tests for adding/deleting logical routers in VTEP database
New tests were introduced based on lcov report, which reveals apparent code
is not covered by ovs test suites.
Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vtep-ctl.at | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at index 3949f1623..980676584 100644 --- a/tests/vtep-ctl.at +++ b/tests/vtep-ctl.at @@ -129,6 +129,39 @@ m4_define([CHECK_LSWITCHES], AT_CHECK([RUN_VTEP_CTL([ls-exists nonexistent])], [2], [], [], [VTEP_CTL_CLEANUP])]) + +dnl CHECK_LROUTERS([LROUTER], ...) +dnl +dnl Verifies that "vtep-ctl list-lr" prints the specified list of +dnl logical routers, which must be in alphabetical order. +m4_define([CHECK_LROUTERS], + [dnl Check that the lrouters appear on list-lr, without --oneline. + AT_CHECK( + [RUN_VTEP_CTL([list-lr])], + [0], + [m4_foreach([lrinfo], [$@], [m4_car(lrinfo) +])], + [], + [VTEP_CTL_CLEANUP]) + + dnl Check that the lswitches appear on list-lr, with --oneline. + AT_CHECK( + [RUN_VTEP_CTL_ONELINE([list-lr])], + [0], + [m4_join([\n], m4_foreach([lrinfo], [$@], [m4_car(lrinfo),])) +], + [], + [VTEP_CTL_CLEANUP]) + + dnl Check that each lrouter exists according to lr-exists and that + dnl a prouter that should not exist does not. + m4_foreach([lrinfo], [$@], + [AT_CHECK([RUN_VTEP_CTL([lr-exists m4_car(lrinfo)])], [0], [], + [], [VTEP_CTL_CLEANUP])]) + AT_CHECK([RUN_VTEP_CTL([lr-exists nonexistent])], [2], [], [], + [VTEP_CTL_CLEANUP])]) + + dnl ---------------------------------------------------------------------- AT_BANNER([vtep-ctl unit tests -- physical switch tests]) @@ -351,6 +384,60 @@ AT_CHECK([RUN_VTEP_CTL( VTEP_CTL_CLEANUP AT_CLEANUP + +dnl ---------------------------------------------------------------------- +AT_BANNER([vtep-ctl unit tests -- logical router tests]) + +AT_SETUP([add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [0], [], [], [VTEP_CTL_CLEANUP]) +AT_CHECK([RUN_VTEP_CTL([add-lr a])], [1], [], + [vtep-ctl: cannot create logical router a because it already exists +], [VTEP_CTL_CLEANUP]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr b]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b])], [0], [], [], + [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a], [b]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, add-lr b, del-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL([add-lr a], [add-lr b], [del-lr a])], [0], [], [], + [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([b]) +VTEP_CTL_CLEANUP +AT_CLEANUP + +AT_SETUP([add-lr a, del-lr a, add-lr a]) +AT_KEYWORDS([vtep-ctl]) +VTEP_CTL_SETUP +AT_CHECK([RUN_VTEP_CTL_TOGETHER( + [add-lr a], + [del-lr a], + [add-lr a])], [0], [ + + +], [], [VTEP_CTL_CLEANUP]) +CHECK_LROUTERS([a]) +VTEP_CTL_CLEANUP +AT_CLEANUP + dnl ---------------------------------------------------------------------- AT_BANNER([vtep-ctl unit tests -- logical binding tests]) |