LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
11 * | 11 * |
12 * You should have received a copy of the GNU General Public License | 12 * You should have received a copy of the GNU General Public License |
13 * along with this program; if not, write to the Free Software | 13 * along with this program; if not, write to the Free Software |
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 * | 15 * |
16 * (c) 2009, GTech Systems, Inc. - Alfred Park <park@gtech-systems.com> | 16 * (c) 2009, GTech Systems, Inc. - Alfred Park <park@gtech-systems.com> |
17 * | 17 * |
18 * DARPA NMS Campus Network Model | 18 * DARPA NMS Campus Network Model |
19 * | 19 * |
20 * This topology replicates the original NMS Campus Network model | 20 * This topology replicates the original NMS Campus Network model |
21 * with the exception of chord links (which were never utilized in the | 21 * with the exception of chord links (which were never utilized in the |
22 * original model) | 22 * original model) |
23 * Link Bandwidths and Delays may not be the same as the original | 23 * Link Bandwidths and Delays may not be the same as the original |
24 * specifications | 24 * specifications |
25 * | 25 * |
26 * Modified for distributed simulation by Josh Pelkey <jpelkey@gatech.edu> | 26 * Modified for distributed simulation by Josh Pelkey <jpelkey@gatech.edu> |
27 * | 27 * |
28 * The fundamental unit of the NMS model consists of a campus network. The | 28 * The fundamental unit of the NMS model consists of a campus network. The |
29 * campus network topology can been seen here: | 29 * campus network topology can been seen here: |
30 * http://www.nsnam.org/~jpelkey3/nms.png | 30 * http://www.nsnam.org/~jpelkey3/nms.png |
31 * The number of hosts (default 42) is variable. Finally, an arbitrary | 31 * The number of hosts (default 42) is variable. Finally, an arbitrary |
32 * number of these campus networks can be connected together (default 2) | 32 * number of these campus networks can be connected together (default 2) |
33 * to make very large simulations. | 33 * to make very large simulations. |
34 */ | 34 */ |
35 | 35 |
36 // for timing functions | 36 // for timing functions |
37 #include <cstdlib> | 37 #include <cstdlib> |
38 #include <sys/time.h> | 38 #include <sys/time.h> |
39 #include <fstream> | 39 #include <fstream> |
40 | 40 |
41 #include "ns3/core-module.h" | 41 #include "ns3/core-module.h" |
42 #include "ns3/simulator-module.h" | 42 #include "ns3/simulator-module.h" |
43 #include "ns3/node-module.h" | 43 #include "ns3/node-module.h" |
44 #include "ns3/helper-module.h" | 44 #include "ns3/helper-module.h" |
45 #include "ns3/global-routing-module.h" | 45 #include "ns3/global-routing-module.h" |
46 #include "ns3/onoff-application.h" | 46 #include "ns3/onoff-application.h" |
47 #include "ns3/packet-sink.h" | 47 #include "ns3/packet-sink.h" |
48 #include "ns3/point-to-point-net-device.h" | 48 #include "ns3/point-to-point-net-device.h" |
| 49 #include "ns3/mpi-interface.h" |
49 | 50 |
50 #ifdef NS3_MPI | 51 #ifdef NS3_MPI |
51 #include <mpi.h> | 52 #include <mpi.h> |
52 #endif | 53 #endif |
53 | 54 |
54 using namespace std; | 55 using namespace std; |
55 using namespace ns3; | 56 using namespace ns3; |
56 | 57 |
57 typedef struct timeval TIMER_TYPE; | 58 typedef struct timeval TIMER_TYPE; |
58 #define TIMER_NOW(_t) gettimeofday(&_t,NULL); | 59 #define TIMER_NOW(_t) gettimeofday (&_t,NULL); |
59 #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec*1e-6) | 60 #define TIMER_SECONDS(_t) ((double)(_t).tv_sec + (_t).tv_usec * 1e-6) |
60 #define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS(_t1)-TIMER_SECONDS(_t2)) | 61 #define TIMER_DIFF(_t1, _t2) (TIMER_SECONDS (_t1) - TIMER_SECONDS (_t2)) |
61 | 62 |
62 NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel"); | 63 NS_LOG_COMPONENT_DEFINE ("CampusNetworkModel"); |
63 | 64 |
64 int | 65 int |
65 main (int argc, char *argv[]) | 66 main (int argc, char *argv[]) |
66 { | 67 { |
67 #ifdef NS3_MPI | 68 #ifdef NS3_MPI |
68 // Enable MPI with the command line arguments | 69 // Enable MPI with the command line arguments |
69 MPIInterface::Enable (&argc, &argv); | 70 MpiInterface::Enable (&argc, &argv); |
70 | 71 |
71 TIMER_TYPE t0, t1, t2; | 72 TIMER_TYPE t0, t1, t2; |
72 TIMER_NOW(t0); | 73 TIMER_NOW (t0); |
73 cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << endl; | 74 cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << endl; |
74 | 75 |
75 GlobalValue::Bind ("SimulatorImplementationType", | 76 GlobalValue::Bind ("SimulatorImplementationType", |
76 StringValue ("ns3::DistributedSimulatorImpl")); | 77 StringValue ("ns3::DistributedSimulatorImpl")); |
77 | 78 |
78 uint32_t rank = MPIInterface::Rank (); | 79 uint32_t systemId = MpiInterface::GetSystemId (); |
79 uint32_t systemCount = MPIInterface::Size (); | 80 uint32_t systemCount = MpiInterface::GetSize (); |
80 | 81 |
81 uint32_t nCN = 2, nLANClients = 42; | 82 uint32_t nCN = 2, nLANClients = 42; |
82 int32_t single = 0; | 83 int32_t single = 0; |
83 int nBytes = 500000; // Bytes for each on/off app | 84 int nBytes = 500000; // Bytes for each on/off app |
84 bool nix = true; | 85 bool nix = true; |
85 bool tracing = false; | |
86 | 86 |
87 CommandLine cmd; | 87 CommandLine cmd; |
88 cmd.AddValue ("CN", "Number of total CNs [2]", nCN); | 88 cmd.AddValue ("CN", "Number of total CNs [2]", nCN); |
89 cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients); | 89 cmd.AddValue ("LAN", "Number of nodes per LAN [42]", nLANClients); |
90 cmd.AddValue ("single", "1 if use single flow", single); | 90 cmd.AddValue ("single", "1 if use single flow", single); |
91 cmd.AddValue ("nBytes", "Number of bytes for each on/off app", nBytes); | 91 cmd.AddValue ("nBytes", "Number of bytes for each on/off app", nBytes); |
92 cmd.AddValue ("nix", "Toggle the use of nix-vector or global routing", nix); | 92 cmd.AddValue ("nix", "Toggle the use of nix-vector or global routing", nix); |
93 cmd.AddValue ("tracing", "Turn on ascii tracing", tracing); | |
94 cmd.Parse (argc,argv); | 93 cmd.Parse (argc,argv); |
95 | 94 |
96 if (nCN < 2) | 95 if (nCN < 2) |
97 { | 96 { |
98 cout << "Number of total CNs (" << nCN << ") lower than minimum of 2" | 97 cout << "Number of total CNs (" << nCN << ") lower than minimum of 2" |
99 << endl; | 98 << endl; |
100 return 1; | 99 return 1; |
101 } | 100 } |
102 if (systemCount > nCN) | 101 if (systemCount > nCN) |
103 { | 102 { |
104 cout << "Number of total CNs (" << nCN << ") should be >= systemCount (" | 103 cout << "Number of total CNs (" << nCN << ") should be >= systemCount (" |
105 << systemCount << ")." << endl; | 104 << systemCount << ")." << endl; |
106 return 1; | 105 return 1; |
107 } | 106 } |
108 | 107 |
109 cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl; | 108 cout << "Number of CNs: " << nCN << ", LAN nodes: " << nLANClients << endl; |
110 | 109 |
111 NodeContainer nodes_net0[nCN][3], nodes_net1[nCN][6], nodes_netLR[nCN], | 110 NodeContainer nodes_net0[nCN][3], nodes_net1[nCN][6], nodes_netLR[nCN], |
112 nodes_net2[nCN][14], nodes_net2LAN[nCN][7][nLANClients], | 111 nodes_net2[nCN][14], nodes_net2LAN[nCN][7][nLANClients], |
113 nodes_net3[nCN][9], nodes_net3LAN[nCN][5][nLANClients]; | 112 nodes_net3[nCN][9], nodes_net3LAN[nCN][5][nLANClients]; |
114 PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms; | 113 PointToPointHelper p2p_2gb200ms, p2p_1gb5ms, p2p_100mb1ms; |
(...skipping 16 matching lines...) Expand all Loading... |
131 Ipv4ListRoutingHelper list; | 130 Ipv4ListRoutingHelper list; |
132 list.Add (staticRouting, 0); | 131 list.Add (staticRouting, 0); |
133 list.Add (nixRouting, 10); | 132 list.Add (nixRouting, 10); |
134 | 133 |
135 if (nix) | 134 if (nix) |
136 { | 135 { |
137 stack.SetRoutingHelper (list); | 136 stack.SetRoutingHelper (list); |
138 } | 137 } |
139 | 138 |
140 // Create Campus Networks | 139 // Create Campus Networks |
141 for (uint32_t z = 0; z < nCN; ++z) | 140 for (uint32_t z = 0; z < nCN; ++z) |
142 { | 141 { |
143 cout << "Creating Campus Network " << z << ":" << endl; | 142 cout << "Creating Campus Network " << z << ":" << endl; |
144 // Create Net0 | 143 // Create Net0 |
145 cout << " SubNet [ 0"; | 144 cout << " SubNet [ 0"; |
146 for (int i = 0; i < 3; ++i) | 145 for (int i = 0; i < 3; ++i) |
147 { | 146 { |
148 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 147 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
149 nodes_net0[z][i].Add (node); | 148 nodes_net0[z][i].Add (node); |
150 stack.Install (nodes_net0[z][i]); | 149 stack.Install (nodes_net0[z][i]); |
151 } | 150 } |
152 nodes_net0[z][0].Add (nodes_net0[z][1].Get (0)); | 151 nodes_net0[z][0].Add (nodes_net0[z][1].Get (0)); |
153 nodes_net0[z][1].Add (nodes_net0[z][2].Get (0)); | 152 nodes_net0[z][1].Add (nodes_net0[z][2].Get (0)); |
154 nodes_net0[z][2].Add (nodes_net0[z][0].Get (0)); | 153 nodes_net0[z][2].Add (nodes_net0[z][0].Get (0)); |
155 NetDeviceContainer ndc0[3]; | 154 NetDeviceContainer ndc0[3]; |
156 for (int i = 0; i < 3; ++i) | 155 for (int i = 0; i < 3; ++i) |
157 { | 156 { |
158 ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]); | 157 ndc0[i] = p2p_1gb5ms.Install (nodes_net0[z][i]); |
159 } | 158 } |
160 // Create Net1 | 159 // Create Net1 |
161 cout << " 1"; | 160 cout << " 1"; |
162 for (int i = 0; i < 6; ++i) | 161 for (int i = 0; i < 6; ++i) |
163 { | 162 { |
164 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 163 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
165 nodes_net1[z][i].Add (node); | 164 nodes_net1[z][i].Add (node); |
166 stack.Install (nodes_net1[z][i]); | 165 stack.Install (nodes_net1[z][i]); |
167 } | 166 } |
168 nodes_net1[z][0].Add (nodes_net1[z][1].Get (0)); | 167 nodes_net1[z][0].Add (nodes_net1[z][1].Get (0)); |
169 nodes_net1[z][2].Add (nodes_net1[z][0].Get (0)); | 168 nodes_net1[z][2].Add (nodes_net1[z][0].Get (0)); |
170 nodes_net1[z][3].Add (nodes_net1[z][0].Get (0)); | 169 nodes_net1[z][3].Add (nodes_net1[z][0].Get (0)); |
171 nodes_net1[z][4].Add (nodes_net1[z][1].Get (0)); | 170 nodes_net1[z][4].Add (nodes_net1[z][1].Get (0)); |
172 nodes_net1[z][5].Add (nodes_net1[z][1].Get (0)); | 171 nodes_net1[z][5].Add (nodes_net1[z][1].Get (0)); |
173 NetDeviceContainer ndc1[6]; | 172 NetDeviceContainer ndc1[6]; |
174 for (int i = 0; i < 6; ++i) | 173 for (int i = 0; i < 6; ++i) |
175 { | 174 { |
176 if (i == 1) continue; | 175 if (i == 1) |
| 176 { |
| 177 continue; |
| 178 } |
177 ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]); | 179 ndc1[i] = p2p_1gb5ms.Install (nodes_net1[z][i]); |
178 } | 180 } |
179 // Connect Net0 <-> Net1 | 181 // Connect Net0 <-> Net1 |
180 NodeContainer net0_1; | 182 NodeContainer net0_1; |
181 net0_1.Add (nodes_net0[z][2].Get (0)); | 183 net0_1.Add (nodes_net0[z][2].Get (0)); |
182 net0_1.Add (nodes_net1[z][0].Get (0)); | 184 net0_1.Add (nodes_net1[z][0].Get (0)); |
183 NetDeviceContainer ndc0_1; | 185 NetDeviceContainer ndc0_1; |
184 ndc0_1 = p2p_1gb5ms.Install (net0_1); | 186 ndc0_1 = p2p_1gb5ms.Install (net0_1); |
185 oss.str (""); | 187 oss.str (""); |
186 oss << 10 + z << ".1.252.0"; | 188 oss << 10 + z << ".1.252.0"; |
187 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 189 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
188 ifs = address.Assign (ndc0_1); | 190 ifs = address.Assign (ndc0_1); |
189 // Create Net2 | 191 // Create Net2 |
190 cout << " 2"; | 192 cout << " 2"; |
191 for (int i = 0; i < 14; ++i) | 193 for (int i = 0; i < 14; ++i) |
192 { | 194 { |
193 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 195 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
194 nodes_net2[z][i].Add (node); | 196 nodes_net2[z][i].Add (node); |
195 stack.Install (nodes_net2[z][i]); | 197 stack.Install (nodes_net2[z][i]); |
196 } | 198 } |
197 nodes_net2[z][0].Add (nodes_net2[z][1].Get (0)); | 199 nodes_net2[z][0].Add (nodes_net2[z][1].Get (0)); |
198 nodes_net2[z][2].Add (nodes_net2[z][0].Get (0)); | 200 nodes_net2[z][2].Add (nodes_net2[z][0].Get (0)); |
199 nodes_net2[z][1].Add (nodes_net2[z][3].Get (0)); | 201 nodes_net2[z][1].Add (nodes_net2[z][3].Get (0)); |
200 nodes_net2[z][3].Add (nodes_net2[z][2].Get (0)); | 202 nodes_net2[z][3].Add (nodes_net2[z][2].Get (0)); |
201 nodes_net2[z][4].Add (nodes_net2[z][2].Get (0)); | 203 nodes_net2[z][4].Add (nodes_net2[z][2].Get (0)); |
202 nodes_net2[z][5].Add (nodes_net2[z][3].Get (0)); | 204 nodes_net2[z][5].Add (nodes_net2[z][3].Get (0)); |
203 nodes_net2[z][6].Add (nodes_net2[z][5].Get (0)); | 205 nodes_net2[z][6].Add (nodes_net2[z][5].Get (0)); |
204 nodes_net2[z][7].Add (nodes_net2[z][2].Get (0)); | 206 nodes_net2[z][7].Add (nodes_net2[z][2].Get (0)); |
205 nodes_net2[z][8].Add (nodes_net2[z][3].Get (0)); | 207 nodes_net2[z][8].Add (nodes_net2[z][3].Get (0)); |
206 nodes_net2[z][9].Add (nodes_net2[z][4].Get (0)); | 208 nodes_net2[z][9].Add (nodes_net2[z][4].Get (0)); |
207 nodes_net2[z][10].Add (nodes_net2[z][5].Get (0)); | 209 nodes_net2[z][10].Add (nodes_net2[z][5].Get (0)); |
208 nodes_net2[z][11].Add (nodes_net2[z][6].Get (0)); | 210 nodes_net2[z][11].Add (nodes_net2[z][6].Get (0)); |
209 nodes_net2[z][12].Add (nodes_net2[z][6].Get (0)); | 211 nodes_net2[z][12].Add (nodes_net2[z][6].Get (0)); |
210 nodes_net2[z][13].Add (nodes_net2[z][6].Get (0)); | 212 nodes_net2[z][13].Add (nodes_net2[z][6].Get (0)); |
211 NetDeviceContainer ndc2[14]; | 213 NetDeviceContainer ndc2[14]; |
212 for (int i = 0; i < 14; ++i) | 214 for (int i = 0; i < 14; ++i) |
213 { | 215 { |
214 ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]); | 216 ndc2[i] = p2p_1gb5ms.Install (nodes_net2[z][i]); |
215 } | 217 } |
216 NetDeviceContainer ndc2LAN[7][nLANClients]; | 218 NetDeviceContainer ndc2LAN[7][nLANClients]; |
217 for (int i = 0; i < 7; ++i) | 219 for (int i = 0; i < 7; ++i) |
218 { | 220 { |
219 oss.str (""); | 221 oss.str (""); |
220 oss << 10 + z << ".4." << 15 + i << ".0"; | 222 oss << 10 + z << ".4." << 15 + i << ".0"; |
221 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 223 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
222 for (uint32_t j = 0; j < nLANClients; ++j) | 224 for (uint32_t j = 0; j < nLANClients; ++j) |
223 { | 225 { |
224 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 226 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
225 nodes_net2LAN[z][i][j].Add (node); | 227 nodes_net2LAN[z][i][j].Add (node); |
226 stack.Install (nodes_net2LAN[z][i][j]); | 228 stack.Install (nodes_net2LAN[z][i][j]); |
227 nodes_net2LAN[z][i][j].Add (nodes_net2[z][i+7].Get (0)); | 229 nodes_net2LAN[z][i][j].Add (nodes_net2[z][i + 7].Get (0)); |
228 ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]); | 230 ndc2LAN[i][j] = p2p_100mb1ms.Install (nodes_net2LAN[z][i][j]); |
229 ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]); | 231 ifs2LAN[z][i][j] = address.Assign (ndc2LAN[i][j]); |
230 } | 232 } |
231 } | 233 } |
232 // Create Net3 | 234 // Create Net3 |
233 cout << " 3 ]" << endl; | 235 cout << " 3 ]" << endl; |
234 for (int i = 0; i < 9; ++i) | 236 for (int i = 0; i < 9; ++i) |
235 { | 237 { |
236 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 238 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
237 nodes_net3[z][i].Add (node); | 239 nodes_net3[z][i].Add (node); |
238 stack.Install (nodes_net3[z][i]); | 240 stack.Install (nodes_net3[z][i]); |
239 } | 241 } |
240 nodes_net3[z][0].Add (nodes_net3[z][1].Get (0)); | 242 nodes_net3[z][0].Add (nodes_net3[z][1].Get (0)); |
241 nodes_net3[z][1].Add (nodes_net3[z][2].Get (0)); | 243 nodes_net3[z][1].Add (nodes_net3[z][2].Get (0)); |
242 nodes_net3[z][2].Add (nodes_net3[z][3].Get (0)); | 244 nodes_net3[z][2].Add (nodes_net3[z][3].Get (0)); |
243 nodes_net3[z][3].Add (nodes_net3[z][1].Get (0)); | 245 nodes_net3[z][3].Add (nodes_net3[z][1].Get (0)); |
244 nodes_net3[z][4].Add (nodes_net3[z][0].Get (0)); | 246 nodes_net3[z][4].Add (nodes_net3[z][0].Get (0)); |
245 nodes_net3[z][5].Add (nodes_net3[z][0].Get (0)); | 247 nodes_net3[z][5].Add (nodes_net3[z][0].Get (0)); |
246 nodes_net3[z][6].Add (nodes_net3[z][2].Get (0)); | 248 nodes_net3[z][6].Add (nodes_net3[z][2].Get (0)); |
247 nodes_net3[z][7].Add (nodes_net3[z][3].Get (0)); | 249 nodes_net3[z][7].Add (nodes_net3[z][3].Get (0)); |
248 nodes_net3[z][8].Add (nodes_net3[z][3].Get (0)); | 250 nodes_net3[z][8].Add (nodes_net3[z][3].Get (0)); |
249 NetDeviceContainer ndc3[9]; | 251 NetDeviceContainer ndc3[9]; |
250 for (int i = 0; i < 9; ++i) | 252 for (int i = 0; i < 9; ++i) |
251 { | 253 { |
252 ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]); | 254 ndc3[i] = p2p_1gb5ms.Install (nodes_net3[z][i]); |
253 } | 255 } |
254 NetDeviceContainer ndc3LAN[5][nLANClients]; | 256 NetDeviceContainer ndc3LAN[5][nLANClients]; |
255 for (int i = 0; i < 5; ++i) | 257 for (int i = 0; i < 5; ++i) |
256 { | 258 { |
257 oss.str (""); | 259 oss.str (""); |
258 oss << 10 + z << ".5." << 10 + i << ".0"; | 260 oss << 10 + z << ".5." << 10 + i << ".0"; |
259 address.SetBase (oss.str ().c_str (), "255.255.255.255"); | 261 address.SetBase (oss.str ().c_str (), "255.255.255.255"); |
260 for (uint32_t j = 0; j < nLANClients; ++j) | 262 for (uint32_t j = 0; j < nLANClients; ++j) |
261 { | 263 { |
262 Ptr<Node> node = CreateObject<Node> (z%systemCount); | 264 Ptr<Node> node = CreateObject<Node> (z % systemCount); |
263 nodes_net3LAN[z][i][j].Add (node); | 265 nodes_net3LAN[z][i][j].Add (node); |
264 stack.Install (nodes_net3LAN[z][i][j]); | 266 stack.Install (nodes_net3LAN[z][i][j]); |
265 nodes_net3LAN[z][i][j].Add (nodes_net3[z][i+4].Get (0)); | 267 nodes_net3LAN[z][i][j].Add (nodes_net3[z][i + 4].Get (0)); |
266 ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]); | 268 ndc3LAN[i][j] = p2p_100mb1ms.Install (nodes_net3LAN[z][i][j]); |
267 ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]); | 269 ifs3LAN[z][i][j] = address.Assign (ndc3LAN[i][j]); |
268 } | 270 } |
269 } | 271 } |
270 cout << " Connecting Subnets..." << endl; | 272 cout << " Connecting Subnets..." << endl; |
271 // Create Lone Routers (Node 4 & 5) | 273 // Create Lone Routers (Node 4 & 5) |
272 Ptr<Node> node1 = CreateObject<Node> (z%systemCount); | 274 Ptr<Node> node1 = CreateObject<Node> (z % systemCount); |
273 Ptr<Node> node2 = CreateObject<Node> (z%systemCount); | 275 Ptr<Node> node2 = CreateObject<Node> (z % systemCount); |
274 nodes_netLR[z].Add (node1); | 276 nodes_netLR[z].Add (node1); |
275 nodes_netLR[z].Add (node2); | 277 nodes_netLR[z].Add (node2); |
276 stack.Install (nodes_netLR[z]); | 278 stack.Install (nodes_netLR[z]); |
277 NetDeviceContainer ndcLR; | 279 NetDeviceContainer ndcLR; |
278 ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]); | 280 ndcLR = p2p_1gb5ms.Install (nodes_netLR[z]); |
279 // Connect Net2/Net3 through Lone Routers to Net0 | 281 // Connect Net2/Net3 through Lone Routers to Net0 |
280 NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b; | 282 NodeContainer net0_4, net0_5, net2_4a, net2_4b, net3_5a, net3_5b; |
281 net0_4.Add (nodes_netLR[z].Get (0)); | 283 net0_4.Add (nodes_netLR[z].Get (0)); |
282 net0_4.Add (nodes_net0[z][0].Get (0)); | 284 net0_4.Add (nodes_net0[z][0].Get (0)); |
283 net0_5.Add (nodes_netLR[z].Get (1)); | 285 net0_5.Add (nodes_netLR[z].Get (1)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 oss << 10 + z << ".5.253.0"; | 318 oss << 10 + z << ".5.253.0"; |
317 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 319 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
318 ifs = address.Assign (ndc3_5a); | 320 ifs = address.Assign (ndc3_5a); |
319 ndc3_5b = p2p_1gb5ms.Install (net3_5b); | 321 ndc3_5b = p2p_1gb5ms.Install (net3_5b); |
320 oss.str (""); | 322 oss.str (""); |
321 oss << 10 + z << ".5.254.0"; | 323 oss << 10 + z << ".5.254.0"; |
322 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 324 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
323 ifs = address.Assign (ndc3_5b); | 325 ifs = address.Assign (ndc3_5b); |
324 // Assign IP addresses | 326 // Assign IP addresses |
325 cout << " Assigning IP addresses..." << endl; | 327 cout << " Assigning IP addresses..." << endl; |
326 for (int i = 0; i < 3; ++i) | 328 for (int i = 0; i < 3; ++i) |
327 { | 329 { |
328 oss.str (""); | 330 oss.str (""); |
329 oss << 10 + z << ".1." << 1 + i << ".0"; | 331 oss << 10 + z << ".1." << 1 + i << ".0"; |
330 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 332 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
331 ifs0[z][i] = address.Assign (ndc0[i]); | 333 ifs0[z][i] = address.Assign (ndc0[i]); |
332 } | 334 } |
333 for (int i = 0; i < 6; ++i) | 335 for (int i = 0; i < 6; ++i) |
334 { | 336 { |
335 if (i == 1) continue; | 337 if (i == 1) |
| 338 { |
| 339 continue; |
| 340 } |
336 oss.str (""); | 341 oss.str (""); |
337 oss << 10 + z << ".2." << 1 + i << ".0"; | 342 oss << 10 + z << ".2." << 1 + i << ".0"; |
338 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 343 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
339 ifs1[z][i] = address.Assign (ndc1[i]); | 344 ifs1[z][i] = address.Assign (ndc1[i]); |
340 } | 345 } |
341 oss.str (""); | 346 oss.str (""); |
342 oss << 10 + z << ".3.1.0"; | 347 oss << 10 + z << ".3.1.0"; |
343 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 348 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
344 ifs = address.Assign (ndcLR); | 349 ifs = address.Assign (ndcLR); |
345 for (int i = 0; i < 14; ++i) | 350 for (int i = 0; i < 14; ++i) |
346 { | 351 { |
347 oss.str (""); | 352 oss.str (""); |
348 oss << 10 + z << ".4." << 1 + i << ".0"; | 353 oss << 10 + z << ".4." << 1 + i << ".0"; |
349 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 354 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
350 ifs2[z][i] = address.Assign (ndc2[i]); | 355 ifs2[z][i] = address.Assign (ndc2[i]); |
351 } | 356 } |
352 for (int i = 0; i < 9; ++i) | 357 for (int i = 0; i < 9; ++i) |
353 { | 358 { |
354 oss.str (""); | 359 oss.str (""); |
355 oss << 10 + z << ".5." << 1 + i << ".0"; | 360 oss << 10 + z << ".5." << 1 + i << ".0"; |
356 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 361 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
357 ifs3[z][i] = address.Assign (ndc3[i]); | 362 ifs3[z][i] = address.Assign (ndc3[i]); |
358 } | 363 } |
359 } | 364 } |
360 // Create Ring Links | 365 // Create Ring Links |
361 if (nCN > 1)· | 366 if (nCN > 1) |
362 { | 367 { |
363 cout << "Forming Ring Topology..." << endl; | 368 cout << "Forming Ring Topology..." << endl; |
364 NodeContainer nodes_ring[nCN]; | 369 NodeContainer nodes_ring[nCN]; |
365 for (uint32_t z = 0; z < nCN-1; ++z)· | 370 for (uint32_t z = 0; z < nCN - 1; ++z) |
366 { | 371 { |
367 nodes_ring[z].Add (nodes_net0[z][0].Get (0)); | 372 nodes_ring[z].Add (nodes_net0[z][0].Get (0)); |
368 nodes_ring[z].Add (nodes_net0[z+1][0].Get (0)); | 373 nodes_ring[z].Add (nodes_net0[z + 1][0].Get (0)); |
369 } | 374 } |
370 nodes_ring[nCN-1].Add (nodes_net0[nCN-1][0].Get (0)); | 375 nodes_ring[nCN - 1].Add (nodes_net0[nCN - 1][0].Get (0)); |
371 nodes_ring[nCN-1].Add (nodes_net0[0][0].Get (0)); | 376 nodes_ring[nCN - 1].Add (nodes_net0[0][0].Get (0)); |
372 NetDeviceContainer ndc_ring[nCN]; | 377 NetDeviceContainer ndc_ring[nCN]; |
373 for (uint32_t z = 0; z < nCN; ++z)· | 378 for (uint32_t z = 0; z < nCN; ++z) |
374 { | 379 { |
375 ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]); | 380 ndc_ring[z] = p2p_2gb200ms.Install (nodes_ring[z]); |
376 oss.str (""); | 381 oss.str (""); |
377 oss << "254.1." << z + 1 << ".0"; | 382 oss << "254.1." << z + 1 << ".0"; |
378 address.SetBase (oss.str ().c_str (), "255.255.255.0"); | 383 address.SetBase (oss.str ().c_str (), "255.255.255.0"); |
379 ifs = address.Assign (ndc_ring[z]); | 384 ifs = address.Assign (ndc_ring[z]); |
380 } | 385 } |
381 } | 386 } |
382 | 387 |
383 // Create Traffic Flows | 388 // Create Traffic Flows |
384 cout << "Creating UDP Traffic Flows:" << endl; | 389 cout << "Creating UDP Traffic Flows:" << endl; |
385 Config::SetDefault ("ns3::OnOffApplication::MaxBytes", | 390 Config::SetDefault ("ns3::OnOffApplication::MaxBytes", |
386 UintegerValue (nBytes)); | 391 UintegerValue (nBytes)); |
387 Config::SetDefault ("ns3::OnOffApplication::OnTime", | 392 Config::SetDefault ("ns3::OnOffApplication::OnTime", |
388 RandomVariableValue (ConstantVariable (1))); | 393 RandomVariableValue (ConstantVariable (1))); |
389 Config::SetDefault ("ns3::OnOffApplication::OffTime", | 394 Config::SetDefault ("ns3::OnOffApplication::OffTime", |
390 RandomVariableValue (ConstantVariable (0))); | 395 RandomVariableValue (ConstantVariable (0))); |
391 | 396 |
392 | 397 |
393 if (single) | 398 if (single) |
394 { | 399 { |
395 if (systemCount == 1) | 400 if (systemCount == 1) |
396 { | 401 { |
397 PacketSinkHelper sinkHelper ("ns3::UdpSocketFactory", | 402 PacketSinkHelper sinkHelper ("ns3::UdpSocketFactory", |
398 InetSocketAddress (Ipv4Address::GetAny ()
, | 403 InetSocketAddress (Ipv4Address::GetAny ()
, |
399 9999)); | 404 9999)); |
400 ApplicationContainer sinkApp = sinkHelper.Install (nodes_net1[0][2].Ge
t (0)); | 405 ApplicationContainer sinkApp = sinkHelper.Install (nodes_net1[0][2].Ge
t (0)); |
401 sinkApp.Start(Seconds(0.0)); | |
402 | |
403 OnOffHelper client("ns3::UdpSocketFactory", Address()); | |
404 AddressValue remoteAddress(InetSocketAddress(ifs1[0][2].GetAddress(0),
9999)); | |
405 cout << "Remote Address is " << ifs1[0][2].GetAddress(0) << endl; | |
406 client.SetAttribute("Remote", remoteAddress); | |
407 | |
408 ApplicationContainer clientApp; | |
409 clientApp.Add(client.Install(nodes_net2LAN[0][0][0].Get(0))); | |
410 clientApp.Start(Seconds(0)); | |
411 } | |
412 else if (rank == 1) | |
413 { | |
414 PacketSinkHelper sinkHelper("ns3::UdpSocketFactory", | |
415 InetSocketAddress(Ipv4Address::GetAny(), | |
416 9999)); | |
417 ApplicationContainer sinkApp =· | |
418 sinkHelper.Install(nodes_net1[1][0].Get(0)); | |
419 | |
420 sinkApp.Start (Seconds (0.0)); | 406 sinkApp.Start (Seconds (0.0)); |
421 } | 407 |
422 else if (rank == 0) | |
423 { | |
424 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); | 408 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
425 AddressValue remoteAddress | 409 AddressValue remoteAddress (InetSocketAddress (ifs1[0][2].GetAddress (
0), 9999)); |
426 (InetSocketAddress (ifs1[1][0].GetAddress (0), 9999)); | 410 cout << "Remote Address is " << ifs1[0][2].GetAddress (0) << endl; |
427 | |
428 cout << "Remote Address is " << ifs1[1][0].GetAddress (0) << endl; | |
429 client.SetAttribute ("Remote", remoteAddress); | 411 client.SetAttribute ("Remote", remoteAddress); |
430 | 412 |
431 ApplicationContainer clientApp; | 413 ApplicationContainer clientApp; |
432 clientApp.Add (client.Install (nodes_net2LAN[0][0][0].Get (0))); | 414 clientApp.Add (client.Install (nodes_net2LAN[0][0][0].Get (0))); |
433 clientApp.Start (Seconds (0)); | 415 clientApp.Start (Seconds (0)); |
434 } | 416 } |
| 417 else if (systemId == 1) |
| 418 { |
| 419 PacketSinkHelper sinkHelper ("ns3::UdpSocketFactory", |
| 420 InetSocketAddress (Ipv4Address::GetAny ()
, |
| 421 9999)); |
| 422 ApplicationContainer sinkApp = |
| 423 sinkHelper.Install (nodes_net1[1][0].Get (0)); |
| 424 |
| 425 sinkApp.Start (Seconds (0.0)); |
| 426 } |
| 427 else if (systemId == 0) |
| 428 { |
| 429 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
| 430 AddressValue remoteAddress |
| 431 (InetSocketAddress (ifs1[1][0].GetAddress (0), 9999)); |
| 432 |
| 433 cout << "Remote Address is " << ifs1[1][0].GetAddress (0) << endl; |
| 434 client.SetAttribute ("Remote", remoteAddress); |
| 435 |
| 436 ApplicationContainer clientApp; |
| 437 clientApp.Add (client.Install (nodes_net2LAN[0][0][0].Get (0))); |
| 438 clientApp.Start (Seconds (0)); |
| 439 } |
435 } | 440 } |
436 else | 441 else |
437 { | 442 { |
438 UniformVariable urng; | 443 UniformVariable urng; |
439 int r1; | 444 int r1; |
440 double r2; | 445 double r2; |
441 for (uint32_t z = 0; z < nCN; ++z) | 446 for (uint32_t z = 0; z < nCN; ++z) |
442 { | 447 { |
443 uint32_t x = z + 1; | 448 uint32_t x = z + 1; |
444 if (z == nCN - 1) | 449 if (z == nCN - 1) |
445 { | 450 { |
446 x = 0; | 451 x = 0; |
447 } | 452 } |
448 // Subnet 2 LANs | 453 // Subnet 2 LANs |
449 cout << " Campus Network " << z << " Flows [ Net2 "; | 454 cout << " Campus Network " << z << " Flows [ Net2 "; |
450 for (int i = 0; i < 7; ++i) | 455 for (int i = 0; i < 7; ++i) |
451 { | 456 { |
452 for (uint32_t j = 0; j < nLANClients; ++j) | 457 for (uint32_t j = 0; j < nLANClients; ++j) |
453 { | 458 { |
454 // Sinks | 459 // Sinks |
455 if (systemCount == 1) | 460 if (systemCount == 1) |
456 { | 461 { |
457 PacketSinkHelper sinkHelper· | 462 PacketSinkHelper sinkHelper |
458 ("ns3::UdpSocketFactory",· | 463 ("ns3::UdpSocketFactory", |
459 InetSocketAddress (Ipv4Address::GetAny (), 9999)); | 464 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
460 | 465 |
461 ApplicationContainer sinkApp = | 466 ApplicationContainer sinkApp = |
462 sinkHelper.Install (nodes_net2LAN[z][i][j].Get (0)); | 467 sinkHelper.Install (nodes_net2LAN[z][i][j].Get (0)); |
463 | 468 |
464 sinkApp.Start(Seconds (100.0)); | 469 sinkApp.Start (Seconds (100.0)); |
465 } | 470 } |
466 else if (rank == z%systemCount) | 471 else if (systemId == z % systemCount) |
467 { | 472 { |
468 PacketSinkHelper sinkHelper· | 473 PacketSinkHelper sinkHelper |
469 ("ns3::UdpSocketFactory",· | 474 ("ns3::UdpSocketFactory", |
470 InetSocketAddress (Ipv4Address::GetAny (), 9999)); | 475 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
471 | 476 |
472 ApplicationContainer sinkApp =· | 477 ApplicationContainer sinkApp = |
473 sinkHelper.Install (nodes_net2LAN[z][i][j].Get (0)); | 478 sinkHelper.Install (nodes_net2LAN[z][i][j].Get (0)); |
474 | 479 |
475 sinkApp.Start (Seconds (100.0)); | 480 sinkApp.Start (Seconds (100.0)); |
476 } | 481 } |
477 // Sources | 482 // Sources |
478 if (systemCount == 1) | 483 if (systemCount == 1) |
479 { | 484 { |
480 r1 = 2 + (int)(4 * urng.GetValue ()); | 485 r1 = 2 + (int)(4 * urng.GetValue ()); |
481 r2 = 100 + (10 * urng.GetValue ()); | 486 r2 = 100 + (10 * urng.GetValue ()); |
482 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); | 487 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
483 | 488 |
484 AddressValue remoteAddress· | 489 AddressValue remoteAddress |
485 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0), 9999
)); | 490 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0)
, 9999)); |
486 | 491 |
487 client.SetAttribute ("Remote", remoteAddress); | 492 client.SetAttribute ("Remote", remoteAddress); |
488 ApplicationContainer clientApp; | 493 ApplicationContainer clientApp; |
489 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; | 494 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; |
490 clientApp.Start (Seconds (r2)); | 495 clientApp.Start (Seconds (r2)); |
491 } | 496 } |
492 else if (rank == x%systemCount) | 497 else if (systemId == x % systemCount) |
493 { | 498 { |
494 r1 = 2 + (int)(4 * urng.GetValue ()); | 499 r1 = 2 + (int)(4 * urng.GetValue ()); |
495 r2 = 100 + (10 * urng.GetValue ()); | 500 r2 = 100 + (10 * urng.GetValue ()); |
496 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); | 501 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
497 | 502 |
498 AddressValue remoteAddress· | 503 AddressValue remoteAddress |
499 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0), 9999
)); | 504 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0)
, 9999)); |
500 | 505 |
501 client.SetAttribute ("Remote", remoteAddress); | 506 client.SetAttribute ("Remote", remoteAddress); |
502 ApplicationContainer clientApp; | 507 ApplicationContainer clientApp; |
503 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; | 508 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; |
504 clientApp.Start (Seconds (r2)); | 509 clientApp.Start (Seconds (r2)); |
505 } | 510 } |
506 } | 511 } |
507 } | 512 } |
508 // Subnet 3 LANs | 513 // Subnet 3 LANs |
509 cout << "Net3 ]" << endl; | 514 cout << "Net3 ]" << endl; |
510 for (int i = 0; i < 5; ++i) | 515 for (int i = 0; i < 5; ++i) |
511 { | 516 { |
512 for (uint32_t j = 0; j < nLANClients; ++j) | 517 for (uint32_t j = 0; j < nLANClients; ++j) |
513 { | 518 { |
514 // Sinks | 519 // Sinks |
515 if (systemCount == 1) | 520 if (systemCount == 1) |
516 { | 521 { |
517 PacketSinkHelper sinkHelper· | 522 PacketSinkHelper sinkHelper |
518 ("ns3::UdpSocketFactory", | 523 ("ns3::UdpSocketFactory", |
519 InetSocketAddress(Ipv4Address::GetAny (), 9999)); | 524 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
520 | 525 |
521 ApplicationContainer sinkApp = | 526 ApplicationContainer sinkApp = |
522 sinkHelper.Install (nodes_net3LAN[z][i][j].Get (0)); | 527 sinkHelper.Install (nodes_net3LAN[z][i][j].Get (0)); |
523 | 528 |
524 sinkApp.Start (Seconds (100.0)); | 529 sinkApp.Start (Seconds (100.0)); |
525 } | 530 } |
526 else if (rank == z%systemCount) | 531 else if (systemId == z % systemCount) |
527 { | 532 { |
528 PacketSinkHelper sinkHelper· | 533 PacketSinkHelper sinkHelper |
529 ("ns3::UdpSocketFactory",· | 534 ("ns3::UdpSocketFactory", |
530 InetSocketAddress (Ipv4Address::GetAny (), 9999)); | 535 InetSocketAddress (Ipv4Address::GetAny (), 9999)); |
531 | 536 |
532 ApplicationContainer sinkApp = | 537 ApplicationContainer sinkApp = |
533 sinkHelper.Install (nodes_net3LAN[z][i][j].Get (0)); | 538 sinkHelper.Install (nodes_net3LAN[z][i][j].Get (0)); |
534 | 539 |
535 sinkApp.Start (Seconds (100.0)); | 540 sinkApp.Start (Seconds (100.0)); |
536 } | 541 } |
537 // Sources | 542 // Sources |
538 if (systemCount == 1) | 543 if (systemCount == 1) |
539 { | 544 { |
540 r1 = 2 + (int)(4 * urng.GetValue ()); | 545 r1 = 2 + (int)(4 * urng.GetValue ()); |
541 r2 = 100 + (10 * urng.GetValue ()); | 546 r2 = 100 + (10 * urng.GetValue ()); |
542 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); | 547 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
543 | 548 |
544 AddressValue remoteAddress· | 549 AddressValue remoteAddress |
545 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0), 999
9)); | 550 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0
), 9999)); |
546 | 551 |
547 client.SetAttribute ("Remote", remoteAddress); | 552 client.SetAttribute ("Remote", remoteAddress); |
548 ApplicationContainer clientApp; | 553 ApplicationContainer clientApp; |
549 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; | 554 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; |
550 clientApp.Start (Seconds (r2)); | 555 clientApp.Start (Seconds (r2)); |
551 } | 556 } |
552 else if (rank == x%systemCount) | 557 else if (systemId == x % systemCount) |
553 { | 558 { |
554 r1 = 2 + (int)(4 * urng.GetValue ()); | 559 r1 = 2 + (int)(4 * urng.GetValue ()); |
555 r2 = 100 + (10 * urng.GetValue ()); | 560 r2 = 100 + (10 * urng.GetValue ()); |
556 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); | 561 OnOffHelper client ("ns3::UdpSocketFactory", Address ()); |
557 | 562 |
558 AddressValue remoteAddress· | 563 AddressValue remoteAddress |
559 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0), 999
9)); | 564 (InetSocketAddress (ifs2LAN[z][i][j].GetAddress (0
), 9999)); |
560 | 565 |
561 client.SetAttribute ("Remote", remoteAddress); | 566 client.SetAttribute ("Remote", remoteAddress); |
562 ApplicationContainer clientApp; | 567 ApplicationContainer clientApp; |
563 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; | 568 clientApp.Add (client.Install (nodes_net1[x][r1].Get (0)))
; |
564 clientApp.Start (Seconds (r2)); | 569 clientApp.Start (Seconds (r2)); |
565 } | 570 } |
566 } | 571 } |
567 } | 572 } |
568 } | 573 } |
569 } | 574 } |
570 | 575 |
571 cout << "Created " << NodeList::GetNNodes () << " nodes." << endl; | 576 cout << "Created " << NodeList::GetNNodes () << " nodes." << endl; |
572 TIMER_TYPE routingStart; | 577 TIMER_TYPE routingStart; |
573 TIMER_NOW (routingStart); | 578 TIMER_NOW (routingStart); |
574 | 579 |
575 if (nix) | 580 if (nix) |
576 { | 581 { |
577 cout << "Using Nix-vectors..." << endl; | 582 cout << "Using Nix-vectors..." << endl; |
578 } | 583 } |
579 else | 584 else |
580 { | 585 { |
581 // Calculate routing tables | 586 // Calculate routing tables |
582 cout << "Populating Routing tables..." << endl; | 587 cout << "Populating Routing tables..." << endl; |
583 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); | 588 Ipv4GlobalRoutingHelper::PopulateRoutingTables (); |
584 } | 589 } |
585 | 590 |
586 TIMER_TYPE routingEnd; | 591 TIMER_TYPE routingEnd; |
587 TIMER_NOW (routingEnd); | 592 TIMER_NOW (routingEnd); |
588 cout << "Routing tables population took " | 593 cout << "Routing tables population took " |
589 << TIMER_DIFF (routingEnd, routingStart) << endl; | 594 << TIMER_DIFF (routingEnd, routingStart) << endl; |
590 | |
591 if (tracing) | |
592 { | |
593 oss.str(""); | |
594 oss << "nms_udp_nix_rank" << rank << ".tr"; | |
595 std::ofstream ascii; | |
596 ascii.open(oss.str().c_str()); | |
597 PointToPointHelper::EnableAsciiAll(ascii); | |
598 } | |
599 | 595 |
600 cout << "Running simulator..." << endl; | 596 cout << "Running simulator..." << endl; |
601 TIMER_NOW (t1); | 597 TIMER_NOW (t1); |
602 Simulator::Stop (Seconds(200.0)); | 598 Simulator::Stop (Seconds (200.0)); |
603 Simulator::Run (); | 599 Simulator::Run (); |
604 TIMER_NOW (t2); | 600 TIMER_NOW (t2); |
605 cout << "Simulator finished." << endl; | 601 cout << "Simulator finished." << endl; |
606 Simulator::Destroy (); | 602 Simulator::Destroy (); |
607 | 603 |
608 double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1); | 604 double d1 = TIMER_DIFF (t1, t0), d2 = TIMER_DIFF (t2, t1); |
609 cout << "-----" << endl << "Runtime Stats:" << endl; | 605 cout << "-----" << endl << "Runtime Stats:" << endl; |
610 cout << "Simulator init time: " << d1 << endl; | 606 cout << "Simulator init time: " << d1 << endl; |
611 cout << "Simulator run time: " << d2 << endl; | 607 cout << "Simulator run time: " << d2 << endl; |
612 cout << "Total elapsed time: " << d1+d2 << endl; | 608 cout << "Total elapsed time: " << d1 + d2 << endl; |
613 return 0; | 609 return 0; |
614 #else | 610 #else |
615 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); | 611 NS_FATAL_ERROR ("Can't use distributed simulator without MPI compiled in"); |
616 #endif | 612 #endif |
617 } | 613 } |
618 | 614 |
LEFT | RIGHT |