Skip to content

Commit 01a528f

Browse files
committed
ovn-nbctl: Ability to update a route's output port.
The command 'lr-route-add' currently cannot update the output port. Signed-off-by: Gurucharan Shetty <guru@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
1 parent be15ec4 commit 01a528f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ovn/utilities/ovn-nbctl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,10 @@ nbctl_lr_route_add(struct ctl_context *ctx)
13831383
nbrec_logical_router_static_route_verify_nexthop(route);
13841384
nbrec_logical_router_static_route_set_ip_prefix(route, prefix);
13851385
nbrec_logical_router_static_route_set_nexthop(route, next_hop);
1386+
if (ctx->argc == 5) {
1387+
nbrec_logical_router_static_route_set_output_port(route,
1388+
ctx->argv[4]);
1389+
}
13861390
free(rt_prefix);
13871391
free(next_hop);
13881392
free(prefix);

tests/ovn-nbctl.at

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ IPv4 Routes
388388
0.0.0.0/0 192.168.0.1
389389
])
390390

391+
AT_CHECK([ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1])
392+
AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl
393+
IPv4 Routes
394+
10.0.0.0/24 11.0.0.1 lp1
395+
10.0.1.0/24 11.0.1.1 lp0
396+
0.0.0.0/0 192.168.0.1
397+
])
398+
391399
dnl Delete non-existent prefix
392400
AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.2.1/24], [1], [],
393401
[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])
398406

399407
AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl
400408
IPv4 Routes
401-
10.0.0.0/24 11.0.0.1
409+
10.0.0.0/24 11.0.0.1 lp1
402410
0.0.0.0/0 192.168.0.1
403411
])
404412

0 commit comments

Comments
 (0)