Fix python examples.
authorSebastien Vincent <vincent@clarinet.u-strasbg.fr>
Fri Sep 04 16:23:38 2009 +0200 (5 months ago)
changeset 47523e26b3b2e3a8
parent 4751 386247c6625a
child 4753 81146e4a3993
Fix python examples.
examples/mixed-wireless.py
examples/wifi-ap.py
     1.1 --- a/examples/mixed-wireless.py	Fri Sep 04 12:06:54 2009 +0100
     1.2 +++ b/examples/mixed-wireless.py	Fri Sep 04 16:23:38 2009 +0200
     1.3 @@ -114,18 +114,22 @@
     1.4      #  our container
     1.5      # 
     1.6      wifi = ns3.WifiHelper()
     1.7 -    wifi.SetMac("ns3::AdhocWifiMac")
     1.8 +    mac = ns3.NqosWifiMacHelper.Default ()
     1.9 +    mac.SetType ("ns3::AdhocWifiMac")
    1.10      wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
    1.11                                    "DataMode", ns3.StringValue ("wifia-54mbs"))
    1.12      wifiPhy = ns3.YansWifiPhyHelper.Default ()
    1.13      wifiChannel = ns3.YansWifiChannelHelper.Default ()
    1.14      wifiPhy.SetChannel (wifiChannel.Create ())
    1.15 -    backboneDevices = wifi.Install(wifiPhy, backbone)
    1.16 +    backboneDevices = wifi.Install(wifiPhy, mac, backbone)
    1.17      # 
    1.18      #  Add the IPv4 protocol stack to the nodes in our container
    1.19      # 
    1.20 +    print "Enabling OLSR routing on all backbone nodes"
    1.21      internet = ns3.InternetStackHelper()
    1.22 -    internet.Install(backbone)
    1.23 +    olsr = ns3.OlsrHelper()
    1.24 +    internet.SetRoutingHelper (olsr);
    1.25 +    internet.Install (backbone);
    1.26      # 
    1.27      #  Assign IPv4 addresses to the device drivers(actually to the associated
    1.28      #  IPv4 interfaces) we just created.
    1.29 @@ -223,16 +227,18 @@
    1.30          wifiInfra = ns3.WifiHelper.Default ()
    1.31          wifiPhy.SetChannel (wifiChannel.Create ())
    1.32          wifiInfra.SetRemoteStationManager ('ns3::ArfWifiManager')
    1.33 -        # setup stas
    1.34 -        wifiInfra.SetMac ("ns3::NqstaWifiMac",
    1.35 +        macInfra = ns3.NqosWifiMacHelper.Default ();
    1.36 +        macInfra.SetType ("ns3::NqstaWifiMac",
    1.37                            "Ssid", ns3.SsidValue (ssid),
    1.38                            "ActiveProbing", ns3.BooleanValue (False))
    1.39 -        staDevices = wifiInfra.Install (wifiPhy, stas)
    1.40 +
    1.41 +        # setup stas
    1.42 +        staDevices = wifiInfra.Install (wifiPhy, macInfra, stas)
    1.43          # setup ap.
    1.44 -        wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", ns3.SsidValue (ssid),
    1.45 +        macInfra.SetType ("ns3::NqapWifiMac", "Ssid", ns3.SsidValue (ssid),
    1.46                            "BeaconGeneration", ns3.BooleanValue (True),
    1.47                            "BeaconInterval", ns3.TimeValue (ns3.Seconds (2.5)))
    1.48 -        apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i))
    1.49 +        apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i))
    1.50          # Collect all of these new devices
    1.51          infraDevices = ns3.NetDeviceContainer (apDevices, staDevices)
    1.52  
    1.53 @@ -267,16 +273,6 @@
    1.54  
    1.55      # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
    1.56      #                                                                        # 
    1.57 -    #  Routing configuration                                                 # 
    1.58 -    #                                                                        # 
    1.59 -    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
    1.60 -
    1.61 -    print "Enabling OLSR routing on all backbone nodes"
    1.62 -    olsr = ns3.OlsrHelper()
    1.63 -    olsr.Install(backbone)
    1.64 -
    1.65 -    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
    1.66 -    #                                                                        # 
    1.67      #  Application configuration                                             # 
    1.68      #                                                                        # 
    1.69      # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / 
    1.70 @@ -327,9 +323,9 @@
    1.71      # WifiHelper.EnableAscii(ascii, 13, 0); 
    1.72  
    1.73      #  Let's do a pcap trace on the backbone devices
    1.74 -    ns3.YansWifiPhyHelper.EnablePcap("mixed-wireless", backboneDevices)
    1.75 +    wifiPhy.EnablePcap("mixed-wireless", backboneDevices)
    1.76      #  Let's additionally trace the application Sink, ifIndex 0
    1.77 -    ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0)
    1.78 +    ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0, False)
    1.79  
    1.80  #   #ifdef ENABLE_FOR_TRACING_EXAMPLE
    1.81  #     Config.Connect("/NodeList/*/$MobilityModel/CourseChange",
     2.1 --- a/examples/wifi-ap.py	Fri Sep 04 12:06:54 2009 +0100
     2.2 +++ b/examples/wifi-ap.py	Fri Sep 04 16:23:38 2009 +0200
     2.3 @@ -115,16 +115,18 @@
     2.4  
     2.5      ssid = ns3.Ssid("wifi-default")
     2.6      wifi.SetRemoteStationManager("ns3::ArfWifiManager")
     2.7 +    wifiMac = ns3.NqosWifiMacHelper.Default ()
     2.8 +
     2.9      # setup stas.
    2.10 -    wifi.SetMac("ns3::NqstaWifiMac", 
    2.11 +    wifiMac.SetType("ns3::NqstaWifiMac", 
    2.12                 "Ssid", ns3.SsidValue(ssid),
    2.13                 "ActiveProbing", ns3.BooleanValue(False))
    2.14 -    staDevs = wifi.Install(wifiPhy, stas)
    2.15 +    staDevs = wifi.Install(wifiPhy, wifiMac, stas)
    2.16      # setup ap.
    2.17 -    wifi.SetMac("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
    2.18 +    wifiMac.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
    2.19                  "BeaconGeneration", ns3.BooleanValue(True),
    2.20                  "BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
    2.21 -    wifi.Install(wifiPhy, ap)
    2.22 +    wifi.Install(wifiPhy, wifiMac, ap)
    2.23  
    2.24      # mobility.
    2.25      mobility.Install(stas)