Exemple #1
0
 def __init__(self, *args, **kwargs):
     self.switches = []
     self.links = []
     super(FTRouter, self).__init__(*args, **kwargs)
     self.topo_net = topo.Fattree(4)
     self.ip_to_id, self.id_to_ip = self.create_mappings()
     self.core_switches_routing_table = {}
     self.routing_table_prefixes = {}
     self.routing_table_suffixes = {}
     self.create_2_way_routing_table()
     self.mac_to_port = {}
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(FTRouter, self).__init__(*args, **kwargs)
        self.topo_net = topo.Fattree(4)
        self.k = 4

        # Initialize mac address table
        self.mac_to_port = {}

        # Initialize arp table
        self.arp_table = {}
        self.sw = {}
    def __init__(self, *args, **kwargs):
        super(SPRouter, self).__init__(*args, **kwargs)
        self.topo_raw_switches = []
        self.topo_raw_links = []
        self.switches = []
        self.switches_links = []
        self.datapath_list = []
        self.mac_to_port = {}
        self.fat_tree_topo = topo.Fattree(4)
        self.ip_to_id, self.id_to_ip = self.create_mappings()
        self.shortest_paths_for_all_nodes = self.calculate_all_shortest_path_routs_for_servers(
        )

        self.adjacency = collections.defaultdict(
            lambda: collections.defaultdict(lambda: None))
Exemple #4
0
    def __init__(self, *args, **kwargs):
        super(SPRouter, self).__init__(*args, **kwargs)
        self.topo_net = topo.Fattree(4)

        # Used for learning switch functioning
        self.mac_to_port = {}

        # arp table
        self.arp_table = {}
        self.sw = {}

        self.shortest_path_dict = default_dict()

        # calculate shortest paths between all server pairs
        self.servers = self.topo_net.servers
        self.switches = self.topo_net.switches

        self.dijkstra_table, self.n_servers = dijkstra.dijkstra_shortest_path(
            self.servers, self.switches)
