예제 #1
0
 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'
     })
예제 #2
0
 def setUpClass(cls):
     cls.topo = fnss.glp_topology(n=100, m=1, m0=10, p=0.2, beta=-2, seed=1)
     fnss.set_capacities_random_uniform(cls.topo, [10, 20, 40])
     odd_links = [(u, v) for (u, v) in cls.topo.edges() if (u + v) % 2 == 1]
     even_links = [(u, v) for (u, v) in cls.topo.edges()
                   if (u + v) % 2 == 0]
     fnss.set_delays_constant(cls.topo, 2, 'ms', odd_links)
     fnss.set_delays_constant(cls.topo, 5, 'ms', even_links)
     cls.capacities = [12, 25, 489, 1091]
예제 #3
0
 def test_glp_topology(self):
     self.assertRaises(ValueError, fnss.glp_topology, 0, 20, 30, 0.4, -0.5)
     self.assertRaises(ValueError, fnss.glp_topology, 100, 30, 20, 0.4, -0.5)
     self.assertRaises(ValueError, fnss.glp_topology, 0, 30, 20, -1, -0.5)
     self.assertRaises(ValueError, fnss.glp_topology, 0, 30, 20, 0.2, -2)
     self.assertRaises(ValueError, fnss.glp_topology, 20, 11, 16, -0.5, 0.5)
     self.assertRaises(ValueError, fnss.glp_topology, 20, 11, 16, 1.5, 0.5)
     topology = fnss.glp_topology(20, 11, 16, 0.5, 0.5)
     self.assertEqual(20, topology.number_of_nodes())
예제 #4
0
 def setUpClass(cls):
     # specifying the seeds make the topology generation deterministic
     # GLP topology has been chosen because it is always connected and
     # these parameters given a topology with large diameter and variety
     # of degrees
     # 50 nodes has been chosen because eigenvector centrality tests would
     # require considerably more time
     cls.topo = fnss.glp_topology(n=50, m=1, m0=10, p=0.2, beta=-2, seed=1)
     cls.capacities = [12, 25, 489, 1091]
예제 #5
0
 def setUpClass(cls):
     # specifying the seeds make the topology generation deterministic
     # GLP topology has been chosen because it is always connected and 
     # these parameters given a topology with large diameter and variety
     # of degrees
     # 50 nodes has been chosen because eigenvector centrality tests would
     # require considerably more time
     cls.topo = fnss.glp_topology(n=50, m=1, m0=10, p=0.2, beta=-2, seed=1)
     cls.capacities = [12, 25, 489, 1091]
예제 #6
0
 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')
예제 #7
0
파일: test_buffers.py 프로젝트: fnss/fnss
 def setUpClass(cls):
     cls.topo = fnss.glp_topology(n=100, m=1, m0=10, p=0.2, beta=-2, seed=1)
     fnss.set_capacities_random_uniform(cls.topo, [10, 20, 40])
     odd_links = [(u, v) for (u, v) in cls.topo.edges()
                  if (u + v) % 2 == 1]
     even_links = [(u, v) for (u, v) in cls.topo.edges()
                   if (u + v) % 2 == 0]
     fnss.set_delays_constant(cls.topo, 2, 'ms', odd_links)
     fnss.set_delays_constant(cls.topo, 5, 'ms', even_links)
     cls.capacities = [12, 25, 489, 1091]
예제 #8
0
 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'})
예제 #9
0
 def test_glp_topology_zero_seed(self):
     a = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=0)
     b = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=0)
     self.assertEqual(set(a.edges()), set(b.edges()))
예제 #10
0
 def test_glp_topology_constant_seed(self):
     a = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=1)
     b = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=2)
     c = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=1)
     self.assertEqual(set(a.edges()), set(c.edges()))
     self.assertNotEqual(set(a.edges()), set(b.edges()))
예제 #11
0
 def test_glp_topology_zero_seed(self):
     a = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=0)
     b = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=0)
     self.assertEqual(set(a.edges()), set(b.edges()))
예제 #12
0
 def test_glp_topology_constant_seed(self):
     a = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=1)
     b = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=2)
     c = fnss.glp_topology(100, 15, 20, 0.5, 0.5, seed=1)
     self.assertEqual(set(a.edges()), set(c.edges()))
     self.assertNotEqual(set(a.edges()), set(b.edges()))
예제 #13
0
 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')