Beispiel #1
0
def get_tango_server_class(device_name):
    """Build and return the Tango device class for DishMaster

    :param device_name: str
        The Tango device name
    :return DishMaster: tango.server.Device
        The Tango device class for dishmaster
    """
    data_descr_files = []
    data_descr_files.append(
        pkg_resources.resource_filename("dishmaster", "dish_master.fgo"))
    data_descr_files.append(
        pkg_resources.resource_filename("dishmaster",
                                        "dish_master_SimDD.json"))

    # add a filter with this device's name
    device_name_tag = f"tango-device:{device_name}"

    class TangoDeviceTagsFilter(logging.Filter):
        def filter(self, record):
            record.tags = device_name_tag
            return True

    # set up Python logging
    configure_logging(tags_filter=TangoDeviceTagsFilter)
    logger_name = f"dish-master-{device_name}"
    logger = logging.getLogger(logger_name)
    logger.info("Logging started for %s.", device_name)
    configure_args = {"logger": logger}
    # test/nodb/dishmaster is used for testing
    if device_name == "test/nodb/dishmaster":
        configure_args["test_device_name"] = device_name
    model = configure_device_model(data_descr_files, **configure_args)
    DishMaster, _ = get_tango_device_server(model, data_descr_files)
    return DishMaster
 def setUp(self):
     super(test_TangoSimGenDeviceIntegration, self).setUp()
     self.xmi_parser = sim_xmi_parser.XmiParser()
     self.xmi_parser.parse(self.data_descr_file[0])
     self.expected_model = tango_sim_generator.configure_device_model(
         self.data_descr_file, self.sim_device.name())
     self.attr_name_enum_labels = sorted(
         self.sim_control_device.attribute_query(
             'attribute_name').enum_labels)
Beispiel #3
0
 def setUpClassWithCleanup(cls):
     cls.data_descr_files = []
     cls.data_descr_files.append(
         pkg_resources.resource_filename('tango_simlib.tests',
                                         'DishElementMaster.xmi'))
     cls.data_descr_files.append(
         pkg_resources.resource_filename('tango_simlib.tests',
                                         'DishElementMaster_SIMDD.json'))
     cls.device_name = 'test/nodb/tangodeviceserver'
     cls.model = tango_sim_generator.configure_device_model(
         cls.data_descr_files, cls.device_name)
Beispiel #4
0
 def setUpClassWithCleanup(cls):
     cls.tango_db = cleanup_tempfile(cls, prefix='tango', suffix='.db')
     cls.xmi_file = [pkg_resources.resource_filename(
                         'tango_simlib.tests', 'devenum_test_case.xmi')]
     cls.device_name = 'test/nodb/tangodeviceserver'
     model = tango_sim_generator.configure_device_model(cls.xmi_file,
                                                        cls.device_name)
     cls.TangoDeviceServer = tango_sim_generator.get_tango_device_server(
         model, cls.xmi_file)[0]
     cls.tango_context = TangoTestContext(cls.TangoDeviceServer,
                                          device_name=cls.device_name,
                                          db=cls.tango_db)
     start_thread_with_cleanup(cls, cls.tango_context)
def get_dishmaster_server_class(DISH_DEVICE_NAME):
    """Build and return the Tango device class for DishMaster

    :param DISH_DEVICE_NAME: string
        The Tango device name
    :return DishMaster: tango.server.Device
        The Tango device class for dishmaster
    """
    data_descr_files = []
    data_descr_files.append(FGO_FILE_PATH)
    data_descr_files.append(JSON_FILE_PATH)
    configure_args = {}
    configure_args["test_device_name"] = DISH_DEVICE_NAME
    model = configure_device_model(data_descr_files, **configure_args)
    DishMaster, _ = get_tango_device_server(model, data_descr_files)
    return DishMaster
Beispiel #6
0
 def setUpClassWithCleanup(cls):
     cls.tango_db = cleanup_tempfile(cls, prefix='tango', suffix='.db')
     cls.data_descr_files = []
     cls.data_descr_files.append(
         pkg_resources.resource_filename('tango_simlib.tests',
                                         'DishElementMaster.xmi'))
     cls.data_descr_files.append(
         pkg_resources.resource_filename('tango_simlib.tests',
                                         'DishElementMaster_SIMDD.json'))
     cls.device_name = 'test/nodb/tangodeviceserver'
     model = tango_sim_generator.configure_device_model(
         cls.data_descr_files, cls.device_name)
     cls.TangoDeviceServer = tango_sim_generator.get_tango_device_server(
         model, cls.data_descr_files)[0]
     cls.tango_context = TangoTestContext(cls.TangoDeviceServer,
                                          device_name=cls.device_name,
                                          db=cls.tango_db)
     start_thread_with_cleanup(cls, cls.tango_context)
Beispiel #7
0
def main():
    sim_data_files = ['../tests/MkatVds.xmi', '../tests/MkatVds_SIMDD.json']
    model = configure_device_model(sim_data_files)
    TangoDeviceServers = get_tango_device_server(model, sim_data_files)
    server_run(TangoDeviceServers)
Beispiel #8
0
def main():
    sim_data_files = ['../tests/Weather.xmi']
    model = configure_device_model(sim_data_files)
    TangoDeviceServers = get_tango_device_server(model, sim_data_files)
    server_run(TangoDeviceServers)