Merge "OVS_LIB support API for setting fail mode 'standalone'"

This commit is contained in:
Jenkins 2015-05-28 02:58:22 +00:00 committed by Gerrit Code Review
commit 7de7df280b
3 changed files with 14 additions and 1 deletions

View File

@ -40,6 +40,7 @@ UNASSIGNED_OFPORT = []
# OVS bridge fail modes
FAILMODE_SECURE = 'secure'
FAILMODE_STANDALONE = 'standalone'
OPTS = [
cfg.IntOpt('ovs_vsctl_timeout',
@ -160,6 +161,10 @@ class OVSBridge(BaseOVS):
self.ovsdb.set_fail_mode(self.br_name, FAILMODE_SECURE).execute(
check_error=True)
def set_standalone_mode(self):
self.ovsdb.set_fail_mode(self.br_name, FAILMODE_STANDALONE).execute(
check_error=True)
def set_protocols(self, protocols):
self.set_db_attribute('Bridge', self.br_name, 'protocols', protocols,
check_error=True)

View File

@ -118,10 +118,14 @@ class OVSBridgeTestCase(OVSBridgeTestBase):
self.br.db_get_val('Controller', self.br.br_name,
'connection_mode'))
def test_set_fail_mode(self):
def test_set_fail_mode_secure(self):
self.br.set_secure_mode()
self._assert_br_fail_mode(ovs_lib.FAILMODE_SECURE)
def test_set_fail_mode_standalone(self):
self.br.set_standalone_mode()
self._assert_br_fail_mode(ovs_lib.FAILMODE_STANDALONE)
def _assert_br_fail_mode(self, fail_mode):
self.assertEqual(
self.br.db_get_val('Bridge', self.br.br_name, 'fail_mode'),

View File

@ -130,6 +130,10 @@ class OVS_Lib_Test(base.BaseTestCase):
self.br.set_secure_mode()
self._verify_vsctl_mock('set-fail-mode', self.BR_NAME, 'secure')
def test_set_standalone_mode(self):
self.br.set_standalone_mode()
self._verify_vsctl_mock('set-fail-mode', self.BR_NAME, 'standalone')
def test_set_protocols(self):
protocols = 'OpenFlow13'
self.br.set_protocols(protocols)