コード例 #1
0
    def deploy_from_image(self, context, deploy_data):
        """
        Deploy From Image Command, will deploy vm from ovf image

        :param models.QualiDriverModels.ResourceCommandContext context: the context of the command
        :param str deploy_data: represent a json of the parameters, example: {
                "image_url": "c:\image.ovf" or
                             "\\nas\shared\image.ovf" or
                             "http://192.168.65.88/ovf/Debian%2064%20-%20Yoav.ovf",
                "cluster_name": "QualiSB Cluster",
                "resource_pool": "LiverPool",
                "datastore_name": "eric ds cluster",
                "datacenter_name": "QualiSB"
                "power_on": False
                "app_name": "appName"
                "user_arguments": ["--compress=9", " --schemaValidate", "--etc"]
            }
        :return str deploy results
        """
        # get command parameters from the environment
        data = jsonpickle.decode(deploy_data)
        data_holder = DeployDataHolder(data)

        # execute command
        result = self.command_wrapper.execute_command_with_connection(
            context,
            self.deploy_command.execute_deploy_from_image,
            data_holder,
            context.resource)

        return set_command_result(result=result, unpicklable=False)
コード例 #2
0
    def deploy_from_device_farm(self, context, device_model, inbound_ports, instance_type, outbound_ports, app_name):
        # # api = CloudShellAPISession(context.connectivity.server_address, domain="Global", token_id=context.connectivity.admin_auth_token, port=context.connectivity.cloudshell_api_port)

        df_session = self._connect_amazon(context)

        device_arn = ''
        for d in df_session.list_devices()['devices']:
            s = d['name'] + ' - ' + d['platform'] + ' ' + d['os']
            s = s.replace('&', '&')
            s = s.replace('"', '"')
            device_model = device_model.replace('&', '&')
            device_model = device_model.replace('"', '"')
            s = s.replace('&', '')
            s = s.replace('"', '')
            device_model = device_model.replace('&', '')
            device_model = device_model.replace('"', '')
            if s == device_model:
                device_arn = d['arn']
                break

        if not device_arn:
            raise Exception('Device not found matching model selection <' + device_model + '>')

        self._project_arn = df_session.list_projects()['projects'][0]['arn']

        o = df_session.create_remote_access_session(
            deviceArn=device_arn,
            projectArn=self._project_arn,
            configuration={
                'billingMethod': 'METERED'
            },
            name=app_name.replace(' ', '_')
        )

        self._session_arn = o['remoteAccessSession']['arn']

        status = ''
        for _ in range(0, 30):
            o = df_session.get_remote_access_session(arn=self._session_arn)
            status = o['remoteAccessSession']['status']
            if status == 'RUNNING':
                self._endpoint = o['remoteAccessSession']['endpoint']
                break
            sleep(10)

        if status != 'RUNNING':
            raise Exception('Remote device session did not start within 5 minutes')

        # self._endpoint = 'fake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpoint'
        # self._app_arn = 'fake_app_arn'
        # self._session_arn = 'fake_session_arn'

        result = DeployResult(app_name, self._session_arn, context.resource.fullname, "", 60, True, True, True, True, False)
        rv = set_command_result(result, False)
        # # with open(r'c:\temp\a.txt', 'a') as f:
        # #     f.write(rv + '\n\n')
        #
        # # if apk_filename:
        # #     self.upload_app(context, None, apk_filename)
        return rv
