diff mbox

[ovs-dev,1/2] ovn-nbctl: Ability to update a route's output port.

Message ID 1467368619-4916-1-git-send-email-guru@ovn.org
State Accepted
Headers show

Commit Message

Gurucharan Shetty July 1, 2016, 10:23 a.m. UTC
The command 'lr-route-add' currently cannot update the output
port.

Signed-off-by: Gurucharan Shetty <guru@ovn.org>
---
 ovn/utilities/ovn-nbctl.c |  4 ++++
 tests/ovn-nbctl.at        | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Ben Pfaff July 1, 2016, 9:19 p.m. UTC | #1
On Fri, Jul 01, 2016 at 03:23:38AM -0700, Gurucharan Shetty wrote:
> The command 'lr-route-add' currently cannot update the output
> port.
> 
> Signed-off-by: Gurucharan Shetty <guru@ovn.org>

Our other "add" commands that take "--may-exist" insist that the "add"
command is *not* changing anything.  I don't know why lr-route-add is
different.

But this does add least make the implementation of lr-route-add
self-consistent, so:

Acked-by: Ben Pfaff <blp@ovn.org>
Gurucharan Shetty July 1, 2016, 10:47 p.m. UTC | #2
On 1 July 2016 at 14:19, Ben Pfaff <blp@ovn.org> wrote:

> On Fri, Jul 01, 2016 at 03:23:38AM -0700, Gurucharan Shetty wrote:
> > The command 'lr-route-add' currently cannot update the output
> > port.
> >
> > Signed-off-by: Gurucharan Shetty <guru@ovn.org>
>
> Our other "add" commands that take "--may-exist" insist that the "add"
> command is *not* changing anything.  I don't know why lr-route-add is
> different.
>
> But this does add least make the implementation of lr-route-add
> self-consistent, so:
>
I do not have a strong opinion one way or the other. Since it does seem to
fix a behavior, I will apply this in sometime.

>
> Acked-by: Ben Pfaff <blp@ovn.org>
>
diff mbox

Patch

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 345647a..abeba0b 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -1383,6 +1383,10 @@  nbctl_lr_route_add(struct ctl_context *ctx)
         nbrec_logical_router_static_route_verify_nexthop(route);
         nbrec_logical_router_static_route_set_ip_prefix(route, prefix);
         nbrec_logical_router_static_route_set_nexthop(route, next_hop);
+        if (ctx->argc == 5) {
+            nbrec_logical_router_static_route_set_output_port(route,
+                                                              ctx->argv[4]);
+        }
         free(rt_prefix);
         free(next_hop);
         free(prefix);
diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index d2d74b6..0c756ed 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -388,6 +388,14 @@  IPv4 Routes
                 0.0.0.0/0               192.168.0.1
 ])
 
+AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1])
+AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl
+IPv4 Routes
+              10.0.0.0/24                  11.0.0.1 lp1
+              10.0.1.0/24                  11.0.1.1 lp0
+                0.0.0.0/0               192.168.0.1
+])
+
 dnl Delete non-existent prefix
 AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.2.1/24], [1], [],
   [ovn-nbctl: no matching prefix: 10.0.2.0/24
@@ -398,7 +406,7 @@  AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.1.1/24])
 
 AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl
 IPv4 Routes
-              10.0.0.0/24                  11.0.0.1
+              10.0.0.0/24                  11.0.0.1 lp1
                 0.0.0.0/0               192.168.0.1
 ])