summaryrefslogtreecommitdiff
path: root/lib/ofp-print.c
diff options
context:
space:
mode:
authorSaloni Jain <saloni.jain@tcs.com>2015-11-24 17:49:42 +0530
committerBen Pfaff <blp@ovn.org>2015-11-29 18:00:03 -0800
commitde7d3c0761a34232613ac60792c0f6cf75fdca8e (patch)
treee70474c83d10451b40f97d6e1d452d7c136b241d /lib/ofp-print.c
parent331e7aefe1c627d60fe60ce9b11fd3f308945603 (diff)
downloadopenvswitch-de7d3c0761a34232613ac60792c0f6cf75fdca8e.tar.gz
Implement Openflow 1.4 Vacancy Events for OFPT_TABLE_MOD.
OpenFlow 1.4 introduces the ability to turn on vacancy events with an OFPT_TABLE_MOD message specifying OFPTC_VACANCY_EVENTS. This commit adds support for the new feature in ovs-ofctl mod-table. As per the openflow specification-1.4, vacancy event adds a mechanism enabling the controller to get an early warning based on capacity threshold chosen by the controller. With this commit, vacancy events can be configured as: ovs-ofctl -O OpenFlow14 mod-table <bridge> <table> vacancy:<low,high> <low,high> specify vacancy threshold values in percentage for vacancy_down and vacancy_up respectively. To disable vacancy events, following command should be given: ovs-ofctl -O OpenFlow14 mod-table <bridge> <table> novacancy Signed-off-by: Saloni Jain <saloni.jain@tcs.com> Co-authored-by: Shashwat Srivastava <shashwat.srivastava@tcs.com> Signed-off-by: Shashwat Srivastava <shashwat.srivastava@tcs.com> Co-authored-by: Sandeep Kumar <sandeep.kumar16@tcs.com> Signed-off-by: Sandeep Kumar <sandeep.kumar16@tcs.com> [blp@ovn.org fixed a few typos] Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/ofp-print.c')
-rw-r--r--lib/ofp-print.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 9451e7a46..1f22dd753 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -990,6 +990,18 @@ ofputil_put_eviction_flags(struct ds *string, uint32_t eviction_flags)
}
}
+static const char *
+ofputil_table_vacancy_to_string(enum ofputil_table_vacancy vacancy)
+{
+ switch (vacancy) {
+ case OFPUTIL_TABLE_VACANCY_DEFAULT: return "default";
+ case OFPUTIL_TABLE_VACANCY_ON: return "on";
+ case OFPUTIL_TABLE_VACANCY_OFF: return "off";
+ default: return "***error***";
+ }
+
+}
+
static void
ofp_print_table_mod(struct ds *string, const struct ofp_header *oh)
{
@@ -1020,6 +1032,15 @@ ofp_print_table_mod(struct ds *string, const struct ofp_header *oh)
ds_put_cstr(string, "eviction_flags=");
ofputil_put_eviction_flags(string, pm.eviction_flags);
}
+ if (pm.vacancy != OFPUTIL_TABLE_VACANCY_DEFAULT) {
+ ds_put_format(string, ", vacancy=%s",
+ ofputil_table_vacancy_to_string(pm.vacancy));
+ if (pm.vacancy == OFPUTIL_TABLE_VACANCY_ON) {
+ ds_put_format(string, " vacancy:%"PRIu8""
+ ",%"PRIu8"", pm.table_vacancy.vacancy_down,
+ pm.table_vacancy.vacancy_up);
+ }
+ }
}
/* This function will print the Table description properties. */