examples/wireless/mixed-wireless.py
author Tom Henderson <tomh@tomh.org>
Fri, 20 Aug 2010 12:17:19 -0700
changeset 6589 9c325569fb01
parent 6360 d8975477ff6a
permissions -rw-r--r--
Help waf to guess release versions of nsc and pybindgen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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()
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   117
    mac = ns3.NqosWifiMacHelper.Default()
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   118
    mac.SetType("ns3::AdhocWifiMac")
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   119
    wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 6256
diff changeset
   120
                                  "DataMode", ns3.StringValue("OfdmRate54Mbps"))
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   121
    wifiPhy = ns3.YansWifiPhyHelper.Default()
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   122
    wifiChannel = ns3.YansWifiChannelHelper.Default()
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   123
    wifiPhy.SetChannel(wifiChannel.Create())
4752
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   124
    backboneDevices = wifi.Install(wifiPhy, mac, backbone)
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   125
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   126
    #  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
   127
    # 
4752
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   128
    print "Enabling OLSR routing on all backbone nodes"
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   129
    internet = ns3.InternetStackHelper()
4752
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   130
    olsr = ns3.OlsrHelper()
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   131
    internet.SetRoutingHelper(olsr);
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   132
    internet.Install(backbone);
5357
d8915edc639c make mixed-wireless examples use InternetStackHelper::Reset
Tom Henderson <tomh@tomh.org>
parents: 4754
diff changeset
   133
    # re-initialize for non-olsr routing.
d8915edc639c make mixed-wireless examples use InternetStackHelper::Reset
Tom Henderson <tomh@tomh.org>
parents: 4754
diff changeset
   134
    internet.Reset()
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   135
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   136
    #  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
   137
    #  IPv4 interfaces) we just created.
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   138
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   139
    ipAddrs = ns3.Ipv4AddressHelper()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   140
    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
   141
    ipAddrs.Assign(backboneDevices)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   142
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   143
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   144
    #  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
   145
    #  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
   146
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   147
    mobility = ns3.MobilityHelper()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   148
    positionAlloc = ns3.ListPositionAllocator()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   149
    x = 0.0
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   150
    for i in range(backboneNodes):
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   151
        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
   152
        x += 5.0
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   153
    mobility.SetPositionAllocator(positionAlloc)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   154
    mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   155
                               "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
   156
                               "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
   157
                               "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
   158
    mobility.Install(backbone)
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   161
    #                                                                        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   162
    #  Construct the LANs                                                    # 
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   165
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   166
    #  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
   167
    #  the "172.16 address space
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   168
    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
   169
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   170
    for i in range(backboneNodes):
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   171
        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
   172
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   173
        #  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
   174
        #  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
   175
        #  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
   176
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   177
        newLanNodes = ns3.NodeContainer()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   178
        newLanNodes.Create(lanNodes - 1)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   179
        #  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
   180
        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
   181
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   182
        #  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
   183
        #  collection.
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   184
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   185
        csma = ns3.CsmaHelper()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   186
        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
   187
        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
   188
        lanDevices = csma.Install(lan)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   189
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   190
        #  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
   191
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   192
        internet.Install(newLanNodes)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   193
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   194
        #  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
   195
        #  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
   196
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   197
        ipAddrs.Assign(lanDevices)
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
        #  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
   200
        #  network mask initialized above
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
        ipAddrs.NewNetwork()
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   205
    #                                                                        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   206
    #  Construct the mobile networks                                         # 
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   209
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   210
    #  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
   211
    #  the "10.0" address space
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   212
    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
   213
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   214
    for i in range(backboneNodes):
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   215
        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
   216
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   217
        #  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
   218
        #  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
   219
        #  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
   220
        # 
4211
11cae8936153 bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3536
diff changeset
   221
        stas = ns3.NodeContainer()
11cae8936153 bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3536
diff changeset
   222
        stas.Create(infraNodes - 1)
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   223
        #  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
   224
        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
   225
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   226
        #  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
   227
        # 
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   228
        ssid = ns3.Ssid('wifi-infra' + str(i))
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   229
        wifiInfra = ns3.WifiHelper.Default()
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   230
        wifiPhy.SetChannel(wifiChannel.Create())
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   231
        wifiInfra.SetRemoteStationManager('ns3::ArfWifiManager')
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   232
        macInfra = ns3.NqosWifiMacHelper.Default();
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   233
        macInfra.SetType("ns3::NqstaWifiMac",
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   234
                          "Ssid", ns3.SsidValue(ssid),
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   235
                          "ActiveProbing", ns3.BooleanValue(False))
