当前位置: 首页>>代码示例>>Python>>正文


Python HTTPClient.authenticate方法代码示例

本文整理汇总了Python中quantumclient.client.HTTPClient.authenticate方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPClient.authenticate方法的具体用法?Python HTTPClient.authenticate怎么用?Python HTTPClient.authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在quantumclient.client.HTTPClient的用法示例。


在下文中一共展示了HTTPClient.authenticate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
    def __init__(self, args_str=None):
        self._args = None
        if not args_str:
            args_str = ' '.join(sys.argv[1:])
        self._parse_args(args_str)

        httpclient = HTTPClient(
            username='admin', tenant_name='demo', password='contrail123',
            # region_name=self._region_name,
            auth_url='http://%s:5000/v2.0' % (self._args.api_server_ip))
        httpclient.authenticate()

        #OS_URL = httpclient.endpoint_url
        OS_URL = 'http://%s:9696/' % (self._args.api_server_ip)
        OS_TOKEN = httpclient.auth_token
        self._quantum = client.Client(
            '2.0', endpoint_url=OS_URL, token=OS_TOKEN)

        self._vnc_lib = VncApi(self._args.admin_user,
                               self._args.admin_password,
                               self._args.admin_tenant_name,
                               self._args.api_server_ip,
                               self._args.api_server_port, '/')

        self._create_vn('public', self._args.public_subnet)
        self._policy_link_vns()
开发者ID:Juniper,项目名称:contrail-controller,代码行数:28,代码来源:demo_cfg.py

示例2: _do_quantum_authentication

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
 def _do_quantum_authentication(self):
     try:
         httpclient = HTTPClient(username=self.username,
                                 tenant_id= self.project_id,
                                 password=self.password,
                                 auth_url=self.auth_url)
         httpclient.authenticate()
     except CommonNetworkClientException, e:
         self.logger.exception('Exception while connection to Quantum')
         raise e
开发者ID:ruchi123,项目名称:contrail-test,代码行数:12,代码来源:quantum_test.py

示例3: __init__

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
    def __init__(self, project, user, passwd, api_server_ip):
        AUTH_URL = 'http://%s:5000/v2.0' % (api_server_ip)
        httpclient = HTTPClient(username=user, tenant_name=project,
                                password=passwd, auth_url=AUTH_URL)
        httpclient.authenticate()

        OS_URL = 'http://%s:9696/' % (api_server_ip)
        OS_TOKEN = httpclient.auth_token
        self._quantum = client.Client('2.0', endpoint_url=OS_URL,
                                      token=OS_TOKEN)
开发者ID:Doude,项目名称:contrail-controller,代码行数:12,代码来源:network.py

示例4: initialize

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
 def initialize(self):
     if not self._url:
         httpclient = HTTPClient(username=self._username,
                                 tenant_name=self._tenant_name,
                                 password=self._password,
                                 region_name=self._region_name,
                                 auth_url=self._auth_url)
         httpclient.authenticate()
         # Populate other password flow attributes
         self._token = httpclient.auth_token
         self._url = httpclient.endpoint_url
开发者ID:akushwah,项目名称:python-quantumclient-n1kv,代码行数:13,代码来源:clientmanager.py

示例5: setUp

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
 def setUp(self):
     super(QuantumFixture, self).setUp()
     project_id = get_plain_uuid(self.project_id)
     try:
         httpclient = HTTPClient(username=self.username,
                                 tenant_id= project_id,
                                 password=self.password,
                                 auth_url=self.auth_url)
         httpclient.authenticate()
     except CommonNetworkClientException, e:
         self.logger.exception('Exception while connection to Quantum')
         raise e
开发者ID:rombie,项目名称:contrail-test,代码行数:14,代码来源:quantum_test.py

示例6: setUp

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
 def setUp(self):
     super(QuantumFixture, self).setUp()
     project_id = get_plain_uuid(self.project_id)
     insecure = bool(os.getenv('OS_INSECURE', True))
     try:
         httpclient = HTTPClient(username=self.username,
                                 tenant_id=project_id,
                                 password=self.password,
                                 auth_url=self.auth_url,
                                 insecure=insecure)
         httpclient.authenticate()
     except CommonNetworkClientException as e:
         self.logger.exception('Exception while connection to Quantum')
         raise e
     OS_URL = httpclient.endpoint_url
     OS_TOKEN = httpclient.auth_token
     self.obj = client.Client(
         '2.0',
         endpoint_url=OS_URL,
         token=OS_TOKEN,
         insecure=insecure)
     self.project_id = httpclient.auth_tenant_id
开发者ID:smusuvat,项目名称:contrail-test,代码行数:24,代码来源:quantum_test.py

示例7: _run

# 需要导入模块: from quantumclient.client import HTTPClient [as 别名]
# 或者: from quantumclient.client.HTTPClient import authenticate [as 别名]
    def _run(self, args_str=None, oper=''):
        self._args = None
        if not args_str:
            args_str = ' '.join(sys.argv[1:])
        self._parse_args(args_str)

        if self._quantum == None:
            httpclient = HTTPClient(username='admin',
                                    tenant_name='demo',
                                    password='contrail123',
                                    # region_name=self._region_name,
                                    auth_url='http://%s:5000/v2.0' % (self._args.api_server_ip))
            httpclient.authenticate()

            #OS_URL = httpclient.endpoint_url
            OS_URL = 'http://%s:9696/' % (self._args.api_server_ip)
            OS_TOKEN = httpclient.auth_token
            self._quantum = client.Client(
                '2.0', endpoint_url=OS_URL, token=OS_TOKEN)

            self._vnc_lib = VncApi(self._args.admin_user,
                                   self._args.admin_password,
                                   self._args.admin_tenant_name,
                                   # self._args.vn_name,
                                   self._args.api_server_ip,
                                   self._args.api_server_port, '/')

            self._proj_obj = self._vnc_lib.project_read(
                fq_name=['default-domain', 'demo'])
            self._ipam_obj = self._vnc_lib.network_ipam_read(
                fq_name=['default-domain', 'default-project', 'default-network-ipam'])

        if self._args.oper == 'add':
            self._create_vn(self._args.vn_name, self._args.public_subnet)
        elif self._args.oper == 'del':
            self._delete_vn(self._args.vn_name)
        elif self._args.oper == 'add-list':
            self._create_vn_list(self._args.vn_list)
开发者ID:alokkumar223,项目名称:contrail-test,代码行数:40,代码来源:vn_oper.py


注:本文中的quantumclient.client.HTTPClient.authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。