コード例 #3
0
    def deploy_from_linked_clone(self, context, deploy_data):
        """
        Deploy Cloned VM From VM Command, will deploy vm from template

        :param models.QualiDriverModels.ResourceCommandContext context: the context of the command
        :param str deploy_data: represent a json of the parameters, example: {"template_resource_model": {"vm_location": "", "vcenter_name": "VMware vCenter", "refresh_ip_timeout": "600", "auto_delete": "True", "vm_storage": "", "auto_power_on": "True", "autoload": "True", "ip_regex": "", "auto_power_off": "True", "vcenter_template": "Alex\\test", "vm_cluster": "", "vm_resource_pool": "", "wait_for_ip": "True"}, "app_name": "Temp"}
        :return str deploy results
        """

        # get command parameters from the environment
        data = jsonpickle.decode(deploy_data)
        data_holder = DeployDataHolder(data)

        if not data_holder.template_resource_model.vcenter_vm:
            raise ValueError('Please insert vm to deploy from')

        data_holder.template_resource_model.vcenter_vm = \
            back_slash_to_front_converter(data_holder.template_resource_model.vcenter_vm)

        if not data_holder.template_resource_model.vcenter_vm_snapshot:
            raise ValueError('Please insert snapshot to deploy from')

        data_holder.template_resource_model.vcenter_vm_snapshot = \
            back_slash_to_front_converter(data_holder.template_resource_model.vcenter_vm_snapshot)

        # execute command
        result = self.command_wrapper.execute_command_with_connection(
            context, self.deploy_command.execute_deploy_from_linked_clone,
            data_holder)

        return set_command_result(result=result, unpicklable=False)
コード例 #4
0
    def deploy_from_image(self, context, deploy_data):
        """
        Deploy From Image Command, will deploy vm from ovf image

        :param models.QualiDriverModels.ResourceCommandContext context: the context of the command
        :param str deploy_data: represent a json of the parameters, example: {
                "image_url": "c:\image.ovf" or
                             "\\nas\shared\image.ovf" or
                             "http://192.168.65.88/ovf/Debian%2064%20-%20Yoav.ovf",
                "cluster_name": "QualiSB Cluster",
                "resource_pool": "LiverPool",
                "datastore_name": "eric ds cluster",
                "datacenter_name": "QualiSB"
                "power_on": False
                "app_name": "appName"
                "user_arguments": ["--compress=9", " --schemaValidate", "--etc"]
            }
        :return str deploy results
        """
        # get command parameters from the environment
        data = jsonpickle.decode(deploy_data)
        data_holder = DeployDataHolder(data)

        # execute command
        result = self.command_wrapper.execute_command_with_connection(
            context, self.deploy_command.execute_deploy_from_image,
            data_holder, context.resource)

        return set_command_result(result=result, unpicklable=False)
コード例 #5
0
    def orchestration_save(self, context, mode="shallow", custom_params=None):
        """
        Creates a snapshot with a unique name and returns SavedResults as JSON
        :param context: resource context of the vCenterShell
        :param mode: Snapshot save mode, default shallow. Currently not it use
        :param custom_params: Set of custom parameter to be supported in the future
        :return: SavedResults serialized as JSON
        :rtype: SavedResults
        """
        resource_details = self._parse_remote_model(context)
        created_date = date.today()
        snapshot_name = created_date.strftime('%y_%m_%d %H_%M_%S_%f')
        created_snapshot_path = self.save_snapshot(context=context,
                                                   snapshot_name=snapshot_name)

        created_snapshot_path = self._strip_double_quotes(
            created_snapshot_path)

        orchestration_saved_artifact = OrchestrationSavedArtifact()
        orchestration_saved_artifact.artifact_type = 'vcenter_snapshot'
        orchestration_saved_artifact.identifier = created_snapshot_path

        saved_artifacts_info = OrchestrationSavedArtifactsInfo(
            resource_name=resource_details.cloud_provider,
            created_date=created_date,
            restore_rules={'requires_same_resource': True},
            saved_artifact=orchestration_saved_artifact)

        orchestration_save_result = OrchestrationSaveResult(
            saved_artifacts_info)

        return set_command_result(result=orchestration_save_result,
                                  unpicklable=False)
コード例 #6
0
 def power_on_not_roemote(self, context, vm_uuid, resource_fullname):
     # get connection details
     res = self.command_wrapper.execute_command_with_connection(context,
                                                                self.vm_power_management_command.power_on,
                                                                vm_uuid,
                                                                resource_fullname)
     return set_command_result(result=res, unpicklable=False)
コード例 #7
0
    def _power_command(self, context, ports, command):
        resource_details = self._parse_remote_model(context)

        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context, command, resource_details.vm_uuid,
            resource_details.fullname)
        return set_command_result(result=res, unpicklable=False)
