OSDN Git Service

776bf06000ed20585543ab8e6710b06b0ee78643
[ftg/ftg.git] / ftg / grapher.py
1 # vim: tabstop=4 shiftwidth=4 softtabstop=4
2 # -*- coding: utf-8 -*-
3 #
4
5 from ftg.utils.common import CommonUtils
6 from ftg.parser.ovs_flow_dump import OVSFlowDumpParser
7
8
9 class Grapher():
10
11     def __init__(self, util, dump_file, formatter):
12         self.util = util
13         self.dump_file = dump_file
14         self.formatter = formatter
15
16     def run(self):
17         parser = OVSFlowDumpParser(self.util, self.dump_file)
18         parser.parse()
19         tables = parser.get_tables()
20         self.formatter.set_tables(tables)
21         for formatted_line in self.formatter.format():
22             print formatted_line
23
24 #         for action in self.actions:
25 #             action_title = "ACTION: " + action
26 #             self.util.message_out("\n" + action_title)
27 #             self.util.message_out("-" * len(action_title))
28 #             action_type = str(self.scenario.get_item(action, "ACTION")).upper()
29 #             action_params = self.scenario.get_items_as_dict(action)
30 #             if action_type == "GENERATE":
31 #                 packet_def_name = str(
32 #                     self.scenario.get_item(action, "PACKET_DEF"))
33 #                 task_runner = PacketGenerator(self.util, self._get_packet_def(
34 #                     packet_def_name), action_params, self.reporter)
35 #             elif action_type == "CAPTURE":
36 #                 task_runner = PacketCapture(
37 #                     self.util, self.packet_templates, action_params, self.reporter)
38 #             elif action_type == "ANALYZE":
39 #                 task_runner = PacketAnalyzer(
40 #                     self.util, self.packet_templates, action_params, self.reporter)
41 #             else:
42 #                 packet_def_name = str(
43 #                     self.scenario.get_item(action, "PACKET_DEF"))
44 #                 task_runner = PacketGenerator(self.util, self._get_packet_def(
45 #                     packet_def_name), action_params, self.reporter)
46 #             task_runner.run()