Commit cff6ac80 authored by Gianluca Marotta's avatar Gianluca Marotta
Browse files

Merge branch 'CT-215' into 'master'

Resolve CT-215

Closes CT-215

See merge request ska-telescope/csp-lmc!16
parents c3e22519 19ad7a5f
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
0.7.2
- Initialization of CSP Subarray align its state ans obsstate to sub-elements.

0.7.1
- Off command in Subarray drives each sub-element component to the final OFF/EMPTY state.
- CspMaster On/Standby commands are executed synchronously
+317 −285

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
"""Release information for Python Package"""

name = """csp-lmc-common"""
version = "0.7.1"
version = "0.7.2"
version_info = version.split(".")
description = """SKA CSP.LMC Common Software"""
author = "INAF-OAA"
+31 −15
Original line number Diff line number Diff line
@@ -21,25 +21,41 @@ def test_cspsubarray_state_and_obstate_value_after_initialization():
    """
    device_under_test = CspSubarray
    cbf_subarray_fqdn = 'mid_csp_cbf/sub_elt/subarray_01'
    cbf_subarray_state_attr = 'State'
    pss_subarray_fqdn = 'mid_csp_pss/sub_elt/subarray_01'
    pst_subarray_fqdn = 'mid_csp_pst/sub_elt/subarray_01'

    state_attr = 'State'
    dut_properties = {
            'CspMaster': 'mid_csp/elt/master',
            'CbfSubarray': cbf_subarray_fqdn,
            'PssSubarray': 'mid_csp_pss/sub_elt/subarray_01',
            'PstSubarray': 'mid_csp_pst/sub_elt/subarray_01',
            'PssSubarray': pss_subarray_fqdn,
            'PstSubarray': pst_subarray_fqdn
    }
    event_subscription_map = {}
    cbf_subarray_device_proxy_mock = Mock()
    pss_subarray_device_proxy_mock = Mock()
    pst_subarray_device_proxy_mock = Mock()

    event_subscription_map_cbf= {}
    cbf_subarray_device_proxy_mock.subscribe_event.side_effect = (
       lambda attr_name, event_type, callback, *args, **kwargs: event_subscription_map.update({attr_name: callback}))
       lambda attr_name, event_type, callback, *args, **kwargs: event_subscription_map_cbf.update({attr_name: callback}))

    event_subscription_map_pss = {}
    cbf_subarray_device_proxy_mock.subscribe_event.side_effect = (
        lambda attr_name, event_type, callback, *args, **kwargs: event_subscription_map_pss.update(
            {attr_name: callback}))

    event_subscription_map_pst = {}
    cbf_subarray_device_proxy_mock.subscribe_event.side_effect = (
        lambda attr_name, event_type, callback, *args, **kwargs: event_subscription_map_pst.update(
            {attr_name: callback}))

    proxies_to_mock = {
        cbf_subarray_fqdn: cbf_subarray_device_proxy_mock
        cbf_subarray_fqdn: cbf_subarray_device_proxy_mock,
        pss_subarray_fqdn: pss_subarray_device_proxy_mock,
        pst_subarray_fqdn: pst_subarray_device_proxy_mock
    }

    # CASE A: CBF is OFF
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        dummy_event = create_dummy_event(cbf_subarray_fqdn, DevState.OFF)
        event_subscription_map[cbf_subarray_state_attr](dummy_event)
        assert tango_context.device.State() == DevState.OFF
        assert tango_context.device.obsState == ObsState.EMPTY

@@ -176,13 +192,13 @@ def test_cspsubarray_transaction_id_in_log(capsys):
    with fake_tango_system(device_under_test, initial_dut_properties=dut_properties, proxies_to_mock=proxies_to_mock) as tango_context:
        cbf_subarray_device_proxy_mock.On.side_effect = return_ok
        pss_subarray_device_proxy_mock.On.side_effect = return_ok
        prober_obs_state = Probe(tango_context.device, "State", DevState.OFF, f"State is not OFF")
        Poller(3, 0.1).check(prober_obs_state)
        tango_context.device.On()
        assert tango_context.device.State() == DevState.ON
        tango_context.device.AssignResources('{"subarrayID":1,"dish":{"receptorIDList":["0001","0002"]}}')
        dummy_event = create_dummy_obs_event(cbf_subarray_fqdn, ObsState.IDLE)
        event_subscription_map[cbf_subarray_state_attr](dummy_event)
        prober_obs_state = Probe(tango_context.device, "obsState", ObsState.EMPTY, f"AssignResources command out of time")
        Poller(10, 0.1).check(prober_obs_state)
        #tango_context.device.AssignResources('{"subarrayID":1,"dish":{"receptorIDList":["0001","0002"]}}')
        tango_context.device.AssignResources('{"example": ["BAND1"]}')
        tango_context.device.obsState == ObsState.IDLE
        #TODO: find a way to test Configure (ObsState is needed to be IDLE)
        #tango_context.device.Configure('{"id":"sbi-400-scienceA"}')
        # a prober is needed since the duration of the Configure command is variable.
+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ k8s_test = tar -c . | \
		/bin/bash -c "tar xv --strip-components 1 --warning=all && \
		python3 -m pip install -r requirements-tst.txt . && \
		cd test-harness &&\
		make TANGO_HOST=$(TANGO_HOST) $1 && \
		make TANGO_HOST=$(TANGO_HOST) MARK='$(MARK)' $1 && \
		tar -czvf /tmp/build.tgz build && \
                echo '~~~~BOUNDARY~~~~' && \
                cat /tmp/build.tgz | base64 && \
Loading