当前位置: 首页>>代码示例>>Python>>正文


Python ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument方法代码示例

本文整理汇总了Python中interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument方法的典型用法代码示例。如果您正苦于以下问题:Python ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument方法的具体用法?Python ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument怎么用?Python ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient的用法示例。


在下文中一共展示了ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestIMSDeployAsPrimaryDevice

# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import assign_instrument_model_to_logical_instrument [as 别名]

#.........这里部分代码省略.........
        #-------------------------------
        instModel_obj = IonObject(RT.InstrumentModel, name='SBE37IMModel', description="SBE37IMModel", model_label="SBE37IMModel" )
        try:
            instModel_id = self.imsclient.create_instrument_model(instModel_obj)
        except BadRequest as ex:
            self.fail("failed to create new InstrumentModel: %s" %ex)
        print 'test_deployAsPrimaryDevice: new InstrumentModel id = ', instModel_id


        #-------------------------------
        # Create InstrumentAgent
        #-------------------------------
        instAgent_obj = IonObject(RT.InstrumentAgent, name='agent007', description="SBE37IMAgent", driver_module="ion.services.mi.instrument_agent", driver_class="InstrumentAgent" )
        try:
            instAgent_id = self.imsclient.create_instrument_agent(instAgent_obj)
        except BadRequest as ex:
            self.fail("failed to create new InstrumentAgent: %s" %ex)
        print 'test_deployAsPrimaryDevice: new InstrumentAgent id = ', instAgent_id

        self.imsclient.assign_instrument_model_to_instrument_agent(instModel_id, instAgent_id)



        #-------------------------------
        # Create Logical Instrument
        #-------------------------------
        logicalInstrument_obj = IonObject(RT.LogicalInstrument, name='logicalInstrument1', description="SBE37IMLogicalInstrument" )
        try:
            logicalInstrument_id = self.observatoryclient.create_logical_instrument(logical_instrument=logicalInstrument_obj, parent_logical_platform_id='')
        except BadRequest as ex:
            self.fail("failed to create new LogicalInstrument: %s" %ex)
        print 'test_deployAsPrimaryDevice: new logicalInstrument id = ', logicalInstrument_id

        self.observatoryclient.assign_instrument_model_to_logical_instrument(instModel_id, logicalInstrument_id)


        #-------------------------------
        # Create Old InstrumentDevice
        #-------------------------------
        instDevice_obj = IonObject(RT.InstrumentDevice, name='SBE37IMDeviceYear1', description="SBE37IMDevice for the FIRST year of deployment", serial_number="12345" )
        try:
            oldInstDevice_id = self.imsclient.create_instrument_device(instrument_device=instDevice_obj)
            self.imsclient.assign_instrument_model_to_instrument_device(instModel_id, oldInstDevice_id)
        except BadRequest as ex:
            self.fail("failed to create new InstrumentDevice: %s" %ex)

        print 'test_deployAsPrimaryDevice: new Year 1 InstrumentDevice id = ', oldInstDevice_id

        # deploy this device to the logical slot
        self.imsclient.deploy_instrument_device_to_logical_instrument(oldInstDevice_id, logicalInstrument_id)

        self.rrclient.execute_lifecycle_transition(oldInstDevice_id, LCE.DEPLOY)
        self.rrclient.execute_lifecycle_transition(oldInstDevice_id, LCE.ENABLE)

        # set this device as the current primary device
        self.imsclient.deploy_as_primary_instrument_device_to_logical_instrument(oldInstDevice_id, logicalInstrument_id)

        #-------------------------------
        # Create InstrumentAgentInstance for OldInstrumentDevice to hold configuration information
        # cmd_port=5556, evt_port=5557, comms_method="ethernet", comms_device_address=CFG.device.sbe37.host, comms_device_port=CFG.device.sbe37.port,
        #-------------------------------
        instAgentInstance_obj = IonObject(RT.InstrumentAgentInstance, name='SBE37IMAgentInstanceYear1', description="SBE37IMAgentInstance Year 1", svr_addr="localhost",
                                          driver_module="ion.services.mi.drivers.sbe37_driver", driver_class="SBE37Driver",
                                          cmd_port=5556, evt_port=5557, comms_method="ethernet", comms_device_address="localhost", comms_device_port=4001,
                                          comms_server_address="localhost", comms_server_port=8888)
        oldInstAgentInstance_id = self.imsclient.create_instrument_agent_instance(instAgentInstance_obj, instAgent_id, oldInstDevice_id)
开发者ID:seman,项目名称:coi-services,代码行数:70,代码来源:test_deploy_as_primary_instrument.py


注:本文中的interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.assign_instrument_model_to_logical_instrument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。