From: Suresh Babu Angadi <sureshab(a)in.ibm.com>
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(a)in.ibm.com>
---
control/ovsbridges.py | 29 +++++++++++++++++++++++++++++
docs/API.md | 8 ++++++++
model/ovsbridges.py | 31 +++++++++++++++++++++++++++++++
3 files changed, 68 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..974e954
--- /dev/null
+++ b/control/ovsbridges.py
@@ -0,0 +1,29 @@
+#
+# 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
+
+
+@UrlSubNode("ovsbridges", True)
+class OVSBridges(SimpleCollection):
+ def __init__(self, model):
+ super(OVSBridges, self).__init__(model)
+ self.role_key = 'ovsbridges'
+ self.admin_methods = ['GET']
diff --git a/docs/API.md b/docs/API.md
index 7bd677f..49540b9 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -1028,3 +1028,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