From 15fadfe414139b4b0e17086fdf3f160c06ad914c Mon Sep 17 00:00:00 2001 From: Aditya Dange <adityadange.ska@gmail.com> Date: Tue, 11 Dec 2018 14:51:57 +0530 Subject: [PATCH] Removed unwanted methods (GetMetrics and ToJson) from SKAMaster class --- skabase/SKAMaster/SKAMaster.xmi | 18 ------------------ skabase/SKAMaster/SKAMaster/SKAMaster.py | 7 ++++--- skabase/SKAMaster/test/SKAMaster_test.py | 20 +++----------------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/skabase/SKAMaster/SKAMaster.xmi b/skabase/SKAMaster/SKAMaster.xmi index f14469c8..7d265f63 100644 --- a/skabase/SKAMaster/SKAMaster.xmi +++ b/skabase/SKAMaster/SKAMaster.xmi @@ -66,24 +66,6 @@ </argout> <status abstract="true" inherited="true" concrete="true"/> </commands> - <commands name="GetMetrics" description="Gets list of attributes marked as metrics, with their values, 
for device" execMethod="get_metrics" displayLevel="OPERATOR" polledPeriod="0"> - <argin description=""> - <type xsi:type="pogoDsl:VoidType"/> - </argin> - <argout description=""> - <type xsi:type="pogoDsl:StringType"/> - </argout> - <status abstract="false" inherited="true" concrete="true"/> - </commands> - <commands name="ToJson" description="Returns a JSON translation of this device.
Defaults for empty string argin gives commands and metris:
with_value:false, 
with_commands:true, 
with_metrics:true, 
with_attributes:false" execMethod="to_json" displayLevel="OPERATOR" polledPeriod="0"> - <argin description="Requests the JSON string representing this device, can be filtered 
by with_commands, with_metrics, with_attributes and 
with_value. Defaults for empty string argin are:
{`with_value`:`false`, `with_commands`:`true`,
 `with_metrics`:`true, `with_attributes`:`false}"> - <type xsi:type="pogoDsl:StringType"/> - </argin> - <argout description="The JSON string representing this device, 
filtered as per the input argument flags"> - <type xsi:type="pogoDsl:StringType"/> - </argout> - <status abstract="false" inherited="true" concrete="true"/> - </commands> <commands name="GetVersionInfo" description="Array of version strings of all entities modelled by this device. 
(One level down only)
Each string in the array lists the version info for one entity
managed by this device. 
The first entry is version info for this TANGO Device itself.
The entities may be TANGO devices, or hardware LRUs or 
anything else this devices manages/models.
The intention with this command is that it can provide more 
detailed information than can be captured in the versionId 
and buildState attributes, if necessary.
In the minimal case the GetVersionInfo will contain only the 
versionId and buildState attributes of the next lower level
entities." execMethod="get_version_info" displayLevel="OPERATOR" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> diff --git a/skabase/SKAMaster/SKAMaster/SKAMaster.py b/skabase/SKAMaster/SKAMaster/SKAMaster.py index dcbd292c..fae0ac2c 100644 --- a/skabase/SKAMaster/SKAMaster/SKAMaster.py +++ b/skabase/SKAMaster/SKAMaster/SKAMaster.py @@ -4,6 +4,8 @@ # # # +# Distributed under the terms of the none license. +# See LICENSE.txt for more info. """ SKAMaster @@ -118,7 +120,7 @@ class SKAMaster(SKABaseDevice): self._element_tel_state_device = "" self._element_database_device = "" - self._max_capabilities = {"cap1":10, "cap2":20} + self._max_capabilities = {} if self.MaxCapabilities: for max_capability in self.MaxCapabilities: capability_type, max_capability_instances = max_capability.split(":") @@ -167,7 +169,6 @@ class SKAMaster(SKABaseDevice): def read_availableCapabilities(self): # PROTECTED REGION ID(SKAMaster.availableCapabilities_read) ENABLED START # - print (self._available_capabilities) return convert_dict_to_list(self._available_capabilities) # PROTECTED REGION END # // SKAMaster.availableCapabilities_read @@ -179,7 +180,7 @@ class SKAMaster(SKABaseDevice): @command( dtype_in='DevVarLongStringArray', doc_in="[nrInstances][Capability types]", - dtype_out='bool', + dtype_out='bool', ) @DebugIt() def isCapabilityAchievable(self, argin): diff --git a/skabase/SKAMaster/test/SKAMaster_test.py b/skabase/SKAMaster/test/SKAMaster_test.py index e4adc439..c78a92e1 100644 --- a/skabase/SKAMaster/test/SKAMaster_test.py +++ b/skabase/SKAMaster/test/SKAMaster_test.py @@ -5,6 +5,8 @@ # # # +# Distributed under the terms of the none license. +# See LICENSE.txt for more info. ######################################################################################### """Contain the tests for the SKAMaster.""" @@ -41,7 +43,7 @@ class TestSKAMaster(object): 'GroupDefinitions': '', 'NrSubarrays': '16', 'CapabilityTypes': '', - 'MaxCapabilities': {"CORRELATOR":512, "PSS-BEAMS":4} + 'MaxCapabilities': '', } @classmethod @@ -74,22 +76,6 @@ class TestSKAMaster(object): assert tango_context.device.Status() == "The device is in UNKNOWN state." # PROTECTED REGION END # // SKAMaster.test_Status - # PROTECTED REGION ID(SKAMaster.test_GetMetrics_decorators) ENABLED START # - # PROTECTED REGION END # // SKAMaster.test_GetMetrics_decorators - # def test_GetMetrics(self, tango_context): - # """Test for GetMetrics""" - # # PROTECTED REGION ID(SKAMaster.test_GetMetrics) ENABLED START # - # #assert tango_context.device.GetMetrics() == "" - # # PROTECTED REGION END # // SKAMaster.test_GetMetrics - - # PROTECTED REGION ID(SKAMaster.test_ToJson_decorators) ENABLED START # - # PROTECTED REGION END # // SKAMaster.test_ToJson_decorators - # def test_ToJson(self, tango_context): - # """Test for ToJson""" - # # PROTECTED REGION ID(SKAMaster.test_ToJson) ENABLED START # - # assert tango_context.device.ToJson("") == "" - # # PROTECTED REGION END # // SKAMaster.test_ToJson - # PROTECTED REGION ID(SKAMaster.test_GetVersionInfo_decorators) ENABLED START # # PROTECTED REGION END # // SKAMaster.test_GetVersionInfo_decorators def test_GetVersionInfo(self, tango_context): -- GitLab