本文整理汇总了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()
示例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
示例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)
示例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
示例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
示例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
示例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)