當前位置: 首頁>>代碼示例>>Python>>正文


Python NetworkUtil.create_network_definition_from_ci_config方法代碼示例

本文整理匯總了Python中ion.agents.platform.util.network_util.NetworkUtil.create_network_definition_from_ci_config方法的典型用法代碼示例。如果您正苦於以下問題:Python NetworkUtil.create_network_definition_from_ci_config方法的具體用法?Python NetworkUtil.create_network_definition_from_ci_config怎麽用?Python NetworkUtil.create_network_definition_from_ci_config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ion.agents.platform.util.network_util.NetworkUtil的用法示例。


在下文中一共展示了NetworkUtil.create_network_definition_from_ci_config方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_create_network_definition_from_ci_config_bad

# 需要導入模塊: from ion.agents.platform.util.network_util import NetworkUtil [as 別名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import create_network_definition_from_ci_config [as 別名]
    def test_create_network_definition_from_ci_config_bad(self):

        CFG = DotDict({
            'device_type' : "bad_device_type",
        })

        # device_type
        with self.assertRaises(NetworkDefinitionException):
            NetworkUtil.create_network_definition_from_ci_config(CFG)

        CFG = DotDict({
            'device_type' : "PlatformDevice",
        })

        # missing platform_id
        with self.assertRaises(NetworkDefinitionException):
            NetworkUtil.create_network_definition_from_ci_config(CFG)

        CFG = DotDict({
            'device_type' : "PlatformDevice",

            'platform_config': {
                'platform_id': 'Node1D'
            },
        })

        # missing driver_config
        with self.assertRaises(NetworkDefinitionException):
            NetworkUtil.create_network_definition_from_ci_config(CFG)
開發者ID:ednad,項目名稱:coi-services,代碼行數:31,代碼來源:test_network_util.py

示例2: test_create_network_definition_from_ci_config

# 需要導入模塊: from ion.agents.platform.util.network_util import NetworkUtil [as 別名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import create_network_definition_from_ci_config [as 別名]
    def test_create_network_definition_from_ci_config(self):

        CFG = DotDict({
            'device_type' : "PlatformDevice",

            'platform_config': {
                'platform_id': 'Node1D'
            },

            'driver_config': {'attributes': {'MVPC_pressure_1': {'attr_id': 'MVPC_pressure_1',
                                                                 'group': 'pressure',
                                                                 'max_val': 33.8,
                                                                 'min_val': -3.8,
                                                                 'monitor_cycle_seconds': 10,
                                                                 'precision': 0.04,
                                                                 'read_write': 'read',
                                                                 'type': 'float',
                                                                 'units': 'PSI'},
                                             'MVPC_temperature': {'attr_id': 'MVPC_temperature',
                                                                  'group': 'temperature',
                                                                  'max_val': 58.5,
                                                                  'min_val': -1.5,
                                                                  'monitor_cycle_seconds': 10,
                                                                  'precision': 0.06,
                                                                  'read_write': 'read',
                                                                  'type': 'float',
                                                                  'units': 'Degrees C'},
                                             'input_bus_current': {'attr_id': 'input_bus_current',
                                                                   'group': 'power',
                                                                   'max_val': 50,
                                                                   'min_val': -50,
                                                                   'monitor_cycle_seconds': 5,
                                                                   'precision': 0.1,
                                                                   'read_write': 'write',
                                                                   'type': 'float',
                                                                   'units': 'Amps'},
                                             'input_voltage': {'attr_id': 'input_voltage',
                                                               'group': 'power',
                                                               'max_val': 500,
                                                               'min_val': -500,
                                                               'monitor_cycle_seconds': 5,
                                                               'precision': 1,
                                                               'read_write': 'read',
                                                               'type': 'float',
                                                               'units': 'Volts'}},
                              'dvr_cls': 'RSNPlatformDriver',
                              'dvr_mod': 'ion.agents.platform.rsn.rsn_platform_driver',
                              'oms_uri': 'embsimulator',
                              'ports': {'Node1D_port_1': {'port_id': 'Node1D_port_1'},
                                        'Node1D_port_2': {'port_id': 'Node1D_port_2'}},
                              },


            'children': {'d7877d832cf94c388089b141043d60de': {'agent': {'resource_id': 'd7877d832cf94c388089b141043d60de'},
                                                              'device_type': 'PlatformDevice',
                                                              'platform_config': {'platform_id': 'MJ01C'},
                                                              'driver_config': {'attributes': {'MJ01C_attr_1': {'attr_id': 'MJ01C_attr_1',
                                                                                                                'group': 'power',
                                                                                                                'max_val': 10,
                                                                                                                'min_val': -2,
                                                                                                                'monitor_cycle_seconds': 5,
                                                                                                                'read_write': 'read',
                                                                                                                'type': 'int',
                                                                                                                'units': 'xyz'},
                                                                                               'MJ01C_attr_2': {'attr_id': 'MJ01C_attr_2',
                                                                                                                'group': 'power',
                                                                                                                'max_val': 10,
                                                                                                                'min_val': -2,
                                                                                                                'monitor_cycle_seconds': 5,
                                                                                                                'read_write': 'write',
                                                                                                                'type': 'int',
                                                                                                                'units': 'xyz'}},
                                                                                'dvr_cls': 'RSNPlatformDriver',
                                                                                'dvr_mod': 'ion.agents.platform.rsn.rsn_platform_driver',
                                                                                'oms_uri': 'embsimulator',
                                                                                'ports': {'MJ01C_port_1': {'port_id': 'MJ01C_port_1'},
                                                                                          'MJ01C_port_2': {'port_id': 'MJ01C_port_2'}}},

                                                              'children': {'d0203cb9eb844727b7a8eea77db78e89': {'agent': {'resource_id': 'd0203cb9eb844727b7a8eea77db78e89'},
                                                                                                                'platform_config': {'platform_id': 'LJ01D'},
                                                                                                                'device_type': 'PlatformDevice',
                                                                                                                'driver_config': {'attributes': {'MVPC_pressure_1': {'attr_id': 'MVPC_pressure_1',
                                                                                                                                                                     'group': 'pressure',
                                                                                                                                                                     'max_val': 33.8,
                                                                                                                                                                     'min_val': -3.8,
                                                                                                                                                                     'monitor_cycle_seconds': 10,
                                                                                                                                                                     'precision': 0.04,
                                                                                                                                                                     'read_write': 'read',
                                                                                                                                                                     'type': 'float',
                                                                                                                                                                     'units': 'PSI'},
                                                                                                                                                 'MVPC_temperature': {'attr_id': 'MVPC_temperature',
                                                                                                                                                                      'group': 'temperature',
                                                                                                                                                                      'max_val': 58.5,
                                                                                                                                                                      'min_val': -1.5,
                                                                                                                                                                      'monitor_cycle_seconds': 10,
                                                                                                                                                                      'precision': 0.06,
                                                                                                                                                                      'read_write': 'read',
                                                                                                                                                                      'type': 'float',
                                                                                                                                                                      'units': 'Degrees C'},
                                                                                                                                                 'input_bus_current': {'attr_id': 'input_bus_current',
#.........這裏部分代碼省略.........
開發者ID:ednad,項目名稱:coi-services,代碼行數:103,代碼來源:test_network_util.py


注:本文中的ion.agents.platform.util.network_util.NetworkUtil.create_network_definition_from_ci_config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。