コード例 #8
0
    def _power_command(self, context, ports, command):
        resource_details = self._parse_remote_model(context)

        # execute command
        res = self.command_wrapper.execute_command_with_connection(context,
                                                                   command,
                                                                   resource_details.vm_uuid,
                                                                   resource_details.fullname)
        return set_command_result(result=res, unpicklable=False)
コード例 #9
0
    def connect_bulk(self, context, request):
        results = self.command_wrapper.execute_command_with_connection(
            context, self.connection_orchestrator.connect_bulk, request)

        driver_response = DriverResponse()
        driver_response.actionResults = results
        driver_response_root = DriverResponseRoot()
        driver_response_root.driverResponse = driver_response
        return set_command_result(result=driver_response_root,
                                  unpicklable=False)
コード例 #10
0
    def connect_bulk(self, context, request):
        results = self.command_wrapper.execute_command_with_connection(
            context,
            self.connection_orchestrator.connect_bulk,
            request)

        driver_response = DriverResponse()
        driver_response.actionResults = results
        driver_response_root = DriverResponseRoot()
        driver_response_root.driverResponse = driver_response
        return set_command_result(result=driver_response_root, unpicklable=False)
コード例 #11
0
    def test_get_result_from_command_output_with_result_unpickable_false(self):
        connection_result = ConnectionResult(mac_address='AA', vm_uuid='BB', network_name='CC', network_key='DD',
                                             requested_vnic='EE', vnic_name='FF')
        output_result = set_command_result(result=[connection_result], unpicklable=False)
        results = get_result_from_command_output(output_result)

        self.assertEqual(results[0]['mac_address'], 'AA')
        self.assertEqual(results[0]['vm_uuid'], 'BB')
        self.assertEqual(results[0]['network_name'], 'CC')
        self.assertEqual(results[0]['network_key'], 'DD')
        self.assertEqual(results[0]['requested_vnic'], 'EE')
        self.assertEqual(results[0]['vnic_name'], 'FF')
コード例 #12
0
 def get_snapshots(self, context):
     """
     Returns list of snapshots
     :param context: resource context of the vCenterShell
     :type context: models.QualiDriverModels.ResourceCommandContext
     :return:
     """
     resource_details = self._parse_remote_model(context)
     res = self.command_wrapper.execute_command_with_connection(
         context, self.snapshots_retriever.get_snapshots,
         resource_details.vm_uuid)
     return set_command_result(result=res, unpicklable=False)
コード例 #13
0
    def test_get_result_from_command_output_with_result_unpickable_true(self):
        connection_result = ConnectionResult(mac_address='AA', vm_uuid='BB', network_name='CC', network_key='DD',
                                             requested_vnic='EE', vnic_name='FF')
        output_result = set_command_result(result=connection_result, unpicklable=True)
        result = get_result_from_command_output(output_result)

        self.assertEqual(result.mac_address, 'AA')
        self.assertEqual(result.vm_uuid, 'BB')
        self.assertEqual(result.network_name, 'CC')
        self.assertEqual(result.network_key, 'DD')
        self.assertEqual(result.requested_vnic, 'EE')
        self.assertEqual(result.vnic_name, 'FF')
コード例 #14
0
    def destroy_vm_only(self, context, ports):
        """
        Destroy Vm Command, will only destroy the vm and will not remove the resource

        :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!!!
        """
        resource_details = self._parse_remote_model(context)
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context, self.destroy_virtual_machine_command.destroy_vm_only,
            resource_details.vm_uuid, resource_details.fullname)
        return set_command_result(result=res, unpicklable=False)
コード例 #15
0
 def refresh_ip(self, context, cancellation_context, ports):
     """
     Refresh IP Command, will refresh the ip of the vm and will update it on the resource
     :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
     :param cancellation_context:
     :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
     """
     resource_details = self._parse_remote_model(context)
     # execute command
     res = self.command_wrapper.execute_command_with_connection(
         context, self.refresh_ip_command.refresh_ip,
         resource_details.vm_uuid, resource_details.fullname,
         cancellation_context)
     return set_command_result(result=res, unpicklable=False)
