Exemple #1
0
    def vitrage_client_for_user(cls):
        """vitrage client for a specific user and tenant

        :rtype: vitrageclient.v1.client.Client
        """
        session = cls._get_session_for_user()
        return vc.Client('1', session=session)
Exemple #2
0
    def client(self):
        if self._client is None:
            if hasattr(self.options, "endpoint"):
                endpoint_override = self.options.endpoint
            else:
                endpoint_override = None

            if profiler and self.options.profile:
                # Initialize the root of the future trace: the created trace
                # ID will be used as the very first parent to which all
                # related traces will be bound to. The given HMAC key must
                # correspond to the one set in vitrage api vitrage.conf,
                # otherwise the latter will fail to check the request
                # signature and will skip initialization of osprofiler on the
                # server side.
                profiler.init(self.options.profile)

            auth_plugin = loading.load_auth_from_argparse_arguments(
                self.options)
            session = loading.load_session_from_argparse_arguments(
                self.options, auth=auth_plugin)

            # noinspection PyAttributeOutsideInit
            self._client = client.Client(
                self.options.vitrage_api_version,
                session=session,
                interface=self.options.interface,
                region_name=self.options.region_name,
                endpoint_override=endpoint_override)

        return self._client
Exemple #3
0
    def vitrage(cls):
        """vitrage client

        :rtype: vitrageclient.v1.client.Client
        """
        if not cls._vitrage:
            cls._vitrage = vc.Client('1', session=cls._get_session_for_admin())
        return cls._vitrage
Exemple #4
0
 def setUpClass(cls):
     super(BaseTopologyTest, cls).setUpClass()
     cls.conf = service.prepare_service([])
     cls.conf.register_opts(list(OPTS), group='keystone_authtoken')
     cls.vitrage_client = \
         v_client.Client('1', session=keystone_client.get_session(cls.conf))
     cls.nova_client = clients.nova_client(cls.conf)
     cls.cinder_client = clients.cinder_client(cls.conf)
Exemple #5
0
 def setUpClass(cls):
     super(BaseApiTest, cls).setUpClass()
     cls.conf = utils.get_conf()
     cls.conf.register_opts(list(OPTS), group='keystone_authtoken')
     cls.vitrage_client = \
         v_client.Client('1', session=keystone_client.get_session(cls.conf))
     cls.nova_client = clients.nova_client(cls.conf)
     cls.cinder_client = clients.cinder_client(cls.conf)
    def vitrage_client_for_user(cls, username, user_domain_id, project_name,
                                project_domain_id):
        """vitrage client for a specific user and tenant

        :rtype: vitrageclient.v1.client.Client
        """
        session = cls._get_session_for_user(username, user_domain_id,
                                            project_name, project_domain_id)
        return vc.Client('1', session=session)
    def vitrage(cls):
        """vitrage client

        :rtype: vitrageclient.v1.client.Client
        """
        if not cls._vitrage:
            cls._vitrage = vc.Client('1',
                                     session=keystone_client.get_session(
                                         cls._conf))
        return cls._vitrage
def vitrageclient(request, password=None):
    endpoint = base.url_for(request, 'identity')
    token_id = request.user.token.id
    tenant_name = request.user.tenant_name
    project_domain_id = request.user.token.project.get('domain_id', 'Default')
    auth = Token(auth_url=endpoint, token=token_id,
                 project_name=tenant_name,
                 project_domain_id=project_domain_id)
    session = Session(auth=auth, timeout=600)
    return vitrage_client.Client('1', session)
Exemple #9
0
    def setUpClass(cls):
        super(BaseApiTest, cls).setUpClass()
        cls.conf = service.prepare_service([])

        cls.vitrage_client = \
            v_client.Client('1', session=keystone_client.get_session(cls.conf))
        cls.nova_client = os_clients.nova_client(cls.conf)
        cls.cinder_client = os_clients.cinder_client(cls.conf)
        cls.neutron_client = os_clients.neutron_client(cls.conf)
        cls.heat_client = os_clients.heat_client(cls.conf)

        cls.num_default_networks = \
            len(cls.neutron_client.list_networks()['networks'])
        cls.num_default_ports = \
            len(cls.neutron_client.list_ports()['ports'])
        cls.num_default_entities = 3
        cls.num_default_edges = 2
Exemple #10
0
 def _create(self):
     return vitrage_client.Client('1', self.context.keystone_session)
Exemple #11
0
def vitrage_client(version, session):
    return vitrageclient.Client(version=version, session=session)
Exemple #12
0
 def setUpClass(cls):
     cls.conf = service.prepare_service([])
     cls.vitrage_client = \
         v_client.Client('1', session=keystone_client.get_session(cls.conf))