Exemplo n.º 1
0
    def setUp(self):
        # before test, create graph
        self.nodes: List[int] = [1, 2, 3, 4, 5, 6, 7]

        self.edges: List[Tuple[int]] = [(1, 2), (2, 1), (2, 3), (3, 2), (2, 4),
                                        (4, 2), (3, 4), (4, 3), (3, 5), (5, 3),
                                        (4, 5), (5, 4), (5, 6), (6, 5), (5, 7),
                                        (7, 5)]

        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(self.edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)

        # fid = 1, size = 8Kb, period = 300us, source = 1, destinations = [6, 7], reliability = 0.0, deadline = 300us
        f1: Flow = Flow(1, int(8e3), int(3e5), 1, [6, 7], 0.0, int(1e6))
        # fid = 1, size = 20Kb, period = 150us, source = 1, destinations = [6], reliability = 0.0, deadline = 150us
        f2: Flow = Flow(2, int(2e4), int(1.5e5), 1, [6], 0.0, int(1e6))
        # fid = 1, size = 30Kb, period = 150us, source = 1, destinations = [6, 7], reliability = 0.0, deadline = 300us
        f3: Flow = Flow(3, int(3e4), int(3e5), 1, [6, 7], 0.0, int(1e6))
        # fid = 1, size = 2Kb, period = 150us, source = 1, destinations = [7], reliability = 0.0, deadline = 300us
        f4: Flow = Flow(4, int(2e3), int(3e5), 1, [7], 0.0, int(1e6))

        self.flows: List[Flow] = list()
        self.flows.append(f1)
        self.flows.append(f2)
        self.flows.append(f3)
        self.flows.append(f4)
    def setUp(self):
        # configuration
        config.FLOW_CONFIG['size-set'] = [int(1.5e3),
                                          int(5e3),
                                          int(1e3)]  # [200B, 625B, 125B]
        config.FLOW_CONFIG['period-set'] = [int(1e5),
                                            int(1.5e5),
                                            int(3e5)]  # [100us, 150us, 300us]
        config.FLOW_CONFIG['hyper-period'] = int(3e5)  # [300us]
        config.FLOW_CONFIG['deadline-set'] = [int(1e8),
                                              int(5e7),
                                              int(2e7)]  # [100ms, 50ms, 20ms]
        config.FLOW_CONFIG['redundancy_degree'] = 3
        config.FLOW_CONFIG['reliability-set'] = [0.5]
        config.FLOW_CONFIG['dest-num-set'] = [1, 2, 3]
        config.FLOW_CONFIG['max-hops'] = 8
        config.FLOW_CONFIG['flow-num'] = 10
        config.GRAPH_CONFIG['time-granularity'] = TIME_GRANULARITY.NS
        config.GRAPH_CONFIG['all-bandwidth'] = 1e0  # 500Mbps
        config.GRAPH_CONFIG['all-propagation-delay'] = 1e2
        config.GRAPH_CONFIG['all-process-delay'] = 5e3
        config.GRAPH_CONFIG['all-per'] = 0.004  # 0.4%
        config.XML_CONFIG['enhancement-tsn-switch-enable'] = True

        # create graph
        edges: List[Tuple[int, int]] = [(1, 5), (2, 6), (3, 8), (4, 11),
                                        (5, 6), (5, 9), (6, 7), (7, 9), (7, 8),
                                        (8, 9), (8, 11), (9, 10), (10, 11)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)
Exemplo n.º 3
0
    def setUp(self):
        edges: List[Tuple[int, int]] = [(1, 5), (2, 6), (3, 8), (4, 11),
                                        (5, 6), (5, 9), (6, 7), (7, 9), (7, 8),
                                        (8, 9), (8, 11), (9, 10), (10, 11)]
        # edges: List[Tuple[int, int]] = [(1, 2), (2, 3), (2, 4), (3, 4), (3, 5), (4, 5), (3, 8), (5, 6), (5, 7)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)

        # fid = 1, size = 1500KB, period = 300us, source = 1, destinations = [6, 7], reliability = 0.95, deadline = 300us
        f1: Flow = Flow(1, int(1.2e4), int(3e5), 1, [3, 4], 0.95, int(1e6))
        # f1: Flow = Flow(1, int(1.2e4), int(3e5), 1, [6, 7], 0.95, int(1e6))
        self.flows: List[Flow] = [f1]

        config.FLOW_CONFIG['redundancy_degree'] = 2
        config.GRAPH_CONFIG['all-per'] = 0.004
        config.GRAPH_CONFIG[
            'routing_strategy'] = ROUTING_STRATEGY.DIJKSTRA_SINGLE_ROUTING_STRATEGY
        config.GRAPH_CONFIG[
            'scheduling_strategy'] = SCHEDULING_STRATEGY.LRF_REDUNDANT_SCHEDULING_STRATEGY
        config.GRAPH_CONFIG[
            'allocating_strategy'] = ALLOCATING_STRATEGY.AEAP_ALLOCATING_STRATEGY
        config.GRAPH_CONFIG[
            'reliability-strategy'] = RELIABILITY_STRATEGY.UNI_ROUTES_RELIABILITY_STRATEGY
