|
1 # |
|
2 # Copyright 2007 Baylor University |
|
3 # |
|
4 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 # you may not use this file except in compliance with the License. |
|
6 # You may obtain a copy of the License at |
|
7 # |
|
8 # http://www.apache.org/licenses/LICENSE-2.0 |
|
9 # |
|
10 # Unless required by applicable law or agreed to in writing, software |
|
11 # distributed under the License is distributed on an "AS IS" BASIS, |
|
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 # See the License for the specific language governing permissions and |
|
14 # limitations under the License. |
|
15 # |
|
16 |
|
17 # name of test |
|
18 test::name discovery |
|
19 |
|
20 # XXX/wilson automate these and other args |
|
21 # number of participating nodes |
|
22 net::num_nodes 3 |
|
23 set cl tcp |
|
24 set disc_interval 7 |
|
25 |
|
26 dtn::config --router_type static --no_null_link |
|
27 dtn::config_topology_common true |
|
28 |
|
29 testlog "Bringing up listening interfaces" |
|
30 dtn::config_interface $cl |
|
31 |
|
32 |
|
33 testlog "Configuring discovery components" |
|
34 testlog "* Limit visibility between 0 and 2 so that 1 is the intermediary" |
|
35 # Force 0 and 2 to unicast to 1, to reduce their visibility |
|
36 # and simulate a linear path 0 --> 1 <-- 2 |
|
37 conf::add dtnd 0 "discovery add ipdisc0 ip port=6789 addr=$net::host(1)" |
|
38 conf::add dtnd 2 "discovery add ipdisc0 ip port=6789 addr=$net::host(1)" |
|
39 conf::add dtnd 1 "discovery add ipdisc0 ip port=6789" |
|
40 |
|
41 testlog "* Add announce to advertise each node's $cl CL" |
|
42 conf::add dtnd 0 "discovery announce tcp0 ipdisc0 tcp interval=$disc_interval \ |
|
43 cl_port=[dtn::get_port tcp 0]" |
|
44 conf::add dtnd 1 "discovery announce tcp0 ipdisc0 tcp interval=$disc_interval \ |
|
45 cl_port=[dtn::get_port tcp 1]" |
|
46 conf::add dtnd 2 "discovery announce tcp0 ipdisc0 tcp interval=$disc_interval \ |
|
47 cl_port=[dtn::get_port tcp 2]" |
|
48 |
|
49 if {$opt(net) == "localhost"} { |
|
50 testlog "Discovery test cannot be run on localhost net" |
|
51 exit 0 |
|
52 } |
|
53 |
|
54 test::script { |
|
55 |
|
56 |
|
57 testlog "Running dtnds" |
|
58 dtn::run_dtnd * |
|
59 |
|
60 testlog "Waiting for dtnds to start up" |
|
61 dtn::wait_for_dtnd * |
|
62 |
|
63 testlog "Wait for routes to populate" |
|
64 dtn::wait_for_route 0 dtn://host-1/* opportunistic-0 {} |
|
65 dtn::wait_for_route 2 dtn://host-1/* opportunistic-0 {} |
|
66 testlog "Test success!" |
|
67 } |
|
68 |
|
69 test::exit_script { |
|
70 testlog "Stopping all dtnds" |
|
71 dtn::stop_dtnd * |
|
72 } |