[Kimchi-devel] [PATCH] [Kimchi v2] /plugins/kimchi/ovsbridges API

sureshab at linux.vnet.ibm.com sureshab at linux.vnet.ibm.com
Fri Sep 2 07:00:57 UTC 2016


From: Suresh Babu Angadi <sureshab at in.ibm.com>

v1 to v2 : Removed role_key in controller

As Per RFC:
    [Kimchi-devel] [RFC] listing of ovs bridges

this patch adds new API /plugins/kimchi/ovsbridges
to list ovsbridges

Signed-off-by: Suresh Babu Angadi <sureshab at in.ibm.com>
---
 control/ovsbridges.py | 28 ++++++++++++++++++++++++++++
 docs/API.md           |  8 ++++++++
 model/ovsbridges.py   | 31 +++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)
 create mode 100644 control/ovsbridges.py
 create mode 100644 model/ovsbridges.py

diff --git a/control/ovsbridges.py b/control/ovsbridges.py
new file mode 100644
index 0000000..5ffd6c2
--- /dev/null
+++ b/control/ovsbridges.py
@@ -0,0 +1,28 @@
+#
+# Project Kimchi
+#
+# Copyright IBM Corp, 2016
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+from wok.control.base import SimpleCollection
+from wok.control.utils import UrlSubNode
+
+
+ at UrlSubNode("ovsbridges", True)
+class OVSBridges(SimpleCollection):
+    def __init__(self, model):
+        super(OVSBridges, self).__init__(model)
+        self.admin_methods = ['GET']
diff --git a/docs/API.md b/docs/API.md
index 357c2b8..c94003f 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -1031,3 +1031,11 @@ List of available groups.
 
 * **GET**: Return the list of Kimchi peers in the same network
            (It uses openSLP for discovering)
+
+### Simple Collection: OVSBridges
+
+**URI:** /plugins/kimchi/ovsbridges
+
+**Methods:**
+
+* **GET**: Return list of OVS bridges of the host.
diff --git a/model/ovsbridges.py b/model/ovsbridges.py
new file mode 100644
index 0000000..212520f
--- /dev/null
+++ b/model/ovsbridges.py
@@ -0,0 +1,31 @@
+#
+# Project Kimchi
+#
+# Copyright IBM Corp, 2016
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+from wok.plugins.gingerbase.netinfo import ovs_bridges
+
+
+class OVSBridgesModel(object):
+
+    def get_list(self):
+        """
+
+        Returns: list of ovs bridge names
+
+        """
+        return ovs_bridges()
-- 
1.8.3.1




More information about the Kimchi-devel mailing list