merge with ns-3-dev

This commit is contained in:
Gustavo J. A. M. Carneiro
2009-09-08 13:57:17 +01:00
88 changed files with 1844 additions and 1070 deletions

View File

@@ -104,7 +104,7 @@ def main(argv):
sink = ns3.PacketSinkHelper("ns3::UdpSocketFactory",
ns3.Address(ns3.InetSocketAddress(ns3.Ipv4Address.GetAny(), port)))
app = sink.Install(ns3.NodeContainer(terminals.Get(1)))
app.Start (ns3.Seconds (0.0))
app.Start(ns3.Seconds(0.0))
#
# Create a similar flow from n3 to n0, starting at time 1.1 seconds
@@ -116,7 +116,7 @@ def main(argv):
app.Stop(ns3.Seconds(10.0))
app = sink.Install(ns3.NodeContainer(terminals.Get(0)))
app.Start (ns3.Seconds (0.0))
app.Start(ns3.Seconds(0.0))
#
# Configure tracing of all enqueue, dequeue, and NetDevice receive events.

View File

@@ -0,0 +1,158 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// Test program for this 3-router scenario, using global routing
//
// (a.a.a.a/32)A<--x.x.x.0/30-->B<--y.y.y.0/30-->C(c.c.c.c/32)
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/csma-net-device.h"
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/ipv4-static-routing.h"
#include "ns3/ipv4-global-routing.h"
#include "ns3/ipv4-list-routing.h"
#include "ns3/ipv4-routing-table-entry.h"
#include "ns3/global-router-interface.h"
using namespace ns3;
using std::cout;
NS_LOG_COMPONENT_DEFINE ("GlobalRouterInjectionTest");
int
main (int argc, char *argv[])
{
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
CommandLine cmd;
cmd.Parse (argc, argv);
Ptr<Node> nA = CreateObject<Node> ();
Ptr<Node> nB = CreateObject<Node> ();
Ptr<Node> nC = CreateObject<Node> ();
NodeContainer c = NodeContainer (nA, nB, nC);
InternetStackHelper internet;
// Point-to-point links
NodeContainer nAnB = NodeContainer (nA, nB);
NodeContainer nBnC = NodeContainer (nB, nC);
internet.Install (nAnB);
Ipv4ListRoutingHelper staticonly;
Ipv4ListRoutingHelper staticRouting;
staticonly.Add(staticRouting, 0);
internet.SetRoutingHelper(staticonly);
internet.Install(NodeContainer(nC));
// We create the channels first without any IP addressing information
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer dAdB = p2p.Install (nAnB);
NetDeviceContainer dBdC = p2p.Install (nBnC);;
Ptr<CsmaNetDevice> deviceA = CreateObject<CsmaNetDevice> ();
deviceA->SetAddress (Mac48Address::Allocate ());
nA->AddDevice (deviceA);
Ptr<CsmaNetDevice> deviceC = CreateObject<CsmaNetDevice> ();
deviceC->SetAddress (Mac48Address::Allocate ());
nC->AddDevice (deviceC);
// Later, we add IP addresses.
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.252");
Ipv4InterfaceContainer iAiB = ipv4.Assign (dAdB);
ipv4.SetBase ("10.1.1.4", "255.255.255.252");
Ipv4InterfaceContainer iBiC = ipv4.Assign (dBdC);
Ptr<Ipv4> ipv4A = nA->GetObject<Ipv4> ();
Ptr<Ipv4> ipv4B = nB->GetObject<Ipv4> ();
Ptr<Ipv4> ipv4C = nC->GetObject<Ipv4> ();
int32_t ifIndexA = ipv4A->AddInterface (deviceA);
int32_t ifIndexC = ipv4C->AddInterface (deviceC);
Ipv4InterfaceAddress ifInAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4A->AddAddress (ifIndexA, ifInAddrA);
ipv4A->SetMetric (ifIndexA, 1);
ipv4A->SetUp (ifIndexA);
Ipv4InterfaceAddress ifInAddrC = Ipv4InterfaceAddress (Ipv4Address ("192.168.1.1"), Ipv4Mask ("255.255.255.255"));
ipv4C->AddAddress (ifIndexC, ifInAddrC);
ipv4C->SetMetric (ifIndexC, 1);
ipv4C->SetUp (ifIndexC);
// Create router nodes, initialize routing database and set up the routing
// tables in the nodes.
// Populate routing tables for nodes nA and nB
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
// Inject global routes from Node B, including transit network...
Ptr<GlobalRouter> globalRouterB = nB->GetObject<GlobalRouter> ();
globalRouterB->InjectRoute ("10.1.1.4", "255.255.255.252");
// ...and the host in network "C"
globalRouterB->InjectRoute ("192.168.1.1", "255.255.255.255");
Ipv4GlobalRoutingHelper::RecomputeRoutingTables();
// In addition, nB needs a static route to nC so it knows what to do with stuff
// going to 192.168.1.1
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr<Ipv4StaticRouting> staticRoutingB = ipv4RoutingHelper.GetStaticRouting(ipv4B);
staticRoutingB->AddHostRouteTo (Ipv4Address ("192.168.1.1"), Ipv4Address ("10.1.1.6"),2);
// Create the OnOff application to send UDP datagrams of size
// 210 bytes at a rate of 448 Kb/s
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal(), port)));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
// Create a packet sink to receive these packets
PacketSinkHelper sink ("ns3::UdpSocketFactory",
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
apps = sink.Install (nC);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
std::ofstream ascii;
ascii.open ("global-routing-injection32.tr", std::ios_base::binary | std::ios_base::out);
PointToPointHelper::EnablePcapAll ("global-routing-injection32");
PointToPointHelper::EnableAsciiAll (ascii);
Simulator::Run ();
Simulator::Destroy ();
return 0;
}