Exemplo n.º 4
0
 def test_my_topology(self):
     edges: List[Tuple[int, int]] = [(1, 3), (2, 4), (3, 4), (3, 5), (3, 6),
                                     (4, 5), (5, 6), (5, 7), (6, 8), (7, 8),
                                     (7, 9), (8, 10), (8, 11)]
     graph: nx.Graph = nx.Graph()
     graph.add_edges_from(edges)
     graph = graph.to_directed()
     TopoGenerator.draw(graph)
Exemplo n.º 5
0
    def setUp(self):
        edges: List[Tuple[int, int]] = [(1, 5), (2, 6), (3, 8), (4, 11), (5, 6), (5, 9),
                                        (6, 7), (7, 9), (7, 8), (8, 9), (8, 11), (9, 10), (10, 11)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)

        config.TESTING['generate-flow'] = True  # whether enable flow generation or not
        config.FLOW_CONFIG['reliability-set'] = [0.5]
        config.FLOW_CONFIG['redundancy_degree'] = 2
        if config.TESTING['generate-flow']:
            attached_nodes: List[NodeId] = [1, 2, 3, 4]
            config.FLOW_CONFIG['dest-num-set'] = [1, 2, 3]
            config.FLOW_CONFIG['flow-num'] = 10
            self.flows: List[Flow] = FlowGenerator.generate_flows(edge_nodes=attached_nodes, graph=self.graph)
            FlowGenerator.save_flows(self.flows)
        else:
            self.flows: List[Flow] = FlowGenerator.load_flows()

        config.FLOW_CONFIG['redundancy_degree'] = 5
        config.GRAPH_CONFIG['routing_strategy'] = ROUTING_STRATEGY.BACKTRACKING_REDUNDANT_ROUTING_STRATEGY
        # config.GRAPH_CONFIG['routing_strategy'] = ROUTING_STRATEGY.DIJKSTRA_SINGLE_ROUTING_STRATEGY
        config.GRAPH_CONFIG['scheduling_strategy'] = SCHEDULING_STRATEGY.LRF_REDUNDANT_SCHEDULING_STRATEGY
        config.GRAPH_CONFIG['allocating_strategy'] = ALLOCATING_STRATEGY.AEAP_ALLOCATING_STRATEGY
        config.GRAPH_CONFIG['reliability-strategy'] = RELIABILITY_STRATEGY.ENUMERATION_METHOD_RELIABILITY_STRATEGY
        solver: Solver = Solver(nx_graph=self.graph,
                                flows=self.flows,
                                topo_strategy=None,
                                routing_strategy=config.GRAPH_CONFIG['routing_strategy'],
                                scheduling_strategy=config.GRAPH_CONFIG['scheduling_strategy'],
                                allocating_strategy=config.GRAPH_CONFIG['allocating_strategy'],
                                reliability_strategy=config.GRAPH_CONFIG['reliability-strategy'])
        self.solution = solver.generate_init_solution()
        solver.draw_gantt_chart(self.solution)  # draw gantt chart
        solution_name: str = solver.generate_solution_name(solution=self.solution, prefix='n7_f10_r6_')
        import os
        filename: str = os.path.join(config.res_dir, solution_name)
        solver.analyze(solution=self.solution, target_filename=filename)  # analyze solution
        config.OPTIMIZATION['enable'] = False
        if config.OPTIMIZATION['enable'] is True:
            # optimized method
            self.solution = solver.optimize()  # optimize
            solver.draw_gantt_chart(self.solution)  # draw gantt chart
            solution_name: str = solver.generate_solution_name(
                solution=self.solution,
                prefix='o_n7_f10_r5_')
            filename: str = os.path.join(config.res_dir, solution_name)
            solver.analyze(solution=self.solution, target_filename=filename)
        solver.save_solution(solution=self.solution)  # save solution

        tsn_network_factory: TSNNetworkFactory = TSNNetworkFactory()
        tsn_network: TSNNetwork = tsn_network_factory.product(
            solution_filename=solution_name,
            enhancement_enable=config.XML_CONFIG['enhancement-tsn-switch-enable'])
        self.tsn_network = tsn_network
        self.node_edge_mac_info = tsn_network_factory.node_edge_mac_info
