diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-11-16 17:53:26 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-11-16 17:53:26 +0000 |
commit | 26bf6d22e5395a03ec3f6ac6164df1f3482da374 (patch) | |
tree | becde8a860504da20f45045815fc9252cce7d252 | |
parent | 5c6866ff424ec0292ea1b5cc637c5a0d87021c82 (diff) | |
download | gnunet-26bf6d22e5395a03ec3f6ac6164df1f3482da374.tar.gz gnunet-26bf6d22e5395a03ec3f6ac6164df1f3482da374.zip |
small world topology
-rw-r--r-- | src/testbed/Makefile.am | 13 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_testbed_run_topologysmallworld.conf | 80 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 40 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 6 |
4 files changed, 128 insertions, 11 deletions
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index 130014836..7230888dc 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am | |||
@@ -96,7 +96,8 @@ check_PROGRAMS = \ | |||
96 | test_testbed_api_testbed_run_topologyclique \ | 96 | test_testbed_api_testbed_run_topologyclique \ |
97 | test_testbed_api_testbed_run_topologyring \ | 97 | test_testbed_api_testbed_run_topologyring \ |
98 | test_testbed_api_testbed_run_topologysmallworldring \ | 98 | test_testbed_api_testbed_run_topologysmallworldring \ |
99 | test_testbed_api_testbed_run_topology2dtorus | 99 | test_testbed_api_testbed_run_topology2dtorus \ |
100 | test_testbed_api_testbed_run_topologysmallworld | ||
100 | 101 | ||
101 | if ENABLE_TEST_RUN | 102 | if ENABLE_TEST_RUN |
102 | TESTS = \ | 103 | TESTS = \ |
@@ -116,7 +117,8 @@ if ENABLE_TEST_RUN | |||
116 | test_testbed_api_testbed_run_topologyclique \ | 117 | test_testbed_api_testbed_run_topologyclique \ |
117 | test_testbed_api_testbed_run_topologyring \ | 118 | test_testbed_api_testbed_run_topologyring \ |
118 | test_testbed_api_testbed_run_topologysmallworldring \ | 119 | test_testbed_api_testbed_run_topologysmallworldring \ |
119 | test_testbed_api_testbed_run_topology2dtorus | 120 | test_testbed_api_testbed_run_topology2dtorus \ |
121 | test_testbed_api_testbed_run_topologysmallworld | ||
120 | endif | 122 | endif |
121 | 123 | ||
122 | test_testbed_api_hosts_SOURCES = \ | 124 | test_testbed_api_hosts_SOURCES = \ |
@@ -226,6 +228,12 @@ test_testbed_api_testbed_run_topology2dtorus_LDADD = \ | |||
226 | $(top_builddir)/src/util/libgnunetutil.la \ | 228 | $(top_builddir)/src/util/libgnunetutil.la \ |
227 | libgnunettestbed.la | 229 | libgnunettestbed.la |
228 | 230 | ||
231 | test_testbed_api_testbed_run_topologysmallworld_SOURCES = \ | ||
232 | test_testbed_api_testbed_run.c | ||
233 | test_testbed_api_testbed_run_topologysmallworld_LDADD = \ | ||
234 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
235 | libgnunettestbed.la | ||
236 | |||
229 | EXTRA_DIST = \ | 237 | EXTRA_DIST = \ |
230 | test_testbed_api.conf \ | 238 | test_testbed_api.conf \ |
231 | test_testbed_api_testbed_run_topologyring.conf \ | 239 | test_testbed_api_testbed_run_topologyring.conf \ |
@@ -234,4 +242,5 @@ EXTRA_DIST = \ | |||
234 | test_testbed_api_testbed_run_topologyrandom.conf \ | 242 | test_testbed_api_testbed_run_topologyrandom.conf \ |
235 | test_testbed_api_testbed_run_topologysmallworldring.conf \ | 243 | test_testbed_api_testbed_run_topologysmallworldring.conf \ |
236 | test_testbed_api_testbed_run_topology2dtorus.conf \ | 244 | test_testbed_api_testbed_run_topology2dtorus.conf \ |
245 | test_testbed_api_testbed_run_topologysmallworld.conf \ | ||
237 | sample_hosts.txt \ No newline at end of file | 246 | sample_hosts.txt \ No newline at end of file |
diff --git a/src/testbed/test_testbed_api_testbed_run_topologysmallworld.conf b/src/testbed/test_testbed_api_testbed_run_topologysmallworld.conf new file mode 100644 index 000000000..662233d90 --- /dev/null +++ b/src/testbed/test_testbed_api_testbed_run_topologysmallworld.conf | |||
@@ -0,0 +1,80 @@ | |||
1 | [testbed] | ||
2 | AUTOSTART = NO | ||
3 | PORT = 12113 | ||
4 | ACCEPT_FROM = 127.0.0.1; | ||
5 | HOSTNAME = localhost | ||
6 | PARALLEL_OVERLAY_CONNECT_THRESHOLD = 2 | ||
7 | OVERLAY_TOPOLOGY = SMALL_WORLD | ||
8 | OVERLAY_RANDOM_LINKS = 3 | ||
9 | #PREFIX = xterm -geometry 100x85 -T peer1 -e libtool --mode=execute gdb --args | ||
10 | |||
11 | [fs] | ||
12 | AUTOSTART = NO | ||
13 | |||
14 | [resolver] | ||
15 | AUTOSTART = NO | ||
16 | |||
17 | [mesh] | ||
18 | AUTOSTART = NO | ||
19 | |||
20 | [dht] | ||
21 | AUTOSTART = NO | ||
22 | |||
23 | [block] | ||
24 | plugins = dht test | ||
25 | |||
26 | [dhtcache] | ||
27 | QUOTA = 1 MB | ||
28 | DATABASE = sqlite | ||
29 | |||
30 | [transport] | ||
31 | PLUGINS = tcp | ||
32 | ACCEPT_FROM6 = ::1; | ||
33 | ACCEPT_FROM = 127.0.0.1; | ||
34 | NEIGHBOUR_LIMIT = 50 | ||
35 | PORT = 12365 | ||
36 | |||
37 | [ats] | ||
38 | WAN_QUOTA_OUT = 3932160 | ||
39 | WAN_QUOTA_IN = 3932160 | ||
40 | |||
41 | [core] | ||
42 | PORT = 12092 | ||
43 | AUTOSTART = YES | ||
44 | |||
45 | [arm] | ||
46 | DEFAULTSERVICES = core transport | ||
47 | PORT = 12366 | ||
48 | |||
49 | [transport-tcp] | ||
50 | TIMEOUT = 300 s | ||
51 | PORT = 12368 | ||
52 | |||
53 | [TESTING] | ||
54 | NUM_PEERS = 5 | ||
55 | WEAKRANDOM = YES | ||
56 | HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat | ||
57 | MAX_CONCURRENT_SSH = 10 | ||
58 | USE_PROGRESSBARS = YES | ||
59 | PEERGROUP_TIMEOUT = 2400 s | ||
60 | |||
61 | [gnunetd] | ||
62 | HOSTKEY = $SERVICEHOME/.hostkey | ||
63 | |||
64 | [PATHS] | ||
65 | SERVICEHOME = /tmp/test-testbed/ | ||
66 | |||
67 | [dns] | ||
68 | AUTOSTART = NO | ||
69 | |||
70 | [nse] | ||
71 | AUTOSTART = NO | ||
72 | |||
73 | [vpn] | ||
74 | AUTOSTART = NO | ||
75 | |||
76 | [nat] | ||
77 | RETURN_LOCAL_ADDRESSES = YES | ||
78 | |||
79 | [gns-helper-service-w32] | ||
80 | AUTOSTART = NO \ No newline at end of file | ||
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index a7e15dc6b..20633378d 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -441,17 +441,34 @@ call_cc: | |||
441 | if (GNUNET_TESTBED_TOPOLOGY_NONE != rc->topology) | 441 | if (GNUNET_TESTBED_TOPOLOGY_NONE != rc->topology) |
442 | { | 442 | { |
443 | if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) | 443 | if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) |
444 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology)) | 444 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) |
445 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology)) | ||
446 | { | ||
447 | unsigned int rand_links; | ||
448 | |||
449 | switch (rc->topology) | ||
450 | { | ||
451 | case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI: | ||
452 | rand_links = rc->num_oc; | ||
453 | break; | ||
454 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING: | ||
455 | rand_links = rc->num_oc - rc->num_peers; | ||
456 | break; | ||
457 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD: | ||
458 | rand_links = GNUNET_TESTBED_2dtorus_calc_links (rc->num_peers, NULL, NULL); | ||
459 | break; | ||
460 | default: | ||
461 | GNUNET_break (0); | ||
462 | rand_links = 0; | ||
463 | } | ||
445 | rc->topology_operation = | 464 | rc->topology_operation = |
446 | GNUNET_TESTBED_overlay_configure_topology (NULL, | 465 | GNUNET_TESTBED_overlay_configure_topology (NULL, |
447 | rc->num_peers, | 466 | rc->num_peers, |
448 | rc->peers, | 467 | rc->peers, |
449 | rc->topology, | 468 | rc->topology, |
450 | (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI | 469 | rand_links, |
451 | == rc->topology) ? | ||
452 | rc->num_oc : | ||
453 | (rc->num_oc - rc->num_peers), | ||
454 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 470 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
471 | } | ||
455 | else | 472 | else |
456 | rc->topology_operation = | 473 | rc->topology_operation = |
457 | GNUNET_TESTBED_overlay_configure_topology (NULL, | 474 | GNUNET_TESTBED_overlay_configure_topology (NULL, |
@@ -655,6 +672,12 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
655 | else if (0 == strcasecmp (topology, "SMALL_WORLD_RING")) | 672 | else if (0 == strcasecmp (topology, "SMALL_WORLD_RING")) |
656 | { | 673 | { |
657 | rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING; | 674 | rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING; |
675 | rc->num_oc = num_peers; | ||
676 | } | ||
677 | else if (0 == strcasecmp (topology, "SMALL_WORLD")) | ||
678 | { | ||
679 | rc->topology = GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD; | ||
680 | rc->num_oc = GNUNET_TESTBED_2dtorus_calc_links (num_peers, NULL, NULL); | ||
658 | } | 681 | } |
659 | else if (0 == strcasecmp (topology, "CLIQUE")) | 682 | else if (0 == strcasecmp (topology, "CLIQUE")) |
660 | { | 683 | { |
@@ -682,7 +705,8 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
682 | GNUNET_free (topology); | 705 | GNUNET_free (topology); |
683 | } | 706 | } |
684 | if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) | 707 | if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) |
685 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology)) | 708 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) |
709 | || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology)) | ||
686 | { | 710 | { |
687 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "testbed", | 711 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "testbed", |
688 | "OVERLAY_RANDOM_LINKS", | 712 | "OVERLAY_RANDOM_LINKS", |
@@ -700,9 +724,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
700 | GNUNET_free (rc); | 724 | GNUNET_free (rc); |
701 | return; | 725 | return; |
702 | } | 726 | } |
703 | rc->num_oc = (unsigned int) random_links; | 727 | rc->num_oc += (unsigned int) random_links; |
704 | if (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) | ||
705 | rc->num_oc += num_peers; | ||
706 | } | 728 | } |
707 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 729 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
708 | &shutdown_run_task, rc); | 730 | &shutdown_run_task, rc); |
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index 9c62502c4..b42934f3b 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c | |||
@@ -530,6 +530,12 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, | |||
530 | case GNUNET_TESTBED_TOPOLOGY_2D_TORUS: | 530 | case GNUNET_TESTBED_TOPOLOGY_2D_TORUS: |
531 | gen_topo_2dtorus (tc); | 531 | gen_topo_2dtorus (tc); |
532 | break; | 532 | break; |
533 | case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD: | ||
534 | gen_topo_2dtorus (tc); | ||
535 | gen_topo_random (tc, | ||
536 | va_arg (va, unsigned int), | ||
537 | GNUNET_YES); | ||
538 | break; | ||
533 | default: | 539 | default: |
534 | GNUNET_break (0); | 540 | GNUNET_break (0); |
535 | GNUNET_free (tc); | 541 | GNUNET_free (tc); |