def setUpClass(cls): # set up topology used for all traffic matrix tests cls.G = fnss.glp_topology(n=50, m=1, m0=10, p=0.2, beta=-2, seed=1) fnss.set_capacities_random(cls.G, { 10: 0.5, 20: 0.3, 40: 0.2 }, capacity_unit='Mbps') fnss.set_delays_constant(cls.G, 2, delay_unit='ms') fnss.set_weights_inverse_capacity(cls.G) for node in [2, 4, 6]: fnss.add_stack(cls.G, node, 'tcp', { 'protocol': 'cubic', 'rcvwnd': 1024 }) for node in [2, 4]: fnss.add_application(cls.G, node, 'client', { 'rate': 100, 'user-agent': 'fnss' }) fnss.add_application(cls.G, 2, 'server', { 'port': 80, 'active': True, 'user-agent': 'fnss' })
def setUpClass(cls): # set up topology used for all traffic matrix tests cls.G = fnss.glp_topology(n=50, m=1, m0=10, p=0.2, beta=-2, seed=1) fnss.set_capacities_random(cls.G, {10: 0.5, 20: 0.3, 40: 0.2}, capacity_unit='Mbps') fnss.set_delays_constant(cls.G, 2, delay_unit='ms') fnss.set_weights_inverse_capacity(cls.G) for node in [2, 4, 6]: fnss.add_stack(cls.G, node, 'tcp', {'protocol': 'cubic', 'rcvwnd': 1024}) for node in [2, 4]: fnss.add_application(cls.G, node, 'client', {'rate': 100, 'user-agent': 'fnss'}) fnss.add_application(cls.G, 2, 'server', {'port': 80, 'active': True, 'user-agent': 'fnss'})
def test_weights_inverse_capacity(self): fnss.set_weights_inverse_capacity(self.topo) self.assertTrue( all(self.topo.adj[u][v]['weight'] in [1, 2] for (u, v) in self.topo.edges()))
def test_weights_inverse_capacity(self): fnss.set_weights_inverse_capacity(self.topo) self.assertTrue(all(self.topo.edge[u][v]['weight'] in [1, 2] for (u, v) in self.topo.edges_iter()))
""" import fnss import random # Import RocketFuel topology # Replace the filename with the actual location of the file you want to parse topology = fnss.parse_rocketfuel_isp_map("rocket-fuel-topo-file.cch") # add capacities capacities = [1, 10, 40] capacity_unit = 'Gbps' fnss.set_capacities_edge_betweenness(topology, capacities, capacity_unit, weighted=False) # add weights proportional to inverse of capacity fnss.set_weights_inverse_capacity(topology) # add constant link delays of 2 ms fnss.set_delays_constant(topology, 2, delay_unit='ms') # generate cyclostationary traffic matrix (period 7 days, 24 samples per day) tmc = fnss.sin_cyclostationary_traffic_matrix( topology, mean=0.5, # average flow in TM is 0,5 Gbps stddev=0.05, # this is the std among average flows of different OD pairs gamma=0.8, # gamma and log_psi are parameters for fitting the std of log_psi=-0.33, # volume fluctuations over time. Look at Nucci et al. paper delta=0.2, # traffic variation from period max and avg as fraction of average n=24, # number of samples per each period periods=7, # number of periods max_u=0.9, # max link utilization desired