class TestConnectBulk(TestCase): @patch('common.model_factory.ResourceModelParser.convert_to_resource_model', MockResourceParser.convert_to_resource_model) def setUp(self): self.resource = Mock() self.context = Mock() session = Mock() remote_resource = Mock() remote_resource.fullname = 'this is full name of the remote resource' remote_resource.uuid = 'this is full uuis of the remote resource' self.connection_details = TestCredentials() self.context.resource = self.resource self.context.remote_endpoints = [self.resource] self.command_orchestrator = CommandOrchestrator(self.context) self.command_orchestrator.cs_helper = Mock() self.command_orchestrator.cs_helper.get_session = Mock(return_value=session) self.command_orchestrator.cs_helper.get_connection_details = Mock(return_value=self.connection_details) self.command_orchestrator.vc_data_model.default_dvswitch = 'QualiSB\\dvSwitch' self.command_orchestrator.vc_data_model.default_port_group_location = 'QualiSB' self.command_orchestrator.vc_data_model.holding_network = 'QualiSB/anetwork' self.ports = Mock() self.command_orchestrator._parse_remote_model = Mock(return_value=remote_resource) self.command_orchestrator.connection_orchestrator.disconnector.default_network = \ self.command_orchestrator.vc_data_model.holding_network def test_connect_bulk(self): json = self._get_connect_json() results = self.command_orchestrator.connect_bulk(self.context, json) print results def test_disconnect_bulk(self): json = self._get_disconnect_json() results = self.command_orchestrator.connect_bulk(self.context, json) print results def _get_disconnect_json(self): return jsonpickle.encode({"driverRequest":{"actions":[{"connectionId":"2e85db89-f1c9-4da2-b738-6ed57d7c8ec6","connectionParams":{"vlanIds":["2"],"mode":"Access","type":"setVlanParameter"},"connectorAttributes":[{"attributeName":"Interface","attributeValue":"00:50:56:a2:3c:83","type":"connectorAttribute"}],"actionId":"27409903-4d80-4607-8be2-8140285f87e6","actionTarget":{"fullName":"VM Deployment_6693d80d","fullAddress":"N/A","type":"actionTarget"},"customActionAttributes":[{"attributeName":"VM_UUID","attributeValue":"422279ec-e35a-b63f-591a-5e748514056d","type":"customAttribute"}],"type":"removeVlan"},{"connectionId":"2e85db89-f1c9-4da2-b738-6ed57d7c8ec6","connectionParams":{"vlanIds":["2"],"mode":"Access","type":"setVlanParameter"},"connectorAttributes":[{"attributeName":"Interface","attributeValue":"00:50:56:a2:4f:e2","type":"connectorAttribute"}],"actionId":"20d37283-3f90-4d5b-a949-5851629f20e6","actionTarget":{"fullName":"VM Deployment_44256851","fullAddress":"N/A","type":"actionTarget"},"customActionAttributes":[{"attributeName":"VM_UUID","attributeValue":"422217cb-1de3-1faf-bc42-401e9ecee942","type":"customAttribute"}],"type":"removeVlan"}]}}) def _get_connect_json(self): return jsonpickle.encode({"driverRequest":{"actions":[{"connectionId":"4e7c7249-be28-4bd4-b528-0cb14a18b64d","connectionParams":{"vlanIds":["2"],"mode":"Access","type":"setVlanParameter"},"connectorAttributes":[],"actionId":"f1fcd6c0-f9c2-45f6-8ad2-c996a96e87e7","actionTarget":{"fullName":"VM Deployment_7c6cf268","fullAddress":"N/A","type":"actionTarget"},"customActionAttributes":[{"attributeName":"VM_UUID","attributeValue":"4222a08b-4034-d611-dda4-a45d51828865","type":"customAttribute"}],"type":"setVlan"}]}})
class VCenterShellDriver(ResourceDriverInterface): def cleanup(self): pass def __init__(self): """ ctor must be without arguments, it is created with reflection at run time """ self.request_parser = DriverRequestParser() self.command_orchestrator = CommandOrchestrator( ) # type: CommandOrchestrator self.deployments = dict() self.deployments[ 'vCenter Clone VM From VM'] = self.deploy_clone_from_vm self.deployments[ 'VCenter Deploy VM From Linked Clone'] = self.deploy_from_linked_clone self.deployments[ 'vCenter VM From Template'] = self.deploy_from_template self.deployments['vCenter VM From Image'] = self.deploy_from_image def initialize(self, **kwargs): pass def ApplyConnectivityChanges(self, context, request): return self.command_orchestrator.connect_bulk(context, request) def disconnect_all(self, context, ports): return self.command_orchestrator.disconnect_all(context, ports) def disconnect(self, context, ports, network_name): return self.command_orchestrator.disconnect(context, ports, network_name) def DeleteInstance(self, context, ports): return self.command_orchestrator.DeleteInstance(context, ports) def remote_refresh_ip(self, context, cancellation_context, ports): return self.command_orchestrator.refresh_ip(context, cancellation_context, ports) def PowerOff(self, context, ports): return self.command_orchestrator.power_off(context, ports) # the name is by the Qualisystems conventions def PowerOn(self, context, ports): """ Powers off the remote vm :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! """ return self.command_orchestrator.power_on(context, ports) # the name is by the Qualisystems conventions def PowerCycle(self, context, ports, delay): return self.command_orchestrator.power_cycle(context, ports, delay) def Deploy(self, context, request=None, cancellation_context=None): """ :param ResourceCommandContext context: :param str request: json string to be parsed :param cancellation_context: :return: """ RESOURCE_POOL_ATTR = "App Pool Name" CP_RESTRICTED_ATTR = "Restricted App Model Pools" api = CloudShellSessionContext(context).get_api() res_id = context.reservation.reservation_id # VALIDATE THAT CLOUD PROVIDER RESOURCE HAS POOL LIST Attribute cp_attrs = context.resource.attributes try: cp_pool_list_val = cp_attrs[CP_RESTRICTED_ATTR] except KeyError: pass else: api.WriteMessageToReservationOutput(res_id, "=== full request json ===") api.WriteMessageToReservationOutput(res_id, request) request_obj = json.loads(request) request_action_params = request_obj["driverRequest"]["actions"][0][ "actionParams"] app_name = request_action_params["appName"] deployment = request_action_params["deployment"] app_resource = request_action_params["appResource"] app_resource_attrs = app_resource["attributes"] pool_attr_search = [ attr for attr in app_resource_attrs if attr["attributeName"] == RESOURCE_POOL_ATTR ] if pool_attr_search: app_pool_attr_val = pool_attr_search[0]["attributeValue"] restricted_attrs_dict = get_cp_restricted_attrs_dict( cp_pool_list_val) try: app_pool_limit = restricted_attrs_dict[app_pool_attr_val] except KeyError: not_found_msg = "{} pool name key not in cp restricted list {}".format( app_pool_attr_val, restricted_attrs_dict) api.WriteMessageToReservationOutput(res_id, not_found_msg) else: # count deployed apps all_generic_app_resources = api.FindResources( resourceFamily="Generic App Family").Resources # collect matching apps matching_apps = [] for resource in all_generic_app_resources: attrs = api.GetResourceDetails( resource.Name).ResourceAttributes attr_search = [ attr for attr in attrs if attr.Name == RESOURCE_POOL_ATTR ] if attr_search: attr_val = attr_search[0].Value if attr_val == app_pool_attr_val: matching_apps.append(resource) # PERFORM VALIDATION if len(matching_apps) >= int(app_pool_limit): matching_app_names = [r.Name for r in matching_apps] exc_msg = "Can not deploy '{}'. The pool '{}' has reached it's limit of {}. Current Apps in Pool: {}".format( app_name, app_pool_attr_val, app_pool_limit, matching_app_names) api.WriteMessageToReservationOutput( res_id, '<span style="color:red">{}</span>'.format( exc_msg)) raise AppLimitDeploymentError(exc_msg) actions = self.request_parser.convert_driver_request_to_actions( request) deploy_action = single(actions, lambda x: isinstance(x, DeployApp)) deployment_name = deploy_action.actionParams.deployment.deploymentPath if deployment_name in self.deployments.keys(): deploy_method = self.deployments[deployment_name] deploy_result = deploy_method(context, deploy_action, cancellation_context) return DriverResponse([deploy_result]).to_driver_response_json() else: raise Exception('Could not find the deployment') def SaveApp(self, context, request, cancellation_context=None): actions = self.request_parser.convert_driver_request_to_actions( request) save_actions = [x for x in actions if isinstance(x, SaveApp)] save_app_results = self.command_orchestrator.save_sandbox( context, save_actions, cancellation_context) return DriverResponse(save_app_results).to_driver_response_json() def DeleteSavedApps(self, context, request, cancellation_context=None): actions = self.request_parser.convert_driver_request_to_actions( request) delete_actions = [x for x in actions if isinstance(x, DeleteSavedApp)] save_app_results = self.command_orchestrator.delete_saved_sandbox( context, delete_actions, cancellation_context) return DriverResponse(save_app_results).to_driver_response_json() def deploy_from_template(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_from_template( context, deploy_action, cancellation_context) def deploy_clone_from_vm(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_clone_from_vm( context, deploy_action, cancellation_context) def deploy_from_linked_clone(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_from_linked_clone( context, deploy_action, cancellation_context) def deploy_from_image(self, context, deploy_action, cancellation_context): if cancellation_context is None: cancellation_context = CancellationContext() return self.command_orchestrator.deploy_from_image( context, deploy_action, cancellation_context) def get_inventory(self, context): """ :type context: models.QualiDriverModels.AutoLoadCommandContext """ validator = VCenterAutoModelDiscovery() return validator.validate_and_discover(context) def remote_save_snapshot(self, context, ports, snapshot_name, save_memory): """ Saves virtual machine to a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: snapshot name to save to :type snapshot_name: str :param save_memory: Snapshot the virtual machine's memory. Lookup, Yes / No :type save_memory: str :return: """ return self.command_orchestrator.save_snapshot(context, snapshot_name, save_memory) def remote_restore_snapshot(self, context, ports, snapshot_name): """ Restores virtual machine from a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: Snapshot name to restore from :type snapshot_name: str :return: """ return self.command_orchestrator.restore_snapshot( context, snapshot_name) def remote_get_snapshots(self, context, ports): """ Returns list of snapshots :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :return: list """ return self.command_orchestrator.get_snapshots(context) def orchestration_save(self, context, ports, mode="shallow", custom_params=None): return self.command_orchestrator.orchestration_save( context, mode, custom_params) def orchestration_restore(self, context, ports, saved_details): return self.command_orchestrator.orchestration_restore( context, saved_details) def get_vm_uuid(self, context, vm_name): return self.command_orchestrator.get_vm_uuid_by_name(context, vm_name) def GetVmDetails(self, context, cancellation_context, requests): return self.command_orchestrator.get_vm_details( context, cancellation_context, requests)
class VCenterShellDriver(ResourceDriverInterface): def cleanup(self): pass def __init__(self): """ ctor must be without arguments, it is created with reflection at run time """ self.command_orchestrator = CommandOrchestrator( ) # type: CommandOrchestrator def initialize(self): pass def ApplyConnectivityChanges(self, context, request): return self.command_orchestrator.connect_bulk(context, request) def disconnect_all(self, context, ports): return self.command_orchestrator.disconnect_all(context, ports) def disconnect(self, context, ports, network_name): return self.command_orchestrator.disconnect(context, ports, network_name) def destroy_vm_only(self, context, ports): return self.command_orchestrator.destroy_vm_only(context, ports) def remote_refresh_ip(self, context, cancellation_context, ports): return self.command_orchestrator.refresh_ip(context, cancellation_context, ports) def PowerOff(self, context, ports): return self.command_orchestrator.power_off(context, ports) # the name is by the Qualisystems conventions def PowerOn(self, context, ports): """ Powers off the remote vm :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! """ return self.command_orchestrator.power_on(context, ports) # the name is by the Qualisystems conventions def PowerCycle(self, context, ports, delay): return self.command_orchestrator.power_cycle(context, ports, delay) def deploy_from_template(self, context, deploy_data): return self.command_orchestrator.deploy_from_template( context, deploy_data) def deploy_clone_from_vm(self, context, deploy_data): return self.command_orchestrator.deploy_clone_from_vm( context, deploy_data) def deploy_from_linked_clone(self, context, deploy_data): return self.command_orchestrator.deploy_from_linked_clone( context, deploy_data) def deploy_from_image(self, context, deploy_data): return self.command_orchestrator.deploy_from_image( context, deploy_data) def get_inventory(self, context): """ :type context: models.QualiDriverModels.AutoLoadCommandContext """ validator = VCenterAutoModelDiscovery() return validator.validate_and_discover(context) def remote_save_snapshot(self, context, ports, snapshot_name): """ Saves virtual machine to a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: snapshot name to save to :type snapshot_name: str :return: """ return self.command_orchestrator.save_snapshot(context, snapshot_name) def remote_restore_snapshot(self, context, ports, snapshot_name): """ Restores virtual machine from a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: Snapshot name to restore from :type snapshot_name: str :return: """ return self.command_orchestrator.restore_snapshot( context, snapshot_name) def remote_get_snapshots(self, context, ports): """ Returns list of snapshots :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :return: list """ return self.command_orchestrator.get_snapshots(context) def orchestration_save(self, context, ports, mode="shallow", custom_params=None): return self.command_orchestrator.orchestration_save( context, mode, custom_params) def orchestration_restore(self, context, ports, saved_details): return self.command_orchestrator.orchestration_restore( context, saved_details) def get_vm_uuid(self, context, vm_name): return self.command_orchestrator.get_vm_uuid_by_name(context, vm_name)
class VCenterShellDriver (ResourceDriverInterface): def cleanup(self): pass def __init__(self): """ ctor must be without arguments, it is created with reflection at run time """ self.command_orchestrator = CommandOrchestrator() # type: CommandOrchestrator def initialize(self): pass def ApplyConnectivityChanges(self, context, request): return self.command_orchestrator.connect_bulk(context, request) def disconnect_all(self, context, ports): return self.command_orchestrator.disconnect_all(context, ports) def disconnect(self, context, ports, network_name): return self.command_orchestrator.disconnect(context, ports, network_name) def destroy_vm(self, context, ports): return self.command_orchestrator.destroy_vm(context, ports) def destroy_vm_only(self, context, ports): return self.command_orchestrator.destroy_vm_only(context, ports) def remote_refresh_ip(self, context, cancellation_context, ports): return self.command_orchestrator.refresh_ip(context, cancellation_context, ports) def PowerOff(self, context, ports): return self.command_orchestrator.power_off(context, ports) # the name is by the Qualisystems conventions def PowerOn(self, context, ports): """ Powers off the remote vm :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! """ return self.command_orchestrator.power_on(context, ports) # the name is by the Qualisystems conventions def PowerCycle(self, context, ports, delay): return self.command_orchestrator.power_cycle(context, ports, delay) def deploy_from_template(self, context, deploy_data): return self.command_orchestrator.deploy_from_template(context, deploy_data) def deploy_from_image(self, context, deploy_data): return self.command_orchestrator.deploy_from_image(context, deploy_data) def get_inventory(self, context): """ :type context: models.QualiDriverModels.AutoLoadCommandContext """ validator = VCenterAutoModelDiscovery() return validator.validate_and_discover(context)
class VCenterShellDriver (ResourceDriverInterface): def cleanup(self): pass def __init__(self): """ ctor must be without arguments, it is created with reflection at run time """ self.command_orchestrator = CommandOrchestrator() # type: CommandOrchestrator def initialize(self): pass def ApplyConnectivityChanges(self, context, request): return self.command_orchestrator.connect_bulk(context, request) def disconnect_all(self, context, ports): return self.command_orchestrator.disconnect_all(context, ports) def disconnect(self, context, ports, network_name): return self.command_orchestrator.disconnect(context, ports, network_name) def destroy_vm_only(self, context, ports): return self.command_orchestrator.destroy_vm_only(context, ports) def remote_refresh_ip(self, context, cancellation_context, ports): return self.command_orchestrator.refresh_ip(context, cancellation_context, ports) def PowerOff(self, context, ports): return self.command_orchestrator.power_off(context, ports) # the name is by the Qualisystems conventions def PowerOn(self, context, ports): """ Powers off the remote vm :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! """ return self.command_orchestrator.power_on(context, ports) # the name is by the Qualisystems conventions def PowerCycle(self, context, ports, delay): return self.command_orchestrator.power_cycle(context, ports, delay) def deploy_from_template(self, context, deploy_data): return self.command_orchestrator.deploy_from_template(context, deploy_data) def deploy_clone_from_vm(self, context, deploy_data): return self.command_orchestrator.deploy_clone_from_vm(context, deploy_data) def deploy_from_linked_clone(self, context, deploy_data): return self.command_orchestrator.deploy_from_linked_clone(context, deploy_data) def deploy_from_image(self, context, deploy_data): return self.command_orchestrator.deploy_from_image(context, deploy_data) def get_inventory(self, context): """ :type context: models.QualiDriverModels.AutoLoadCommandContext """ validator = VCenterAutoModelDiscovery() return validator.validate_and_discover(context) def remote_save_snapshot(self, context, ports, snapshot_name): """ Saves virtual machine to a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: snapshot name to save to :type snapshot_name: str :return: """ return self.command_orchestrator.save_snapshot(context, snapshot_name) def remote_restore_snapshot(self, context, ports, snapshot_name): """ Restores virtual machine from a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: Snapshot name to restore from :type snapshot_name: str :return: """ return self.command_orchestrator.restore_snapshot(context, snapshot_name) def remote_get_snapshots(self, context, ports): """ Returns list of snapshots :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :return: list """ return self.command_orchestrator.get_snapshots(context) def orchestration_save(self, context, ports, mode="shallow", custom_params=None): return self.command_orchestrator.orchestration_save(context, mode, custom_params) def orchestration_restore(self, context, ports, saved_details): return self.command_orchestrator.orchestration_restore(context, saved_details) def get_vm_uuid(self, context, vm_name): return self.command_orchestrator.get_vm_uuid_by_name(context, vm_name)
class VCenterShellDriver(ResourceDriverInterface): def cleanup(self): pass def __init__(self): """ ctor must be without arguments, it is created with reflection at run time """ self.request_parser = DriverRequestParser() self.command_orchestrator = CommandOrchestrator( ) # type: CommandOrchestrator self.deployments = dict() self.deployments[ 'vCenter Clone VM From VM'] = self.deploy_clone_from_vm self.deployments[ 'VCenter Deploy VM From Linked Clone'] = self.deploy_from_linked_clone self.deployments[ 'vCenter VM From Template'] = self.deploy_from_template self.deployments['vCenter VM From Image'] = self.deploy_from_image def initialize(self, **kwargs): pass def ApplyConnectivityChanges(self, context, request): return self.command_orchestrator.connect_bulk(context, request) def disconnect_all(self, context, ports): return self.command_orchestrator.disconnect_all(context, ports) def disconnect(self, context, ports, network_name): return self.command_orchestrator.disconnect(context, ports, network_name) def DeleteInstance(self, context, ports): return self.command_orchestrator.DeleteInstance(context, ports) def remote_refresh_ip(self, context, cancellation_context, ports): return self.command_orchestrator.refresh_ip(context, cancellation_context, ports) def PowerOff(self, context, ports): return self.command_orchestrator.power_off(context, ports) # the name is by the Qualisystems conventions def PowerOn(self, context, ports): """ Powers off the remote vm :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!! """ return self.command_orchestrator.power_on(context, ports) # the name is by the Qualisystems conventions def PowerCycle(self, context, ports, delay): return self.command_orchestrator.power_cycle(context, ports, delay) def Deploy(self, context, request=None, cancellation_context=None): actions = self.request_parser.convert_driver_request_to_actions( request) deploy_action = single(actions, lambda x: isinstance(x, DeployApp)) deployment_name = deploy_action.actionParams.deployment.deploymentPath if deployment_name in self.deployments.keys(): deploy_method = self.deployments[deployment_name] deploy_result = deploy_method(context, deploy_action, cancellation_context) return DriverResponse([deploy_result]).to_driver_response_json() else: raise Exception('Could not find the deployment') def SaveApp(self, context, request, cancellation_context=None): actions = self.request_parser.convert_driver_request_to_actions( request) save_actions = [x for x in actions if isinstance(x, SaveApp)] save_app_results = self.command_orchestrator.save_sandbox( context, save_actions, cancellation_context) return DriverResponse(save_app_results).to_driver_response_json() def DeleteSavedApps(self, context, request, cancellation_context=None): actions = self.request_parser.convert_driver_request_to_actions( request) delete_actions = [x for x in actions if isinstance(x, DeleteSavedApp)] save_app_results = self.command_orchestrator.delete_saved_sandbox( context, delete_actions, cancellation_context) return DriverResponse(save_app_results).to_driver_response_json() def deploy_from_template(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_from_template( context, deploy_action, cancellation_context) def deploy_clone_from_vm(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_clone_from_vm( context, deploy_action, cancellation_context) def deploy_from_linked_clone(self, context, deploy_action, cancellation_context): return self.command_orchestrator.deploy_from_linked_clone( context, deploy_action, cancellation_context) def deploy_from_image(self, context, deploy_action, cancellation_context): if cancellation_context is None: cancellation_context = CancellationContext() return self.command_orchestrator.deploy_from_image( context, deploy_action, cancellation_context) def get_inventory(self, context): """ :type context: models.QualiDriverModels.AutoLoadCommandContext """ validator = VCenterAutoModelDiscovery() return validator.validate_and_discover(context) def remote_save_snapshot(self, context, ports, snapshot_name, save_memory): """ Saves virtual machine to a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: snapshot name to save to :type snapshot_name: str :param save_memory: Snapshot the virtual machine's memory. Lookup, Yes / No :type save_memory: str :return: """ return self.command_orchestrator.save_snapshot(context, snapshot_name, save_memory) def remote_restore_snapshot(self, context, ports, snapshot_name): """ Restores virtual machine from a snapshot :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :param snapshot_name: Snapshot name to restore from :type snapshot_name: str :return: """ return self.command_orchestrator.restore_snapshot( context, snapshot_name) def remote_get_snapshots(self, context, ports): """ Returns list of snapshots :param context: resource context of the vCenterShell :type context: models.QualiDriverModels.ResourceCommandContext :param ports:list[string] ports: the ports of the connection between the remote resource and the local resource :type ports: list[string] :return: list """ return self.command_orchestrator.get_snapshots(context) def orchestration_save(self, context, ports, mode="shallow", custom_params=None): return self.command_orchestrator.orchestration_save( context, mode, custom_params) def orchestration_restore(self, context, ports, saved_details): return self.command_orchestrator.orchestration_restore( context, saved_details) def get_vm_uuid(self, context, vm_name): return self.command_orchestrator.get_vm_uuid_by_name(context, vm_name) def GetVmDetails(self, context, cancellation_context, requests): return self.command_orchestrator.get_vm_details( context, cancellation_context, requests)