Merge "Set OpenFlow 1.0, 1.3 and 1.4 by default on bridges"

This commit is contained in:
Zuul 2020-01-18 07:05:06 +00:00 committed by Gerrit Code Review
commit d76db2a1a4
2 changed files with 13 additions and 4 deletions

View File

@ -237,6 +237,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):
@ -275,6 +281,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 set_igmp_snooping_state(self, state):
state = bool(state)
@ -301,7 +308,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

@ -483,11 +483,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"