Ejemplo n.º 1
0
 def create_default_device_info(cls):
     # generate default device info
     _device_spec, _device_inventory = (
         config_factory.create_default_device_data())
     device_spec, device_inventory = json_utils.import_bundle(
         common_utils.get_file_path('config_default/device_data.json'),
         'device_spec', 'device_inventory')
     assert _device_spec == device_spec
     assert _device_inventory == device_inventory
     return config_factory.derive_device_info(device_spec, device_inventory)
Ejemplo n.º 2
0
 def __init__(self, filepath=None):
     if filepath:
         filemap = json_utils.import_bundle(filepath)
         self.task_mapping = TaskMapping(data=filemap['task_mapping'])
         self.task_links = TaskLinks(data=filemap['task_links'])
         self.task_info = TaskInfo(data=filemap['task_info'])
     else:
         self.task_mapping = TaskMapping()
         self.task_links = TaskLinks()
         self.task_info = TaskInfo()
Ejemplo n.º 3
0
 def __init__(self, filepath=None):
     if not filepath:
         self.device_spec = DeviceSpec(data=spec_def.DEVICE_SPEC)
         self.device_inventory = DeviceInventory()
         self.device_links = DeviceLinks()
     else:
         filemap = json_utils.import_bundle(filepath)
         self.device_spec = DeviceSpec(data=filemap['device_spec'])
         self.device_inventory = DeviceInventory(
             data=filemap['device_inventory'])
         self.device_links = DeviceLinks(data=filemap['links'])
Ejemplo n.º 4
0
 def create_default_graph(cls):
     _task_info, _edge_info, _src_map, _dst_map = (
         config_factory.create_default_task_graph())
     task_info, edge_info, src_map, dst_map = json_utils.import_bundle(
         common_utils.get_file_path('config_default/task_graph.json'),
         'task_info', 'edge_info', 'src_map', 'dst_map')
     assert _src_map == src_map
     assert _dst_map == dst_map
     assert _task_info == task_info
     assert _edge_info == edge_info
     return cls.create(src_map, dst_map, task_info, edge_info)
Ejemplo n.º 5
0
    def import_data(cls, data_name):
        """Import data.

        Returns:
            node_info (dict)
            edge_info (dict)

        """
        filepath = cls.gen_config_filepath(data_name)
        filemap = json_utils.import_bundle(filepath)
        node_info = filemap['node_info']
        edge_info = filemap['edge_info']
        return node_info, edge_info
Ejemplo n.º 6
0
def import_data(filepath):
    filemap = json_utils.import_bundle(filepath)
    task_mapping = filemap['task_mapping']
    task_links = filemap['task_links']
    task_info = filemap['task_info']
    return task_mapping, task_links, task_info
Ejemplo n.º 7
0
def import_data(filepath):
    filemap = json_utils.import_bundle(filepath)
    device_spec = filemap['device_spec']
    device_inventory = filemap['device_inventory']
    links = filemap['links']
    return device_spec, device_inventory, links