本文整理汇总了Python中interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.create_observatory方法的典型用法代码示例。如果您正苦于以下问题:Python ObservatoryManagementServiceClient.create_observatory方法的具体用法?Python ObservatoryManagementServiceClient.create_observatory怎么用?Python ObservatoryManagementServiceClient.create_observatory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient
的用法示例。
在下文中一共展示了ObservatoryManagementServiceClient.create_observatory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_observatory [as 别名]
#.........这里部分代码省略.........
self.RR.create_association(platform_device_id, PRED.hasModel, platform_model_id)
#instrument_device
self.RR.create_association(instrument_device_id, PRED.hasModel, instrument_model_id)
self.RR.create_association(instrument_device2_id, PRED.hasModel, instrument_model_id)
ret = DotDict()
ret.org_id = org_id
ret.observatory_id = observatory_id
ret.subsite_id = subsite_id
ret.subsite2_id = subsite2_id
ret.subsiteb_id = subsiteb_id
ret.subsitez_id = subsitez_id
ret.platform_site_id = platform_site_id
ret.platform_siteb_id = platform_siteb_id
ret.platform_siteb2_id = platform_siteb2_id
ret.platform_site3_id = platform_site3_id
ret.instrument_site_id = instrument_site_id
ret.instrument_site2_id = instrument_site2_id
ret.instrument_siteb3_id = instrument_siteb3_id
ret.instrument_site4_id = instrument_site4_id
ret.instrument_device_id = instrument_device_id
ret.instrument_device2_id = instrument_device2_id
ret.platform_device_id = platform_device_id
ret.platform_deviceb_id = platform_deviceb_id
ret.instrument_model_id = instrument_model_id
ret.platform_model_id = platform_model_id
ret.deployment_id = deployment_id
return ret
#@unittest.skip("targeting")
def test_create_observatory(self):
observatory_obj = IonObject(RT.Observatory,
name='TestFacility',
description='some new mf')
observatory_id = self.OMS.create_observatory(observatory_obj)
self.OMS.force_delete_observatory(observatory_id)
#@unittest.skip("targeting")
def _do_test_create_geospatial_point_center(self, resources):
platformsite_obj = IonObject(RT.PlatformSite,
name='TestPlatformSite',
description='some new TestPlatformSite')
geo_index_obj = IonObject(OT.GeospatialBounds)
geo_index_obj.geospatial_latitude_limit_north = 20.0
geo_index_obj.geospatial_latitude_limit_south = 10.0
geo_index_obj.geospatial_longitude_limit_east = 15.0
geo_index_obj.geospatial_longitude_limit_west = 20.0
platformsite_obj.constraint_list = [geo_index_obj]
platformsite_id = self.OMS.create_platform_site(platformsite_obj)
# now get the dp back to see if it was updated
platformsite_obj = self.OMS.read_platform_site(platformsite_id)
self.assertEquals('some new TestPlatformSite', platformsite_obj.description)
self.assertAlmostEqual(15.0, platformsite_obj.geospatial_point_center.lat, places=1)
#now adjust a few params
platformsite_obj.description = 'some old TestPlatformSite'
geo_index_obj = IonObject(OT.GeospatialBounds)
geo_index_obj.geospatial_latitude_limit_north = 30.0
geo_index_obj.geospatial_latitude_limit_south = 20.0
platformsite_obj.constraint_list = [geo_index_obj]
示例2: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_observatory [as 别名]
#.........这里部分代码省略.........
self.RR.create_association(platform_device_id, PRED.hasModel, platform_model_id)
#instrument_device
self.RR.create_association(instrument_device_id, PRED.hasModel, instrument_model_id)
self.RR.create_association(instrument_device2_id, PRED.hasModel, instrument_model_id)
ret = DotDict()
ret.org_id = org_id
ret.observatory_id = observatory_id
ret.subsite_id = subsite_id
ret.subsite2_id = subsite2_id
ret.subsiteb_id = subsiteb_id
ret.subsitez_id = subsitez_id
ret.platform_site_id = platform_site_id
ret.platform_siteb_id = platform_siteb_id
ret.platform_siteb2_id = platform_siteb2_id
ret.platform_site3_id = platform_site3_id
ret.instrument_site_id = instrument_site_id
ret.instrument_site2_id = instrument_site2_id
ret.instrument_siteb3_id = instrument_siteb3_id
ret.instrument_site4_id = instrument_site4_id
ret.instrument_device_id = instrument_device_id
ret.instrument_device2_id = instrument_device2_id
ret.platform_device_id = platform_device_id
ret.platform_deviceb_id = platform_deviceb_id
ret.instrument_model_id = instrument_model_id
ret.platform_model_id = platform_model_id
ret.deployment_id = deployment_id
return ret
#@unittest.skip("targeting")
def test_create_observatory(self):
observatory_obj = IonObject(RT.Observatory,
name='TestFacility',
description='some new mf')
observatory_id = self.OMS.create_observatory(observatory_obj)
self.OMS.force_delete_observatory(observatory_id)
#@unittest.skip("targeting")
def test_find_observatory_org(self):
org_obj = IonObject(RT.Org,
name='TestOrg',
description='some new mf org')
org_id = self.OMS.create_marine_facility(org_obj)
observatory_obj = IonObject(RT.Observatory,
name='TestObservatory',
description='some new obs')
observatory_id = self.OMS.create_observatory(observatory_obj)
#make association
self.OMS.assign_resource_to_observatory_org(observatory_id, org_id)
#find association
org_objs = self.OMS.find_org_by_observatory(observatory_id)
self.assertEqual(1, len(org_objs))
self.assertEqual(org_id, org_objs[0]._id)
print("org_id=<" + org_id + ">")
示例3: TestRegisterAndActivate
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_observatory [as 别名]
class TestRegisterAndActivate(IonIntegrationTestCase):
"""
Integration test cases to confirm registration and activation services
for marine device resources.
"""
def setUp(self):
"""
Test setup.
"""
# Resources used in the tests.
# General resources.
self.actor_id = None
self.user_info_id = None
self.org_id = None
self.obs_id = None
# Cabled infrastructure.
self.cabled_platform_model_id = None
self.cabled_platform_site_id = None
self.cabled_platform_device_id = None
self.cabled_platform_agent_id = None
self.cabled_platform_agent_instance_id = None
self.cabled_platform_deployment_id = None
self.cabled_instrument_deployment_id = None
self.cabled_instrument_model_id = None
self.cabled_instrument_site_id = None
self.cabled_instrument_device_id = None
self.cabled_instrument_agent_id = None
self.cabled_instrument_agent_instance_id = None
self.cabled_instrument_deployment_id = None
# Uncabled infrastructure.
self.uncabled_platform_model_id = None
self.uncabled_platform_site_id = None
self.uncabled_platform_device_id = None
self.uncabled_platform_agent_id = None
self.uncabled_platform_agent_instance_id = None
self.uncabled_instrument_model_id = None
self.uncabled_instrument_site_id = None
self.uncabled_instrument_device_id = None
self.uncabled_instrument_agent_id = None
self.uncabled_instrument_agent_instance_id = None
self.uncabled_site_deployment_id = None
# Start container.
log.info('Staring capability container.')
self._start_container()
# Bring up services in a deploy file (no need to message)
log.info('Staring deploy services.')
self.container.start_rel_from_url('res/deploy/r2deploy.yml')
# Setup service clients.
self.idms = IdentityManagementServiceClient(node=self.container.node)
self.oms = ObservatoryManagementServiceClient(node=self.container.node)
# Add generic resources.
self._load_system_actors()
self._create_user()
self._create_org()
self._create_observatory()
# Add cleanup routine.
self.addCleanup(self._cleanup_resources)
def _cleanup_resources(self):
"""
Delete resources created by the tests.
"""
# Check and clean up cabled resources.
if self.cabled_instrument_model_id:
self.oms.unassign_instrument_model_from_instrument_site(
self.cabled_instrument_model_id, self.cabled_instrument_site_id)
self.ims.delete_instrument_model(self.cabled_instrument_model_id)
self.cabled_instrument_model_id = None
if self.cabled_platform_model_id:
self.oms.unassign_platform_model_from_platform_site(
self.cabled_platform_model_id, self.cabled_platform_site_id)
self.ims.delete_platform_model(self.cabled_platform_model_id)
self.cabled_platform_model_id = None
if self.cabled_instrument_site_id:
self.oms.unassign_site_from_site(self.cabled_instrument_site_id,
self.cabled_platform_site_id)
self.oms.delete_instrument_site(self.cabled_instrument_site_id)
self.cabled_instrument_site_id = None
if self.cabled_platform_site_id:
self.oms.unassign_site_from_site(self.cabled_platform_site_id,
self.obs_id)
self.oms.delete_platform_site(self.cabled_platform_site_id)
self.cabled_platform_site_id = None
# Check and clean up unclabled resources.
# TODO
#.........这里部分代码省略.........
示例4: TestRollups
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_observatory [as 别名]
class TestRollups(IonIntegrationTestCase):
def setUp(self):
# Start container
#print 'instantiating container'
self._start_container()
#container = Container()
#print 'starting container'
#container.start()
#print 'started container'
self.container.start_rel_from_url('res/deploy/r2deploy.yml')
self.RR = ResourceRegistryServiceClient(node=self.container.node)
self.IMS = InstrumentManagementServiceClient(node=self.container.node)
self.OMS = ObservatoryManagementServiceClient(node=self.container.node)
self.RR2 = EnhancedResourceRegistryClient(self.RR)
self._setup_statuses()
def _make_status(self, bad_items_dict=None):
if bad_items_dict is None:
bad_items_dict = {}
ret = {}
for k in reverse_mapping.values():
if k in bad_items_dict:
ret[k] = bad_items_dict[k]
else:
ret[k] = DeviceStatusType.STATUS_OK
return ret
def _setup_statuses(self):
# set up according to https://docs.google.com/drawings/d/1kZ_L4xr4Be0OdqMDX6tiI50hROgvLHU4HcnD7e_NIKE/pub?w=1200z
# https://confluence.oceanobservatories.org/display/syseng/CIAD+SA+OV+Observatory+Status+and+Events
device_agents = {}
ms = self._make_status
# override the default "get agent" function and resource registyr
IMS_SVC = self._get_svc(InstrumentManagementService)
OMS_SVC = self._get_svc(ObservatoryManagementService)
self.IMS_ASB = self._get_specific_attr(IMS_SVC, AgentStatusBuilder)
self.OMS_ASB = self._get_specific_attr(OMS_SVC, AgentStatusBuilder)
assert self.IMS_ASB
assert self.OMS_ASB
self.IMS_ASB.RR2 = IMS_SVC.RR2
self.OMS_ASB.RR2 = OMS_SVC.RR2
# create org
org_id = self.OMS.create_marine_facility(any_old(RT.Org))
obs_id = self.OMS.create_observatory(any_old(RT.Observatory), org_id)
# create instrument and platform devices and sites
pst = dict([(i + 1, self.RR2.create(any_old(RT.PlatformSite))) for i in range(8)])
pdv = dict([(i + 1, self.RR2.create(any_old(RT.PlatformDevice))) for i in range(11)])
ist = dict([(i + 1, self.RR2.create(any_old(RT.InstrumentSite))) for i in range(6)])
idv = dict([(i + 1, self.RR2.create(any_old(RT.InstrumentDevice))) for i in range(6)])
# create associations
has_site = [
(obs_id, pst[2]),
(pst[2], pst[1]),
(pst[1], ist[1]),
(pst[2], pst[3]),
(pst[3], ist[2]),
(pst[3], ist[3]),
(obs_id, pst[4]),
(pst[4], pst[5]),
(pst[4], pst[6]),
(pst[6], pst[7]),
(pst[7], ist[4]),
(pst[6], pst[8]),
(pst[8], ist[5]),
(pst[8], ist[6]),
]
has_device = [
(pst[2], pdv[2]),
(pst[1], pdv[1]),
(ist[1], idv[1]),
(pst[3], pdv[3]),
(pdv[3], idv[2]),
(pdv[3], idv[3]),
(ist[2], idv[2]),
(ist[3], idv[3]),
(pst[4], pdv[4]),
(pdv[4], pdv[5]),
(pdv[5], pdv[6]),
(pdv[5], pdv[7]),
(pdv[7], idv[4]),
(pst[6], pdv[5]),
(pst[7], pdv[6]),
(pst[8], pdv[7]),
(ist[5], idv[4]),
(pdv[8], pdv[9]),
#.........这里部分代码省略.........
示例5: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_observatory [as 别名]
#.........这里部分代码省略.........
self.RR.create_association(platform_site_id, PRED.hasSite, instrument_site2_id)
self.RR.create_association(platform_site_id, PRED.hasSite, platform_siteb_id)
self.RR.create_association(platform_siteb_id, PRED.hasSite, instrument_site_id)
self.RR.create_association(platform_site_id, PRED.hasModel, platform_model_id)
self.RR.create_association(platform_site_id, PRED.hasDevice, platform_device_id)
self.RR.create_association(platform_site_id, PRED.hasDeployment, deployment_id)
#instrument_site
self.RR.create_association(instrument_site_id, PRED.hasModel, instrument_model_id)
self.RR.create_association(instrument_site_id, PRED.hasDevice, instrument_device_id)
self.RR.create_association(instrument_site_id, PRED.hasDeployment, deployment_id)
ret = DotDict()
ret.observatory_id = observatory_id
ret.subsite_id = subsite_id
ret.subsite2_id = subsite2_id
ret.subsiteb_id = subsiteb_id
ret.subsitez_id = subsitez_id
ret.platform_site_id = platform_site_id
ret.platform_siteb_id = platform_siteb_id
ret.platform_siteb2_id = platform_siteb2_id
ret.platform_site3_id = platform_site3_id
ret.instrument_site_id = instrument_site_id
ret.instrument_site2_id = instrument_site2_id
ret.instrument_siteb3_id = instrument_siteb3_id
ret.instrument_site4_id = instrument_site4_id
return ret
#@unittest.skip("targeting")
def test_create_observatory(self):
observatory_obj = IonObject(RT.Observatory,
name='TestFacility',
description='some new mf')
self.OMS.create_observatory(observatory_obj)
#@unittest.skip("targeting")
def test_find_observatory_org(self):
org_obj = IonObject(RT.Org,
name='TestOrg',
description='some new mf org')
org_id = self.OMS.create_marine_facility(org_obj)
observatory_obj = IonObject(RT.Observatory,
name='TestObservatory',
description='some new obs')
observatory_id = self.OMS.create_observatory(observatory_obj)
#make association
self.OMS.assign_resource_to_observatory_org(observatory_id, org_id)
#find association
org_objs = self.OMS.find_org_by_observatory(observatory_id)
self.assertEqual(1, len(org_objs))
self.assertEqual(org_id, org_objs[0]._id)
print("org_id=<" + org_id + ">")
#create a subsite with parent Observatory
subsite_obj = IonObject(RT.Subsite,