Ejemplo n.º 1
0
 def wrapper(*args, **kwargs):
     check_going_out_of_configured()
     the_waiter = waiter()
     the_waiter.set_wait_for_ending_SB()
     result = func(*args, **kwargs)
     the_waiter.wait(200)
     return result
Ejemplo n.º 2
0
 def wrapper(*args, **kwargs):
     check_coming_out_of_standby()
     the_waiter = waiter()
     the_waiter.set_wait_for_starting_up()
     result = func(*args, **kwargs)
     the_waiter.wait(200)
     return result
Ejemplo n.º 3
0
 def wrapper(*args, **kwargs):
     check_going_into_empty()
     the_waiter = waiter()
     the_waiter.set_wait_for_tearing_down_subarray()
     result = func(*args, **kwargs)
     the_waiter.wait(timeout=100)
     return result
Ejemplo n.º 4
0
 def wrapper(*args, **kwargs):
     check_going_out_of_configure()
     the_waiter = waiter()
     the_waiter.set_wait_for_going_into_scanning()
     result = func(*args, **kwargs)
     the_waiter.wait()
     return result
Ejemplo n.º 5
0
 def wrapper(*args, **kwargs):
     check_going_into_standby()
     the_waiter = waiter()
     the_waiter.set_wait_for_going_to_standby()
     result = func(*args, **kwargs)
     the_waiter.wait(100)
     return result
Ejemplo n.º 6
0
 def wrapper(*args, **kwargs):
     check_going_out_of_abort()
     the_waiter = waiter()
     the_waiter.set_wait_for_going_into_obsreset()
     result = func(*args, **kwargs)
     the_waiter.wait(500)
     return result
Ejemplo n.º 7
0
 def wrapper(*args, **kwargs):
     logging.info("In sync_release_resources")
     check_going_into_empty()
     the_waiter = waiter()
     the_waiter.set_wait_for_tearing_down_subarray()
     result = func(*args, **kwargs)
     the_waiter.wait(150)
     return result
Ejemplo n.º 8
0
 def wrapper(*args, **kwargs):
     check_going_out_of_empty()
     the_waiter = waiter()
     the_waiter.set_wait_for_assign_resources()
     ################ 
     result = func(*args, **kwargs)
     ################ 
     the_waiter.wait(timeout=timeout)
     return result
Ejemplo n.º 9
0
def set_telescope_to_running(disable_waiting=False):
    resource('ska_low/tm_subarray_node/1').assert_attribute('State').equals(
        'OFF')
    the_waiter = waiter()
    the_waiter.set_wait_for_starting_up()
    Telescope().start_up()
    if not disable_waiting:
        the_waiter.wait(100)
        if the_waiter.timed_out:
            pytest.fail("timed out whilst starting up telescope:\n {}".format(
                the_waiter.logs))
Ejemplo n.º 10
0
def set_telescope_to_standby():
    resource('ska_low/tm_subarray_node/1').assert_attribute('State').equals(
        'ON')
    the_waiter = waiter()
    the_waiter.set_wait_for_going_to_standby()
    Telescope().standby()
    #It is observed that CSP and CBF subarrays sometimes take more than 8 sec to change the State to DISABLE
    #therefore timeout is given as 12 sec
    the_waiter.wait(100)
    if the_waiter.timed_out:
        pytest.fail(
            "timed out whilst setting telescope to standby:\n {}".format(
                the_waiter.logs))
Ejemplo n.º 11
0
def compose_sub():
    resource("ska_low/tm_subarray_node/1").assert_attribute("State").equals(
        "ON")
    resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals(
        "EMPTY")
    assign_resources_file = (
        "resources/test_data/TMC_integration/mccs_assign_resources.json")
    config = load_config_from_file(assign_resources_file)
    CentralNodeLow = DeviceProxy("ska_low/tm_central/central_node")
    CentralNodeLow.AssignResources(config)
    the_waiter = waiter()
    the_waiter.wait()
    LOGGER.info("Invoked AssignResources on CentralNodeLow")
Ejemplo n.º 12
0
def compose_sub():
    resource("ska_low/tm_subarray_node/1").assert_attribute("State").equals("ON")
    resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals("EMPTY")
    assign_resources_file = download_test_data(
        "low_assign_resources_v1.json",
        "skampi-test-data/tmc-integration/assign-resources",
    )
    config = load_config_from_file(assign_resources_file)
    os.remove(assign_resources_file)
    CentralNodeLow = DeviceProxy("ska_low/tm_central/central_node")
    CentralNodeLow.AssignResources(config)
    the_waiter = waiter()
    the_waiter.wait()
    LOGGER.info("Invoked AssignResources on CentralNodeLow")
Ejemplo n.º 13
0
def release_resources():
    resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals(
        "IDLE")
    CentralNodeLow = DeviceProxy("ska_low/tm_central/central_node")
    release_resources_file = (
        "resources/test_data/TMC_integration/mccs_release_resources.json")
    release_resource_str = load_config_from_file(release_resources_file)
    CentralNodeLow.ReleaseResources(release_resource_str)
    SubarrayNodeLow = DeviceProxy("ska_low/tm_subarray_node/1")
    LOGGER.info(
        "After Invoking Release Resource on Subarray, SubarrayNodeLow State and ObsState:"
        + str(SubarrayNodeLow.State()) + str(SubarrayNodeLow.ObsState))
    the_waiter = waiter()
    the_waiter.wait()
    LOGGER.info("finished ReleaseResources on CentralNodeLow")
