Skip to content
Snippets Groups Projects
Commit f51ec801 authored by Aditya Dange's avatar Aditya Dange
Browse files

Removed unwanted methods (GetMetrics and ToJson) from SKABase class. Changed...

Removed unwanted methods (GetMetrics and ToJson) from SKABase class. Changed data types of attributes centralLoggingLevel, elementLoggingLevel and storageLoggingLevel to DevUShort to align with CS_Guidelines
parent 3e52e766
Branches
No related tags found
No related merge requests found
......@@ -10,13 +10,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>4</DefaultPropValue>
</deviceProperties>
<deviceProperties name="MetricList" description="A subset of attributes we want to expose as metrics for this device.">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>healthState</DefaultPropValue>
<DefaultPropValue>adminMode</DefaultPropValue>
<DefaultPropValue>controlMode</DefaultPropValue>
</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="false" concrete="true" concreteHere="true"/>
......@@ -52,24 +45,6 @@
</argout>
<status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
</commands>
<commands name="GetMetrics" description="Gets list of attributes marked as metrics, with their values, &#xA;for device" execMethod="get_metrics" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:StringType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="ToJson" description="Returns a JSON translation of this device.&#xA;Defaults for empty string argin gives commands and metris:&#xA;with_value:false, &#xA;with_commands:true, &#xA;with_metrics:true, &#xA;with_attributes:false" execMethod="to_json" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="Requests the JSON string representing this device, can be filtered &#xA;by with_commands, with_metrics, with_attributes and &#xA;with_value. Defaults for empty string argin are:&#xA;{`with_value`:false, `with_commands`:true,&#xA; `with_metrics`:true, `with_attributes`:false}">
<type xsi:type="pogoDsl:StringType"/>
</argin>
<argout description="The JSON string representing this device, &#xA;filtered as per the input argument flags">
<type xsi:type="pogoDsl:StringType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="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" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
......@@ -102,18 +77,24 @@
</attributes>
<attributes name="centralLoggingLevel" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="1000" 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="Current logging level to Central logging target for this device - &#xA;initialises to CentralLoggingLevelDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="elementLoggingLevel" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="1000" 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="Current logging level to Element logging target for this device - &#xA;initialises to ElementLoggingLevelDefault on startup" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="storageLoggingLevel" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="1000" maxX="" maxY="" memorized="true" 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="Current logging level to Syslog for this device - &#xA;initialises from StorageLoggingLevelDefault on first execution of device.&#xA;Needs to be READ_WRITE To make it memorized - but writing this attribute should &#xA;do the same as command SetStorageLoggingLevel to ensure the targets and adjustments&#xA;are made correctly" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
......
......@@ -4,6 +4,8 @@
#
#
#
# Distributed under the terms of the none license.
# See LICENSE.txt for more info.
""" SKABASE
......@@ -186,10 +188,6 @@ class SKABaseDevice(Device):
dtype='int16', default_value=4
)
MetricList = device_property(
dtype=('str',), default_value=["healthState", "adminMode", "controlMode"]
)
GroupDefinitions = device_property(
dtype=('str',),
)
......@@ -412,42 +410,6 @@ class SKABaseDevice(Device):
# Commands
# --------
@command(
dtype_out='str',
)
@DebugIt()
# def GetMetrics(self):
# # PROTECTED REGION ID(SKABaseDevice.GetMetrics) ENABLED START #
# ### TBD - read the value of each of the attributes in the MetricList
# with exception_manager(self):
# args_dict = {'with_value': True, 'with_commands': False,
# 'with_metrics': True, 'with_attributes': False}
# device_dict = self._get_device_json(args_dict)
# argout = json.dumps(device_dict)
# return argout
# # PROTECTED REGION END # // SKABaseDevice.GetMetrics
@command(
dtype_in='str',
doc_in="Requests the JSON string representing this device, can be filtered \nby with_commands, with_metrics, with_attributes and \nwith_value. Defaults for empty string argin are:\n{`with_value`:false, `with_commands`:true,\n `with_metrics`:true, `with_attributes`:false}",
dtype_out='str',
doc_out="The JSON string representing this device, \nfiltered as per the input argument flags",
)
@DebugIt()
# def ToJson(self, argin):
# # PROTECTED REGION ID(SKABaseDevice.ToJson) ENABLED START #
# TBD - see how to use fandango's export_device_to_dict
# with exception_manager(self):
# defaults = {'with_value': False, 'with_commands': True,
# 'with_metrics': True, 'with_attributes': False}
# args_dict = self._parse_argin(argin, defaults=defaults)
# device_dict = self._get_device_json(args_dict)
# argout = json.dumps(device_dict)
# return argout
# # PROTECTED REGION END # // SKABaseDevice.ToJson
@command(
dtype_out=('str',),
doc_out="[ name: EltTelState ]",
......
......@@ -5,6 +5,8 @@
#
#
#
# Distributed under the terms of the none license.
# See LICENSE.txt for more info.
#########################################################################################
"""Contain the tests for the SKABASE."""
......@@ -34,7 +36,6 @@ class TestSKABaseDevice(object):
properties = {
'SkaLevel': '4',
'MetricList': 'healthState',
'GroupDefinitions': '',
'CentralLoggingTarget': '',
'ElementLoggingTarget': '',
......@@ -71,22 +72,6 @@ class TestSKABaseDevice(object):
assert tango_context.device.Status() == "The device is in UNKNOWN state."
# PROTECTED REGION END # // SKABaseDevice.test_Status
# PROTECTED REGION ID(SKABaseDevice.test_GetMetrics_decorators) ENABLED START #
# PROTECTED REGION END # // SKABaseDevice.test_GetMetrics_decorators
# def test_GetMetrics(self, tango_context):
# """Test for GetMetrics"""
# # PROTECTED REGION ID(SKABaseDevice.test_GetMetrics) ENABLED START #
# assert tango_context.device.GetMetrics() == ""
# # PROTECTED REGION END # // SKABaseDevice.test_GetMetrics
# PROTECTED REGION ID(SKABaseDevice.test_ToJson_decorators) ENABLED START #
# PROTECTED REGION END # // SKABaseDevice.test_ToJson_decorators
# def test_ToJson(self, tango_context):
# """Test for ToJson"""
# # PROTECTED REGION ID(SKABaseDevice.test_ToJson) ENABLED START #
# assert tango_context.device.ToJson("") == ""
# # PROTECTED REGION END # // SKABaseDevice.test_ToJson
# PROTECTED REGION ID(SKABaseDevice.test_GetVersionInfo_decorators) ENABLED START #
# PROTECTED REGION END # // SKABaseDevice.test_GetVersionInfo_decorators
def test_GetVersionInfo(self, tango_context):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment