Exemplo n.º 1
0
 def test_cluster_const(self):
     n_clusters = 2
     cache_budget = 60
     cacheplacement.clustered_hashrouting_cache_placement(
         self.topo, cache_budget, n_clusters, "cluster_const"
     )
     clusters = self.topo.graph["clusters"]
     assert n_clusters == len(clusters)
     assert len(self.topo.graph["icr_candidates"]) == sum(len(c) for c in clusters)
     for c in clusters:
         if 0 in c:
             assert c == {0, 1, 2}
         elif 7 in c:
             assert c == {3, 4, 5, 6}
     assert self.topo.cache_nodes() == {1: 15, 2: 15, 3: 10, 4: 10, 5: 10}
Exemplo n.º 2
0
 def test_cluster_const(self):
     n_clusters = 2
     cache_budget = 60
     cacheplacement.clustered_hashrouting_cache_placement(self.topo,
                         cache_budget, n_clusters, 'cluster_const')
     clusters = self.topo.graph['clusters']
     self.assertEqual(n_clusters, len(clusters))
     self.assertEquals(len(self.topo.graph['icr_candidates']), sum(len(c) for c in clusters))
     for c in clusters:
         if 0 in c:
             self.assertSetEqual(set([0, 1, 2]), c)
         elif 7 in c:
             self.assertSetEqual(set([3, 4, 5, 6]), c)
     self.assertDictEqual({1: 15, 2: 15, 3: 10, 4: 10, 5: 10},
                          self.topo.cache_nodes())
Exemplo n.º 3
0
 def test_cluster_const(self):
     n_clusters = 2
     cache_budget = 60
     cacheplacement.clustered_hashrouting_cache_placement(self.topo,
                         cache_budget, n_clusters, 'cluster_const')
     clusters = self.topo.graph['clusters']
     self.assertEqual(n_clusters, len(clusters))
     self.assertEqual(len(self.topo.graph['icr_candidates']), sum(len(c) for c in clusters))
     for c in clusters:
         if 0 in c:
             self.assertSetEqual(set([0, 1, 2]), c)
         elif 7 in c:
             self.assertSetEqual(set([3, 4, 5, 6]), c)
     self.assertDictEqual({1: 15, 2: 15, 3: 10, 4: 10, 5: 10},
                          self.topo.cache_nodes())
Exemplo n.º 4
0
 def test_node_const(self):
     n_clusters = 2
     cache_budget = 50
     cacheplacement.clustered_hashrouting_cache_placement(self.topo,
                         cache_budget, n_clusters, 'node_const')
     clusters = self.topo.graph['clusters']
     self.assertEqual(n_clusters, len(clusters))
     self.assertEquals(len(self.topo.graph['icr_candidates']), sum(len(c) for c in clusters))
     for c in clusters:
         if 0 in c:
             self.assertSetEqual(set([0, 1, 2]), c)
         elif 7 in c:
             self.assertSetEqual(set([3, 4, 5, 6]), c)
     cache_size = cache_budget / len(self.topo.cache_nodes())
     self.assertDictEqual({i: cache_size for i in self.topo.cache_nodes()},
                          self.topo.cache_nodes())
Exemplo n.º 5
0
 def test_node_const(self):
     n_clusters = 2
     cache_budget = 50
     cacheplacement.clustered_hashrouting_cache_placement(self.topo,
                         cache_budget, n_clusters, 'node_const')
     clusters = self.topo.graph['clusters']
     self.assertEqual(n_clusters, len(clusters))
     self.assertEqual(len(self.topo.graph['icr_candidates']), sum(len(c) for c in clusters))
     for c in clusters:
         if 0 in c:
             self.assertSetEqual(set([0, 1, 2]), c)
         elif 7 in c:
             self.assertSetEqual(set([3, 4, 5, 6]), c)
     cache_size = cache_budget / len(self.topo.cache_nodes())
     self.assertDictEqual({i: cache_size for i in self.topo.cache_nodes()},
                          self.topo.cache_nodes())
Exemplo n.º 6
0
 def test_cluster_const(self):
     n_clusters = 2
     cache_budget = 60
     cacheplacement.clustered_hashrouting_cache_placement(
         self.topo, cache_budget, n_clusters, 'cluster_const')
     clusters = self.topo.graph['clusters']
     assert n_clusters == len(clusters)
     assert len(self.topo.graph['icr_candidates']) == sum(
         len(c) for c in clusters)
     for c in clusters:
         if 0 in c:
             assert {0, 1, 2} == c
         elif 7 in c:
             assert {3, 4, 5, 6} == c
     assert {1: 15, 2: 15, 3: 10, 4: 10, 5: 10} == \
                          self.topo.cache_nodes()
Exemplo n.º 7
0
 def test_node_const(self):
     n_clusters = 2
     cache_budget = 50
     cacheplacement.clustered_hashrouting_cache_placement(
         self.topo, cache_budget, n_clusters, 'node_const')
     clusters = self.topo.graph['clusters']
     assert n_clusters == len(clusters)
     assert len(self.topo.graph['icr_candidates']) == sum(
         len(c) for c in clusters)
     for c in clusters:
         if 0 in c:
             assert {0, 1, 2} == c
         elif 7 in c:
             assert {3, 4, 5, 6} == c
     cache_size = cache_budget / len(self.topo.cache_nodes())
     assert {i: cache_size for i in self.topo.cache_nodes()} == \
                          self.topo.cache_nodes()
Exemplo n.º 8
0
 def test_node_const(self):
     n_clusters = 2
     cache_budget = 50
     cacheplacement.clustered_hashrouting_cache_placement(
         self.topo, cache_budget, n_clusters, "node_const"
     )
     clusters = self.topo.graph["clusters"]
     assert n_clusters == len(clusters)
     assert len(self.topo.graph["icr_candidates"]) == sum(len(c) for c in clusters)
     for c in clusters:
         if 0 in c:
             assert c == {0, 1, 2}
         elif 7 in c:
             assert c == {3, 4, 5, 6}
     cache_size = cache_budget / len(self.topo.cache_nodes())
     assert self.topo.cache_nodes() == {
         i: cache_size for i in self.topo.cache_nodes()
     }