diff options
author | Nobuhiro MIKI <nmiki@yahoo-corp.jp> | 2023-03-06 11:49:16 +0900 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-03-07 18:23:01 +0100 |
commit | 915f084b9ff80f32e265c66c9b1aa51f9bbbd275 (patch) | |
tree | 9a05c3a4ffbd61fa6a78672d5a0d8e7f5349d6a8 /tests | |
parent | de6589799e7e810d5ff243b7b00fd2af5bf99ff2 (diff) | |
download | openvswitch-915f084b9ff80f32e265c66c9b1aa51f9bbbd275.tar.gz |
ovs-router: Cleanup parser for ovs/route/add command.
This patch cleans up the parser to accept pkt_mark and gw in any order.
pkt_mark and gw are normally expected to be specified exactly once.
However, as with other tools, if specified multiple times, the last
specification is used. Also, pkt_mark and gw have separate prefix
strings so they can be parsed in any order.
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ovs-router.at | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/ovs-router.at b/tests/ovs-router.at index 6dacc2954..a36990f1e 100644 --- a/tests/ovs-router.at +++ b/tests/ovs-router.at @@ -1,14 +1,33 @@ AT_BANNER([ovs-router]) -AT_SETUP([appctl - route/add with gateway]) +AT_SETUP([appctl - route/add with gateway and pkt_mark]) AT_KEYWORDS([ovs_router]) -OVS_VSWITCHD_START([add-port br0 p2 -- set Interface p2 type=gre \ - options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \ - -- add-port br0 p1 -- set interface p1 type=dummy]) +OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy]) AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 2.2.2.2/24], [0], [OK ]) +AT_CHECK([ovs-appctl ovs/route/add 2.2.2.3/32 br0 pkt_mark=1], [0], [OK +]) AT_CHECK([ovs-appctl ovs/route/add 1.1.1.0/24 br0 2.2.2.10], [0], [OK ]) +AT_CHECK([ovs-appctl ovs/route/add 1.1.2.0/24 br0 2.2.2.10 pkt_mark=2], [0], [OK +]) +AT_CHECK([ovs-appctl ovs/route/add 1.1.3.0/24 br0 pkt_mark=3], [2], [], [dnl +Error while inserting route. +ovs-appctl: ovs-vswitchd: server returned an error +]) +AT_CHECK([ovs-appctl ovs/route/add 1.1.foo.bar/24 br0 2.2.2.10], [2], [], [dnl +Invalid 'ip_addr/prefix_len' parameter +ovs-appctl: ovs-vswitchd: server returned an error +]) +AT_CHECK([ovs-appctl ovs/route/add 2.2.2.4/24 br0 pkt_mark=baz], [2], [], [dnl +Invalid pkt_mark or IP gateway +ovs-appctl: ovs-vswitchd: server returned an error +]) +AT_CHECK([ovs-appctl ovs/route/show | grep User | sort], [0], [dnl +User: 1.1.1.0/24 dev br0 GW 2.2.2.10 SRC 2.2.2.2 +User: 1.1.2.0/24 MARK 2 dev br0 GW 2.2.2.10 SRC 2.2.2.2 +User: 2.2.2.3/32 MARK 1 dev br0 SRC 2.2.2.2 +]) OVS_VSWITCHD_STOP AT_CLEANUP |