Exemple #5
0
def main(argv):

    # no argument executes default case for fig 1.c
    if not argv:
        num_servers = 686
        num_switches = 858  #245
        num_ports = 14

        total_pathlen_distr_Jelly = defaultdict(lambda: 0)
        total_pathlen_distr_Fat = defaultdict(lambda: 0)
        total_pairs = 0

        # run jellyfish topology for for 10 iterations
        iterations = 10
        for i in range(iterations):
            print(f'Iteration {i+1} / {iterations}', end='\r')

            # run jellyfish topo
            jellyfish_topo = topo.Jellyfish(num_servers, num_switches,
                                            num_ports)

            # jellyfish topo's servers and switches
            servers = jellyfish_topo.servers
            switches = jellyfish_topo.switches

            # run dijkstra's algorithm on both topos
            dijkstra_table = dijkstra.dijkstra_shortest_path(servers, switches)

            # calculate dict['pathlength between servers']['amount of occurences'], num_pairs = total number of server pairs
            length_distr, num_pairs = pathlength_distribution(dijkstra_table)

            for path_len in length_distr.keys():
                total_pathlen_distr_Jelly[path_len] += length_distr[path_len]

            total_pairs += num_pairs

        # average over all iterarions
        for distance in total_pathlen_distr_Jelly.keys():
            total_pathlen_distr_Jelly[distance] /= total_pairs

        # run fattree topology for 1 iteration
        topology = topo.Fattree(num_ports)

        servers = topology.servers
        switches = topology.switches

        dijkstra_table = dijkstra.dijkstra_shortest_path(servers, switches)
        length_distr, num_pairs = pathlength_distribution(dijkstra_table)

        for path_len in length_distr.keys():
            total_pathlen_distr_Fat[path_len] += length_distr[path_len]

        total_pairs += num_pairs

        # average results
        for distance in total_pathlen_distr_Fat.keys():
            total_pathlen_distr_Fat[distance] /= total_pairs

        # plot figure 1.c
        plot_figure_9c([total_pathlen_distr_Jelly, total_pathlen_distr_Fat],
                       num_servers, num_switches, num_ports, iterations)

    # else if argumetns are given, execute custom
    else:
        network_report = False
        dijkstra_report = False

        run_both = False

        # individually test jellyfish or fattree topology
        try:

            if argv[0] == 'fattree' and bool(type(int(argv[1])) == type(0)):
                num_ports = int(argv[1])
                iterations = 1

                # optional report settings
                if len(argv) == 3:

                    if argv[2] == '-dr':
                        dijkstra_report = True

                    elif argv[2] == '-fr':
                        network_report = True
                        dijkstra_report = True

                    elif argv[2] == '-nr':
                        network_report = True

            elif argv[0] == 'jellyfish' and all(
                [bool(type(int(arg)) == type(0)) for arg in argv[1:4]]):

                num_servers = int(argv[1])
                num_switches = int(argv[2])
                num_ports = int(argv[3])

                # set amount of iterations for jellyfish
                if argv[0] == 'jellyfish' and argv[-2] == '-i' and bool(
                        type(int(argv[-1])) == type(0)):
                    iterations = int(argv[-1])

                else:
                    iterations = 1

                # optional report settings
                if len(argv) == 5 or len(argv) == 7:

                    if argv[4] == '-dr':
                        dijkstra_report = True

                    elif argv[4] == '-fr':
                        network_report = True
                        dijkstra_report = True

                    elif argv[4] == '-nr':
                        network_report = True

            elif all([bool(type(int(arg)) == type(0)) for arg in argv[0:3]]):

                num_servers = int(argv[0])
                num_switches = int(argv[1])
                num_ports = int(argv[2])

                iterations = 1

                if len(argv) > 3:

                    if argv[3] == '-i' and bool(type(int(argv[4])) == type(0)):

                        iterations = int(argv[4])

            total_pathlen_distr = defaultdict(lambda: 0)
            total_pairs = 0

            for i in range(iterations):
                print(f'Iteration {i + 1} / {iterations}', end='\r')

                # build the topo and save the servers and switches
                if argv[0] == 'jellyfish':
                    jellyfish = topo.Jellyfish(num_servers,
                                               num_switches,
                                               num_ports,
                                               network_report=network_report)
                    servers = jellyfish.servers
                    switches = jellyfish.switches
                elif argv[0] == 'fattree':
                    fattree = topo.Fattree(num_ports,
                                           network_report=network_report)
                    servers = fattree.servers
                    switches = fattree.switches
                else:
                    run_both = True

                    jellyfish = topo.Jellyfish(num_servers,
                                               num_switches,
                                               num_ports,
                                               network_report=network_report)
                    servers = jellyfish.servers
                    switches = jellyfish.switches

                dijkstra_table = dijkstra.dijkstra_shortest_path(
                    servers, switches, report=dijkstra_report)
                length_distr, num_pairs = pathlength_distribution(
                    dijkstra_table)

                for path_len in length_distr.keys():
                    # print(path_len, total_pathlen_distr[path_len])
                    total_pathlen_distr[path_len] += length_distr[path_len]

                total_pairs += num_pairs

            # average results
            for distance in total_pathlen_distr.keys():
                total_pathlen_distr[distance] /= total_pairs

            if not run_both:
                num_servers = len(servers)
                num_switches = len(switches)

                plot_figure_9c([total_pathlen_distr], num_servers,
                               num_switches, num_ports, iterations)
            else:
                total_pathlen_distr_Jelly = total_pathlen_distr
                total_pathlen_distr_Fat = defaultdict(lambda: 0)

                # run fattree topology for 1 iteration
                topology = topo.Fattree(num_ports)

                servers = topology.servers
                switches = topology.switches

                dijkstra_table = dijkstra.dijkstra_shortest_path(
                    servers, switches)
                length_distr, num_pairs = pathlength_distribution(
                    dijkstra_table)

                for path_len in length_distr.keys():
                    total_pathlen_distr_Fat[path_len] += length_distr[path_len]

                total_pairs += num_pairs

                # average results
                for distance in total_pathlen_distr_Fat.keys():
                    total_pathlen_distr_Fat[distance] /= total_pairs

                # plot figure 1.c
                plot_figure_9c(
                    [total_pathlen_distr_Jelly, total_pathlen_distr_Fat],
                    num_servers, num_switches, num_ports, iterations)

        except:
            raise ValueError(
                'Usage: $ python topo.py (topo_type) num_servers num_switches num_ports (-report) (-iterations N'
            )

def make_mininet_instance(graph_topo):
    net_topo = FattreeNet(graph_topo)
    net = Mininet(topo=net_topo, controller=None, autoSetMacs=True)
    net.addController('c0',
                      controller=RemoteController,
                      ip="127.0.0.1",
                      port=6653)
    return net


def run(graph_topo):

    # Run the Mininet CLI with a given topology
    lg.setLogLevel('info')
    mininet.clean.cleanup()
    net = make_mininet_instance(graph_topo)

    info('*** Starting network ***\n')
    net.start()
    info('*** Running CLI ***\n')
    script = 'performence.sh'
    CLI(net, script=script)
    CLI(net)
    info('*** Stopping network ***\n')
    net.stop()


ft_topo = topo.Fattree(4)
run(ft_topo)
# Copyright 2020 Lin Wang

# This code is part of the Advanced Computer Networks (2020) course at Vrije
# Universiteit Amsterdam.

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at

#   http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import topo

# Same setup for Jellyfish and Fattree
num_servers = 686
num_switches = 245
num_ports = 14

ft_topo = topo.Fattree(num_ports)
jf_topo = topo.Jellyfish(num_servers, num_switches, num_ports)

# TODO: code for reproducing Figure 1(c) in the jellyfish paper


Exemple #8
0
 def __init__(self, *args, **kwargs):
     super(FTRouter, self).__init__(*args, **kwargs)
     self.topo_net = topo.Fattree(4)
     self.core_list=["10","11","12","13"]
     self.pod_list=["20", "21", "22", "23", "24", "25", "26", "27", "30", "31", "32", "33", "34", "35", "36", "37"]