diff options
-rw-r--r-- | src/include/gnunet_testbed_service.h | 5 | ||||
-rw-r--r-- | src/testbed/Makefile.am | 9 | ||||
-rw-r--r-- | src/testbed/generate-underlay-topology.c | 1 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_testbed_run_topologystar.conf | 4 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 53 |
5 files changed, 72 insertions, 0 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index 781dc0441..bc4be0140 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -981,6 +981,11 @@ enum GNUNET_TESTBED_TopologyOption | |||
981 | GNUNET_TESTBED_TOPOLOGY_RING, | 981 | GNUNET_TESTBED_TOPOLOGY_RING, |
982 | 982 | ||
983 | /** | 983 | /** |
984 | * Star topology. No options. | ||
985 | */ | ||
986 | GNUNET_TESTBED_TOPOLOGY_STAR, | ||
987 | |||
988 | /** | ||
984 | * 2-d torus. No options. | 989 | * 2-d torus. No options. |
985 | */ | 990 | */ |
986 | GNUNET_TESTBED_TOPOLOGY_2D_TORUS, | 991 | GNUNET_TESTBED_TOPOLOGY_2D_TORUS, |
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 | ||
287 | test_testbed_api_testbed_run_topologystar_SOURCES = \ | ||
288 | test_testbed_api_testbed_run.c | ||
289 | test_testbed_api_testbed_run_topologystar_LDADD = \ | ||
290 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
291 | libgnunettestbed.la | ||
292 | |||
285 | test_testbed_api_testbed_run_topologyclique_SOURCES = \ | 293 | test_testbed_api_testbed_run_topologyclique_SOURCES = \ |
286 | test_testbed_api_testbed_run.c | 294 | test_testbed_api_testbed_run.c |
287 | test_testbed_api_testbed_run_topologyclique_LDADD = \ | 295 | test_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] | ||
4 | OVERLAY_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 | */ | ||
557 | static void | ||
558 | gen_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; |