Fix reference to non-existent setup_dvr_flows_on_integ_tun_br

Found via the pylint no-member check.

Co-authored-by: Kevin Benton <blak111@gmail.com>

Closes-Bug: #1423775
Change-Id: Id4104fa783aa8c34917df6d16ff1290882f93af5
This commit is contained in:
Assaf Muller 2015-02-19 20:34:17 -05:00 committed by Akihiro Motoki
parent 8305c85898
commit d313e668ba
3 changed files with 39 additions and 11 deletions

View File

@ -135,6 +135,12 @@ class OVSDVRNeutronAgent(object):
if self.enable_distributed_routing:
self.get_dvr_mac_address()
def setup_dvr_flows(self):
self.setup_dvr_flows_on_integ_br()
self.setup_dvr_flows_on_tun_br()
self.setup_dvr_flows_on_phys_br()
self.setup_dvr_mac_flows_on_all_brs()
def reset_ovs_parameters(self, integ_br, tun_br,
patch_int_ofport, patch_tun_ofport):
'''Reset the openvswitch parameters'''

View File

@ -241,10 +241,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
if self.enable_tunneling:
self.setup_tunnel_br()
self.dvr_agent.setup_dvr_flows_on_integ_br()
self.dvr_agent.setup_dvr_flows_on_tun_br()
self.dvr_agent.setup_dvr_flows_on_phys_br()
self.dvr_agent.setup_dvr_mac_flows_on_all_brs()
self.dvr_agent.setup_dvr_flows()
# Collect additional bridges to monitor
self.ancillary_brs = self.setup_ancillary_bridges(integ_br, tun_br)
@ -1442,13 +1439,13 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
self.reset_tunnel_br()
self.setup_tunnel_br()
tunnel_sync = True
if self.enable_distributed_routing:
self.dvr_agent.reset_ovs_parameters(self.int_br,
self.tun_br,
self.patch_int_ofport,
self.patch_tun_ofport)
self.dvr_agent.reset_dvr_parameters()
self.dvr_agent.setup_dvr_flows_on_integ_tun_br()
if self.enable_distributed_routing:
self.dvr_agent.reset_ovs_parameters(self.int_br,
self.tun_br,
self.patch_int_ofport,
self.patch_tun_ofport)
self.dvr_agent.reset_dvr_parameters()
self.dvr_agent.setup_dvr_flows()
elif ovs_status == constants.OVS_DEAD:
# Agent doesn't apply any operations when ovs is dead, to
# prevent unexpected failure or crash. Sleep and continue

View File

@ -801,3 +801,28 @@ class TestOvsDvrNeutronAgent(base.BaseTestCase):
del_flows_tn_fn.assert_called_with(table=constants.DVR_NOT_LEARN,
dl_src=newmac)
self.assertFalse(add_flow_fn.called)
def test_ovs_restart(self):
self._setup_for_dvr_test()
reset_methods = (
'reset_ovs_parameters', 'reset_dvr_parameters',
'setup_dvr_flows_on_integ_br', 'setup_dvr_flows_on_tun_br',
'setup_dvr_flows_on_phys_br', 'setup_dvr_mac_flows_on_all_brs')
reset_mocks = [mock.patch.object(self.agent.dvr_agent, method).start()
for method in reset_methods]
with contextlib.nested(
mock.patch.object(self.agent, 'check_ovs_status',
return_value=constants.OVS_RESTARTED),
mock.patch.object(self.agent, '_agent_has_updates',
side_effect=TypeError('loop exit'))
):
# block RPC calls and bridge calls
self.agent.setup_physical_bridges = mock.Mock()
self.agent.setup_integration_br = mock.Mock()
self.agent.reset_tunnel_br = mock.Mock()
self.agent.state_rpc = mock.Mock()
try:
self.agent.rpc_loop(polling_manager=mock.Mock())
except TypeError:
pass
self.assertTrue(all([x.called for x in reset_mocks]))