Exemplo n.º 6
0
    def setUp(self):
        edges: List[Tuple[int, int]] = [(1, 2), (2, 3), (2, 4), (3, 4), (3, 5),
                                        (4, 5), (3, 8), (5, 6), (5, 7)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)

        config.TESTING[
            'generate-flow'] = False  # whether enable flow generation or not
        if config.TESTING['generate-flow']:
            attached_nodes: List[NodeId] = [1, 6, 7, 8]
            config.FLOW_CONFIG['dest-num-set'] = [1, 2, 3]
            config.FLOW_CONFIG['flow-num'] = 5
            self.flows: List[Flow] = FlowGenerator.generate_flows(
                edge_nodes=attached_nodes, graph=self.graph)
            FlowGenerator.save_flows(self.flows)
        else:
            self.flows: List[Flow] = FlowGenerator.load_flows()

        config.GRAPH_CONFIG[
            'routing_strategy'] = ROUTING_STRATEGY.BACKTRACKING_REDUNDANT_ROUTING_STRATEGY
        # config.GRAPH_CONFIG['routing_strategy'] = ROUTING_STRATEGY.DIJKSTRA_SINGLE_ROUTING_STRATEGY
        config.GRAPH_CONFIG[
            'scheduling_strategy'] = SCHEDULING_STRATEGY.LRF_REDUNDANT_SCHEDULING_STRATEGY
        config.GRAPH_CONFIG[
            'allocating_strategy'] = ALLOCATING_STRATEGY.AEAP_ALLOCATING_STRATEGY
        solver: Solver = Solver(
            nx_graph=self.graph,
            flows=self.flows,
            topo_strategy=None,
            routing_strategy=config.GRAPH_CONFIG['routing_strategy'],
            scheduling_strategy=config.GRAPH_CONFIG['scheduling_strategy'],
            allocating_strategy=config.GRAPH_CONFIG['allocating_strategy'])
        self.solution = solver.generate_init_solution()
        solver.draw_gantt_chart(self.solution)  # draw gantt chart
        solution_name: str = solver.generate_solution_name(
            solution=self.solution)
        import os
        filename: str = os.path.join(config.res_dir, solution_name)
        solver.analyze(solution=self.solution,
                       target_filename=filename)  # analyze solution
        solver.save_solution(solution=self.solution)  # save solution

        tsn_network_factory: TSNNetworkFactory = TSNNetworkFactory()
        tsn_network: TSNNetwork = tsn_network_factory.product(
            solution_filename=solution_name,
            enhancement_enable=config.
            XML_CONFIG['enhancement-tsn-switch-enable'])
        self.tsn_network = tsn_network
        self.node_edge_mac_info = tsn_network_factory.node_edge_mac_info
