def terminate_instance_from_detail_page(self, instance_id, timeout_in_seconds=480): """ Navigates to detail page, terminates instance. :param instance_id: """ BasePage(self).goto_instances_via_menu() instance_name=InstanceLanding(self).get_instance_name(instance_id) InstanceLanding(self).goto_instance_detail_page_via_actions(instance_id) InstanceDetailPage(self, instance_id, instance_name).click_terminate_instance_action_item_from_detail_page() TerminateInstanceModal(self).click_terminate_instance_submit_button(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_terminated(timeout_in_seconds=timeout_in_seconds)
def attach_volume_from_instance_detail_page(self, volume_id, instance_id, instance_name=None, device=None, timeout_in_seconds=240): """ Navigates to instance detail page and attaches volume. :param instance_id: :param volume_id: :param device: :param timeout_in_seconds: """ BasePage(self).goto_instances_via_menu() InstanceLanding(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).click_action_attach_volume() AttachVolumeModalSelectVolume(self).attach_volume(volume_id, device) InstanceDetailPage(self, instance_id).verify_volume_is_attached(volume_id, timeout_in_seconds)
def launch_instance_from_image_view_page(self, image_id_or_type, availability_zone = None, instance_type="t1.micro", number_of_of_instances = None, instance_name = None, key_name = "None (advanced option)", security_group = "default", user_data=None, monitoring=False, private_addressing=False, timeout_in_seconds=480): """ Navigates to image view page via menu. Launches instance from given image. :param image_id_or_type: :param availability_zone: :param instance_type: :param number_of_of_instances: :param instance_name: :param key_name: :param security_group: :param user_data: :param monitoring: :param private_addressing: """ BasePage(self).goto_images_view_via_menu() ImageLanding(self).click_action_launch_instance(image_id_or_type) LaunchInstanceWizard(self).launch_instance_step2(availability_zone, instance_type, number_of_of_instances, instance_name, key_name, security_group, user_data, monitoring, private_addressing) instance_id = InstanceLanding(self).get_id_of_newly_launched_instance() InstanceLanding(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_in_running_state(timeout_in_seconds=timeout_in_seconds) return {'instance_name': instance_name, 'instance_id':instance_id}
def launch_instance_from_instance_view_page(self, image = "centos",availability_zone = None, instance_type = "t1.micro: 1 CPUs, 256 memory (MB), 5 disk (GB,root device)", number_of_of_instances = None, instance_name = None, key_name = "None (advanced option)", security_group = "default", user_data=None, monitoring=False, private_addressing=False): """ Navigates to instance view page via menu. Launches instance. :param image: :param availability_zone: :param instance_type: :param number_of_of_instances: :param instance_name: :param key_name: :param security_group: :param user_data: :param monitoring: :param private_addressing: """ BasePage(self).goto_instances_via_menu() InstanceView(self).click_action_launch_instance_on_view_page() LaunchInstanceWizard(self).launch_instance(image, availability_zone, instance_type, number_of_of_instances, instance_name, key_name, security_group, user_data, monitoring, private_addressing) instance_id = InstanceView(self).get_id_of_newly_launched_instance() InstanceView(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_in_running_state() return {'instance_name': instance_name, 'instance_id':instance_id}
def attach_volume_from_instance_lp(self, volume_id, instance_id, instance_name=None, device=None, timeout_in_seconds=240): """ Navigates to instance landing page. Attaches volume. :param volume_id: :param instance_id: :param instance_name: :param device: :param timeout_in_seconds: """ print "" print "====== Running attach_volume_from_instance_lp ======" print "" BasePage(self).goto_instances_via_menu() InstanceLanding(self).click_action_manage_volumes_on_view_page(instance_id) InstanceDetailPage(self, instance_id, instance_name).click_action_attach_volume() AttachVolumeModalSelectVolume(self).attach_volume(volume_id, device) InstanceDetailPage(self, instance_id).verify_volume_is_attached(volume_id, timeout_in_seconds)
def launch_more_like_this_from_detail_page(self, base_instance_id, instance_name=None, user_data=None, monitoring=False, private_addressing=False, timeout_in_seconds=240): """ Navigates to instance detail page. Launches an instance like given instance. :param inatance_id: :param instance_name: :param user_data: :param monitoring: :param private_addressing: """ BasePage(self).goto_instances_via_menu() base_instance_name=InstanceLanding(self).get_instance_name(base_instance_id) InstanceLanding(self).goto_instance_detail_page_via_actions(base_instance_id) InstanceDetailPage(self, base_instance_id, base_instance_name).click_action_launch_more_like_this() LaunchMoreLikeThisDialog(self).launch_more_like_this(instance_name, user_data, monitoring, private_addressing) instance_id = InstanceLanding(self).get_id_of_newly_launched_instance() InstanceLanding(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_in_running_state(timeout_in_seconds=timeout_in_seconds) return {'instance_name': instance_name, 'instance_id':instance_id}
def terminate_instance_from_view_page(self, instance_id, instance_name=None,timeout_in_seconds=480): """ Navigates to view page, terminates instance. :param instance_name: :param instance_id: """ BasePage(self).goto_instances_via_menu() InstanceLanding(self).click_action_terminate_instance_on_view_page(instance_id) TerminateInstanceModal(self).click_terminate_instance_submit_button(instance_id) InstanceLanding(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_terminated(timeout_in_seconds=timeout_in_seconds)
def terminate_instance_from_view_page(self, instance_name, instance_id): """ Navigates to view page, terminates instance. :param instance_name: :param instance_id: """ BasePage(self).goto_instances_via_menu() InstanceView(self).click_action_terminate_instance_on_view_page(instance_id) TerminateInstanceModal(self).click_terminate_instance_submit_button(instance_id) InstanceView(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id, instance_name).verify_instance_is_terminated()
def disassociate_eip_from_instance_detail_page(self, elastic_ip, instance_id): BasePage(self).goto_instances_via_menu() InstanceLanding(self).goto_instance_detail_page_via_link(instance_id) InstanceDetailPage(self, instance_id).click_action_disassociate_ip_address() DisassociateEipDialog(self).disassociate_eip_from_instance() InstanceDetailPage(self, instance_id).verify_eip_address_disassociated_to_instance(elastic_ip)