diff --git a/csp-lmc-common/HISTORY b/csp-lmc-common/HISTORY
index b7bd5ba43a5324ca6669573e6bfe40eb49c7cfdb..5d3e2752b39d01971c3030247d3e4c6e63cd5549 100644
--- a/csp-lmc-common/HISTORY
+++ b/csp-lmc-common/HISTORY
@@ -1,3 +1,8 @@
+0.7.0
+- Align CSP.LMC to be compliant with the SKA Base Classes API: add of
+ Assign/ReleaseResources commands.
+- Add transaction ID for the new commands
+
0.6.12
- support to ADR18/22
diff --git a/csp-lmc-common/csp_lmc_common/CspSubarray.py b/csp-lmc-common/csp_lmc_common/CspSubarray.py
index 3e0f3a8d3bd515f20e26db21fa90aabe86d8295d..ee878103231b1526ffeebbe220e65baa32b60aa8 100644
--- a/csp-lmc-common/csp_lmc_common/CspSubarray.py
+++ b/csp-lmc-common/csp_lmc_common/CspSubarray.py
@@ -375,9 +375,12 @@ class CspSubarray(SKASubarray):
class AssignResourcesCommand(SKASubarray.AssignResourcesCommand):
@transaction_id
- def do(self,argin):
- return super().do(argin)
- self.logger.warning("Assign Resource Command not yet implemented in CSP Subarray. This is an instance of the lmcbaseclasses")
+ def do(self, argin):
+ #TODO: Edit the logger
+ self.logger.info('Assign resource command ... ')
+ return (ResultCode.OK, "Assign Resources command completed OK")
+
+
class ConfigureCommand(SKASubarray.ConfigureCommand):
@@ -691,6 +694,15 @@ class CspSubarray(SKASubarray):
"ConfigureScan execution",
tango.ErrSeverity.ERR)
+ class ReleaseResourcesCommand(SKASubarray.ReleaseResourcesCommand):
+
+ @transaction_id
+ def do(self,argin):
+ #TODO: Log message
+ self.logger.info('Release Resource command...')
+ return (ResultCode.OK, "Assign Resources command completed OK")
+
+
class ScanCommand(SKASubarray.ScanCommand):
def do(self, argin):
target_device = self.target
diff --git a/csp-lmc-common/csp_lmc_common/release.py b/csp-lmc-common/csp_lmc_common/release.py
index 28b5231ec64614b1691fca6d5da92bc5f0eb5b5a..b93729c3f1b99ada8755f6c9825522449b04065d 100755
--- a/csp-lmc-common/csp_lmc_common/release.py
+++ b/csp-lmc-common/csp_lmc_common/release.py
@@ -10,7 +10,7 @@
"""Release information for Python Package"""
name = """csp-lmc-common"""
-version = "0.6.12"
+version = "0.7.0"
version_info = version.split(".")
description = """SKA CSP.LMC Common Software"""
author = "INAF-OAA"
diff --git a/csp-lmc-common/tests/unit/cspsubarray_unit_test.py b/csp-lmc-common/tests/unit/cspsubarray_unit_test.py
index e25e80eb2e9bc00b82563c919da85cf1a119385a..09460846e10f31ffe76383b471c01d0008c04c89 100644
--- a/csp-lmc-common/tests/unit/cspsubarray_unit_test.py
+++ b/csp-lmc-common/tests/unit/cspsubarray_unit_test.py
@@ -151,7 +151,7 @@ def test_cspsbarray_state_after_On_forwarded_to_subelement_subarray():
def test_cspsubarray_transaction_id_in_log(capsys):
"""
- Test that when transaction_id decorator is applied to the Configure
+ Test that when transaction_id decorator is applied to the Configure
and Assign Resources command, both transaction id are captured in log
"""
device_under_test = CspSubarray
@@ -178,27 +178,29 @@ def test_cspsubarray_transaction_id_in_log(capsys):
pss_subarray_device_proxy_mock.On.side_effect = return_ok
tango_context.device.On()
assert tango_context.device.State() == DevState.ON
- tango_context.device.AssignResources('{"example":"band"}')
+ tango_context.device.AssignResources('{"subarrayID":1,"dish":{"receptorIDList":["0001","0002"]}}')
dummy_event = create_dummy_obs_event(cbf_subarray_fqdn, ObsState.IDLE)
event_subscription_map[cbf_subarray_state_attr](dummy_event)
- assert tango_context.device.obsState == ObsState.IDLE
- tango_context.device.Configure('{"id":"sbi-400-scienceA"}')
- # a prober is needed since the duration of the Configure command is variable.
- prober_obs_state = Probe(tango_context.device, "obsState", ObsState.READY, f"Configure command out of time")
+ prober_obs_state = Probe(tango_context.device, "obsState", ObsState.EMPTY, f"AssignResources command out of time")
Poller(10, 0.1).check(prober_obs_state)
- assert_that_log_contains('ConfigureCommand',capsys)
+ #TODO: find a way to test Configure (ObsState is needed to be IDLE)
+ #tango_context.device.Configure('{"id":"sbi-400-scienceA"}')
+ # a prober is needed since the duration of the Configure command is variable.
+ #prober_obs_state = Probe(tango_context.device, "obsState", ObsState.IDLE, f"Configure command out of time")
+ #Poller(10, 0.1).check(prober_obs_state)
+ #assert_that_log_contains('ConfigureCommand',capsys)
assert_that_log_contains('AssignResourcesCommand', capsys)
-def assert_that_log_contains(name:str,capsys):
- patterns = [f'|Transaction.*(?<=Enter\[{name}\])',f'|Transaction.*(?<=Exit\[{name}\])']
- for pattern in patterns:
- found = False
- out, err = capsys.readouterr()
- if re.match(pattern,out):
- found = True
- break
- if not found:
- raise AssertionError(f'pattern ({pattern}) not found in expected log messages')
+def assert_that_log_contains(name:str,capsys):
+ patterns = [f'|Transaction.*(?<=Enter\[{name}\])',f'|Transaction.*(?<=Exit\[{name}\])']
+ for pattern in patterns:
+ found = False
+ out, err = capsys.readouterr()
+ if re.match(pattern,out):
+ found = True
+ break
+ if not found:
+ raise AssertionError(f'pattern ({pattern}) not found in expected log messages')
def return_ok():
"""
diff --git a/csp-lmc-mid/.release b/csp-lmc-mid/.release
index 8ad0f4b49581b0389b5d6e6d27782fd0beadc8a1..689fa9b5760d9975d1a39d5ee44b8008e1e63798 100644
--- a/csp-lmc-mid/.release
+++ b/csp-lmc-mid/.release
@@ -9,7 +9,7 @@
"""Release information for Python Package"""
name = """MID CSP.LMC"""
-version = "0.6.10"
+version = "0.7.0"
version_info = version.split(".")
description = """SKA MID CSP.LMC Classes"""
author = "E.G"
@@ -18,5 +18,5 @@ license = """BSD-3-Clause"""
url = """www.tango-controls.org"""
copyright = """"""
-release=0.6.10
-tag=mid-csp-lmc-0.6.10
+release=0.7.0
+tag=mid-csp-lmc-0.7.0
diff --git a/csp-lmc-mid/HISTORY b/csp-lmc-mid/HISTORY
index db304070b0d0c8a07f959638aa9750c1bd9c0e8b..9eccdf71ce27e491d1d98ded4f510e77784e64d4 100644
--- a/csp-lmc-mid/HISTORY
+++ b/csp-lmc-mid/HISTORY
@@ -1,3 +1,12 @@
+0.7.0
+- use csp-lmc-common 0.7.0
+- align Mid CSP.LMC to the SKA Base Classes API
+ implementing Assign/ReleaseResources commands.
+- added transaction ID for ReleaseResources command.
+- updated tests to handle the new commands.
+- updated helm chart to version 0.1.2 (mid-csp-lmc:1.0.0 docker image)
+- updated mid-csp-umbrella helm chart to rely on mid-csp version 0.1.2
+
0.6.10
- use csp-lmc-common 0.6.12
- support to ADR-18/22
diff --git a/csp-lmc-mid/charts/mid-csp-umbrella/Chart.yaml b/csp-lmc-mid/charts/mid-csp-umbrella/Chart.yaml
index 7ee78858c6797d2973c3c1c323c18bd43bcf7bd2..fe6a5dd535c862076c6f551c17e0efd2019cf1ec 100644
--- a/csp-lmc-mid/charts/mid-csp-umbrella/Chart.yaml
+++ b/csp-lmc-mid/charts/mid-csp-umbrella/Chart.yaml
@@ -15,5 +15,5 @@ dependencies:
version: 0.1.1
repository: https://nexus.engageska-portugal.pt/repository/helm-chart
- name: mid-csp
- version: 0.1.1
+ version: 0.1.2
repository: "file://../mid-csp"
diff --git a/csp-lmc-mid/charts/mid-csp/Chart.yaml b/csp-lmc-mid/charts/mid-csp/Chart.yaml
index 63f811907aa83cec2bb451bfc9b24cd4c65dfa37..6158b39c4410506e2929dc1fe8ebc7ca22fde876 100644
--- a/csp-lmc-mid/charts/mid-csp/Chart.yaml
+++ b/csp-lmc-mid/charts/mid-csp/Chart.yaml
@@ -1,8 +1,8 @@
apiVersion: v2
name: mid-csp
description: A Helm chart for deploying the Mid_CSP.LMC devices on Kubernetes
-version: 0.1.1
-appVersion: "0.6.10"
+version: 0.1.2
+appVersion: "0.7.0"
icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png
dependencies:
- name: tango-util
diff --git a/csp-lmc-mid/charts/mid-csp/values.yaml b/csp-lmc-mid/charts/mid-csp/values.yaml
index 2da0693ee20a8ecbb64a87aa20a6baa3b22672a3..d56b102adac140a012fc7781d0da3e7898ccb3d1 100644
--- a/csp-lmc-mid/charts/mid-csp/values.yaml
+++ b/csp-lmc-mid/charts/mid-csp/values.yaml
@@ -37,7 +37,7 @@ midcsplmc:
image:
registry: nexus.engageska-portugal.pt/ska-docker
image: mid-csp-lmc
- tag: 0.6.10
+ tag: 0.7.0
pullPolicy: IfNotPresent
resources:
diff --git a/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py b/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py
index d517ba4f62797c0dafe9dae439cd671f800e285a..6d7c0607d88ddafb47026acb6c898b648552fac8 100644
--- a/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py
+++ b/csp-lmc-mid/csp_lmc_mid/MidCspSubarrayBase.py
@@ -99,13 +99,49 @@ class MidCspSubarrayBase(CspSubarray):
return super().do()
#return (ResultCode.OK, "On command completed OK")
- class AddReceptorsCommand(SKASubarray.AssignResourcesCommand):
+ class AssignResourcesCommand(CspSubarray.AssignResourcesCommand):
+ #TODO: aggiungere logica riconoscimento sottoelementi
def do(self, argin):
+ """
+ Stateless hook for AssignResources() command functionality.
+ :param argin: The resources to be assigned.
+ :type argin: string (JSON formatted)
+ :return: A tuple containing a return code and a string
+ message indicating status. The message is for
+ information purpose only.
+ :rtype: (ResultCode, str)
+ :raise: ValueError exception.
+ """
+ super().do(argin)
+ try:
+ resources_dict = json.loads(argin)
+ subarray_id = resources_dict['subarrayID']
+ if subarray_id != self.target.SubID:
+ msg = f"Mismatch in subarrayID. Received: {subarray_id} {self.target.SubID}"
+ self.logger.error(msg)
+ #return (ResultCode.FAILED, msg)
+ receptor_list = list(map(int, resources_dict['dish']['receptorIDList']))
+ except (KeyError, json.JSONDecodeError) as error:
+ msg = f"Something wrong in Json input string: {error}"
+ raise ValueError(msg)
+ return self._add_receptors(receptor_list)
+
+ def _add_receptors(self, argin):
+ """
+ Issue the command AddReceptors to the Mid.CBF Subarray.
+
+ :param argin: The list of receptors ID to assign to the subarray
+ :type argin: list of integer
+ :return: A tuple containing a return code and a string
+ message indicating status. The message is for
+ information purpose only.
+ :rtype: (ResultCode, str)
+ """
device = self.target
# check if the CbfSubarray TANGO device is already running
# and the proxy registered
if not device._is_sc_subarray_running(device.CbfSubarray):
- return (ResultCode.FAILED, "AddReceptors command FAILED")
+ return (ResultCode.FAILED, "AssignResources command FAILED")
proxy = device._sc_subarray_proxies[device.CbfSubarray]
device._reconfiguring = False
if self.state_model._obs_state == ObsState.IDLE:
@@ -114,7 +150,7 @@ class MidCspSubarrayBase(CspSubarray):
try:
receptor_to_assign = self._validate_receptors_list(argin)
if not any(receptor_to_assign):
- return (ResultCode.OK, "AddReceptors end OK")
+ return (ResultCode.OK, "AssignResources end OK")
device._timeout_expired = False
device._failure_raised = False
proxy.command_inout_asynch("AddReceptors", receptor_to_assign, device._cmd_ended_cb)
@@ -126,13 +162,9 @@ class MidCspSubarrayBase(CspSubarray):
if device._cmd_execution_state['addreceptors'] != CmdExecState.FAILED:
device._cmd_execution_state['addreceptors'] = CmdExecState.RUNNING
device._command_thread['addreceptors'].start()
- return (ResultCode.STARTED, "AddReceptors Started")
+ return (ResultCode.STARTED, "AssignResourcess Started")
except tango.DevFailed as tango_err:
- #tango.Except.throw_exception("Command failed",
- # tango_err.args[0].desc,
- # "AddReceptors",
- # tango.ErrSeverity.ERR)
- return (ResultCode.FAILED, "Failure in AddReceptors")
+ return (ResultCode.FAILED, "Failure in AssignResources")
def _validate_receptors_list(self, argin):
"""
@@ -161,7 +193,7 @@ class MidCspSubarrayBase(CspSubarray):
available_receptors = device._receptors.unassigned_ids()
self.logger.info("available_receptors: {}".format(available_receptors))
if not any(available_receptors):
- log_msg = "No available receptor to add to subarray {}".format( device.SubID)
+ log_msg = "No available receptor to add to subarray {}".format(device.SubID)
self.logger.info(log_msg)
return []
# the list of available receptor IDs. This number is mantained by the CspMaster
@@ -203,14 +235,33 @@ class MidCspSubarrayBase(CspSubarray):
return receptor_to_assign
# PROTECTED REGION END # // MidCspSubarrayBase.AddReceptors
- #def succeeded(self):
- # self.logger.info("Eccomi")
- # action = "add_receptors_succeeded"
- # self.state_model.perform_action(action)
- # self.logger.info("ObsState:{}".format(self.state_model.obs_state))
+ class ReleaseResourcesCommand(CspSubarray.ReleaseResourcesCommand):
- class RemoveReceptorsCommand(SKASubarray.ReleaseResourcesCommand):
def do(self, argin):
+ """
+ Stateless hook for ReleaseResources() command functionality.
+ :param argin: The resources to be released.
+ :type argin: string (JSON formatted)
+ :return: A tuple containing a return code and a string
+ message indicating status. The message is for
+ information purpose only.
+ :rtype: (ResultCode, str)
+ """
+ super().do(argin)
+ try:
+ resources_dict = json.loads(argin)
+ subarray_id = resources_dict['subarrayID']
+ if subarray_id != int(self.target.SubID):
+ msg = f"Mismatch in subarrayID. Received: {subarray_id}"
+ self.logger.error(msg)
+ return (ResultCode.FAILED, msg)
+ receptor_list = list(map(int, resources_dict['dish']['receptorIDList']))
+ except (KeyError, json.JSONDecodeError, Exception) as error:
+ msg = f"Something wrong in Json input string: {error}"
+ return (ResultCode.FAILED, msg)
+ return self._remove_receptors(receptor_list)
+
+ def _remove_receptors(self, argin):
device = self.target
# check if the CspSubarray is already connected to the CbfSubarray
if not device._is_sc_subarray_running(device.CbfSubarray):
@@ -272,31 +323,28 @@ class MidCspSubarrayBase(CspSubarray):
device._cmd_execution_state['removereceptors'] = CmdExecState.IDLE
return (ResultCode.STARTED, "RemoveReceptor started")
except tango.DevFailed as tango_err:
- #tango.Except.throw_exception("Command failed",
- # tango_err.args[0].desc,
- # "RemoveReceptors",
- # tango.ErrSeverity.ERR)
message = str(tango_err.args[0].desc)
except AttributeError as attr_err:
- #log_msg = "RemoveReceptors:" + str(attr_err)
- #self.logger.error(log_msg)
- #tango.Except.throw_exception("Command failed",
- # str(attr_err),
- # "RemoveReceptors",
- # tango.ErrSeverity.ERR)
message = str(attr_err)
return (ResultCode.FAILED, message)
- class RemoveAllReceptorsCommand(SKASubarray.ReleaseAllResourcesCommand):
+ class ReleaseAllResourcesCommand(SKASubarray.ReleaseAllResourcesCommand):
def do(self):
- self.logger.info("RemoveAllReceptorsCommand")
+ return self.remove_all_receptors()
+
+ def remove_all_receptors(self):
+ self.logger.info("Going to remove all receptors")
device = self.target
try:
if len(device):
- #receptors = device._get_cbfsubarray_assigned_receptors()
receptors = device._receptors.assigned_to_subarray(device.SubID)
+ receptors = receptors.tolist()
self.logger.info("assigned receptors:{}".format(receptors))
- return device._removereceptors_cmd_obj.do(receptors[:])
+ release_dict = {}
+ release_dict["dish"] = {"receptorIDList": receptors[:]}
+ release_dict['subarrayID'] = int(device.SubID)
+ self.logger.info(release_dict)
+ return device._releaseresources_cmd_obj.do(json.dumps(release_dict))
return (ResultCode.OK, "No receptor to remove")
except tango.DevFailed as df:
log_msg = ("RemoveAllReceptors failure. Reason: {} "
@@ -415,9 +463,9 @@ class MidCspSubarrayBase(CspSubarray):
if CspSubarray.update_subarray_state(self):
if self.get_state() == DevState.ON:
if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.IDLE:
- self._addreceptors_cmd_obj.succeeded()
+ self._assignresources_cmd_obj.succeeded()
if self._sc_subarray_obs_state[self.CbfSubarray] == ObsState.EMPTY:
- self._removereceptors_cmd_obj.succeeded()
+ self._releaseeceptors_cmd_obj.succeeded()
self.logger.info("MidCsp subarray state: {} obsState: {}".format(self.get_state(), self.state_model._obs_state))
return True
@@ -503,10 +551,10 @@ class MidCspSubarrayBase(CspSubarray):
self.logger.info("CspSubarray failure flag:{}".format(self._failure_raised))
self.logger.info("CspSubarray timeout flag:{}".format(self._timeout_expired))
if self._timeout_expired or self._failure_raised:
- return self._addreceptors_cmd_obj.failed()
+ return self._assignresources_cmd_obj.failed()
# reset the command execution state
- self.logger.info("AddReceptors ends with success")
- return self._addreceptors_cmd_obj.succeeded()
+ self.logger.info("AssignResources ends with success")
+ return self._assignresources_cmd_obj.succeeded()
# PROTECTED REGION END # // MidCspSubarrayBase.private_methods
@@ -577,15 +625,17 @@ class MidCspSubarrayBase(CspSubarray):
self._sc_subarray_state[self.CbfSubarray]))
self.logger.warning(self._failure_message[device])
self._failure_raised = True
- return (ResultCode.FAILED, "RemoveReceptors ended with failure")
+ self.logger.error("ReleaseReceptors ended with failure")
+ return self._releaseresources_cmd_obj.failed()
if self._sc_subarray_cmd_exec_state[device][cmd_name] == CmdExecState.TIMEOUT:
self._timeout_expired = True
- return (ResultCode.FAILED, "RemoveReceptors ended with timeout")
+ self.logger.error("ReleaseReceptors ended with timeout")
+ return self._releaseresources_cmd_obj.failed()
# reset the command exeuction state
self._sc_subarray_cmd_exec_state[device][cmd_name] = CmdExecState.IDLE
self._cmd_execution_state[cmd_name] = CmdExecState.IDLE
self.logger.info("Receptors removed with success")
- return self._removereceptors_cmd_obj.succeeded()
+ return self._releaseresources_cmd_obj.succeeded()
#@command(
# dtype_in='DevString',
@@ -601,11 +651,12 @@ class MidCspSubarrayBase(CspSubarray):
"""
super().init_command_objects()
args = (self, self.state_model, self.logger)
- self._addreceptors_cmd_obj = self.AddReceptorsCommand(*args)
- self._removereceptors_cmd_obj = self.RemoveReceptorsCommand(*args)
- self.register_command_object("AddReceptors", self.AddReceptorsCommand(*args))
- self.register_command_object("RemoveReceptors", self.RemoveReceptorsCommand(*args))
- self.register_command_object("RemoveAllReceptors", self.RemoveAllReceptorsCommand(*args))
+
+ self._assignresources_cmd_obj = self.AssignResourcesCommand(*args)
+ self._releaseresources_cmd_obj = self.ReleaseResourcesCommand(*args)
+ self.register_command_object("AssignResources", self.AssignResourcesCommand(*args))
+ self.register_command_object("ReleaseResources", self.ReleaseResourcesCommand(*args))
+ self.register_command_object("ReleaseAllResources", self.ReleaseAllResourcesCommand(*args))
# PROTECTED REGION END # // MidCspSubarrayBase.private_methods
@@ -778,86 +829,6 @@ class MidCspSubarrayBase(CspSubarray):
return self._assigned_vcc
# PROTECTED REGION END # // MidCspSubarrayBase.assignedVcc_read
- # --------
- # Commands
- # --------
- @command(
- dtype_in='DevVarUShortArray',
- doc_in="List of the receptor IDs to add to the subarray.",
- dtype_out='DevVarLongStringArray',
- )
- @DebugIt()
- def AddReceptors(self, argin):
- # PROTECTED REGION ID(MidCspSubarrayBase.AddReceptors) ENABLED START #
- """
- *Class method*
-
- Add the specified receptor IDs to the subarray.
-
- The command can be executed only if the CspSubarray *ObsState* is *IDLE*.
-
- :param argin: the list of receptor IDs
- :type: array of DevUShort
- :return:
- None
- :raises:
- tango.DevFailed: if the CbfSubarray is not available or if an exception\
- is caught during command execution.
- """
- handler = self.get_command_object("AddReceptors")
- (result_code, message) = handler(argin)
- return [[result_code], [message]]
-
- @command(
- dtype_in='DevVarUShortArray',
- doc_in="The list with the receptor IDs to remove",
- dtype_out='DevVarLongStringArray',
- )
- @DebugIt()
- def RemoveReceptors(self, argin):
- # PROTECTED REGION ID(MidCspSubarrayBase.RemoveReceptors) ENABLED START #
- """
- Remove the receptor IDs from the subarray.
-
- :param argin: The list of the receptor IDs to remove from the subarray.
- Type: array of DevUShort
- :returns:
- None
- :raises:
- tango.DevFailed: raised if the subarray *obState* attribute is not IDLE, or \
- when an exception is caught during command execution.
- """
- # PROTECTED REGION ID(CspSubarray.RemoveReceptors) ENABLED START #
- self.logger.info("Call to RemoveReceptors")
- handler = self.get_command_object("RemoveReceptors")
- (result_code, message) = handler(argin)
- return [[result_code], [message]]
-
- # PROTECTED REGION END # // MidCspSubarrayBase.RemoveReceptors
- @command(
- dtype_out='DevVarLongStringArray',
- )
- @DebugIt()
- def RemoveAllReceptors(self):
- # PROTECTED REGION ID(MidCspSubarrayBase.RemoveAllReceptors) ENABLED START #
- """
- *Class method.*
-
- Remove all the assigned receptors from the subarray.
- Returns:
- None
- Raises:
- tango.DevFailed: raised if the subarray *obState* attribute is not IDLE or READY, or \
- when an exception is caught during command execution.
- """
- # PROTECTED REGION ID(CspSubarray.RemoveAllReceptors) ENABLED START #
-
- self.logger.info("Call to RemoveAllReceptors")
- handler = self.get_command_object("RemoveAllReceptors")
- (result_code, message) = handler()
- return [[result_code], [message]]
- # PROTECTED REGION END # // MidCspSubarrayBase.RemoveAllReceptors
-
# ----------
# Run server
# ----------
diff --git a/csp-lmc-mid/csp_lmc_mid/release.py b/csp-lmc-mid/csp_lmc_mid/release.py
index 1302a246d00235cb3a3b270210feeb9a2e789689..5c450ad3801c5f2a7c117ae6e39927e1c1ebe755 100755
--- a/csp-lmc-mid/csp_lmc_mid/release.py
+++ b/csp-lmc-mid/csp_lmc_mid/release.py
@@ -10,7 +10,7 @@
"""Release information for Python Package"""
name = """mid-csp-lmc"""
-version = "0.6.10"
+version = "0.7.0"
version_info = version.split(".")
description = """SKA MID CSP.LMC"""
author = "INAF-OAA"
diff --git a/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi b/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi
index 5f79f1fda1de61198c4688bf94c179b6e96a50b7..d1b084a5f060572d72430b5a942313fc93fc3e92 100644
--- a/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi
+++ b/csp-lmc-mid/pogo/MidCspSubarrayBase.xmi
@@ -268,15 +268,6 @@
-
-
-
-
-
-
-
-
-
@@ -286,15 +277,6 @@
-
-
-
-
-
-
-
-
-
diff --git a/csp-lmc-mid/tests/integration/MidCspSubarray_test.py b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py
index 8bd86601a0e0010107d401cd60500837a1db0a86..ce9a36fb214e968bca8dfaac06b23d131334831d 100755
--- a/csp-lmc-mid/tests/integration/MidCspSubarray_test.py
+++ b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py
@@ -18,6 +18,7 @@ import numpy as np
import logging
import unittest
import pytest
+import json
# Tango imports
import tango
@@ -115,7 +116,13 @@ class TestCspSubarray(TestBase):
obs_state = self.midcsp_subarray01.obsState
LOGGER.info("CSPSubarray state:{}-{}".format(state, obs_state))
LOGGER.info("Going to assign receptors")
- self.midcsp_subarray01.AddReceptors(receptor_list.tolist())
+
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': list(map(str, receptor_list.tolist()))}}
+ json_config = json.dumps(param)
+ self.midcsp_subarray01.AssignResources(json_config)
+
# wait for the transition to IDLE
prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE,
f"Wrong CSP Subarray obsState is not IDLE")
@@ -134,7 +141,7 @@ class TestCspSubarray(TestBase):
LOGGER.info("Receptor assigned to the subarray {}".format(receptors))
try:
LOGGER.info("invoke remove all receptors")
- self.midcsp_subarray01.RemoveAllReceptors()
+ self.midcsp_subarray01.ReleaseAllResources()
except Exception as e:
LOGGER.info(str(e))
# wait for the transition to EMPTY
@@ -212,7 +219,13 @@ class TestCspSubarray(TestBase):
invalid_receptor_to_assign.append(id_num)
if len(invalid_receptor_to_assign) > 3:
break
- self.midcsp_subarray01.AddReceptors(invalid_receptor_to_assign)
+
+ param = {
+ 'subarrayID': 1,
+ 'dish': { 'receptorIDList': list(map(str, invalid_receptor_to_assign))}}
+ json_config = json.dumps(param)
+ self.midcsp_subarray01.AssignResources(json_config)
+
prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray is not EMPTY")
Poller(4, 0.2).check(prober_obs_state)
receptors = self.midcsp_subarray01.assignedReceptors
@@ -241,7 +254,11 @@ class TestCspSubarray(TestBase):
# assert the array is not empty
assert receptor_list.any()
# Exercise the system: issue the AddREceptors command
- self.midcsp_subarray01.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': list(map(str, receptor_list))}}
+ json_config = json.dumps(param)
+ self.midcsp_subarray01.AssignResources(json_config)
# check the final subarray obstate
prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE,
f"Wrong CSP Subarray obsState")
@@ -263,7 +280,11 @@ class TestCspSubarray(TestBase):
LOGGER.info(f"receptors belonging to subarray:{assigned_receptors}")
# Exercise: try to re-assign one of the subarray receptors
LOGGER.info(f"Try to assign receptor:{assigned_receptors[0]}")
- self.midcsp_subarray01.AddReceptors([assigned_receptors[0],])
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': list(map(str, [assigned_receptors[0],]))}}
+ json_config = json.dumps(param)
+ self.midcsp_subarray01.AssignResources(json_config)
# check
prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE,
f"Wrong CSP Subarray obsState")
@@ -310,7 +331,11 @@ class TestCspSubarray(TestBase):
receptor_to_remove.append(i)
# Exercise the system: remove only one receptor (with a random ID)
LOGGER.info(f"Remove one receptor from CSP subarray01")
- self.midcsp_subarray01.RemoveReceptors(receptor_to_remove)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_to_remove}}
+ json_config = json.dumps(param)
+ self.midcsp_subarray01.ReleaseResources(json_config)
# check
prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE,
f"Wrong CSP Subarray obsState")
@@ -336,7 +361,7 @@ class TestCspSubarray(TestBase):
assigned_receptors = self.midcsp_subarray01.assignedReceptors
assert assigned_receptors.any()
LOGGER.info(f"Remove all receptors from CSP subarray01")
- self.midcsp_subarray01.RemoveAllReceptors()
+ self.midcsp_subarray01.ReleaseAllResources()
prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.EMPTY,
f"Wrong CSP Subarray obsState")
Poller(10, 0.2).check(prober_obs_state)
@@ -514,7 +539,7 @@ class TestCspSubarray(TestBase):
def test_send_abort_WHILE_in_configuring(self):
"""
Configure the CSP Subarray with a JSon string including
- the new ADR4 fields.
+ the new ADR22 fields.
"""
self._setup_subarray()
self._assign_receptors()
@@ -605,10 +630,10 @@ class TestCspSubarray(TestBase):
obs_state = midcsp_subarray01.obsState
assert obs_state == ObsState.READY
with pytest.raises(tango.DevFailed) as df:
- midcsp_subarray01.RemoveAllReceptors()
+ midcsp_subarray01.ReleaseAllReceptors()
if df:
err_msg = str(df.value.args[0].desc)
- assert "RemoveAllReceptors command can't be issued when the obsState is READY" in err_msg
+ assert "ReleaseAllReceptors command can't be issued when the obsState is READY" in err_msg
def test_remove_receptors_when_idle(self, midcsp_subarray01):
"""
@@ -622,7 +647,7 @@ class TestCspSubarray(TestBase):
time.sleep(3)
obs_state = midcsp_subarray01.obsState
assert obs_state == ObsState.IDLE
- midcsp_subarray01.RemoveAllReceptors()
+ midcsp_subarray01.ReleaseAllResources()
time.sleep(3)
subarray_state = midcsp_subarray01.state()
assert subarray_state == tango.DevState.OFF
diff --git a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py
index 1f0b9efb18a8ee071179fe43e8f7ed5e727c2033..2478b499d5be30cea589d17873865955df247384 100644
--- a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py
+++ b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py
@@ -6,6 +6,7 @@ import mock
import pytest
import tango
import time
+import json
from mock import Mock, MagicMock
from ska.base.control_model import HealthState, ObsState
@@ -189,10 +190,14 @@ def test_addreceptors_command_WHEN_subarray_is_in_wrong_state():
proxies_to_mock=proxies_to_mock) as tango_context:
with pytest.raises(tango.DevFailed) as df:
receptors_to_add = [1,2,3]
- tango_context.device.AddReceptors(receptors_to_add)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptors_to_add}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
if df:
err_msg = str(df.value.args[0].desc)
- assert "Error executing command AddReceptorsCommand" in err_msg
+ assert "Error executing command AssignResourcesCommand" in err_msg
def test_removereceptors_command_WHEN_subarray_is_in_wrong_state():
"""
@@ -219,24 +224,28 @@ def test_removereceptors_command_WHEN_subarray_is_in_wrong_state():
receptor_list = [1,2,3]
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.ConfigureCommand.do') as mock_configure_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ 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")
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
tango_context.device.Configure("")
obs_state = tango_context.device.obsState
assert obs_state == ObsState.READY
with pytest.raises(tango.DevFailed) as df:
- tango_context.device.RemoveAllReceptors()
+ tango_context.device.ReleaseAllResources()
if df:
err_msg = str(df.value.args[0].desc)
- assert "Error executing command RemoveAllReceptorsCommand" in err_msg
+ assert "Error executing command ReleaseAllResourcesCommand" in err_msg
def test_midcspsubarray_obsstate_WHEN_cbfsubarray_raises_an_exception():
"""
@@ -273,11 +282,15 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_raises_an_exception():
cbf_subarray_device_proxy_mock.On.side_effect = return_ok
pss_subarray_device_proxy_mock.On.side_effect = return_ok
tango_context.device.On()
- dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.EMPTY)
+ dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate', ObsState.EMPTY)
event_subscription_map[cbf_subarray_state_attr](dummy_event)
mock_assigned_to_subarray.return_value = []
mock_unassigned_ids.return_value = [1,2]
- tango_context.device.AddReceptors([1,2,11,17,21,23])
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': [1,2,11,17,21,23]}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
dummy_event = command_callback_with_event_error("AddReceptors", cbf_subarray_fqdn)
event_subscription_map["AddReceptors"](dummy_event)
prober_obs_state = Probe(tango_context.device, 'obsState', ObsState.FAULT, f"Wrong CspSubarray state")
@@ -323,7 +336,11 @@ def test_midcspsubarray_obsstate_AFTER_add_receptors_to_cbf_subarray():
mock_unassigned_ids.return_value = [1,2]
mock_assigned_to_subarray.return_value = [1,2]
mock_len.return_value = len([1,2])
- tango_context.device.AddReceptors([1,2])
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': ["1", "2"]}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.RESOURCING)
event_subscription_map[cbf_subarray_state_attr](dummy_event)
dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.IDLE)
@@ -360,16 +377,20 @@ def test_midcspsubarray_obsstate_AFTER_configure():
receptor_list = [1,2,3]
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
#assert tango_context.device.obsState == ObsState.IDLE
cbf_subarray_device_proxy_mock.configureDelay.return_value = 10
configuration_string = load_json_file("test_ConfigureScan_ADR22.json")
@@ -412,15 +433,19 @@ def test_midcspsubarray_invoke_configure_WHILE_gotoidle_is_running():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
cbf_subarray_device_proxy_mock.GoToIdle.side_effect = return_ok
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
mock_delay_expected.return_value = 2
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
@@ -459,14 +484,18 @@ def test_midcspsubarray_obsstate_AFTER_configure_WITH_wrong_json():
receptor_list = [1,2,3]
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_without_configID.json")
tango_context.device.Configure(configuration_string)
assert tango_context.device.obsState == ObsState.FAULT
@@ -500,16 +529,21 @@ def test_midcspsubarray_obsstate_AFTER_timeout_during_configuration():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
cbf_subarray_device_proxy_mock.Configure.side_effect = return_failed
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
+
#assert tango_context.device.obsState == ObsState.IDLE
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
@@ -547,16 +581,20 @@ def test_midcspsubarray_obsstate_AFTER_cbfsubarray_fault_during_configuration():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
#cbf_subarray_device_proxy_mock.Configure.side_effect = return_failed
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.FAULT)
@@ -595,16 +633,20 @@ def test_midcspsubarray_obsstate_AFTER_abort_request_during_configuration():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
cbf_subarray_device_proxy_mock.Abort.side_effect = return_ok
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
tango_context.device.Abort()
@@ -643,16 +685,20 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_is_in_fault_during_abort_reque
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
#cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.READY)
@@ -698,16 +744,20 @@ def test_midcspsubarray_obsstate_WHEN_abort_invoked_in_resetting():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
#cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_ADR4.json")
tango_context.device.Configure(configuration_string)
dummy_event = create_dummy_event(cbf_subarray_fqdn, 'obsstate',ObsState.FAULT)
@@ -749,16 +799,20 @@ def test_midcspsubarray_obsstate_WHEN_restart_invoked_after_cspsubarray_aborted(
receptor_list = [1,2,3]
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len:
mock_len.return_value = len(receptor_list)
- mock_do.return_value = (ResultCode.OK, "AddReceptors OK")
+ mock_do.return_value = (ResultCode.OK, "AssignResources OK")
mock_on_do.return_value = (ResultCode.OK, "On command OK")
mock_delay_expected.return_value = 2
tango_context.device.On()
- tango_context.device.AddReceptors(receptor_list)
+ param = {
+ 'subarrayID': 1,
+ 'dish': {'receptorIDList': receptor_list}}
+ json_config = json.dumps(param)
+ tango_context.device.AssignResources(json_config)
configuration_string = load_json_file("test_ConfigureScan_without_configID.json")
tango_context.device.Configure(configuration_string)
prober_obs_state = Probe(tango_context.device, 'obsState', ObsState.FAULT, f"Wrong CspSubarray state")
@@ -827,7 +881,7 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_abort_returns_failed():
with fake_tango_system(device_under_test, initial_dut_properties=dut_properties,
proxies_to_mock=proxies_to_mock) as tango_context:
cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed
- with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\
+ with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AssignResourcesCommand.do') as mock_do,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\
mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\
mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: