本文整理汇总了Python中interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.get_site_extension方法的典型用法代码示例。如果您正苦于以下问题:Python ObservatoryManagementServiceClient.get_site_extension方法的具体用法?Python ObservatoryManagementServiceClient.get_site_extension怎么用?Python ObservatoryManagementServiceClient.get_site_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient
的用法示例。
在下文中一共展示了ObservatoryManagementServiceClient.get_site_extension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import get_site_extension [as 别名]
#.........这里部分代码省略.........
#todo: remove the dangling association
# remove the PlatformSite as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(platform_site_id, org_id)
# verify that PlatformSite is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.PlatformSite, id_only=True )
self.assertEqual(len(assocs), 0)
# remove the Site as a resource of this Observatory
self.OMS.unassign_resource_from_observatory_org(subsite_id, org_id)
# verify that Site is linked to Org
assocs,_ = self.RR.find_objects(org_id, PRED.hasResource, RT.Subsite, id_only=True )
self.assertEqual(len(assocs), 0)
self.RR.delete(org_id)
self.OMS.force_delete_observatory(observatory_id)
self.OMS.force_delete_subsite(subsite_id)
self.OMS.force_delete_platform_site(platform_site_id)
self.OMS.force_delete_instrument_site(instrument_site_id)
#@unittest.skip("in development...")
@attr('EXT')
def test_observatory_org_extended(self):
stuff = self._make_associations()
parsed_pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict',
id_only=True)
parsed_stream_def_id = self.pubsubcli.create_stream_definition(name='parsed',
parameter_dictionary_id=parsed_pdict_id)
tdom, sdom = time_series_domain()
sdom = sdom.dump()
tdom = tdom.dump()
dp_obj = IonObject(RT.DataProduct,
name='the parsed data',
description='ctd stream test',
temporal_domain = tdom,
spatial_domain = sdom)
data_product_id1 = self.dpclient.create_data_product(data_product=dp_obj,
stream_definition_id=parsed_stream_def_id)
self.damsclient.assign_data_product(input_resource_id=stuff.instrument_device_id,
data_product_id=data_product_id1)
#--------------------------------------------------------------------------------
# Get the extended Site (platformSite)
#--------------------------------------------------------------------------------
extended_site = self.OMS.get_site_extension(stuff.platform_site_id)
log.debug("extended_site: %s ", str(extended_site))
self.assertEqual(1, len(extended_site.platform_devices))
self.assertEqual(1, len(extended_site.platform_models))
self.assertEqual(stuff.platform_device_id, extended_site.platform_devices[0]._id)
self.assertEqual(stuff.platform_model_id, extended_site.platform_models[0]._id)
#--------------------------------------------------------------------------------
# Get the extended Org
#--------------------------------------------------------------------------------
#test the extended resource
extended_org = self.org_management_service.get_marine_facility_extension(stuff.org_id)
log.debug("test_observatory_org_extended: extended_org: %s ", str(extended_org))
#self.assertEqual(2, len(extended_org.instruments_deployed) )
#self.assertEqual(1, len(extended_org.platforms_not_deployed) )
self.assertEqual(2, extended_org.number_of_platforms)
self.assertEqual(2, len(extended_org.platform_models) )
self.assertEqual(2, extended_org.number_of_instruments)
self.assertEqual(2, len(extended_org.instrument_models) )
#test the extended resource of the ION org
ion_org_id = self.org_management_service.find_org()
extended_org = self.org_management_service.get_marine_facility_extension(ion_org_id._id)
log.debug("test_observatory_org_extended: extended_ION_org: %s ", str(extended_org))
self.assertEqual(0, len(extended_org.members))
self.assertEqual(0, extended_org.number_of_platforms)
#self.assertEqual(1, len(extended_org.sites))
#--------------------------------------------------------------------------------
# Get the extended Site
#--------------------------------------------------------------------------------
#create device state events to use for op /non-op filtering in extended
t = get_ion_ts()
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device_id, state=ResourceAgentState.STREAMING )
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device2_id, state=ResourceAgentState.INACTIVE )
extended_site = self.OMS.get_site_extension(stuff.instrument_site2_id)
log.debug("test_observatory_org_extended: extended_site: %s ", str(extended_site))
self.dpclient.delete_data_product(data_product_id1)
开发者ID:blazetopher,项目名称:coi-services,代码行数:104,代码来源:test_observatory_management_service_integration.py
示例2: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import get_site_extension [as 别名]
#.........这里部分代码省略.........
data_product_id1 = self.dpclient.create_data_product(data_product=dp_obj,
stream_definition_id=parsed_stream_def_id)
self.damsclient.assign_data_product(input_resource_id=stuff.instrument_device_id,
data_product_id=data_product_id1)
#Create a user to be used as regular member
member_actor_obj = IonObject(RT.ActorIdentity, name='org member actor')
member_actor_id,_ = self.RR.create(member_actor_obj)
assert(member_actor_id)
member_actor_header = get_actor_header(member_actor_id)
member_user_obj = IonObject(RT.UserInfo, name='org member user')
member_user_id,_ = self.RR.create(member_user_obj)
assert(member_user_id)
self.RR.create_association(subject=member_actor_id, predicate=PRED.hasInfo, object=member_user_id)
#Build the Service Agreement Proposal to enroll a user actor
sap = IonObject(OT.EnrollmentProposal,consumer=member_actor_id, provider=stuff.org_id )
sap_response = self.org_management_service.negotiate(sap, headers=member_actor_header )
#enroll the member without using negotiation
self.org_management_service.enroll_member(org_id=stuff.org_id, actor_id=member_actor_id)
#--------------------------------------------------------------------------------
# Get the extended Site (platformSite)
#--------------------------------------------------------------------------------
try:
extended_site = self.OMS.get_site_extension(stuff.platform_site_id)
except:
log.error('failed to get extended site', exc_info=True)
raise
log.debug("extended_site: %r ", extended_site)
self.assertEqual(1, len(extended_site.platform_devices))
self.assertEqual(1, len(extended_site.platform_models))
self.assertEqual(stuff.platform_device_id, extended_site.platform_devices[0]._id)
self.assertEqual(stuff.platform_model_id, extended_site.platform_models[0]._id)
log.debug("verify that PlatformDeviceb is linked to PlatformDevice with hasNetworkParent link")
associations = self.RR.find_associations(subject=stuff.platform_deviceb_id, predicate=PRED.hasNetworkParent, object=stuff.platform_device_id, id_only=True)
self.assertIsNotNone(associations, "PlatformDevice child not connected to PlatformDevice parent.")
#--------------------------------------------------------------------------------
# Get the extended Org
#--------------------------------------------------------------------------------
#test the extended resource
extended_org = self.OMS.get_marine_facility_extension(stuff.org_id)
log.debug("test_observatory_org_extended: extended_org: %s ", str(extended_org))
#self.assertEqual(2, len(extended_org.instruments_deployed) )
#self.assertEqual(1, len(extended_org.platforms_not_deployed) )
self.assertEqual(2, extended_org.number_of_platforms)
self.assertEqual(2, len(extended_org.platform_models) )
self.assertEqual(2, extended_org.number_of_instruments)
self.assertEqual(2, len(extended_org.instrument_models) )
self.assertEqual(1, len(extended_org.members))
self.assertNotEqual(extended_org.members[0]._id, member_actor_id)
self.assertEqual(extended_org.members[0]._id, member_user_id)
self.assertEqual(1, len(extended_org.open_requests))
self.assertTrue(len(extended_site.deployments)>0)
self.assertEqual(len(extended_site.deployments), len(extended_site.deployment_info))
#test the extended resource of the ION org
ion_org_id = self.org_management_service.find_org()
extended_org = self.OMS.get_marine_facility_extension(ion_org_id._id, user_id=12345)
log.debug("test_observatory_org_extended: extended_ION_org: %s ", str(extended_org))
self.assertEqual(1, len(extended_org.members))
self.assertEqual(0, extended_org.number_of_platforms)
#self.assertEqual(1, len(extended_org.sites))
#--------------------------------------------------------------------------------
# Get the extended Site
#--------------------------------------------------------------------------------
#create device state events to use for op /non-op filtering in extended
t = get_ion_ts()
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device_id, state=ResourceAgentState.STREAMING )
self.event_publisher.publish_event( ts_created= t, event_type = 'ResourceAgentStateEvent',
origin = stuff.instrument_device2_id, state=ResourceAgentState.INACTIVE )
extended_site = self.OMS.get_site_extension(stuff.instrument_site2_id)
log.debug("test_observatory_org_extended: extended_site: %s ", str(extended_site))
self.dpclient.delete_data_product(data_product_id1)
示例3: TestRollups
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import get_site_extension [as 别名]
#.........这里部分代码省略.........
self.assertEqual(self.pdv[5], self.RR2.find_platform_device_id_of_platform_device_using_has_device(self.pdv[4]))
self.assertIn(self.pdv[6], self.RR2.find_platform_device_ids_of_platform_device_using_has_device(self.pdv[5]))
self.assertIn(self.pdv[7], self.RR2.find_platform_device_ids_of_platform_device_using_has_device(self.pdv[5]))
self.assertEqual(self.idv[4], self.RR2.find_instrument_device_id_of_platform_device_using_has_device(self.pdv[7]))
self.assertEqual(DeviceStatusType.STATUS_OK,
self.my_get_agent_client(self.idv[4]).get_agent(["aggstatus"])["aggstatus"][AggregateStatusType.AGGREGATE_DATA])
self.assertEqual(DeviceStatusType.STATUS_WARNING,
self.my_get_agent_client(self.pdv[7]).get_agent(["aggstatus"])["aggstatus"][AggregateStatusType.AGGREGATE_DATA])
@unittest.skip("errors in outil prevent this from passing")
def test_complex_rollup_structure(self):
self.check_structure_assumptions()
o = DeviceStatusType.STATUS_OK
u = DeviceStatusType.STATUS_UNKNOWN
w = DeviceStatusType.STATUS_WARNING
c = DeviceStatusType.STATUS_CRITICAL
pst_stat = ["ignore", c, c, w, w, u, w, o, w]
pdv_stat = ["ignore", o, w, w, w, w, o, w, c, c, w, c]
ist_stat = ["ignore", c, o, w, u, o, u]
idv_stat = ["ignore", c, o, w, o, w, c]
for i, id in self.idv.iteritems():
label = "InstrumentDevice %s" % i
log.info("Checking rollup of %s", label)
self.assertProperRollup(label, self.IMS.get_instrument_device_extension(id), idv_stat[i])
for i, id in self.ist.iteritems():
label = "InstrumentSite %s" % i
log.info("Checking rollup of %s", label)
self.assertProperRollup(label, self.OMS.get_site_extension(id), ist_stat[i])
for i, id in self.pdv.iteritems():
label = "PlatformDevice %s" % i
log.info("Checking rollup of %s", label)
self.assertProperRollup(label, self.IMS.get_platform_device_extension(id), pdv_stat[i])
for i, id in self.pst.iteritems():
label = "PlatformSite %s" % i
log.info("Checking rollup of %s", label)
self.assertProperRollup(label, self.OMS.get_site_extension(id), pst_stat[i])
#TODO: check observatory and org rollups!
#TODO: REMOVE THIS TEST when test_complex_rollup_structure is fixed
#@unittest.skip("phasing out")
def test_complex_rollup_structure_partially(self):
o = DeviceStatusType.STATUS_OK
u = DeviceStatusType.STATUS_UNKNOWN
w = DeviceStatusType.STATUS_WARNING
c = DeviceStatusType.STATUS_CRITICAL
idv_stat = ["ignore", c, o, w, o, w, c]
ist_stat = ["ignore", c, o, w, u, o, u]
for i, id in self.idv.iteritems():
label = "InstrumentDevice %s" % i
log.info("Checking rollup of %s", label)
self.assertProperRollup(label, self.IMS.get_instrument_device_extension(id), idv_stat[i])