summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-10-20 16:48:21 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-10-25 16:22:51 +0900
commitd7cfe6687bc93fce0f7200317f2d9b0b190dc31e (patch)
tree99db2198e2bdfc64ad463d56816439e4f6537ef7
parent05b373835902ce0451e07139dddfb909fcdfce3a (diff)
ovs/vsctl: Add missing Controller commands in OVS v2.6.0
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/ovs/vsctl.py47
1 files changed, 44 insertions, 3 deletions
diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py
index 90048139..61f9ac6e 100644
--- a/ryu/lib/ovs/vsctl.py
+++ b/ryu/lib/ovs/vsctl.py
@@ -1158,9 +1158,9 @@ class VSCtl(object):
'get-controller': (self._pre_controller, self._cmd_get_controller),
'del-controller': (self._pre_controller, self._cmd_del_controller),
'set-controller': (self._pre_controller, self._cmd_set_controller),
- # 'get-fail-mode':
- # 'del-fail-mode':
- # 'set-fail-mode':
+ 'get-fail-mode': (self._pre_fail_mode, self._cmd_get_fail_mode),
+ 'del-fail-mode': (self._pre_fail_mode, self._cmd_del_fail_mode),
+ 'set-fail-mode': (self._pre_fail_mode, self._cmd_set_fail_mode),
# Manager commands.
# 'get-manager':
@@ -1775,6 +1775,47 @@ class VSCtl(object):
controller_names = command.args[1:]
self._set_controller(ctx, br_name, controller_names)
+ def _pre_fail_mode(self, ctx, command):
+ self._pre_get_info(ctx, command)
+ self.schema_helper.register_columns(
+ vswitch_idl.OVSREC_TABLE_BRIDGE,
+ [vswitch_idl.OVSREC_BRIDGE_COL_FAIL_MODE])
+
+ def _get_fail_mode(self, ctx, br_name):
+ ctx.populate_cache()
+ br = ctx.find_bridge(br_name, True)
+
+ # Note: Returns first element of fail_mode column
+ return getattr(br.br_cfg, vswitch_idl.OVSREC_BRIDGE_COL_FAIL_MODE)[0]
+
+ def _cmd_get_fail_mode(self, ctx, command):
+ br_name = command.args[0]
+ command.result = self._get_fail_mode(ctx, br_name)
+
+ def _del_fail_mode(self, ctx, br_name):
+ ctx.populate_cache()
+ br = ctx.find_bridge(br_name, True)
+ # Note: assuming that [] means empty
+ setattr(br.br_cfg, vswitch_idl.OVSREC_BRIDGE_COL_FAIL_MODE, [])
+ ctx.invalidate_cache()
+
+ def _cmd_del_fail_mode(self, ctx, command):
+ br_name = command.args[0]
+ self._del_fail_mode(ctx, br_name)
+
+ def _set_fail_mode(self, ctx, br_name, mode):
+ ctx.populate_cache()
+ br = ctx.find_bridge(br_name, True)
+ setattr(br.br_cfg, vswitch_idl.OVSREC_BRIDGE_COL_FAIL_MODE, mode)
+ ctx.invalidate_cache()
+
+ def _cmd_set_fail_mode(self, ctx, command):
+ br_name = command.args[0]
+ mode = command.args[1]
+ if mode not in ('standalone', 'secure'):
+ vsctl_fatal('fail-mode must be "standalone" or "secure"')
+ self._set_fail_mode(ctx, br_name, mode)
+
# Utility commands:
def _del_qos(self, ctx, port_name):