author | Raj Bhattacharjea <raj.b@gatech.edu> |
Wed, 01 Apr 2009 19:09:12 -0400 | |
changeset 4306 | 5396ecd09060 |
parent 4211 | 11cae8936153 |
permissions | -rw-r--r-- |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
1 |
# /* |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
2 |
# * This program is free software; you can redistribute it and/or modify |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
3 |
# * it under the terms of the GNU General Public License version 2 as |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
4 |
# * published by the Free Software Foundation; |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
5 |
# * |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
6 |
# * This program is distributed in the hope that it will be useful, |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
7 |
# * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
8 |
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
9 |
# * GNU General Public License for more details. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
10 |
# * |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
11 |
# * You should have received a copy of the GNU General Public License |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
12 |
# * along with this program; if not, write to the Free Software |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
13 |
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
14 |
# * |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
15 |
# */ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
16 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
17 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
18 |
# This ns-3 example demonstrates the use of helper functions to ease |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
19 |
# the construction of simulation scenarios. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
20 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
21 |
# The simulation topology consists of a mixed wired and wireless |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
22 |
# scenario in which a hierarchical mobility model is used. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
23 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
24 |
# The simulation layout consists of N backbone routers interconnected |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
25 |
# by an ad hoc wifi network. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
26 |
# Each backbone router also has a local 802.11 network and is connected |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
27 |
# to a local LAN. An additional set of(K-1) nodes are connected to |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
28 |
# this backbone. Finally, a local LAN is connected to each router |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
29 |
# on the backbone, with L-1 additional hosts. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
30 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
31 |
# The nodes are populated with TCP/IP stacks, and OLSR unicast routing |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
32 |
# on the backbone. An example UDP transfer is shown. The simulator |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
33 |
# be configured to output tcpdumps or traces from different nodes. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
34 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
35 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
36 |
# +--------------------------------------------------------+ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
37 |
# | | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
38 |
# | 802.11 ad hoc, ns-2 mobility | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
39 |
# | | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
40 |
# +--------------------------------------------------------+ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
41 |
# | o o o(N backbone routers) | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
42 |
# +--------+ +--------+ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
43 |
# wired LAN | mobile | wired LAN | mobile | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
44 |
# -----------| router | -----------| router | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
45 |
# --------- --------- |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
46 |
# | | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
47 |
# +----------------+ +----------------+ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
48 |
# | 802.11 | | 802.11 | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
49 |
# | net | | net | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
50 |
# | K-1 hosts | | K-1 hosts | |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
51 |
# +----------------+ +----------------+ |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
52 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
53 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
54 |
import ns3 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
55 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
56 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
57 |
# # This function will be used below as a trace sink |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
58 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
59 |
# static void |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
60 |
# CourseChangeCallback(std.string path, Ptr<const MobilityModel> model) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
61 |
# { |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
62 |
# Vector position = model.GetPosition(); |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
63 |
# std.cout << "CourseChange " << path << " x=" << position.x << ", y=" << position.y << ", z=" << position.z << std.endl; |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
64 |
# } |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
65 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
66 |
def main(argv): |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
67 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
68 |
# First, we declare and initialize a few local variables that control some |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
69 |
# simulation parameters. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
70 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
71 |
backboneNodes = 10 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
72 |
infraNodes = 5 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
73 |
lanNodes = 5 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
74 |
stopTime = 10 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
75 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
76 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
77 |
# Simulation defaults are typically set next, before command line |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
78 |
# arguments are parsed. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
79 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
80 |
ns3.Config.SetDefault("ns3::OnOffApplication::PacketSize", ns3.StringValue("210")) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
81 |
ns3.Config.SetDefault("ns3::OnOffApplication::DataRate", ns3.StringValue("448kb/s")) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
82 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
83 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
84 |
# For convenience, we add the local variables to the command line argument |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
85 |
# system so that they can be overridden with flags such as |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
86 |
# "--backboneNodes=20" |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
87 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
88 |
cmd = ns3.CommandLine() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
89 |
#cmd.AddValue("backboneNodes", "number of backbone nodes", backboneNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
90 |
#cmd.AddValue("infraNodes", "number of leaf nodes", infraNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
91 |
#cmd.AddValue("lanNodes", "number of LAN nodes", lanNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
92 |
#cmd.AddValue("stopTime", "simulation stop time(seconds)", stopTime) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
93 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
94 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
95 |
# The system global variables and the local values added to the argument |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
96 |
# system can be overridden by command line arguments by using this call. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
97 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
98 |
cmd.Parse(argv) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
99 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
100 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
101 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
102 |
# Construct the backbone # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
103 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
104 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
105 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
106 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
107 |
# Create a container to manage the nodes of the adhoc(backbone) network. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
108 |
# Later we'll create the rest of the nodes we'll need. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
109 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
110 |
backbone = ns3.NodeContainer() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
111 |
backbone.Create(backboneNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
112 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
113 |
# Create the backbone wifi net devices and install them into the nodes in |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
114 |
# our container |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
115 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
116 |
wifi = ns3.WifiHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
117 |
wifi.SetMac("ns3::AdhocWifiMac") |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
118 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
119 |
"DataMode", ns3.StringValue ("wifia-54mbs")) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
120 |
wifiPhy = ns3.YansWifiPhyHelper.Default () |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
121 |
wifiChannel = ns3.YansWifiChannelHelper.Default () |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
122 |
wifiPhy.SetChannel (wifiChannel.Create ()) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
123 |
backboneDevices = wifi.Install(wifiPhy, backbone) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
124 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
125 |
# Add the IPv4 protocol stack to the nodes in our container |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
126 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
127 |
internet = ns3.InternetStackHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
128 |
internet.Install(backbone) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
129 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
130 |
# Assign IPv4 addresses to the device drivers(actually to the associated |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
131 |
# IPv4 interfaces) we just created. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
132 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
133 |
ipAddrs = ns3.Ipv4AddressHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
134 |
ipAddrs.SetBase(ns3.Ipv4Address("192.168.0.0"), ns3.Ipv4Mask("255.255.255.0")) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
135 |
ipAddrs.Assign(backboneDevices) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
136 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
137 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
138 |
# The ad-hoc network nodes need a mobility model so we aggregate one to |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
139 |
# each of the nodes we just finished building. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
140 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
141 |
mobility = ns3.MobilityHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
142 |
positionAlloc = ns3.ListPositionAllocator() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
143 |
x = 0.0 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
144 |
for i in range(backboneNodes): |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
145 |
positionAlloc.Add(ns3.Vector(x, 0.0, 0.0)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
146 |
x += 5.0 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
147 |
mobility.SetPositionAllocator(positionAlloc) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
148 |
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel", |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
149 |
"Bounds", ns3.RectangleValue(ns3.Rectangle(0, 1000, 0, 1000)), |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
150 |
"Speed", ns3.RandomVariableValue(ns3.ConstantVariable(2000)), |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
151 |
"Pause", ns3.RandomVariableValue(ns3.ConstantVariable(0.2))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
152 |
mobility.Install(backbone) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
153 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
154 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
155 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
156 |
# Construct the LANs # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
157 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
158 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
159 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
160 |
# Reset the address base-- all of the CSMA networks will be in |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
161 |
# the "172.16 address space |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
162 |
ipAddrs.SetBase(ns3.Ipv4Address("172.16.0.0"), ns3.Ipv4Mask("255.255.255.0")) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
163 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
164 |
for i in range(backboneNodes): |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
165 |
print "Configuring local area network for backbone node ", i |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
166 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
167 |
# Create a container to manage the nodes of the LAN. We need |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
168 |
# two containers here; one with all of the new nodes, and one |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
169 |
# with all of the nodes including new and existing nodes |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
170 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
171 |
newLanNodes = ns3.NodeContainer() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
172 |
newLanNodes.Create(lanNodes - 1) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
173 |
# Now, create the container with all nodes on this link |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
174 |
lan = ns3.NodeContainer(ns3.NodeContainer(backbone.Get(i)), newLanNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
175 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
176 |
# Create the CSMA net devices and install them into the nodes in our |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
177 |
# collection. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
178 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
179 |
csma = ns3.CsmaHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
180 |
csma.SetChannelAttribute("DataRate", ns3.DataRateValue(ns3.DataRate(5000000))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
181 |
csma.SetChannelAttribute("Delay", ns3.TimeValue(ns3.MilliSeconds(2))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
182 |
lanDevices = csma.Install(lan) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
183 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
184 |
# Add the IPv4 protocol stack to the new LAN nodes |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
185 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
186 |
internet.Install(newLanNodes) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
187 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
188 |
# Assign IPv4 addresses to the device drivers(actually to the |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
189 |
# associated IPv4 interfaces) we just created. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
190 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
191 |
ipAddrs.Assign(lanDevices) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
192 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
193 |
# Assign a new network prefix for the next LAN, according to the |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
194 |
# network mask initialized above |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
195 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
196 |
ipAddrs.NewNetwork() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
197 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
198 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
199 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
200 |
# Construct the mobile networks # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
201 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
202 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
203 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
204 |
# Reset the address base-- all of the 802.11 networks will be in |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
205 |
# the "10.0" address space |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
206 |
ipAddrs.SetBase(ns3.Ipv4Address("10.0.0.0"), ns3.Ipv4Mask("255.255.255.0")) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
207 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
208 |
for i in range(backboneNodes): |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
209 |
print "Configuring wireless network for backbone node ", i |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
210 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
211 |
# Create a container to manage the nodes of the LAN. We need |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
212 |
# two containers here; one with all of the new nodes, and one |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
213 |
# with all of the nodes including new and existing nodes |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
214 |
# |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
215 |
stas = ns3.NodeContainer() |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
216 |
stas.Create(infraNodes - 1) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
217 |
# Now, create the container with all nodes on this link |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
218 |
infra = ns3.NodeContainer(ns3.NodeContainer(backbone.Get(i)), stas) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
219 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
220 |
# Create another ad hoc network and devices |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
221 |
# |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
222 |
ssid = ns3.Ssid ('wifi-infra' + str(i)) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
223 |
wifiInfra = ns3.WifiHelper.Default () |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
224 |
wifiPhy.SetChannel (wifiChannel.Create ()) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
225 |
wifiInfra.SetRemoteStationManager ('ns3::ArfWifiManager') |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
226 |
# setup stas |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
227 |
wifiInfra.SetMac ("ns3::NqstaWifiMac", |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
228 |
"Ssid", ns3.SsidValue (ssid), |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
229 |
"ActiveProbing", ns3.BooleanValue (False)) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
230 |
staDevices = wifiInfra.Install (wifiPhy, stas) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
231 |
# setup ap. |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
232 |
wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", ns3.SsidValue (ssid), |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
233 |
"BeaconGeneration", ns3.BooleanValue (True), |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
234 |
"BeaconInterval", ns3.TimeValue (ns3.Seconds (2.5))) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
235 |
apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i)) |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
236 |
# Collect all of these new devices |
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
237 |
infraDevices = ns3.NetDeviceContainer (apDevices, staDevices) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
238 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
239 |
# Add the IPv4 protocol stack to the nodes in our container |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
240 |
# |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
241 |
internet.Install(stas) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
242 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
243 |
# Assign IPv4 addresses to the device drivers(actually to the associated |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
244 |
# IPv4 interfaces) we just created. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
245 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
246 |
ipAddrs.Assign(infraDevices) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
247 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
248 |
# Assign a new network prefix for each mobile network, according to |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
249 |
# the network mask initialized above |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
250 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
251 |
ipAddrs.NewNetwork() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
252 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
253 |
# The new wireless nodes need a mobility model so we aggregate one |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
254 |
# to each of the nodes we just finished building. |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
255 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
256 |
subnetAlloc = ns3.ListPositionAllocator() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
257 |
for j in range(infra.GetN()): |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
258 |
subnetAlloc.Add(ns3.Vector(0.0, j, 0.0)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
259 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
260 |
mobility.PushReferenceMobilityModel(backbone.Get(i)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
261 |
mobility.SetPositionAllocator(subnetAlloc) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
262 |
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel", |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
263 |
"Bounds", ns3.RectangleValue(ns3.Rectangle(-25, 25, -25, 25)), |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
264 |
"Speed", ns3.RandomVariableValue(ns3.ConstantVariable(30)), |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
265 |
"Pause", ns3.RandomVariableValue(ns3.ConstantVariable(0.4))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
266 |
mobility.Install(infra) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
267 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
268 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
269 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
270 |
# Routing configuration # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
271 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
272 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
273 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
274 |
print "Enabling OLSR routing on all backbone nodes" |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
275 |
olsr = ns3.OlsrHelper() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
276 |
olsr.Install(backbone) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
277 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
278 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
279 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
280 |
# Application configuration # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
281 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
282 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
283 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
284 |
# Create the OnOff application to send UDP datagrams of size |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
285 |
# 210 bytes at a rate of 448 Kb/s, between two nodes |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
286 |
print "Create Applications." |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
287 |
port = 9 # Discard port(RFC 863) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
288 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
289 |
# Let's make sure that the user does not define too few LAN nodes |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
290 |
# to make this example work. We need lanNodes >= 5 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
291 |
assert (lanNodes >= 5) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
292 |
appSource = ns3.NodeList.GetNode(11) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
293 |
appSink = ns3.NodeList.GetNode(13) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
294 |
remoteAddr = ns3.Ipv4Address("172.16.0.5") |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
295 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
296 |
onoff = ns3.OnOffHelper("ns3::UdpSocketFactory", |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
297 |
ns3.Address(ns3.InetSocketAddress(remoteAddr, port))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
298 |
onoff.SetAttribute("OnTime", ns3.RandomVariableValue(ns3.ConstantVariable(1))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
299 |
onoff.SetAttribute("OffTime", ns3.RandomVariableValue(ns3.ConstantVariable(0))) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
300 |
apps = onoff.Install(ns3.NodeContainer(appSource)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
301 |
apps.Start(ns3.Seconds(3.0)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
302 |
apps.Stop(ns3.Seconds(20.0)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
303 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
304 |
# Create a packet sink to receive these packets |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
305 |
sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory", |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
306 |
ns3.InetSocketAddress(ns3.Ipv4Address.GetAny(), port)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
307 |
apps = sink.Install(ns3.NodeContainer(appSink)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
308 |
apps.Start(ns3.Seconds(3.0)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
309 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
310 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
311 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
312 |
# Tracing configuration # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
313 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
314 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
315 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
316 |
print "Configure Tracing." |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
317 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
318 |
# Let's set up some ns-2-like ascii traces, using another helper class |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
319 |
# |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
320 |
#std.ofstream ascii |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
321 |
#ascii.open("mixed-wireless.tr") |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
322 |
#WifiHelper.EnableAsciiAll(ascii) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
323 |
#CsmaHelper.EnableAsciiAll(ascii) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
324 |
print "(tracing not done for Python)" |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
325 |
# Look at nodes 11, 13 only |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
326 |
# WifiHelper.EnableAscii(ascii, 11, 0); |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
327 |
# WifiHelper.EnableAscii(ascii, 13, 0); |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
328 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
329 |
# Let's do a pcap trace on the backbone devices |
4211
11cae8936153
bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3536
diff
changeset
|
330 |
ns3.YansWifiPhyHelper.EnablePcap("mixed-wireless", backboneDevices) |
3422
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
331 |
# Let's additionally trace the application Sink, ifIndex 0 |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
332 |
ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
333 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
334 |
# #ifdef ENABLE_FOR_TRACING_EXAMPLE |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
335 |
# Config.Connect("/NodeList/*/$MobilityModel/CourseChange", |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
336 |
# MakeCallback(&CourseChangeCallback)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
337 |
# #endif |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
338 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
339 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
340 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
341 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
342 |
# Run simulation # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
343 |
# # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
344 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
345 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
346 |
print "Run Simulation." |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
347 |
ns3.Simulator.Stop(ns3.Seconds(stopTime)) |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
348 |
ns3.Simulator.Run() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
349 |
ns3.Simulator.Destroy() |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
350 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
351 |
|
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
352 |
if __name__ == '__main__': |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
353 |
import sys |
ad0c05e68792
Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
354 |
main(sys.argv) |