Exemplo n.º 7
0
    def setUp(self):
        config.TESTING['round'] = [1, 1]  # [1, 5]
        config.TESTING['flow-size'] = [10, 100]
        config.TESTING['x-axis-gap'] = 5
        config.TESTING['draw-gantt-chart'] = True
        config.OPTIMIZATION['enable'] = True
        config.FLOW_CONFIG[
            'redundancy_degree'] = 2  # at least 2 end-to-end routes
        config.FLOW_CONFIG[
            'max-redundancy-degree'] = 5  # the most no. of end-to-end routes
        config.FLOW_CONFIG[
            'un-neighbors_degree'] = 1  # avoid source and node connecting at the same node
        config.GRAPH_CONFIG['time-granularity'] = TIME_GRANULARITY.NS
        config.GRAPH_CONFIG['all-bandwidth'] = 0.1  # 100Mbps
        config.GRAPH_CONFIG['all-propagation-delay'] = 0  # 1e2 100ns
        config.GRAPH_CONFIG['all-process-delay'] = 0  # 5e3 5us
        config.GRAPH_CONFIG['all-per'] = 0.01  # 0.4%
        config.GRAPH_CONFIG['edge-nodes-distribution-degree'] = 3

        # create flows
        self.flows: List[Flow] = [
            Flow(1, int(1e3), int(1e6), 5, [7, 8], 0.5,
                 int(2e7)),  # 125B 1000us 20ms
            Flow(2, int(1e3), int(1e6), 6, [5], 0.5,
                 int(2e7)),  # 125B 1000us 20ms
            Flow(3, int(1e3), int(1e6), 7, [5, 6], 0.5,
                 int(2e7)),  # 125B 1000us 20ms
            Flow(4, int(1.6e3), int(1e6), 8, [5], 0.5,
                 int(5e7)),  # 200B 1000us 50ms
            Flow(5, int(2.4e3), int(1e6), 6, [7, 8], 0.5,
                 int(5e7)),  # 300B 1000us 50ms
            Flow(6, int(2.4e3), int(1.5e6), 7, [5, 6], 0.5,
                 int(5e7)),  # 300B 1500us 50ms
            Flow(7, int(5e3), int(1.5e6), 5, [8], 0.5,
                 int(1e8)),  # 625B 1500us 100ms
            Flow(8, int(5e3), int(1.5e6), 6, [8], 0.5,
                 int(1e8)),  # 625B 1500us 100ms
            Flow(9, int(1.2e3), int(3e6), 8, [5, 6], 0.5,
                 int(1e8)),  # 150B 3000us 100ms
            Flow(10, int(1.2e3), int(3e6), 8, [5], 0.5,
                 int(1e8)),  # 150B 3000us 100ms
        ]
        # create topology
        edges: List[Tuple[int, int]] = [(1, 2), (1, 3), (2, 3), (2, 4), (3, 4),
                                        (5, 1), (6, 2), (4, 7), (4, 8)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)
    def setUp(self):
        config.TESTING['round'] = [1, 1]  # [1, 5]
        config.TESTING['flow-size'] = [10, 100]
        config.TESTING['x-axis-gap'] = 5
        config.TESTING['draw-gantt-chart'] = False
        config.OPTIMIZATION['enable'] = True
        config.FLOW_CONFIG['redundancy_degree'] = 2  # at least 2 end-to-end routes
        config.FLOW_CONFIG['max-redundancy-degree'] = 5  # the most no. of end-to-end routes
        config.FLOW_CONFIG['un-neighbors_degree'] = 1  # avoid source and node connecting at the same node
        config.FLOW_CONFIG['size-set'] = [int(1.6e3), int(5e3), int(1e3)]  # [200B, 625B, 125B]
        config.FLOW_CONFIG['period-set'] = [int(1e5), int(1.5e5), int(3e5)]  # [100us, 150us, 300us]
        config.FLOW_CONFIG['hyper-period'] = int(3e5)  # [300us]
        config.FLOW_CONFIG['deadline-set'] = [int(1e8), int(5e7), int(2e7)]  # [100ms, 50ms, 20ms]
        config.FLOW_CONFIG['reliability-set'] = [0.5]  # [0.98]
        config.GRAPH_CONFIG['time-granularity'] = TIME_GRANULARITY.NS
        config.GRAPH_CONFIG['all-bandwidth'] = 1  # 500Mbps
        config.GRAPH_CONFIG['all-propagation-delay'] = 0  # 1e2 100ns
        config.GRAPH_CONFIG['all-process-delay'] = 0  # 5e3 5us
        config.GRAPH_CONFIG['all-per'] = 0.004  # 0.4%
        config.GRAPH_CONFIG['core-node-num'] = 10
        config.GRAPH_CONFIG['edge-node-num'] = 10
        config.GRAPH_CONFIG['edge-nodes-distribution-degree'] = 6

        # create flows
        self.flows: List[Flow] = [
            Flow(1, int(1e3), int(1e5), 1, [9, 10], 0.5, int(2e7)),  # 125B 100us 20ms
            Flow(2, int(1e3), int(1e5), 2, [1, 10], 0.5, int(2e7)),  # 125B 100us 20ms
            Flow(3, int(1e3), int(1e5), 9, [2, 11], 0.5, int(2e7)),  # 125B 100us 20ms
            Flow(4, int(1.6e3), int(1e5), 10, [1, 2], 0.5, int(5e7)),  # 200B 100us 50ms
            Flow(5, int(2.4e3), int(1e5), 11, [1, 2], 0.5, int(5e7)),  # 300B 100us 50ms
            Flow(6, int(2.4e3), int(1.5e5), 1, [11], 0.5, int(5e7)),  # 300B 150us 50ms
            Flow(7, int(5e3), int(1.5e5), 2, [9, 10], 0.5, int(1e8)),  # 625B 150us 100ms
            Flow(8, int(5e3), int(1.5e5), 9, [2], 0.5, int(1e8)),  # 625B 150us 100ms
            Flow(9, int(1.184e4), int(3e5), 10, [2], 0.5, int(1e8)),  # 1480B 300us 100ms
            Flow(10, int(1.184e4), int(3e5), 11, [1, 2], 0.5, int(1e8)),  # 1480B 300us 100ms
        ]
        # create topology
        edges: List[Tuple[int, int]] = [(1, 3), (2, 4), (3, 4), (3, 5), (3, 6), (4, 5), (5, 6), (5, 7), (6, 8), (7, 8),
                                        (7, 9), (8, 10), (8, 11)]
        # edges: List[Tuple[int, int]] = [(1, 5), (2, 6), (3, 8), (4, 11), (5, 6), (5, 9),
        #                                 (6, 7), (7, 9), (7, 8), (8, 9), (8, 11), (9, 10), (10, 11)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)