View File

@@ -114,18 +114,22 @@ def main(argv):
# our container
#
wifi = ns3.WifiHelper()
wifi.SetMac("ns3::AdhocWifiMac")
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode", ns3.StringValue ("wifia-54mbs"))
wifiPhy = ns3.YansWifiPhyHelper.Default ()
wifiChannel = ns3.YansWifiChannelHelper.Default ()
wifiPhy.SetChannel (wifiChannel.Create ())
backboneDevices = wifi.Install(wifiPhy, backbone)
mac = ns3.NqosWifiMacHelper.Default()
mac.SetType("ns3::AdhocWifiMac")
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
"DataMode", ns3.StringValue("wifia-54mbs"))
wifiPhy = ns3.YansWifiPhyHelper.Default()
wifiChannel = ns3.YansWifiChannelHelper.Default()
wifiPhy.SetChannel(wifiChannel.Create())
backboneDevices = wifi.Install(wifiPhy, mac, backbone)
#
# Add the IPv4 protocol stack to the nodes in our container
#
print "Enabling OLSR routing on all backbone nodes"
internet = ns3.InternetStackHelper()
internet.Install(backbone)
olsr = ns3.OlsrHelper()
internet.SetRoutingHelper(olsr);
internet.Install(backbone);
#
# Assign IPv4 addresses to the device drivers(actually to the associated
# IPv4 interfaces) we just created.
@@ -219,22 +223,24 @@ def main(argv):
#
# Create another ad hoc network and devices
#
ssid = ns3.Ssid ('wifi-infra' + str(i))
wifiInfra = ns3.WifiHelper.Default ()
wifiPhy.SetChannel (wifiChannel.Create ())
wifiInfra.SetRemoteStationManager ('ns3::ArfWifiManager')
ssid = ns3.Ssid('wifi-infra' + str(i))
wifiInfra = ns3.WifiHelper.Default()
wifiPhy.SetChannel(wifiChannel.Create())
wifiInfra.SetRemoteStationManager('ns3::ArfWifiManager')
macInfra = ns3.NqosWifiMacHelper.Default();
macInfra.SetType("ns3::NqstaWifiMac",
"Ssid", ns3.SsidValue(ssid),
"ActiveProbing", ns3.BooleanValue(False))
# setup stas
wifiInfra.SetMac ("ns3::NqstaWifiMac",
"Ssid", ns3.SsidValue (ssid),
"ActiveProbing", ns3.BooleanValue (False))
staDevices = wifiInfra.Install (wifiPhy, stas)
staDevices = wifiInfra.Install(wifiPhy, macInfra, stas)
# setup ap.
wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", ns3.SsidValue (ssid),
"BeaconGeneration", ns3.BooleanValue (True),
"BeaconInterval", ns3.TimeValue (ns3.Seconds (2.5)))
apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i))
macInfra.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
"BeaconGeneration", ns3.BooleanValue(True),
"BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i))
# Collect all of these new devices
infraDevices = ns3.NetDeviceContainer (apDevices, staDevices)
infraDevices = ns3.NetDeviceContainer(apDevices, staDevices)
# Add the IPv4 protocol stack to the nodes in our container
#
@@ -265,16 +271,6 @@ def main(argv):
"Pause", ns3.RandomVariableValue(ns3.ConstantVariable(0.4)))
mobility.Install(infra)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
# #
# Routing configuration #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
print "Enabling OLSR routing on all backbone nodes"
olsr = ns3.OlsrHelper()
olsr.Install(backbone)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
# #
# Application configuration #
@@ -288,7 +284,7 @@ def main(argv):
# Let's make sure that the user does not define too few LAN nodes
# to make this example work. We need lanNodes >= 5
assert (lanNodes >= 5)
assert(lanNodes >= 5)
appSource = ns3.NodeList.GetNode(11)
appSink = ns3.NodeList.GetNode(13)
remoteAddr = ns3.Ipv4Address("172.16.0.5")
@@ -327,9 +323,9 @@ def main(argv):
# WifiHelper.EnableAscii(ascii, 13, 0);
# Let's do a pcap trace on the backbone devices
ns3.YansWifiPhyHelper.EnablePcap("mixed-wireless", backboneDevices)
wifiPhy.EnablePcap("mixed-wireless", backboneDevices)
# Let's additionally trace the application Sink, ifIndex 0
ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0)
ns3.CsmaHelper.EnablePcap("mixed-wireless", appSink.GetId(), 0, False)
# #ifdef ENABLE_FOR_TRACING_EXAMPLE
# Config.Connect("/NodeList/*/$MobilityModel/CourseChange",

