From af1e41ea6cfe6875a49c5f97333746db2f045270 Mon Sep 17 00:00:00 2001 From: GilGald Date: Tue, 9 Aug 2016 15:28:17 +0300 Subject: [PATCH 01/42] Adding Generic Static VM --- vCenterShellPackage/DataModel/datamodel.xml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/vCenterShellPackage/DataModel/datamodel.xml b/vCenterShellPackage/DataModel/datamodel.xml index 744c5e40..67f1fcfa 100644 --- a/vCenterShellPackage/DataModel/datamodel.xml +++ b/vCenterShellPackage/DataModel/datamodel.xml @@ -554,10 +554,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + vCenter Static VM Autoload + + + + + + + + + From 43abaaf8c8687cc236b1d988e524928ddbfd0e75 Mon Sep 17 00:00:00 2001 From: GilGald Date: Tue, 9 Aug 2016 15:39:48 +0300 Subject: [PATCH 02/42] Changed is locked by default. --- vCenterShellPackage/DataModel/datamodel.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vCenterShellPackage/DataModel/datamodel.xml b/vCenterShellPackage/DataModel/datamodel.xml index 67f1fcfa..84ec714b 100644 --- a/vCenterShellPackage/DataModel/datamodel.xml +++ b/vCenterShellPackage/DataModel/datamodel.xml @@ -555,7 +555,7 @@ - + From 007871ed6559567f38b41acfe33a5ed0e3979790 Mon Sep 17 00:00:00 2001 From: GilGald Date: Wed, 10 Aug 2016 13:01:45 +0300 Subject: [PATCH 03/42] added vcenter app discovery --- vCenterShell_specs/vcenter_app_discovery.ini | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vCenterShell_specs/vcenter_app_discovery.ini diff --git a/vCenterShell_specs/vcenter_app_discovery.ini b/vCenterShell_specs/vcenter_app_discovery.ini new file mode 100644 index 00000000..c5c62429 --- /dev/null +++ b/vCenterShell_specs/vcenter_app_discovery.ini @@ -0,0 +1,6 @@ +[Packaging] +is_driver: True +driver_folder: VCenterAutoloadVMDriver\app_discovery +include_dirs: +target_name: VCenter Autoload VM Driver +target_dir: Resource Drivers - Python \ No newline at end of file From e5b1333fc1122dd90ea855418b38a7a0d8bc8254 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 11 Aug 2016 11:12:20 +0300 Subject: [PATCH 04/42] Adding Autoload.xml file --- .../Configuration/AppAutoLoad.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vCenterShellPackage/Configuration/AppAutoLoad.xml diff --git a/vCenterShellPackage/Configuration/AppAutoLoad.xml b/vCenterShellPackage/Configuration/AppAutoLoad.xml new file mode 100644 index 00000000..bcd00d38 --- /dev/null +++ b/vCenterShellPackage/Configuration/AppAutoLoad.xml @@ -0,0 +1,18 @@ + + + + + A generic shell for loading existing vCenter VMs to CloudShell inventory. + + Fill in the inputs and click 'start discovery' to load a vCenter VM into CloudShell Inventory as a static VM. + + + + + + + + From 0423edbf0c828662f0a69a783cfd18dc833b4cbb Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 11 Aug 2016 13:09:48 +0300 Subject: [PATCH 05/42] -Removing the user inputs values. -Adding the driver implementation. --- static_vm_autoload_driver/__init__.py | 0 .../context_based_logger_factory.py | 33 ++++ static_vm_autoload_driver/drivermetadata.xml | 2 + static_vm_autoload_driver/requirements.txt | 4 + .../vm_autoload_driver.py | 145 ++++++++++++++++++ vCenterShellPackage/DataModel/datamodel.xml | 8 +- 6 files changed, 187 insertions(+), 5 deletions(-) create mode 100644 static_vm_autoload_driver/__init__.py create mode 100644 static_vm_autoload_driver/context_based_logger_factory.py create mode 100644 static_vm_autoload_driver/drivermetadata.xml create mode 100644 static_vm_autoload_driver/requirements.txt create mode 100644 static_vm_autoload_driver/vm_autoload_driver.py diff --git a/static_vm_autoload_driver/__init__.py b/static_vm_autoload_driver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/static_vm_autoload_driver/context_based_logger_factory.py b/static_vm_autoload_driver/context_based_logger_factory.py new file mode 100644 index 00000000..ab85fece --- /dev/null +++ b/static_vm_autoload_driver/context_based_logger_factory.py @@ -0,0 +1,33 @@ +from cloudshell.core.logger.qs_logger import get_qs_logger + + +class ContextBasedLoggerFactory(object): + UNSUPPORTED_CONTEXT_PROVIDED = 'Unsuppported command context provided {0}' + + def create_logger_for_context(self, logger_name, context): + """ + Create QS Logger for command context AutoLoadCommandContext or ResourceCommandContext + :param logger_name: + :type logger_name: str + :param context: + :return: logging.Logger + """ + if self._is_instance_of(context, 'AutoLoadCommandContext'): + reservation_id = 'Autoload' + handler_name = 'Default' + elif self._is_instance_of(context, 'ResourceCommandContext'): + reservation_id = context.reservation.reservation_id + handler_name = context.resource.name + elif self._is_instance_of(context, 'ResourceRemoteCommandContext'): + reservation_id = context.remote_reservation.reservation_id + handler_name = context.remote_endpoints[0].name + else: + raise Exception(ContextBasedLoggerFactory.UNSUPPORTED_CONTEXT_PROVIDED, context) + logger = get_qs_logger(log_file_prefix=handler_name, + log_group=reservation_id, + log_category=logger_name) + return logger + + @staticmethod + def _is_instance_of(context, type_name): + return context.__class__.__name__ == type_name diff --git a/static_vm_autoload_driver/drivermetadata.xml b/static_vm_autoload_driver/drivermetadata.xml new file mode 100644 index 00000000..9602721b --- /dev/null +++ b/static_vm_autoload_driver/drivermetadata.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/static_vm_autoload_driver/requirements.txt b/static_vm_autoload_driver/requirements.txt new file mode 100644 index 00000000..8dfeb4d7 --- /dev/null +++ b/static_vm_autoload_driver/requirements.txt @@ -0,0 +1,4 @@ +cloudshell-automation-api>=7.0.0.0,<7.1.0.0 +cloudshell-core>=2.0.0,<2.1.0 +cloudshell-cp-vcenter>=1.1.0,<1.2.0 +cloudshell-shell-core>=2.0.0,<2.1.0 \ No newline at end of file diff --git a/static_vm_autoload_driver/vm_autoload_driver.py b/static_vm_autoload_driver/vm_autoload_driver.py new file mode 100644 index 00000000..212b81d9 --- /dev/null +++ b/static_vm_autoload_driver/vm_autoload_driver.py @@ -0,0 +1,145 @@ +from cloudshell.api.cloudshell_api import InputNameValue +from cloudshell.api.cloudshell_api import CloudShellAPISession +from cloudshell.cp.vcenter.common.cloud_shell.driver_helper import CloudshellDriverHelper +from cloudshell.cp.vcenter.commands.load_vm import VMLoader +from cloudshell.cp.vcenter.common.vcenter.vmomi_service import pyVmomiService +from pyVim.connect import SmartConnect, Disconnect +from cloudshell.cp.vcenter.models.QualiDriverModels import AutoLoadAttribute, AutoLoadCommandContext, AutoLoadDetails +from cloudshell.cp.vcenter.common.model_factory import ResourceModelParser +from cloudshell.cp.vcenter.vm.ip_manager import VMIPManager +from cloudshell.core.logger.qs_logger import get_qs_logger +from cloudshell.cp.vcenter.common.vcenter.task_waiter import SynchronousTaskWaiter + +import jsonpickle + +DOMAIN = 'Global' + + +class DeployAppOrchestrationDriver(object): + def __init__(self): + self.cs_helper = CloudshellDriverHelper() + self.model_parser = ResourceModelParser() + self.ip_manager = VMIPManager() + self.task_waiter = SynchronousTaskWaiter() + self.logger = get_qs_logger('VM AutoLoad') + + def get_inventory(self, context): + """ + Will locate vm in vcenter and fill its uuid + :type context: cloudshell.shell.core.context.ResourceCommandContext + """ + vcenter_vm_name = context.resource.attributes['vCenter VM'] + vcenter_vm_name = vcenter_vm_name.replace('\\', '/') + vcenter_name = context.resource.attributes['vCenter Name'] + + self.logger.info('start autoloading vm_path: {0} on vcenter: {1}'.format(vcenter_vm_name, vcenter_name)) + + session = self.cs_helper.get_session(context.connectivity.server_address, + context.connectivity.admin_auth_token, + DOMAIN) + + vcenter_api_res = session.GetResourceDetails(vcenter_name) + vcenter_resource = self.model_parser.convert_to_vcenter_model(vcenter_api_res) + + si = None + pv_service = pyVmomiService(SmartConnect, Disconnect, self.task_waiter) + + try: + self.logger.info('connecting to vcenter ({0})'.format(vcenter_api_res.Address)) + si = self._get_connection_to_vcenter(pv_service, session, vcenter_resource, vcenter_api_res.Address) + + self.logger.info('loading vm uuid') + vm_loader = VMLoader(pv_service) + uuid = vm_loader.load_vm_uuid_by_name(si, vcenter_resource, vcenter_vm_name) + self.logger.info('vm uuid: {0}'.format(uuid)) + self.logger.info('loading the ip of the vm') + ip = self._try_get_ip(pv_service, si, uuid, vcenter_resource) + if ip: + session.UpdateResourceAddress(context.resource.name, ip) + + except Exception as e: + self.logger.error(e) + raise + finally: + if si: + pv_service.disconnect(si) + + return self._get_auto_load_response(uuid, vcenter_name, context.resource) + + def _get_auto_load_response(self, uuid, vcenter_name, resource): + vm_details = self._get_vm_details(uuid, vcenter_name, resource) + autoload_atts = [AutoLoadAttribute('', 'VmDetails', vm_details)] + return AutoLoadDetails([], autoload_atts) + + def _try_get_ip(self, pv_service, si, uuid, vcenter_resource): + ip = None + try: + vm = pv_service.get_vm_by_uuid(si, uuid) + ip_res = self.ip_manager.get_ip(vm, + vcenter_resource.holding_network, + self.ip_manager.get_ip_match_function(None), + cancellation_context=None, + timeout=None, + logger=self.logger) + if ip_res.ip_address: + ip = ip_res.ip_address + except Exception as e: + self.logger.debug('Error while trying to load VM({0}) IP'.format(uuid)) + return ip + + @staticmethod + def _get_vm_details(uuid, vcenter_name, resource): + vm_details = ApiVmDetails() + + vm_details.UID = uuid + vm_details.CloudProviderName = vcenter_name + + ip_regex = ApiVmCustomParam() + ip_regex.Name = 'ip_regex' + ip_regex.Value = resource.attributes['IP Regex'] + + timeout = ApiVmCustomParam() + timeout.Name = 'refresh_ip_timeout' + timeout.Value = resource.attributes['Refresh IP Timeout'] + + auto_power_off = ApiVmCustomParam() + auto_power_off.Name = 'auto_power_off' + auto_power_off.Value = resource.attributes['Auto Power Off'] + + # AutoDelete is set to False to prevent accidental termination of imported VM's + auto_delete = ApiVmCustomParam() + auto_delete.Name = 'auto_delete' + auto_delete.Value = 'False' + + vm_details.VmCustomParams.append(timeout) + vm_details.VmCustomParams.append(ip_regex) + vm_details.VmCustomParams.append(auto_power_off) + vm_details.VmCustomParams.append(auto_delete) + + str_vm_details = jsonpickle.encode(vm_details, unpicklable=False) + return str_vm_details + + def _get_connection_to_vcenter(self, pv_service, session, vcenter_resource, address): + password = self._decrypt_password(session, vcenter_resource.password) + si = pv_service.connect(address, + vcenter_resource.user, + password, + 443) + return si + + @staticmethod + def _decrypt_password(session, password): + return session.DecryptPassword(password).Value + + +class ApiVmDetails(object): + def __init__(self): + self.CloudProviderName = '' + self.UID = '' + self.VmCustomParams = [] + + +class ApiVmCustomParam(object): + def __init__(self): + self.Name = '' + self.Value = '' diff --git a/vCenterShellPackage/DataModel/datamodel.xml b/vCenterShellPackage/DataModel/datamodel.xml index 84ec714b..12978775 100644 --- a/vCenterShellPackage/DataModel/datamodel.xml +++ b/vCenterShellPackage/DataModel/datamodel.xml @@ -554,7 +554,6 @@ - @@ -563,13 +562,13 @@ - + - + - + @@ -585,7 +584,6 @@ - From 3d13d044dcc99681f88b8faa3de0639d72eeb6e9 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 11 Aug 2016 13:47:26 +0300 Subject: [PATCH 06/42] updated ini file autoload static vm --- vCenterShell_specs/vcenter_app_discovery.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vCenterShell_specs/vcenter_app_discovery.ini b/vCenterShell_specs/vcenter_app_discovery.ini index c5c62429..eaed65af 100644 --- a/vCenterShell_specs/vcenter_app_discovery.ini +++ b/vCenterShell_specs/vcenter_app_discovery.ini @@ -1,6 +1,6 @@ [Packaging] is_driver: True -driver_folder: VCenterAutoloadVMDriver\app_discovery +driver_folder: static_vm_autoload_driver include_dirs: -target_name: VCenter Autoload VM Driver +target_name: VCenter Autoload Static VM Driver target_dir: Resource Drivers - Python \ No newline at end of file From cd96917a46a32c8854ce2cd4f3d9f6a414d72b4c Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 11 Aug 2016 16:14:06 +0300 Subject: [PATCH 07/42] Creating driver ini --- static_vm_autoload_driver/drivermetadata.xml | 2 +- vCenterShellPackage/Configuration/AppAutoLoad.xml | 2 +- vCenterShellPackage/DataModel/datamodel.xml | 4 ++-- vCenterShell_specs/vcenter_app_discovery.ini | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/static_vm_autoload_driver/drivermetadata.xml b/static_vm_autoload_driver/drivermetadata.xml index 9602721b..f9e17bff 100644 --- a/static_vm_autoload_driver/drivermetadata.xml +++ b/static_vm_autoload_driver/drivermetadata.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/vCenterShellPackage/Configuration/AppAutoLoad.xml b/vCenterShellPackage/Configuration/AppAutoLoad.xml index bcd00d38..f6f7abd9 100644 --- a/vCenterShellPackage/Configuration/AppAutoLoad.xml +++ b/vCenterShellPackage/Configuration/AppAutoLoad.xml @@ -4,7 +4,7 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.qualisystems.com/ResourceManagement/ShellsConfigurationSchema.xsd"> - + A generic shell for loading existing vCenter VMs to CloudShell inventory. Fill in the inputs and click 'start discovery' to load a vCenter VM into CloudShell Inventory as a static VM. diff --git a/vCenterShellPackage/DataModel/datamodel.xml b/vCenterShellPackage/DataModel/datamodel.xml index 12978775..952a9dc0 100644 --- a/vCenterShellPackage/DataModel/datamodel.xml +++ b/vCenterShellPackage/DataModel/datamodel.xml @@ -576,7 +576,7 @@ - vCenter Static VM Autoload + VCenter Static VM Autoload @@ -588,7 +588,7 @@ - + diff --git a/vCenterShell_specs/vcenter_app_discovery.ini b/vCenterShell_specs/vcenter_app_discovery.ini index eaed65af..32c22d94 100644 --- a/vCenterShell_specs/vcenter_app_discovery.ini +++ b/vCenterShell_specs/vcenter_app_discovery.ini @@ -2,5 +2,5 @@ is_driver: True driver_folder: static_vm_autoload_driver include_dirs: -target_name: VCenter Autoload Static VM Driver +target_name: VCenter Static VM Autoload target_dir: Resource Drivers - Python \ No newline at end of file From ae4bbfed70cc7aaf96fdc95afd849ae112e385d7 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 17:14:57 +0300 Subject: [PATCH 08/42] removed folder --- static_vm_autoload_driver/__init__.py | 0 .../context_based_logger_factory.py | 33 ---- static_vm_autoload_driver/drivermetadata.xml | 2 - static_vm_autoload_driver/requirements.txt | 4 - .../vm_autoload_driver.py | 145 ------------------ 5 files changed, 184 deletions(-) delete mode 100644 static_vm_autoload_driver/__init__.py delete mode 100644 static_vm_autoload_driver/context_based_logger_factory.py delete mode 100644 static_vm_autoload_driver/drivermetadata.xml delete mode 100644 static_vm_autoload_driver/requirements.txt delete mode 100644 static_vm_autoload_driver/vm_autoload_driver.py diff --git a/static_vm_autoload_driver/__init__.py b/static_vm_autoload_driver/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/static_vm_autoload_driver/context_based_logger_factory.py b/static_vm_autoload_driver/context_based_logger_factory.py deleted file mode 100644 index ab85fece..00000000 --- a/static_vm_autoload_driver/context_based_logger_factory.py +++ /dev/null @@ -1,33 +0,0 @@ -from cloudshell.core.logger.qs_logger import get_qs_logger - - -class ContextBasedLoggerFactory(object): - UNSUPPORTED_CONTEXT_PROVIDED = 'Unsuppported command context provided {0}' - - def create_logger_for_context(self, logger_name, context): - """ - Create QS Logger for command context AutoLoadCommandContext or ResourceCommandContext - :param logger_name: - :type logger_name: str - :param context: - :return: logging.Logger - """ - if self._is_instance_of(context, 'AutoLoadCommandContext'): - reservation_id = 'Autoload' - handler_name = 'Default' - elif self._is_instance_of(context, 'ResourceCommandContext'): - reservation_id = context.reservation.reservation_id - handler_name = context.resource.name - elif self._is_instance_of(context, 'ResourceRemoteCommandContext'): - reservation_id = context.remote_reservation.reservation_id - handler_name = context.remote_endpoints[0].name - else: - raise Exception(ContextBasedLoggerFactory.UNSUPPORTED_CONTEXT_PROVIDED, context) - logger = get_qs_logger(log_file_prefix=handler_name, - log_group=reservation_id, - log_category=logger_name) - return logger - - @staticmethod - def _is_instance_of(context, type_name): - return context.__class__.__name__ == type_name diff --git a/static_vm_autoload_driver/drivermetadata.xml b/static_vm_autoload_driver/drivermetadata.xml deleted file mode 100644 index f9e17bff..00000000 --- a/static_vm_autoload_driver/drivermetadata.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/static_vm_autoload_driver/requirements.txt b/static_vm_autoload_driver/requirements.txt deleted file mode 100644 index 8dfeb4d7..00000000 --- a/static_vm_autoload_driver/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -cloudshell-automation-api>=7.0.0.0,<7.1.0.0 -cloudshell-core>=2.0.0,<2.1.0 -cloudshell-cp-vcenter>=1.1.0,<1.2.0 -cloudshell-shell-core>=2.0.0,<2.1.0 \ No newline at end of file diff --git a/static_vm_autoload_driver/vm_autoload_driver.py b/static_vm_autoload_driver/vm_autoload_driver.py deleted file mode 100644 index 212b81d9..00000000 --- a/static_vm_autoload_driver/vm_autoload_driver.py +++ /dev/null @@ -1,145 +0,0 @@ -from cloudshell.api.cloudshell_api import InputNameValue -from cloudshell.api.cloudshell_api import CloudShellAPISession -from cloudshell.cp.vcenter.common.cloud_shell.driver_helper import CloudshellDriverHelper -from cloudshell.cp.vcenter.commands.load_vm import VMLoader -from cloudshell.cp.vcenter.common.vcenter.vmomi_service import pyVmomiService -from pyVim.connect import SmartConnect, Disconnect -from cloudshell.cp.vcenter.models.QualiDriverModels import AutoLoadAttribute, AutoLoadCommandContext, AutoLoadDetails -from cloudshell.cp.vcenter.common.model_factory import ResourceModelParser -from cloudshell.cp.vcenter.vm.ip_manager import VMIPManager -from cloudshell.core.logger.qs_logger import get_qs_logger -from cloudshell.cp.vcenter.common.vcenter.task_waiter import SynchronousTaskWaiter - -import jsonpickle - -DOMAIN = 'Global' - - -class DeployAppOrchestrationDriver(object): - def __init__(self): - self.cs_helper = CloudshellDriverHelper() - self.model_parser = ResourceModelParser() - self.ip_manager = VMIPManager() - self.task_waiter = SynchronousTaskWaiter() - self.logger = get_qs_logger('VM AutoLoad') - - def get_inventory(self, context): - """ - Will locate vm in vcenter and fill its uuid - :type context: cloudshell.shell.core.context.ResourceCommandContext - """ - vcenter_vm_name = context.resource.attributes['vCenter VM'] - vcenter_vm_name = vcenter_vm_name.replace('\\', '/') - vcenter_name = context.resource.attributes['vCenter Name'] - - self.logger.info('start autoloading vm_path: {0} on vcenter: {1}'.format(vcenter_vm_name, vcenter_name)) - - session = self.cs_helper.get_session(context.connectivity.server_address, - context.connectivity.admin_auth_token, - DOMAIN) - - vcenter_api_res = session.GetResourceDetails(vcenter_name) - vcenter_resource = self.model_parser.convert_to_vcenter_model(vcenter_api_res) - - si = None - pv_service = pyVmomiService(SmartConnect, Disconnect, self.task_waiter) - - try: - self.logger.info('connecting to vcenter ({0})'.format(vcenter_api_res.Address)) - si = self._get_connection_to_vcenter(pv_service, session, vcenter_resource, vcenter_api_res.Address) - - self.logger.info('loading vm uuid') - vm_loader = VMLoader(pv_service) - uuid = vm_loader.load_vm_uuid_by_name(si, vcenter_resource, vcenter_vm_name) - self.logger.info('vm uuid: {0}'.format(uuid)) - self.logger.info('loading the ip of the vm') - ip = self._try_get_ip(pv_service, si, uuid, vcenter_resource) - if ip: - session.UpdateResourceAddress(context.resource.name, ip) - - except Exception as e: - self.logger.error(e) - raise - finally: - if si: - pv_service.disconnect(si) - - return self._get_auto_load_response(uuid, vcenter_name, context.resource) - - def _get_auto_load_response(self, uuid, vcenter_name, resource): - vm_details = self._get_vm_details(uuid, vcenter_name, resource) - autoload_atts = [AutoLoadAttribute('', 'VmDetails', vm_details)] - return AutoLoadDetails([], autoload_atts) - - def _try_get_ip(self, pv_service, si, uuid, vcenter_resource): - ip = None - try: - vm = pv_service.get_vm_by_uuid(si, uuid) - ip_res = self.ip_manager.get_ip(vm, - vcenter_resource.holding_network, - self.ip_manager.get_ip_match_function(None), - cancellation_context=None, - timeout=None, - logger=self.logger) - if ip_res.ip_address: - ip = ip_res.ip_address - except Exception as e: - self.logger.debug('Error while trying to load VM({0}) IP'.format(uuid)) - return ip - - @staticmethod - def _get_vm_details(uuid, vcenter_name, resource): - vm_details = ApiVmDetails() - - vm_details.UID = uuid - vm_details.CloudProviderName = vcenter_name - - ip_regex = ApiVmCustomParam() - ip_regex.Name = 'ip_regex' - ip_regex.Value = resource.attributes['IP Regex'] - - timeout = ApiVmCustomParam() - timeout.Name = 'refresh_ip_timeout' - timeout.Value = resource.attributes['Refresh IP Timeout'] - - auto_power_off = ApiVmCustomParam() - auto_power_off.Name = 'auto_power_off' - auto_power_off.Value = resource.attributes['Auto Power Off'] - - # AutoDelete is set to False to prevent accidental termination of imported VM's - auto_delete = ApiVmCustomParam() - auto_delete.Name = 'auto_delete' - auto_delete.Value = 'False' - - vm_details.VmCustomParams.append(timeout) - vm_details.VmCustomParams.append(ip_regex) - vm_details.VmCustomParams.append(auto_power_off) - vm_details.VmCustomParams.append(auto_delete) - - str_vm_details = jsonpickle.encode(vm_details, unpicklable=False) - return str_vm_details - - def _get_connection_to_vcenter(self, pv_service, session, vcenter_resource, address): - password = self._decrypt_password(session, vcenter_resource.password) - si = pv_service.connect(address, - vcenter_resource.user, - password, - 443) - return si - - @staticmethod - def _decrypt_password(session, password): - return session.DecryptPassword(password).Value - - -class ApiVmDetails(object): - def __init__(self): - self.CloudProviderName = '' - self.UID = '' - self.VmCustomParams = [] - - -class ApiVmCustomParam(object): - def __init__(self): - self.Name = '' - self.Value = '' From 22a3113402f70050ce6e5ed4b531424efd2159ca Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 17:46:44 +0300 Subject: [PATCH 09/42] updating Travis .yaml file to run tests --- .travis.yml | 13 +++++++++++-- runtestsStaticVM.py | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 runtestsStaticVM.py diff --git a/.travis.yml b/.travis.yml index fdc5ba3e..e7beac39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,27 @@ language: python python: - "2.7" +env: + - CLOUD_SHELL_SHELL_CORE = 1 + - CLOUD_SHELL_SHELL_CORE = 2 + + install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple - - pip install "cloudshell-shell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple + - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install "cloudshell-shell-core >=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install "cloudshell-shell-core >=2.4.0,<2.5.0" --extra-index-url https://testpypi.python.org/simple; fi - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple + + script: - pushd package - python setup.py develop - popd - - python runtests.py --with-coverage --cover-package=package --exclude-dir=integration + - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi + - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi after_success: coveralls diff --git a/runtestsStaticVM.py b/runtestsStaticVM.py new file mode 100644 index 00000000..9622e219 --- /dev/null +++ b/runtestsStaticVM.py @@ -0,0 +1,9 @@ +import nose +import nose.config +import sys +from nose.plugins.manager import DefaultPluginManager +c = nose.config.Config() +c.plugins=DefaultPluginManager() +c.srcDirs = ['static_vm_package'] +if not nose.run(config=c): + sys.exit(1) From 8f3c4e562a7e11530bfa5d2ab5c4a738e5b761cb Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 18:11:44 +0300 Subject: [PATCH 10/42] Fixing YAML tests --- .travis.yml | 52 ++++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index e7beac39..65f37b7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,23 @@ +--- +after_success: coveralls +env: + - CLOUD_SHELL_SHELL_CORE=1 + - CLOUD_SHELL_SHELL_CORE=2 +install: + - "pip install -r external_requirements.txt" + - "pip install -r test_requirements.txt" + - "pip install \"cloudshell-core>=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple" + - "if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi" + - "if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi" + - "pip install \"cloudshell-automation-api>=7.1.0.0,<7.2.0.0\" --extra-index-url https://testpypi.python.org/simple" language: python -python: - - "2.7" - -env: - - CLOUD_SHELL_SHELL_CORE = 1 - - CLOUD_SHELL_SHELL_CORE = 2 - - -install: - - pip install -r external_requirements.txt - - pip install -r test_requirements.txt - - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple - - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install "cloudshell-shell-core >=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple; fi - - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install "cloudshell-shell-core >=2.4.0,<2.5.0" --extra-index-url https://testpypi.python.org/simple; fi - - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple - - - -script: - - pushd package - - python setup.py develop - - popd - - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi - - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi - -after_success: - coveralls - -notifications: - webhools: https://qualisystems.getbadges.io/api/app/webhook/63350e33-4119-49c3-8127-075aaa022926 +notifications: + webhools: "https://qualisystems.getbadges.io/api/app/webhook/63350e33-4119-49c3-8127-075aaa022926" +python: + - "2.7" +script: + - "pushd package" + - "python setup.py develop" + - popd + - "if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi" + - "if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi" From 6c18c6579d3b07d92d4cbd077bec5081c6c27271 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 18:17:59 +0300 Subject: [PATCH 11/42] check yaml breaking test --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory index 696af038..eb704d28 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory @@ -51,7 +51,7 @@ class TestGetInventory(TestCase): vcenter_name="Prinplup", resource="Empoleon") str_vm_details = jsonpickle.decode(vm_details) - self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup") + self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup2") self.assertTrue(str_vm_details['UID']=='Piplup') From 872e81d9321dc5ba4cecf0a0cec83bb66a17fdee Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 18:22:14 +0300 Subject: [PATCH 12/42] undoing the tests --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory index eb704d28..696af038 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory @@ -51,7 +51,7 @@ class TestGetInventory(TestCase): vcenter_name="Prinplup", resource="Empoleon") str_vm_details = jsonpickle.decode(vm_details) - self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup2") + self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup") self.assertTrue(str_vm_details['UID']=='Piplup') From ec979b3d2f76b806c890bbd8e92615ee1b5f6831 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 18:27:59 +0300 Subject: [PATCH 13/42] Changing the yaml --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 65f37b7b..6bec6395 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ ---- after_success: coveralls env: - CLOUD_SHELL_SHELL_CORE=1 @@ -7,8 +6,8 @@ install: - "pip install -r external_requirements.txt" - "pip install -r test_requirements.txt" - "pip install \"cloudshell-core>=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple" - - "if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi" - - "if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi" + - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi - "pip install \"cloudshell-automation-api>=7.1.0.0,<7.2.0.0\" --extra-index-url https://testpypi.python.org/simple" language: python notifications: @@ -19,5 +18,5 @@ script: - "pushd package" - "python setup.py develop" - popd - - "if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi" - - "if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi" + - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi + - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi From 28796dc49ec952a044517a6e7811deea4b0d9d15 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 18:32:44 +0300 Subject: [PATCH 14/42] yaml2 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6bec6395..f4655728 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ install: - "pip install -r external_requirements.txt" - "pip install -r test_requirements.txt" - "pip install \"cloudshell-core>=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple" - - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi - - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi - "pip install \"cloudshell-automation-api>=7.1.0.0,<7.2.0.0\" --extra-index-url https://testpypi.python.org/simple" language: python notifications: @@ -18,5 +18,5 @@ script: - "pushd package" - "python setup.py develop" - popd - - if [[$CLOUD_SHELL_SHELL_CORE == 1]]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi - - if [[$CLOUD_SHELL_SHELL_CORE == 2]]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi From 5e2aaf0bde87745c238f92fa497b16085e879ea5 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 19:01:48 +0300 Subject: [PATCH 15/42] yaml3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4655728..aab28de1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ after_success: coveralls env: - - CLOUD_SHELL_SHELL_CORE=1 - - CLOUD_SHELL_SHELL_CORE=2 + - CLOUD_SHELL_SHELL_CORE + - CLOUD_SHELL_SHELL_CORE install: - "pip install -r external_requirements.txt" - "pip install -r test_requirements.txt" From 41a8da5c9d89e4c12830227a76e20205a4c0ac59 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 19:02:49 +0300 Subject: [PATCH 16/42] yaml3 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aab28de1..6b812ecd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ after_success: coveralls env: - - CLOUD_SHELL_SHELL_CORE - - CLOUD_SHELL_SHELL_CORE + - CLOUD_SHELL_SHELL_CORE='1' + - CLOUD_SHELL_SHELL_CORE='2' install: - "pip install -r external_requirements.txt" - "pip install -r test_requirements.txt" From f504c936e7b3bb375a98357f83b3da857a506fc7 Mon Sep 17 00:00:00 2001 From: GilGald Date: Thu, 25 Aug 2016 19:07:01 +0300 Subject: [PATCH 17/42] t1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6b812ecd..8532d214 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ install: - "pip install -r external_requirements.txt" - "pip install -r test_requirements.txt" - "pip install \"cloudshell-core>=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple" - - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE != '1']]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi - "pip install \"cloudshell-automation-api>=7.1.0.0,<7.2.0.0\" --extra-index-url https://testpypi.python.org/simple" language: python From 6aa27d857766176178aa147345a79f3bbce19d29 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:31:57 +0300 Subject: [PATCH 18/42] t2 --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8532d214..d1f24215 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,20 +3,20 @@ env: - CLOUD_SHELL_SHELL_CORE='1' - CLOUD_SHELL_SHELL_CORE='2' install: - - "pip install -r external_requirements.txt" - - "pip install -r test_requirements.txt" - - "pip install \"cloudshell-core>=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple" - - if [[$CLOUD_SHELL_SHELL_CORE != '1']]; then pip install \"cloudshell-shell-core >=2.0.0,<2.1.0\" --extra-index-url https://testpypi.python.org/simple; fi - - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install \"cloudshell-shell-core >=2.4.0,<2.5.0\" --extra-index-url https://testpypi.python.org/simple; fi - - "pip install \"cloudshell-automation-api>=7.1.0.0,<7.2.0.0\" --extra-index-url https://testpypi.python.org/simple" + - pip install -r external_requirements.txt + - pip install -r test_requirements.txt + - pip install cloudshell-core>=2.0.0,<2.1.0 --extra-index-url https://testpypi.python.org/simple + - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install cloudshell-shell-core>=2.0.0,<2.1.0 --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install cloudshell-shell-core>=2.4.0,<2.5.0 --extra-index-url https://testpypi.python.org/simple; fi + - pip install cloudshell-automation-api>=7.1.0.0,<7.2.0.0 --extra-index-url https://testpypi.python.org/simple language: python notifications: webhools: "https://qualisystems.getbadges.io/api/app/webhook/63350e33-4119-49c3-8127-075aaa022926" python: - "2.7" script: - - "pushd package" - - "python setup.py develop" + - pushd package + - python setup.py develop - popd - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi From ab641cf7db211e482b764af8017c28dd304abab3 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:36:45 +0300 Subject: [PATCH 19/42] t3 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d1f24215..d9281866 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ env: install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt - - pip install cloudshell-core>=2.0.0,<2.1.0 --extra-index-url https://testpypi.python.org/simple - - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install cloudshell-shell-core>=2.0.0,<2.1.0 --extra-index-url https://testpypi.python.org/simple; fi - - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install cloudshell-shell-core>=2.4.0,<2.5.0 --extra-index-url https://testpypi.python.org/simple; fi - - pip install cloudshell-automation-api>=7.1.0.0,<7.2.0.0 --extra-index-url https://testpypi.python.org/simple + - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple + - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install "cloudshell-shell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple; fi + - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install "cloudshell-shell-core>=2.4.0,<2.5.0" --extra-index-url https://testpypi.python.org/simple; fi + - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple language: python notifications: webhools: "https://qualisystems.getbadges.io/api/app/webhook/63350e33-4119-49c3-8127-075aaa022926" From 985a4e2fda28059ad4344101b6718e6cbfb2ff86 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:39:48 +0300 Subject: [PATCH 20/42] t2 --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9281866..7200c023 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,7 @@ env: install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt - - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple - - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then pip install "cloudshell-shell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple; fi - - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then pip install "cloudshell-shell-core>=2.4.0,<2.5.0" --extra-index-url https://testpypi.python.org/simple; fi + - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple language: python notifications: @@ -18,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - if [[$CLOUD_SHELL_SHELL_CORE == '1']]; then python runtests.py --with-coverage --cover-package=package --exclude-dir=integration; fi - - if [[$CLOUD_SHELL_SHELL_CORE == '2']]; then python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration; fi + - print $CLOUD_SHELL_SHELL_CORE + From a7eea07cb4b5608150432dc922cc1fd3694cefb2 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:50:25 +0300 Subject: [PATCH 21/42] t3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7200c023..77be8ac3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - print $CLOUD_SHELL_SHELL_CORE + - print "${CLOUD_SHELL_SHELL_CORE}" From 8e24698765895ecc1d28db51692464de05c7b974 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:53:24 +0300 Subject: [PATCH 22/42] 1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 77be8ac3..31a83c57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - print "${CLOUD_SHELL_SHELL_CORE}" + - echo $CLOUD_SHELL_SHELL_CORE From c9329a65decdd8da04de08c2d83b796ba5d95a0a Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:55:41 +0300 Subject: [PATCH 23/42] 4 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31a83c57..ba9a4e2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ after_success: coveralls env: - - CLOUD_SHELL_SHELL_CORE='1' - - CLOUD_SHELL_SHELL_CORE='2' + - CLOUD_SHELL_SHELL_CORE="1" + - CLOUD_SHELL_SHELL_CORE="2" install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - echo $CLOUD_SHELL_SHELL_CORE + - echo $CLOUD_SHELL_SHELL_CORE=="1" From 612b3e47b12dfafdda2b955a8da3c6219703c62e Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 11:58:07 +0300 Subject: [PATCH 24/42] 1 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ba9a4e2c..a4dde0ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ after_success: coveralls env: - CLOUD_SHELL_SHELL_CORE="1" - - CLOUD_SHELL_SHELL_CORE="2" + - CLOUD_SHELL_SHELL_CORE=$true install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - echo $CLOUD_SHELL_SHELL_CORE=="1" + - echo $CLOUD_SHELL_SHELL_CORE From 5308a77311f7f366a1a377248fe5ee6865d99827 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:00:34 +0300 Subject: [PATCH 25/42] 1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a4dde0ac..9d7539dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - echo $CLOUD_SHELL_SHELL_CORE + - if [$CLOUD_SHELL_SHELL_CORE==$true]; then echo 'true' fi From d9d59b4a36523ef6c14af0166aebe8d9dda84538 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:03:48 +0300 Subject: [PATCH 26/42] 1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9d7539dc..21cc2444 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - if [$CLOUD_SHELL_SHELL_CORE==$true]; then echo 'true' fi + - if [ "$CLOUD_SHELL_SHELL_CORE " -eq $true]; then echo 'true' fi From af59a8e6a65ce84025d8ab80437f3510c02ece68 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:04:50 +0300 Subject: [PATCH 27/42] ' --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 21cc2444..6c758cb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,5 @@ script: - pushd package - python setup.py develop - popd - - if [ "$CLOUD_SHELL_SHELL_CORE " -eq $true]; then echo 'true' fi + - if [ "$CLOUD_SHELL_SHELL_CORE" -eq "1" ]; then echo 'true' fi From 2d4310915fc26a26f1bb79fdab1e7810204e0cde Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:19:20 +0300 Subject: [PATCH 28/42] s --- .travis.yml | 8 ++++---- cloudshell_shell_core_install.sh | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 cloudshell_shell_core_install.sh diff --git a/.travis.yml b/.travis.yml index 6c758cb1..8a0e2e8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ after_success: coveralls env: - - CLOUD_SHELL_SHELL_CORE="1" - - CLOUD_SHELL_SHELL_CORE=$true + - CLOUD_SHELL_SHELL_CORE=1 + - CLOUD_SHELL_SHELL_CORE=2 install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple + - ./cloudshell_shell_core_install.sh - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple language: python notifications: @@ -15,6 +16,5 @@ python: script: - pushd package - python setup.py develop - - popd - - if [ "$CLOUD_SHELL_SHELL_CORE" -eq "1" ]; then echo 'true' fi + - popd diff --git a/cloudshell_shell_core_install.sh b/cloudshell_shell_core_install.sh new file mode 100644 index 00000000..c56a2551 --- /dev/null +++ b/cloudshell_shell_core_install.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ "${CLOUD_SHELL_SHELL_CORE}" -eq 1 ] +then + echo "111" +else + echo "222" +fi \ No newline at end of file From 9dc1332a73fa85e9a04c70ff56d4cd30efa4fee5 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:21:38 +0300 Subject: [PATCH 29/42] d --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8a0e2e8a..715e5f22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ install: - pip install -r external_requirements.txt - pip install -r test_requirements.txt - pip install "cloudshell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple + - chmod 777 ./cloudshell_shell_core_install.sh - ./cloudshell_shell_core_install.sh - pip install "cloudshell-automation-api>=7.1.0.0,<7.2.0.0" --extra-index-url https://testpypi.python.org/simple language: python From 247df2b709d1e1daae944fd7eea1156868feed71 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:28:33 +0300 Subject: [PATCH 30/42] 1 --- cloudshell_shell_core_install.sh | 4 ++-- cloudshell_shell_core_run_tests.sh | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cloudshell_shell_core_run_tests.sh diff --git a/cloudshell_shell_core_install.sh b/cloudshell_shell_core_install.sh index c56a2551..5306784f 100644 --- a/cloudshell_shell_core_install.sh +++ b/cloudshell_shell_core_install.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "${CLOUD_SHELL_SHELL_CORE}" -eq 1 ] then - echo "111" + pip install "cloudshell-shell-core>=2.0.0,<2.1.0" --extra-index-url https://testpypi.python.org/simple else - echo "222" + pip install "cloudshell-shell-core>=2.4.0,<2.5.0" --extra-index-url https://testpypi.python.org/simple fi \ No newline at end of file diff --git a/cloudshell_shell_core_run_tests.sh b/cloudshell_shell_core_run_tests.sh new file mode 100644 index 00000000..e9c4f49b --- /dev/null +++ b/cloudshell_shell_core_run_tests.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ "${CLOUD_SHELL_SHELL_CORE}" -eq 1 ] +then + python runtests.py --with-coverage --cover-package=package --exclude-dir=integration +else + python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration +fi \ No newline at end of file From 7f3ccf77baa9092ee3b06663b60d797a2c6dab47 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:30:23 +0300 Subject: [PATCH 31/42] 2 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 715e5f22..d7f424e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,5 @@ script: - pushd package - python setup.py develop - popd - + - chmod 777 ./cloudshell_shell_core_install.sh + - ./cloudshell_shell_core_run_tests.sh From e45f10749aba4da63a7979215cb19b26a417aa6f Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:31:51 +0300 Subject: [PATCH 32/42] q --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7f424e2..be41184e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,5 +18,5 @@ script: - pushd package - python setup.py develop - popd - - chmod 777 ./cloudshell_shell_core_install.sh + - chmod 777 ./cloudshell_shell_core_run_tests.sh - ./cloudshell_shell_core_run_tests.sh From 69cbb0f82c56ad8339ea12b8c170507cf11a1fd0 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:56:17 +0300 Subject: [PATCH 33/42] s --- .../Configuration/AppAutoLoad.xml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 vCenterShellPackage/Configuration/AppAutoLoad.xml diff --git a/vCenterShellPackage/Configuration/AppAutoLoad.xml b/vCenterShellPackage/Configuration/AppAutoLoad.xml deleted file mode 100644 index f6f7abd9..00000000 --- a/vCenterShellPackage/Configuration/AppAutoLoad.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - A generic shell for loading existing vCenter VMs to CloudShell inventory. - - Fill in the inputs and click 'start discovery' to load a vCenter VM into CloudShell Inventory as a static VM. - - - - - - - - From 32da17413ef185fe9b6466148980763e45ebeed1 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 12:58:34 +0300 Subject: [PATCH 34/42] gt --- .travis.yml | 4 ++-- ..._shell_core_run_tests.sh => run_static_or_vcenter_tests.sh | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename cloudshell_shell_core_run_tests.sh => run_static_or_vcenter_tests.sh (100%) diff --git a/.travis.yml b/.travis.yml index be41184e..be054e65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,5 +18,5 @@ script: - pushd package - python setup.py develop - popd - - chmod 777 ./cloudshell_shell_core_run_tests.sh - - ./cloudshell_shell_core_run_tests.sh + - chmod 777 ./run_static_or_vcenter_tests.sh + - ./run_static_or_vcenter_tests.sh diff --git a/cloudshell_shell_core_run_tests.sh b/run_static_or_vcenter_tests.sh similarity index 100% rename from cloudshell_shell_core_run_tests.sh rename to run_static_or_vcenter_tests.sh From bc59d6e004c3b94c4747293214408c944f569d5d Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 13:48:49 +0300 Subject: [PATCH 35/42] d --- vCenterShellPackage/DataModel/datamodel.xml | 31 --------------------- 1 file changed, 31 deletions(-) diff --git a/vCenterShellPackage/DataModel/datamodel.xml b/vCenterShellPackage/DataModel/datamodel.xml index 952a9dc0..744c5e40 100644 --- a/vCenterShellPackage/DataModel/datamodel.xml +++ b/vCenterShellPackage/DataModel/datamodel.xml @@ -554,41 +554,10 @@ - - - - - - - - - - - - - - - - - - - - - - - VCenter Static VM Autoload - - - - - - - - From c96ca4623f05800776bc06d1719e7909dd8f9577 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 13:59:04 +0300 Subject: [PATCH 36/42] Running static VM and vCenter test --- run_static_or_vcenter_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_static_or_vcenter_tests.sh b/run_static_or_vcenter_tests.sh index e9c4f49b..fe66be6a 100644 --- a/run_static_or_vcenter_tests.sh +++ b/run_static_or_vcenter_tests.sh @@ -1,7 +1,9 @@ #!/bin/bash if [ "${CLOUD_SHELL_SHELL_CORE}" -eq 1 ] then + echo "Running vCenter Tests" python runtests.py --with-coverage --cover-package=package --exclude-dir=integration else + echo "Running static VM Tests" python runtestsStaticVM.py --with-coverage --cover-package=package --exclude-dir=integration fi \ No newline at end of file From fdc643638f08434042f10ffc46f7861742a59604 Mon Sep 17 00:00:00 2001 From: GilGald Date: Sun, 28 Aug 2016 14:24:29 +0300 Subject: [PATCH 37/42] to py --- .../tests/{test_get_inventory => test_get_inventory.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename static_vm_package/VCenterAutoloadStaticVMDriver/tests/{test_get_inventory => test_get_inventory.py} (100%) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py similarity index 100% rename from static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory rename to static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py From f5ebeab459632521b760f602eb10cf908377d84e Mon Sep 17 00:00:00 2001 From: GilGald Date: Mon, 29 Aug 2016 12:20:47 +0300 Subject: [PATCH 38/42] typo --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py index 696af038..3953884e 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py @@ -21,7 +21,7 @@ def test_get_inventory(self): vcenter_data_model = Mock() vcenter_data_model.default_datacenter = 'name' self.deploy_app_orchestration_driver.cs_helper.get_session = Mock(return_value=Mock()) - self.deploy_app_orchestration_driver.model_parser.convert_to_vcenter_model = Mock( + self.deploy_app_orchetration_driver.model_parser.convert_to_vcenter_model = Mock( return_value=vcenter_data_model) self.deploy_app_orchestration_driver._get_connection_to_vcenter = Mock(return_value=Mock()) self.deploy_app_orchestration_driver._try_get_ip = Mock(return_value=Mock()) From a5e74cdff74b07b37103711aa23aa11becca4742 Mon Sep 17 00:00:00 2001 From: GilGald Date: Mon, 29 Aug 2016 13:35:27 +0300 Subject: [PATCH 39/42] rt --- runtests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtests.py b/runtests.py index 4603b582..6432b2cf 100644 --- a/runtests.py +++ b/runtests.py @@ -1,3 +1,4 @@ +import re import nose import nose.config import sys @@ -5,5 +6,13 @@ c = nose.config.Config() c.plugins=DefaultPluginManager() c.srcDirs = ['package'] + + +# c.ignoreFiles.append('vm_autoload_driver') +c.ignoreFiles.append(re.compile(r'^vm_autoload_driver\.py$')) +c.ignoreFiles.append(re.compile(r'^test_get_inventory\.py$')) +c.ignoreFiles.append(re.compile(r'^DeployAppOrchestrationDriver$')) + + if not nose.run(config=c): sys.exit(1) From 01a7499c021a4b1cb18f078b38002286ab55a6c1 Mon Sep 17 00:00:00 2001 From: GilGald Date: Mon, 29 Aug 2016 14:25:11 +0300 Subject: [PATCH 40/42] typo --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py index 3953884e..696af038 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py @@ -21,7 +21,7 @@ def test_get_inventory(self): vcenter_data_model = Mock() vcenter_data_model.default_datacenter = 'name' self.deploy_app_orchestration_driver.cs_helper.get_session = Mock(return_value=Mock()) - self.deploy_app_orchetration_driver.model_parser.convert_to_vcenter_model = Mock( + self.deploy_app_orchestration_driver.model_parser.convert_to_vcenter_model = Mock( return_value=vcenter_data_model) self.deploy_app_orchestration_driver._get_connection_to_vcenter = Mock(return_value=Mock()) self.deploy_app_orchestration_driver._try_get_ip = Mock(return_value=Mock()) From 91b1e3ddbbd1f1ae401c0cb52cfa60a7f03c46c0 Mon Sep 17 00:00:00 2001 From: GilGald Date: Mon, 29 Aug 2016 14:30:04 +0300 Subject: [PATCH 41/42] fail --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py index 696af038..61010054 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py @@ -45,6 +45,8 @@ def test_get_inventory(self): self.assertTrue(self.deploy_app_orchestration_driver._try_get_ip.called) self.assertTrue(self.deploy_app_orchestration_driver._get_vm_details.called) self.assertTrue(self.deploy_app_orchestration_driver.pv_service.find_vm_by_name.called) + self.assertTrue(1==2) + def test_get_vm_details(self): vm_details = self.deploy_app_orchestration_driver._get_vm_details(uuid="Piplup", @@ -53,6 +55,7 @@ def test_get_vm_details(self): str_vm_details = jsonpickle.decode(vm_details) self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup") self.assertTrue(str_vm_details['UID']=='Piplup') + self.assertTrue(1==2) From 6134dbf1c97213a14582cd0f2eff2ef1f9bfe24b Mon Sep 17 00:00:00 2001 From: GilGald Date: Mon, 29 Aug 2016 14:31:57 +0300 Subject: [PATCH 42/42] fixing test_get_inventory --- .../VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py index 61010054..9b10b8a4 100644 --- a/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py +++ b/static_vm_package/VCenterAutoloadStaticVMDriver/tests/test_get_inventory.py @@ -45,7 +45,7 @@ def test_get_inventory(self): self.assertTrue(self.deploy_app_orchestration_driver._try_get_ip.called) self.assertTrue(self.deploy_app_orchestration_driver._get_vm_details.called) self.assertTrue(self.deploy_app_orchestration_driver.pv_service.find_vm_by_name.called) - self.assertTrue(1==2) + def test_get_vm_details(self): @@ -55,7 +55,7 @@ def test_get_vm_details(self): str_vm_details = jsonpickle.decode(vm_details) self.assertTrue(str_vm_details['CloudProviderName']=="Prinplup") self.assertTrue(str_vm_details['UID']=='Piplup') - self.assertTrue(1==2) +