本文整理汇总了Python中ion.agents.platform.util.network_util.NetworkUtil.deserialize_network_definition方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkUtil.deserialize_network_definition方法的具体用法?Python NetworkUtil.deserialize_network_definition怎么用?Python NetworkUtil.deserialize_network_definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.agents.platform.util.network_util.NetworkUtil
的用法示例。
在下文中一共展示了NetworkUtil.deserialize_network_definition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serialization_deserialization
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def test_serialization_deserialization(self):
# create NetworkDefinition object by de-serializing the simulated network:
ndef = NetworkUtil.deserialize_network_definition(
file('ion/agents/platform/rsn/simulator/network.yml'))
# serialize object to string
serialization = NetworkUtil.serialize_network_definition(ndef)
# recreate object by de-serializing the string:
ndef2 = NetworkUtil.deserialize_network_definition(serialization)
# verify the objects are equal:
self.assertEquals(ndef.diff(ndef2), None)
示例2: setUp
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def setUp(self):
self.DVR_CONFIG = {
'oms_uri': self._dispatch_simulator('launchsimulator'),
'attributes': {},
'ports': {}
}
log.debug("DVR_CONFIG['oms_uri'] = %s", self.DVR_CONFIG['oms_uri'])
yaml_filename = 'ion/agents/platform/rsn/simulator/network.yml'
log.debug("retrieving network definition from %s", yaml_filename)
network_definition = NetworkUtil.deserialize_network_definition(file(yaml_filename))
if log.isEnabledFor(logging.DEBUG):
network_definition_ser = NetworkUtil.serialize_network_definition(network_definition)
log.debug("NetworkDefinition serialization:\n%s", network_definition_ser)
platform_id = self.PLATFORM_ID
pnode = network_definition.pnodes[platform_id]
def evt_recv(driver_event):
log.debug('GOT driver_event=%s', str(driver_event))
self._plat_driver = RSNPlatformDriver(pnode, evt_recv, Mock(), Mock())
res_state = self._plat_driver.get_resource_state()
self.assertEqual(res_state, RSNPlatformDriverState.UNCONFIGURED)
示例3: test_compute_checksum
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def test_compute_checksum(self):
# create NetworkDefinition object by de-serializing the simulated network:
ndef = NetworkUtil.deserialize_network_definition(file("ion/agents/platform/rsn/simulator/network.yml"))
checksum = ndef.compute_checksum()
if log.isEnabledFor(logging.DEBUG):
log.debug("NetworkDefinition checksum = %s", checksum)
示例4: __init__
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def __init__(self, yaml_filename='ion/agents/platform/rsn/simulator/network.yml'):
self._ndef = NetworkUtil.deserialize_network_definition(file(yaml_filename))
self._platform_types = self._ndef.platform_types
self._pnodes = self._ndef.pnodes
# registered event listeners: {url: reg_time, ...},
# where reg_time is the NTP time of (latest) registration.
# NOTE: for simplicity, we don't keep info about unregistered listeners
self._reg_event_listeners = {}
self._event_notifier = EventNotifier()
# EventGenerator only kept while there are listeners registered
self._event_generator = None
示例5: setUp
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def setUp(self):
DVR_CONFIG['oms_uri'] = self._dispatch_simulator(oms_uri)
log.debug("DVR_CONFIG['oms_uri'] = %s", DVR_CONFIG['oms_uri'])
yaml_filename = 'ion/agents/platform/rsn/simulator/network.yml'
log.debug("retrieving network definition from %s", yaml_filename)
network_definition = NetworkUtil.deserialize_network_definition(file(yaml_filename))
if log.isEnabledFor(logging.DEBUG):
network_definition_ser = NetworkUtil.serialize_network_definition(network_definition)
log.debug("NetworkDefinition serialization:\n%s", network_definition_ser)
platform_id = self.PLATFORM_ID
pnode = network_definition.pnodes[platform_id]
self._plat_driver = RSNPlatformDriver(pnode, self.evt_recv)
示例6: setUp
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import deserialize_network_definition [as 别名]
def setUp(self):
self._pp = pprint.PrettyPrinter()
yaml_filename = 'ion/agents/platform/rsn/simulator/network.yml'
self._ndef = NetworkUtil.deserialize_network_definition(file(yaml_filename))