Skip to content
Snippets Groups Projects
Commit 2511c892 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-1030: replace tangodb_properties entries with station_configuration

parent 91383d07
No related branches found
No related tags found
1 merge request!468Resolve L2SS-1030 "Create configuration device"
...@@ -37,19 +37,19 @@ class Configuration(lofar_device): ...@@ -37,19 +37,19 @@ class Configuration(lofar_device):
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
tangodb_properties_RW = attribute(dtype=str, access=AttrWriteType.READ_WRITE, doc='The whole station configuration, as a JSON string.') station_configuration_RW = attribute(dtype=str, access=AttrWriteType.READ_WRITE, doc='The Tango properties of all the devices in this station, as a JSON string.')
def read_tangodb_properties_RW(self): def read_station_configuration_RW(self):
return self._dump_configdb() return self._dump_configdb()
def write_tangodb_properties_RW(self, tangodb_properties): def write_station_configuration_RW(self, station_configuration):
""" Takes a JSON string which represents the station configuration """ Takes a JSON string which represents the station configuration
and loads the whole configuration from scratch. and loads the whole configuration from scratch.
N.B. it does not update, it loads a full new configuration. N.B. it does not update, it loads a full new configuration.
""" """
# TODO(Stefano): L2SS-1031 implement load configuration # TODO(Stefano): L2SS-1031 implement load configuration
self.proxy.tangodb_properties_RW = tangodb_properties self.proxy.station_configuration_RW = station_configuration
def _dump_configdb(self): def _dump_configdb(self):
""" Returns the TangoDB station configuration as a JSON string """ """ Returns the TangoDB station configuration as a JSON string """
......
...@@ -18,12 +18,12 @@ class TestDeviceConfiguration(AbstractTestBases.TestDeviceBase): ...@@ -18,12 +18,12 @@ class TestDeviceConfiguration(AbstractTestBases.TestDeviceBase):
def setUp(self): def setUp(self):
super().setUp("STAT/Configuration/1") super().setUp("STAT/Configuration/1")
def test_read_tangodb_properties(self): def test_read_station_configuration(self):
self.proxy.warm_boot() self.proxy.warm_boot()
self.assertEqual(DevState.ON, self.proxy.state()) self.assertEqual(DevState.ON, self.proxy.state())
""" Test whether the station control configuration is correctly retrieved as a JSON string """ """ Test whether the station control configuration is correctly retrieved as a JSON string """
tangodb_properties = self.proxy.tangodb_properties_RW station_configuration = self.proxy.station_configuration_RW
dbdata = json.loads(tangodb_properties) dbdata = json.loads(station_configuration)
self.assertTrue(type(dbdata), dict) self.assertTrue(type(dbdata), dict)
self.assertGreater(len(dbdata['servers']), 0) self.assertGreater(len(dbdata['servers']), 0)
# Verify if Configuration Device exists # Verify if Configuration Device exists
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment