|
|
ebb439 |
From a1cbb077f5907a3ad898e43478614d18ad7be294 Mon Sep 17 00:00:00 2001
|
|
|
ebb439 |
From: Numan Siddique <numans@ovn.org>
|
|
|
ebb439 |
Date: Thu, 12 Nov 2020 17:28:17 +0530
|
|
|
ebb439 |
Subject: [PATCH 10/10] sbctl: Add Load Balancer support for vflows option.
|
|
|
ebb439 |
|
|
|
ebb439 |
Acked-by: Dumitru Ceara <dceara@redhat.com>
|
|
|
ebb439 |
Acked-by: Mark Michelson <mmichels@redhat.com>
|
|
|
ebb439 |
Signed-off-by: Numan Siddique <numans@ovn.org>
|
|
|
ebb439 |
---
|
|
|
ebb439 |
utilities/ovn-sbctl.c | 56 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
ebb439 |
1 file changed, 56 insertions(+)
|
|
|
ebb439 |
|
|
|
ebb439 |
diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c
|
|
|
ebb439 |
index 30236c9cc..a524175c4 100644
|
|
|
ebb439 |
--- a/utilities/ovn-sbctl.c
|
|
|
ebb439 |
+++ b/utilities/ovn-sbctl.c
|
|
|
ebb439 |
@@ -542,6 +542,11 @@ pre_get_info(struct ctl_context *ctx)
|
|
|
ebb439 |
ovsdb_idl_add_column(ctx->idl, &sbrec_mac_binding_col_logical_port);
|
|
|
ebb439 |
ovsdb_idl_add_column(ctx->idl, &sbrec_mac_binding_col_ip);
|
|
|
ebb439 |
ovsdb_idl_add_column(ctx->idl, &sbrec_mac_binding_col_mac);
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ ovsdb_idl_add_column(ctx->idl, &sbrec_load_balancer_col_datapaths);
|
|
|
ebb439 |
+ ovsdb_idl_add_column(ctx->idl, &sbrec_load_balancer_col_vips);
|
|
|
ebb439 |
+ ovsdb_idl_add_column(ctx->idl, &sbrec_load_balancer_col_name);
|
|
|
ebb439 |
+ ovsdb_idl_add_column(ctx->idl, &sbrec_load_balancer_col_protocol);
|
|
|
ebb439 |
}
|
|
|
ebb439 |
|
|
|
ebb439 |
static struct cmd_show_table cmd_show_tables[] = {
|
|
|
ebb439 |
@@ -1010,6 +1015,56 @@ cmd_lflow_list_chassis(struct ctl_context *ctx, struct vconn *vconn,
|
|
|
ebb439 |
}
|
|
|
ebb439 |
}
|
|
|
ebb439 |
|
|
|
ebb439 |
+static void
|
|
|
ebb439 |
+cmd_lflow_list_load_balancers(struct ctl_context *ctx, struct vconn *vconn,
|
|
|
ebb439 |
+ const struct sbrec_datapath_binding *datapath,
|
|
|
ebb439 |
+ bool stats, bool print_uuid)
|
|
|
ebb439 |
+{
|
|
|
ebb439 |
+ const struct sbrec_load_balancer *lb;
|
|
|
ebb439 |
+ const struct sbrec_load_balancer *lb_prev = NULL;
|
|
|
ebb439 |
+ SBREC_LOAD_BALANCER_FOR_EACH (lb, ctx->idl) {
|
|
|
ebb439 |
+ bool dp_found = false;
|
|
|
ebb439 |
+ if (datapath) {
|
|
|
ebb439 |
+ size_t i;
|
|
|
ebb439 |
+ for (i = 0; i < lb->n_datapaths; i++) {
|
|
|
ebb439 |
+ if (datapath == lb->datapaths[i]) {
|
|
|
ebb439 |
+ dp_found = true;
|
|
|
ebb439 |
+ break;
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+ if (!dp_found) {
|
|
|
ebb439 |
+ continue;
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ if (!lb_prev) {
|
|
|
ebb439 |
+ printf("\nLoad Balancers:\n");
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ printf(" ");
|
|
|
ebb439 |
+ print_uuid_part(&lb->header_.uuid, print_uuid);
|
|
|
ebb439 |
+ printf("name=\"%s\", protocol=\"%s\", ", lb->name, lb->protocol);
|
|
|
ebb439 |
+ if (!dp_found) {
|
|
|
ebb439 |
+ for (size_t i = 0; i < lb->n_datapaths; i++) {
|
|
|
ebb439 |
+ print_vflow_datapath_name(lb->datapaths[i], true);
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ printf("\n vips:\n");
|
|
|
ebb439 |
+ struct smap_node *node;
|
|
|
ebb439 |
+ SMAP_FOR_EACH (node, &lb->vips) {
|
|
|
ebb439 |
+ printf(" %s = %s\n", node->key, node->value);
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+ printf("\n");
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ if (vconn) {
|
|
|
ebb439 |
+ sbctl_dump_openflow(vconn, &lb->header_.uuid, stats);
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+
|
|
|
ebb439 |
+ lb_prev = lb;
|
|
|
ebb439 |
+ }
|
|
|
ebb439 |
+}
|
|
|
ebb439 |
+
|
|
|
ebb439 |
static void
|
|
|
ebb439 |
cmd_lflow_list(struct ctl_context *ctx)
|
|
|
ebb439 |
{
|
|
|
ebb439 |
@@ -1119,6 +1174,7 @@ cmd_lflow_list(struct ctl_context *ctx)
|
|
|
ebb439 |
cmd_lflow_list_mac_bindings(ctx, vconn, datapath, stats, print_uuid);
|
|
|
ebb439 |
cmd_lflow_list_mc_groups(ctx, vconn, datapath, stats, print_uuid);
|
|
|
ebb439 |
cmd_lflow_list_chassis(ctx, vconn, stats, print_uuid);
|
|
|
ebb439 |
+ cmd_lflow_list_load_balancers(ctx, vconn, datapath, stats, print_uuid);
|
|
|
ebb439 |
}
|
|
|
ebb439 |
|
|
|
ebb439 |
vconn_close(vconn);
|
|
|
ebb439 |
--
|
|
|
ebb439 |
2.28.0
|
|
|
ebb439 |
|