Merge "[OVN] Update check_for_mcast_flood_reports() to check for mcast_flood"
This commit is contained in:
commit
4b1bf15f7b
@ -677,7 +677,7 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
|||||||
txn.add(cmd)
|
txn.add(cmd)
|
||||||
raise periodics.NeverAgain()
|
raise periodics.NeverAgain()
|
||||||
|
|
||||||
# TODO(lucasagomes): Remove this in the Y cycle
|
# TODO(lucasagomes): Remove this in the Z cycle
|
||||||
# A static spacing value is used here, but this method will only run
|
# A static spacing value is used here, but this method will only run
|
||||||
# once per lock due to the use of periodics.NeverAgain().
|
# once per lock due to the use of periodics.NeverAgain().
|
||||||
@periodics.periodic(spacing=600, run_immediately=True)
|
@periodics.periodic(spacing=600, run_immediately=True)
|
||||||
@ -692,13 +692,16 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
options = port.options
|
options = port.options
|
||||||
if ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS in options:
|
if port_type == ovn_const.LSP_TYPE_LOCALNET:
|
||||||
|
mcast_flood_value = options.get(
|
||||||
|
ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS)
|
||||||
|
if mcast_flood_value == 'false':
|
||||||
|
continue
|
||||||
|
options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD: 'false'})
|
||||||
|
elif ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS in options:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'})
|
options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'})
|
||||||
if port_type == ovn_const.LSP_TYPE_LOCALNET:
|
|
||||||
options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD: 'false'})
|
|
||||||
|
|
||||||
cmds.append(self._nb_idl.lsp_set_options(port.name, **options))
|
cmds.append(self._nb_idl.lsp_set_options(port.name, **options))
|
||||||
|
|
||||||
if cmds:
|
if cmds:
|
||||||
|
@ -455,7 +455,8 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
|||||||
nb_idl = self.fake_ovn_client._nb_idl
|
nb_idl = self.fake_ovn_client._nb_idl
|
||||||
lsp0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
lsp0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||||
attrs={'name': 'lsp0',
|
attrs={'name': 'lsp0',
|
||||||
'options': {'mcast_flood_reports': 'true'},
|
'options': {
|
||||||
|
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'},
|
||||||
'type': ""})
|
'type': ""})
|
||||||
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||||
attrs={'name': 'lsp1', 'options': {}, 'type': ""})
|
attrs={'name': 'lsp1', 'options': {}, 'type': ""})
|
||||||
@ -470,21 +471,33 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
|||||||
'type': "router"})
|
'type': "router"})
|
||||||
lsp5 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
lsp5 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||||
attrs={'name': 'lsp5', 'options': {}, 'type': 'localnet'})
|
attrs={'name': 'lsp5', 'options': {}, 'type': 'localnet'})
|
||||||
|
lsp6 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||||
|
attrs={'name': 'lsp6',
|
||||||
|
'options': {
|
||||||
|
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
|
||||||
|
constants.LSP_OPTIONS_MCAST_FLOOD: 'true'},
|
||||||
|
'type': 'localnet'})
|
||||||
|
lsp7 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||||
|
attrs={'name': 'lsp7',
|
||||||
|
'options': {
|
||||||
|
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
|
||||||
|
constants.LSP_OPTIONS_MCAST_FLOOD: 'false'},
|
||||||
|
'type': 'localnet'})
|
||||||
|
|
||||||
nb_idl.lsp_list.return_value.execute.return_value = [
|
nb_idl.lsp_list.return_value.execute.return_value = [
|
||||||
lsp0, lsp1, lsp2, lsp3, lsp4, lsp5]
|
lsp0, lsp1, lsp2, lsp3, lsp4, lsp5, lsp6, lsp7]
|
||||||
|
|
||||||
# Invoke the periodic method, it meant to run only once at startup
|
# Invoke the periodic method, it meant to run only once at startup
|
||||||
# so NeverAgain will be raised at the end
|
# so NeverAgain will be raised at the end
|
||||||
self.assertRaises(periodics.NeverAgain,
|
self.assertRaises(periodics.NeverAgain,
|
||||||
self.periodic.check_for_mcast_flood_reports)
|
self.periodic.check_for_mcast_flood_reports)
|
||||||
|
|
||||||
# Assert only lsp1 and lsp5 were called because they are the only
|
# Assert only lsp1, lsp5 and lsp6 were called because they are the
|
||||||
# ones meeting the criteria ("mcast_flood_reports" not yet set,
|
# only ones meeting the criteria
|
||||||
# and type "" or localnet)
|
|
||||||
expected_calls = [
|
expected_calls = [
|
||||||
mock.call('lsp1', mcast_flood_reports='true'),
|
mock.call('lsp1', mcast_flood_reports='true'),
|
||||||
mock.call('lsp5', mcast_flood_reports='true', mcast_flood='false')]
|
mock.call('lsp5', mcast_flood_reports='true', mcast_flood='false'),
|
||||||
|
mock.call('lsp6', mcast_flood_reports='true', mcast_flood='false')]
|
||||||
|
|
||||||
nb_idl.lsp_set_options.assert_has_calls(expected_calls)
|
nb_idl.lsp_set_options.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user