View File

@@ -77,7 +77,7 @@ class StackHelper
routing = routingHelper.GetStaticRouting (ipv6);
std::cout << "Routing table of " << n << " : " << std::endl;
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << std::endl;
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
nbRoutes = routing->GetNRoutes ();
for (uint32_t i = 0 ; i < nbRoutes ; i++)
@@ -85,7 +85,9 @@ class StackHelper
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
<< route.GetGateway () << "\t"
<< route.GetInterface () << "\t" << std::endl;
<< route.GetInterface () << "\t"
<< route.GetPrefixToUse () << "\t"
<< std::endl;
}
}
};
@@ -157,8 +159,8 @@ int main (int argc, char** argv)
iic2.Add (iicr2);
/* radvd configuration */
Ipv6Address prefix ("2001:1::0"); /* create the prefix */
Ipv6Address prefixBis ("2001:ABCD::0"); /* create the prefix */
Ipv6Address prefix ("2001:ABCD::0"); /* create the prefix */
Ipv6Address prefixBis ("2001:1::0"); /* create the prefix */
Ipv6Address prefix2 ("2001:2::0"); /* create the prefix */
uint32_t indexRouter = iic1.GetInterfaceIndex (1); /* R interface (n0 - R) */
uint32_t indexRouter2 = iic2.GetInterfaceIndex (1); /* R interface (R - n1) */

View File

