Exemple #1
0
 def test_get_neutron_client(self, mock_session_loader, mock_auth_loader,
                             mock_client):
     fake_auth = 'Fake_auth_plugin'
     fake_session = 'Fake_session_plugin'
     mock_auth_loader.return_value = fake_auth
     mock_session_loader.return_value = fake_session
     utils.get_neutron_client()
     mock_client.assert_called_once_with(
         auth=fake_auth,
         session=fake_session,
         endpoint_type=cfg.CONF.neutron.endpoint_type)
Exemple #2
0
 def test_get_neutron_client(self, mock_client):
     fake_username = '******'
     fake_tenant_name = 'fake_tenant_name'
     fake_password = '******'
     fake_ca_cert = None
     fake_insecure = False
     fake_timeout = 60
     utils.get_neutron_client(url=self.fake_url, username=fake_username,
                    tenant_name=fake_tenant_name, password=fake_password,
                    auth_url=self.fake_auth_url, ca_cert=fake_ca_cert,
                    insecure=fake_insecure, timeout=fake_timeout)
     mock_client.assert_called_once_with(endpoint_url=self.fake_url,
                    timeout=fake_timeout, username=fake_username,
                    tenant_name=fake_tenant_name, password=fake_password,
                    auth_url=self.fake_auth_url, ca_cert=fake_ca_cert,
                    insecure=fake_insecure)
Exemple #3
0
 def test_get_neutron_client(self, mock_get_keystone_session,
                             mock_get_auth_plugin, mock_client):
     fake_auth = 'Fake_auth_plugin'
     fake_session = 'Fake_session_plugin'
     default_conf_group = 'neutron'
     mock_get_auth_plugin.return_value = fake_auth
     mock_get_keystone_session.return_value = fake_session
     utils.get_neutron_client()
     mock_get_keystone_session.assert_called_once_with(
         default_conf_group, fake_auth)
     mock_get_auth_plugin.assert_called_once_with(default_conf_group)
     neutron_group = getattr(cfg.CONF, kuryr_config.neutron_group.name)
     mock_client.assert_called_once_with(
         auth=fake_auth,
         session=fake_session,
         endpoint_type=neutron_group.endpoint_type)
Exemple #4
0
def setup_loadbalancer_client():
    neutron_client = get_neutron_client()
    if any(ext['alias'] == 'lbaasv2'
           for ext in neutron_client.list_extensions()['extensions']):
        _clients[_LB_CLIENT] = neutron_client
    else:
        # Since Octavia is lbaasv2 API compatible (A superset of it) we'll just
        # wire an extra neutron client instance to point to it
        lbaas_client = utils.get_neutron_client()
        conf_group = utils.kuryr_config.neutron_group.name
        auth_plugin = utils.get_auth_plugin(conf_group)
        octo_httpclient = n_client.construct_http_client(
            session=utils.get_keystone_session(conf_group, auth_plugin),
            service_type='load-balancer')
        lbaas_client.httpclient = octo_httpclient
        _clients[_LB_CLIENT] = lbaas_client
Exemple #5
0
def setup_neutron_client():
    _clients[_NEUTRON_CLIENT] = utils.get_neutron_client()
 def verify_neutron_connection(self):
     neutron = utils.get_neutron_client()
     neutron.list_extensions()