def set_to_ready(): to_be_composed_out_of() LOGGER.info("AssignResources is invoked on Subarray") wait_before_test(timeout=10) configure_by_file() LOGGER.info("Configure is invoke on Subarray") wait_before_test(timeout=10)
def config(): def test_SUT(): configure_by_file() test_SUT() LOGGER.info("Configure command on Subarray 1 is successful") wait_before_test(timeout=10)
def set_to_running(): LOGGER.info( "Given A running telescope for executing observations on a subarray") assert (telescope_is_in_standby()) LOGGER.info("Starting up telescope") set_telescope_to_running() wait_before_test(timeout=10)
def start_up(): LOGGER.info( "Given A running telescope for executing observations on a subarray") LOGGER.info("Check whether telescope is in StandBy") assert (telescope_is_in_standby()) LOGGER.info("Starting up telescope") set_telescope_to_running() wait_before_test(timeout=10) LOGGER.info("Telescope is in ON State")
def start_up_telescope(result): if telescope_is_in_standby(): LOGGER.info("PROCESS: Starting up telescope") set_telescope_to_running() wait_before_test(timeout=10) subarray_state = resource(result[SUBARRAY_USED]).get('obsState') assert subarray_state == 'EMPTY', \ f"Expected sub-array to be in EMPTY but instead was in {subarray_state}" LOGGER.info("Sub-array is in ObsState EMPTY")
def set_telescope_in_on_state(result): """ Set telescope to ON state (startup) if it's not yet ON. """ LOGGER.info("Starting up telescope") if telescope_is_in_standby(): set_telescope_to_running() wait_before_test(timeout=10) telescope_state = resource(result[CENTRAL_NODE_USED]).get('State') assert telescope_state == 'ON', \ f"Expected telescope to be ON but instead was {telescope_state}" LOGGER.info("Telescope is in ON state")
def teardown_function(function): """ teardown any state that was previously setup with a setup_function call. """ if (resource('ska_low/tm_subarray_node/1').get('State') == "ON"): if (resource('ska_low/tm_subarray_node/1').get('obsState') == "IDLE"): LOGGER.info("tearing down composed subarray (IDLE)") # subarray.deallocate() #TODO: Once the OET latest charts are available this can be reverted tmc.release_resources() LOGGER.info('Invoked ReleaseResources on Subarray') wait_before_test(timeout=10) if (resource('ska_low/tm_subarray_node/1').get('obsState') == "READY"): LOGGER.info("tearing down configured subarray (READY)") # subarray.end() take_subarray(1).and_end_sb_when_ready() resource('ska_low/tm_subarray_node/1').assert_attribute('obsState').equals('IDLE') LOGGER.info('Invoked End on Subarray') wait_before_test(timeout=10) # subarray.deallocate() #TODO: Once the OET latest charts are available this can be reverted tmc.release_resources() LOGGER.info('Invoked ReleaseResources on Subarray') wait_before_test(timeout=10) if (resource('ska_low/tm_subarray_node/1').get('obsState') == "CONFIGURING"): LOGGER.warn("Subarray is still in CONFIFURING! Please restart MVP manualy to complete tear down") restart_subarray_low(1) #raise exception since we are unable to continue with tear down raise Exception("Unable to tear down test setup") if (resource('ska_low/tm_subarray_node/1').get('obsState') == "SCANNING"): LOGGER.warn("Subarray is still in SCANNING! Please restart MVP manualy to complete tear down") restart_subarray_low(1) #raise exception since we are unable to continue with tear down raise Exception("Unable to tear down test setup") if (resource('ska_low/tm_subarray_node/1').get('obsState') == "ABORTING"): LOGGER.warn("Subarray is still in ABORTING! Please restart MVP Low manualy to complete tear down") restart_subarray_low(1) #raise exception since we are unable to continue with tear down raise Exception("Unable to tear down test setup") if(resource('ska_low/tm_subarray_node/1').get('obsState') == "ABORTED"): LOGGER.info("tearing down configured subarray (ABORTED)") take_subarray(1).reset_when_aborted() LOGGER.info('Invoked ObsReset on Subarray') wait_before_test(timeout=10) # subarray.deallocate() #TODO: Once the OET latest charts are available this can be reverted tmc.release_resources() LOGGER.info('Invoked ReleaseResources on Subarray') wait_before_test(timeout=10) if (resource('ska_low/tm_subarray_node/1').get('obsState') == "RESETTING"): LOGGER.warn("Subarray is still in RESTARTING! Please restart MVP manualy to complete tear down") restart_subarray_low(1) #raise exception since we are unable to continue with tear down raise Exception("Unable to tear down test setup") set_telescope_to_standby() LOGGER.info("Telescope is in standBy")
def check_ready_state(fixture): fixture['future'].result(timeout=10) wait_before_test(timeout=10) # check that the TMC report subarray as being in the obsState = READY logging.info("TMC subarray low obsState: " + resource('ska_low/tm_subarray_node/1').get("obsState")) assert_that(resource('ska_low/tm_subarray_node/1').get( 'obsState')).is_equal_to('READY') # check that the MCCS report subarray as being in the obsState = READY logging.info("MCCS subarray low obsState: " + resource('low-mccs/subarray/01').get("obsState")) assert_that( resource('low-mccs/subarray/01').get('obsState')).is_equal_to('READY')
def assign(): LOGGER.info( "Before starting the telescope checking if the telescope is in StandBy." ) assert telescope_is_in_standby() LOGGER.info("Telescope is in StandBy.") LOGGER.info("Invoking Startup Telescope command on the telescope.") set_telescope_to_running() wait_before_test(timeout=10) LOGGER.info("Telescope is started successfully.") LOGGER.info("Allocating resources to Low Subarray 1") to_be_composed_out_of() wait_before_test(timeout=10) LOGGER.info("Subarray 1 is ready")
def allocate_resources_from_sbi(script, sb_json): """ Use the OET Rest API to run resource allocation script with SB JSON Args: script (str): file path to an observing script sb_json (str): file path to a scheduling block """ if telescope_is_in_standby(): set_telescope_to_running() wait_before_test(timeout=10) script_completion_state = EXECUTOR.execute_script(script, sb_json, timeout=60) assert script_completion_state == 'COMPLETED', \ f"Expected resource allocation script to be COMPLETED, instead was {script_completion_state}"
def assign(): LOGGER.info( "Before starting the telescope checking if the telescope is in StandBy." ) #Added timeout of 10 sec to wait tmc_low subarray to become OFF wait_before_test(timeout=10) assert (telescope_is_in_standby()) LOGGER.info("Telescope is in StandBy.") LOGGER.info("Invoking Startup Telescope command on the telescope.") LOGGER.info("Starting up telescope") set_telescope_to_running() wait_before_test(timeout=10) LOGGER.info("Telescope is started successfully.") LOGGER.info("Allocating resources to Low Subarray 1") to_be_composed_out_of() LOGGER.info("AssignResources execution successful on Subarray 1") wait_before_test(timeout=10)
def start_up(): LOGGER.info("Check whether telescope is in StandBy") assert (telescope_is_in_standby()) LOGGER.info("Starting up telescope") set_telescope_to_running() wait_before_test(timeout=10)