@@ -33,12 +33,59 @@
#include "ns3/simulator-module.h"
#include "ns3/helper-module.h"
#include "ns3/ipv6-routing-table-entry.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SimpleRoutingUdp6Example");
NS_LOG_COMPONENT_DEFINE ("SimpleRoutingPing6Example");
int
main (int argc, char** argv)
class StackHelper
{
public:
/**
* \brief Add an address to a IPv6 node.
* \param n node
* \param interface interface index
* \param address IPv6 address to add
*/
inline void AddAddress (Ptr<Node>& n, uint32_t interface, Ipv6Address address)
{
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
ipv6->AddAddress (interface, address);
}
/**
* \brief Print the routing table.
* \param n the node
*/
inline void PrintRoutingTable (Ptr<Node>& n)
{
Ptr<Ipv6StaticRouting> routing = 0;
Ipv6StaticRoutingHelper routingHelper;
Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
uint32_t nbRoutes = 0;
Ipv6RoutingTableEntry route;
routing = routingHelper.GetStaticRouting (ipv6);
std::cout << "Routing table of " << n << " : " << std::endl;
std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
nbRoutes = routing->GetNRoutes ();
for (uint32_t i = 0 ; i < nbRoutes ; i++)
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
<< route.GetGateway () << "\t"
<< route.GetInterface () << "\t"
<< route.GetPrefixToUse () << "\t"
<< std::endl;
}
}
};
int main (int argc, char** argv)
{
#if 0
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL);
@@ -50,6 +97,8 @@ main (int argc, char** argv)
CommandLine cmd;
cmd.Parse (argc, argv);
StackHelper stackHelper;
NS_LOG_INFO ("Create nodes.");
Ptr<Node> n0 = CreateObject<Node> ();
@@ -80,6 +129,8 @@ main (int argc, char** argv)
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (0, true);
stackHelper.PrintRoutingTable(n0);
/* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */
uint32_t packetSize = 1024;
uint32_t maxPacketCount = 5;
@@ -88,7 +139,6 @@ main (int argc, char** argv)
ping6.SetLocal (i1.GetAddress (0, 1));
ping6.SetRemote (i2.GetAddress (1, 1));
/* ping6.SetRemote (Ipv6Address::GetAllNodesMulticast ()); */
ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
ping6.SetAttribute ("Interval", TimeValue (interPacketInterval));

View File

@@ -0,0 +1,106 @@
#
# Copyright (c) 2008-2009 Strasbourg University
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: David Gross <david.gross@eturs.u-strasbg.fr>
# Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
#
#
# Network topology:
#
# n0 r n1
# | _ |
# ====|_|====
# router
#
import ns3;
def main(argv):
cmd = ns3.CommandLine();
cmd.Parse(argv);
# Create nodes
print "Create nodes"
n0 = ns3.Node();
r = ns3.Node();
n1 = ns3.Node();
net1 = ns3.NodeContainer();
net1.Add(n0);
net1.Add(r);
net2 = ns3.NodeContainer();
net2.Add(r);
net2.Add(n1);
all = ns3.NodeContainer();
all.Add(n0);
all.Add(r);
all.Add(n1);
# Create IPv6 Internet Stack
internetv6 = ns3.InternetStackHelper();
internetv6.Install(all);
# Create channels
csma = ns3.CsmaHelper();
csma.SetChannelAttribute("DataRate", ns3.DataRateValue(ns3.DataRate(5000000)));
csma.SetChannelAttribute("Delay", ns3.TimeValue(ns3.MilliSeconds(2)));
d1 = csma.Install(net1);
d2 = csma.Install(net2);
# Create networks and assign IPv6 Addresses
print "Addressing"
ipv6 = ns3.Ipv6AddressHelper();
ipv6.NewNetwork(ns3.Ipv6Address("2001:1::"), ns3.Ipv6Prefix(64));
i1 = ipv6.Assign(d1);
i1.SetRouter(1, True);
ipv6.NewNetwork(ns3.Ipv6Address("2001:2::"), ns3.Ipv6Prefix(64));
i2 = ipv6.Assign(d2);
i2.SetRouter(0, True);
# Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r
print "Application"
packetSize = 1024;
maxPacketCount = 5;
interPacketInterval = ns3.Seconds(1.);
ping6 = ns3.Ping6Helper();
ping6.SetLocal(i1.GetAddress(0, 1));
ping6.SetRemote(i2.GetAddress(1, 1));
ping6.SetAttribute("MaxPackets", ns3.UintegerValue(maxPacketCount));
ping6.SetAttribute("Interval", ns3.TimeValue(interPacketInterval));
ping6.SetAttribute("PacketSize", ns3.UintegerValue(packetSize));
apps = ping6.Install(ns3.NodeContainer(net1.Get(0)));
apps.Start(ns3.Seconds(2.0));
apps.Stop(ns3.Seconds(20.0));
print "Tracing"
ascii = ns3.ofstream("simple-routing-ping6.tr");
ns3.CsmaHelper.EnableAsciiAll(ascii);
ns3.CsmaHelper.EnablePcapAll("simple-routing-ping6", True);
# Run Simulation
ns3.Simulator.Run();
ns3.Simulator.Destroy();
if __name__ == '__main__':
import sys
main(sys.argv)

View File

