aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorCarlo von lynX <lynX@time.to.get.psyced.org>2016-08-06 13:59:03 +0000
committerCarlo von lynX <lynX@time.to.get.psyced.org>2016-08-06 13:59:03 +0000
commitaa317bd7953190ac0b0ceef02ba3f36047982a6c (patch)
tree0be172cac20979e4927a4d181e055ffcc970a207 /src/testbed
parent2506c0b954088dc5f9bf267678de89fe0d4ac53e (diff)
downloadgnunet-aa317bd7953190ac0b0ceef02ba3f36047982a6c.tar.gz
gnunet-aa317bd7953190ac0b0ceef02ba3f36047982a6c.zip
testbed: STAR topology (SCNR)
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/Makefile.am9
-rw-r--r--src/testbed/generate-underlay-topology.c1
-rw-r--r--src/testbed/test_testbed_api_testbed_run_topologystar.conf4
-rw-r--r--src/testbed/testbed_api_topology.c53
4 files changed, 67 insertions, 0 deletions
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index 9c1bfcce6..16fe27fc0 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -142,6 +142,7 @@ check_PROGRAMS = \
142 test_testbed_api_topology_clique \ 142 test_testbed_api_topology_clique \
143 test_testbed_api_testbed_run_topologyrandom \ 143 test_testbed_api_testbed_run_topologyrandom \
144 test_testbed_api_testbed_run_topologyline \ 144 test_testbed_api_testbed_run_topologyline \
145 test_testbed_api_testbed_run_topologystar \
145 test_testbed_api_testbed_run_topologyclique \ 146 test_testbed_api_testbed_run_topologyclique \
146 test_testbed_api_testbed_run_topologyring \ 147 test_testbed_api_testbed_run_topologyring \
147 test_testbed_api_testbed_run_topologysmallworldring \ 148 test_testbed_api_testbed_run_topologysmallworldring \
@@ -176,6 +177,7 @@ if ENABLE_TEST_RUN
176 test_testbed_api_topology_clique \ 177 test_testbed_api_topology_clique \
177 test_testbed_api_testbed_run_topologyrandom \ 178 test_testbed_api_testbed_run_topologyrandom \
178 test_testbed_api_testbed_run_topologyline \ 179 test_testbed_api_testbed_run_topologyline \
180 test_testbed_api_testbed_run_topologystar \
179 test_testbed_api_testbed_run_topologyclique \ 181 test_testbed_api_testbed_run_topologyclique \
180 test_testbed_api_testbed_run_topologyring \ 182 test_testbed_api_testbed_run_topologyring \
181 test_testbed_api_testbed_run_topology2dtorus \ 183 test_testbed_api_testbed_run_topology2dtorus \
@@ -282,6 +284,12 @@ test_testbed_api_testbed_run_topologyline_LDADD = \
282 $(top_builddir)/src/util/libgnunetutil.la \ 284 $(top_builddir)/src/util/libgnunetutil.la \
283 libgnunettestbed.la 285 libgnunettestbed.la
284 286
287test_testbed_api_testbed_run_topologystar_SOURCES = \
288 test_testbed_api_testbed_run.c
289test_testbed_api_testbed_run_topologystar_LDADD = \
290 $(top_builddir)/src/util/libgnunetutil.la \
291 libgnunettestbed.la
292
285test_testbed_api_testbed_run_topologyclique_SOURCES = \ 293test_testbed_api_testbed_run_topologyclique_SOURCES = \
286 test_testbed_api_testbed_run.c 294 test_testbed_api_testbed_run.c
287test_testbed_api_testbed_run_topologyclique_LDADD = \ 295test_testbed_api_testbed_run_topologyclique_LDADD = \
@@ -374,6 +382,7 @@ EXTRA_DIST = \
374 test_testbed_api_test_timeout.conf \ 382 test_testbed_api_test_timeout.conf \
375 test_testbed_api_template.conf \ 383 test_testbed_api_template.conf \
376 test_testbed_api_testbed_run_topologyring.conf \ 384 test_testbed_api_testbed_run_topologyring.conf \
385 test_testbed_api_testbed_run_topologystar.conf \
377 test_testbed_api_testbed_run_topologyclique.conf \ 386 test_testbed_api_testbed_run_topologyclique.conf \
378 test_testbed_api_testbed_run_topologyline.conf \ 387 test_testbed_api_testbed_run_topologyline.conf \
379 test_testbed_api_testbed_run_topologyrandom.conf \ 388 test_testbed_api_testbed_run_topologyrandom.conf \
diff --git a/src/testbed/generate-underlay-topology.c b/src/testbed/generate-underlay-topology.c
index 22fe98e33..36580a2a3 100644
--- a/src/testbed/generate-underlay-topology.c
+++ b/src/testbed/generate-underlay-topology.c
@@ -298,6 +298,7 @@ run (void *cls, char *const *args, const char *cfgfile,
298 { 298 {
299 case GNUNET_TESTBED_TOPOLOGY_LINE: 299 case GNUNET_TESTBED_TOPOLOGY_LINE:
300 case GNUNET_TESTBED_TOPOLOGY_RING: 300 case GNUNET_TESTBED_TOPOLOGY_RING:
301 case GNUNET_TESTBED_TOPOLOGY_STAR:
301 case GNUNET_TESTBED_TOPOLOGY_CLIQUE: 302 case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
302 case GNUNET_TESTBED_TOPOLOGY_2D_TORUS: 303 case GNUNET_TESTBED_TOPOLOGY_2D_TORUS:
303 GNUNET_TESTBED_underlay_construct_ (num_peers, link_processor, NULL, 304 GNUNET_TESTBED_underlay_construct_ (num_peers, link_processor, NULL,
diff --git a/src/testbed/test_testbed_api_testbed_run_topologystar.conf b/src/testbed/test_testbed_api_testbed_run_topologystar.conf
new file mode 100644
index 000000000..13f8d1784
--- /dev/null
+++ b/src/testbed/test_testbed_api_testbed_run_topologystar.conf
@@ -0,0 +1,4 @@
1@INLINE@ test_testbed_api_template.conf
2
3[testbed]
4OVERLAY_TOPOLOGY = STAR
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 1f7d11b27..b7722b9c7 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -286,6 +286,11 @@ const char *topology_strings[] = {
286 "RING", 286 "RING",
287 287
288 /** 288 /**
289 * Star topology. No options.
290 */
291 "STAR",
292
293 /**
289 * 2-d torus. No options. 294 * 2-d torus. No options.
290 */ 295 */
291 "2D_TORUS", 296 "2D_TORUS",
@@ -316,6 +321,11 @@ const char *topology_strings[] = {
316 "LINE", 321 "LINE",
317 322
318 /** 323 /**
324 * Star topology. No options.
325 */
326 "STAR",
327
328 /**
319 * Read a topology from a given file. Followed by the name of the file (const char *). 329 * Read a topology from a given file. Followed by the name of the file (const char *).
320 */ 330 */
321 "FROM_FILE", 331 "FROM_FILE",
@@ -540,6 +550,43 @@ gen_topo_line (struct TopologyContext *tc)
540 550
541 551
542/** 552/**
553 * Generates star topology
554 *
555 * @param tc the topology context
556 */
557static void
558gen_topo_star (struct TopologyContext *tc)
559{
560 unsigned int cnt;
561
562 tc->link_array_size = tc->num_peers - 1;
563 switch (tc->type)
564 {
565 case TOPOLOGYCONTEXT_TYPE_OVERLAY:
566 {
567 struct TopologyContextOverlay *overlay;
568
569 overlay = &tc->u.overlay;
570 overlay->link_array =
571 GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
572 }
573 break;
574 case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
575 {
576 struct TopologyContextUnderlay *underlay;
577
578 underlay = &tc->u.underlay;
579 underlay->link_array =
580 GNUNET_malloc (sizeof (struct UnderlayLink) * tc->link_array_size);
581 }
582 break;
583 }
584 for (cnt = tc->link_array_size; cnt; cnt--)
585 make_link (0, 0, cnt, tc);
586}
587
588
589/**
543 * Generates ring topology 590 * Generates ring topology
544 * 591 *
545 * @param tc the topology context 592 * @param tc the topology context
@@ -1278,6 +1325,9 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1278 case GNUNET_TESTBED_TOPOLOGY_LINE: 1325 case GNUNET_TESTBED_TOPOLOGY_LINE:
1279 gen_topo_line (tc); 1326 gen_topo_line (tc);
1280 break; 1327 break;
1328 case GNUNET_TESTBED_TOPOLOGY_STAR:
1329 gen_topo_star (tc);
1330 break;
1281 case GNUNET_TESTBED_TOPOLOGY_RING: 1331 case GNUNET_TESTBED_TOPOLOGY_RING:
1282 gen_topo_ring (tc); 1332 gen_topo_ring (tc);
1283 break; 1333 break;
@@ -1492,6 +1542,9 @@ GNUNET_TESTBED_underlay_construct_ (int num_peers,
1492 case GNUNET_TESTBED_TOPOLOGY_LINE: 1542 case GNUNET_TESTBED_TOPOLOGY_LINE:
1493 gen_topo_line (&tc); 1543 gen_topo_line (&tc);
1494 break; 1544 break;
1545 case GNUNET_TESTBED_TOPOLOGY_STAR:
1546 gen_topo_star (&tc);
1547 break;
1495 case GNUNET_TESTBED_TOPOLOGY_RING: 1548 case GNUNET_TESTBED_TOPOLOGY_RING:
1496 gen_topo_ring (&tc); 1549 gen_topo_ring (&tc);
1497 break; 1550 break;