def __init__(self, topo_file, latency_file): "Create custom topo." # Initialize topology BaseTopo.__init__(self) topo_matrix = read_matrix_from_file(topo_file, int) latency_matrix = read_matrix_from_file(latency_file, float) length = len(topo_matrix) # Add hosts and switches hs = [None] ss = [None] for i in range(0, length): hs.append(self.addHost(BaseTopo.get_host_name(i + 1))) ss.append(self.addSwitch(BaseTopo.get_switch_name(i + 1))) # Add links for i in range(0, length): self.addLink(hs[i + 1], ss[i + 1]) for i in range(0, length): for j in range(i, length): if latency_matrix[i][j] != 0: self.addLink(ss[i + 1], ss[j + 1], delay=latency_matrix[i][j], loss=0)
def __init__(self): "Create custom topo." # Initialize topology BaseTopo.__init__(self) # Add hosts and switches hs = [None] ss = [None] for i in xrange(1, 13): hs.append(self.addHost(BaseTopo.get_host_name(i))) ss.append(self.addSwitch(BaseTopo.get_switch_name(i))) # Add links for i in xrange(1, 13): self.addLink(hs[i], ss[i]) self.addLink(ss[1], ss[2], delay='3.98ms', loss=0) self.addLink(ss[1], ss[3], delay='52.1ms', loss=0) self.addLink(ss[2], ss[5], delay='57.33ms', loss=0) self.addLink(ss[3], ss[4], delay='16ms', loss=0) self.addLink(ss[3], ss[6], delay='13.93ms', loss=0) self.addLink(ss[4], ss[5], delay='5.77ms', loss=0) self.addLink(ss[4], ss[7], delay='14.74ms', loss=0) self.addLink(ss[4], ss[8], delay='2.39ms', loss=0) self.addLink(ss[5], ss[6], delay='7.44ms', loss=0) self.addLink(ss[6], ss[7], delay='10.82ms', loss=0) self.addLink(ss[6], ss[8], delay='8.89ms', loss=0) self.addLink(ss[7], ss[8], delay='17.01ms', loss=0) self.addLink(ss[7], ss[11], delay='41.82ms', loss=0) self.addLink(ss[8], ss[10], delay='33.95ms', loss=0) self.addLink(ss[9], ss[10], delay='4.76ms', loss=0) self.addLink(ss[9], ss[11], delay='5.07ms', loss=0) self.addLink(ss[10], ss[11], delay='1.87ms', loss=0) self.addLink(ss[10], ss[12], delay='9.61ms', loss=0) self.addLink(ss[11], ss[12], delay='7.86ms', loss=0)
def __init__(self): "Create custom topo." # Initialize topology BaseTopo.__init__(self) # Add hosts and switches hs = [None] ss = [None] for i in xrange(1, 17): hs.append(self.addHost(BaseTopo.get_host_name(i))) ss.append(self.addSwitch(BaseTopo.get_switch_name(i))) # Add links for i in xrange(1, 17): self.addLink(hs[i], ss[i]) self.addLink(ss[1], ss[2], delay='5.69ms', loss=0) self.addLink(ss[1], ss[4], delay='5.55ms', loss=0) self.addLink(ss[1], ss[11], delay='17.32ms', loss=0) #ss[13]) self.addLink(ss[2], ss[3], delay='12.63ms', loss=0) self.addLink(ss[2], ss[4], delay='4.68ms', loss=0) self.addLink(ss[3], ss[4], delay='10.08ms', loss=0) self.addLink(ss[3], ss[6], delay='12.66ms', loss=0) self.addLink(ss[4], ss[5], delay='5.83ms', loss=0) self.addLink(ss[5], ss[6], delay='8.76ms', loss=0) self.addLink(ss[5], ss[7], delay='4.65ms', loss=0) self.addLink(ss[6], ss[8], delay='12.67ms', loss=0) self.addLink(ss[7], ss[8], delay='2.39ms', loss=0) self.addLink(ss[7], ss[10], delay='7.32ms', loss=0) self.addLink(ss[8], ss[9], delay='2.76ms', loss=0) self.addLink(ss[8], ss[16], delay='6.54ms', loss=0) #ss[18]) self.addLink(ss[9], ss[10], delay='3.42ms', loss=0) self.addLink(ss[9], ss[15], delay='8.03ms', loss=0) #ss[17]) self.addLink(ss[10], ss[11], delay='4.45ms', loss=0) #self.addLink(ss[10], ss[12]) #self.addLink(ss[11], ss[12]) #self.addLink(ss[11], ss[14]) #self.addLink(ss[12], ss[13]) self.addLink(ss[10], ss[12], delay='3.66ms', loss=0) # self.addLink(ss[10], ss[11], delay='0.91ms', loss=0) # self.addLink(ss[14], ss[15]) # self.addLink(ss[14], ss[16]) # self.addLink(ss[15], ss[16]) # self.addLink(ss[16], ss[17]) # self.addLink(ss[17], ss[18]) self.addLink(ss[12], ss[13], delay='1.46ms', loss=0) self.addLink(ss[12], ss[14], delay='2.55ms', loss=0) self.addLink(ss[13], ss[14], delay='2.69ms', loss=0) self.addLink(ss[14], ss[15], delay='3.78ms', loss=0) self.addLink(ss[15], ss[16], delay='5.24ms', loss=0)
def __init__(self): "Create custom topo." # Initialize topology BaseTopo.__init__(self) # Add hosts and switches leftHost = self.addHost('h1') rightHost = self.addHost('h2') s1 = self.addSwitch(BaseTopo.get_switch_name(1)) s2 = self.addSwitch(BaseTopo.get_switch_name(2)) s3 = self.addSwitch(BaseTopo.get_switch_name(3)) # Add links self.addLink(leftHost, s1) self.addLink(rightHost, s2) self.addLink(s1, s2, delay='5.09ms', loss=0) self.addLink(s1, s3, delay='1.12ms', loss=0) self.addLink(s2, s3, delay='3.63ms', loss=0)
def __init__(self): "Create custom topo." # Initialize topology BaseTopo.__init__(self) # Add hosts and switches hs = [None] ss = [None] for i in xrange(1, 8): hs.append(self.addHost(BaseTopo.get_host_name(i))) ss.append(self.addSwitch(BaseTopo.get_switch_name(i))) # Add links for i in xrange(1, 8): self.addLink(hs[i], ss[i]) self.addLink(ss[1], ss[2], delay='1ms', loss=0) self.addLink(ss[2], ss[3], delay='1ms', loss=0) self.addLink(ss[2], ss[6], delay='1ms', loss=0) self.addLink(ss[3], ss[4], delay='1ms', loss=0) self.addLink(ss[3], ss[6], delay='1ms', loss=0) self.addLink(ss[3], ss[7], delay='1ms', loss=0) self.addLink(ss[4], ss[5], delay='1ms', loss=0) self.addLink(ss[4], ss[7], delay='1ms', loss=0)
def __init__( self ): "Create custom topo." # Initialize topology BaseTopo.__init__( self ) # Add hosts and switches hs = [None] ss = [None] # node_count = len(rf_topo.graph.nodes()) for i in xrange(1, 23): hs.append(self.addHost(BaseTopo.get_host_name(i))) ss.append(self.addSwitch(BaseTopo.get_switch_name(i))) # Add links for i in xrange(1, 23): self.addLink(hs[i], ss[i]) self.addLink(ss[11], ss[18], delay='2ms', loss=0) self.addLink(ss[19], ss[20], delay='2ms', loss=0) self.addLink(ss[6], ss[9], delay='11ms', loss=0) self.addLink(ss[7], ss[8], delay='3ms', loss=0) self.addLink(ss[7], ss[11], delay='21ms', loss=0) self.addLink(ss[11], ss[19], delay='2ms', loss=0) self.addLink(ss[5], ss[6], delay='7ms', loss=0) self.addLink(ss[12], ss[22], delay='40ms', loss=0) self.addLink(ss[1], ss[2], delay='3ms', loss=0) self.addLink(ss[2], ss[13], delay='5ms', loss=0) self.addLink(ss[8], ss[9], delay='3ms', loss=0) self.addLink(ss[9], ss[10], delay='6ms', loss=0) self.addLink(ss[3], ss[13], delay='6ms', loss=0) self.addLink(ss[7], ss[15], delay='3ms', loss=0) self.addLink(ss[21], ss[22], delay='40ms', loss=0) self.addLink(ss[11], ss[20], delay='2ms', loss=0) self.addLink(ss[3], ss[8], delay='29ms', loss=0) self.addLink(ss[6], ss[11], delay='13ms', loss=0) self.addLink(ss[5], ss[7], delay='6ms', loss=0) self.addLink(ss[11], ss[21], delay='2ms', loss=0) self.addLink(ss[1], ss[3], delay='3ms', loss=0) self.addLink(ss[2], ss[4], delay='4ms', loss=0) self.addLink(ss[9], ss[14], delay='37ms', loss=0) self.addLink(ss[5], ss[9], delay='6ms', loss=0) self.addLink(ss[3], ss[9], delay='31ms', loss=0) self.addLink(ss[11], ss[16], delay='20ms', loss=0) self.addLink(ss[8], ss[12], delay='21ms', loss=0) self.addLink(ss[9], ss[11], delay='21ms', loss=0) self.addLink(ss[10], ss[12], delay='15ms', loss=0) self.addLink(ss[3], ss[4], delay='3ms', loss=0) self.addLink(ss[7], ss[9], delay='2ms', loss=0) self.addLink(ss[11], ss[17], delay='4ms', loss=0) self.addLink(ss[6], ss[10], delay='8ms', loss=0) self.addLink(ss[5], ss[8], delay='8ms', loss=0) self.addLink(ss[11], ss[12], delay='7ms', loss=0) self.addLink(ss[1], ss[4], delay='4ms', loss=0) self.addLink(ss[9], ss[15], delay='3ms', loss=0) self.addLink(ss[2], ss[14], delay='5ms', loss=0) self.addLink(ss[9], ss[12], delay='20ms', loss=0) self.addLink(ss[3], ss[11], delay='45ms', loss=0) self.addLink(ss[10], ss[11], delay='16ms', loss=0) self.addLink(ss[8], ss[10], delay='7ms', loss=0) self.addLink(ss[4], ss[9], delay='32ms', loss=0)