当前位置: 首页>>代码示例>>Python>>正文


Python NetworkUtil.deserialize_network_definition方法代码示例

本文整理汇总了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)
开发者ID:blazetopher,项目名称:coi-services,代码行数:15,代码来源:test_network_util.py

示例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)
开发者ID:ednad,项目名称:coi-services,代码行数:27,代码来源:test_rsn_platform_driver.py

示例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)
开发者ID:pkediyal,项目名称:coi-services,代码行数:9,代码来源:test_network_util.py

示例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
开发者ID:MauriceManning,项目名称:coi-services,代码行数:15,代码来源:oms_simulator.py

示例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)
开发者ID:StevenMyerson,项目名称:marine-integrations,代码行数:18,代码来源:test_rsn_platform_driver.py

示例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))
开发者ID:shenrie,项目名称:coi-services,代码行数:6,代码来源:test_platform_resource_monitor.py


注:本文中的ion.agents.platform.util.network_util.NetworkUtil.deserialize_network_definition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。