From 7376e7a72e64883c00c3f44223f5792ff9d993c4 Mon Sep 17 00:00:00 2001 From: toor <elisabetta.giani@inaf.it> Date: Mon, 15 Feb 2021 18:34:45 +0100 Subject: [PATCH] CT-215: Removed forwarded attribute from the Mid CSP.LMC subarray. Updated TANGO DB configuration. Updated tests. --- .../charts/mid-csp/data/midcspconfig.json | 75 -------- csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py | 173 ++++++++++++++---- csp-lmc-mid/csp_lmc_mid/receptors.py | 29 +-- csp-lmc-mid/pogo/MidCspSubarrayBase.xmi | 148 +++++++++++---- .../tests/integration/MidCspSubarray_test.py | 2 + .../tests/unit/midcspsubarray_unit_test.py | 43 +++++ 6 files changed, 304 insertions(+), 166 deletions(-) diff --git a/csp-lmc-mid/charts/mid-csp/data/midcspconfig.json b/csp-lmc-mid/charts/mid-csp/data/midcspconfig.json index 08bb41f..e4a775e 100644 --- a/csp-lmc-mid/charts/mid-csp/data/midcspconfig.json +++ b/csp-lmc-mid/charts/mid-csp/data/midcspconfig.json @@ -347,31 +347,6 @@ "-1", "1" ] - }, - "assignedFspHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_01/fspHealthState" - ] - }, - "assignedFspState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_01/fspState" - ] - }, - "assignedReceptors": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_01/receptors" - ] - }, - "assignedVccHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_01/vccHealthState" - ] - }, - "assignedVccState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_01/vccState" - ] } }, "properties": { @@ -510,31 +485,6 @@ "-1", "1" ] - }, - "assignedFspHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_02/fspHealthState" - ] - }, - "assignedFspState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_02/fspState" - ] - }, - "assignedReceptors": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_02/receptors" - ] - }, - "assignedVccHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_02/vccHealthState" - ] - }, - "assignedVccState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_02/vccState" - ] } }, "properties": { @@ -673,31 +623,6 @@ "-1", "1" ] - }, - "assignedFspHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_03/fspHealthState" - ] - }, - "assignedFspState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_03/fspState" - ] - }, - "assignedReceptors": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_03/receptors" - ] - }, - "assignedVccHealthState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_03/vccHealthState" - ] - }, - "assignedVccState": { - "__root_att": [ - "mid_csp_cbf/sub_elt/subarray_03/vccState" - ] } }, "properties": { diff --git a/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py b/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py index 097c969..a1b0b39 100644 --- a/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py +++ b/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py @@ -24,6 +24,7 @@ import time import json from collections import defaultdict import logging +import numpy # PROTECTED REGION END# //MidCspSubarrayBase.standardlibray_import @@ -88,7 +89,7 @@ class MidCspSubarrayBase(CspSubarray): device._assigned_fsp = [] #device._receptor_to_vcc_map = {} #device._receptor_id_list = [] - device._receptors = Receptors(device.CspMaster) + device._receptors = Receptors(device, self.logger) message = "MidCspSubarray Init command completed OK" self.logger.info(message) return (result_code, message) @@ -697,43 +698,71 @@ class MidCspSubarrayBase(CspSubarray): doc="The progress percentage for the RemoveReceptors command.", ) - assignedVccState = attribute(name="assignedVccState", - label="State of the assigned VCC", - forwarded=True - ) - assignedVccHealthState = attribute(name="assignedVccHealthState", - label="HealthState of the assigned VCC", - forwarded=True - ) - assignedFspState = attribute(name="assignedFspState", - label="State of the assigned FSPs", - forwarded=True - ) - assignedFspHealthState = attribute(name="assignedFspHealthState", - label="HealthState of the assigned FSPs.", - forwarded=True - ) - assignedReceptors = attribute(name="assignedReceptors", - label="The list of assigned receptor IDs.", - forwarded=True - ) - # TODO: implement the root attributes on CbfSubarray - # assignedVccObsState = attribute(name="assignedVccObsState", - # label="ObsState of the assigned VCCs", - # forwarded=True - # ) - # assignedFspObsState = attribute(name="assignedFspObsState", - # label="ObsState of the assigned FSPs.", - # forwarded=True - # ) - # assignedVccAdminMode = attribute(name="assignedVccAdminMode", - # label="AdminMode of the assigned VCCs.", - # forwarded=True - # ) - # assignedFspAdminMode = attribute(name="assignedFspAdminMode", - # label="AdminMode of the assigned FSPs.", - # forwarded=True - # ) + assignedVccState = attribute( + dtype=('DevState',), + max_dim_x=197, + label="assignedVccState", + doc="The State of the assigned VCCs.", + ) + + assignedVccHealthState = attribute( + dtype=('DevUShort',), + max_dim_x=197, + label="assignedVccHealthState", + doc="The health state of the assigned VCCs.", + ) + + assignedVccObsState = attribute( + dtype=('DevUShort',), + max_dim_x=197, + label="assignedVccObsState", + doc="The observing state of the assigned VCCs.", + ) + + assignedVccAdminMode = attribute( + dtype=('DevUShort',), + access=AttrWriteType.READ_WRITE, + max_dim_x=197, + label="assignedVccAdminMode", + doc="The admin mode of the assigned VCCs.", + ) + + assignedFspState = attribute( + dtype=('DevState',), + max_dim_x=197, + label="assignedFSPState", + doc="The State of the assigned FSPs.", + ) + + assignedFspHealthState = attribute( + dtype=('DevUShort',), + max_dim_x=197, + label="assignedFSPHealthState", + doc="The health state of the assigned FSPs.", + ) + + assignedFspObsState = attribute( + dtype=('DevUShort',), + max_dim_x=197, + label="assignedFspObsState", + doc="The observing state of the assigned FSPs.", + ) + + assignedFspAdminMode = attribute( + dtype=('DevUShort',), + access=AttrWriteType.READ_WRITE, + max_dim_x=197, + label="assignedFspAdminMode", + doc="The admin mode of the assigned FSPs.", + ) + + assignedReceptors = attribute( + dtype=('DevULong',), + max_dim_x=197, + label="assignedReceptors", + doc="The list of receptors assigned to the subarray.", + ) + # --------------- # General methods # --------------- @@ -806,7 +835,6 @@ class MidCspSubarrayBase(CspSubarray): self.logger.warning(tango_err.args[0].desc) ''' try: - #assigned_receptors = self._sc_subarray_proxies[self.CbfSubarray].receptors assigned_receptors = self._receptors.assigned_to_subarray(self.SubID) # NOTE: if receptors attribute is empty, assigned_receptors is an empty numpy array # and it will just be skipped by the for loop @@ -828,6 +856,73 @@ class MidCspSubarrayBase(CspSubarray): return self._assigned_vcc # PROTECTED REGION END # // MidCspSubarrayBase.assignedVcc_read + def read_assignedVccState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedVccState_read) ENABLED START # + """Return the assignedVccState attribute.""" + return (Tango.DevState.UNKNOWN,) + def read_assignedVccHealthState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedVccHealthState_read) ENABLED START # + """Return the assignedVccHealthState attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedVccHealthState_read + + def read_assignedVccObsState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedVccObsState_read) ENABLED START # + """Return the assignedVccObsState attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedVccObsState_read + + def read_assignedVccAdminMode(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedVccAdminMode_read) ENABLED START # + """Return the assignedVccAdminMode attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedVccAdminMode_read + + def write_assignedVccAdminMode(self, value): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedVccAdminMode_write) ENABLED START # + """Set the assignedVccAdminMode attribute.""" + pass + # PROTECTED REGION END # // MidCspSubarrayBase.assignedVccAdminMode_write + + def read_assignedFspState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedFspState_read) ENABLED START # + """Return the assignedFspState attribute.""" + return (Tango.DevState.UNKNOWN,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedFspState_read + + def read_assignedFspHealthState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedFspHealthState_read) ENABLED START # + """Return the assignedFspHealthState attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedFspHealthState_read + + def read_assignedFspObsState(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedFspObsState_read) ENABLED START # + """Return the assignedFspObsState attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedFspObsState_read + + def read_assignedFspAdminMode(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedFspAdminMode_read) ENABLED START # + """Return the assignedFspAdminMode attribute.""" + return (0,) + # PROTECTED REGION END # // MidCspSubarrayBase.assignedFspAdminMode_read + + def write_assignedFspAdminMode(self, value): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedFspAdminMode_write) ENABLED START # + """Set the assignedFspAdminMode attribute.""" + pass + # PROTECTED REGION END # // MidCspSubarrayBase.assignedFspAdminMode_write + + def read_assignedReceptors(self): + # PROTECTED REGION ID(MidCspSubarrayBase.assignedReceptors_read) ENABLED START # + """Return the assignedReceptors attribute.""" + assigned_receptors = self._receptors.assigned_to_subarray(self.SubID) + if len(assigned_receptors) == 0: + return [0] + return assigned_receptors + # PROTECTED REGION END # // MidCspSubarrayBase.assignedReceptors_read + # ---------- # Run server # ---------- diff --git a/csp-lmc-mid/csp_lmc_mid/receptors.py b/csp-lmc-mid/csp_lmc_mid/receptors.py index 0d507c0..2bc8e6f 100644 --- a/csp-lmc-mid/csp_lmc_mid/receptors.py +++ b/csp-lmc-mid/csp_lmc_mid/receptors.py @@ -3,13 +3,15 @@ import logging import time from tango import DeviceProxy -LOGGER = logging.getLogger(__name__) +module_logger = logging.getLogger(__name__) class Receptors: """ Class to handle information about the Mid receptors. """ - def __init__(self, csp_master_fqdn): - self._csp_master_fqdn = csp_master_fqdn + def __init__(self, device, logger=None): + self.device = device + self._csp_master_fqdn = device.CspMaster + self.logger = logger or module_logger def cbf_master_address(self): """ @@ -34,7 +36,7 @@ class Receptors: proxy.ping() return proxy except tango.DevFailed as tango_ex: - LOGGER.error(tango_ex.args[0].desc) + module_logger.error(tango_ex.args[0].desc) tango.Except.re_throw_exception(tango_ex, "Connection failed", "Receptors class", @@ -53,7 +55,7 @@ class Receptors: for pair in receptor_to_vcc) return receptor_to_vcc_map except tango.DevFailed as tango_ex: - LOGGER.error(tango_ex.args[0].desc) + module_logger.error(tango_ex.args[0].desc) tango.Except.re_throw_exception(tango_ex, "Connection failed", "Receptors class", @@ -84,7 +86,7 @@ class Receptors: value = proxy.unassignedReceptorIDs return value except tango.DevFailed as tango_ex: - LOGGER.error(tango_ex.args[0].desc) + module_logger.error(tango_ex.args[0].desc) tango.Except.re_throw_exception(tango_ex, "Connection failed", "Receptors class", @@ -99,10 +101,10 @@ class Receptors: try: proxy = self.connect(self._csp_master_fqdn) value = proxy.receptorMembership - LOGGER.debug("receptorMembership:{}".format(value)) + module_logger.debug("receptorMembership:{}".format(value)) return value except tango.DevFailed as tango_ex: - LOGGER.error(tango_ex.args[0].desc) + module_logger.error(tango_ex.args[0].desc) tango.Except.re_throw_exception(tango_ex, "Connection failed", "Receptors class", @@ -115,16 +117,15 @@ class Receptors: assigned_receptors = [] sub_id = int(_sub_id) try: - proxy = self.connect(self._csp_master_fqdn) - subarray_addrs = proxy.cspSubarrayAddresses + self.logger.info(f"CbfSubarray: {self.device.CbfSubarray}") + proxy = self.connect(self.device.CbfSubarray) #receptor_membership = self.subarray_affiliation() #assigned_receptors = [receptor_id + 1 for receptor_id, e in enumerate(receptor_membership) if e == int(sub_id)] - proxy = self.connect(subarray_addrs[sub_id - 1]) - assigned_receptors = proxy.assignedReceptors - LOGGER.debug(assigned_receptors) + assigned_receptors = proxy.receptors + module_logger.debug(assigned_receptors) return assigned_receptors except tango.DevFailed as tango_ex: - LOGGER.error(tango_ex.args[0].desc) + module_logger.error(tango_ex.args[0].desc) tango.Except.re_throw_exception(tango_ex, "Connection failed", "Receptors class", diff --git a/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi b/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi index d1b084a..e154f9a 100644 --- a/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi +++ b/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="ASCII"?> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> <classes name="MidCspSubarrayBase" pogoRevision="9.6"> - <description description="The base class for MID CspSubarray.
Fuctionality to monitor assigned CSP.LMC Capabilities,
as well as inherent Capabilities, are implemented in 
separate TANGO Devices." title="MidCspSubarrayBase" sourcePath="/home/softir/ska-git/csp-lmc/csp-lmc-mid/pogo" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="INAF, SKA Telescope" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false"> + <description description="The base class for MID CspSubarray.
Fuctionality to monitor assigned CSP.LMC Capabilities,
as well as inherent Capabilities, are implemented in 
separate TANGO Devices." title="MidCspSubarrayBase" sourcePath="/home/toor/tmp/CT-215/csp-lmc/csp-lmc-mid/pogo" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="INAF, SKA Telescope" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> - <inheritances classname="SKAObsDevice" sourcePath="../../../lmc-base-classes/pogo"/> - <inheritances classname="SKASubarray" sourcePath="/home/softir/ska-git/lmc-base-classes/pogo"/> - <inheritances classname="CspSubarray" sourcePath="/home/softir/ska-git/csp-lmc/csp-lmc-common/pogo"/> + <inheritances classname="SKAObsDevice" sourcePath="../../../../../ska-git/lmc-base-classes/pogo"/> + <inheritances classname="SKASubarray" sourcePath="/home/toor/ska-git/lmc-base-classes/pogo"/> + <inheritances classname="CspSubarray" sourcePath="/home/toor/ska-git/csp-lmc/csp-lmc-common/pogo"/> <identification contact="at inaf.it - elisabetta.giani" author="elisabetta.giani" emailDomain="inaf.it" classFamily="SKA CSP" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="INAF" reference=""/> </description> <classProperties name="PSTBeams" description="PST sub-element PSTBeams TANGO devices FQDNs"> @@ -75,7 +75,7 @@ <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> - <type xsi:type="pogoDsl:VoidType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -138,7 +138,7 @@ <type xsi:type="pogoDsl:StringArrayType"/> </argin> <argout description="A list of Resources added to the subarray."> - <type xsi:type="pogoDsl:StringArrayType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -147,7 +147,7 @@ <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> - <type xsi:type="pogoDsl:VoidType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -174,7 +174,7 @@ <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description="List of resources removed from the subarray."> - <type xsi:type="pogoDsl:StringArrayType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -183,7 +183,7 @@ <type xsi:type="pogoDsl:StringArrayType"/> </argin> <argout description="List of resources removed from the subarray."> - <type xsi:type="pogoDsl:StringArrayType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -192,7 +192,7 @@ <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> - <type xsi:type="pogoDsl:VoidType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -210,7 +210,7 @@ <type xsi:type="pogoDsl:StringArrayType"/> </argin> <argout description=""> - <type xsi:type="pogoDsl:VoidType"/> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -300,7 +300,34 @@ <type xsi:type="pogoDsl:StringType"/> </argin> <argout description=""> + <type xsi:type="pogoDsl:LongStringArrayType"/> + </argout> + <status abstract="false" inherited="true" concrete="true"/> + </commands> + <commands name="End" description="Change obsState to IDLE." execMethod="end" displayLevel="OPERATOR" polledPeriod="0"> + <argin description=""> <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:LongStringArrayType"/> + </argout> + <status abstract="false" inherited="true" concrete="true"/> + </commands> + <commands name="ObsReset" description="Reset observation state machine to its default state" execMethod="obs_reset" displayLevel="OPERATOR" polledPeriod="0"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:LongStringArrayType"/> + </argout> + <status abstract="false" inherited="true" concrete="true"/> + </commands> + <commands name="Restart" description="Restart the observation state machine" execMethod="restart" displayLevel="OPERATOR" polledPeriod="0"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:LongStringArrayType"/> </argout> <status abstract="false" inherited="true" concrete="true"/> </commands> @@ -882,33 +909,78 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="List of assigned VCCs." label="List of assigned VCCs" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> - <forwardedAttributes name="assignedVccState" label="State of the assigned VCC"> + <attributes name="assignedVccState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:StateType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedVccHealthState" label="HealthState of the assigned VCC"> + <properties description="The State of the assigned VCCs." label="assignedVccState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedVccHealthState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedFspState" label="State of the assigned FSPs"> + <properties description="The health state of the assigned VCCs." label="assignedVccHealthState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedVccObsState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedFspHealthState" label="HealthState of the assigned FSPs."> + <properties description="The observing state of the assigned VCCs." label="assignedVccObsState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedVccAdminMode" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedReceptors" label="The list of assigned receptor IDs."> + <properties description="The admin mode of the assigned VCCs." label="assignedVccAdminMode" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedFspState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:StateType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedVccObsState" label="ObsState of the assigned VCCs"> + <properties description="The State of the assigned FSPs." label="assignedFSPState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedFspHealthState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedFspObsState" label="ObsState of the assigned FSPs."> + <properties description="The health state of the assigned FSPs." label="assignedFSPHealthState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedFspObsState" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedVccAdminMode" label="AdminMode of the assigned VCCs."> + <properties description="The observing state of the assigned FSPs." label="assignedFspObsState" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedFspAdminMode" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UShortType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> - <forwardedAttributes name="assignedFspAdminMode" label="AdminMode of the assigned FSPs."> + <properties description="The admin mode of the assigned FSPs." label="assignedFspAdminMode" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> + <attributes name="assignedReceptors" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="197" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:UIntType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </forwardedAttributes> + <properties description="The list of receptors assigned to the subarray." label="assignedReceptors" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> <states name="ON" description="This state could have been called OK or OPERATIONAL. It means that the device is in its operational state. (E.g. the power supply is giving its nominal current, th motor is ON and ready to move, the instrument is operating). This state is modified by the Attribute alarm checking of the DeviceImpl:dev_state method. i.e. if the State is ON and one attribute has its quality factor to ATTR_WARNING or ATTR_ALARM, then the State is modified to ALARM."> <status abstract="false" inherited="true" concrete="true"/> </states> @@ -934,14 +1006,14 @@ <status abstract="false" inherited="true" concrete="true"/> </states> <preferences docHome="./doc_html" makefileHome="/usr/local/share/pogo/preferences"/> - <overlodedPollPeriodObject name="adminMode" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="configurationDelayExpected" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="configurationProgress" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="controlMode" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="healthState" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="obsMode" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="obsState" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="simulationMode" type="attribute" pollPeriod="0"/> - <overlodedPollPeriodObject name="testMode" type="attribute" pollPeriod="0"/> + <overlodedPollPeriodObject name="activationTime" type="attribute" pollPeriod="1000"/> + <overlodedPollPeriodObject name="buildState" type="attribute" pollPeriod="60000"/> + <overlodedPollPeriodObject name="buildState" type="attribute" pollPeriod="60000"/> + <overlodedPollPeriodObject name="versionId" type="attribute" pollPeriod="60000"/> + <overlodedPollPeriodObject name="versionId" type="attribute" pollPeriod="60000"/> + <overlodedPollPeriodObject name="loggingLevel" type="attribute" pollPeriod="1000"/> + <overlodedPollPeriodObject name="loggingLevel" type="attribute" pollPeriod="1000"/> + <overlodedPollPeriodObject name="assignedResources" type="attribute" pollPeriod="1000"/> + <overlodedPollPeriodObject name="configuredCapabilities" type="attribute" pollPeriod="1000"/> </classes> </pogoDsl:PogoSystem> diff --git a/csp-lmc-mid/tests/integration/MidCspSubarray_test.py b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py index ace4b2d..678009b 100755 --- a/csp-lmc-mid/tests/integration/MidCspSubarray_test.py +++ b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py @@ -312,6 +312,7 @@ class TestCspSubarray(TestBase): prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.ON, f"CSP Subarray not OFF") Poller(4, 0.2).check(prober_subarray_state) + @pytest.mark.off_resourcing def test_OffCommand_after_RESOURCING(self): """ Test that the Off command send the device in OFF-EMPTY @@ -332,6 +333,7 @@ class TestCspSubarray(TestBase): prober_subarray_obsstate = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray not EMPTY") Poller(4, 0.2).check(prober_subarray_obsstate) receptors = self.midcsp_subarray01.assignedReceptors + LOGGER.info(f'type of {type(receptors)}') LOGGER.info(f'list of receptors{receptors}') assert not receptors.any(), f"CSP Subarray is not empty" diff --git a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py index d4accef..89a63ab 100644 --- a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py +++ b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py @@ -75,6 +75,9 @@ def test_midcspsubarray_state_AFTER_on_command_WITH_exception_raised_by_subeleme proxies_to_mock=proxies_to_mock) as tango_context: cbf_subarray_device_proxy_mock.On.side_effect = raise_devfailed_exception pss_subarray_device_proxy_mock.On.side_effect = return_ok + state = tango_context.device.State() + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() # Note: the state is in ALARM because the device uses forwarded attributes. #assert tango_context.device.State() == DevState.FAULT @@ -105,6 +108,8 @@ def test_midcspsubarray_state_AFTER_on_command_WITH_failed_code_returned_by_sube proxies_to_mock=proxies_to_mock) as tango_context: cbf_subarray_device_proxy_mock.On.side_effect = return_failed pss_subarray_device_proxy_mock.On.side_effect = return_ok + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() #assert tango_context.device.State() == DevState.FAULT assert tango_context.device.obsState == ObsState.EMPTY @@ -133,6 +138,8 @@ def test_midcspsubarray_state_AFTER_on_command_WITH_failed_code_returned_by_pss_ 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_failed + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() #assert tango_context.device.State() == DevState.ON assert tango_context.device.obsState == ObsState.EMPTY @@ -162,6 +169,8 @@ def test_midcspsubarray_state_after_on_forwarded_to_subelement_subarray(): 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_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() #assert tango_context.device.State() == DevState.ON assert tango_context.device.obsState == ObsState.EMPTY @@ -232,6 +241,8 @@ def test_removereceptors_command_WHEN_subarray_is_in_wrong_state(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_configure_do.return_value = (ResultCode.OK, "On command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -281,6 +292,8 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_raises_an_exception(): mock.patch('csp_lmc_mid.receptors.Receptors.unassigned_ids') as mock_unassigned_ids: cbf_subarray_device_proxy_mock.On.side_effect = return_ok pss_subarray_device_proxy_mock.On.side_effect = return_ok + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate', ObsState.EMPTY) event_subscription_map[cbf_subarray_state_attr](dummy_event) @@ -325,6 +338,8 @@ def test_midcspsubarray_obsstate_AFTER_add_receptors_to_cbf_subarray(): 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_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obstate',ObsState.IDLE) event_subscription_map[cbf_subarray_state_attr](dummy_event) @@ -385,6 +400,8 @@ def test_midcspsubarray_obsstate_AFTER_configure(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -440,6 +457,8 @@ def test_midcspsubarray_invoke_configure_WHILE_gotoidle_is_running(): mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -490,6 +509,8 @@ def test_midcspsubarray_obsstate_AFTER_configure_WITH_wrong_json(): mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -537,6 +558,8 @@ def test_midcspsubarray_obsstate_AFTER_timeout_during_configuration(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -588,6 +611,8 @@ def test_midcspsubarray_obsstate_AFTER_cbfsubarray_fault_during_configuration(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -640,6 +665,8 @@ def test_midcspsubarray_obsstate_AFTER_abort_request_during_configuration(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -692,6 +719,8 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_is_in_fault_during_abort_reque mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -751,6 +780,8 @@ def test_midcspsubarray_obsstate_WHEN_abort_invoked_in_resetting(): mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -806,6 +837,8 @@ def test_midcspsubarray_obsstate_WHEN_restart_invoked_after_cspsubarray_aborted( mock_do.return_value = (ResultCode.OK, "AssignResources OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() param = { 'subarrayID': 1, @@ -846,6 +879,8 @@ def test_midcspsubarray_state_AFTER_on_command_WITH_failed_code_returned_by_pss_ 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_failed + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() #assert tango_context.device.State() == DevState.ON assert tango_context.device.obsState == ObsState.EMPTY @@ -933,6 +968,8 @@ def test_midcspsubarray_obsstate_WHEN_timeout_in_abort_request_during_configurin mock_do.return_value = (ResultCode.OK, "AddReceptors OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") mock_delay_expected.return_value = 2 + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() tango_context.device.AddReceptors(receptor_list) configuration_string = load_json_file("test_ConfigureScan_ADR4.json") @@ -980,6 +1017,8 @@ def test_midcspsubarray_obsstate_AFTER_configure_WITH_cbf_returning_FAULT(): mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() tango_context.device.AddReceptors(receptor_list) configuration_string = load_json_file("test_ConfigureScan_ADR4.json") @@ -1026,6 +1065,8 @@ def test_midcspsubarray_obsstate_AFTER_end_scan(): mock_do.return_value = (ResultCode.OK, "AddReceptors OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") #mock_configure_do.return_value = (ResultCode.OK, "Configure command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() tango_context.device.AddReceptors(receptor_list) configuration_string = load_json_file("test_ConfigureScan_ADR4.json") @@ -1075,6 +1116,8 @@ def test_midcspsubarray_obsreset(): mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") mock_on_do.return_value = (ResultCode.OK, "On command OK") + prober_state = Probe(tango_context.device, 'State', DevState.OFF, f"Wrong CspSubarray state") + Poller(3, 0.1).check(prober_state) tango_context.device.On() tango_context.device.AddReceptors(receptor_list) configuration_string = load_json_file("test_ConfigureScan_ADR4.json") -- GitLab