Exemplo n.º 9
0
 def test_generate_flow(self):
     import src.config as cf
     cf.FLOW_CONFIG = {
         'flow-num': 5,
         'dest-num-set': [1, 2, 3],
         'period-set': [int(1e6), int(2e6),
                        int(5e5), int(1e7)],
         'size-set': [int(2e4), int(1e5), int(5e4)],
         'reliability-set': [0.97, 0.98, 0.99],
         'deadline-set': [int(1e8), int(5e7), int(2e7)]
     }
     graph: nx.Graph = nx.Graph()
     graph.add_edges_from([(1, 2), (2, 3), (2, 4), (4, 5), (4, 6), (7, 1),
                           (8, 1), (9, 6), (10, 5)])
     TopoGenerator.draw(graph)
     flows: List[Flow] = FlowGenerator.generate_flows(
         edge_nodes=[3, 7, 8, 9, 10], graph=graph)
     for flow in flows:
         logger.info(flow)
    def setUp(self):
        # configuration
        config.FLOW_CONFIG['hyper-period'] = int(3e5)  # [300us]
        config.FLOW_CONFIG['redundancy_degree'] = 2
        config.FLOW_CONFIG['max-hops'] = 8
        config.FLOW_CONFIG['flow-num'] = 10
        config.GRAPH_CONFIG['time-granularity'] = TIME_GRANULARITY.NS
        config.GRAPH_CONFIG['all-bandwidth'] = 1e0  # 500Mbps
        config.GRAPH_CONFIG['all-propagation-delay'] = 1e2
        config.GRAPH_CONFIG['all-process-delay'] = 5e3
        config.GRAPH_CONFIG['all-per'] = 0.004  # 0.4%
        config.XML_CONFIG['enhancement-tsn-switch-enable'] = True

        # create graph
        edges: List[Tuple[int, int]] = [(1, 2), (2, 3), (2, 4), (3, 4), (3, 5),
                                        (4, 5), (3, 8), (5, 6), (5, 7)]
        self.graph: nx.Graph = nx.Graph()
        self.graph.add_edges_from(edges)
        self.graph = self.graph.to_directed()
        TopoGenerator.draw(self.graph)
        # create flows
        self.flows: List[Flow] = [
            Flow(1, int(1e3), int(1e5), 1, [7, 8], 0.5, int(1e8))
        ]
