本文整理汇总了Python中interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient.assign_platform_model_to_platform_agent方法的典型用法代码示例。如果您正苦于以下问题:Python InstrumentManagementServiceClient.assign_platform_model_to_platform_agent方法的具体用法?Python InstrumentManagementServiceClient.assign_platform_model_to_platform_agent怎么用?Python InstrumentManagementServiceClient.assign_platform_model_to_platform_agent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient
的用法示例。
在下文中一共展示了InstrumentManagementServiceClient.assign_platform_model_to_platform_agent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestOmsLaunch
# 需要导入模块: from interface.services.sa.iinstrument_management_service import InstrumentManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient import assign_platform_model_to_platform_agent [as 别名]
#.........这里部分代码省略.........
ports = self._prepare_platform_ports(platform_id)
device__obj = IonObject(RT.PlatformDevice,
name='%s_PlatformDevice' % platform_id,
description='%s_PlatformDevice platform device' % platform_id,
ports=ports,
platform_monitor_attributes = monitor_attributes)
device_id = self.imsclient.create_platform_device(device__obj)
self.imsclient.assign_platform_model_to_platform_device(self.platformModel_id, device_id)
self.rrclient.create_association(subject=site_id, predicate=PRED.hasDevice, object=device_id)
self.damsclient.register_instrument(instrument_id=device_id)
if parent_platform_objs:
# establish hasDevice association with the parent
self.rrclient.create_association(
subject=parent_platform_objs['device_id'],
predicate=PRED.hasDevice,
object=device_id)
agent__obj = IonObject(RT.PlatformAgent,
name='%s_PlatformAgent' % platform_id,
description='%s_PlatformAgent platform agent' % platform_id)
agent_id = self.imsclient.create_platform_agent(agent__obj)
if parent_platform_objs:
# add this platform_id to parent's children:
parent_platform_objs['children'].append(platform_id)
self.imsclient.assign_platform_model_to_platform_agent(self.platformModel_id, agent_id)
# agent_instance_obj = IonObject(RT.PlatformAgentInstance,
# name='%s_PlatformAgentInstance' % platform_id,
# description="%s_PlatformAgentInstance" % platform_id)
#
# agent_instance_id = self.imsclient.create_platform_agent_instance(
# agent_instance_obj, agent_id, device_id)
plat_objs = {
'platform_id': platform_id,
'site__obj': site__obj,
'site_id': site_id,
'device__obj': device__obj,
'device_id': device_id,
'agent__obj': agent__obj,
'agent_id': agent_id,
# 'agent_instance_obj': agent_instance_obj,
# 'agent_instance_id': agent_instance_id,
'children': []
}
log.info("plat_objs for platform_id %r = %s", platform_id, str(plat_objs))
self.agent_device_map[platform_id] = device__obj
stream_config = self._create_stream_config(plat_objs)
self.agent_streamconfig_map[platform_id] = stream_config
# self._start_data_subscriber(agent_instance_id, stream_config)
return plat_objs
def _prepare_platform_attributes(self, platform_id):
示例2: TestOmsLaunch
# 需要导入模块: from interface.services.sa.iinstrument_management_service import InstrumentManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iinstrument_management_service.InstrumentManagementServiceClient import assign_platform_model_to_platform_agent [as 别名]
#.........这里部分代码省略.........
description='%s_PlatformDevice platform device' % platform_id,
# ports=port_objs,
# platform_monitor_attributes = monitor_attribute_objs
)
device__dict = dict(ports=port_dicts,
platform_monitor_attributes=monitor_attribute_dicts)
self.device_id = self.imsclient.create_platform_device(device__obj)
self.imsclient.assign_platform_model_to_platform_device(self.platformModel_id, self.device_id)
self.rrclient.create_association(subject=site_id, predicate=PRED.hasDevice, object=self.device_id)
self.damsclient.register_instrument(instrument_id=self.device_id)
if parent_platform_objs:
# establish hasDevice association with the parent
self.rrclient.create_association(
subject=parent_platform_objs['device_id'],
predicate=PRED.hasDevice,
object=self.device_id)
agent__obj = IonObject(RT.PlatformAgent,
name='%s_PlatformAgent' % platform_id,
description='%s_PlatformAgent platform agent' % platform_id)
agent_id = self.imsclient.create_platform_agent(agent__obj)
if parent_platform_objs:
# add this platform_id to parent's children:
parent_platform_objs['children'].append(platform_id)
self.imsclient.assign_platform_model_to_platform_agent(self.platformModel_id, agent_id)
# agent_instance_obj = IonObject(RT.PlatformAgentInstance,
# name='%s_PlatformAgentInstance' % platform_id,
# description="%s_PlatformAgentInstance" % platform_id)
#
# agent_instance_id = self.imsclient.create_platform_agent_instance(
# agent_instance_obj, agent_id, device_id)
plat_objs = {
'platform_id': platform_id,
'site__obj': site__obj,
'site_id': site_id,
'device__obj': device__obj,
'device_id': self.device_id,
'agent__obj': agent__obj,
'agent_id': agent_id,
# 'agent_instance_obj': agent_instance_obj,
# 'agent_instance_id': agent_instance_id,
'children': []
}
log.info("plat_objs for platform_id %r = %s", platform_id, str(plat_objs))
stream_config = self._create_stream_config(plat_objs)
self.agent_streamconfig_map[platform_id] = stream_config
# self.agent_streamconfig_map[platform_id] = None
# self._start_data_subscriber(agent_instance_id, stream_config)
return plat_objs
def _prepare_platform_attributes(self, pnode, platform_id):
"""