Skip to content
Snippets Groups Projects
Commit 5dc84731 authored by toor's avatar toor
Browse files

CT-126: First step in adding the CspSubElementSubarray class and

related tests.
parent c375f624
Branches
Tags
No related merge requests found
<?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="CspSubElementSubarray" pogoRevision="9.6">
<description description="Subarray device for SKA CSP SubElement" title="CspSubElementSubarray" sourcePath="/home/toor/ska-git/lmc-base-classes/pogo" language="PythonHL" filestogenerate="XMI file,Code files,Protected Regions" license="BSD3" copyright="" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<inheritances classname="SKAObsDevice" sourcePath="./"/>
<inheritances classname="SKASubarray" sourcePath="/home/toor/ska-git/lmc-base-classes/pogo"/>
<identification contact="at inaf.it - elisabetta.giani" author="elisabetta.giani" emailDomain="inaf.it" classFamily="SkaBase" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<deviceProperties name="CapabilityTypes" description="List of Capability types e.g. capCorr, capPss,&#xA;capPstBf, capVlbi, this will be used to dynamically&#xA;define groups for subarray.">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="true" concrete="true"/>
</deviceProperties>
<deviceProperties name="LoggingLevelDefault" description="Default logging level at device startup.&#xA;(0=OFF, 1=FATAL, 2=ERROR, 3=WARNING, 4=INFO, 5=DEBUG)">
<type xsi:type="pogoDsl:UShortType"/>
<status abstract="false" inherited="true" concrete="true"/>
<DefaultPropValue>4</DefaultPropValue>
</deviceProperties>
<deviceProperties name="LoggingTargetsDefault" description="Default logging targets at device startup.&#xA;Each item has the format: target_type::target_name.&#xA;To log to stdout, use 'console::cout'.&#xA;To log to syslog, use 'syslog::&lt;address>',&#xA; where &lt;address> is a file path,&#xA; for example 'syslog::/var/run/rsyslog/dev/log'.&#xA;To log to a file, use 'file::&lt;path>',&#xA; where &lt;path> is a file path,&#xA; for example 'file::/tmp/my_dev.log'.">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="true" concrete="true"/>
</deviceProperties>
<deviceProperties name="GroupDefinitions" description="Each string in the list is a JSON serialised dict defining the ``group_name``,&#xA;``devices`` and ``subgroups`` in the group. A TANGO Group object is created&#xA;for each item in the list, according to the hierarchy defined. This provides&#xA;easy access to the managed devices in bulk, or individually.&#xA;&#xA;The general format of the list is as follows, with optional ``devices`` and&#xA;``subgroups`` keys:&#xA; [ {``group_name``: ``&lt;name>``,&#xA; ``devices``: [``&lt;dev name>``, ...]},&#xA; {``group_name``: ``&lt;name>``,&#xA; ``devices``: [``&lt;dev name>``, ``&lt;dev name>``, ...],&#xA; ``subgroups`` : [{&lt;nested group>},&#xA; {&lt;nested group>}, ...]},&#xA; ...&#xA; ]&#xA;&#xA;For example, a hierarchy of racks, servers and switches:&#xA; [ {``group_name``: ``servers``,&#xA; ``devices``: [``elt/server/1``, ``elt/server/2``,&#xA; ``elt/server/3``, ``elt/server/4``]},&#xA; {``group_name``: ``switches``,&#xA; ``devices``: [``elt/switch/A``, ``elt/switch/B``]},&#xA; {``group_name``: ``pdus``,&#xA; ``devices``: [``elt/pdu/rackA``, ``elt/pdu/rackB``]},&#xA; {``group_name``: ``racks``,&#xA; ``subgroups``: [&#xA; {``group_name``: ``rackA``,&#xA; ``devices``: [``elt/server/1``, ``elt/server/2``,&#xA; ``elt/switch/A``, ``elt/pdu/rackA``]},&#xA; {``group_name``: ``rackB``,&#xA; ``devices``: [``elt/server/3``, ``elt/server/4``,&#xA; ``elt/switch/B``, ``elt/pdu/rackB``],&#xA; ``subgroups``: []}&#xA; ]} ]">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="true" concrete="true"/>
</deviceProperties>
<deviceProperties name="SkaLevel" description="Indication of importance of the device in the SKA hierarchy &#xA;to support drill-down navigation: 1..6, with 1 highest.&#xA;Default is 4, making provision for &#xA;EltMaster, EltAlarms, EltTelState = 1&#xA;SubEltMaster = 2&#xA;Subarray, Capability = 2/3&#xA;Others = 4 (or 5 or 6)">
<type xsi:type="pogoDsl:ShortType"/>
<status abstract="false" inherited="true" concrete="true"/>
<DefaultPropValue>4</DefaultPropValue>
</deviceProperties>
<deviceProperties name="SubID" description="Unique identifier of the subarray device.">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="true" concrete="true"/>
</deviceProperties>
<commands name="Abort" description="Change obsState to ABORTED." execMethod="abort" 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="Configure" description="Configures the scan for this subarray" execMethod="configure" displayLevel="OPERATOR" polledPeriod="0">
<argin description="The scan configuration, formatted as a JSON string">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:LongStringArrayType"/>
</argout>
<status abstract="false" inherited="true" concrete="true"/>
</commands>
<commands name="GetVersionInfo" description="Array of version strings of all entities modelled by this device. &#xA;(One level down only)&#xA;Each string in the array lists the version info for one entity&#xA;managed by this device. &#xA;The first entry is version info for this TANGO Device itself.&#xA;The entities may be TANGO devices, or hardware LRUs or &#xA;anything else this devices manages/models.&#xA;The intention with this command is that it can provide more &#xA;detailed information than can be captured in the versionId &#xA;and buildState attributes, if necessary.&#xA;In the minimal case the GetVersionInfo will contain only the &#xA;versionId and buildState attributes of the next lower level&#xA;entities." execMethod="get_version_info" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="[ name: EltTelState">
<type xsi:type="pogoDsl:StringArrayType"/>
</argout>
<status abstract="false" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="AssignResources" description="" execMethod="assign_resources" displayLevel="OPERATOR" polledPeriod="0">
<argin description="List of Resources to add to subarray.">
<type xsi:type="pogoDsl:StringArrayType"/>
</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="EndScan" description="Terminate scan." execMethod="end_scan" 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="ReleaseAllResources" description="Remove all resources to tear down to an empty subarray." execMethod="release_all_resources" 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="ReleaseResources" description="Delta removal of assigned resources." execMethod="release_resources" displayLevel="OPERATOR" polledPeriod="0">
<argin description="List of resources to remove from the subarray.">
<type xsi:type="pogoDsl:StringArrayType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:LongStringArrayType"/>
</argout>
<status abstract="false" inherited="true" concrete="true"/>
</commands>
<commands name="Reset" description="Reset device to its default state" execMethod="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="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>
<commands name="Scan" description="Starts the scan." execMethod="scan" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:StringArrayType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:LongStringArrayType"/>
</argout>
<status abstract="false" inherited="true" concrete="true"/>
</commands>
<commands name="ConfigureScan" description="Configure a complete scan for the subarray." execMethod="configure_scan" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="A Json-encoded string with the scan configuration.">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="A tuple containing a return code and a string message indicating status.&#xA;The message is for information purpose only.">
<type xsi:type="pogoDsl:LongStringArrayType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="GoToIdle" description="Transit the subarray from READY to IDLE obsState." execMethod="go_to_idle" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="A tuple containing a return code and a string message indicating status.&#xA;The message is for information purpose only.">
<type xsi:type="pogoDsl:LongStringArrayType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="activationTime" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:DoubleType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Time of activation in seconds since Unix epoch." label="" unit="s" standardUnit="s" displayUnit="s" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="adminMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="true" libCheckCriteria="true"/>
<archiveEvent fire="true" libCheckCriteria="true"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="The admin mode reported for this device. It may interpret the current device condition &#xA;and condition of all managed devices to set this. Most possibly an aggregate attribute." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="buildState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Build state of this device" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="configurationDelayExpected" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:UShortType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Configuration delay expected in seconds" label="" unit="seconds" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="configurationProgress" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:UShortType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true" concreteHere="false"/>
<properties description="Percentage configuration progress" label="" unit="%" standardUnit="" displayUnit="" format="" maxValue="100" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="controlMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="The control mode of the device. REMOTE, LOCAL&#xA;TANGO Device accepts only from a &#x2018;local&#x2019; client and ignores commands and queries received from TM&#xA;or any other &#x2018;remote&#x2019; clients. The Local clients has to release LOCAL control before REMOTE clients&#xA;can take control again." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="healthState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="The health state reported for this device. It interprets the current device condition &#xA;and condition of all managed devices to set this. Most possibly an aggregate attribute." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="loggingLevel" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Current logging level for this device - initialises to LoggingLevelDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="obsMode" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Observing Mode" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="obsState" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="true" libCheckCriteria="true"/>
<archiveEvent fire="true" libCheckCriteria="true"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Observing State" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="simulationMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Reports the simulation mode of the device. Some devices may implement both modes,&#xA;while others will have simulators that set simulationMode to True while the real&#xA;devices always set simulationMode to False." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="testMode" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" allocReadMember="true">
<dataType xsi:type="pogoDsl:EnumType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="The test mode of the device. &#xA;Either no test mode (empty string) or an indication of the test mode." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="versionId" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Build state of this device" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="scanID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:ULongType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The scan identification number to be inserted in the output products." label="scanID" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="configurationID" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The configuration ID specified into the JSON configuration." label="configurationID" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="sdpDestinationAddresses" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="JSON formatted string.&#xA;Report the list of all the SDP addresses provided by SDP to receive the output products.&#xA;Specifies the Mac, IP, Port for each resource:CBF visibility channels, Pss pipelines, PSTBeam" label="sdpDestinationAddresses" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="outputDataRateToSdp" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The output data rate (GB/s) on the link for each scan." label="outputDataRateToSdp" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="lastScanConfiguration" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The last valid scan configuration." label="lastScanConfiguration" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="configureScanMeasuredDuration" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The measured time (sec) taken to execute the command" label="configureScanMeasuredDuration" unit="sec" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="listOfDevicesCompletedTasks" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="JSON formatted string reporting for each task/command the list of devices&#xA;that completed successfully the task.&#xA;Ex.&#xA;{``cmd1``: [``device1``, ``device2``], ``cmd2``: [``device2``, ``device3``]}" label="listOfDevicesCompletedTasks" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="assignResourcesMaximumDuration" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The maximum expected command duration." label="assignResourcesMaximumDuration" unit="sec" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="assignResourcesMeasuredDuration" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The measured command execution duration." label="assignResourcesMeasuredDuration" unit="sec" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="assignResourcesProgress" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" 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"/>
<properties description="The percentage progress of the command in the [0,100]." label="assignResourcesProgress" unit="" standardUnit="" displayUnit="" format="" maxValue="100" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="releaseResourcesMaximumDuration" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The maximum expected command duration." label="releaseResourcesMaximumDuration" unit="sec" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="releaseResourcesMeasuredDuration" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:FloatType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The measured command execution duration." label="releaseResourcesMeasuredDuration" unit="sec" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="releaseResourcesProgress" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" 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"/>
<properties description="The percentage progress of the command in the [0,100]." label="releaseResourcesProgress" unit="" standardUnit="" displayUnit="" format="" maxValue="100" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="timeoutExpiredFlag" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Flag reporting command timeout expiration." label="timeoutExpiredFlag" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="assignedResources" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="100" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true" concreteHere="false"/>
<properties description="The list of resources assigned to the subarray." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="configuredCapabilities" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="10" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true" concreteHere="false"/>
<properties description="A list of capability types with no. of instances in use on this subarray; e.g.&#xA;Correlators:512, PssBeams:4, PstBeams:4, VlbiBeams:0." label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="loggingTargets" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="3" maxY="" allocReadMember="true">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<status abstract="false" inherited="true" concrete="true"/>
<properties description="Logging targets for this device, excluding ska_logging defaults - &#xA;initialises to LoggingTargetsDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="sdpLinkActive" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="100" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Flag reporting if the SDP links are active." label="sdpLinkActive" 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>
<states name="OFF" description="The device is in normal condition but is not active. E.g. the power supply main circuit breaker is open; the RF transmitter has no power etc...">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="FAULT" description="The device has a major failure that prevents it to work. For instance, A power supply has stopped due to over temperature A motor cannot move because it has fault conditions. Usually we cannot get out from this state without an intervention on the hardware or a reset command.">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="INIT" description="This state is reserved to the starting phase of the device server. It means that the software is not fully operational and that the user must wait">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="ALARM" description="ALARM - The device is operating but&#xA;at least one of the attributes is out of range. It can be linked to alarm conditions set by attribute properties or a specific case. (E.g. temperature alarm on a stepper motor, end switch pressed on a stepper motor, up water level in a tank, etc....). In alarm, usually the device does its job, but the operator has to perform an action to avoid a bigger problem that may switch the state to FAULT.">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="UNKNOWN" description="The device cannot retrieve its state. It is the case when there is a communication problem to the hardware (network cut, broken cable etc...) It could also represent an incoherent situation">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="STANDBY" description="Equates to LOW-POWER mode. This is the initial transition from INIT if the device supports a low-power mode. The device is not fully active but is ready to operate.">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<states name="DISABLE" description="The device cannot be switched ON for an external reason. E.g. the power supply has its door open, the safety conditions are not satisfactory to allow the device to operate.">
<status abstract="false" inherited="true" concrete="true"/>
</states>
<preferences docHome="./doc_html" makefileHome="/usr/local/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
......@@ -14,6 +14,7 @@ __all__ = (
"SKASubarrayResourceManager",
"SKATelState",
"CspSubElementMaster",
"CspSubElementSubarray",
)
# Note: order of imports is important - start with lowest in the hierarchy
......@@ -35,3 +36,4 @@ from .subarray_device import (
)
# CspSubElement classes
from .csp_subelement_master import CspSubElementMaster
from .csp_subelement_subarray import CspSubElementSubarray
This diff is collapsed.
#########################################################################################
# -*- coding: utf-8 -*-
#
# This file is part of the CspSubelementSubarray project
#
#
#
#########################################################################################
"""Contain the tests for the CspSubelementSubarray and the State model implemented by
such device.
"""
# Imports
import logging
import re
import pytest
import json
from tango import DevState, DevFailed
from tango.test_context import MultiDeviceTestContext
# PROTECTED REGION ID(CspSubelementSubarray.test_additional_imports) ENABLED START #
from ska.base import SKASubarray, CspSubElementSubarray
from ska.base.commands import ResultCode
from ska.base.faults import StateModelError
from ska.base.control_model import (
ObsState, AdminMode, ControlMode, HealthState, SimulationMode, TestMode
)
from .conftest import load_state_machine_spec, StateMachineTester
# PROTECTED REGION END # // CspSubElementSubarray.test_additional_imports
# Device test case
# PROTECTED REGION ID(CspSubElementSubarray.test_CspSubelementSubarray_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_CspSubelementSubarray_decorators
class TestCspSubElementSubarray(object):
"""Test case for CSP SubElement Subarray class."""
properties = {
'SkaLevel': '4',
'LoggingTargetsDefault': '',
'GroupDefinitions': '',
}
@classmethod
def mocking(cls):
"""Mock external libraries."""
# Example : Mock numpy
# cls.numpy = CspSubelementSubarray.numpy = MagicMock()
# PROTECTED REGION ID(CspSubelementSubarray.test_mocking) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_mocking
def test_properties(self, tango_context):
# Test the properties
# PROTECTED REGION ID(CspSubelementSubarray.test_properties) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_properties
pass
# PROTECTED REGION ID(CspSubelementSubarray.test_State_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_State_decorators
def test_State(self, tango_context):
"""Test for State"""
# PROTECTED REGION ID(CspSubelementSubarray.test_State) ENABLED START #
assert tango_context.device.State() == DevState.OFF
# PROTECTED REGION END # // CspSubelementSubarray.test_State
# PROTECTED REGION ID(CspSubelementSubarray.test_Status_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_Status_decorators
def test_Status(self, tango_context):
"""Test for Status"""
# PROTECTED REGION ID(CspSubelementSubarray.test_Status) ENABLED START #
assert tango_context.device.Status() == "The device is in OFF state."
# PROTECTED REGION END # // CspSubelementSubarray.test_Status
# PROTECTED REGION ID(CspSubelementSubarray.test_GetVersionInfo_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_GetVersionInfo_decorators
def test_GetVersionInfo(self, tango_context):
"""Test for GetVersionInfo"""
# PROTECTED REGION ID(CspSubelementSubarray.test_GetVersionInfo) ENABLED START #
versionPattern = re.compile(
r'CspSubElementSubarray, lmcbaseclasses, [0-9].[0-9].[0-9], '
r'A set of generic base devices for SKA Telescope.')
versionInfo = tango_context.device.GetVersionInfo()
assert (re.match(versionPattern, versionInfo[0])) is not None
# PROTECTED REGION END # // CspSubelementSubarray.test_GetVersionInfo
# PROTECTED REGION ID(CspSubelementSubarray.test_configurationProgress_decorators) ENABLED START #
def test_buildState(self, tango_context):
"""Test for buildState"""
# PROTECTED REGION ID(CspSubelementSubarray.test_buildState) ENABLED START #
buildPattern = re.compile(
r'lmcbaseclasses, [0-9].[0-9].[0-9], '
r'A set of generic base devices for SKA Telescope')
assert (re.match(buildPattern, tango_context.device.buildState)) is not None
# PROTECTED REGION END # // CspSubelementSubarray.test_buildState
# PROTECTED REGION ID(CspSubelementSubarray.test_versionId_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_versionId_decorators
def test_versionId(self, tango_context):
"""Test for versionId"""
# PROTECTED REGION ID(CspSubelementSubarray.test_versionId) ENABLED START #
versionIdPattern = re.compile(r'[0-9].[0-9].[0-9]')
assert (re.match(versionIdPattern, tango_context.device.versionId)) is not None
# PROTECTED REGION END # // CspSubelementSubarray.test_versionId
# PROTECTED REGION ID(CspSubelementSubarray.test_healthState_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_healthState_decorators
def test_healthState(self, tango_context):
"""Test for healthState"""
# PROTECTED REGION ID(CspSubelementSubarray.test_healthState) ENABLED START #
assert tango_context.device.healthState == HealthState.OK
# PROTECTED REGION END # // CspSubelementSubarray.test_healthState
# PROTECTED REGION ID(CspSubelementSubarray.test_adminMode_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_adminMode_decorators
def test_adminMode(self, tango_context):
"""Test for adminMode"""
# PROTECTED REGION ID(CspSubelementSubarray.test_adminMode) ENABLED START #
assert tango_context.device.adminMode == AdminMode.MAINTENANCE
# PROTECTED REGION END # // CspSubelementSubarray.test_adminMode
# PROTECTED REGION ID(CspSubelementSubarray.test_controlMode_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_controlMode_decorators
def test_controlMode(self, tango_context):
"""Test for controlMode"""
# PROTECTED REGION ID(CspSubelementSubarray.test_controlMode) ENABLED START #
assert tango_context.device.controlMode == ControlMode.REMOTE
# PROTECTED REGION END # // CspSubelementSubarray.test_controlMode
# PROTECTED REGION ID(CspSubelementSubarray.test_simulationMode_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_simulationMode_decorators
def test_simulationMode(self, tango_context):
"""Test for simulationMode"""
# PROTECTED REGION ID(CspSubelementSubarray.test_simulationMode) ENABLED START #
assert tango_context.device.simulationMode == SimulationMode.FALSE
# PROTECTED REGION END # // CspSubelementSubarray.test_simulationMode
# PROTECTED REGION ID(CspSubelementSubarray.test_testMode_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_testMode_decorators
def test_testMode(self, tango_context):
"""Test for testMode"""
# PROTECTED REGION ID(CspSubelementSubarray.test_testMode) ENABLED START #
assert tango_context.device.testMode == TestMode.NONE
# PROTECTED REGION END # // CspSubelementSubarray.test_testMode
# PROTECTED REGION ID(CspSubelementSubarray.test_scanID_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_scanID_decorators
def test_scanID(self, tango_context):
"""Test for scanID"""
# PROTECTED REGION ID(CspSubelementSubarray.test_scanID) ENABLED START #
assert tango_context.device.scanID == 0
# PROTECTED REGION END # // CspSubelementSubarray.test_scanID
# PROTECTED REGION ID(CspSubelementSubarray.test_sdpDestinationAddresses_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_sdpDestinationAddresses_decorators
def test_sdpDestinationAddresses(self, tango_context):
"""Test for sdpDestinationAddresses"""
# PROTECTED REGION ID(CspSubelementSubarray.test_sdpDestinationAddresses) ENABLED START #
addresses_dict = {'outputHost': [], 'outputMac': [], 'outputPort': []}
tango_context.device.sdpDestinationAddresses = json.dumps(addresses_dict)
assert tango_context.device.sdpDestinationAddresses == json.dumps(addresses_dict)
# PROTECTED REGION END # // CspSubelementSubarray.test_sdpDestinationAddresses
# PROTECTED REGION ID(CspSubelementSubarray.test_sdpLinkActive_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_sdpLinkActive_decorators
def test_sdpLinkActivity(self, tango_context):
"""Test for sdpLinkActive """
# PROTECTED REGION ID(CspSubelementSubarray.test_sdpLinkActive) ENABLED START #
expected = tango_context.device.sdpLinkActive
if expected is not None:
n_links = len(expected)
actual = [ False for i in range(0, n_links)]
assert all([a == b for a, b in zip(actual, expected)])
else:
assert expected is None
# PROTECTED REGION END # // CspSubelementSubarray.test_sdpLinkActive
# PROTECTED REGION ID(CspSubelementSubarray.test_outputDataRateToSdp_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_outputDataRateToSdp_decorators
def test_outputDataRateToSdp(self, tango_context):
"""Test for outputDataRateToSdp """
# PROTECTED REGION ID(CspSubelementSubarray.test_outputDataRateToSdp) ENABLED START #
assert tango_context.device.outputDataRateToSdp == 0
# PROTECTED REGION END # // CspSubelementSubarray.test_outputDataRateToSdp
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_decorators
def test_ConfigureScan(self, tango_context, tango_change_event_helper):
"""Test for ConfigureScan"""
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan) ENABLED START #
tango_context.device.On()
tango_context.device.AssignResources('{"example": [1,2,3]}')
obs_state_callback = tango_change_event_helper.subscribe("obsState")
scan_configuration = '{"id":"sbi-mvp01-20200325-00002"}'
tango_context.device.ConfigureScan(scan_configuration)
obs_state_callback.assert_calls([ObsState.IDLE,ObsState.CONFIGURING])
assert tango_context.device.configurationID == "sbi-mvp01-20200325-00002"
assert tango_context.device.lastScanConfiguration == scan_configuration
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan
# PROTECTED REGION ID(CspSubelementSubarray.test_Configure_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_Configure_decorators
def test_Configure(self, tango_context, tango_change_event_helper):
"""Test for ConfigureScan"""
# PROTECTED REGION ID(CspSubelementSubarray.test_Configure) ENABLED START #
tango_context.device.On()
tango_context.device.AssignResources('{"example": [1,2,3]}')
obs_state_callback = tango_change_event_helper.subscribe("obsState")
scan_configuration = '{"id":"sbi-mvp01-20200325-00002"}'
tango_context.device.Configure(scan_configuration)
obs_state_callback.assert_calls([ObsState.IDLE,ObsState.CONFIGURING])
assert tango_context.device.configurationID == "sbi-mvp01-20200325-00002"
assert tango_context.device.lastScanConfiguration == scan_configuration
# PROTECTED REGION END # // CspSubelementSubarray.test_Configure
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_when_in_wrong_state_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_when_in_wrong_state_decorators
def test_ConfigureScan_when_in_wrong_state(self, tango_context):
"""Test for ConfigureScan when the device is in wrong state"""
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_when_in_wrong_state) ENABLED START #
# The device in in OFF/EMPTY state, not valid to invoke ConfigureScan.
with pytest.raises(DevFailed) as df:
tango_context.device.ConfigureScan('{"id":"sbi-mvp01-20200325-00002"}')
assert "Error executing command ConfigureScanCommand" in str(df.value.args[0].desc)
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_when_in_wrong_state
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_with_wrong_configId_key_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_with_wrong_configId_key_decorators
def test_ConfigureScan_with_wrong_configId_key(self, tango_context):
"""Test for ConfigureScan when json configuration specifies a wrong key for
configuration ID
"""
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_with_wrong_configId_key) ENABLED START #
tango_context.device.On()
tango_context.device.AssignResources('{"example": [1,2,3]}')
# wrong configurationID key
wrong_configuration = '{"subid":"sbi-mvp01-20200325-00002"}'
result_code, msg = tango_context.device.ConfigureScan(wrong_configuration)
assert result_code == ResultCode.FAILED
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_with_wrong_configId_key
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_with_json_syntax_error) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_with_json_syntax_error_decorators
def test_ConfigureScan_with_json_syntax_error(self, tango_context):
"""Test for ConfigureScan when syntax error in json configuration """
# PROTECTED REGION ID(CspSubelementSubarray.test_ConfigureScan_with_json_syntax_error) ENABLED START #
tango_context.device.On()
tango_context.device.AssignResources('{"example": [1,2,3]}')
result_code, msg = tango_context.device.ConfigureScan('{"foo": 1,}')
assert result_code == ResultCode.FAILED
# PROTECTED REGION END # // CspSubelementSubarray.test_ConfigureScan_with_json_syntax_error
# PROTECTED REGION ID(CspSubelementSubarray.test_GoToIdle_decorators) ENABLED START #
# PROTECTED REGION END # // CspSubelementSubarray.test_GoToIdle_decorators
def test_GoToIdle(self, tango_context, tango_change_event_helper):
"""Test for GoToIdle"""
# PROTECTED REGION ID(CspSubelementSubarray.test_GoToIdle) ENABLED START #
tango_context.device.On()
tango_context.device.AssignResources('{"example": [1,2,3]}')
obs_state_callback = tango_change_event_helper.subscribe("obsState")
tango_context.device.ConfigureScan('{"id":"sbi-mvp01-20200325-00002"}')
obs_state_callback.assert_calls([ObsState.IDLE,ObsState.CONFIGURING, ObsState.READY])
tango_context.device.GoToIdle()
obs_state_callback.assert_call(ObsState.IDLE)
assert tango_context.device.scanID == 0
assert tango_context.device.configurationID == ''
# PROTECTED REGION END # // CspSubelementSubarray.test_GoToIdle
def test_multiple_devices_in_same_process():
devices_info = (
{"class": CspSubElementSubarray, "devices": [{"name": "test/se/1"}]},
{"class": SKASubarray, "devices": [{"name": "test/obsdevice/1"}]},
)
with MultiDeviceTestContext(devices_info, process=False) as context:
proxy1 = context.get_device("test/se/1")
proxy2 = context.get_device("test/obsdevice/1")
assert proxy1.State() == DevState.OFF
assert proxy2.State() == DevState.OFF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment