def test_system_fip(): lab = InstallVars.get_install_var("LAB") res_dict = setups.collect_sys_net_info(lab) retry = False for res in res_dict.values(): if not res: retry = True break if retry: res_dict = setups.collect_sys_net_info(lab) for key, value in res_dict.items(): assert value, "could not {}".format(key)
def test_duplex_plus_install(install_setup): """ Complete fresh_install steps for a duplex plus (AIO+) lab Test Setups: - Retrieve dictionary containing lab information - Retrieve required paths to directories, images, and licenses - Determine active controller - Initialize build server and boot server objects - Retrieve what steps to be skipped Test Steps: - Install controller-0 - Download configuration files, heat templates, images, and licenses - Configure controller-0, run lab_setup, and unlock controller-0 - Add the standby controller - Run the lab_setup.sh script - Re-add the standby controller - Run the lab_setup.sh script - Install the Standby Controller - Run the lab_setup.sh script twice - Unlock the standby controller - Run the lab_setup.sh script """ lab = install_setup["lab"] hosts = lab["hosts"] boot_device = lab["boot_device_dict"] controller0_node = lab["controller-0"] final_step = install_setup["control"]["stop"] patch_dir = install_setup["directories"]["patches"] patch_server = install_setup["servers"]["patches"] guest_server = install_setup["servers"]["guest"] install_subcloud = install_setup.get("install_subcloud") lab_files_server = install_setup["servers"]["lab_files"] helm_chart_server = install_setup["servers"]["helm_charts"] if final_step == '0' or final_step == "setup": skip("stopping at install step: {}".format(LOG.test_step)) fresh_install_helper.install_controller( sys_type=SysType.AIO_DX, patch_dir=patch_dir, patch_server_conn=patch_server.ssh_conn, init_global_vars=True) # controller0_node.telnet_conn.login() # controller0_node.telnet_conn.flush() # fresh_install_helper.set_software_version_var(use_telnet=True, con_telnet=controller0_node.telnet_conn) build_server = install_setup["servers"]["build"] fresh_install_helper.download_lab_files( lab_files_server=lab_files_server, build_server=build_server, guest_server=guest_server, load_path=InstallVars.get_install_var("TIS_BUILD_DIR"), license_path=InstallVars.get_install_var("LICENSE"), guest_path=InstallVars.get_install_var('GUEST_IMAGE'), helm_chart_server=helm_chart_server) if install_subcloud: fresh_install_helper.configure_subcloud(controller0_node, lab_files_server, subcloud=install_subcloud, final_step=final_step) else: fresh_install_helper.configure_controller_(controller0_node) deploy_mgr = fresh_install_helper.use_deploy_manager(controller0_node, lab) if not deploy_mgr: fresh_install_helper.check_ansible_configured_mgmt_interface( controller0_node, lab) #fresh_install_helper.collect_lab_config_yaml(lab, build_server, stage=fresh_install_helper.DEPLOY_INTITIAL) fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) fresh_install_helper.unlock_active_controller(controller0_node) else: fresh_install_helper.wait_for_deploy_mgr_controller_config( controller0_node, lab=lab) controller0_node.telnet_conn.hostname = r"controller\-[01]" controller0_node.telnet_conn.set_prompt(Prompt.CONTROLLER_PROMPT) if controller0_node.ssh_conn is None: controller0_node.ssh_conn = install_helper.establish_ssh_connection( controller0_node.host_ip) install_helper.update_auth_url(ssh_con=controller0_node.ssh_conn) if not deploy_mgr: fresh_install_helper.bulk_add_hosts(lab=lab, con_ssh=controller0_node.ssh_conn) else: fresh_install_helper.wait_for_deployment_mgr_to_bulk_add_hosts( controller0_node, lab=lab) fresh_install_helper.boot_hosts(boot_device) #fresh_install_helper.collect_lab_config_yaml(lab, build_server, stage=fresh_install_helper.DEPLOY_INTERIM) if not deploy_mgr: fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) fresh_install_helper.unlock_hosts(["controller-1"], con_ssh=controller0_node.ssh_conn) else: fresh_install_helper.wait_for_deploy_mgr_lab_config(controller0_node, lab=lab) fresh_install_helper.wait_for_hosts_ready(hosts, lab=lab) container_helper.wait_for_apps_status(apps='platform-integ-apps', timeout=1800, con_ssh=controller0_node.ssh_conn, status='applied') fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) if lab.get("floating ip"): collect_sys_net_info(lab) setup_tis_ssh(lab) #fresh_install_helper.check_heat_resources(con_ssh=controller0_node.ssh_conn) if not deploy_mgr: fresh_install_helper.collect_lab_config_yaml( lab, build_server, stage=fresh_install_helper.DEPLOY_LAST) fresh_install_helper.attempt_to_run_post_install_scripts() fresh_install_helper.reset_global_vars() fresh_install_helper.verify_install_uuid(lab) if deploy_mgr: fresh_install_helper.validate_deployment_mgr_install( controller0_node, lab)
def test_standard_restore_install(install_setup): """ Configure the active controller Prerequisites: - pxeboot has been setup. Test Setups: - Retrieve dictionary containing lab information - Retrieve required paths to directories, images, and licenses - Determine active controller - Initialize build server and boot server objects - Retrieve what steps to be skipped Test Steps: - Install controller-0 - Unlock controller-0 - Boot the other hosts - Unlock the other hosts """ lab = install_setup["lab"] hosts = lab["hosts"] boot_device = lab['boot_device_dict'] controller0_node = lab["controller-0"] patch_dir = install_setup["directories"]["patches"] patch_server = install_setup["servers"]["patches"] # Power off that which is NOT Controller-0 hostnames = [ hostname for hostname in lab['hosts'] if 'controller-0' not in hostname ] vlm_helper.power_off_hosts(hostnames, lab=lab, count=2) do_boot_c0 = RestoreVars.get_restore_var('RESTORE_PRE_BOOT_CONTROLLER0') stop_before_ansible_restore = \ RestoreVars.get_restore_var('STOP_BEFORE_ANSIBLE_RESTORE') if do_boot_c0: fresh_install_helper.install_controller( sys_type=SysType.REGULAR, patch_dir=patch_dir, patch_server_conn=patch_server.ssh_conn, init_global_vars=True) else: LOG.tc_step("Skipping controller-0 install") if stop_before_ansible_restore: skip("Stopping test before restoring") if InstallVars.get_install_var('IPV6_OAM'): restore_helper.setup_ipv6_oam(controller0_node) restore_helper.restore_platform() fresh_install_helper.unlock_active_controller(controller0_node) controller0_node.telnet_conn.hostname = r"controller\-[01]" controller0_node.telnet_conn.set_prompt(Prompt.CONTROLLER_PROMPT) if controller0_node.ssh_conn is None: controller0_node.ssh_conn = install_helper.ssh_to_controller( controller0_node.host_ip) install_helper.update_auth_url(ssh_con=controller0_node.ssh_conn) # Boot that which is Not Controller-0 fresh_install_helper.restore_boot_hosts(boot_device) # Unlock controller-1 fresh_install_helper.unlock_hosts(['controller-1'], con_ssh=controller0_node.ssh_conn) # Unlock computes fresh_install_helper.unlock_hosts( [host_ for host_ in hosts if 'compute' in host_], con_ssh=controller0_node.ssh_conn) fresh_install_helper.send_arp_cmd() if lab.get("floating ip"): collect_sys_net_info(lab) setup_tis_ssh(lab) fresh_install_helper.reset_global_vars() fresh_install_helper.verify_install_uuid(lab)
def test_distributed_cloud_install(install_setup): """ Configure the active controller Prerequisites: - pxeboot has been setup. Test Setups: - Retrieve dictionary containing lab information - Retrieve required paths to directories, images, and licenses - Determine active controller - Initialize build server and boot server objects - Retrieve what steps to be skipped Test Steps: - Install controller-0 - Download configuration files, heat templates, images, and licenses - Configure controller-0, run lab_setup, and unlock controller-0 - Add the other hosts - Boot the other hosts - Run lab setup - Unlock the other hosts - Run lab setup - Setup heat resources and clear any install related alarms """ dc_lab = install_setup["lab"] central_region_lab = dc_lab['central_region'] hosts = dc_lab['central_region']["hosts"] boot_device = central_region_lab['boot_device_dict'] controller0_node = central_region_lab["controller-0"] final_step = install_setup["control"]["stop"] patch_dir = install_setup["directories"]["patches"] patch_server = install_setup["servers"]["patches"] guest_server = install_setup["servers"]["guest"] if final_step == '0' or final_step == "setup": pytest.skip("stopping at install step: {}".format(LOG.test_step)) fresh_install_helper.install_controller( lab=central_region_lab, sys_type=SysType.DISTRIBUTED_CLOUD, patch_dir=patch_dir, patch_server_conn=patch_server.ssh_conn, init_global_vars=True) # controller0_node.telnet_conn.login() # controller0_node.telnet_conn.flush() # fresh_install_helper.set_software_version_var(use_telnet=True, con_telnet=controller0_node.telnet_conn) lab_files_server = install_setup["servers"]["lab_files"] build_server = install_setup["servers"]["build"] load_path = InstallVars.get_install_var("TIS_BUILD_DIR") ipv6_install = InstallVars.get_install_var("DC_IPV6") fresh_install_helper.download_lab_files( lab=central_region_lab, lab_files_server=lab_files_server, build_server=build_server, guest_server=guest_server, load_path=load_path, license_path=InstallVars.get_install_var("LICENSE"), guest_path=InstallVars.get_install_var('GUEST_IMAGE')) # TODO Change config and lab setup files to common name fresh_install_helper.configure_controller_(controller0_node, lab=central_region_lab, banner=False, branding=False) fresh_install_helper.wait_for_deploy_mgr_controller_config( controller0_node, lab=central_region_lab) controller0_node.telnet_conn.hostname = "controller\-[01]" controller0_node.telnet_conn.set_prompt(Prompt.CONTROLLER_PROMPT) if controller0_node.ssh_conn is None: controller0_node.ssh_conn = install_helper.ssh_to_controller( controller0_node.host_ip) fresh_install_helper.wait_for_deployment_mgr_to_bulk_add_hosts( controller0_node, lab=central_region_lab) LOG.info("Booting standby controller host...") # TODO: get controller-1 hostname fresh_install_helper.boot_hosts(boot_device, hostnames=['controller-1'], lab=central_region_lab, wait_for_online=False) host_helper.wait_for_hosts_ready( [host for host in hosts if controller0_node.name not in host], con_ssh=controller0_node.ssh_conn) fresh_install_helper.wait_for_deploy_mgr_lab_config(controller0_node, lab=central_region_lab) fresh_install_helper.wait_for_hosts_ready(["controller-1"], lab=central_region_lab) container_helper.wait_for_apps_status(apps='platform-integ-apps', timeout=1800, con_ssh=controller0_node.ssh_conn, status='applied') LOG.info("Running lab setup script ...") fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) if dc_lab.get("floating ip"): collect_sys_net_info(dc_lab) setup_tis_ssh(dc_lab) fresh_install_helper.wait_for_hosts_ready(controller0_node.name, lab=central_region_lab) fresh_install_helper.attempt_to_run_post_install_scripts( controller0_node=controller0_node) fresh_install_helper.reset_global_vars() fresh_install_helper.verify_install_uuid(lab=central_region_lab) fresh_install_helper.validate_deployment_mgr_install( controller0_node, central_region_lab)
def setup_test_session(global_setup, request): """ Setup primary tenant and Nax Box ssh before the first test gets executed. TIS ssh was already set up at collecting phase. """ LOG.fixture_step("(session) Setting up test session...") setups.setup_primary_tenant(ProjVar.get_var('PRIMARY_TENANT')) global con_ssh if not con_ssh: con_ssh = ControllerClient.get_active_controller() # set build id to be used to upload/write test results setups.set_build_info(con_ssh) # Set global vars setups.set_session(con_ssh=con_ssh) # Ensure tis and natbox (if applicable) ssh are connected con_ssh.connect(retry=True, retry_interval=3, retry_timeout=300) # set up natbox connection and copy keyfile natbox_dict = ProjVar.get_var('NATBOX') global natbox_ssh try: natbox_ssh = setups.setup_natbox_ssh(natbox_dict, con_ssh=con_ssh) except: if ProjVar.get_var('COLLECT_SYS_NET_INFO'): setups.collect_sys_net_info(lab=ProjVar.get_var('LAB')) raise # Enable keystone debug if ProjVar.get_var('KEYSTONE_DEBUG'): setups.enable_disable_keystone_debug(enable=True, con_ssh=con_ssh) # collect telnet logs for all hosts if ProjVar.get_var('COLLECT_TELNET'): end_event = Event() threads = setups.collect_telnet_logs_for_nodes(end_event=end_event) ProjVar.set_var(TELNET_THREADS=(threads, end_event)) # set global var for sys_type setups.set_sys_type(con_ssh=con_ssh) # rsync files between controllers setups.copy_test_files() # set up remote cli clients client = con_ssh if ProjVar.get_var('REMOTE_CLI'): LOG.fixture_step("(session) Install remote cli clients in virtualenv") client = setups.setup_remote_cli_client() ProjVar.set_var(USER_FILE_DIR=ProjVar.get_var('TEMP_DIR')) def remove_remote_cli(): LOG.fixture_step("(session) Remove remote cli clients") client.exec_cmd('rm -rf {}/*'.format(ProjVar.get_var('TEMP_DIR'))) client.close() from utils.clients.local import RemoteCLIClient RemoteCLIClient.remove_remote_cli_clients() ProjVar.set_var(REMOTE_CLI=None) ProjVar.set_var(USER_FILE_DIR=HostLinuxUser.get_home()) request.addfinalizer(remove_remote_cli)
def test_standard_install(install_setup): """ Configure the active controller Prerequisites: - pxeboot has been setup. Test Setups: - Retrieve dictionary containing lab information - Retrieve required paths to directories, images, and licenses - Determine active controller - Initialize build server and boot server objects - Retrieve what steps to be skipped Test Steps: - Install controller-0 - Download configuration files, heat templates, images, and licenses - Configure controller-0, run lab_setup, and unlock controller-0 - Add the other hosts - Boot the other hosts - Run lab setup - Unlock the other hosts - Run lab setup - Setup heat resources and clear any install related alarms """ lab = install_setup["lab"] hosts = lab["hosts"] boot_device = lab['boot_device_dict'] controller0_node = lab["controller-0"] final_step = install_setup["control"]["stop"] patch_dir = install_setup["directories"]["patches"] patch_server = install_setup["servers"]["patches"] guest_server = install_setup["servers"]["guest"] install_subcloud = install_setup.get("install_subcloud") helm_chart_server = install_setup["servers"]["helm_charts"] if final_step == '0' or final_step == "setup": skip("stopping at install step: {}".format(LOG.test_step)) fresh_install_helper.install_controller(sys_type=SysType.REGULAR, patch_dir=patch_dir, patch_server_conn=patch_server.ssh_conn, init_global_vars=True) lab_files_server = install_setup["servers"]["lab_files"] lab_files_dir = install_setup["directories"]["lab_files"] build_server = install_setup["servers"]["build"] fresh_install_helper.download_lab_files(lab_files_server=lab_files_server, build_server=build_server, guest_server=guest_server, lab_files_dir=lab_files_dir, load_path=InstallVars.get_install_var("TIS_BUILD_DIR"), license_path=InstallVars.get_install_var("LICENSE"), guest_path=InstallVars.get_install_var('GUEST_IMAGE'), helm_chart_server=helm_chart_server) if install_subcloud: fresh_install_helper.configure_subcloud(controller0_node, install_setup["dc_system_controller"], subcloud=install_subcloud, final_step=final_step) deploy_mgr = True else: fresh_install_helper.configure_controller_(controller0_node) deploy_mgr = fresh_install_helper.use_deploy_manager(controller0_node, lab) if not deploy_mgr: fresh_install_helper.check_ansible_configured_mgmt_interface(controller0_node, lab) # fresh_install_helper.collect_lab_config_yaml(lab, build_server, # stage=fresh_install_helper.DEPLOY_INTITIAL) fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) fresh_install_helper.unlock_active_controller(controller0_node) controller0_node.telnet_conn.hostname = r"controller\-[01]" controller0_node.telnet_conn.set_prompt(Prompt.CONTROLLER_PROMPT) else: fresh_install_helper.wait_for_deploy_mgr_controller_config(controller0_node, lab=lab) if controller0_node.ssh_conn is None: controller0_node.ssh_conn = install_helper.ssh_to_controller(controller0_node.host_ip) install_helper.update_auth_url(ssh_con=controller0_node.ssh_conn) if not deploy_mgr: fresh_install_helper.bulk_add_hosts(lab=lab, con_ssh=controller0_node.ssh_conn) else: fresh_install_helper.wait_for_deployment_mgr_to_bulk_add_hosts(controller0_node, lab=lab) fresh_install_helper.boot_hosts(boot_device) # fresh_install_helper.collect_lab_config_yaml(lab, build_server, # stage=fresh_install_helper.DEPLOY_INTERIM) if not deploy_mgr: fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) # Unlock controller-1 fresh_install_helper.unlock_hosts(['controller-1'], con_ssh=controller0_node.ssh_conn) fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) # Unlock computes fresh_install_helper.unlock_hosts([host_ for host_ in hosts if 'compute' in host_], con_ssh=controller0_node.ssh_conn) fresh_install_helper.send_arp_cmd() fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) else: fresh_install_helper.wait_for_deploy_mgr_lab_config(controller0_node, lab=lab) fresh_install_helper.wait_for_hosts_ready(hosts, lab=lab) fresh_install_helper.run_lab_setup(con_ssh=controller0_node.ssh_conn) container_helper.wait_for_apps_status(apps='platform-integ-apps', timeout=1200, con_ssh=controller0_node.ssh_conn, status='applied') if lab.get("floating ip"): collect_sys_net_info(lab) setup_tis_ssh(lab) # fresh_install_helper.check_heat_resources(con_ssh=controller0_node.ssh_conn) if not deploy_mgr: fresh_install_helper.collect_lab_config_yaml(lab, build_server, stage=fresh_install_helper.DEPLOY_LAST) if install_subcloud: fresh_install_helper.wait_for_subcloud_to_be_managed(install_subcloud, install_setup["dc_system_controller"], lab=lab) fresh_install_helper.attempt_to_run_post_install_scripts() fresh_install_helper.reset_global_vars() fresh_install_helper.verify_install_uuid(lab) if deploy_mgr: fresh_install_helper.validate_deployment_mgr_install(controller0_node, lab)