當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。