Ejemplo n.º 14
0
def restart_subarray_low(id):
    devices = device_to_subarray.keys()
    filtered_devices = [
        device for device in devices if device_to_subarray[device] == id
    ]
    the_waiter = waiter()
    the_waiter.set_wait_for_going_to_standby()
    exceptions_raised = ""
    for device in filtered_devices:
        try:
            resource(device).restart()
        except Exception as e:
            exceptions_raised += f'\nException raised on reseting {device}:{e}'
    if exceptions_raised != "":
        raise Exception(f'Error in initialising devices:{exceptions_raised}')
    the_waiter.wait()
Ejemplo n.º 15
0
def release_resources():
    resource('ska_low/tm_subarray_node/1').assert_attribute('obsState').equals(
        'IDLE')
    CentralNodeLow = DeviceProxy('ska_low/tm_central/central_node')
    release_resources_file = download_test_data(
        "mccs_release_resources_v1.json",
        "skampi-test-data/tmc-integration/release-resources")
    release_json = load_config_from_file(release_resources_file)
    os.remove(release_resources_file)
    CentralNodeLow.ReleaseResources(release_json)
    SubarrayNodeLow = DeviceProxy('ska_low/tm_subarray_node/1')
    LOGGER.info(
        'After Invoking Release Resource on Subarray, SubarrayNodeLow State and ObsState:'
        + str(SubarrayNodeLow.State()) + str(SubarrayNodeLow.ObsState))
    the_waiter = waiter()
    the_waiter.wait()
    LOGGER.info('finished ReleaseResources on CentralNodeLow')
Ejemplo n.º 16
0
def sync_assigned_resources():
    check_going_out_of_empty()
    the_waiter = waiter()
    the_waiter.set_wait_for_assign_resources()
    yield
    the_waiter.wait(timeout=60)
Ejemplo n.º 17
0
def sync_oet_scanning():
    check_going_out_of_configure()
    the_waiter = waiter()
    the_waiter.set_wait_for_going_into_scanning()
    yield
    the_waiter.wait()
Ejemplo n.º 18
0
def sync_telescope_starting_up(timeout=50):
    check_coming_out_of_standby()
    the_waiter = waiter()
    the_waiter.set_wait_for_starting_up()
    yield
    the_waiter.wait(timeout)
Ejemplo n.º 19
0
def sync_going_to_standby(timeout=50):
    check_going_into_standby()
    the_waiter = waiter()
    the_waiter.set_wait_for_going_to_standby()
    yield
    the_waiter.wait(timeout)
Ejemplo n.º 20
0
def sync_resources_releasing(timeout=100):
    the_waiter = waiter()
    the_waiter.set_wait_for_tearing_down_subarray()
    yield
    the_waiter.wait(timeout)
def test_restart():
    try:
        # given an interface to TMC to interact with a subarray node and a central node
        fixture = {}
        fixture["state"] = "Unknown"
        the_waiter = waiter()

        # given a started up telescope
        assert telescope_is_in_standby()
        LOGGER.info("Starting up the Telescope")
        tmc.start_up()
        fixture["state"] = "Telescope On"

        # and a subarray composed of two resources configured as perTMC_integration/assign_resources.json
        LOGGER.info("Composing the Subarray")
        tmc.compose_sub()
        fixture["state"] = "Subarray Assigned"

        resource("ska_low/tm_subarray_node/1").assert_attribute(
            "obsState").equals("IDLE")
        LOGGER.info("Aborting the subarray")
        fixture["state"] = "Subarray ABORTING"

        LOGGER.info("Invoking abort command")
        tmc.abort_sub()
        fixture["state"] = "Subarray Aborted"

        fixture["state"] = "Subarray Restarting"

        @sync_restart()
        def restart():
            SubarrayNodeLow = DeviceProxy("ska_low/tm_subarray_node/1")
            LOGGER.info(
                "Subarray obsState before Aborted assertion check is: " +
                str(SubarrayNodeLow.obsState))
            resource("ska_low/tm_subarray_node/1").assert_attribute(
                "obsState").equals("ABORTED")
            SubarrayNodeLow.Restart()
            LOGGER.info("Subarray obsState is: " +
                        str(SubarrayNodeLow.obsState))
            LOGGER.info("Invoked restart on Subarray")

        restart()
        LOGGER.info("Restart is complete on Subarray")
        LOGGER.info("TMC-Restart tests complete: tearing down...")
        resource("ska_low/tm_subarray_node/1").assert_attribute(
            "obsState").equals("EMPTY")
        fixture["state"] = "Subarray empty"

        tmc.set_to_standby()

        LOGGER.info("Invoked StandBy on Subarray")
        fixture["state"] = "Subarray off"

        LOGGER.info("TMC-Low-Restart tests complete: tearing down...")

    except:
        LOGGER.info("Tearing down failed test, state = {}".format(
            fixture["state"]))
        if fixture["state"] == "Telescope On":
            tmc.set_to_standby()
        elif fixture["state"] == "Subarray Assigned":
            tmc.release_resources()
            tmc.set_to_standby()
        elif fixture["state"] == "Subarray ABORTING":
            # restart_subarray(1)
            raise Exception(
                "unable to teardown subarray from being in ABORTING")
        elif fixture["state"] == "Subarray Aborted":
            # restart_subarray(1)
            raise Exception(
                "unable to teardown subarray from being in Aborted")
        elif fixture["state"] == "Subarray Restarting":
            # restart_subarray(1)
            raise Exception(
                "unable to teardown subarray from being in Restarting")
        elif fixture["state"] == "Subarray off":
            LOGGER.info("Subarray has completed StandBy execution")
        pytest.fail("unable to complete test without exceptions")