Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/lib/ovs/vsctl.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py
index 8235be2..0f7e031 100644
--- a/ryu/lib/ovs/vsctl.py
+++ b/ryu/lib/ovs/vsctl.py
@@ -1098,7 +1098,7 @@ class VSCtl(object):
             # 'emer-reset':
 
             # Database commands.
-            # 'list':
+            'list': (self._pre_cmd_list, self._cmd_list),
             'find': (self._pre_cmd_find, self._cmd_find),
             'get': (self._pre_cmd_get, self._cmd_get),
             'set': (self._pre_cmd_set, self._cmd_set),
@@ -1810,6 +1810,27 @@ class VSCtl(object):
                            id_, if_exists)
         command.result = values
 
+    def _pre_cmd_list(self, ctx, command):
+        table_name = command.args[0]
+        self._pre_get_table(ctx, table_name)
+
+    def _list(self, ctx, table_name, record_id=None):
+        result = []
+        for ovsrec_row in ctx.idl.tables[table_name].rows.values():
+            if record_id is not None and ovsrec_row.name != record_id:
+                continue
+            result.append(ovsrec_row)
+
+        return result
+
+    def _cmd_list(self, ctx, command):
+        table_name = command.args[0]
+        record_id = None
+        if len(command.args) > 1:
+            record_id = command.args[1]
+
+        command.result = self._list(ctx, table_name, record_id)
+
     def _pre_cmd_find(self, ctx, command):
         table_name = command.args[0]
         table_schema = self.schema.tables[table_name]
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to