This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdeter.ns
84 lines (69 loc) · 2.4 KB
/
deter.ns
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# This topology has M servers and N user nodes
# connected by a bandwidth-limited link.
#
set ns [new Simulator]
source tb_compat.tcl
set n_trustees 3
set n_clients 5
set trustee_bandwidth 100Mb
set client_bandwidth 1000Mb
set trustee_delay 100ms
set client_delay 10ms
set client_loss 0.05
set lanstr_trustees ""
set lanstr_clients ""
# create the Relay
set relay [$ns node]
tb-set-node-os $relay Ubuntu1404-64-STD
tb-set-hardware $relay pc3060
tb-set-node-startcmd $relay /share/t1t2/set_route
tb-set-node-failure-action $relay "nonfatal"
append lanstr_clients "$relay "
append lanstr_trustees "$relay "
# create the Trustees
for {set i 0} {$i < $n_trustees} {incr i} {
set trustee($i) [$ns node]
tb-set-node-os $trustee($i) Ubuntu1404-64-STD
tb-set-hardware $trustee($i) pc3060
tb-set-node-startcmd $trustee($i) /share/t1t2/set_route
tb-set-node-failure-action $trustee($i) "nonfatal"
append lanstr_trustees "$trustee($i) "
}
# create the Clients
for {set i 0} {$i < $n_clients} {incr i} {
set client($i) [$ns node]
tb-set-node-os $client($i) Ubuntu1404-64-STD
tb-set-hardware $client($i) pc3060
tb-set-node-startcmd $client($i) /share/t1t2/set_route
tb-set-node-failure-action $client($i) "nonfatal"
append lanstr_clients "$client($i) "
}
set lanclients [$ns make-lan "$lanstr_clients" $client_bandwidth $client_delay]
set lantrustees [$ns make-lan "$lanstr_trustees" $trustee_bandwidth $trustee_delay]
# set the relay in both lan
tb-set-ip-lan $relay $lantrustees 10.1.0.254
tb-set-ip-lan $relay $lanclients 10.0.1.254
# tell deterlab not to use delays node, but to shape the delays in the hosts (save some nodes)
tb-set-endnodeshaping $lanclients 1
tb-set-endnodeshaping $lantrustees 1
# set the trustee's lan
for {set i 0} {$i < $n_trustees} {incr i} {
set ip 10.1.0.[expr {$i + 1}]
tb-set-ip-lan $trustee($i) $lantrustees $ip
tb-set-node-lan-bandwidth $trustee($i) $lantrustees $trustee_bandwidth
}
# set the client's lan
for {set i 0} {$i < $n_clients} {incr i} {
set ip 10.0.1.[expr {$i + 1}]
tb-set-ip-lan $client($i) $lanclients $ip
tb-set-node-lan-loss $client($i) $lanclients $client_loss
}
# Do not remove - automatically generated tunnelcode for connectivity
# set tunnel [$ns node]
# tb-set-node-os $tunnel CentOS5-TUNNEL
# tb-allow-external $tunnel
# set linktunnel [$ns duplex-link $router $tunnel 1000Mb 0ms DropTail]
# End of tunnelcode
$ns rtproto Static
$ns run