コード例 #16
0
    def disconnect_all(self, context, ports):
        """
        Disconnect All Command, will the assign all the vnics on the vm to the default network,
        which is sign to be disconnected

        :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!!!
        """
        resource_details = self._parse_remote_model(context)
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context, self.virtual_switch_disconnect_command.disconnect_all,
            resource_details.vm_uuid)
        return set_command_result(result=res, unpicklable=False)
コード例 #17
0
 def save_snapshot(self, context, snapshot_name):
     """
     Saves virtual machine to a snapshot
     :param context: resource context of the vCenterShell
     :type context: models.QualiDriverModels.ResourceCommandContext
     :param snapshot_name: snapshot name to save to
     :type snapshot_name: str
     :return:
     """
     resource_details = self._parse_remote_model(context)
     created_snapshot_path = self.command_wrapper.execute_command_with_connection(
         context, self.snapshot_saver.save_snapshot,
         resource_details.vm_uuid, snapshot_name)
     return set_command_result(created_snapshot_path)
コード例 #18
0
    def disconnect(self, context, ports, network_name):
        """
        Disconnect Command, will disconnect the a specific network that is assign to the vm,
        the command will assign the default network for all the vnics that is assigned to the given network

        :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
        :param str network_name: the name of the network to disconnect from
        :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
        """
        resource_details = self._parse_remote_model(context)
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context, self.virtual_switch_disconnect_command.disconnect,
            resource_details.vm_uuid, network_name)
        return set_command_result(result=res, unpicklable=False)
コード例 #19
0
    def disconnect_all(self, context, ports):
        """
        Disconnect All Command, will the assign all the vnics on the vm to the default network,
        which is sign to be disconnected

        :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!!!
        """
        resource_details = self._parse_remote_model(context)
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context,
            self.virtual_switch_disconnect_command.disconnect_all,
            resource_details.vm_uuid)
        return set_command_result(result=res, unpicklable=False)
コード例 #20
0
 def refresh_ip(self, context, cancellation_context, ports):
     """
     Refresh IP Command, will refresh the ip of the vm and will update it on the resource
     :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
     :param cancellation_context:
     :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
     """
     resource_details = self._parse_remote_model(context)
     # execute command
     res = self.command_wrapper.execute_command_with_connection(context,
                                                                self.refresh_ip_command.refresh_ip,
                                                                resource_details.vm_uuid,
                                                                resource_details.fullname,
                                                                cancellation_context)
     return set_command_result(result=res, unpicklable=False)
    def test_get_result_from_command_output_with_result_unpickable_false(self):
        connection_result = ConnectionResult(mac_address='AA',
                                             vm_uuid='BB',
                                             network_name='CC',
                                             network_key='DD',
                                             requested_vnic='EE',
                                             vnic_name='FF')
        output_result = set_command_result(result=[connection_result],
                                           unpicklable=False)
        results = get_result_from_command_output(output_result)

        self.assertEqual(results[0]['mac_address'], 'AA')
        self.assertEqual(results[0]['vm_uuid'], 'BB')
        self.assertEqual(results[0]['network_name'], 'CC')
        self.assertEqual(results[0]['network_key'], 'DD')
        self.assertEqual(results[0]['requested_vnic'], 'EE')
        self.assertEqual(results[0]['vnic_name'], 'FF')
コード例 #22
0
    def destroy_vm_only(self, context, ports):
        """
        Destroy Vm Command, will only destroy the vm and will not remove the resource

        :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!!!
        """
        resource_details = self._parse_remote_model(context)
        reservation_id = context.remote_reservation.reservation_id
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context,
            self.destroy_virtual_machine_command.destroy_vm_only,
            resource_details.vm_uuid,
            resource_details.fullname,
            reservation_id)
        return set_command_result(result=res, unpicklable=False)