@@ -29,30 +29,30 @@ import ns3
# std::cout << " TX to=" << address << " p: " << *p << std::endl;
# }
# void
# DevRxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
# DevRxTrace(std::string context, Ptr<const Packet> p, Mac48Address address)
# {
# std::cout << " RX from=" << address << " p: " << *p << std::endl;
# }
# void
# PhyRxOkTrace (std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
# PhyRxOkTrace(std::string context, Ptr<const Packet> packet, double snr, WifiMode mode, enum WifiPreamble preamble)
# {
# std::cout << "PHYRXOK mode=" << mode << " snr=" << snr << " " << *packet << std::endl;
# }
# void
# PhyRxErrorTrace (std::string context, Ptr<const Packet> packet, double snr)
# PhyRxErrorTrace(std::string context, Ptr<const Packet> packet, double snr)
# {
# std::cout << "PHYRXERROR snr=" << snr << " " << *packet << std::endl;
# }
# void
# PhyTxTrace (std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
# PhyTxTrace(std::string context, Ptr<const Packet> packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
# {
# std::cout << "PHYTX mode=" << mode << " " << *packet << std::endl;
# }
# void
# PhyStateTrace (std::string context, Time start, Time duration, enum WifiPhy::State state)
# PhyStateTrace(std::string context, Time start, Time duration, enum WifiPhy::State state)
# {
# std::cout << " state=";
# switch (state) {
# switch(state) {
# case WifiPhy::TX:
# std::cout << "tx ";
# break;
@@ -79,7 +79,7 @@ def GetPosition(node):
return mobility.GetPosition()
def AdvancePosition(node):
pos = GetPosition (node);
pos = GetPosition(node);
pos.x += 5.0
if pos.x >= 210.0:
return
@@ -88,12 +88,12 @@ def AdvancePosition(node):
def main(argv):
ns3.Packet.EnablePrinting ();
ns3.Packet.EnablePrinting();
# enable rts cts all the time.
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", ns3.StringValue("0"))
# disable fragmentation
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", ns3.StringValue ("2200"))
ns3.Config.SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", ns3.StringValue("2200"))
wifi = ns3.WifiHelper.Default()
mobility = ns3.MobilityHelper()
@@ -115,16 +115,18 @@ def main(argv):
ssid = ns3.Ssid("wifi-default")
wifi.SetRemoteStationManager("ns3::ArfWifiManager")
wifiMac = ns3.NqosWifiMacHelper.Default()
# setup stas.
wifi.SetMac("ns3::NqstaWifiMac",
wifiMac.SetType("ns3::NqstaWifiMac",
"Ssid", ns3.SsidValue(ssid),
"ActiveProbing", ns3.BooleanValue(False))
staDevs = wifi.Install(wifiPhy, stas)
staDevs = wifi.Install(wifiPhy, wifiMac, stas)
# setup ap.
wifi.SetMac("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
wifiMac.SetType("ns3::NqapWifiMac", "Ssid", ns3.SsidValue(ssid),
"BeaconGeneration", ns3.BooleanValue(True),
"BeaconInterval", ns3.TimeValue(ns3.Seconds(2.5)))
wifi.Install(wifiPhy, ap)
wifi.Install(wifiPhy, wifiMac, ap)
# mobility.
mobility.Install(stas)
@@ -147,12 +149,12 @@ def main(argv):
ns3.Simulator.Stop(ns3.Seconds(44.0))
# Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback (&DevTxTrace));
# Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback (&DevRxTrace));
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback (&PhyRxOkTrace));
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback (&PhyRxErrorTrace));
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback (&PhyTxTrace));
# Config::Connect ("/NodeList/*/DeviceList/*/Phy/State", MakeCallback (&PhyStateTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace));
# Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace));
ascii = ns3.ofstream("wifi-ap.tr")
ns3.YansWifiPhyHelper.EnableAsciiAll(ascii)

View File

@@ -36,6 +36,10 @@ def build(bld):
['point-to-point', 'internet-stack', 'global-routing'])
obj.source = 'global-routing-slash32.cc'
obj = bld.create_ns3_program('global-injection-slash32',
['point-to-point', 'internet-stack', 'global-routing'])
obj.source = 'global-injection-slash32.cc'
obj = bld.create_ns3_program('simple-global-routing',
['point-to-point', 'internet-stack', 'global-routing'])
obj.source = 'simple-global-routing.cc'