equal
deleted
inserted
replaced
|
1 # Simple test of DTLSR |
|
2 |
|
3 # Import all the test utilities |
|
4 set base_test_dir [pwd] |
|
5 while {! [file exists "$base_test_dir/sim/sim-test-utils.tcl"] } { |
|
6 set base_test_dir [file dirname $base_test_dir] |
|
7 if {$base_test_dir == "/"} { |
|
8 error "must run this script from a DTN2 subdirectory" |
|
9 } |
|
10 } |
|
11 source $base_test_dir/sim/sim-test-utils.tcl |
|
12 |
|
13 set opt(N) 5 |
|
14 set opt(runtill) 5000 |
|
15 set opt(area) "" |
|
16 parse_opts |
|
17 |
|
18 sim set runtill $opt(runtill) |
|
19 sim set route_type dtlsr |
|
20 conn set type static |
|
21 |
|
22 # |
|
23 # First set up the five nodes in a linear arrangement |
|
24 # |
|
25 for {set i 0} {$i < $opt(N)} {incr i} { |
|
26 set cur "node$i" |
|
27 set last "node[expr $i - 1]" |
|
28 |
|
29 sim create_node $cur |
|
30 $cur route local_eid dtn://$cur |
|
31 if {$opt(area) != ""} { |
|
32 $cur route set dtlsr_area $opt(area) |
|
33 } |
|
34 |
|
35 $cur registration add dtn://$cur/test |
|
36 |
|
37 if {$i != 0} { |
|
38 $last link add l-$cur $cur alwayson sim remote_eid=dtn://$cur |
|
39 $cur link add l-$last $last alwayson sim remote_eid=dtn://$last |
|
40 } |
|
41 } |
|
42 |
|
43 conn up * * |
|
44 |
|
45 sim at 4.5 eval { |
|
46 for {set i 0} {$i < $opt(N)} {incr i} { |
|
47 puts "Routing table at node $i: [node$i route dump]" |
|
48 } |
|
49 } |
|
50 |
|
51 |
|
52 |