本文整理汇总了Python中interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient.create_marine_facility方法的典型用法代码示例。如果您正苦于以下问题:Python ObservatoryManagementServiceClient.create_marine_facility方法的具体用法?Python ObservatoryManagementServiceClient.create_marine_facility怎么用?Python ObservatoryManagementServiceClient.create_marine_facility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient
的用法示例。
在下文中一共展示了ObservatoryManagementServiceClient.create_marine_facility方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_marine_facility [as 别名]
#.........这里部分代码省略.........
self.destroy(stuff)
def _make_associations(self):
"""
create one of each resource and association used by OMS
to guard against problems in ion-definitions
"""
#raise unittest.SkipTest("https://jira.oceanobservatories.org/tasks/browse/CISWCORE-41")
"""
the tree we're creating (observatory, sites, platforms, instruments)
rows are lettered, colums numbered.
- first row is implied a
- first column is implied 1
- site Z, just because
O--Sz
|
S--S2--P3--I4
|
Sb-Pb2-Ib3
|
P--I2 <- PlatformDevice, InstrumentDevice2
|
Pb <- PlatformDevice b
|
I <- InstrumentDevice
"""
org_id = self.OMS.create_marine_facility(any_old(RT.Org))
def create_under_org(resource_type, extra_fields=None):
obj = any_old(resource_type, extra_fields)
if RT.InstrumentDevice == resource_type:
resource_id = self.IMS.create_instrument_device(obj)
else:
resource_id, _ = self.RR.create(obj)
self.OMS.assign_resource_to_observatory_org(resource_id=resource_id, org_id=org_id)
return resource_id
#stuff we control
observatory_id = create_under_org(RT.Observatory)
subsite_id = create_under_org(RT.Subsite)
subsite2_id = create_under_org(RT.Subsite)
subsiteb_id = create_under_org(RT.Subsite)
subsitez_id = create_under_org(RT.Subsite)
platform_site_id = create_under_org(RT.PlatformSite)
platform_siteb_id = create_under_org(RT.PlatformSite)
platform_siteb2_id = create_under_org(RT.PlatformSite)
platform_site3_id = create_under_org(RT.PlatformSite)
instrument_site_id = create_under_org(RT.InstrumentSite)
instrument_site2_id = create_under_org(RT.InstrumentSite)
instrument_siteb3_id = create_under_org(RT.InstrumentSite)
instrument_site4_id = create_under_org(RT.InstrumentSite)
#stuff we associate to
instrument_device_id = create_under_org(RT.InstrumentDevice)
instrument_device2_id = create_under_org(RT.InstrumentDevice)
platform_device_id = create_under_org(RT.PlatformDevice)
platform_deviceb_id = create_under_org(RT.PlatformDevice)
示例2: TestObservatoryManagementServiceIntegration
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_marine_facility [as 别名]
#.........这里部分代码省略.........
self.destroy(stuff)
def _make_associations(self):
"""
create one of each resource and association used by OMS
to guard against problems in ion-definitions
"""
#raise unittest.SkipTest("https://jira.oceanobservatories.org/tasks/browse/CISWCORE-41")
"""
the tree we're creating (observatory, sites, platforms, instruments)
rows are lettered, colums numbered.
- first row is implied a
- first column is implied 1
- site Z, just because
O--Sz
|
S--S2--P3--I4
|
Sb-Pb2-Ib3
|
P--I2 <- PlatformDevice, InstrumentDevice2
|
Pb <- PlatformDevice b
|
I <- InstrumentDevice
"""
org_id = self.OMS.create_marine_facility(any_old(RT.Org))
def create_under_org(resource_type):
obj = any_old(resource_type)
if RT.InstrumentDevice == resource_type:
resource_id = self.IMS.create_instrument_device(obj)
else:
resource_id, _ = self.RR.create(obj)
self.OMS.assign_resource_to_observatory_org(resource_id=resource_id, org_id=org_id)
return resource_id
#stuff we control
observatory_id = create_under_org(RT.Observatory)
subsite_id = create_under_org(RT.Subsite)
subsite2_id = create_under_org(RT.Subsite)
subsiteb_id = create_under_org(RT.Subsite)
subsitez_id = create_under_org(RT.Subsite)
platform_site_id = create_under_org(RT.PlatformSite)
platform_siteb_id = create_under_org(RT.PlatformSite)
platform_siteb2_id = create_under_org(RT.PlatformSite)
platform_site3_id = create_under_org(RT.PlatformSite)
instrument_site_id = create_under_org(RT.InstrumentSite)
instrument_site2_id = create_under_org(RT.InstrumentSite)
instrument_siteb3_id = create_under_org(RT.InstrumentSite)
instrument_site4_id = create_under_org(RT.InstrumentSite)
#stuff we associate to
instrument_device_id = create_under_org(RT.InstrumentDevice)
instrument_device2_id = create_under_org(RT.InstrumentDevice)
platform_device_id = create_under_org(RT.PlatformDevice)
platform_deviceb_id = create_under_org(RT.PlatformDevice)
示例3: TestRegisterAndActivate
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_marine_facility [as 别名]
#.........这里部分代码省略.........
def _create_org(self):
"""
Create an org that contains all test infrastructure.
Results in this object:
Org({'message_controllable': True,
'_rev': '1',
'_id': '9ff82d9f6c7b41f886c6137f54a3086c',
'lcstate': 'DEPLOYED',
'alt_ids': [],
'url': '',
'description':
'An Org for Activation Tests',
'contacts': [],
'org_governance_name': 'ActiveOrg',
'institution': Institution({'website': '', 'phone': '',
'name': '', 'email': ''}),
'ts_updated': '1391542388395',
'monitorable': True,
'org_type': 2,
'addl': {},
'ts_created': '1391542388395',
'availability': 'AVAILABLE',
'name': 'ActiveOrg'})
"""
org_attrs = {
'name' : 'ActiveOrg',
'description' : 'An Org for Activation Tests',
'org_type' : OrgTypeEnum.MARINE_FACILITY
}
org_obj = IonObject('Org', **org_attrs)
self.org_id = self.oms.create_marine_facility(org_obj,
headers=self.system_actor_headers)
def _create_observatory(self):
"""
Create a top level obsevaotry site for the tests.
Results in this object:
Observatory({'reference_designator': '',
'spatial_area_name': '',
'_id': 'fdcda51901464575913858f98aaf0f41',
'_rev': '1',
'lcstate': 'DEPLOYED',
'alt_ids': [],
'url': '',
'description': 'An Observatory for Activation Tests',
'coordinate_reference_system': GeospatialCoordinateReferenceSystem(
{'geospatial_latitude_units': '',
'geospatial_vertical_crs': '',
'geospatial_geodetic_crs': '',
'geospatial_vertical_positive': '',
'geospatial_vertical_units': '',
'geospatial_longitude_units': ''}),
'constraint_list': [],
'environment': 1,
'ts_updated': '1391544601340',
'local_name': '',
'geospatial_point_center': GeospatialIndex({'lat': 0.0, 'lon': 0.0}),
'addl': {},
'ts_created': '1391544601340',
'availability': 'AVAILABLE',
'name': 'ActiveObservatory'})
"""
示例4: TestRollups
# 需要导入模块: from interface.services.sa.iobservatory_management_service import ObservatoryManagementServiceClient [as 别名]
# 或者: from interface.services.sa.iobservatory_management_service.ObservatoryManagementServiceClient import create_marine_facility [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_marine_facility [as 别名]
#.........这里部分代码省略.........
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,
name= 'TestSubsite',
description = 'sample subsite')
subsite_id = self.OMS.create_subsite(subsite_obj, observatory_id)
self.assertIsNotNone(subsite_id, "Subsite not created.")
# verify that Subsite is linked to Observatory
mf_subsite_assoc = self.RR.get_association(observatory_id, PRED.hasSite, subsite_id)
self.assertIsNotNone(mf_subsite_assoc, "Subsite not connected to Observatory.")
# add the Subsite as a resource of this Observatory