From 282b2e9d40c2ce46ee9c71b6695eca71d5d65ab4 Mon Sep 17 00:00:00 2001 From: DavidWein94 Date: Wed, 15 May 2019 21:34:13 +0200 Subject: [PATCH] feat(SecurityGroups):added security groups" * feat(SecurityGroups):added method to create security groups * feat(SecurityGroups):added logger * feat(SecurityGroups):updated thrift file * feat(SecurityGroups):added creation and deletion * feat(SecurityGroups):added udp ports * feat(Linting):fixed lint errors in handler --- .../VirtualMachineHandler.py | 711 +++++---- VirtualMachineService/VirtualMachineServer.py | 10 +- .../VirtualMachineService-remote | 17 +- .../VirtualMachineService.py | 1394 ++++++++++++----- VirtualMachineService/config/config.yml | 38 +- VirtualMachineService/constants.py | 4 +- VirtualMachineService/ttypes.py | 213 +-- portal_client.thrift | 26 +- requirements.txt | 2 +- 9 files changed, 1593 insertions(+), 822 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index b57fa514..139f24a5 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -60,18 +60,19 @@ def create_connection(self): auth_url=self.AUTH_URL, project_name=self.PROJECT_NAME, user_domain_name=self.USER_DOMAIN_NAME, - project_domain_name='default') + project_domain_name="default", + ) conn.authorize() except Exception as e: - self.logger.error( - 'Client failed authentication at Openstack : {0}', e) + self.logger.error("Client failed authentication at Openstack : {0}", e) raise authenticationException( - Reason='Client failed authentication at Openstack') + Reason="Client failed authentication at Openstack" + ) self.logger.info("Connected to Openstack") return conn - def __init__(self,config): + def __init__(self, config): """ Initialize the handler. @@ -81,43 +82,48 @@ def __init__(self,config): self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) # create file handler which logs even debug messages - self.fh = logging.FileHandler('debug.log') + self.fh = logging.FileHandler("debug.log") self.fh.setLevel(logging.DEBUG) # create console handler with a higher log level self.ch = logging.StreamHandler() self.ch.setLevel(logging.INFO) # create formatter and add it to the handlers self.formatter = logging.Formatter( - '%(asctime)s - %(name)s - %(levelname)s - %(message)s') + "%(asctime)s - %(name)s - %(levelname)s - %(message)s" + ) self.fh.setFormatter(self.formatter) self.ch.setFormatter(self.formatter) # add the handlers to the logger self.logger.addHandler(self.fh) self.logger.addHandler(self.ch) - self.USERNAME = os.environ['OS_USERNAME'] - self.PASSWORD = os.environ['OS_PASSWORD'] - self.PROJECT_NAME = os.environ['OS_PROJECT_NAME'] - self.PROJECT_ID = os.environ['OS_PROJECT_ID'] - self.USER_DOMAIN_NAME = os.environ['OS_USER_DOMAIN_NAME'] - self.AUTH_URL = os.environ['OS_AUTH_URL'] + self.USERNAME = os.environ["OS_USERNAME"] + self.PASSWORD = os.environ["OS_PASSWORD"] + self.PROJECT_NAME = os.environ["OS_PROJECT_NAME"] + self.PROJECT_ID = os.environ["OS_PROJECT_ID"] + self.USER_DOMAIN_NAME = os.environ["OS_USER_DOMAIN_NAME"] + self.AUTH_URL = os.environ["OS_AUTH_URL"] self.SSH_PORT = 22 - with open(config, 'r') as ymlfile: + with open(config, "r") as ymlfile: cfg = yaml.load(ymlfile) - self.USE_GATEWAY = cfg['openstack_connection']['use_gateway'] - self.NETWORK = cfg['openstack_connection']['network'] - self.FLOATING_IP_NETWORK = cfg['openstack_connection'][ - 'floating_ip_network'] - self.AVAIALABILITY_ZONE = cfg['openstack_connection'][ - 'availability_zone'] + self.USE_GATEWAY = cfg["openstack_connection"]["use_gateway"] + self.NETWORK = cfg["openstack_connection"]["network"] + self.FLOATING_IP_NETWORK = cfg["openstack_connection"][ + "floating_ip_network" + ] + self.AVAIALABILITY_ZONE = cfg["openstack_connection"]["availability_zone"] + self.DEFAULT_SECURITY_GROUP = cfg['openstack_connection']['default_security_group'] # self.SET_PASSWORD = cfg['openstack_connection']['set_password'] if self.USE_GATEWAY: - self.GATEWAY_BASE = cfg['openstack_connection']['gateway_base'] - self.GATEWAY_IP = cfg['openstack_connection']['gateway_ip'] + self.GATEWAY_BASE = cfg["openstack_connection"]["gateway_base"] + self.GATEWAY_IP = cfg["openstack_connection"]["gateway_ip"] + self.UDP_BASE = cfg["openstack_connection"]["udp_base"] + + self.logger.info("Gateway IP is {}".format(self.GATEWAY_IP)) self.conn = self.create_connection() - @deprecated(version='1.0.0', reason="Not supported at the moment") + @deprecated(version="1.0.0", reason="Not supported at the moment") def setUserPassword(self, user, password): """ Set the password of a user. @@ -126,21 +132,22 @@ def setUserPassword(self, user, password): :param password: The new password. :return: The new password """ - if str(self.SET_PASSWORD) == 'True': + if str(self.SET_PASSWORD) == "True": try: auth = v3.Password( auth_url=self.AUTH_URL, username=self.USERNAME, password=self.PASSWORD, project_name=self.PROJECT_NAME, - user_domain_id='default', - project_domain_id='default') + user_domain_id="default", + project_domain_id="default", + ) sess = session.Session(auth=auth) def findUser(keystone, name): users = keystone.users.list() for user in users: - if user.__dict__['name'] == name: + if user.__dict__["name"] == name: return user keystone = client.Client(session=sess) @@ -149,11 +156,11 @@ def findUser(keystone, name): return password except Exception as e: self.logger.error( - "Set Password for user {0} failed : {1}".format( - user, str(e))) + "Set Password for user {0} failed : {1}".format(user, str(e)) + ) return otherException(Reason=str(e)) else: - raise otherException(Reason='Not allowed') + raise otherException(Reason="Not allowed") def get_Flavors(self): """ @@ -164,15 +171,15 @@ def get_Flavors(self): self.logger.info("Get Flavors") flavors = list() try: - for flav in (list(self.conn.list_flavors(get_extra=True))): - + for flav in list(self.conn.list_flavors(get_extra=True)): flavor = Flavor( - vcpus=flav['vcpus'], - ram=flav['ram'], - disk=flav['disk'], - name=flav['name'], - openstack_id=flav['id'], - tags=list(flav['extra_specs'].keys())) + vcpus=flav["vcpus"], + ram=flav["ram"], + disk=flav["disk"], + name=flav["name"], + openstack_id=flav["id"], + tags=list(flav["extra_specs"].keys()), + ) flavors.append(flavor) return flavors @@ -181,8 +188,9 @@ def get_Flavors(self): return () @deprecated( - version='1.0.0', - reason="Vers. of Denbi API Client and Portalclient won't be compared") + version="1.0.0", + reason="Vers. of Denbi API Client and Portalclient won't be compared", + ) def check_Version(self, version): """ Compare Version. @@ -192,8 +200,8 @@ def check_Version(self, version): """ self.logger.info( "Compare Version : Server Version = {0} " - "|| Client Version = {1}".format( - VERSION, version)) + "|| Client Version = {1}".format(VERSION, version) + ) try: if version == VERSION: return True @@ -209,10 +217,9 @@ def get_client_version(self): :return: Version of the client. """ - #self.logger.info("Get Version of Client: {}".format(VERSION)) + # self.logger.info("Get Version of Client: {}".format(VERSION)) return str(VERSION) - def get_Images(self): """ Get Images. @@ -223,27 +230,29 @@ def get_Images(self): images = list() try: for img in filter( - lambda x: 'tags' in x and len( - x['tags']) > 0 and x['status'] == 'active', - self.conn.list_images()): - - metadata = img['metadata'] - description = metadata.get('description') - tags = img.get('tags') + lambda x: "tags" in x + and len(x["tags"]) > 0 + and x["status"] == "active", + self.conn.list_images(), + ): + + metadata = img["metadata"] + description = metadata.get("description") + tags = img.get("tags") if description is None: - self.logger.warning( - "No Description and for " + img['name']) + self.logger.warning("No Description and for " + img["name"]) image = Image( - name=img['name'], - min_disk=img['min_disk'], - min_ram=img['min_ram'], - status=img['status'], - created_at=img['created_at'], - updated_at=img['updated_at'], - openstack_id=img['id'], + name=img["name"], + min_disk=img["min_disk"], + min_ram=img["min_ram"], + status=img["status"], + created_at=img["created_at"], + updated_at=img["updated_at"], + openstack_id=img["id"], description=description, - tag=tags) + tag=tags, + ) images.append(image) return images @@ -261,25 +270,24 @@ def get_Image_with_Tag(self, id): self.logger.info("Get Image {0} with tags".format(id)) try: images = self.conn.list_images() - img = list(filter(lambda image: image['id'] == id, images))[0] - metadata = img['metadata'] - description = metadata.get('description') - tags = img.get('tags') + img = list(filter(lambda image: image["id"] == id, images))[0] + metadata = img["metadata"] + description = metadata.get("description") + tags = img.get("tags") image = Image( - name=img['name'], - min_disk=img['min_disk'], - min_ram=img['min_ram'], - status=img['status'], - created_at=img['created_at'], - updated_at=img['updated_at'], - openstack_id=img['id'], + name=img["name"], + min_disk=img["min_disk"], + min_ram=img["min_ram"], + status=img["status"], + created_at=img["created_at"], + updated_at=img["updated_at"], + openstack_id=img["id"], description=description, - tag=tags) + tag=tags, + ) return image except Exception as e: - self.logger.error( - "Get Image {0} with Tag Error: {1}".format( - id, e)) + self.logger.error("Get Image {0} with Tag Error: {1}".format(id, e)) return def import_keypair(self, keyname, public_key): @@ -296,19 +304,19 @@ def import_keypair(self, keyname, public_key): self.logger.info("Create Keypair {0}".format(keyname)) keypair = self.conn.compute.create_keypair( - name=keyname, public_key=public_key) + name=keyname, public_key=public_key + ) return keypair elif keypair.public_key != public_key: self.logger.info("Key has changed. Replace old Key") self.conn.compute.delete_keypair(keypair) keypair = self.conn.compute.create_keypair( - name=keyname, public_key=public_key) + name=keyname, public_key=public_key + ) return keypair return keypair except Exception as e: - self.logger.error( - 'Import Keypair {0} error:{1}'.format( - keyname, e)) + self.logger.error("Import Keypair {0} error:{1}".format(keyname, e)) return def get_server(self, openstack_id): @@ -324,82 +332,85 @@ def get_server(self, openstack_id): try: server = self.conn.compute.get_server(openstack_id) except Exception as e: - self.logger.error("No Server found {0} | Error {1}".format(openstack_id,e)) - return VM(status='DELETED') + self.logger.error("No Server found {0} | Error {1}".format(openstack_id, e)) + return VM(status="DELETED") if server is None: self.logger.error("No Server {0}".format(openstack_id)) - raise serverNotFoundException( - Reason="No Server {0}".format(openstack_id)) + raise serverNotFoundException(Reason="No Server {0}".format(openstack_id)) serv = server.to_dict() - if serv['attached_volumes']: - volume_id = serv['attached_volumes'][0]['id'] - diskspace = self.conn.block_storage.get_volume( - volume_id).to_dict()['size'] + if serv["attached_volumes"]: + volume_id = serv["attached_volumes"][0]["id"] + diskspace = self.conn.block_storage.get_volume(volume_id).to_dict()["size"] else: diskspace = 0 - if serv['launched_at']: + if serv["launched_at"]: dt = datetime.datetime.strptime( - serv['launched_at'][:-7], '%Y-%m-%dT%H:%M:%S') + serv["launched_at"][:-7], "%Y-%m-%dT%H:%M:%S" + ) timestamp = time.mktime(dt.timetuple()) else: timestamp = None try: - flav = self.conn.compute.get_flavor(serv['flavor']['id']).to_dict() + flav = self.conn.compute.get_flavor(serv["flavor"]["id"]).to_dict() except Exception as e: self.logger.error(e) - flav=None + flav = None try: - img = self.get_Image_with_Tag(serv['image']['id']) + img = self.get_Image_with_Tag(serv["image"]["id"]) except Exception as e: self.logger.error(e) img = None for values in server.addresses.values(): for address in values: - if address['OS-EXT-IPS:type'] == 'floating': - floating_ip = address['addr'] - elif address['OS-EXT-IPS:type'] == 'fixed': - fixed_ip = address['addr'] + if address["OS-EXT-IPS:type"] == "floating": + floating_ip = address["addr"] + elif address["OS-EXT-IPS:type"] == "fixed": + fixed_ip = address["addr"] if floating_ip: server = VM( flav=Flavor( - vcpus=flav['vcpus'], - ram=flav['ram'], - disk=flav['disk'], - name=flav['name'], - openstack_id=flav['id']), + vcpus=flav["vcpus"], + ram=flav["ram"], + disk=flav["disk"], + name=flav["name"], + openstack_id=flav["id"], + ), img=img, - status=serv['status'], - metadata=serv['metadata'], - project_id=serv['project_id'], - keyname=serv['key_name'], - openstack_id=serv['id'], - name=serv['name'], + status=serv["status"], + metadata=serv["metadata"], + project_id=serv["project_id"], + keyname=serv["key_name"], + openstack_id=serv["id"], + name=serv["name"], created_at=str(timestamp), floating_ip=floating_ip, fixed_ip=fixed_ip, - diskspace=diskspace) + diskspace=diskspace, + ) else: server = VM( flav=Flavor( - vcpus=flav['vcpus'], - ram=flav['ram'], - disk=flav['disk'], - name=flav['name'], - openstack_id=flav['id']), + vcpus=flav["vcpus"], + ram=flav["ram"], + disk=flav["disk"], + name=flav["name"], + openstack_id=flav["id"], + ), img=img, - status=serv['status'], - metadata=serv['metadata'], - project_id=serv['project_id'], - keyname=serv['key_name'], - openstack_id=serv['id'], - name=serv['name'], + status=serv["status"], + metadata=serv["metadata"], + project_id=serv["project_id"], + keyname=serv["key_name"], + openstack_id=serv["id"], + name=serv["name"], created_at=str(timestamp), fixed_ip=fixed_ip, - diskspace=diskspace) + diskspace=diskspace, + ) return server def start_server( @@ -410,7 +421,8 @@ def start_server( servername, elixir_id, diskspace, - volumename): + volumename, + ): """ Start a new Server. @@ -423,76 +435,83 @@ def start_server( :param volumename: Name of the volume :return: {'openstackid': serverId, 'volumeId': volumeId} """ - volumeId = '' + volumeId = "" self.logger.info("Start Server {0}".format(servername)) try: - metadata = {'elixir_id': elixir_id} + metadata = {"elixir_id": elixir_id} image = self.conn.compute.find_image(image) if image is None: - self.logger.error('Image {0} not found!'.format(image)) + self.logger.error("Image {0} not found!".format(image)) raise imageNotFoundException( - Reason=('Image {0} not fournd'.format(image))) + Reason=("Image {0} not fournd".format(image)) + ) flavor = self.conn.compute.find_flavor(flavor) if flavor is None: - self.logger.error('Flavor {0} not found!'.format(flavor)) + self.logger.error("Flavor {0} not found!".format(flavor)) raise flavorNotFoundException( - Reason='Flavor {0} not found!'.format(flavor)) + Reason="Flavor {0} not found!".format(flavor) + ) network = self.conn.network.find_network(self.NETWORK) if network is None: - self.logger.error('Network {0} not found!'.format(network)) + self.logger.error("Network {0} not found!".format(network)) raise networkNotFoundException( - Reason='Network {0} not found!'.format(network)) + Reason="Network {0} not found!".format(network) + ) keyname = elixir_id[:-18] public_key = urllib.parse.unquote(public_key) keypair = self.import_keypair(keyname, public_key) - if diskspace > '0': + if diskspace > "0": self.logger.info( - 'Creating volume with {0} GB diskspace'.format(diskspace)) + "Creating volume with {0} GB diskspace".format(diskspace) + ) try: volume = self.conn.block_storage.create_volume( - name=volumename, size=int(diskspace)).to_dict() + name=volumename, size=int(diskspace) + ).to_dict() except Exception as e: self.logger.error( - 'Trying to create volume with {0}' - ' GB for vm {1} error : {2}'.format( - diskspace, servername, e), exc_info=True) + "Trying to create volume with {0}" + " GB for vm {1} error : {2}".format(diskspace, servername, e), + exc_info=True, + ) raise ressourceException(Reason=str(e)) - volumeId = volume['id'] + volumeId = volume["id"] fileDir = os.path.dirname(os.path.abspath(__file__)) - mount_script = os.path.join(fileDir, 'scripts/bash/mount.sh') - with open(mount_script, 'r') as file: + mount_script = os.path.join(fileDir, "scripts/bash/mount.sh") + with open(mount_script, "r") as file: text = file.read() - text = text.replace('VOLUMEID', 'virtio-' + volumeId[0:20]) - text = encodeutils.safe_encode(text.encode('utf-8')) - init_script = base64.b64encode(text).decode('utf-8') + text = text.replace("VOLUMEID", "virtio-" + volumeId[0:20]) + text = encodeutils.safe_encode(text.encode("utf-8")) + init_script = base64.b64encode(text).decode("utf-8") server = self.conn.compute.create_server( name=servername, image_id=image.id, flavor_id=flavor.id, - networks=[ - { - "uuid": network.id}], + networks=[{"uuid": network.id}], key_name=keypair.name, metadata=metadata, user_data=init_script, - availability_zone=self.AVAIALABILITY_ZONE) + availability_zone=self.AVAIALABILITY_ZONE, + ) else: server = self.conn.compute.create_server( - name=servername, image_id=image.id, flavor_id=flavor.id, - networks=[{"uuid": network.id}], key_name=keypair.name, - metadata=metadata) + name=servername, + image_id=image.id, + flavor_id=flavor.id, + networks=[{"uuid": network.id}], + key_name=keypair.name, + metadata=metadata, + ) + + openstack_id = server.to_dict()["id"] - return { - 'openstackid': server.to_dict()['id'], - 'volumeId': volumeId} + return {"openstackid": openstack_id, "volumeId": volumeId} except Exception as e: - self.logger.error( - 'Start Server {1} error:{0}'.format( - e, servername)) + self.logger.exception("Start Server {1} error:{0}".format(e, servername)) return {} def create_volume(self, volume_name, diskspace): @@ -503,17 +522,18 @@ def create_volume(self, volume_name, diskspace): :param diskspace: Diskspace in GB for new volume :return: Id of new volume """ - self.logger.info( - 'Creating volume with {0} GB diskspace'.format(diskspace)) + self.logger.info("Creating volume with {0} GB diskspace".format(diskspace)) try: volume = self.conn.block_storage.create_volume( - name=volume_name, size=int(diskspace)).to_dict() - volumeId = volume['id'] + name=volume_name, size=int(diskspace) + ).to_dict() + volumeId = volume["id"] return volumeId except Exception as e: self.logger.error( - 'Trying to create volume with {0} GB error : {1}'.format( - diskspace, e), exc_info=True) + "Trying to create volume with {0} GB error : {1}".format(diskspace, e), + exc_info=True, + ) raise ressourceException(Reason=str(e)) def attach_volume_to_server(self, openstack_id, volume_id): @@ -524,18 +544,18 @@ def attach_volume_to_server(self, openstack_id, volume_id): :param volume_id: Id of volume :return: True if attached, False if not """ + def checkStatusVolume(volume, conn): self.logger.info("Checking Status Volume {0}".format(volume_id)) done = False while not done: - status = conn.block_storage.get_volume( - volume).to_dict()['status'] - self.logger.info("Volume {} Status:{}".format(volume_id,status)) - if status =='in-use': + status = conn.block_storage.get_volume(volume).to_dict()["status"] + self.logger.info("Volume {} Status:{}".format(volume_id, status)) + if status == "in-use": return False - if status != 'available': + if status != "available": time.sleep(3) else: @@ -546,20 +566,25 @@ def checkStatusVolume(volume, conn): server = self.conn.compute.get_server(openstack_id) if server is None: self.logger.error("No Server {0} ".format(openstack_id)) - raise serverNotFoundException( - Reason='No Server {0}'.format(openstack_id)) + raise serverNotFoundException(Reason="No Server {0}".format(openstack_id)) if checkStatusVolume(volume_id, self.conn): self.logger.info( - 'Attaching volume {0} to virtualmachine {1}'.format( - volume_id, openstack_id)) + "Attaching volume {0} to virtualmachine {1}".format( + volume_id, openstack_id + ) + ) try: self.conn.compute.create_volume_attachment( - server=server, volumeId=volume_id) + server=server, volumeId=volume_id + ) except Exception as e: self.logger.error( - 'Trying to attache volume {0} to vm {1} error : {2}'.format( - volume_id, openstack_id, e), exc_info=True) + "Trying to attache volume {0} to vm {1} error : {2}".format( + volume_id, openstack_id, e + ), + exc_info=True, + ) self.logger.info("Delete Volume {0}".format(volume_id)) self.conn.block_storage.delete_volume(volume=volume_id) return False @@ -579,7 +604,7 @@ def check_server_status(self, openstack_id, diskspace, volume_id): """ # TODO: Remove diskspace param, if volume_id exist it can be attached # diskspace not need - self.logger.info('Check Status VM {0}'.format(openstack_id)) + self.logger.info("Check Status VM {0}".format(openstack_id)) try: server = self.conn.compute.get_server(openstack_id) except Exception: @@ -591,7 +616,7 @@ def check_server_status(self, openstack_id, diskspace, volume_id): serv = server.to_dict() try: - if serv['status'] == 'ACTIVE': + if serv["status"] == "ACTIVE": host = self.get_server(openstack_id).floating_ip port = self.SSH_PORT @@ -602,39 +627,93 @@ def check_server_status(self, openstack_id, diskspace, volume_id): port = int(self.GATEWAY_BASE) + int(server_base) * 3 elif self.get_server(openstack_id).floating_ip is None: host = self.add_floating_ip_to_server( - openstack_id, self.FLOATING_IP_NETWORK) + openstack_id, self.FLOATING_IP_NETWORK + ) if self.netcat(host, port): if diskspace > 0: attached = self.attach_volume_to_server( - openstack_id=openstack_id, volume_id=volume_id) + openstack_id=openstack_id, volume_id=volume_id + ) if attached is False: server = self.get_server(openstack_id) self.delete_server(openstack_id=openstack_id) - server.status = 'DESTROYED' + server.status = "DESTROYED" return server return self.get_server(openstack_id) return self.get_server(openstack_id) else: server = self.get_server(openstack_id) - server.status = 'PORT_CLOSED' + server.status = "PORT_CLOSED" return server else: server = self.get_server(openstack_id) - server.status = 'BUILD' + server.status = "BUILD" return server except Exception as e: - self.logger.error( - 'Check Status VM {0} error: {1}'.format( - openstack_id, e)) + self.logger.error("Check Status VM {0} error: {1}".format(openstack_id, e)) return None - def get_IP_PORT(self, openstack_id): + def add_security_group_to_server(self, http, https, udp, server_id): + """ + Adds the default simple vm security group to the vm. + Also adds a security group which can open http,https and udp ports. + :param http: If http ports should be open + :param https: If https ports should be open + :param udp: If udp ports should be open + :param server_id: The id of the server + :return: + """ + + standart_default_security_group = self.conn.network.find_security_group( + name_or_id='default') + default_security_group_simple_vm = self.conn.network.get_security_group( + security_group=self.DEFAULT_SECURITY_GROUP) + + if standart_default_security_group: + self.logger.info("Remove default OpenStack security from {}".format(server_id)) + + self.conn.compute.remove_security_group_from_server(server=server_id, + security_group=standart_default_security_group) + if default_security_group_simple_vm: + self.logger.info( + "Add default simple vm security group {} to {}".format(self.DEFAULT_SECURITY_GROUP, + server_id)) + self.conn.compute.add_security_group_to_server( + server=server_id, security_group=default_security_group_simple_vm + ) + + ip_base = \ + list(self.conn.compute.server_ips(server=server_id))[0].to_dict()['address'].split(".")[-1] + + udp_port_start = int(ip_base) * 10 + int(self.UDP_BASE) + + security_group = self.conn.network.find_security_group(name_or_id=server_id) + if security_group: + self.conn.compute.remove_security_group_from_server(server=server_id, + security_group=security_group) + self.conn.network.delete_security_group(security_group) + + security_group = self.create_security_group( + name=server_id, + udp_port_start=udp_port_start, + udp=udp, + ssh=True, + https=https, + http=http, + ) + self.conn.compute.add_security_group_to_server( + server=server_id, security_group=security_group + ) + + return True + + def get_ip_ports(self, openstack_id): """ Get Ip and Port of the sever. :param openstack_id: Id of the server - :return: {'IP': ip, 'PORT': port} + :return: {'IP': ip, 'PORT': port, 'UDP':start_port} """ self.logger.info("Get IP and PORT for server {0}".format(openstack_id)) @@ -644,15 +723,17 @@ def get_IP_PORT(self, openstack_id): server = self.get_server(openstack_id) server_base = server.fixed_ip.split(".")[-1] port = int(self.GATEWAY_BASE) + int(server_base) * 3 - return {'IP': str(self.GATEWAY_IP), 'PORT': str(port)} + udp_port_start = int(server_base) * 10 + int(self.UDP_BASE) + return {"IP": str(self.GATEWAY_IP), "PORT": str(port), "UDP": str(udp_port_start)} else: + # todo security groups floating ips floating_ip = self.get_server(openstack_id) - return {'IP': str(floating_ip)} + return {"IP": str(floating_ip)} except Exception as e: self.logger.error( - "Get IP and PORT for server {0} error:".format( - openstack_id, e)) + "Get IP and PORT for server {0} error:".format(openstack_id, e) + ) return {} def create_snapshot(self, openstack_id, name, elixir_id, base_tag): @@ -665,29 +746,33 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tag): :param base_tag: Tag with which the servers image is also tagged :return: Id of the new Snapshot """ - self.logger.info(base_tag) self.logger.info( - 'Create Snapshot from Instance {0} with name {1} for {2}'.format( - openstack_id, name, elixir_id)) + "Create Snapshot from Instance {0} with name {1} for {2}".format( + openstack_id, name, elixir_id + ) + ) try: snapshot_munch = self.conn.create_image_snapshot( - server=openstack_id, name=name) + server=openstack_id, name=name + ) except Exception: self.logger.error("Instance {0} not found".format(openstack_id)) return try: - snapshot_id = snapshot_munch['id'] + snapshot_id = snapshot_munch["id"] self.conn.image.add_tag(image=snapshot_id, tag=elixir_id) self.conn.image.add_tag( - image=snapshot_id, - tag='snapshot_image:{0}'.format(base_tag)) + image=snapshot_id, tag="snapshot_image:{0}".format(base_tag) + ) return snapshot_id except Exception as e: self.logger.error( - 'Create Snapshot from Instance {0}' - ' with name {1} for {2} error : {3}'.format( - openstack_id, name, elixir_id, e)) + "Create Snapshot from Instance {0}" + " with name {1} for {2} error : {3}".format( + openstack_id, name, elixir_id, e + ) + ) return def delete_image(self, image_id): @@ -697,19 +782,18 @@ def delete_image(self, image_id): :param image_id: Id of the image :return: True if deleted, False if not """ - self.logger.info('Delete Image {0}'.format(image_id)) + self.logger.info("Delete Image {0}".format(image_id)) try: image = self.conn.compute.get_image(image_id) if image is None: - self.logger.error('Image {0} not found!'.format(image)) + self.logger.error("Image {0} not found!".format(image)) raise imageNotFoundException( - Reason=('Image {0} not found'.format(image))) + Reason=("Image {0} not found".format(image)) + ) self.conn.compute.delete_image(image) return True except Exception as e: - self.logger.error( - 'Delete Image {0} error : {1}'.format( - image_id, e)) + self.logger.error("Delete Image {0} error : {1}".format(image_id, e)) return False def add_floating_ip_to_server(self, openstack_id, network): @@ -724,42 +808,45 @@ def add_floating_ip_to_server(self, openstack_id, network): server = self.conn.compute.get_server(openstack_id) if server is None: - self.logger.error( - "Instance {0} not found".format(openstack_id)) + self.logger.error("Instance {0} not found".format(openstack_id)) raise serverNotFoundException self.logger.info("Checking if Server already got an Floating Ip") for values in server.addresses.values(): for address in values: - if address['OS-EXT-IPS:type'] == 'floating': - return address['addr'] + if address["OS-EXT-IPS:type"] == "floating": + return address["addr"] self.logger.info("Checking if unused Floating-Ip exist") for floating_ip in self.conn.network.ips(): if not floating_ip.fixed_ip_address: self.conn.compute.add_floating_ip_to_server( - server, floating_ip.floating_ip_address) + server, floating_ip.floating_ip_address + ) self.logger.info( "Adding existing Floating IP {0} to {1}".format( - str(floating_ip.floating_ip_address), - openstack_id)) + str(floating_ip.floating_ip_address), openstack_id + ) + ) return str(floating_ip.floating_ip_address) networkID = self.conn.network.find_network(network) if networkID is None: self.logger.error("Network " + network + " not found") raise networkNotFoundException - networkID = networkID.to_dict()['id'] - floating_ip = self.conn.network.create_ip( - floating_network_id=networkID) + networkID = networkID.to_dict()["id"] + floating_ip = self.conn.network.create_ip(floating_network_id=networkID) floating_ip = self.conn.network.get_ip(floating_ip) self.conn.compute.add_floating_ip_to_server( - server, floating_ip.floating_ip_address) + server, floating_ip.floating_ip_address + ) return floating_ip except Exception as e: self.logger.error( "Adding Floating IP to {0} with network {1} error:{2}".format( - openstack_id, network, e)) + openstack_id, network, e + ) + ) return def netcat(self, host, port): @@ -771,14 +858,11 @@ def netcat(self, host, port): :return: True if successfully connected, False if not """ self.logger.info("Checking SSH Connection {0}:{1}".format(host, port)) - return True - - with closing( - socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: + with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: r = sock.connect_ex((host, port)) self.logger.info( - "Checking SSH Connection {0}:{1} Result = {2}".format( - host, port, r)) + "Checking SSH Connection {0}:{1} Result = {2}".format(host, port, r) + ) if r == 0: return True else: @@ -795,23 +879,26 @@ def delete_server(self, openstack_id): try: server = self.conn.compute.get_server(openstack_id) if server is None: - self.logger.error( - "Instance {0} not found".format(openstack_id)) + self.logger.error("Instance {0} not found".format(openstack_id)) raise serverNotFoundException - if server.status == 'SUSPENDED': + if server.status == "SUSPENDED": self.conn.compute.resume_server(server) server = self.conn.compute.get_server(server) - while server.status != 'ACTIVE': - server = self.conn.compute.get_server(server) - time.sleep(3) + self.conn.compute.wait_for_server(server=server, status='ACTIVE') + self.logger.info(server) + self.logger.info(server.name) + security_group = self.conn.network.find_security_group(name_or_id=openstack_id) + if security_group: + self.logger.info("Delete security group {}".format(openstack_id)) + self.conn.compute.remove_security_group_from_server(server=server, + security_group=security_group) + self.conn.network.delete_security_group(security_group) self.conn.compute.delete_server(server) return True except Exception as e: - self.logger.error( - "Delete Server {0} error: {1}".format( - openstack_id, e)) + self.logger.error("Delete Server {0} error: {1}".format(openstack_id, e)) return False def delete_volume_attachment(self, volume_id, server_id): @@ -823,24 +910,24 @@ def delete_volume_attachment(self, volume_id, server_id): :return: True if deleted, False if not """ try: - attachments = self.conn.block_storage.get_volume( - volume_id).attachments + attachments = self.conn.block_storage.get_volume(volume_id).attachments for attachment in attachments: - volume_attachment_id = attachment['id'] - instance_id = attachment['server_id'] + volume_attachment_id = attachment["id"] + instance_id = attachment["server_id"] if instance_id == server_id: self.logger.info( - - "Delete Volume Attachment {0}".format( - volume_attachment_id)) + "Delete Volume Attachment {0}".format(volume_attachment_id) + ) self.conn.compute.delete_volume_attachment( - volume_attachment=volume_attachment_id, - server=server_id) + volume_attachment=volume_attachment_id, server=server_id + ) return True except Exception as e: - self.logger.error( + self.logger.exception( "Delete Volume Attachment {0} error: {1}".format( - volume_attachment_id, e)) + volume_attachment_id, e + ) + ) return False def delete_volume(self, volume_id): @@ -850,15 +937,15 @@ def delete_volume(self, volume_id): :param volume_id: Id of the volume :return: True if deleted, False if not """ + def checkStatusVolume(volume, conn): self.logger.info("Checking Status Volume {0}".format(volume_id)) done = False while not done: - status = conn.block_storage.get_volume( - volume).to_dict()['status'] + status = conn.block_storage.get_volume(volume).to_dict()["status"] - if status != 'available': + if status != "available": time.sleep(3) else: @@ -885,14 +972,13 @@ def stop_server(self, openstack_id): server = self.conn.compute.get_server(openstack_id) try: if server is None: - self.logger.error( - "Instance {0} not found".format(openstack_id)) + self.logger.error("Instance {0} not found".format(openstack_id)) raise serverNotFoundException - if server.status == 'ACTIVE': + if server.status == "ACTIVE": self.conn.compute.suspend_server(server) server = self.conn.compute.get_server(server) - while server.status != 'SUSPENDED': + while server.status != "SUSPENDED": server = self.conn.compute.get_server(server) time.sleep(3) @@ -923,9 +1009,9 @@ def reboot_server(self, server_id, reboot_type): self.conn.compute.reboot_server(server, reboot_type) return True except Exception as e: - self.logger.info( - "Reboot Server {} {} Error : {}".format( - server_id, reboot_type, e)) + self.logger.exception( + "Reboot Server {} {} Error : {}".format(server_id, reboot_type, e) + ) return False def resume_server(self, openstack_id): @@ -939,13 +1025,12 @@ def resume_server(self, openstack_id): try: server = self.conn.compute.get_server(openstack_id) if server is None: - self.logger.error( - "Instance {0} not found".format(openstack_id)) + self.logger.error("Instance {0} not found".format(openstack_id)) raise serverNotFoundException - if server.status == 'SUSPENDED': + if server.status == "SUSPENDED": self.conn.compute.resume_server(server) - while server.status != 'ACTIVE': + while server.status != "ACTIVE": server = self.conn.compute.get_server(server) time.sleep(3) @@ -954,11 +1039,93 @@ def resume_server(self, openstack_id): return False except Exception as e: - self.logger.error( - "Resume Server {0} error:".format( - openstack_id, e)) + self.logger.error("Resume Server {0} error:".format(openstack_id, e)) return False + def create_security_group( + self, name, udp_port_start=None, ssh=True, http=False, https=False, udp=False + ): + self.logger.info("Create new security group {}".format(name)) + new_security_group = self.conn.network.create_security_group(name=name) + if http: + self.logger.info("Add http rule to security group {}".format(name)) + self.conn.network.create_security_group_rule( + direction="ingress", + protocol="tcp", + port_range_max=80, + port_range_min=80, + security_group_id=new_security_group["id"], + ) + self.conn.network.create_security_group_rule( + direction="ingress", + ether_type="IPv6", + protocol="tcp", + port_range_max=80, + port_range_min=80, + security_group_id=new_security_group["id"], + ) + + if https: + self.logger.info("Add https rule to security group {}".format(name)) + + self.conn.network.create_security_group_rule( + direction="ingress", + protocol="tcp", + port_range_max=443, + port_range_min=443, + security_group_id=new_security_group["id"], + ) + self.conn.network.create_security_group_rule( + direction="ingress", + ether_type="IPv6", + protocol="tcp", + port_range_max=443, + port_range_min=443, + security_group_id=new_security_group["id"], + ) + if udp: + self.logger.info( + "Add udp rule ports {} - {} to security group {}".format( + udp_port_start, udp_port_start + 9, name + ) + ) + + self.conn.network.create_security_group_rule( + direction="ingress", + protocol="udp", + port_range_max=udp_port_start + 9, + port_range_min=udp_port_start, + security_group_id=new_security_group["id"], + ) + self.conn.network.create_security_group_rule( + direction="ingress", + ether_type="IPv6", + protocol="udp", + port_range_max=udp_port_start + 9, + port_range_min=udp_port_start, + security_group_id=new_security_group["id"], + ) + if ssh: + self.logger.info("Add ssh rule to security group {}".format(name)) + + self.conn.network.create_security_group_rule( + direction="ingress", + protocol="tcp", + port_range_max=22, + port_range_min=22, + security_group_id=new_security_group["id"], + ) + self.conn.network.create_security_group_rule( + direction="ingress", + ether_type="IPv6", + protocol="tcp", + port_range_max=22, + port_range_min=22, + security_group_id=new_security_group["id"], + ) + + return new_security_group + def get_limits(self): """ Get the Limits. @@ -976,15 +1143,15 @@ def get_limits(self): self.logger.info("Get Limits") limits = self.conn.get_compute_limits() limits.update(self.conn.get_volume_limits()) - maxTotalVolumes = str(limits['absolute']['maxTotalVolumes']) - maxTotalInstances = str(limits['max_total_instances']) - maxTotalVolumeGigabytes = str( - limits['absolute']['maxTotalVolumeGigabytes']) - totalRamUsed = str(limits['total_ram_used']) - totalInstancesUsed = str(limits['total_instances_used']) + maxTotalVolumes = str(limits["absolute"]["maxTotalVolumes"]) + maxTotalInstances = str(limits["max_total_instances"]) + maxTotalVolumeGigabytes = str(limits["absolute"]["maxTotalVolumeGigabytes"]) + totalRamUsed = str(limits["total_ram_used"]) + totalInstancesUsed = str(limits["total_instances_used"]) return { - 'maxTotalVolumes': maxTotalVolumes, - 'maxTotalVolumeGigabytes': maxTotalVolumeGigabytes, - 'maxTotalInstances': maxTotalInstances, - 'totalRamUsed': totalRamUsed, - 'totalInstancesUsed': totalInstancesUsed} + "maxTotalVolumes": maxTotalVolumes, + "maxTotalVolumeGigabytes": maxTotalVolumeGigabytes, + "maxTotalInstances": maxTotalInstances, + "totalRamUsed": totalRamUsed, + "totalInstancesUsed": totalInstancesUsed, + } diff --git a/VirtualMachineService/VirtualMachineServer.py b/VirtualMachineService/VirtualMachineServer.py index 0d2cee8a..ec635fef 100644 --- a/VirtualMachineService/VirtualMachineServer.py +++ b/VirtualMachineService/VirtualMachineServer.py @@ -3,9 +3,12 @@ try: from VirtualMachineService import Client, Processor - from VirtualMachineHandler import VirtualMachineHandler -except Exception as e: +except Exception: from .VirtualMachineService import Client, Processor + +try: + from VirtualMachineHandler import VirtualMachineHandler +except Exception: from .VirtualMachineHandler import VirtualMachineHandler from thrift.transport import TSSLSocket @@ -60,8 +63,9 @@ def check_environment_variables(envs): def check_env(var): if var not in os.environ: click.echo("ERROR: There is no {} set in environment.".format(var)) - click.echo("Please make sure you have sourced your openstack rc file") + click.echo("Please make sure you have sourced your OpenStack rc file") sys.exit() + list(map(lambda var: check_env(var), envs)) diff --git a/VirtualMachineService/VirtualMachineService-remote b/VirtualMachineService/VirtualMachineService-remote index f6db22f5..1376ab87 100755 --- a/VirtualMachineService/VirtualMachineService-remote +++ b/VirtualMachineService/VirtualMachineService-remote @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.12.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -27,7 +27,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' bool check_Version(double version)') print(' string get_client_version()') print(' string import_keypair(string keyname, string public_key)') - print(' get_IP_PORT(string openstack_id)') + print(' get_ip_ports(string openstack_id)') print(' get_Flavors()') print(' get_Images()') print(' Image get_Image_with_Tag(string openstack_id)') @@ -37,6 +37,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' string add_floating_ip_to_server(string openstack_id, string network)') print(' bool create_connection(string username, string password, string auth_url, string user_domain_name, string project_domain_name)') print(' start_server(string flavor, string image, string public_key, string servername, string elixir_id, string diskspace, string volumename)') + print(' bool add_security_group_to_server(bool http, bool https, bool udp, string server_id)') print(' VM get_server(string openstack_id)') print(' bool stop_server(string openstack_id)') print(' string create_snapshot(string openstack_id, string name, string elixir_id, string base_tag)') @@ -147,11 +148,11 @@ elif cmd == 'import_keypair': sys.exit(1) pp.pprint(client.import_keypair(args[0], args[1],)) -elif cmd == 'get_IP_PORT': +elif cmd == 'get_ip_ports': if len(args) != 1: - print('get_IP_PORT requires 1 args') + print('get_ip_ports requires 1 args') sys.exit(1) - pp.pprint(client.get_IP_PORT(args[0],)) + pp.pprint(client.get_ip_ports(args[0],)) elif cmd == 'get_Flavors': if len(args) != 0: @@ -207,6 +208,12 @@ elif cmd == 'start_server': sys.exit(1) pp.pprint(client.start_server(args[0], args[1], args[2], args[3], args[4], args[5], args[6],)) +elif cmd == 'add_security_group_to_server': + if len(args) != 4: + print('add_security_group_to_server requires 4 args') + sys.exit(1) + pp.pprint(client.add_security_group_to_server(eval(args[0]), eval(args[1]), eval(args[2]), args[3],)) + elif cmd == 'get_server': if len(args) != 1: print('get_server requires 1 args') diff --git a/VirtualMachineService/VirtualMachineService.py b/VirtualMachineService/VirtualMachineService.py index 4111e88e..58c6f81e 100644 --- a/VirtualMachineService/VirtualMachineService.py +++ b/VirtualMachineService/VirtualMachineService.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.12.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -8,21 +8,26 @@ from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + import sys import logging from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport +all_structs = [] class Iface(object): """ This VirtualMachiine service deploys methods for creating,deleting,stopping etc. VirtualMachines in Openstack. + """ def check_Version(self, version): """ Parameters: - version + """ pass @@ -30,6 +35,7 @@ def get_client_version(self): """ Get Client version. Returns Version of the client + """ pass @@ -41,16 +47,18 @@ def import_keypair(self, keyname, public_key): Parameters: - keyname: Name for the keypair - public_key: The public key + """ pass - def get_IP_PORT(self, openstack_id): + def get_ip_ports(self, openstack_id): """ Get Ip and Port of server - Returns: {'IP': ip, 'PORT': port} + Returns: {'IP': ip, 'PORT': port,'UDP':udp} Parameters: - openstack_id: Id of server + """ pass @@ -58,6 +66,7 @@ def get_Flavors(self): """ Get Flavors. Returns: List of flavor instances. + """ pass @@ -65,6 +74,7 @@ def get_Images(self): """ Get Images. Returns: List of Image instances. + """ pass @@ -75,6 +85,7 @@ def get_Image_with_Tag(self, openstack_id): Parameters: - openstack_id + """ pass @@ -85,6 +96,7 @@ def delete_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ pass @@ -93,6 +105,7 @@ def add_metadata_to_server(self, servername, metadata): Parameters: - servername - metadata + """ pass @@ -101,6 +114,7 @@ def delete_metadata_from_server(self, servername, keys): Parameters: - servername - keys + """ pass @@ -112,6 +126,7 @@ def add_floating_ip_to_server(self, openstack_id, network): Parameters: - openstack_id: Id of the server - network: Network name of the network which provides the floating Ip. + """ pass @@ -129,6 +144,7 @@ def create_connection(self, username, password, auth_url, user_domain_name, proj /** Domain name of OpenStack - project_domain_name: Project domain name of OpenStack + """ pass @@ -144,6 +160,20 @@ def start_server(self, flavor, image, public_key, servername, elixir_id, diskspa - elixir_id: Elixir-Id of the user who requested to start a new server - diskspace: Diskspace in GB for additional volume. - volumename: Name of additional Volume + + """ + pass + + def add_security_group_to_server(self, http, https, udp, server_id): + """ + Adds a security group to a server + + Parameters: + - http: If http ports are open + - https: If https ports are open + - udp: If udp ports are open + - server_id: OpenStack id of the server + """ pass @@ -154,6 +184,7 @@ def get_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ pass @@ -164,6 +195,7 @@ def stop_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ pass @@ -178,6 +210,7 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tag): - name: Name of new Snapshot - elixir_id: Elixir-Id of the user who requested creation of Snapshot - base_tag: Tag with which the servers image is also tagged ( for connection information at the webapp) + """ pass @@ -187,6 +220,7 @@ def get_limits(self): Returns: {'maxTotalVolumes': maxTotalVolumes, 'maxTotalVolumeGigabytes': maxTotalVolumeGigabytes, 'maxTotalInstances': maxTotalInstances, 'totalRamUsed': totalRamUsed, 'totalInstancesUsed': totalInstancesUsed} + """ pass @@ -197,6 +231,7 @@ def delete_image(self, image_id): Parameters: - image_id: Id of image + """ pass @@ -208,6 +243,7 @@ def delete_volume_attachment(self, volume_id, server_id): Parameters: - volume_id: Id of the attached volume - server_id: Id of the server where the volume is attached + """ pass @@ -218,6 +254,7 @@ def delete_volume(self, volume_id): Parameters: - volume_id + """ pass @@ -229,6 +266,7 @@ def attach_volume_to_server(self, openstack_id, volume_id): Parameters: - openstack_id: Id of server - volume_id: Id of volume + """ pass @@ -241,6 +279,7 @@ def check_server_status(self, openstack_id, diskspace, volume_id): - openstack_id: Id of the server - diskspace: diskspace of server(volume will be attached if server is active and diskpace >0) - volume_id: Id of the volume + """ pass @@ -252,6 +291,7 @@ def setUserPassword(self, user, password): Parameters: - user: Elixir-Id of the user which wants to set a password - password: New password + """ pass @@ -262,6 +302,7 @@ def resume_server(self, openstack_id): Parameters: - openstack_id: Id of the server + """ pass @@ -273,6 +314,7 @@ def create_volume(self, volume_name, diskspace): Parameters: - volume_name: Name of volume - diskspace: Diskspace in GB for new volume + """ pass @@ -284,6 +326,7 @@ def reboot_server(self, server_id, reboot_type): Parameters: - server_id: Id of the server - reboot_type: HARD or SOFT + """ pass @@ -291,6 +334,7 @@ def reboot_server(self, server_id, reboot_type): class Client(Iface): """ This VirtualMachiine service deploys methods for creating,deleting,stopping etc. VirtualMachines in Openstack. + """ def __init__(self, iprot, oprot=None): self._iprot = self._oprot = iprot @@ -302,6 +346,7 @@ def check_Version(self, version): """ Parameters: - version + """ self.send_check_Version(version) return self.recv_check_Version() @@ -333,6 +378,7 @@ def get_client_version(self): """ Get Client version. Returns Version of the client + """ self.send_get_client_version() return self.recv_get_client_version() @@ -367,6 +413,7 @@ def import_keypair(self, keyname, public_key): Parameters: - keyname: Name for the keypair - public_key: The public key + """ self.send_import_keypair(keyname, public_key) return self.recv_import_keypair() @@ -395,26 +442,27 @@ def recv_import_keypair(self): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "import_keypair failed: unknown result") - def get_IP_PORT(self, openstack_id): + def get_ip_ports(self, openstack_id): """ Get Ip and Port of server - Returns: {'IP': ip, 'PORT': port} + Returns: {'IP': ip, 'PORT': port,'UDP':udp} Parameters: - openstack_id: Id of server + """ - self.send_get_IP_PORT(openstack_id) - return self.recv_get_IP_PORT() + self.send_get_ip_ports(openstack_id) + return self.recv_get_ip_ports() - def send_get_IP_PORT(self, openstack_id): - self._oprot.writeMessageBegin('get_IP_PORT', TMessageType.CALL, self._seqid) - args = get_IP_PORT_args() + def send_get_ip_ports(self, openstack_id): + self._oprot.writeMessageBegin('get_ip_ports', TMessageType.CALL, self._seqid) + args = get_ip_ports_args() args.openstack_id = openstack_id args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_get_IP_PORT(self): + def recv_get_ip_ports(self): iprot = self._iprot (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: @@ -422,17 +470,18 @@ def recv_get_IP_PORT(self): x.read(iprot) iprot.readMessageEnd() raise x - result = get_IP_PORT_result() + result = get_ip_ports_result() result.read(iprot) iprot.readMessageEnd() if result.success is not None: return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "get_IP_PORT failed: unknown result") + raise TApplicationException(TApplicationException.MISSING_RESULT, "get_ip_ports failed: unknown result") def get_Flavors(self): """ Get Flavors. Returns: List of flavor instances. + """ self.send_get_Flavors() return self.recv_get_Flavors() @@ -463,6 +512,7 @@ def get_Images(self): """ Get Images. Returns: List of Image instances. + """ self.send_get_Images() return self.recv_get_Images() @@ -496,6 +546,7 @@ def get_Image_with_Tag(self, openstack_id): Parameters: - openstack_id + """ self.send_get_Image_with_Tag(openstack_id) return self.recv_get_Image_with_Tag() @@ -530,6 +581,7 @@ def delete_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ self.send_delete_server(openstack_id) return self.recv_delete_server() @@ -564,6 +616,7 @@ def add_metadata_to_server(self, servername, metadata): Parameters: - servername - metadata + """ self.send_add_metadata_to_server(servername, metadata) return self.recv_add_metadata_to_server() @@ -599,6 +652,7 @@ def delete_metadata_from_server(self, servername, keys): Parameters: - servername - keys + """ self.send_delete_metadata_from_server(servername, keys) return self.recv_delete_metadata_from_server() @@ -637,6 +691,7 @@ def add_floating_ip_to_server(self, openstack_id, network): Parameters: - openstack_id: Id of the server - network: Network name of the network which provides the floating Ip. + """ self.send_add_floating_ip_to_server(openstack_id, network) return self.recv_add_floating_ip_to_server() @@ -683,6 +738,7 @@ def create_connection(self, username, password, auth_url, user_domain_name, proj /** Domain name of OpenStack - project_domain_name: Project domain name of OpenStack + """ self.send_create_connection(username, password, auth_url, user_domain_name, project_domain_name) return self.recv_create_connection() @@ -728,6 +784,7 @@ def start_server(self, flavor, image, public_key, servername, elixir_id, diskspa - elixir_id: Elixir-Id of the user who requested to start a new server - diskspace: Diskspace in GB for additional volume. - volumename: Name of additional Volume + """ self.send_start_server(flavor, image, public_key, servername, elixir_id, diskspace, volumename) return self.recv_start_server() @@ -775,6 +832,50 @@ def recv_start_server(self): raise result.o raise TApplicationException(TApplicationException.MISSING_RESULT, "start_server failed: unknown result") + def add_security_group_to_server(self, http, https, udp, server_id): + """ + Adds a security group to a server + + Parameters: + - http: If http ports are open + - https: If https ports are open + - udp: If udp ports are open + - server_id: OpenStack id of the server + + """ + self.send_add_security_group_to_server(http, https, udp, server_id) + return self.recv_add_security_group_to_server() + + def send_add_security_group_to_server(self, http, https, udp, server_id): + self._oprot.writeMessageBegin('add_security_group_to_server', TMessageType.CALL, self._seqid) + args = add_security_group_to_server_args() + args.http = http + args.https = https + args.udp = udp + args.server_id = server_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_add_security_group_to_server(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = add_security_group_to_server_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.r is not None: + raise result.r + if result.s is not None: + raise result.s + raise TApplicationException(TApplicationException.MISSING_RESULT, "add_security_group_to_server failed: unknown result") + def get_server(self, openstack_id): """ Get a Server. @@ -782,6 +883,7 @@ def get_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ self.send_get_server(openstack_id) return self.recv_get_server() @@ -818,6 +920,7 @@ def stop_server(self, openstack_id): Parameters: - openstack_id: Id of the server. + """ self.send_stop_server(openstack_id) return self.recv_stop_server() @@ -858,6 +961,7 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tag): - name: Name of new Snapshot - elixir_id: Elixir-Id of the user who requested creation of Snapshot - base_tag: Tag with which the servers image is also tagged ( for connection information at the webapp) + """ self.send_create_snapshot(openstack_id, name, elixir_id, base_tag) return self.recv_create_snapshot() @@ -896,6 +1000,7 @@ def get_limits(self): Returns: {'maxTotalVolumes': maxTotalVolumes, 'maxTotalVolumeGigabytes': maxTotalVolumeGigabytes, 'maxTotalInstances': maxTotalInstances, 'totalRamUsed': totalRamUsed, 'totalInstancesUsed': totalInstancesUsed} + """ self.send_get_limits() return self.recv_get_limits() @@ -929,6 +1034,7 @@ def delete_image(self, image_id): Parameters: - image_id: Id of image + """ self.send_delete_image(image_id) return self.recv_delete_image() @@ -966,6 +1072,7 @@ def delete_volume_attachment(self, volume_id, server_id): Parameters: - volume_id: Id of the attached volume - server_id: Id of the server where the volume is attached + """ self.send_delete_volume_attachment(volume_id, server_id) return self.recv_delete_volume_attachment() @@ -1003,6 +1110,7 @@ def delete_volume(self, volume_id): Parameters: - volume_id + """ self.send_delete_volume(volume_id) return self.recv_delete_volume() @@ -1038,6 +1146,7 @@ def attach_volume_to_server(self, openstack_id, volume_id): Parameters: - openstack_id: Id of server - volume_id: Id of volume + """ self.send_attach_volume_to_server(openstack_id, volume_id) return self.recv_attach_volume_to_server() @@ -1077,6 +1186,7 @@ def check_server_status(self, openstack_id, diskspace, volume_id): - openstack_id: Id of the server - diskspace: diskspace of server(volume will be attached if server is active and diskpace >0) - volume_id: Id of the volume + """ self.send_check_server_status(openstack_id, diskspace, volume_id) return self.recv_check_server_status() @@ -1118,6 +1228,7 @@ def setUserPassword(self, user, password): Parameters: - user: Elixir-Id of the user which wants to set a password - password: New password + """ self.send_setUserPassword(user, password) return self.recv_setUserPassword() @@ -1155,6 +1266,7 @@ def resume_server(self, openstack_id): Parameters: - openstack_id: Id of the server + """ self.send_resume_server(openstack_id) return self.recv_resume_server() @@ -1192,6 +1304,7 @@ def create_volume(self, volume_name, diskspace): Parameters: - volume_name: Name of volume - diskspace: Diskspace in GB for new volume + """ self.send_create_volume(volume_name, diskspace) return self.recv_create_volume() @@ -1230,6 +1343,7 @@ def reboot_server(self, server_id, reboot_type): Parameters: - server_id: Id of the server - reboot_type: HARD or SOFT + """ self.send_reboot_server(server_id, reboot_type) return self.recv_reboot_server() @@ -1268,7 +1382,7 @@ def __init__(self, handler): self._processMap["check_Version"] = Processor.process_check_Version self._processMap["get_client_version"] = Processor.process_get_client_version self._processMap["import_keypair"] = Processor.process_import_keypair - self._processMap["get_IP_PORT"] = Processor.process_get_IP_PORT + self._processMap["get_ip_ports"] = Processor.process_get_ip_ports self._processMap["get_Flavors"] = Processor.process_get_Flavors self._processMap["get_Images"] = Processor.process_get_Images self._processMap["get_Image_with_Tag"] = Processor.process_get_Image_with_Tag @@ -1278,6 +1392,7 @@ def __init__(self, handler): self._processMap["add_floating_ip_to_server"] = Processor.process_add_floating_ip_to_server self._processMap["create_connection"] = Processor.process_create_connection self._processMap["start_server"] = Processor.process_start_server + self._processMap["add_security_group_to_server"] = Processor.process_add_security_group_to_server self._processMap["get_server"] = Processor.process_get_server self._processMap["stop_server"] = Processor.process_stop_server self._processMap["create_snapshot"] = Processor.process_create_snapshot @@ -1315,11 +1430,15 @@ def process_check_Version(self, seqid, iprot, oprot): try: result.success = self._handler.check_Version(args.version) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("check_Version", msg_type, seqid) result.write(oprot) @@ -1334,11 +1453,15 @@ def process_get_client_version(self, seqid, iprot, oprot): try: result.success = self._handler.get_client_version() msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_client_version", msg_type, seqid) result.write(oprot) @@ -1353,32 +1476,40 @@ def process_import_keypair(self, seqid, iprot, oprot): try: result.success = self._handler.import_keypair(args.keyname, args.public_key) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("import_keypair", msg_type, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() - def process_get_IP_PORT(self, seqid, iprot, oprot): - args = get_IP_PORT_args() + def process_get_ip_ports(self, seqid, iprot, oprot): + args = get_ip_ports_args() args.read(iprot) iprot.readMessageEnd() - result = get_IP_PORT_result() + result = get_ip_ports_result() try: - result.success = self._handler.get_IP_PORT(args.openstack_id) + result.success = self._handler.get_ip_ports(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("get_IP_PORT", msg_type, seqid) + oprot.writeMessageBegin("get_ip_ports", msg_type, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() @@ -1391,11 +1522,15 @@ def process_get_Flavors(self, seqid, iprot, oprot): try: result.success = self._handler.get_Flavors() msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_Flavors", msg_type, seqid) result.write(oprot) @@ -1410,11 +1545,15 @@ def process_get_Images(self, seqid, iprot, oprot): try: result.success = self._handler.get_Images() msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_Images", msg_type, seqid) result.write(oprot) @@ -1429,11 +1568,15 @@ def process_get_Image_with_Tag(self, seqid, iprot, oprot): try: result.success = self._handler.get_Image_with_Tag(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_Image_with_Tag", msg_type, seqid) result.write(oprot) @@ -1448,14 +1591,18 @@ def process_delete_server(self, seqid, iprot, oprot): try: result.success = self._handler.delete_server(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("delete_server", msg_type, seqid) result.write(oprot) @@ -1470,14 +1617,18 @@ def process_add_metadata_to_server(self, seqid, iprot, oprot): try: result.success = self._handler.add_metadata_to_server(args.servername, args.metadata) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("add_metadata_to_server", msg_type, seqid) result.write(oprot) @@ -1492,14 +1643,18 @@ def process_delete_metadata_from_server(self, seqid, iprot, oprot): try: result.success = self._handler.delete_metadata_from_server(args.servername, args.keys) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("delete_metadata_from_server", msg_type, seqid) result.write(oprot) @@ -1514,7 +1669,7 @@ def process_add_floating_ip_to_server(self, seqid, iprot, oprot): try: result.success = self._handler.add_floating_ip_to_server(args.openstack_id, args.network) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY @@ -1522,9 +1677,13 @@ def process_add_floating_ip_to_server(self, seqid, iprot, oprot): except networkNotFoundException as f: msg_type = TMessageType.REPLY result.f = f - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("add_floating_ip_to_server", msg_type, seqid) result.write(oprot) @@ -1539,14 +1698,18 @@ def process_create_connection(self, seqid, iprot, oprot): try: result.success = self._handler.create_connection(args.username, args.password, args.auth_url, args.user_domain_name, args.project_domain_name) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except authenticationException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("create_connection", msg_type, seqid) result.write(oprot) @@ -1561,7 +1724,7 @@ def process_start_server(self, seqid, iprot, oprot): try: result.success = self._handler.start_server(args.flavor, args.image, args.public_key, args.servername, args.elixir_id, args.diskspace, args.volumename) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except nameException as e: msg_type = TMessageType.REPLY @@ -1584,15 +1747,48 @@ def process_start_server(self, seqid, iprot, oprot): except otherException as o: msg_type = TMessageType.REPLY result.o = o - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("start_server", msg_type, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() + def process_add_security_group_to_server(self, seqid, iprot, oprot): + args = add_security_group_to_server_args() + args.read(iprot) + iprot.readMessageEnd() + result = add_security_group_to_server_result() + try: + result.success = self._handler.add_security_group_to_server(args.http, args.https, args.udp, args.server_id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except ressourceException as r: + msg_type = TMessageType.REPLY + result.r = r + except serverNotFoundException as s: + msg_type = TMessageType.REPLY + result.s = s + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("add_security_group_to_server", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_get_server(self, seqid, iprot, oprot): args = get_server_args() args.read(iprot) @@ -1601,14 +1797,18 @@ def process_get_server(self, seqid, iprot, oprot): try: result.success = self._handler.get_server(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_server", msg_type, seqid) result.write(oprot) @@ -1623,14 +1823,18 @@ def process_stop_server(self, seqid, iprot, oprot): try: result.success = self._handler.stop_server(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("stop_server", msg_type, seqid) result.write(oprot) @@ -1645,14 +1849,18 @@ def process_create_snapshot(self, seqid, iprot, oprot): try: result.success = self._handler.create_snapshot(args.openstack_id, args.name, args.elixir_id, args.base_tag) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("create_snapshot", msg_type, seqid) result.write(oprot) @@ -1667,11 +1875,15 @@ def process_get_limits(self, seqid, iprot, oprot): try: result.success = self._handler.get_limits() msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("get_limits", msg_type, seqid) result.write(oprot) @@ -1686,14 +1898,18 @@ def process_delete_image(self, seqid, iprot, oprot): try: result.success = self._handler.delete_image(args.image_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except imageNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("delete_image", msg_type, seqid) result.write(oprot) @@ -1708,14 +1924,18 @@ def process_delete_volume_attachment(self, seqid, iprot, oprot): try: result.success = self._handler.delete_volume_attachment(args.volume_id, args.server_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("delete_volume_attachment", msg_type, seqid) result.write(oprot) @@ -1730,11 +1950,15 @@ def process_delete_volume(self, seqid, iprot, oprot): try: result.success = self._handler.delete_volume(args.volume_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("delete_volume", msg_type, seqid) result.write(oprot) @@ -1749,14 +1973,18 @@ def process_attach_volume_to_server(self, seqid, iprot, oprot): try: result.success = self._handler.attach_volume_to_server(args.openstack_id, args.volume_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("attach_volume_to_server", msg_type, seqid) result.write(oprot) @@ -1771,7 +1999,7 @@ def process_check_server_status(self, seqid, iprot, oprot): try: result.success = self._handler.check_server_status(args.openstack_id, args.diskspace, args.volume_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY @@ -1779,9 +2007,13 @@ def process_check_server_status(self, seqid, iprot, oprot): except ressourceException as r: msg_type = TMessageType.REPLY result.r = r - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("check_server_status", msg_type, seqid) result.write(oprot) @@ -1796,14 +2028,18 @@ def process_setUserPassword(self, seqid, iprot, oprot): try: result.success = self._handler.setUserPassword(args.user, args.password) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except otherException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("setUserPassword", msg_type, seqid) result.write(oprot) @@ -1818,14 +2054,18 @@ def process_resume_server(self, seqid, iprot, oprot): try: result.success = self._handler.resume_server(args.openstack_id) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("resume_server", msg_type, seqid) result.write(oprot) @@ -1840,14 +2080,18 @@ def process_create_volume(self, seqid, iprot, oprot): try: result.success = self._handler.create_volume(args.volume_name, args.diskspace) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except ressourceException as r: msg_type = TMessageType.REPLY result.r = r - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("create_volume", msg_type, seqid) result.write(oprot) @@ -1862,14 +2106,18 @@ def process_reboot_server(self, seqid, iprot, oprot): try: result.success = self._handler.reboot_server(args.server_id, args.reboot_type) msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + except TTransport.TTransportException: raise except serverNotFoundException as e: msg_type = TMessageType.REPLY result.e = e - except Exception as ex: + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') msg_type = TMessageType.EXCEPTION - logging.exception(ex) result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') oprot.writeMessageBegin("reboot_server", msg_type, seqid) result.write(oprot) @@ -1883,19 +2131,16 @@ class check_Version_args(object): """ Attributes: - version + """ - thrift_spec = ( - None, # 0 - (1, TType.DOUBLE, 'version', None, None, ), # 1 - ) def __init__(self, version=None,): self.version = version def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1914,7 +2159,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('check_Version_args') if self.version is not None: @@ -1937,24 +2182,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(check_Version_args) +check_Version_args.thrift_spec = ( + None, # 0 + (1, TType.DOUBLE, 'version', None, None, ), # 1 +) class check_Version_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1973,7 +2221,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('check_Version_result') if self.success is not None: @@ -1996,16 +2244,18 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(check_Version_result) +check_Version_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 +) class get_client_version_args(object): - thrift_spec = ( - ) def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2019,7 +2269,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_client_version_args') oprot.writeFieldStop() @@ -2038,24 +2288,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_client_version_args) +get_client_version_args.thrift_spec = ( +) class get_client_version_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2074,7 +2325,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_client_version_result') if self.success is not None: @@ -2097,6 +2348,10 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_client_version_result) +get_client_version_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 +) class import_keypair_args(object): @@ -2104,13 +2359,9 @@ class import_keypair_args(object): Attributes: - keyname: Name for the keypair - public_key: The public key + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'keyname', 'UTF8', None, ), # 1 - (2, TType.STRING, 'public_key', 'UTF8', None, ), # 2 - ) def __init__(self, keyname=None, public_key=None,): self.keyname = keyname @@ -2118,7 +2369,7 @@ def __init__(self, keyname=None, public_key=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2142,7 +2393,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('import_keypair_args') if self.keyname is not None: @@ -2169,24 +2420,28 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(import_keypair_args) +import_keypair_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'keyname', 'UTF8', None, ), # 1 + (2, TType.STRING, 'public_key', 'UTF8', None, ), # 2 +) class import_keypair_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2205,7 +2460,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('import_keypair_result') if self.success is not None: @@ -2228,25 +2483,26 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(import_keypair_result) +import_keypair_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 +) -class get_IP_PORT_args(object): +class get_ip_ports_args(object): """ Attributes: - openstack_id: Id of server + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2265,9 +2521,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('get_IP_PORT_args') + oprot.writeStructBegin('get_ip_ports_args') if self.openstack_id is not None: oprot.writeFieldBegin('openstack_id', TType.STRING, 1) oprot.writeString(self.openstack_id.encode('utf-8') if sys.version_info[0] == 2 else self.openstack_id) @@ -2288,24 +2544,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_ip_ports_args) +get_ip_ports_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) -class get_IP_PORT_result(object): +class get_ip_ports_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2330,9 +2589,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('get_IP_PORT_result') + oprot.writeStructBegin('get_ip_ports_result') if self.success is not None: oprot.writeFieldBegin('success', TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) @@ -2357,16 +2616,18 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_ip_ports_result) +get_ip_ports_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 +) class get_Flavors_args(object): - thrift_spec = ( - ) def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2380,7 +2641,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Flavors_args') oprot.writeFieldStop() @@ -2399,24 +2660,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Flavors_args) +get_Flavors_args.thrift_spec = ( +) class get_Flavors_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (Flavor, Flavor.thrift_spec), False), None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2441,7 +2703,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Flavors_result') if self.success is not None: @@ -2467,16 +2729,18 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Flavors_result) +get_Flavors_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [Flavor, None], False), None, ), # 0 +) class get_Images_args(object): - thrift_spec = ( - ) def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2490,7 +2754,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Images_args') oprot.writeFieldStop() @@ -2509,24 +2773,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Images_args) +get_Images_args.thrift_spec = ( +) class get_Images_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (Image, Image.thrift_spec), False), None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2551,7 +2816,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Images_result') if self.success is not None: @@ -2577,25 +2842,26 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Images_result) +get_Images_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [Image, None], False), None, ), # 0 +) class get_Image_with_Tag_args(object): """ Attributes: - openstack_id + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2614,7 +2880,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Image_with_Tag_args') if self.openstack_id is not None: @@ -2637,24 +2903,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Image_with_Tag_args) +get_Image_with_Tag_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) class get_Image_with_Tag_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (Image, Image.thrift_spec), None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2674,7 +2943,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_Image_with_Tag_result') if self.success is not None: @@ -2697,25 +2966,26 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_Image_with_Tag_result) +get_Image_with_Tag_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [Image, None], None, ), # 0 +) class delete_server_args(object): """ Attributes: - openstack_id: Id of the server. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2734,7 +3004,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_server_args') if self.openstack_id is not None: @@ -2757,6 +3027,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_server_args) +delete_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) class delete_server_result(object): @@ -2764,12 +3039,9 @@ class delete_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -2777,7 +3049,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2802,7 +3074,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_server_result') if self.success is not None: @@ -2829,6 +3101,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_server_result) +delete_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class add_metadata_to_server_args(object): @@ -2836,13 +3113,9 @@ class add_metadata_to_server_args(object): Attributes: - servername - metadata + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'servername', 'UTF8', None, ), # 1 - (2, TType.MAP, 'metadata', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 2 - ) def __init__(self, servername=None, metadata=None,): self.servername = servername @@ -2850,7 +3123,7 @@ def __init__(self, servername=None, metadata=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2880,7 +3153,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('add_metadata_to_server_args') if self.servername is not None: @@ -2911,6 +3184,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(add_metadata_to_server_args) +add_metadata_to_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'servername', 'UTF8', None, ), # 1 + (2, TType.MAP, 'metadata', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 2 +) class add_metadata_to_server_result(object): @@ -2918,12 +3197,9 @@ class add_metadata_to_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -2931,7 +3207,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2962,7 +3238,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('add_metadata_to_server_result') if self.success is not None: @@ -2993,6 +3269,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(add_metadata_to_server_result) +add_metadata_to_server_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class delete_metadata_from_server_args(object): @@ -3000,13 +3281,9 @@ class delete_metadata_from_server_args(object): Attributes: - servername - keys + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'servername', 'UTF8', None, ), # 1 - (2, TType.SET, 'keys', (TType.STRING, 'UTF8', False), None, ), # 2 - ) def __init__(self, servername=None, keys=None,): self.servername = servername @@ -3014,7 +3291,7 @@ def __init__(self, servername=None, keys=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3043,7 +3320,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_metadata_from_server_args') if self.servername is not None: @@ -3073,6 +3350,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_metadata_from_server_args) +delete_metadata_from_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'servername', 'UTF8', None, ), # 1 + (2, TType.SET, 'keys', (TType.STRING, 'UTF8', False), None, ), # 2 +) class delete_metadata_from_server_result(object): @@ -3080,12 +3363,9 @@ class delete_metadata_from_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.SET, 'success', (TType.STRING, 'UTF8', False), None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -3093,7 +3373,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3123,7 +3403,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_metadata_from_server_result') if self.success is not None: @@ -3153,6 +3433,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_metadata_from_server_result) +delete_metadata_from_server_result.thrift_spec = ( + (0, TType.SET, 'success', (TType.STRING, 'UTF8', False), None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class add_floating_ip_to_server_args(object): @@ -3160,13 +3445,9 @@ class add_floating_ip_to_server_args(object): Attributes: - openstack_id: Id of the server - network: Network name of the network which provides the floating Ip. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - (2, TType.STRING, 'network', 'UTF8', None, ), # 2 - ) def __init__(self, openstack_id=None, network=None,): self.openstack_id = openstack_id @@ -3174,7 +3455,7 @@ def __init__(self, openstack_id=None, network=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3198,7 +3479,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('add_floating_ip_to_server_args') if self.openstack_id is not None: @@ -3225,6 +3506,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(add_floating_ip_to_server_args) +add_floating_ip_to_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'network', 'UTF8', None, ), # 2 +) class add_floating_ip_to_server_result(object): @@ -3233,13 +3520,9 @@ class add_floating_ip_to_server_result(object): - success - e - f + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'f', (networkNotFoundException, networkNotFoundException.thrift_spec), None, ), # 2 - ) def __init__(self, success=None, e=None, f=None,): self.success = success @@ -3248,7 +3531,7 @@ def __init__(self, success=None, e=None, f=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3279,7 +3562,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('add_floating_ip_to_server_result') if self.success is not None: @@ -3310,6 +3593,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(add_floating_ip_to_server_result) +add_floating_ip_to_server_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 + (2, TType.STRUCT, 'f', [networkNotFoundException, None], None, ), # 2 +) class create_connection_args(object): @@ -3323,17 +3612,9 @@ class create_connection_args(object): /** Domain name of OpenStack - project_domain_name: Project domain name of OpenStack + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', 'UTF8', None, ), # 1 - (2, TType.STRING, 'password', 'UTF8', None, ), # 2 - (3, TType.STRING, 'auth_url', 'UTF8', None, ), # 3 - None, # 4 - (5, TType.STRING, 'user_domain_name', 'UTF8', None, ), # 5 - (6, TType.STRING, 'project_domain_name', 'UTF8', None, ), # 6 - ) def __init__(self, username=None, password=None, auth_url=None, user_domain_name=None, project_domain_name=None,): self.username = username @@ -3344,7 +3625,7 @@ def __init__(self, username=None, password=None, auth_url=None, user_domain_name def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3383,7 +3664,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_connection_args') if self.username is not None: @@ -3422,6 +3703,16 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_connection_args) +create_connection_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'username', 'UTF8', None, ), # 1 + (2, TType.STRING, 'password', 'UTF8', None, ), # 2 + (3, TType.STRING, 'auth_url', 'UTF8', None, ), # 3 + None, # 4 + (5, TType.STRING, 'user_domain_name', 'UTF8', None, ), # 5 + (6, TType.STRING, 'project_domain_name', 'UTF8', None, ), # 6 +) class create_connection_result(object): @@ -3429,12 +3720,9 @@ class create_connection_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (authenticationException, authenticationException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -3442,7 +3730,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3467,7 +3755,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_connection_result') if self.success is not None: @@ -3494,6 +3782,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_connection_result) +create_connection_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [authenticationException, None], None, ), # 1 +) class start_server_args(object): @@ -3506,18 +3799,9 @@ class start_server_args(object): - elixir_id: Elixir-Id of the user who requested to start a new server - diskspace: Diskspace in GB for additional volume. - volumename: Name of additional Volume + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'flavor', 'UTF8', None, ), # 1 - (2, TType.STRING, 'image', 'UTF8', None, ), # 2 - (3, TType.STRING, 'public_key', 'UTF8', None, ), # 3 - (4, TType.STRING, 'servername', 'UTF8', None, ), # 4 - (5, TType.STRING, 'elixir_id', 'UTF8', None, ), # 5 - (6, TType.STRING, 'diskspace', 'UTF8', None, ), # 6 - (7, TType.STRING, 'volumename', 'UTF8', None, ), # 7 - ) def __init__(self, flavor=None, image=None, public_key=None, servername=None, elixir_id=None, diskspace=None, volumename=None,): self.flavor = flavor @@ -3530,7 +3814,7 @@ def __init__(self, flavor=None, image=None, public_key=None, servername=None, el def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3579,7 +3863,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('start_server_args') if self.flavor is not None: @@ -3626,6 +3910,17 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(start_server_args) +start_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'flavor', 'UTF8', None, ), # 1 + (2, TType.STRING, 'image', 'UTF8', None, ), # 2 + (3, TType.STRING, 'public_key', 'UTF8', None, ), # 3 + (4, TType.STRING, 'servername', 'UTF8', None, ), # 4 + (5, TType.STRING, 'elixir_id', 'UTF8', None, ), # 5 + (6, TType.STRING, 'diskspace', 'UTF8', None, ), # 6 + (7, TType.STRING, 'volumename', 'UTF8', None, ), # 7 +) class start_server_result(object): @@ -3639,18 +3934,9 @@ class start_server_result(object): - i - f - o + """ - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 - (1, TType.STRUCT, 'e', (nameException, nameException.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'r', (ressourceException, ressourceException.thrift_spec), None, ), # 2 - (3, TType.STRUCT, 's', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 3 - (4, TType.STRUCT, 'n', (networkNotFoundException, networkNotFoundException.thrift_spec), None, ), # 4 - (5, TType.STRUCT, 'i', (imageNotFoundException, imageNotFoundException.thrift_spec), None, ), # 5 - (6, TType.STRUCT, 'f', (flavorNotFoundException, flavorNotFoundException.thrift_spec), None, ), # 6 - (7, TType.STRUCT, 'o', (otherException, otherException.thrift_spec), None, ), # 7 - ) def __init__(self, success=None, e=None, r=None, s=None, n=None, i=None, f=None, o=None,): self.success = success @@ -3664,7 +3950,7 @@ def __init__(self, success=None, e=None, r=None, s=None, n=None, i=None, f=None, def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3731,7 +4017,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('start_server_result') if self.success is not None: @@ -3786,25 +4072,218 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(start_server_result) +start_server_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 + (1, TType.STRUCT, 'e', [nameException, None], None, ), # 1 + (2, TType.STRUCT, 'r', [ressourceException, None], None, ), # 2 + (3, TType.STRUCT, 's', [serverNotFoundException, None], None, ), # 3 + (4, TType.STRUCT, 'n', [networkNotFoundException, None], None, ), # 4 + (5, TType.STRUCT, 'i', [imageNotFoundException, None], None, ), # 5 + (6, TType.STRUCT, 'f', [flavorNotFoundException, None], None, ), # 6 + (7, TType.STRUCT, 'o', [otherException, None], None, ), # 7 +) + + +class add_security_group_to_server_args(object): + """ + Attributes: + - http: If http ports are open + - https: If https ports are open + - udp: If udp ports are open + - server_id: OpenStack id of the server + + """ + + + def __init__(self, http=None, https=None, udp=None, server_id=None,): + self.http = http + self.https = https + self.udp = udp + self.server_id = server_id + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.http = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.https = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.udp = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.server_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('add_security_group_to_server_args') + if self.http is not None: + oprot.writeFieldBegin('http', TType.BOOL, 1) + oprot.writeBool(self.http) + oprot.writeFieldEnd() + if self.https is not None: + oprot.writeFieldBegin('https', TType.BOOL, 2) + oprot.writeBool(self.https) + oprot.writeFieldEnd() + if self.udp is not None: + oprot.writeFieldBegin('udp', TType.BOOL, 3) + oprot.writeBool(self.udp) + oprot.writeFieldEnd() + if self.server_id is not None: + oprot.writeFieldBegin('server_id', TType.STRING, 4) + oprot.writeString(self.server_id.encode('utf-8') if sys.version_info[0] == 2 else self.server_id) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(add_security_group_to_server_args) +add_security_group_to_server_args.thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'http', None, None, ), # 1 + (2, TType.BOOL, 'https', None, None, ), # 2 + (3, TType.BOOL, 'udp', None, None, ), # 3 + (4, TType.STRING, 'server_id', 'UTF8', None, ), # 4 +) + + +class add_security_group_to_server_result(object): + """ + Attributes: + - success + - r + - s + + """ + + + def __init__(self, success=None, r=None, s=None,): + self.success = success + self.r = r + self.s = s + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.r = ressourceException() + self.r.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.s = serverNotFoundException() + self.s.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('add_security_group_to_server_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.r is not None: + oprot.writeFieldBegin('r', TType.STRUCT, 1) + self.r.write(oprot) + oprot.writeFieldEnd() + if self.s is not None: + oprot.writeFieldBegin('s', TType.STRUCT, 2) + self.s.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(add_security_group_to_server_result) +add_security_group_to_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'r', [ressourceException, None], None, ), # 1 + (2, TType.STRUCT, 's', [serverNotFoundException, None], None, ), # 2 +) class get_server_args(object): """ Attributes: - openstack_id: Id of the server. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3823,7 +4302,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_server_args') if self.openstack_id is not None: @@ -3846,6 +4325,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_server_args) +get_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) class get_server_result(object): @@ -3853,12 +4337,9 @@ class get_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (VM, VM.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -3866,7 +4347,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3892,7 +4373,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_server_result') if self.success is not None: @@ -3919,25 +4400,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_server_result) +get_server_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [VM, None], None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class stop_server_args(object): """ Attributes: - openstack_id: Id of the server. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -3956,7 +4439,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('stop_server_args') if self.openstack_id is not None: @@ -3979,6 +4462,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(stop_server_args) +stop_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) class stop_server_result(object): @@ -3986,12 +4474,9 @@ class stop_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -3999,7 +4484,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4024,7 +4509,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('stop_server_result') if self.success is not None: @@ -4051,6 +4536,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(stop_server_result) +stop_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class create_snapshot_args(object): @@ -4060,15 +4550,9 @@ class create_snapshot_args(object): - name: Name of new Snapshot - elixir_id: Elixir-Id of the user who requested creation of Snapshot - base_tag: Tag with which the servers image is also tagged ( for connection information at the webapp) + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - (2, TType.STRING, 'name', 'UTF8', None, ), # 2 - (3, TType.STRING, 'elixir_id', 'UTF8', None, ), # 3 - (4, TType.STRING, 'base_tag', 'UTF8', None, ), # 4 - ) def __init__(self, openstack_id=None, name=None, elixir_id=None, base_tag=None,): self.openstack_id = openstack_id @@ -4078,7 +4562,7 @@ def __init__(self, openstack_id=None, name=None, elixir_id=None, base_tag=None,) def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4112,7 +4596,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_snapshot_args') if self.openstack_id is not None: @@ -4147,6 +4631,14 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_snapshot_args) +create_snapshot_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'name', 'UTF8', None, ), # 2 + (3, TType.STRING, 'elixir_id', 'UTF8', None, ), # 3 + (4, TType.STRING, 'base_tag', 'UTF8', None, ), # 4 +) class create_snapshot_result(object): @@ -4154,12 +4646,9 @@ class create_snapshot_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -4167,7 +4656,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4192,7 +4681,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_snapshot_result') if self.success is not None: @@ -4219,16 +4708,19 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_snapshot_result) +create_snapshot_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class get_limits_args(object): - thrift_spec = ( - ) def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4242,7 +4734,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_limits_args') oprot.writeFieldStop() @@ -4261,24 +4753,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_limits_args) +get_limits_args.thrift_spec = ( +) class get_limits_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4303,7 +4796,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('get_limits_result') if self.success is not None: @@ -4330,25 +4823,26 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(get_limits_result) +get_limits_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 +) class delete_image_args(object): """ Attributes: - image_id: Id of image + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'image_id', 'UTF8', None, ), # 1 - ) def __init__(self, image_id=None,): self.image_id = image_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4367,7 +4861,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_image_args') if self.image_id is not None: @@ -4390,6 +4884,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_image_args) +delete_image_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'image_id', 'UTF8', None, ), # 1 +) class delete_image_result(object): @@ -4397,12 +4896,9 @@ class delete_image_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (imageNotFoundException, imageNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -4410,7 +4906,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4435,7 +4931,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_image_result') if self.success is not None: @@ -4462,6 +4958,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_image_result) +delete_image_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [imageNotFoundException, None], None, ), # 1 +) class delete_volume_attachment_args(object): @@ -4469,13 +4970,9 @@ class delete_volume_attachment_args(object): Attributes: - volume_id: Id of the attached volume - server_id: Id of the server where the volume is attached + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'volume_id', 'UTF8', None, ), # 1 - (2, TType.STRING, 'server_id', 'UTF8', None, ), # 2 - ) def __init__(self, volume_id=None, server_id=None,): self.volume_id = volume_id @@ -4483,7 +4980,7 @@ def __init__(self, volume_id=None, server_id=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4507,7 +5004,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_volume_attachment_args') if self.volume_id is not None: @@ -4534,6 +5031,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_volume_attachment_args) +delete_volume_attachment_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'volume_id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'server_id', 'UTF8', None, ), # 2 +) class delete_volume_attachment_result(object): @@ -4541,12 +5044,9 @@ class delete_volume_attachment_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -4554,7 +5054,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4579,7 +5079,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_volume_attachment_result') if self.success is not None: @@ -4606,25 +5106,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_volume_attachment_result) +delete_volume_attachment_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class delete_volume_args(object): """ Attributes: - volume_id + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'volume_id', 'UTF8', None, ), # 1 - ) def __init__(self, volume_id=None,): self.volume_id = volume_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4643,7 +5145,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_volume_args') if self.volume_id is not None: @@ -4666,24 +5168,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_volume_args) +delete_volume_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'volume_id', 'UTF8', None, ), # 1 +) class delete_volume_result(object): """ Attributes: - success + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) def __init__(self, success=None,): self.success = success def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4702,7 +5207,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('delete_volume_result') if self.success is not None: @@ -4725,6 +5230,10 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(delete_volume_result) +delete_volume_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 +) class attach_volume_to_server_args(object): @@ -4732,13 +5241,9 @@ class attach_volume_to_server_args(object): Attributes: - openstack_id: Id of server - volume_id: Id of volume + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - (2, TType.STRING, 'volume_id', 'UTF8', None, ), # 2 - ) def __init__(self, openstack_id=None, volume_id=None,): self.openstack_id = openstack_id @@ -4746,7 +5251,7 @@ def __init__(self, openstack_id=None, volume_id=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4770,7 +5275,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('attach_volume_to_server_args') if self.openstack_id is not None: @@ -4797,6 +5302,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(attach_volume_to_server_args) +attach_volume_to_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'volume_id', 'UTF8', None, ), # 2 +) class attach_volume_to_server_result(object): @@ -4804,12 +5315,9 @@ class attach_volume_to_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -4817,7 +5325,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4842,7 +5350,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('attach_volume_to_server_result') if self.success is not None: @@ -4869,6 +5377,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(attach_volume_to_server_result) +attach_volume_to_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class check_server_status_args(object): @@ -4877,14 +5390,9 @@ class check_server_status_args(object): - openstack_id: Id of the server - diskspace: diskspace of server(volume will be attached if server is active and diskpace >0) - volume_id: Id of the volume + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - (2, TType.I32, 'diskspace', None, None, ), # 2 - (3, TType.STRING, 'volume_id', 'UTF8', None, ), # 3 - ) def __init__(self, openstack_id=None, diskspace=None, volume_id=None,): self.openstack_id = openstack_id @@ -4893,7 +5401,7 @@ def __init__(self, openstack_id=None, diskspace=None, volume_id=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -4922,7 +5430,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('check_server_status_args') if self.openstack_id is not None: @@ -4953,6 +5461,13 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(check_server_status_args) +check_server_status_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (2, TType.I32, 'diskspace', None, None, ), # 2 + (3, TType.STRING, 'volume_id', 'UTF8', None, ), # 3 +) class check_server_status_result(object): @@ -4961,13 +5476,9 @@ class check_server_status_result(object): - success - e - r + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (VM, VM.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'r', (ressourceException, ressourceException.thrift_spec), None, ), # 2 - ) def __init__(self, success=None, e=None, r=None,): self.success = success @@ -4976,7 +5487,7 @@ def __init__(self, success=None, e=None, r=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5008,7 +5519,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('check_server_status_result') if self.success is not None: @@ -5039,6 +5550,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(check_server_status_result) +check_server_status_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [VM, None], None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 + (2, TType.STRUCT, 'r', [ressourceException, None], None, ), # 2 +) class setUserPassword_args(object): @@ -5046,13 +5563,9 @@ class setUserPassword_args(object): Attributes: - user: Elixir-Id of the user which wants to set a password - password: New password + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'user', 'UTF8', None, ), # 1 - (2, TType.STRING, 'password', 'UTF8', None, ), # 2 - ) def __init__(self, user=None, password=None,): self.user = user @@ -5060,7 +5573,7 @@ def __init__(self, user=None, password=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5084,7 +5597,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('setUserPassword_args') if self.user is not None: @@ -5111,6 +5624,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(setUserPassword_args) +setUserPassword_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'user', 'UTF8', None, ), # 1 + (2, TType.STRING, 'password', 'UTF8', None, ), # 2 +) class setUserPassword_result(object): @@ -5118,12 +5637,9 @@ class setUserPassword_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'e', (otherException, otherException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -5131,7 +5647,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5156,7 +5672,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('setUserPassword_result') if self.success is not None: @@ -5183,25 +5699,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(setUserPassword_result) +setUserPassword_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'e', [otherException, None], None, ), # 1 +) class resume_server_args(object): """ Attributes: - openstack_id: Id of the server + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 - ) def __init__(self, openstack_id=None,): self.openstack_id = openstack_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5220,7 +5738,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('resume_server_args') if self.openstack_id is not None: @@ -5243,6 +5761,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(resume_server_args) +resume_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) class resume_server_result(object): @@ -5250,12 +5773,9 @@ class resume_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -5263,7 +5783,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5288,7 +5808,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('resume_server_result') if self.success is not None: @@ -5315,6 +5835,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(resume_server_result) +resume_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) class create_volume_args(object): @@ -5322,13 +5847,9 @@ class create_volume_args(object): Attributes: - volume_name: Name of volume - diskspace: Diskspace in GB for new volume + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'volume_name', 'UTF8', None, ), # 1 - (2, TType.I32, 'diskspace', None, None, ), # 2 - ) def __init__(self, volume_name=None, diskspace=None,): self.volume_name = volume_name @@ -5336,7 +5857,7 @@ def __init__(self, volume_name=None, diskspace=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5360,7 +5881,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_volume_args') if self.volume_name is not None: @@ -5387,6 +5908,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_volume_args) +create_volume_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'volume_name', 'UTF8', None, ), # 1 + (2, TType.I32, 'diskspace', None, None, ), # 2 +) class create_volume_result(object): @@ -5394,12 +5921,9 @@ class create_volume_result(object): Attributes: - success - r + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'r', (ressourceException, ressourceException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, r=None,): self.success = success @@ -5407,7 +5931,7 @@ def __init__(self, success=None, r=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5432,7 +5956,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('create_volume_result') if self.success is not None: @@ -5459,6 +5983,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(create_volume_result) +create_volume_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'r', [ressourceException, None], None, ), # 1 +) class reboot_server_args(object): @@ -5466,13 +5995,9 @@ class reboot_server_args(object): Attributes: - server_id: Id of the server - reboot_type: HARD or SOFT + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'server_id', 'UTF8', None, ), # 1 - (2, TType.STRING, 'reboot_type', 'UTF8', None, ), # 2 - ) def __init__(self, server_id=None, reboot_type=None,): self.server_id = server_id @@ -5480,7 +6005,7 @@ def __init__(self, server_id=None, reboot_type=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5504,7 +6029,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('reboot_server_args') if self.server_id is not None: @@ -5531,6 +6056,12 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(reboot_server_args) +reboot_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'server_id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'reboot_type', 'UTF8', None, ), # 2 +) class reboot_server_result(object): @@ -5538,12 +6069,9 @@ class reboot_server_result(object): Attributes: - success - e + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (serverNotFoundException, serverNotFoundException.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, e=None,): self.success = success @@ -5551,7 +6079,7 @@ def __init__(self, success=None, e=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -5576,7 +6104,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('reboot_server_result') if self.success is not None: @@ -5603,3 +6131,11 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(reboot_server_result) +reboot_server_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) +fix_spec(all_structs) +del all_structs + diff --git a/VirtualMachineService/config/config.yml b/VirtualMachineService/config/config.yml index 45e3e0a0..d4df7d15 100644 --- a/VirtualMachineService/config/config.yml +++ b/VirtualMachineService/config/config.yml @@ -1,17 +1,23 @@ openstack_connection: - host: 0.0.0.0 - # Client Port - port: 9090 - # Gateway Port and IP - gateway_base: 30000 - gateway_ip: 172.21.40.72 - # If set to True the client will use a Gateway instead of providing floating IPs for each instance. - use_gateway: True - set_password: False - # network where the project is located - network: portalnetzwerk - floating_ip_network: cebitec - # The name of the availability zone the server should be placed. - availability_zone: default - # If you use docker-compose this path needs to be the path you mount the server.pem into - certfile: /code/VirtualMachineService/keys/server.pem + host: 0.0.0.0 + # Client Port + port: 9090 + # Gateway Port and IP + gateway_base: 30000 + gateway_ip: 129.70.51.75 + # If set to True the client will use a Gateway instead of providing floating IPs for each instance. + use_gateway: True + + # Id of the default simple vm security group + default_security_group: ec824d8f-0e45-4eb1-8f49-089867fef366 + + udp_base: 30000 + + set_password: False + # network where the project is located + network: portalexternalnetwork + floating_ip_network: external + # The name of the availability zone the server should be placed. + availability_zone: default + # If you use docker-compose this path needs to be the path you mount the server.pem into + certfile: /code/VirtualMachineService/keys/server.pem diff --git a/VirtualMachineService/constants.py b/VirtualMachineService/constants.py index b31e6be4..8de3f670 100644 --- a/VirtualMachineService/constants.py +++ b/VirtualMachineService/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.12.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -8,6 +8,8 @@ from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + import sys from ttypes import * VERSION = "1.0.0" diff --git a/VirtualMachineService/ttypes.py b/VirtualMachineService/ttypes.py index 5b474e80..5d3d9c5e 100644 --- a/VirtualMachineService/ttypes.py +++ b/VirtualMachineService/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.12.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -8,9 +8,12 @@ from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + import sys from thrift.transport import TTransport +all_structs = [] class Flavor(object): @@ -25,18 +28,9 @@ class Flavor(object): - openstack_id: The openstack_id of the flavor - description: The description of the flavor - tags: List of tags from flavor + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'vcpus', None, None, ), # 1 - (2, TType.I32, 'ram', None, None, ), # 2 - (3, TType.I32, 'disk', None, None, ), # 3 - (4, TType.STRING, 'name', 'UTF8', None, ), # 4 - (5, TType.STRING, 'openstack_id', 'UTF8', None, ), # 5 - (6, TType.STRING, 'description', 'UTF8', None, ), # 6 - (7, TType.LIST, 'tags', (TType.STRING, 'UTF8', False), None, ), # 7 - ) def __init__(self, vcpus=None, ram=None, disk=None, name=None, openstack_id=None, description=None, tags=None,): self.vcpus = vcpus @@ -49,7 +43,7 @@ def __init__(self, vcpus=None, ram=None, disk=None, name=None, openstack_id=None def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -103,7 +97,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('Flavor') if self.vcpus is not None: @@ -181,20 +175,9 @@ class Image(object): - openstack_id: The openstack_id the image - description: The description of the image - tag: List of tags from image + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', 'UTF8', None, ), # 1 - (2, TType.I32, 'min_disk', None, None, ), # 2 - (3, TType.I32, 'min_ram', None, None, ), # 3 - (4, TType.STRING, 'status', 'UTF8', None, ), # 4 - (5, TType.STRING, 'created_at', 'UTF8', None, ), # 5 - (6, TType.STRING, 'updated_at', 'UTF8', None, ), # 6 - (7, TType.STRING, 'openstack_id', 'UTF8', None, ), # 7 - (8, TType.STRING, 'description', 'UTF8', None, ), # 8 - (9, TType.LIST, 'tag', (TType.STRING, 'UTF8', False), None, ), # 9 - ) def __init__(self, name=None, min_disk=None, min_ram=None, status=None, created_at=None, updated_at=None, openstack_id=None, description=None, tag=None,): self.name = name @@ -209,7 +192,7 @@ def __init__(self, name=None, min_disk=None, min_ram=None, status=None, created_ def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -273,7 +256,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('Image') if self.name is not None: @@ -363,24 +346,9 @@ class VM(object): - fixed_ip: The fixed ips of the VM - diskspace: Diskspace in GB from additional volume - volume_id: Id of additional volume + """ - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'flav', (Flavor, Flavor.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'img', (Image, Image.thrift_spec), None, ), # 2 - (3, TType.STRING, 'status', 'UTF8', None, ), # 3 - (4, TType.MAP, 'metadata', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 4 - (5, TType.STRING, 'project_id', 'UTF8', None, ), # 5 - (6, TType.STRING, 'keyname', 'UTF8', None, ), # 6 - (7, TType.STRING, 'openstack_id', 'UTF8', None, ), # 7 - (8, TType.STRING, 'name', 'UTF8', None, ), # 8 - (9, TType.STRING, 'created_at', 'UTF8', None, ), # 9 - (10, TType.STRING, 'floating_ip', 'UTF8', None, ), # 10 - (11, TType.STRING, 'fixed_ip', 'UTF8', None, ), # 11 - (12, TType.I32, 'diskspace', None, None, ), # 12 - (13, TType.STRING, 'volume_id', 'UTF8', None, ), # 13 - ) def __init__(self, flav=None, img=None, status=None, metadata=None, project_id=None, keyname=None, openstack_id=None, name=None, created_at=None, floating_ip=None, fixed_ip=None, diskspace=None, volume_id=None,): self.flav = flav @@ -399,7 +367,7 @@ def __init__(self, flav=None, img=None, status=None, metadata=None, project_id=N def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -486,7 +454,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('VM') if self.flav is not None: @@ -583,19 +551,16 @@ class otherException(TException): """ Attributes: - Reason: Every other exception. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -614,7 +579,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('otherException') if self.Reason is not None: @@ -646,19 +611,16 @@ class ressourceException(TException): """ Attributes: - Reason: Name already used. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -677,7 +639,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('ressourceException') if self.Reason is not None: @@ -709,19 +671,16 @@ class nameException(TException): """ Attributes: - Reason: @ Name already used. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -740,7 +699,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('nameException') if self.Reason is not None: @@ -772,19 +731,16 @@ class serverNotFoundException(TException): """ Attributes: - Reason: Server not found. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -803,7 +759,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('serverNotFoundException') if self.Reason is not None: @@ -835,19 +791,16 @@ class networkNotFoundException(TException): """ Attributes: - Reason: Network not found. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -866,7 +819,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('networkNotFoundException') if self.Reason is not None: @@ -898,19 +851,16 @@ class imageNotFoundException(TException): """ Attributes: - Reason: Image not found. + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -929,7 +879,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('imageNotFoundException') if self.Reason is not None: @@ -961,19 +911,16 @@ class flavorNotFoundException(TException): """ Attributes: - Reason + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -992,7 +939,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('flavorNotFoundException') if self.Reason is not None: @@ -1026,19 +973,16 @@ class authenticationException(TException): Attributes: - Reason: Reason why the Authentication failed + """ - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 - ) def __init__(self, Reason=None,): self.Reason = Reason def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1057,7 +1001,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('authenticationException') if self.Reason is not None: @@ -1083,3 +1027,86 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(Flavor) +Flavor.thrift_spec = ( + None, # 0 + (1, TType.I32, 'vcpus', None, None, ), # 1 + (2, TType.I32, 'ram', None, None, ), # 2 + (3, TType.I32, 'disk', None, None, ), # 3 + (4, TType.STRING, 'name', 'UTF8', None, ), # 4 + (5, TType.STRING, 'openstack_id', 'UTF8', None, ), # 5 + (6, TType.STRING, 'description', 'UTF8', None, ), # 6 + (7, TType.LIST, 'tags', (TType.STRING, 'UTF8', False), None, ), # 7 +) +all_structs.append(Image) +Image.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', 'UTF8', None, ), # 1 + (2, TType.I32, 'min_disk', None, None, ), # 2 + (3, TType.I32, 'min_ram', None, None, ), # 3 + (4, TType.STRING, 'status', 'UTF8', None, ), # 4 + (5, TType.STRING, 'created_at', 'UTF8', None, ), # 5 + (6, TType.STRING, 'updated_at', 'UTF8', None, ), # 6 + (7, TType.STRING, 'openstack_id', 'UTF8', None, ), # 7 + (8, TType.STRING, 'description', 'UTF8', None, ), # 8 + (9, TType.LIST, 'tag', (TType.STRING, 'UTF8', False), None, ), # 9 +) +all_structs.append(VM) +VM.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'flav', [Flavor, None], None, ), # 1 + (2, TType.STRUCT, 'img', [Image, None], None, ), # 2 + (3, TType.STRING, 'status', 'UTF8', None, ), # 3 + (4, TType.MAP, 'metadata', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 4 + (5, TType.STRING, 'project_id', 'UTF8', None, ), # 5 + (6, TType.STRING, 'keyname', 'UTF8', None, ), # 6 + (7, TType.STRING, 'openstack_id', 'UTF8', None, ), # 7 + (8, TType.STRING, 'name', 'UTF8', None, ), # 8 + (9, TType.STRING, 'created_at', 'UTF8', None, ), # 9 + (10, TType.STRING, 'floating_ip', 'UTF8', None, ), # 10 + (11, TType.STRING, 'fixed_ip', 'UTF8', None, ), # 11 + (12, TType.I32, 'diskspace', None, None, ), # 12 + (13, TType.STRING, 'volume_id', 'UTF8', None, ), # 13 +) +all_structs.append(otherException) +otherException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(ressourceException) +ressourceException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(nameException) +nameException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(serverNotFoundException) +serverNotFoundException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(networkNotFoundException) +networkNotFoundException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(imageNotFoundException) +imageNotFoundException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(flavorNotFoundException) +flavorNotFoundException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +all_structs.append(authenticationException) +authenticationException.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'Reason', 'UTF8', None, ), # 1 +) +fix_spec(all_structs) +del all_structs diff --git a/portal_client.thrift b/portal_client.thrift index 0cd492c4..11d01bf2 100644 --- a/portal_client.thrift +++ b/portal_client.thrift @@ -188,9 +188,9 @@ service VirtualMachineService { /** * Get Ip and Port of server - * Returns: {'IP': ip, 'PORT': port} + * Returns: {'IP': ip, 'PORT': port,'UDP':udp} */ - map get_IP_PORT( + map get_ip_ports( /** Id of server */ 1: string openstack_id) @@ -302,6 +302,28 @@ service VirtualMachineService { throws (1:nameException e,2:ressourceException r,3:serverNotFoundException s,4: networkNotFoundException n,5:imageNotFoundException i,6:flavorNotFoundException f,7:otherException o), + /** + * Adds a security group to a server + */ + bool add_security_group_to_server( + /** If http ports are open*/ + 1:bool http, + + /** If https ports are open*/ + 2:bool https, + + /** If udp ports are open*/ + 3:bool udp, + + /** OpenStack id of the server*/ + 4:string server_id) + + throws (1:ressourceException r,2:serverNotFoundException s + + ) + + + /** * Get a Server. * Returns: A server instance. diff --git a/requirements.txt b/requirements.txt index fae916a8..ecaa22d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ setuptools==40.4.3 thrift >= 0.10.0,<0.20.0 python-keystoneclient -openstacksdk ==0.20.0 +openstacksdk ==0.27.0 deprecated == 1.2.4 Click==7.0 flake8