|
1 # |
|
2 # Simple two node unidirectional simulation |
|
3 # |
|
4 |
|
5 # Import all the test utilities |
|
6 set base_test_dir [pwd] |
|
7 while {! [file exists "$base_test_dir/sim/sim-test-utils.tcl"] } { |
|
8 set base_test_dir [file dirname $base_test_dir] |
|
9 if {$base_test_dir == "/"} { |
|
10 error "must run this script from a DTN2 subdirectory" |
|
11 } |
|
12 } |
|
13 source $base_test_dir/sim/sim-test-utils.tcl |
|
14 |
|
15 # |
|
16 # global simulation parameters |
|
17 # |
|
18 set opt(route_type) static |
|
19 set opt(link_type) ALWAYSON |
|
20 set opt(size) 1024 |
|
21 set opt(reps) 1 |
|
22 set opt(interval) 10 |
|
23 set opt(bw) 100kbps |
|
24 set opt(latency) 1s |
|
25 set opt(expiration) 1000000000 |
|
26 |
|
27 # |
|
28 # parse command line params |
|
29 # |
|
30 parse_opts |
|
31 |
|
32 # |
|
33 # Set up the routing state |
|
34 # |
|
35 sim set route_type $opt(route_type) |
|
36 |
|
37 # |
|
38 # create two nodes and configure their local addresses |
|
39 # |
|
40 sim create_node n0 |
|
41 sim create_node n1 |
|
42 |
|
43 n0 route local_eid dtn://n0 |
|
44 n1 route local_eid dtn://n1 |
|
45 |
|
46 # |
|
47 # set the connectivity parameters to activate at time 1 |
|
48 # |
|
49 conn set type static |
|
50 conn up n0 n1 bw=$opt(bw) latency=$opt(latency) |
|
51 |
|
52 # |
|
53 # add a registration on node 1 |
|
54 # |
|
55 n1 registration add dtn://n1/* |
|
56 |
|
57 # |
|
58 # now add a link and a route from 0 to 1 |
|
59 # |
|
60 n0 link add link-n1 n1 $opt(link_type) sim |
|
61 n0 route add dtn://n1/* link-n1 |
|
62 |
|
63 # |
|
64 # start the traffic agent at time 2 to send a bundle |
|
65 # |
|
66 sim at 2 n0 tragent dtn://n0/src dtn://n1/dst size=$opt(size) \ |
|
67 reps=$opt(reps) interval=$opt(interval) expiration=$opt(expiration) |
|
68 |
|
69 # |
|
70 # dump statistics when we're done |
|
71 # |
|
72 sim at exit dtn::dump_stats |