コード例 #23
0
    def disconnect(self, context, ports, network_name):
        """
        Disconnect Command, will disconnect the a specific network that is assign to the vm,
        the command will assign the default network for all the vnics that is assigned to the given network

        :param models.QualiDriverModels.ResourceRemoteCommandContext context: the context the command runs on
        :param str network_name: the name of the network to disconnect from
        :param list[string] ports: the ports of the connection between the remote resource and the local resource, NOT IN USE!!!
        """
        resource_details = self._parse_remote_model(context)
        # execute command
        res = self.command_wrapper.execute_command_with_connection(
            context,
            self.virtual_switch_disconnect_command.disconnect,
            resource_details.vm_uuid,
            network_name)
        return set_command_result(result=res, unpicklable=False)
    def test_get_result_from_command_output_with_result_unpickable_true(self):
        connection_result = ConnectionResult(mac_address='AA',
                                             vm_uuid='BB',
                                             network_name='CC',
                                             network_key='DD',
                                             requested_vnic='EE',
                                             vnic_name='FF')
        output_result = set_command_result(result=connection_result,
                                           unpicklable=True)
        result = get_result_from_command_output(output_result)

        self.assertEqual(result.mac_address, 'AA')
        self.assertEqual(result.vm_uuid, 'BB')
        self.assertEqual(result.network_name, 'CC')
        self.assertEqual(result.network_key, 'DD')
        self.assertEqual(result.requested_vnic, 'EE')
        self.assertEqual(result.vnic_name, 'FF')
コード例 #25
0
    def test_set_command_result(self):
        action_result = ActionResult()
        action_result.actionId = 'A'
        action_result.errorMessage = ''
        action_result.infoMessage = ''
        action_result.success = True
        action_result.type = 'setVlan'
        action_result.updatedInterface = 'AA-BB'

        driver_response = DriverResponse()
        driver_response.actionResults = [action_result]

        driver_response_root = DriverResponseRoot()
        driver_response_root.driverResponse = driver_response

        result = set_command_result(driver_response_root)

        self.assertEqual(result, '{"driverResponse": {"actionResults": [{"success": true, "updatedInterface": "AA-BB", "errorMessage": "", "infoMessage": "", "actionId": "A", "type": "setVlan"}]}}')
    def test_set_command_result(self):
        action_result = ActionResult()
        action_result.actionId = 'A'
        action_result.errorMessage = ''
        action_result.infoMessage = ''
        action_result.success = True
        action_result.type = 'setVlan'
        action_result.updatedInterface = 'AA-BB'

        driver_response = DriverResponse()
        driver_response.actionResults = [action_result]

        driver_response_root = DriverResponseRoot()
        driver_response_root.driverResponse = driver_response

        result = set_command_result(driver_response_root)

        self.assertEqual(
            result,
            '{"driverResponse": {"actionResults": [{"success": true, "updatedInterface": "AA-BB", "errorMessage": "", "infoMessage": "", "actionId": "A", "type": "setVlan"}]}}'
        )
コード例 #27
0
    def deploy_from_template(self, context, deploy_data):
        """
        Deploy From Template Command, will deploy vm from template

        :param models.QualiDriverModels.ResourceCommandContext context: the context of the command
        :param str deploy_data: represent a json of the parameters, example: {"template_resource_model": {"vm_location": "", "vcenter_name": "VMware vCenter", "refresh_ip_timeout": "600", "auto_delete": "True", "vm_storage": "", "auto_power_on": "True", "autoload": "True", "ip_regex": "", "auto_power_off": "True", "vcenter_template": "Alex\\test", "vm_cluster": "", "vm_resource_pool": "", "wait_for_ip": "True"}, "app_name": "Temp"}
        :return str deploy results
        """

        # get command parameters from the environment
        data = jsonpickle.decode(deploy_data)
        data_holder = DeployDataHolder(data)
        data_holder.template_resource_model.vcenter_template = \
            data_holder.template_resource_model.vcenter_template.replace('\\', '/')

        # execute command
        result = self.command_wrapper.execute_command_with_connection(
            context,
            self.deploy_command.execute_deploy_from_template,
            data_holder,
            context.resource)

        return set_command_result(result=result, unpicklable=False)
