Re-home OvnProviderHelper class
Put it in a separate file from the driver class. Change-Id: I32eda38d212b7b5a1434d9130a1b4e268d2c3aa9
This commit is contained in:
parent
bf68be1cca
commit
178dbd3fee
@ -14,9 +14,13 @@
|
|||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from ovn_octavia_provider.common import config as ovn_conf
|
||||||
from ovn_octavia_provider import driver
|
from ovn_octavia_provider import driver
|
||||||
|
from ovn_octavia_provider import helper as ovn_helper
|
||||||
from ovn_octavia_provider.ovsdb import impl_idl_ovn
|
from ovn_octavia_provider.ovsdb import impl_idl_ovn
|
||||||
|
|
||||||
|
ovn_conf.register_opts()
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
OVN_EVENT_LOCK_NAME = "neutron_ovn_octavia_event_lock"
|
OVN_EVENT_LOCK_NAME = "neutron_ovn_octavia_event_lock"
|
||||||
@ -24,7 +28,7 @@ OVN_EVENT_LOCK_NAME = "neutron_ovn_octavia_event_lock"
|
|||||||
|
|
||||||
def OvnProviderAgent(exit_event):
|
def OvnProviderAgent(exit_event):
|
||||||
|
|
||||||
helper = driver.OvnProviderHelper()
|
helper = ovn_helper.OvnProviderHelper()
|
||||||
events = [driver.LogicalRouterPortEvent(helper),
|
events = [driver.LogicalRouterPortEvent(helper),
|
||||||
driver.LogicalSwitchPortUpdateEvent(helper)]
|
driver.LogicalSwitchPortUpdateEvent(helper)]
|
||||||
|
|
||||||
|
@ -58,14 +58,36 @@ ovn_opts = [
|
|||||||
'to 60 seconds.')),
|
'to 60 seconds.')),
|
||||||
]
|
]
|
||||||
|
|
||||||
cfg.CONF.register_opts(ovn_opts, group='ovn')
|
neutron_opts = [
|
||||||
ks_loading.register_auth_conf_options(cfg.CONF, 'service_auth')
|
cfg.StrOpt('service_name',
|
||||||
ks_loading.register_session_conf_options(cfg.CONF, 'service_auth')
|
help=_('The name of the neutron service in the '
|
||||||
|
'keystone catalog')),
|
||||||
|
cfg.StrOpt('endpoint', help=_('A new endpoint to override the endpoint '
|
||||||
|
'in the keystone catalog.')),
|
||||||
|
cfg.StrOpt('region_name',
|
||||||
|
help=_('Region in Identity service catalog to use for '
|
||||||
|
'communication with the OpenStack services.')),
|
||||||
|
cfg.StrOpt('endpoint_type', default='publicURL',
|
||||||
|
help=_('Endpoint interface in identity service to use')),
|
||||||
|
cfg.StrOpt('ca_certificates_file',
|
||||||
|
help=_('CA certificates file path')),
|
||||||
|
cfg.BoolOpt('insecure',
|
||||||
|
default=False,
|
||||||
|
help=_('Disable certificate validation on SSL connections ')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_opts():
|
||||||
|
cfg.CONF.register_opts(ovn_opts, group='ovn')
|
||||||
|
cfg.CONF.register_opts(neutron_opts, group='neutron')
|
||||||
|
ks_loading.register_auth_conf_options(cfg.CONF, 'service_auth')
|
||||||
|
ks_loading.register_session_conf_options(cfg.CONF, 'service_auth')
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return [
|
return [
|
||||||
('ovn', ovn_opts),
|
('ovn', ovn_opts),
|
||||||
|
('neutron', neutron_opts),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
1790
ovn_octavia_provider/helper.py
Normal file
1790
ovn_octavia_provider/helper.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,7 @@ from ovn_octavia_provider import agent as ovn_agent
|
|||||||
from ovn_octavia_provider.common import clients
|
from ovn_octavia_provider.common import clients
|
||||||
from ovn_octavia_provider.common import constants as ovn_const
|
from ovn_octavia_provider.common import constants as ovn_const
|
||||||
from ovn_octavia_provider import driver as ovn_driver
|
from ovn_octavia_provider import driver as ovn_driver
|
||||||
|
from ovn_octavia_provider import helper as ovn_helper
|
||||||
from ovn_octavia_provider.ovsdb import impl_idl_ovn
|
from ovn_octavia_provider.ovsdb import impl_idl_ovn
|
||||||
|
|
||||||
LR_REF_KEY_HEADER = 'neutron-'
|
LR_REF_KEY_HEADER = 'neutron-'
|
||||||
@ -1179,7 +1180,7 @@ class TestOvnOctaviaProviderAgent(TestOvnOctaviaBase):
|
|||||||
# with IDL running, but to make it easier for now
|
# with IDL running, but to make it easier for now
|
||||||
# we can initialize this IDL here instead spawning
|
# we can initialize this IDL here instead spawning
|
||||||
# another process.
|
# another process.
|
||||||
da_helper = ovn_driver.OvnProviderHelper()
|
da_helper = ovn_helper.OvnProviderHelper()
|
||||||
events = [ovn_driver.LogicalRouterPortEvent(da_helper),
|
events = [ovn_driver.LogicalRouterPortEvent(da_helper),
|
||||||
ovn_driver.LogicalSwitchPortUpdateEvent(da_helper)]
|
ovn_driver.LogicalSwitchPortUpdateEvent(da_helper)]
|
||||||
ovn_nb_idl_for_events = impl_idl_ovn.OvnNbIdlForLb(
|
ovn_nb_idl_for_events = impl_idl_ovn.OvnNbIdlForLb(
|
||||||
|
@ -27,6 +27,7 @@ from ovn_octavia_provider import agent as ovn_agent
|
|||||||
from ovn_octavia_provider.common import clients
|
from ovn_octavia_provider.common import clients
|
||||||
from ovn_octavia_provider.common import constants as ovn_const
|
from ovn_octavia_provider.common import constants as ovn_const
|
||||||
from ovn_octavia_provider import driver as ovn_driver
|
from ovn_octavia_provider import driver as ovn_driver
|
||||||
|
from ovn_octavia_provider import helper as ovn_helper
|
||||||
from ovn_octavia_provider.tests.unit import fakes
|
from ovn_octavia_provider.tests.unit import fakes
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ class TestOvnProviderDriver(TestOvnOctaviaBase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestOvnProviderDriver, self).setUp()
|
super(TestOvnProviderDriver, self).setUp()
|
||||||
self.driver = ovn_driver.OvnProviderDriver()
|
self.driver = ovn_driver.OvnProviderDriver()
|
||||||
add_req_thread = mock.patch.object(ovn_driver.OvnProviderHelper,
|
add_req_thread = mock.patch.object(ovn_helper.OvnProviderHelper,
|
||||||
'add_request')
|
'add_request')
|
||||||
self.member_line = (
|
self.member_line = (
|
||||||
'member_%s_%s:%s_%s' %
|
'member_%s_%s:%s_%s' %
|
||||||
@ -207,11 +208,11 @@ class TestOvnProviderDriver(TestOvnOctaviaBase):
|
|||||||
vip_address=self.vip_address,
|
vip_address=self.vip_address,
|
||||||
vip_network_id=self.vip_network_id)
|
vip_network_id=self.vip_network_id)
|
||||||
mock.patch.object(
|
mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_find_ovn_lbs',
|
ovn_helper.OvnProviderHelper, '_find_ovn_lbs',
|
||||||
side_effect=lambda x, protocol=None:
|
side_effect=lambda x, protocol=None:
|
||||||
self.ovn_lb if protocol else [self.ovn_lb]).start()
|
self.ovn_lb if protocol else [self.ovn_lb]).start()
|
||||||
self.mock_find_lb_pool_key = mock.patch.object(
|
self.mock_find_lb_pool_key = mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper,
|
ovn_helper.OvnProviderHelper,
|
||||||
'_find_ovn_lb_with_pool_key',
|
'_find_ovn_lb_with_pool_key',
|
||||||
return_value=self.ovn_lb).start()
|
return_value=self.ovn_lb).start()
|
||||||
|
|
||||||
@ -612,7 +613,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestOvnProviderHelper, self).setUp()
|
super(TestOvnProviderHelper, self).setUp()
|
||||||
self.helper = ovn_driver.OvnProviderHelper()
|
self.helper = ovn_helper.OvnProviderHelper()
|
||||||
mock.patch.object(self.helper, '_update_status_to_octavia').start()
|
mock.patch.object(self.helper, '_update_status_to_octavia').start()
|
||||||
self.listener = {'id': self.listener_id,
|
self.listener = {'id': self.listener_id,
|
||||||
'loadbalancer_id': self.loadbalancer_id,
|
'loadbalancer_id': self.loadbalancer_id,
|
||||||
@ -642,7 +643,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'admin_state_up': True}
|
'admin_state_up': True}
|
||||||
self.ovn_nbdb_api = mock.patch.object(self.helper, 'ovn_nbdb_api')
|
self.ovn_nbdb_api = mock.patch.object(self.helper, 'ovn_nbdb_api')
|
||||||
self.ovn_nbdb_api.start()
|
self.ovn_nbdb_api.start()
|
||||||
add_req_thread = mock.patch.object(ovn_driver.OvnProviderHelper,
|
add_req_thread = mock.patch.object(ovn_helper.OvnProviderHelper,
|
||||||
'add_request')
|
'add_request')
|
||||||
self.mock_add_request = add_req_thread.start()
|
self.mock_add_request = add_req_thread.start()
|
||||||
self.ovn_lb = mock.MagicMock()
|
self.ovn_lb = mock.MagicMock()
|
||||||
@ -669,7 +670,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
return_value=self.ovn_lb).start()
|
return_value=self.ovn_lb).start()
|
||||||
|
|
||||||
self.mock_find_ovn_lbs = mock.patch.object(
|
self.mock_find_ovn_lbs = mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_find_ovn_lbs',
|
ovn_helper.OvnProviderHelper, '_find_ovn_lbs',
|
||||||
side_effect=lambda x, protocol=None:
|
side_effect=lambda x, protocol=None:
|
||||||
self.ovn_lb if protocol else [self.ovn_lb])
|
self.ovn_lb if protocol else [self.ovn_lb])
|
||||||
self.mock_find_ovn_lbs.start()
|
self.mock_find_ovn_lbs.start()
|
||||||
@ -810,7 +811,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
protocol='TCP',
|
protocol='TCP',
|
||||||
admin_state_up='True')
|
admin_state_up='True')
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'lb_create')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'lb_create')
|
||||||
def test__get_or_create_ovn_lb_required_proto_not_found(self, lbc):
|
def test__get_or_create_ovn_lb_required_proto_not_found(self, lbc):
|
||||||
udp_lb = copy.copy(self.ovn_lb)
|
udp_lb = copy.copy(self.ovn_lb)
|
||||||
udp_lb.protocol = ['udp']
|
udp_lb.protocol = ['udp']
|
||||||
@ -929,7 +930,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
mock.call(self.ovn_lb, associate=True, network_id='foo')])
|
mock.call(self.ovn_lb, associate=True, network_id='foo')])
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'delete_vip_port')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'delete_vip_port')
|
||||||
def test_lb_create_exception(self, del_port, net_cli):
|
def test_lb_create_exception(self, del_port, net_cli):
|
||||||
self.helper._find_ovn_lbs.side_effect = [RuntimeError]
|
self.helper._find_ovn_lbs.side_effect = [RuntimeError]
|
||||||
net_cli.return_value.list_ports.return_value = self.ports
|
net_cli.return_value.list_ports.return_value = self.ports
|
||||||
@ -941,7 +942,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
del_port.assert_called_once_with(self.ports.get('ports')[0]['id'])
|
del_port.assert_called_once_with(self.ports.get('ports')[0]['id'])
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'delete_vip_port')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'delete_vip_port')
|
||||||
def test_lb_delete(self, del_port, net_cli):
|
def test_lb_delete(self, del_port, net_cli):
|
||||||
net_cli.return_value.delete_port.return_value = None
|
net_cli.return_value.delete_port.return_value = None
|
||||||
status = self.helper.lb_delete(self.ovn_lb)
|
status = self.helper.lb_delete(self.ovn_lb)
|
||||||
@ -953,7 +954,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.ovn_lb.uuid)
|
self.ovn_lb.uuid)
|
||||||
del_port.assert_called_once_with('foo_port')
|
del_port.assert_called_once_with('foo_port')
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'delete_vip_port')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'delete_vip_port')
|
||||||
def test_lb_delete_row_not_found(self, del_port):
|
def test_lb_delete_row_not_found(self, del_port):
|
||||||
self.helper._find_ovn_lbs.side_effect = [idlutils.RowNotFound]
|
self.helper._find_ovn_lbs.side_effect = [idlutils.RowNotFound]
|
||||||
status = self.helper.lb_delete(self.lb)
|
status = self.helper.lb_delete(self.lb)
|
||||||
@ -964,7 +965,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
||||||
del_port.assert_not_called()
|
del_port.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'delete_vip_port')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'delete_vip_port')
|
||||||
def test_lb_delete_exception(self, del_port):
|
def test_lb_delete_exception(self, del_port):
|
||||||
self.helper.ovn_nbdb_api.lb_del.side_effect = [RuntimeError]
|
self.helper.ovn_nbdb_api.lb_del.side_effect = [RuntimeError]
|
||||||
status = self.helper.lb_delete(self.lb)
|
status = self.helper.lb_delete(self.lb)
|
||||||
@ -977,7 +978,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
del_port.assert_called_once_with('foo_port')
|
del_port.assert_called_once_with('foo_port')
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, 'delete_vip_port')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, 'delete_vip_port')
|
||||||
def test_lb_delete_port_not_found(self, del_port, net_cli):
|
def test_lb_delete_port_not_found(self, del_port, net_cli):
|
||||||
net_cli.return_value.delete_port.side_effect = (
|
net_cli.return_value.delete_port.side_effect = (
|
||||||
[n_exc.PortNotFoundClient])
|
[n_exc.PortNotFoundClient])
|
||||||
@ -1044,7 +1045,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['loadbalancers'][0]['provisioning_status'],
|
self.assertEqual(status['loadbalancers'][0]['provisioning_status'],
|
||||||
constants.ACTIVE)
|
constants.ACTIVE)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_lb_update_disabled(self, refresh_vips):
|
def test_lb_update_disabled(self, refresh_vips):
|
||||||
self.lb['admin_state_up'] = False
|
self.lb['admin_state_up'] = False
|
||||||
status = self.helper.lb_update(self.lb)
|
status = self.helper.lb_update(self.lb)
|
||||||
@ -1058,7 +1059,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'Load_Balancer', self.ovn_lb.uuid,
|
'Load_Balancer', self.ovn_lb.uuid,
|
||||||
('external_ids', {'enabled': 'False'}))
|
('external_ids', {'enabled': 'False'}))
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_lb_update_enabled(self, refresh_vips):
|
def test_lb_update_enabled(self, refresh_vips):
|
||||||
# Change the mock, its enabled by default.
|
# Change the mock, its enabled by default.
|
||||||
self.ovn_lb.external_ids.update({'enabled': False})
|
self.ovn_lb.external_ids.update({'enabled': False})
|
||||||
@ -1074,7 +1075,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'Load_Balancer', self.ovn_lb.uuid,
|
'Load_Balancer', self.ovn_lb.uuid,
|
||||||
('external_ids', {'enabled': 'True'}))
|
('external_ids', {'enabled': 'True'}))
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_lb_update_enabled_multiple_protocols(self, refresh_vips):
|
def test_lb_update_enabled_multiple_protocols(self, refresh_vips):
|
||||||
self.mock_find_ovn_lbs.stop()
|
self.mock_find_ovn_lbs.stop()
|
||||||
self.ovn_lb.external_ids.update({'enabled': 'False'})
|
self.ovn_lb.external_ids.update({'enabled': 'False'})
|
||||||
@ -1116,7 +1117,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
constants.ACTIVE)
|
constants.ACTIVE)
|
||||||
self.helper._find_ovn_lbs.assert_not_called()
|
self.helper._find_ovn_lbs.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_create_disabled(self, refresh_vips):
|
def test_listener_create_disabled(self, refresh_vips):
|
||||||
self.ovn_lb.external_ids.pop('listener_%s' % self.listener_id)
|
self.ovn_lb.external_ids.pop('listener_%s' % self.listener_id)
|
||||||
status = self.helper.listener_create(self.listener)
|
status = self.helper.listener_create(self.listener)
|
||||||
@ -1143,7 +1144,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['listeners'][0]['operating_status'],
|
self.assertEqual(status['listeners'][0]['operating_status'],
|
||||||
constants.OFFLINE)
|
constants.OFFLINE)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_create_enabled(self, refresh_vips):
|
def test_listener_create_enabled(self, refresh_vips):
|
||||||
self.listener['admin_state_up'] = True
|
self.listener['admin_state_up'] = True
|
||||||
status = self.helper.listener_create(self.listener)
|
status = self.helper.listener_create(self.listener)
|
||||||
@ -1221,7 +1222,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
constants.ERROR)
|
constants.ERROR)
|
||||||
self.helper.ovn_nbdb_api.db_set.assert_not_called()
|
self.helper.ovn_nbdb_api.db_set.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_update_exception(self, refresh_vips):
|
def test_listener_update_exception(self, refresh_vips):
|
||||||
refresh_vips.side_effect = [RuntimeError]
|
refresh_vips.side_effect = [RuntimeError]
|
||||||
status = self.helper.listener_update(self.listener)
|
status = self.helper.listener_update(self.listener)
|
||||||
@ -1230,7 +1231,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['listeners'][0]['provisioning_status'],
|
self.assertEqual(status['listeners'][0]['provisioning_status'],
|
||||||
constants.ERROR)
|
constants.ERROR)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_update_listener_enabled(self, refresh_vips):
|
def test_listener_update_listener_enabled(self, refresh_vips):
|
||||||
self.listener['admin_state_up'] = True
|
self.listener['admin_state_up'] = True
|
||||||
# Update the listener port.
|
# Update the listener port.
|
||||||
@ -1256,7 +1257,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
refresh_vips.assert_called_once_with(
|
refresh_vips.assert_called_once_with(
|
||||||
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_update_listener_disabled(self, refresh_vips):
|
def test_listener_update_listener_disabled(self, refresh_vips):
|
||||||
self.listener['admin_state_up'] = False
|
self.listener['admin_state_up'] = False
|
||||||
status = self.helper.listener_update(self.listener)
|
status = self.helper.listener_update(self.listener)
|
||||||
@ -1278,7 +1279,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
refresh_vips.assert_called_once_with(
|
refresh_vips.assert_called_once_with(
|
||||||
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_update_no_admin_state_up(self, refresh_vips):
|
def test_listener_update_no_admin_state_up(self, refresh_vips):
|
||||||
self.listener.pop('admin_state_up')
|
self.listener.pop('admin_state_up')
|
||||||
status = self.helper.listener_update(self.listener)
|
status = self.helper.listener_update(self.listener)
|
||||||
@ -1292,7 +1293,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
refresh_vips.assert_called_once_with(
|
refresh_vips.assert_called_once_with(
|
||||||
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_update_no_admin_state_up_or_default_pool_id(
|
def test_listener_update_no_admin_state_up_or_default_pool_id(
|
||||||
self, refresh_vips):
|
self, refresh_vips):
|
||||||
self.listener.pop('admin_state_up')
|
self.listener.pop('admin_state_up')
|
||||||
@ -1336,7 +1337,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['listeners'][0]['operating_status'],
|
self.assertEqual(status['listeners'][0]['operating_status'],
|
||||||
constants.ERROR)
|
constants.ERROR)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_refresh_lb_vips')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_refresh_lb_vips')
|
||||||
def test_listener_delete_external_id(self, refresh_vips):
|
def test_listener_delete_external_id(self, refresh_vips):
|
||||||
status = self.helper.listener_delete(self.listener)
|
status = self.helper.listener_delete(self.listener)
|
||||||
self.assertEqual(status['loadbalancers'][0]['provisioning_status'],
|
self.assertEqual(status['loadbalancers'][0]['provisioning_status'],
|
||||||
@ -1352,7 +1353,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
refresh_vips.assert_called_once_with(
|
refresh_vips.assert_called_once_with(
|
||||||
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
self.ovn_lb.uuid, self.ovn_lb.external_ids)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_listener_delete_ovn_lb_not_empty(self, lb_empty):
|
def test_listener_delete_ovn_lb_not_empty(self, lb_empty):
|
||||||
lb_empty.return_value = False
|
lb_empty.return_value = False
|
||||||
self.helper.listener_delete(self.listener)
|
self.helper.listener_delete(self.listener)
|
||||||
@ -1361,7 +1362,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'external_ids', 'listener_%s' % self.listener_id)
|
'external_ids', 'listener_%s' % self.listener_id)
|
||||||
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_listener_delete_ovn_lb_empty_octavia_lb_empty(self, lb_empty):
|
def test_listener_delete_ovn_lb_empty_octavia_lb_empty(self, lb_empty):
|
||||||
"""That test situation when the OVN and Octavia LBs are empty.
|
"""That test situation when the OVN and Octavia LBs are empty.
|
||||||
|
|
||||||
@ -1379,7 +1380,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
mock.call('Load_Balancer', self.ovn_lb.uuid,
|
mock.call('Load_Balancer', self.ovn_lb.uuid,
|
||||||
('protocol', []))])
|
('protocol', []))])
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_listener_delete_ovn_lb_empty_octavia_lb_not_empty(self, lb_empty):
|
def test_listener_delete_ovn_lb_empty_octavia_lb_not_empty(self, lb_empty):
|
||||||
"""We test if we can remove one LB with not used protocol"""
|
"""We test if we can remove one LB with not used protocol"""
|
||||||
ovn_lb_udp = copy.copy(self.ovn_lb)
|
ovn_lb_udp = copy.copy(self.ovn_lb)
|
||||||
@ -1586,7 +1587,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'Load_Balancer', self.ovn_lb.uuid,
|
'Load_Balancer', self.ovn_lb.uuid,
|
||||||
'external_ids', 'pool_%s:D' % self.pool_id)
|
'external_ids', 'pool_%s:D' % self.pool_id)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_pool_delete_ovn_lb_not_empty(self, lb_empty):
|
def test_pool_delete_ovn_lb_not_empty(self, lb_empty):
|
||||||
lb_empty.return_value = False
|
lb_empty.return_value = False
|
||||||
self.helper.pool_delete(self.pool)
|
self.helper.pool_delete(self.pool)
|
||||||
@ -1595,7 +1596,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'external_ids', 'pool_%s' % self.pool_id)
|
'external_ids', 'pool_%s' % self.pool_id)
|
||||||
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
self.helper.ovn_nbdb_api.lb_del.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_pool_delete_ovn_lb_empty_lb_empty(self, lb_empty):
|
def test_pool_delete_ovn_lb_empty_lb_empty(self, lb_empty):
|
||||||
lb_empty.return_value = True
|
lb_empty.return_value = True
|
||||||
self.helper.pool_delete(self.pool)
|
self.helper.pool_delete(self.pool)
|
||||||
@ -1608,7 +1609,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
'Load_Balancer', self.ovn_lb.uuid,
|
'Load_Balancer', self.ovn_lb.uuid,
|
||||||
('protocol', []))
|
('protocol', []))
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_is_lb_empty')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_is_lb_empty')
|
||||||
def test_pool_delete_ovn_lb_empty_lb_not_empty(self, lb_empty):
|
def test_pool_delete_ovn_lb_empty_lb_not_empty(self, lb_empty):
|
||||||
ovn_lb_udp = copy.copy(self.ovn_lb)
|
ovn_lb_udp = copy.copy(self.ovn_lb)
|
||||||
self.mock_find_ovn_lbs.stop()
|
self.mock_find_ovn_lbs.stop()
|
||||||
@ -1640,7 +1641,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['members'][0]['provisioning_status'],
|
self.assertEqual(status['members'][0]['provisioning_status'],
|
||||||
constants.ACTIVE)
|
constants.ACTIVE)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_add_member')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_add_member')
|
||||||
def test_member_create_exception(self, mock_add_member):
|
def test_member_create_exception(self, mock_add_member):
|
||||||
mock_add_member.side_effect = [RuntimeError]
|
mock_add_member.side_effect = [RuntimeError]
|
||||||
status = self.helper.member_create(self.member)
|
status = self.helper.member_create(self.member)
|
||||||
@ -1762,7 +1763,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertEqual(status['listeners'][0]['id'],
|
self.assertEqual(status['listeners'][0]['id'],
|
||||||
'listener1')
|
'listener1')
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_update_member')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_update_member')
|
||||||
def test_member_update_exception(self, mock_update_member):
|
def test_member_update_exception(self, mock_update_member):
|
||||||
mock_update_member.side_effect = [RuntimeError]
|
mock_update_member.side_effect = [RuntimeError]
|
||||||
status = self.helper.member_update(self.member)
|
status = self.helper.member_update(self.member)
|
||||||
@ -1810,7 +1811,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper.ovn_nbdb_api.db_set.assert_has_calls(
|
self.helper.ovn_nbdb_api.db_set.assert_has_calls(
|
||||||
expected_calls)
|
expected_calls)
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_refresh_lb_vips')
|
'_refresh_lb_vips')
|
||||||
def test_member_delete(self, mock_vip_command):
|
def test_member_delete(self, mock_vip_command):
|
||||||
status = self.helper.member_delete(self.member)
|
status = self.helper.member_delete(self.member)
|
||||||
@ -1851,7 +1852,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
('vips', {}))]
|
('vips', {}))]
|
||||||
self.helper.ovn_nbdb_api.db_set.has_calls(expected_calls)
|
self.helper.ovn_nbdb_api.db_set.has_calls(expected_calls)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_remove_member')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_remove_member')
|
||||||
def test_member_delete_exception(self, mock_remove_member):
|
def test_member_delete_exception(self, mock_remove_member):
|
||||||
mock_remove_member.side_effect = [RuntimeError]
|
mock_remove_member.side_effect = [RuntimeError]
|
||||||
status = self.helper.member_delete(self.member)
|
status = self.helper.member_delete(self.member)
|
||||||
@ -1962,8 +1963,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper.lb_delete_lrp_assoc_handler(lrp)
|
self.helper.lb_delete_lrp_assoc_handler(lrp)
|
||||||
self.mock_add_request.assert_not_called()
|
self.mock_add_request.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_delete_lrp_assoc_no_net_lb_no_r_lb(self, mock_execute):
|
def test_lb_delete_lrp_assoc_no_net_lb_no_r_lb(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -1975,8 +1975,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper._update_lb_to_lr_association.assert_not_called()
|
self.helper._update_lb_to_lr_association.assert_not_called()
|
||||||
mock_execute.assert_not_called()
|
mock_execute.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_delete_lrp_assoc_no_net_lb_r_lb(self, mock_execute):
|
def test_lb_delete_lrp_assoc_no_net_lb_r_lb(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -1993,8 +1992,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper._update_lb_to_lr_association.assert_not_called()
|
self.helper._update_lb_to_lr_association.assert_not_called()
|
||||||
mock_execute.assert_called_once_with(expected)
|
mock_execute.assert_called_once_with(expected)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_delete_lrp_assoc_net_lb_no_r_lb(self, mock_execute):
|
def test_lb_delete_lrp_assoc_net_lb_no_r_lb(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -2007,8 +2005,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.network.load_balancer[0], self.router, delete=True
|
self.network.load_balancer[0], self.router, delete=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_delete_lrp_assoc(self, mock_execute):
|
def test_lb_delete_lrp_assoc(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -2047,8 +2044,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.helper.lb_create_lrp_assoc_handler(lrp)
|
self.helper.lb_create_lrp_assoc_handler(lrp)
|
||||||
self.mock_add_request.assert_not_called()
|
self.mock_add_request.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_create_lrp_assoc(self, mock_execute):
|
def test_lb_create_lrp_assoc(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -2066,8 +2062,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
]
|
]
|
||||||
mock_execute.assert_called_once_with(expected)
|
mock_execute.assert_called_once_with(expected)
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper,
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_execute_commands')
|
||||||
'_execute_commands')
|
|
||||||
def test_lb_create_lrp_assoc_uniq_lb(self, mock_execute):
|
def test_lb_create_lrp_assoc_uniq_lb(self, mock_execute):
|
||||||
info = {
|
info = {
|
||||||
'network': self.network,
|
'network': self.network,
|
||||||
@ -2142,9 +2137,9 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.assertListEqual([], result)
|
self.assertListEqual([], result)
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_del_lb_to_lr_association')
|
ovn_helper.OvnProviderHelper, '_del_lb_to_lr_association')
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_add_lb_to_lr_association')
|
ovn_helper.OvnProviderHelper, '_add_lb_to_lr_association')
|
||||||
def test__update_lb_to_lr_association(self, add, delete):
|
def test__update_lb_to_lr_association(self, add, delete):
|
||||||
self._update_lb_to_lr_association.stop()
|
self._update_lb_to_lr_association.stop()
|
||||||
self.helper._update_lb_to_lr_association(self.ref_lb1, self.router)
|
self.helper._update_lb_to_lr_association(self.ref_lb1, self.router)
|
||||||
@ -2154,9 +2149,9 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
delete.assert_not_called()
|
delete.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_del_lb_to_lr_association')
|
ovn_helper.OvnProviderHelper, '_del_lb_to_lr_association')
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
ovn_driver.OvnProviderHelper, '_add_lb_to_lr_association')
|
ovn_helper.OvnProviderHelper, '_add_lb_to_lr_association')
|
||||||
def test__update_lb_to_lr_association_delete(self, add, delete):
|
def test__update_lb_to_lr_association_delete(self, add, delete):
|
||||||
self._update_lb_to_lr_association.stop()
|
self._update_lb_to_lr_association.stop()
|
||||||
self.helper._update_lb_to_lr_association(
|
self.helper._update_lb_to_lr_association(
|
||||||
@ -2206,7 +2201,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.router.uuid, self.ref_lb1.uuid, if_exists=True)
|
self.router.uuid, self.ref_lb1.uuid, if_exists=True)
|
||||||
self.helper.ovn_nbdb_api.db_set.assert_not_called()
|
self.helper.ovn_nbdb_api.db_set.assert_not_called()
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_find_ls_for_lr')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_find_ls_for_lr')
|
||||||
def test__del_lb_to_lr_association_from_ls(self, f_ls):
|
def test__del_lb_to_lr_association_from_ls(self, f_ls):
|
||||||
# This test if LB is deleted from Logical_Router_Port
|
# This test if LB is deleted from Logical_Router_Port
|
||||||
# Logical_Switch.
|
# Logical_Switch.
|
||||||
@ -2216,7 +2211,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
(mock.call('neutron-xyz', self.ref_lb1.uuid, if_exists=True)),
|
(mock.call('neutron-xyz', self.ref_lb1.uuid, if_exists=True)),
|
||||||
(mock.call('neutron-qwr', self.ref_lb1.uuid, if_exists=True))])
|
(mock.call('neutron-qwr', self.ref_lb1.uuid, if_exists=True))])
|
||||||
|
|
||||||
@mock.patch.object(ovn_driver.OvnProviderHelper, '_find_ls_for_lr')
|
@mock.patch.object(ovn_helper.OvnProviderHelper, '_find_ls_for_lr')
|
||||||
def test__add_lb_to_lr_association(self, f_ls):
|
def test__add_lb_to_lr_association(self, f_ls):
|
||||||
lr_ref = 'foo'
|
lr_ref = 'foo'
|
||||||
f_ls.return_value = ['neutron-xyz', 'neutron-qwr']
|
f_ls.return_value = ['neutron-xyz', 'neutron-qwr']
|
||||||
@ -2488,7 +2483,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.switch_port_event.run(mock.ANY, row, mock.ANY)
|
self.switch_port_event.run(mock.ANY, row, mock.ANY)
|
||||||
self.mock_add_request.assert_not_called()
|
self.mock_add_request.assert_not_called()
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lbs')
|
'_find_ovn_lbs')
|
||||||
def test_vip_port_update_handler_lb_not_found(self, lb):
|
def test_vip_port_update_handler_lb_not_found(self, lb):
|
||||||
lb.side_effect = [idlutils.RowNotFound for _ in range(5)]
|
lb.side_effect = [idlutils.RowNotFound for _ in range(5)]
|
||||||
@ -2502,7 +2497,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
self.switch_port_event.run(mock.ANY, row, mock.ANY)
|
self.switch_port_event.run(mock.ANY, row, mock.ANY)
|
||||||
self.mock_add_request.assert_not_called()
|
self.mock_add_request.assert_not_called()
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lbs')
|
'_find_ovn_lbs')
|
||||||
def test_vip_port_update_handler_multiple_lbs(self, lb):
|
def test_vip_port_update_handler_multiple_lbs(self, lb):
|
||||||
lb1 = mock.MagicMock()
|
lb1 = mock.MagicMock()
|
||||||
@ -2528,7 +2523,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
mock.call(expected_call(lb1)),
|
mock.call(expected_call(lb1)),
|
||||||
mock.call(expected_call(lb2))])
|
mock.call(expected_call(lb2))])
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lbs')
|
'_find_ovn_lbs')
|
||||||
def test_handle_vip_fip_disassociate(self, flb):
|
def test_handle_vip_fip_disassociate(self, flb):
|
||||||
lb = mock.MagicMock()
|
lb = mock.MagicMock()
|
||||||
@ -2545,7 +2540,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
mock.call.db_set('Load_Balancer', lb.uuid, ('vips', {}))]
|
mock.call.db_set('Load_Balancer', lb.uuid, ('vips', {}))]
|
||||||
self.helper.ovn_nbdb_api.assert_has_calls(calls)
|
self.helper.ovn_nbdb_api.assert_has_calls(calls)
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lbs')
|
'_find_ovn_lbs')
|
||||||
def test_handle_vip_fip_associate(self, fb):
|
def test_handle_vip_fip_associate(self, fb):
|
||||||
lb = mock.MagicMock()
|
lb = mock.MagicMock()
|
||||||
@ -2713,10 +2708,10 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
net_cli, action=ovn_const.REQ_INFO_MEMBER_DELETED)
|
net_cli, action=ovn_const.REQ_INFO_MEMBER_DELETED)
|
||||||
|
|
||||||
def test_ovsdb_connections(self):
|
def test_ovsdb_connections(self):
|
||||||
ovn_driver.OvnProviderHelper.ovn_nbdb_api = None
|
ovn_helper.OvnProviderHelper.ovn_nbdb_api = None
|
||||||
ovn_driver.OvnProviderHelper.ovn_nbdb_api_for_events = None
|
ovn_helper.OvnProviderHelper.ovn_nbdb_api_for_events = None
|
||||||
prov_helper1 = ovn_driver.OvnProviderHelper()
|
prov_helper1 = ovn_helper.OvnProviderHelper()
|
||||||
prov_helper2 = ovn_driver.OvnProviderHelper()
|
prov_helper2 = ovn_helper.OvnProviderHelper()
|
||||||
# One connection for API requests
|
# One connection for API requests
|
||||||
self.assertIs(prov_helper1.ovn_nbdb_api,
|
self.assertIs(prov_helper1.ovn_nbdb_api,
|
||||||
prov_helper2.ovn_nbdb_api)
|
prov_helper2.ovn_nbdb_api)
|
||||||
@ -2822,7 +2817,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
ret = self.helper._get_existing_pool_members(self.pool_id)
|
ret = self.helper._get_existing_pool_members(self.pool_id)
|
||||||
self.assertEqual(ret, self.member_line)
|
self.assertEqual(ret, self.member_line)
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lb_by_pool_id')
|
'_find_ovn_lb_by_pool_id')
|
||||||
def test__get_existing_pool_members_exception(self, folbpi):
|
def test__get_existing_pool_members_exception(self, folbpi):
|
||||||
folbpi.return_value = (None, None)
|
folbpi.return_value = (None, None)
|
||||||
@ -2874,7 +2869,7 @@ class TestOvnProviderHelper(TestOvnOctaviaBase):
|
|||||||
ret = self.helper.check_lb_protocol(self.listener_id, 'TCP')
|
ret = self.helper.check_lb_protocol(self.listener_id, 'TCP')
|
||||||
self.assertTrue(ret)
|
self.assertTrue(ret)
|
||||||
|
|
||||||
@mock.patch('ovn_octavia_provider.driver.OvnProviderHelper.'
|
@mock.patch('ovn_octavia_provider.helper.OvnProviderHelper.'
|
||||||
'_find_ovn_lbs')
|
'_find_ovn_lbs')
|
||||||
def test_check_lb_protocol_no_lb(self, fol):
|
def test_check_lb_protocol_no_lb(self, fol):
|
||||||
fol.return_value = None
|
fol.return_value = None
|
||||||
|
Loading…
Reference in New Issue
Block a user