本文整理汇总了Python中ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient.find_deployment_id_of_instrument_site_using_has_deployment方法的典型用法代码示例。如果您正苦于以下问题:Python EnhancedResourceRegistryClient.find_deployment_id_of_instrument_site_using_has_deployment方法的具体用法?Python EnhancedResourceRegistryClient.find_deployment_id_of_instrument_site_using_has_deployment怎么用?Python EnhancedResourceRegistryClient.find_deployment_id_of_instrument_site_using_has_deployment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient
的用法示例。
在下文中一共展示了EnhancedResourceRegistryClient.find_deployment_id_of_instrument_site_using_has_deployment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDeployment
# 需要导入模块: from ion.util.enhanced_resource_registry_client import EnhancedResourceRegistryClient [as 别名]
# 或者: from ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient import find_deployment_id_of_instrument_site_using_has_deployment [as 别名]
#.........这里部分代码省略.........
for p in range(3):
m = platform_model_at(p)
self.RR2.assign_platform_model_to_platform_site_with_has_model(platform_model_id[m], platform_site_id[p])
self.RR2.assign_platform_model_to_platform_device_with_has_model(platform_model_id[m], platform_device_id[p])
self.RR2.assign_platform_device_to_platform_device_with_has_device(platform_device_id[p], platform_device_id[3])
self.RR2.assign_platform_site_to_platform_site_with_has_site(platform_site_id[p], platform_site_id[3])
for i in range(3):
m = instrument_model_at(p, i)
idx = instrument_at(p, i)
self.RR2.assign_instrument_model_to_instrument_site_with_has_model(instrument_model_id[m], instrument_site_id[idx])
self.RR2.assign_instrument_model_to_instrument_device_with_has_model(instrument_model_id[m], instrument_device_id[idx])
self.RR2.assign_instrument_device_to_platform_device_with_has_device(instrument_device_id[idx], platform_device_id[p])
self.RR2.assign_instrument_site_to_platform_site_with_has_site(instrument_site_id[idx], platform_site_id[p])
# top level models
self.RR2.assign_platform_model_to_platform_device_with_has_model(platform_model_id[2], platform_device_id[3])
self.RR2.assign_platform_model_to_platform_site_with_has_model(platform_model_id[2], platform_site_id[3])
# verify structure
for p in range(3):
parent_id = self.RR2.find_platform_device_id_by_platform_device_using_has_device(platform_device_id[p])
self.assertEqual(platform_device_id[3], parent_id)
parent_id = self.RR2.find_platform_site_id_by_platform_site_using_has_site(platform_site_id[p])
self.assertEqual(platform_site_id[3], parent_id)
for i in range(len(platform_site_id)):
self.assertEqual(self.RR2.find_platform_model_of_platform_device_using_has_model(platform_device_id[i]),
self.RR2.find_platform_model_of_platform_site_using_has_model(platform_site_id[i]))
for i in range(len(instrument_site_id)):
self.assertEqual(self.RR2.find_instrument_model_of_instrument_device_using_has_model(instrument_device_id[i]),
self.RR2.find_instrument_model_of_instrument_site_using_has_model(instrument_site_id[i]))
port_assignments = {}
for p in range(3):
port_assignments[platform_device_id[p]] = "platport_%d" % (p+1)
for i in range(3):
idx = instrument_at(p, i)
port_assignments[instrument_device_id[idx]] = "instport_%d" % (idx+1)
deployment_id = self.RR2.create(any_old(RT.Deployment,
{"context": deployment_context,
"port_assignments": port_assignments}))
# set up the deployment
# top level stuff always goes into the deployment
self.RR2.assign_deployment_to_platform_device_with_has_deployment(deployment_id, platform_device_id[3])
self.RR2.assign_deployment_to_platform_site_with_has_deployment(deployment_id, platform_site_id[3])
if OT.CabledInstrumentDeploymentContext == deployment_context_type:
self.omsclient.activate_deployment(deployment_id)
self.omsclient.deactivate_deployment(deployment_id)
if OT.RemotePlatformDeploymentContext != deployment_context_type:
for p in range(3):
m = platform_model_at(p)
self.RR2.assign_deployment_to_platform_device_with_has_deployment(deployment_id, platform_device_id[p])
self.RR2.assign_deployment_to_platform_site_with_has_deployment(deployment_id, platform_site_id[p])
for i in range(3):
m = instrument_model_at(p, i)
idx = instrument_at(p, i)
self.RR2.assign_deployment_to_instrument_device_with_has_deployment(deployment_id, instrument_device_id[idx])
self.RR2.assign_deployment_to_instrument_site_with_has_deployment(deployment_id, instrument_site_id[idx])
#verify the deployment
if OT.RemotePlatformDeploymentContext != deployment_context_type:
for p in platform_device_id:
self.assertEqual(deployment_id, self.RR2.find_deployment_id_of_platform_device_using_has_deployment(p))
for p in platform_site_id:
self.assertEqual(deployment_id, self.RR2.find_deployment_id_of_platform_site_using_has_deployment(p))
for i in instrument_device_id:
self.assertEqual(deployment_id, self.RR2.find_deployment_id_of_instrument_device_using_has_deployment(i))
for i in instrument_site_id:
self.assertEqual(deployment_id, self.RR2.find_deployment_id_of_instrument_site_using_has_deployment(i))
if OT.CabledInstrumentDeploymentContext == deployment_context_type:
self.assertRaises(BadRequest, self.omsclient.activate_deployment, deployment_id)
else:
self.omsclient.activate_deployment(deployment_id)
# verify proper associations
for i, d in enumerate(platform_device_id):
self.assertEqual(d, self.RR2.find_platform_device_id_of_platform_site_using_has_device(platform_site_id[i]))
for i, d in enumerate(instrument_device_id):
self.assertEqual(d, self.RR2.find_instrument_device_id_of_instrument_site_using_has_device(instrument_site_id[i]))
extended_deployment = self.omsclient.get_deployment_extension(deployment_id)
log.debug('base_3x3_matchups extended_deployment: %s', extended_deployment)
self.assertTrue(len(extended_deployment.platform_sites) == len(extended_deployment.platform_devices))
self.assertTrue(len(extended_deployment.instrument_sites) == len(extended_deployment.instrument_devices))
self.assertTrue(len(extended_deployment.instrument_devices) == len(extended_deployment.instrument_models))
self.assertTrue(len(extended_deployment.platform_devices) == len(extended_deployment.platform_models))
示例2: TestAssembly
# 需要导入模块: from ion.util.enhanced_resource_registry_client import EnhancedResourceRegistryClient [as 别名]
# 或者: from ion.util.enhanced_resource_registry_client.EnhancedResourceRegistryClient import find_deployment_id_of_instrument_site_using_has_deployment [as 别名]
#.........这里部分代码省略.........
#------------------------------------------------------------------------------------------------
pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict', id_only=True)
ctd_stream_def_id = self.client.PSMS.create_stream_definition(name='Simulated CTD data', parameter_dictionary_id=pdict_id)
log.debug("Created stream def id %s", ctd_stream_def_id)
#create data products for instrument data
dp_obj = self.create_data_product_obj()
#log.debug("Created an IonObject for a data product: %s", dp_obj)
#------------------------------------------------------------------------------------------------
# Create a set of ParameterContext objects to define the parameters in the coverage, add each to the ParameterDictionary
#------------------------------------------------------------------------------------------------
dp_obj.name = 'Data Product'
inst_data_product_id = c.DPMS.create_data_product(dp_obj, ctd_stream_def_id)
#assign data products appropriately
c.DAMS.assign_data_product(input_resource_id=instrument_device_id,
data_product_id=inst_data_product_id)
deployment_obj = any_old(RT.Deployment, {"context": IonObject(OT.CabledNodeDeploymentContext)})
deployment_id = self.perform_fcruf_script(RT.Deployment, "deployment", c.OMS, actual_obj=deployment_obj,
extra_fn=add_to_org_fn)
c.OMS.deploy_platform_site(platform_site_id, deployment_id)
self.RR2.find_deployment_id_of_platform_site_using_has_deployment(platform_site_id)
c.IMS.deploy_platform_device(platform_device_id, deployment_id)
self.RR2.find_deployment_of_platform_device_using_has_deployment(platform_device_id)
c.OMS.deploy_instrument_site(instrument_site_id, deployment_id)
self.RR2.find_deployment_id_of_instrument_site_using_has_deployment(instrument_site_id)
c.IMS.deploy_instrument_device(instrument_device_id, deployment_id)
self.RR2.find_deployment_id_of_instrument_device_using_has_deployment(instrument_device_id)
c.OMS.activate_deployment(deployment_id, True)
self.assertLess(0, len(self.RR2.find_instrument_sites_by_instrument_device_using_has_device(instrument_device_id)))
self.assertLess(0, len(self.RR2.find_instrument_devices_of_instrument_site_using_has_device(instrument_site_id)))
self.assertLess(0, len(self.RR2.find_platform_sites_by_platform_device_using_has_device(platform_device_id)))
self.assertLess(0, len(self.RR2.find_platform_devices_of_platform_site_using_has_device(platform_site_id)))
self.assert_lcs_pass(self.client.IMS, "platform_device", platform_device_id, LCE.DEPLOY, LCS.DEPLOYED)
self.assert_lcs_pass(self.client.IMS, "instrument_device", instrument_device_id, LCE.DEPLOY, LCS.DEPLOYED)
idev_lcs = self.client.RR.read(instrument_device_id).lcstate
log.info("L4-CI-SA-RQ-334 DEPLOY: Proposed change - Instrument activation shall support transition to " +
"the active state for instruments - state is %s" % idev_lcs)
#now along comes a new device
log.info("Create instrument device 2")
instrument_device_id2 = self.perform_fcruf_script(RT.InstrumentDevice,
"instrument_device",
self.client.IMS,
actual_obj=None,
extra_fn=add_to_org_fn)
log.info("Associate instrument model with instrument device 2")
self.perform_association_script(c.IMS.assign_instrument_model_to_instrument_device,
c.IMS.find_instrument_device_by_instrument_model,
c.IMS.find_instrument_model_by_instrument_device,