[ovs-dev] [PATCH 1/3] ovn-nbctl: Allow referring to port groups by name.

Jakub Sitnicki jkbs at redhat.com
Thu Jul 26 10:51:04 UTC 2018


Be user-friendly and allow using port group's name as its identifier in
database commands.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
 ovn/utilities/ovn-nbctl.c |  3 +++
 tests/ovn-nbctl.at        | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 3c3e582cb..f99b81bc0 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -4369,6 +4369,9 @@ static const struct ctl_table_class tables[NBREC_N_TABLES] = {
     [NBREC_TABLE_ADDRESS_SET].row_ids[0]
     = {&nbrec_address_set_col_name, NULL, NULL},
 
+    [NBREC_TABLE_PORT_GROUP].row_ids[0]
+    = {&nbrec_port_group_col_name, NULL, NULL},
+
     [NBREC_TABLE_ACL].row_ids[0] = {&nbrec_acl_col_name, NULL, NULL},
 };
 
diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 64e217654..069b7b5b6 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -1505,3 +1505,17 @@ AT_CHECK([grep 'command takes at most .* arguments' stderr], [0], [ignore])
 
 OVN_NBCTL_TEST_STOP
 AT_CLEANUP
+
+dnl ---------------------------------------------------------------------
+
+AT_SETUP([ovn-nbctl - Port Groups])
+OVN_NBCTL_TEST_START
+
+dnl Check that port group can be looked up by name
+AT_CHECK([ovn-nbctl create Port_Group name=pg0], [0], [ignore])
+AT_CHECK([ovn-nbctl get Port_Group pg0 name], [0], [dnl
+"pg0"
+])
+
+OVN_NBCTL_TEST_STOP
+AT_CLEANUP
-- 
2.14.4



More information about the dev mailing list