4752
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   236
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   237
        # setup stas
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   238
        staDevices = wifiInfra.Install(wifiPhy, macInfra, stas)
4211
11cae8936153 bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3536
diff changeset
   239
        # setup ap.
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   240
        macInfra.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   241
                          "BeaconGeneration", ns3.BooleanValue(True),
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   242
                          "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   243
        apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i))
4211
11cae8936153 bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3536
diff changeset
   244
        # Collect all of these new devices
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   245
        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
   246
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   247
        #  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
   248
        # 
4211
11cae8936153 bug 465: mixed-wireless.py does not work anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3536
diff changeset
   249
        internet.Install(stas)
3422
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
        #  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
   252
        #  IPv4 interfaces) we just created.
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   253
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   254
        ipAddrs.Assign(infraDevices)
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
        #  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
   257
        #  the network mask initialized above
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   258
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   259
        ipAddrs.NewNetwork()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   260
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   261
        #  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
   262
        #  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
   263
        # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   264
        subnetAlloc = ns3.ListPositionAllocator()
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   265
        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
   266
            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
   267
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   268
        mobility.PushReferenceMobilityModel(backbone.Get(i))
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   269
        mobility.SetPositionAllocator(subnetAlloc)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   270
        mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   271
                                  "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
   272
                                  "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
   273
                                  "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
   274
        mobility.Install(infra)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   275
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   276
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
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
    #  Application configuration                                             # 
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
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
    #  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
   283
    #  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
   284
    print "Create Applications."
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   285
    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
   286
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   287
    #  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
   288
    #  to make this example work.  We need lanNodes >= 5
4754
77c878bc3e84 Fix Python coding style.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4752
diff changeset
   289
    assert(lanNodes >= 5)
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   290
    appSource = ns3.NodeList.GetNode(11)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   291
    appSink = ns3.NodeList.GetNode(13)
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   292
    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
   293
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   294
    onoff = ns3.OnOffHelper("ns3::UdpSocketFactory", 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   295
                            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
   296
    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
   297
    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
   298
    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
   299
    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
   300
    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
   301
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   302
    #  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
   303
    sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory", 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   304
                                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
   305
    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
   306
    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
   307
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   308
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
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
    #  Tracing configuration                                                 # 
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
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
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
    print "Configure Tracing."
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
    #  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
   317
    # 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   318
    #std.ofstream ascii
6256
a02c44146209 Bug 885 - Error in Ascii tracing in Python examples
Kim H?jgaard-Hansen <kimrhh@gmail.com>
parents: 6208
diff changeset
   319
    #ascii = ns3.AsciiTraceHelper();
a02c44146209 Bug 885 - Error in Ascii tracing in Python examples
Kim H?jgaard-Hansen <kimrhh@gmail.com>
parents: 6208
diff changeset
   320
    #stream = ascii.CreateFileStream("mixed-wireless.tr");
a02c44146209 Bug 885 - Error in Ascii tracing in Python examples
Kim H?jgaard-Hansen <kimrhh@gmail.com>
parents: 6208
diff changeset
   321
    #wifiPhy.EnableAsciiAll(stream);
a02c44146209 Bug 885 - Error in Ascii tracing in Python examples
Kim H?jgaard-Hansen <kimrhh@gmail.com>
parents: 6208
diff changeset
   322
    #csma.EnableAsciiAll(stream);
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   323
    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
   324
    #  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
   325
    # WifiHelper.EnableAscii(ascii, 11, 0); 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   326
    # WifiHelper.EnableAscii(ascii, 13, 0); 
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   327
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   328
    #  Let's do a pcap trace on the backbone devices
4752
3e26b3b2e3a8 Fix python examples.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4211
diff changeset
   329
    wifiPhy.EnablePcap("mixed-wireless", backboneDevices)
3422
ad0c05e68792 Add mixed-wireless example ported to Python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
   330
    #  Let's additionally trace the application Sink, ifIndex 0
6208
5a0c48fd9efa Fix tracing part of the mixed-wireless.py example
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5369
diff changeset
   331
    csma = ns3.CsmaHelper()
5a0c48fd9efa Fix tracing part of the mixed-wireless.py example
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 5369
diff changeset
   332
    csma.EnablePcapAll("mixed-wireless", False)
3422
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)