diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py index 95e9f53e75e..35eedbbd331 100644 --- a/neutron/agent/common/ovs_lib.py +++ b/neutron/agent/common/ovs_lib.py @@ -235,6 +235,12 @@ class OVSBridge(BaseOVS): self._default_cookie = generate_random_cookie() self._highest_protocol_needed = constants.OPENFLOW10 self._min_bw_qos_id = uuidutils.generate_uuid() + # TODO(jlibosva): Revert initial_protocols once launchpad bug 1852221 + # is fixed and new openvswitch containing the fix is + # released. + self.initial_protocols = { + constants.OPENFLOW10, constants.OPENFLOW13, constants.OPENFLOW14} + self.initial_protocols.add(self._highest_protocol_needed) @property def default_cookie(self): @@ -273,6 +279,7 @@ class OVSBridge(BaseOVS): self._highest_protocol_needed = max(self._highest_protocol_needed, protocol, key=version_from_protocol) + self.initial_protocols.add(self._highest_protocol_needed) def create(self, secure_mode=False): other_config = { @@ -287,7 +294,8 @@ class OVSBridge(BaseOVS): # transactions txn.add( self.ovsdb.db_add('Bridge', self.br_name, - 'protocols', self._highest_protocol_needed)) + 'protocols', + *self.initial_protocols)) txn.add( self.ovsdb.db_set('Bridge', self.br_name, ('other_config', other_config))) diff --git a/neutron/tests/functional/agent/test_ovs_lib.py b/neutron/tests/functional/agent/test_ovs_lib.py index 7aee4af65b1..4bf2ef83278 100644 --- a/neutron/tests/functional/agent/test_ovs_lib.py +++ b/neutron/tests/functional/agent/test_ovs_lib.py @@ -464,11 +464,12 @@ class OVSBridgeTestCase(OVSBridgeTestBase): def test_db_add_set(self): protocols = ["OpenFlow10", "OpenFlow11"] + expected = self.br.initial_protocols.union(protocols) self.br.ovsdb.db_add("Bridge", self.br.br_name, "protocols", *protocols).execute(check_error=True) - self.assertEqual(protocols, - self.br.db_get_val('Bridge', - self.br.br_name, "protocols")) + self.assertItemsEqual(expected, + self.br.db_get_val('Bridge', + self.br.br_name, "protocols")) def test_db_add_map(self): key = "testdata"