class SimulationTestCase3(unittest.TestCase):
    def setUp(self):
        config.TESTING['round'] = [1, 5]  # [1, 5]
        config.TESTING['flow-size'] = [10, 100]
        config.TESTING['x-axis-gap'] = 5
        config.TESTING['draw-gantt-chart'] = False
        config.OPTIMIZATION['enable'] = True
        config.GRAPH_CONFIG['all-bandwidth'] = 0.5  # 500Mbps
        config.GRAPH_CONFIG['core-node-num'] = 10
        config.GRAPH_CONFIG['edge-node-num'] = 10
        config.GRAPH_CONFIG['topo-strategy'] = [
            {
                'strategy': TOPO_STRATEGY.ER_STRATEGY,
                'type': ErdosRenyiStrategy.ER_TYPE.GNP,
                'n': 10,
                'm': 14,
                'p': 0.2,
            },
            {
                'strategy': TOPO_STRATEGY.BA_STRATEGY,
                'n': 10,
                'm': 2,
            },
            {
                'strategy': TOPO_STRATEGY.RRG_STRATEGY,
                'd': 3,
                'n': 10,
            },
            {
                'strategy': TOPO_STRATEGY.WS_STRATEGY,
                'n': 10,
                'k': 4,
                'p': 1.0,
            },
        ]
        self.topo_generator = TopoGenerator()
        self.tsn_network_factory = TSNNetworkFactory()

    def test_simulation(self):
        for test_round in range(config.TESTING['round'][0],
                                config.TESTING['round'][1] + 1):
            for topo_strategy_entity in config.GRAPH_CONFIG['topo-strategy']:
                topo_strategy: TopoStrategy = TopoStrategyFactory.get_instance(
                    **topo_strategy_entity)
                self.topo_generator.topo_strategy = topo_strategy
                graph: nx.Graph = self.topo_generator.generate_core_topo()
                attached_edge_nodes_num: int = config.GRAPH_CONFIG[
                    'edge-node-num']
                attached_edge_nodes: List[
                    NodeId] = self.topo_generator.attach_edge_nodes(
                        graph, attached_edge_nodes_num)
                self.topo_generator.draw(graph)
                # generate flows
                flows: List[Flow] = FlowGenerator.generate_flows(
                    edge_nodes=attached_edge_nodes,
                    graph=graph,
                    flow_num=config.TESTING['flow-size'][1])
                for i in range(config.TESTING['flow-size'][0],
                               config.TESTING['flow-size'][1] + 1,
                               config.TESTING['x-axis-gap']):
                    # create solver
                    solver: Solver = Solver(
                        nx_graph=graph,
                        flows=None,
                        topo_strategy=topo_strategy_entity['strategy'],
                        routing_strategy=config.
                        GRAPH_CONFIG['routing-strategy'],
                        scheduling_strategy=config.
                        GRAPH_CONFIG['scheduling-strategy'],
                        allocating_strategy=config.
                        GRAPH_CONFIG['allocating-strategy'])
                    solver.add_flows(copy.deepcopy(flows[:i]))
                    # origin method
                    self.solution = solver.generate_init_solution(
                    )  # get initial solution
                    solution_name: str = solver.generate_solution_name(
                        solution=self.solution,
                        prefix='b_fz_t{}_n{}_'.format(
                            test_round, len(self.solution.graph.nodes)))
                    filename: str = os.path.join(config.flow_size_res_dir,
                                                 self.solution.solution_name)
                    solver.analyze(
                        solution=self.solution,
                        target_filename=filename)  # analyze solution
                    self.solution.solution_name = self.generate_solution_filename(
                        anchor='n{}_'.format(len(self.solution.graph.nodes)),
                        addition='f{}_'.format(i))
                    solver.save_solution(filename=self.solution.solution_name)
                    self.generate_test_scenario()  # generate test scenario
                    # optimized method
                    if config.OPTIMIZATION['enable'] is True:
                        self.solution = solver.optimize()  # optimize
                        solution_name: str = solver.generate_solution_name(
                            solution=self.solution,
                            prefix='o_fz_t{}_n{}_'.format(
                                test_round, len(self.solution.graph.nodes)))
                        filename: str = os.path.join(
                            config.flow_size_res_dir,
                            self.solution.solution_name)
                        solver.analyze(solution=self.solution,
                                       target_filename=filename)
                        self.solution.solution_name = self.generate_solution_filename(
                            anchor='n{}_'.format(len(
                                self.solution.graph.nodes)),
                            addition='f{}_'.format(i))
                        solver.save_solution(
                            filename=self.solution.solution_name)
                        self.generate_test_scenario()  # generate test scenario

    def generate_solution_filename(self, anchor: str, addition: str):
        tl: List[str] = list(self.solution.solution_name)
        ti: int = self.solution.solution_name.index(anchor)
        [tl.insert(i + ti, c) for i, c in enumerate(list(addition))]
        return ''.join(tl)

    def generate_test_scenario(self):
        # create tsn network
        tsn_network: TSNNetwork = self.tsn_network_factory.product(
            solution_filename=self.solution.solution_name,
            enhancement_enable=config.
            XML_CONFIG['enhancement-tsn-switch-enable'])
        self.tsn_network = tsn_network
        self.node_edge_mac_info = self.tsn_network_factory.node_edge_mac_info
        # generate configuration file
        ConfigFileGenerator.create_test_scenario(
            tsn_network=self.tsn_network,
            solution=self.solution,
            node_edge_mac_info=self.node_edge_mac_info)