Example #1
0
 def setUp(self, plurals={}):
     """Prepare the test environment."""
     super(CLITestV10Base, self).setUp()
     client.Client.EXTED_PLURALS.update(constants.PLURALS)
     client.Client.EXTED_PLURALS.update(plurals)
     self.metadata = {
         'plurals': client.Client.EXTED_PLURALS,
         'xmlns': constants.XML_NS_V10,
         constants.EXT_NS: {
             'prefix': 'http://xxxx.yy.com'
         }
     }
     self.mox = mox.Mox()
     self.endurl = ENDURL
     self.fake_stdout = FakeStdout()
     self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.fake_stdout))
     self.useFixture(
         fixtures.MonkeyPatch(
             'tackerclient.tacker.v1_0.find_resourceid_by_name_or_id',
             self._find_resourceid))
     self.useFixture(
         fixtures.MonkeyPatch(
             'tackerclient.tacker.v1_0.find_resourceid_by_id',
             self._find_resourceid))
     self.useFixture(
         fixtures.MonkeyPatch(
             'tackerclient.v1_0.client.Client.get_attr_metadata',
             self._get_attr_metadata))
     self.client = client.Client(token=TOKEN, endpoint_url=self.endurl)
Example #2
0
    def __init__(self, auth_url, username, password, project_name):
        """Instantiates a Tacker client

        Raises
        ------
            NFVOAgentsException
        """
        auth = v3.Password(auth_url=auth_url,
                           username=username,
                           password=password,
                           project_name=project_name,
                           user_domain_name="default",
                           project_domain_name="default")

        self.session = session.Session(auth=auth)
        self.keystone = keystone_client.Client(session=self.session)
        services = self.keystone.services.list(name='tacker')

        if len(services) == 1:
            endpoint = self.keystone.endpoints.list(service=services[0], interface='public')

            if len(endpoint) == 1:
                self.tacker = tacker_client.Client(session=self.session,
                                                   endpoint_url=endpoint[0].url)
            else:
                raise NFVOAgentsException(ERROR, "Tacker public endpoint not found")

        else:
            raise NFVOAgentsException(ERROR, "Tacker service not found")
Example #3
0
 def tackerclient(cls):
     username = cfg.CONF.keystone_authtoken.username
     password = cfg.CONF.keystone_authtoken.password
     tenant_name = cfg.CONF.keystone_authtoken.project_name
     auth_uri = cfg.CONF.keystone_authtoken.auth_uri + '/v2.0'
     return tacker_client.Client(username=username, password=password,
                              tenant_name=tenant_name,
                              auth_url=auth_uri)
Example #4
0
def tackerclient(request):
    insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
    cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
    c = tacker_client.Client(
        token=request.user.token.id,
        auth_url=base.url_for(request, 'identity'),
        endpoint_url=base.url_for(request, 'nfv-orchestration'),
        insecure=insecure, ca_cert=cacert)
    return c
 def tackerclient(cls):
     vim_params = cls.get_credentials()
     auth = v3.Password(auth_url=vim_params['auth_url'],
         username=vim_params['username'],
         password=vim_params['password'],
         project_name=vim_params['project_name'],
         user_domain_name=vim_params['user_domain_name'],
         project_domain_name=vim_params['project_domain_name'])
     auth_ses = session.Session(auth=auth)
     return tacker_client.Client(session=auth_ses)
Example #6
0
 def __init__(self, name='', args=None):
     super(TackerDriver, self).__init__(name, args=args)
     datasource_driver.ExecutionDriver.__init__(self)
     self.creds = args
     session = ds_utils.get_keystone_session(self.creds)
     self.tacker_client = tacker_client.Client(session=session)
     self.add_executable_client_methods(self.tacker_client,
                                        'tackerclient.v1_0.client')
     self.initialize_update_methods()
     self._init_end_start_poll()
Example #7
0
 def tackerclient(cls):
     vim_params = cls.get_credentials()
     auth = v3.Password(auth_url=vim_params['auth_url'],
         username=vim_params['username'],
         password=vim_params['password'],
         project_name=vim_params['project_name'],
         user_domain_name=vim_params['user_domain_name'],
         project_domain_name=vim_params['project_domain_name'])
     verify = 'True' == vim_params.pop('cert_verify', 'False')
     auth_ses = session.Session(auth=auth, verify=verify)
     return tacker_client.Client(session=auth_ses)
Example #8
0
    def new_client(self):
        self.session = session.Session()
        loader = loading.get_plugin_loader('password')
        self.session.auth = loader.load_from_options(
            auth_url=self.identity_url, username='******', password='******')

        return proxy_client.Client(service_type='nfv-orchestration',
                                   interface='public',
                                   endpoint_type='public',
                                   region_name='RegionOne',
                                   auth_url=self.identity_url,
                                   token=self.token.token_id,
                                   endpoint_url=TACKER_URL)
Example #9
0
def get_tacker_client(other_creds={}):
    sess = os_utils.get_session(other_creds)
    return tackerclient.Client(session=sess)
Example #10
0
def get_tacker_client():
    creds_tacker = os_utils.get_credentials('tacker')
    return tackerclient.Client(**creds_tacker)
Example #11
0
 def tackerclient(cls):
     auth_session = cls.get_auth_session()
     return tacker_client.Client(session=auth_session)
Example #12
0
 def tackerclient(cls):
     vim_params = cls.get_credentials()
     return tacker_client.Client(username=vim_params['username'],
                                 password=vim_params['password'],
                                 tenant_name=vim_params['project_name'],
                                 auth_url=vim_params['auth_url'])
Example #13
0
 def __init__(self, auth_attr):
     auth = identity.Password(**auth_attr)
     sess = session.Session(auth=auth)
     self.client = tacker_client.Client(session=sess)