예제 #1
0
    def __init__(self, *args, **kwargs):
        super(SPIDER, self).__init__(*args, **kwargs)

        results_hash = SPIDER_parser.md5sum_results()
        if SPIDER_parser.network_has_changed(results_hash):
            SPIDER_parser.erase_figs_folder()

        (self.requests,
         self.faults) = SPIDER_parser.parse_ampl_results_if_not_cached()

        print len(self.requests), 'requests loaded'
        print len(self.faults), 'faults loaded'

        print "Building network graph from network.xml..."
        # G is a NetworkX Graph object
        (self.G, self.pos, self.hosts, self.switches,
         self.mapping) = SPIDER_parser.parse_network_xml()
        print 'Network has', len(
            self.switches), 'switches,', self.G.number_of_edges() - len(
                self.hosts), 'links and', len(self.hosts), 'hosts'

        print "NetworkX to Mininet topology conversion..."
        # mn_topo is a Mininet Topo object
        self.mn_topo = SPIDER_parser.networkx_to_mininet_topo(
            self.G, self.hosts, self.switches, self.mapping)
        # mn_net is a Mininet object
        self.mn_net = SPIDER_parser.create_mininet_net(self.mn_topo)

        SPIDER_parser.launch_mininet(self.mn_net)

        self.ports_dict = SPIDER_parser.adapt_mn_topo_ports_to_old_API(
            self.mn_topo.ports)

        SPIDER_parser.mn_setup_MAC_and_IP(self.mn_net)

        SPIDER_parser.mn_setup_static_ARP_entries(self.mn_net)

        SPIDER_parser.draw_network_topology(self.G, self.pos, self.ports_dict,
                                            self.hosts)

        (self.fault_ID, self.flow_entries_dict,
         self.flow_entries_with_detection_timeouts_dict,
         self.flow_entries_with_flowlet_timeouts_dict
         ) = SPIDER_parser.generate_flow_entries_dict(
             self.requests,
             self.faults,
             self.ports_dict,
             match_flow=SPIDER_parser.get_mac_match_mininet,
             check_cache=True,
             dpctl_script=True)

        #SPIDER_parser.print_flow_stats(SPIDER_parser.get_flow_stats_dict(self.flow_entries_dict))

        # Associates dp_id to datapath object
        self.dp_dictionary = dict()
        # Associates dp_id to a dict associating port<->MAC address
        self.ports_mac_dict = dict()

        # Needed by SPIDER_ctrl_REST
        self.SPIDER_parser = SPIDER_parser
예제 #2
0
    def __init__(self, *args, **kwargs):
        super(OpenStateFaultTolerance, self).__init__(*args, **kwargs)

        delta_6 = float(os.environ['delta_6'])
        delta_7 = float(os.environ['delta_7'])
        delta_5 = float(os.environ['delta_5'])
        f_t_parser.detection_timeouts_list = [(delta_6,delta_7,delta_5)]

        self.REALIZATIONS_NUM = int(os.environ['REALIZATIONS_NUM'])

        results_hash = f_t_parser.md5sum_results()
        if f_t_parser.network_has_changed(results_hash):
            f_t_parser.erase_figs_folder()

        (self.requests,self.faults) = f_t_parser.parse_ampl_results_if_not_cached()

        print len(self.requests), 'requests loaded'
        print len(self.faults), 'faults loaded'

        print "Building network graph from network.xml..."
        # G is a NetworkX Graph object
        (self.G, self.pos, self.hosts, self.switches, self.mapping) = f_t_parser.parse_network_xml()
        print 'Network has', len(self.switches), 'switches,', self.G.number_of_edges()-len(self.hosts), 'links and', len(self.hosts), 'hosts'

        print "NetworkX to Mininet topology conversion..."
        # mn_topo is a Mininet Topo object
        self.mn_topo = f_t_parser.networkx_to_mininet_topo(self.G, self.hosts, self.switches, self.mapping)
        # mn_net is a Mininet object
        self.mn_net = f_t_parser.create_mininet_net(self.mn_topo)

        f_t_parser.launch_mininet(self.mn_net)

        self.ports_dict = f_t_parser.adapt_mn_topo_ports_to_old_API(self.mn_topo.ports)

        f_t_parser.mn_setup_MAC_and_IP(self.mn_net)

        f_t_parser.mn_setup_static_ARP_entries(self.mn_net)

        f_t_parser.draw_network_topology(self.G,self.pos,self.ports_dict,self.hosts)

        (self.fault_ID, self.flow_entries_dict, self.flow_entries_with_timeout_dict, self.flow_entries_with_burst_dict) = f_t_parser.generate_flow_entries_dict(self.requests,self.faults,self.ports_dict,match_flow=f_t_parser.get_mac_match_mininet,check_cache=False)

        # Associates dp_id to datapath object
        self.dp_dictionary=dict()
        # Associates dp_id to a dict associating port<->MAC address
        self.ports_mac_dict=dict()

        # Needed by fault_tolerance_rest
        self.f_t_parser = f_t_parser

        # switch counter
        self.switch_count = 0
