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_capacities_random(self): self.assertRaises(ValueError, fnss.set_capacities_random, self.topo, {10: 0.3, 20: 0.5}) self.assertRaises(ValueError, fnss.set_capacities_random, self.topo, {10: 0.3, 20: 0.8}) fnss.set_capacities_random(self.topo, {10: 0.3, 20: 0.7}) self.assertTrue(all(self.topo.edge[u][v]['capacity'] in (10, 20) for (u, v) in self.topo.edges_iter()))
def setUpClass(cls): # set up topology used for all traffic matrix tests cls.G = fnss.glp_topology(n=30, 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')
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=30, 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')