|
1 # |
|
2 # Copyright 2005-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 manifest::file apps/dtntest/dtntest dtntest |
|
18 |
|
19 test::name tcp-bogus-link |
|
20 net::num_nodes 1 |
|
21 |
|
22 dtn::config |
|
23 dtn::config_interface tcp |
|
24 dtn::config_topology_common false |
|
25 |
|
26 test::script { |
|
27 testlog "Running dtnd" |
|
28 dtn::run_dtnd 0 |
|
29 |
|
30 testlog "Waiting for dtnd to start up" |
|
31 dtn::wait_for_dtnd 0 |
|
32 |
|
33 testlog "Adding a bogus link" |
|
34 dtn::tell_dtnd 0 link add bogus 1.2.3.4:9999 ALWAYSON tcp |
|
35 |
|
36 testlog "Checking link is OPENING or UNAVAILABLE" |
|
37 dtn::wait_for_link_state 0 bogus {OPENING UNAVAILABLE} |
|
38 |
|
39 testlog "Closing bogus link" |
|
40 dtn::tell_dtnd 0 link close bogus |
|
41 |
|
42 testlog "Checking link is UNAVAILABLE" |
|
43 dtn::wait_for_link_state 0 bogus UNAVAILABLE |
|
44 |
|
45 testlog "Reopening link" |
|
46 dtn::tell_dtnd 0 link open bogus |
|
47 |
|
48 testlog "Checking link is OPENING or UNAVAILABLE" |
|
49 dtn::wait_for_link_state 0 bogus {OPENING UNAVAILABLE} |
|
50 |
|
51 testlog "Closing bogus link again" |
|
52 dtn::tell_dtnd 0 link close bogus |
|
53 |
|
54 testlog "Checking link is UNAVAILABLE" |
|
55 dtn::wait_for_link_state 0 bogus UNAVAILABLE |
|
56 |
|
57 testlog "Running dtntest" |
|
58 dtn::run_dtntest 0 |
|
59 |
|
60 testlog "Bumping down the link data timeout" |
|
61 dtn::tell_dtnd 0 link set_cl_defaults tcp data_timeout=2000 |
|
62 |
|
63 testlog "Connecting with a bogus socket" |
|
64 set sock [dtn::tell_dtntest 0 socket $net::host(0) [dtn::get_port tcp 0]] |
|
65 |
|
66 testlog "Waiting for data timeout" |
|
67 after 5000 |
|
68 |
|
69 testlog "Closing the socket" |
|
70 dtn::tell_dtntest 0 close $sock |
|
71 |
|
72 testlog "Running a bogus server socket" |
|
73 dtn::tell_dtntest 0 proc connected {args} {} |
|
74 set sock [dtn::tell_dtntest 0 socket -server connected \ |
|
75 -myaddr $net::host(0) [dtn::get_port misc 0]] |
|
76 |
|
77 testlog "Creating a link to the new socket" |
|
78 dtn::tell_dtnd 0 link add l-test $net::host(0):[dtn::get_port misc 0] ALWAYSON tcp |
|
79 |
|
80 testlog "Checking that link is in state OPENING" |
|
81 dtn::wait_for_link_state 0 l-test OPENING |
|
82 |
|
83 testlog "Waiting for contact header timeout" |
|
84 after 5000 |
|
85 |
|
86 testlog "Checking that link is in state UNAVAILABLE" |
|
87 dtn::check_link_state 0 l-test UNAVAILABLE |
|
88 |
|
89 testlog "Test success!" |
|
90 } |
|
91 |
|
92 test::exit_script { |
|
93 testlog "Stopping all dtnds" |
|
94 dtn::stop_dtnd * |
|
95 |
|
96 testlog "Stopping dtntest" |
|
97 dtn::stop_dtntest * |
|
98 } |