예제 #3
0
    def __init__(self, *args, **kwargs):
        super(SPIDER, self).__init__(*args, **kwargs)

        results_hash = SPIDER_parser.md5sum_results()
        if SPIDER_parser.network_has_changed(results_hash):
            SPIDER_parser.erase_figs_folder()

        (self.requests,self.faults) = SPIDER_parser.parse_ampl_results_if_not_cached()

        print len(self.requests), 'requests loaded'
        print len(self.faults), 'faults loaded'

        print "Building network graph from network.xml..."
        # G is a NetworkX Graph object
        (self.G, self.pos, self.hosts, self.switches, self.mapping) = SPIDER_parser.parse_network_xml()
        print 'Network has', len(self.switches), 'switches,', self.G.number_of_edges()-len(self.hosts), 'links and', len(self.hosts), 'hosts'

        print "NetworkX to Mininet topology conversion..."
        # mn_topo is a Mininet Topo object
        self.mn_topo = SPIDER_parser.networkx_to_mininet_topo(self.G, self.hosts, self.switches, self.mapping)
        # mn_net is a Mininet object
        self.mn_net = SPIDER_parser.create_mininet_net(self.mn_topo)

        SPIDER_parser.launch_mininet(self.mn_net)

        self.ports_dict = SPIDER_parser.adapt_mn_topo_ports_to_old_API(self.mn_topo.ports)

        SPIDER_parser.mn_setup_MAC_and_IP(self.mn_net)

        SPIDER_parser.mn_setup_static_ARP_entries(self.mn_net)

        SPIDER_parser.draw_network_topology(self.G,self.pos,self.ports_dict,self.hosts)

        (self.fault_ID, self.flow_entries_dict, self.flow_entries_with_detection_timeouts_dict, self.flow_entries_with_flowlet_timeouts_dict) = SPIDER_parser.generate_flow_entries_dict(self.requests,self.faults,self.ports_dict,match_flow=SPIDER_parser.get_mac_match_mininet,check_cache=True,dpctl_script=True)

        #SPIDER_parser.print_flow_stats(SPIDER_parser.get_flow_stats_dict(self.flow_entries_dict))

        # Associates dp_id to datapath object
        self.dp_dictionary=dict()
        # Associates dp_id to a dict associating port<->MAC address
        self.ports_mac_dict=dict()

        # Needed by SPIDER_ctrl_REST
        self.SPIDER_parser = SPIDER_parser
예제 #4
0
    def __init__(self, *args, **kwargs):
        super(OpenStateFaultTolerance, self).__init__(*args, **kwargs)

        DELTA_6_VALUES = eval(
            os.environ['DELTA_6_VALUES'])  # ugly and dangerous!
        delta_7 = float(os.environ['delta_7'])
        delta_5 = float(os.environ['delta_5'])
        f_t_parser.detection_timeouts_list = [(x, delta_7, delta_5)
                                              for x in DELTA_6_VALUES]

        results_hash = f_t_parser.md5sum_results()
        if f_t_parser.network_has_changed(results_hash):
            f_t_parser.erase_figs_folder()

        (self.requests,
         self.faults) = f_t_parser.parse_ampl_results_if_not_cached()

        print len(self.requests), 'requests loaded'
        print len(self.faults), 'faults loaded'

        print "Building network graph from network.xml..."
        # G is a NetworkX Graph object
        (self.G, self.pos, self.hosts, self.switches,
         self.mapping) = f_t_parser.parse_network_xml()
        print 'Network has', len(
            self.switches), 'switches,', self.G.number_of_edges() - len(
                self.hosts), 'links and', len(self.hosts), 'hosts'

        print "NetworkX to Mininet topology conversion..."
        # mn_topo is a Mininet Topo object
        self.mn_topo = f_t_parser.networkx_to_mininet_topo(
            self.G, self.hosts, self.switches, self.mapping)
        # mn_net is a Mininet object
        self.mn_net = f_t_parser.create_mininet_net(self.mn_topo)

        f_t_parser.launch_mininet(self.mn_net)

        self.ports_dict = f_t_parser.adapt_mn_topo_ports_to_old_API(
            self.mn_topo.ports)

        f_t_parser.mn_setup_MAC_and_IP(self.mn_net)

        f_t_parser.mn_setup_static_ARP_entries(self.mn_net)

        f_t_parser.draw_network_topology(self.G, self.pos, self.ports_dict,
                                         self.hosts)

        (self.fault_ID, self.flow_entries_dict,
         self.flow_entries_with_timeout_dict, self.flow_entries_with_burst_dict
         ) = f_t_parser.generate_flow_entries_dict(
             self.requests,
             self.faults,
             self.ports_dict,
             match_flow=f_t_parser.get_mac_match_mininet,
             check_cache=False)

        # Associates dp_id to datapath object
        self.dp_dictionary = dict()
        # Associates dp_id to a dict associating port<->MAC address
        self.ports_mac_dict = dict()

        # Needed by fault_tolerance_rest
        self.f_t_parser = f_t_parser

        # switch counter
        self.switch_count = 0