Skip to content

Commit

Permalink
ovn-nbctl: Print router port networks in "show".
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Pettit <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
justinpettit committed Jul 13, 2016
1 parent 4685e52 commit 34a88a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ovn/utilities/ovn-nbctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,17 @@ print_lr(const struct nbrec_logical_router *lr, struct ds *s)
ds_put_format(s, " port %s\n", lrp->name);
if (lrp->mac) {
ds_put_cstr(s, " mac: ");
ds_put_format(s, "\"%s\"", lrp->mac);
ds_put_format(s, "\"%s\"\n", lrp->mac);
}
if (lrp->n_networks) {
ds_put_cstr(s, " networks: [");
for (size_t j = 0; j < lrp->n_networks; j++) {
ds_put_format(s, "%s\"%s\"",
j == 0 ? "" : ", ",
lrp->networks[j]);
}
ds_put_cstr(s, "]\n");
}
ds_put_format(s, "\n");
}
}

Expand Down
8 changes: 8 additions & 0 deletions tests/ovn-nbctl.at
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ OVN_NBCTL_TEST_START

AT_CHECK([ovn-nbctl lr-add lr0])
AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24])

AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
router <0> (lr0)
port lrp0
mac: "00:00:00:01:02:03"
networks: [["192.168.1.1/24"]]
])

AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24], [1], [],
[ovn-nbctl: lrp0: a port with this name already exists
])
Expand Down

0 comments on commit 34a88a4

Please sign in to comment.