コード例 #28
0
    def deploy_from_device_farm(self, context, device_model, inbound_ports, instance_type, outbound_ports, app_name):
        api = CloudShellAPISession(context.connectivity.server_address, domain="Global", token_id=context.connectivity.admin_auth_token, port=context.connectivity.cloudshell_api_port)

        api.WriteMessageToReservationOutput(context.reservation.reservation_id, 'Deploying %s...' % device_model)
        df_session = self._connect_amazon(context)

        device_arn = ''
        for d in df_session.list_devices()['devices']:
            s = d['name'] + ' - ' + d['platform'] + ' ' + d['os']
            s = s.replace('&amp;', '&')
            s = s.replace('&quot;', '"')
            device_model = device_model.replace('&amp;', '&')
            device_model = device_model.replace('&quot;', '"')
            s = s.replace('&', '')
            s = s.replace('"', '')
            device_model = device_model.replace('&', '')
            device_model = device_model.replace('"', '')
            if s == device_model:
                device_arn = d['arn']
                break

        if not device_arn:
            raise Exception('Device not found matching model selection <' + device_model + '>')

        project_arn = df_session.list_projects()['projects'][0]['arn']

        running = False
        retries = 0
        while not running:
            try:
                api.WriteMessageToReservationOutput(context.reservation.reservation_id, 'Creating remote access session...')

                o = df_session.create_remote_access_session(
                    deviceArn=device_arn,
                    projectArn=project_arn,
                    configuration={
                        'billingMethod': 'METERED'
                    },
                    name=app_name.replace(' ', '_')
                )

                session_arn = o['remoteAccessSession']['arn']

                status = ''
                for _ in range(0, 30):
                    o = df_session.get_remote_access_session(arn=session_arn)
                    status = o['remoteAccessSession']['status']
                    api.WriteMessageToReservationOutput(context.reservation.reservation_id, 'Status: %s' % status)
                    if status == 'RUNNING':
                        # endpoint = o['remoteAccessSession']['endpoint']
                        running = True
                        break
                    if 'ERROR' in status or 'FAIL' in status or 'COMPLETED' in status:
                        api.WriteMessageToReservationOutput(context.reservation.reservation_id, 'Remote device session ended with an error: %s' % str(o))
                        raise Exception('Remote device session ended with an error: ' + str(o))
                    sleep(10)

                if status != 'RUNNING':
                    raise Exception('Remote device session did not start within 5 minutes: ' + str(o))
                break
            except Exception as e:
                retries += 1
                if retries < 5:
                    api.WriteMessageToReservationOutput(context.reservation.reservation_id, 'Remote device failed, RETRYING...')
                else:
                    raise Exception('Could not start a remote session in 5 tries. Check the AWS Device Farm console or try another hardware selection')

        # self._endpoint = 'fake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpointfake_endpoint'
        # self._app_arn = 'fake_app_arn'
        # self._session_arn = 'fake_session_arn'

        result = DeployResult(app_name, session_arn, context.resource.fullname, "", 60, True, True, True, True, False)
        rv = set_command_result(result, False)
        # # with open(r'c:\temp\a.txt', 'a') as f:
        # #     f.write(rv + '\n\n')
        #
        # # if apk_filename:
        # #     self.upload_app(context, None, apk_filename)
        return rv
コード例 #29
0
 def get_vm_details(self, context, cancellation_context, requests_json):
     requests = DeployDataHolder(jsonpickle.decode(requests_json)).items
     res = self.command_wrapper.execute_command_with_connection(
         context, self.vm_details.get_vm_details, context.resource,
         requests, cancellation_context)
     return set_command_result(result=res, unpicklable=False)
コード例 #30
0
 def power_on_not_roemote(self, context, vm_uuid, resource_fullname):
     # get connection details
     res = self.command_wrapper.execute_command_with_connection(
         context, self.vm_power_management_command.power_on, vm_uuid,
         resource_fullname)
     return set_command_result(result=res, unpicklable=False)
コード例 #31
0
 def get_vm_uuid_by_name(self, context, vm_name):
     res = self.command_wrapper.execute_command_with_connection(
         context, self.vm_loader.load_vm_uuid_by_name, vm_name)
     return set_command_result(result=res, unpicklable=False)