當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。