|
1 # |
|
2 # Copyright 2006 Intel Corporation |
|
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 test::name loopback-link |
|
18 net::num_nodes 1 |
|
19 |
|
20 dtn::config |
|
21 |
|
22 set clayer tcp |
|
23 |
|
24 foreach {var val} $opt(opts) { |
|
25 if {$var == "-cl" || $var == "cl"} { |
|
26 set clayer $val |
|
27 } else { |
|
28 testlog error "ERROR: unrecognized test option '$var'" |
|
29 exit 1 |
|
30 } |
|
31 } |
|
32 |
|
33 dtn::config_topology_common false |
|
34 |
|
35 testlog "Configuring $clayer interface" |
|
36 dtn::config_interface $clayer |
|
37 |
|
38 test::script { |
|
39 testlog "Running dtnd" |
|
40 dtn::run_dtnd 0 |
|
41 |
|
42 testlog "Waiting for dtnd to start up" |
|
43 dtn::wait_for_dtnd * |
|
44 |
|
45 testlog "Setting up flamebox-ignore" |
|
46 dtn::tell_dtnd 0 log /test always \ |
|
47 "flamebox-ignore ign1 scheduling IMMEDIATE expiration" |
|
48 |
|
49 testlog "Adding a link that points back to itself and a default route" |
|
50 eval dtn::tell_dtnd 0 link add loopback-link \ |
|
51 "$net::host(0):[dtn::get_port $clayer 0]" ALWAYSON $clayer |
|
52 |
|
53 dtn::tell_dtnd 0 route add *:* loopback-link action=copy |
|
54 |
|
55 testlog "Adding a registration" |
|
56 dtn::tell_dtnd 0 tcl_registration dtn://host-0/test |
|
57 |
|
58 testlog "Sending a bundle" |
|
59 dtn::tell_dtnd 0 sendbundle dtn://host-0/source dtn://host-0/test \ |
|
60 expiration=1 |
|
61 |
|
62 testlog "Waiting for it to loop" |
|
63 after 5000 |
|
64 |
|
65 testlog "Checking stats" |
|
66 dtn::check_bundle_stats 0 0 pending 1 transmitted 2 received 1 delivered |
|
67 dtn::check_link_stats 0 loopback-link 0 bundles_queued 1 bundles_transmitted |
|
68 |
|
69 testlog "Test success!" |
|
70 } |
|
71 |
|
72 test::exit_script { |
|
73 testlog "clearing flamebox ignores" |
|
74 tell_dtnd 0 log /test always "flamebox-ignore-cancel ign1" |
|
75 |
|
76 testlog "Stopping all dtnds" |
|
77 dtn::stop_dtnd * |
|
78 } |