test/no-duplicate-delivery.tcl
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 #
       
     2 #    Copyright 2007 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 no-duplicate-delivery
       
    18 net::num_nodes 2
       
    19 
       
    20 set testopt(cl)       tcp
       
    21 run::parse_test_opts
       
    22 
       
    23 set cl $testopt(cl)
       
    24 
       
    25 dtn::config
       
    26 dtn::config_interface $cl
       
    27 
       
    28 dtn::config_linear_topology ALWAYSON $cl true
       
    29 
       
    30 test::script {
       
    31     testlog "running dtnds"
       
    32     dtn::run_dtnd *
       
    33 
       
    34     testlog "waiting for dtnds to start up"
       
    35     dtn::wait_for_dtnd *
       
    36 
       
    37     set source    dtn://host-0/test
       
    38     set dest      dtn://host-1/test
       
    39     dtn::tell_dtnd 1 tcl_registration $dest
       
    40 
       
    41     testlog "waiting for links to establish"
       
    42     dtn::wait_for_link_state 0 $cl-link:0-1 OPEN
       
    43     dtn::wait_for_link_state 1 $cl-link:1-0 OPEN
       
    44 
       
    45     testlog "telling node 0 not to delete bundles"
       
    46     tell_dtnd 0 "param set early_deletion false"
       
    47 
       
    48     testlog "sending a bundle"
       
    49     set timestamp1 [dtn::tell_dtnd 0 sendbundle $source $dest]
       
    50 
       
    51     testlog "checking that it was delivered but still pending"
       
    52     dtn::wait_for_bundle_stats 0 {1 pending 1 transmitted}
       
    53     dtn::wait_for_bundle_stats 1 {1 received 1 delivered}
       
    54 
       
    55     testlog "clearing the forwarding log and rerouting"
       
    56     tell_dtnd 0 bundle clear_fwdlog 0
       
    57     tell_dtnd 0 route recompute_routes
       
    58 
       
    59     dtn::wait_for_bundle_stats 0 {1 pending  2 transmitted}
       
    60     dtn::wait_for_bundle_stats 1 {2 received 1 delivered}
       
    61 }
       
    62 
       
    63 test::exit_script {
       
    64     testlog "stopping all dtnds"
       
    65     dtn::stop_dtnd *
       
    66 }