def __init__(self, zcc_url, ca_file=None): _url = urlparse.urlparse(zcc_url) _ssl_enabled = False if _url.scheme == 'https': _ssl_enabled = True elif ca_file: LOG.warning( "url is %(url)s which is not https " "but ca_file is configured to %(ca_file)s", { 'url': zcc_url, 'ca_file': ca_file }) if _ssl_enabled and ca_file: self._conn = connector.ZVMConnector(_url.hostname, _url.port, ssl_enabled=_ssl_enabled, verify=ca_file) else: self._conn = connector.ZVMConnector(_url.hostname, _url.port, ssl_enabled=_ssl_enabled, verify=False)
def __init__(self, methodName='runTest'): super(ZVMConnectorTestCase, self).__init__(methodName) self.apibase = api_sample.APITestBase() self.restclient = connector.ZVMConnector(connection_type=CONN_REST, port=8888) self.sockclient = connector.ZVMConnector(connection_type=CONN_SOCKET) self.userid_rest = 'RESTT%03d' % (time.time() % 1000) self.userid_sock = 'SOCKT%03d' % (time.time() % 1000)
def __init__(self, methodName='runTest'): super(ZVMConnectorTestCase, self).__init__(methodName) rest_port = int(CONF.tests.restapi_url.split(':')[2].strip('/')) self.restclient = connector.ZVMConnector(connection_type=CONN_REST, port=rest_port) self.sockclient = connector.ZVMConnector(connection_type=CONN_SOCKET) self.userid_rest = 'RESTT%03d' % (time.time() % 1000) self.userid_sock = 'SOCKT%03d' % (time.time() % 1000) self.image_path = test_utils.TEST_IMAGE_LIST[0][1]
def __init__(self, zcc_url, ca_file=None): _url = urlparse.urlparse(zcc_url) _ssl_enabled = False if _url.scheme == 'https': _ssl_enabled = True elif ca_file: pass if _ssl_enabled and ca_file: self._conn = connector.ZVMConnector(_url.hostname, _url.port, ssl_enabled=_ssl_enabled, verify=ca_file, token_path="/etc/zvmsdk/token.dat") else: self._conn = connector.ZVMConnector(_url.hostname, _url.port, ssl_enabled=_ssl_enabled, verify=False, token_path="/etc/zvmsdk/token.dat")
def __init__(self): _url = urlparse.urlparse(CONF.AGENT.cloud_connector_url) _ca_file = CONF.AGENT.zvm_cloud_connector_ca_file _token_file = CONF.AGENT.zvm_cloud_connector_token_file kwargs = {} if _url.scheme == 'https': kwargs['ssl_enabled'] = True else: kwargs['ssl_enabled'] = False if _token_file is not None: kwargs['token_path'] = _token_file if ((kwargs['ssl_enabled']) and (_ca_file is not None)): kwargs['verify'] = _ca_file else: kwargs['verify'] = False self._conn = connector.ZVMConnector(_url.hostname, _url.port, **kwargs)
def __init__(self): _url = urlparse.urlparse(CONF.zvm_cloud_connector_url) _ca_file = CONF.zvm_ca_file _token_path = CONF.zvm_token_path kwargs = {} # http or https if _url.scheme == 'https': kwargs['ssl_enabled'] = True else: kwargs['ssl_enabled'] = False # token file exist or not if _token_path: kwargs['token_path'] = _token_path # CA file exist or not if kwargs['ssl_enabled'] and _ca_file: kwargs['verify'] = _ca_file else: kwargs['verify'] = False self._conn = connector.ZVMConnector(_url.hostname, _url.port, **kwargs)
def __init__(self): self.client = connector.ZVMConnector(connection_type='socket', ip_addr=CONF.sdkserver.bind_addr, port=CONF.sdkserver.bind_port)
def __init__(self): self.client = connector.ZVMConnector(connection_type='socket', ip_addr=CONF.sdkserver.bind_addr, port=CONF.sdkserver.bind_port) self.dd_semaphore = threading.BoundedSemaphore( value=CONF.wsgi.max_concurrent_deploy_capture)
# Copyright 2017 IBM Corp. from zvmconnector import connector import os print("Setup client: client=connector.ZVMConnector('9.60.18.170', 8080)\n") client = connector.ZVMConnector('9.60.18.170', 8080) print("Test: send_request('vswitch_get_list')") list = client.send_request('vswitch_get_list') print("Result: %s\n" % list) GUEST_USERID = 'DEMOV1S2' print( "Check generated image: send_request('guest_delete', '%s') % GUEST_USERID") info = client.send_request('guest_delete', GUEST_USERID) print('Result: %s\n' % info) print( "Check generated image: send_request('image_query', '%s') % GUEST_USERID") info = client.send_request('guest_get_definition_info', GUEST_USERID) print('Result: %s\n' % info) print('Completed\n')
GUEST_MEMORY = 1024 # in megabytes GUEST_ROOT_DISK_SIZE = 3 # in gigabytes DISK_POOL = 'ECKD:POOL3390' # Image properties IMAGE_PATH = '/data/rhel72eckd.img' IMAGE_OS_VERSION = 'rhel7.2' # Network properties GUEST_IP_ADDR = '192.168.222.200' GATEWAY = '192.168.222.1' CIDR = '192.168.222.0/24' VSWITCH_NAME = 'xcatvsw2' sdk_client = connector.ZVMConnector(connection_type='rest', port='8080') def terminate_guest(userid): """Destroy a virtual machine. Input parameters: :userid: USERID of the guest, last 8 if length > 8 """ res = sdk_client.send_request('guest_delete', userid) if res and 'overallRC' in res and res['overallRC']: print("Error in guest_delete: %s" % res) def describe_guest(userid): """Get virtual machine basic information.
def __init__(self): self.client = connector.ZVMConnector(CONF.sdkserver.bind_addr)
def __init__(self): self.client = connector.ZVMConnector(ip_addr='127.0.0.1', port=8888, connection_type='rest')
""" sample code that deploys a VM. """ import os import sys import time from zvmconnector import connector client = connector.ZVMConnector(connection_type='rest', port=8080) def delete_guest(userid): """ Destroy a virtual machine. Input parameters: :userid: USERID of the guest, last 8 if length > 8 """ # Check if the guest exists. guest_list_info = client.send_request('guest_list') # the string 'userid' need to be coded as 'u'userid' in case of py2 interpreter. userid_1 = (unicode(userid, "utf-8") if sys.version[0] == '2' else userid) if userid_1 not in guest_list_info['output']: RuntimeError("Userid %s does not exist!" % userid) # Delete the guest. guest_delete_info = client.send_request('guest_delete', userid) if guest_delete_info['overallRC']: