Set OpenFlow 1.0, 1.3 and 1.4 by default on bridges

There is a bug in OVS 2.12 where it's impossible to change protocol on
a bridge. This patch should be reverted once OVS is fixed. More
information about the bug at [1].

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1782834

Related-Bug: #1852221

Change-Id: I1ead1eee48a0c56193f20797ab35be36a0458270
(cherry picked from commit 0643ab44d8)
This commit is contained in:
Jakub Libosvar 2020-01-14 11:30:10 +00:00 committed by Corey Bryant
parent 169535b155
commit 7d97420046
2 changed files with 13 additions and 4 deletions

View File

@ -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)))

View File

@ -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"