Example #1
0
    def build(self, number_of_servers, switch_graph_degree, number_of_links):

        nx_topology = NXTopology(number_of_servers, switch_graph_degree,
                                 number_of_links)

        # create switches
        for n in nx_topology.G.nodes():
            self.addSwitch('s' + str(n + 1), cls=LinuxBridge, stp=1)

        # connect switches to each other

        # for every link (i,j), switch with switch_id=i is connected to port number i of switch with switch_id=j
        for e in nx_topology.G.edges():
            self.addLink('s' + str(e[0] + 1),
                         's' + str(e[1] + 1),
                         e[1] + 1,
                         e[0] + 1,
                         bw=switch_switch_link_bw)

        # create hosts and connect them to ToR switch
        for h in range(nx_topology.number_of_servers):
            self.addHost('h' + str(h))
            self.addLink('h' + str(h),
                         's' + str(nx_topology.get_rack_index(h) + 1),
                         0,
                         nx_topology.number_of_racks + h + 1,
                         bw=switch_host_link_bw)
Example #2
0

# Topology port description:
# Every switch with switch_id=i is connected to host_id by port "number_of_racks + host_id"
#                               is connected to switch j by port "j"

src_dest_to_next_hop = {} # d1 maps (src_switch_id, dest_switch_id, current_switch_id) to [next_switch_id1, next_switch_id2, ...]
host_ip_to_host_name = {} # d2 e.g. maps '10.0.0.1' to 'h0'

######################################### Parameters #########################################
iperf_time = 30 # seconds
switch_switch_link_bw = 400 # Mbps
switch_host_link_bw = 100 # Mbps
r_method = 'ecmp8' # 'ecmp8', 'ecmp64' or '8_shortest'
number_of_tcp_flows = 1 # should be 1 or 8
nx_topology = NXTopology(number_of_servers=3, switch_graph_degree=3, number_of_links=15)
##############################################################################################

# current_switch_id is string, e.g. '5'
# returns int
def get_next_hop(src_ip, dest_ip, src_port, dest_port, current_switch_id,current_port,src_dest_to_next_hop_u,host_ip_to_host_name_u):
    print("host_ip_to_host_name dict: {}".format(host_ip_to_host_name))
    src_host = host_ip_to_host_name_u[src_ip] # host object
    dest_host = host_ip_to_host_name_u[dest_ip] # host object
    src_switch_id = nx_topology.get_rack_index(int(str(src_host)[1:]))+1 # int
    dest_switch_id = nx_topology.get_rack_index(int(str(dest_host)[1:]))+1 # int
    if str(dest_switch_id) == current_switch_id: # destination host is directly connected to current_switch
        return nx_topology.number_of_racks + int(str(dest_host)[1:])+1
    print("src_dest_to_next_hop dict: ",src_dest_to_next_hop_u) 
    next_switch_ids = src_dest_to_next_hop_u[(src_switch_id, dest_switch_id, int(current_switch_id))]
    print("next_switch_ids: ",next_switch_ids)
Example #3
0
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from graph import NXTopology, d_star


y_axis = []
x_axis = list(range(2,10))
for r in np.array(x_axis)/5:
    n = 40
    f = n*10
    t = NXTopology(number_of_servers=f,
                    switch_graph_degree=r, number_of_racks=n)

upper_bound = n * r / (f * d_star(n, r))
Example #4
0
    }, {
        'servers_per_rack': 5,
        'traffic_type': TrafficType.PERMUTATION,
        'label': 'Permutation (5 Servers per switch)',
        'color': 'blue',
        'marker': 'x'
    }]
    number_of_switches = 40
    for i in range(len(parameters)):
        y_axis = []
        for r in x_axis:
            print('r = {}'.format(r))
            number_of_servers = number_of_switches * \
                parameters[i]['servers_per_rack']
            t = NXTopology(number_of_servers=number_of_servers,
                           switch_graph_degree=r,
                           number_of_racks=number_of_switches)
            # print(t.G.edges)
            # print(t.sender_to_receiver)
            Z = t.get_max_min_throughput(parameters[i]['traffic_type'])
            ratio = Z / \
                theoretical_upper_bound(
                    number_of_switches, r, number_of_servers, parameters[i]['traffic_type'])

            y_axis.append(ratio)
            print('ratio = {}'.format(ratio))
        ys.append(y_axis)

    plt.figure()
    for i in range(len(ys)):
        plt.plot(x_axis,
Example #5
0
    plt.plot(x_axis, y_axis1, label='Observed ASPL')
    plt.plot(x_axis, y_axis2, label='ASPL lower-bound')
    plt.xlabel('Network Size')
    plt.ylabel('Path Length')
    plt.legend()
    plt.show()
    plt.savefig('2.svg')
    '''

    # figure 1 b
    y_axis1 = []
    y_axis2 = []
    x_axis = list(range(3, 34, 2))
    for r in x_axis:
        n = 40
        t = NXTopology(number_of_servers=n,
                       switch_graph_degree=r,
                       number_of_racks=n)

        y_axis1.append(t.average_shortest_path_length())
        y_axis2.append(d_star(n, r))

    plt.figure()
    plt.plot(x_axis, y_axis1, label='Observed ASPL')
    plt.plot(x_axis, y_axis2, label='ASPL lower-bound')
    plt.xlabel('Network Degree')
    plt.ylabel('Path Length')
    plt.legend()
    plt.show()
    plt.savefig('3.svg')