A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches

Test script. More...

+ Collaboration diagram for AodvExample:

Public Member Functions

 AodvExample ()
 
bool Configure (int argc, char **argv)
 Configure script parameters.
 
void Report (std::ostream &os)
 Report results.
 
void Run ()
 Run simulation.
 

Private Member Functions

void CreateDevices ()
 Create the devices.
 
void CreateNodes ()
 Create the nodes.
 
void InstallApplications ()
 Create the simulation applications.
 
void InstallInternetStack ()
 Create the network.
 

Private Attributes

NetDeviceContainer devices
 devices used in the example
 
Ipv4InterfaceContainer interfaces
 interfaces used in the example
 
NodeContainer nodes
 nodes used in the example
 
bool pcap
 Write per-device PCAP traces if true.
 
bool printRoutes
 Print routes if true.
 
uint32_t size
 Number of nodes.
 
double step
 Distance between nodes, meters.
 
double totalTime
 Simulation time, seconds.
 

Detailed Description

Test script.

This script creates 1-dimensional grid topology and then ping last node from the first one:

[10.0.0.1] <– step --> [10.0.0.2] <– step --> [10.0.0.3] <– step --> [10.0.0.4]

ping 10.0.0.4

When 1/3 of simulation time has elapsed, one of the nodes is moved out of range, thereby breaking the topology. By default, this will result in stopping ping replies reception after sequence number 33. If the step size is reduced to cover the gap, then also the following pings can be received.

Definition at line 58 of file aodv.cc.

Constructor & Destructor Documentation

◆ AodvExample()

AodvExample::AodvExample ( )

Definition at line 124 of file aodv.cc.

Member Function Documentation

◆ Configure()

bool AodvExample::Configure ( int  argc,
char **  argv 
)

Configure script parameters.

Parameters
argcis the command line argument count
argvis the command line arguments
Returns
true on successful configuration

Definition at line 134 of file aodv.cc.

References pcap, printRoutes, ns3::RngSeedManager::SetSeed(), size, step, and totalTime.

+ Here is the call graph for this function:

◆ CreateDevices()

void AodvExample::CreateDevices ( )
private

Create the devices.

Definition at line 206 of file aodv.cc.

References ns3::YansWifiChannelHelper::Create(), ns3::YansWifiChannelHelper::Default(), devices, ns3::PcapHelperForDevice::EnablePcapAll(), nodes, pcap, ns3::YansWifiPhyHelper::SetChannel(), and ns3::WifiMacHelper::SetType().

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateNodes()

void AodvExample::CreateNodes ( )
private

Create the nodes.

Definition at line 175 of file aodv.cc.

References ns3::Names::Add(), ns3::NodeContainer::Create(), ns3::NodeContainer::Get(), nodes, size, and step.

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InstallApplications()

void AodvExample::InstallApplications ( )
private

Create the simulation applications.

Definition at line 248 of file aodv.cc.

References ns3::NodeContainer::Get(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::ApplicationHelper::Install(), interfaces, nodes, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::ApplicationHelper::SetAttribute(), ns3::MobilityModel::SetPosition(), size, ns3::ApplicationContainer::Start(), ns3::ApplicationContainer::Stop(), and totalTime.

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InstallInternetStack()

void AodvExample::InstallInternetStack ( )
private

Create the network.

Definition at line 228 of file aodv.cc.

References devices, interfaces, nodes, printRoutes, ns3::Ipv4RoutingHelper::PrintRoutingTableAllAt(), and ns3::Seconds().

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Report()

void AodvExample::Report ( std::ostream &  os)

Report results.

Parameters
osthe output stream

Definition at line 170 of file aodv.cc.

◆ Run()

void AodvExample::Run ( )

Run simulation.

Definition at line 153 of file aodv.cc.

References CreateDevices(), CreateNodes(), ns3::Simulator::Destroy(), InstallApplications(), InstallInternetStack(), ns3::Simulator::Run(), ns3::Seconds(), ns3::Simulator::Stop(), and totalTime.

+ Here is the call graph for this function:

Member Data Documentation

◆ devices

NetDeviceContainer AodvExample::devices
private

devices used in the example

Definition at line 94 of file aodv.cc.

Referenced by CreateDevices(), and InstallInternetStack().

◆ interfaces

Ipv4InterfaceContainer AodvExample::interfaces
private

interfaces used in the example

Definition at line 96 of file aodv.cc.

Referenced by InstallApplications(), and InstallInternetStack().

◆ nodes

NodeContainer AodvExample::nodes
private

nodes used in the example

Definition at line 92 of file aodv.cc.

Referenced by CreateDevices(), CreateNodes(), InstallApplications(), and InstallInternetStack().

◆ pcap

bool AodvExample::pcap
private

Write per-device PCAP traces if true.

Definition at line 86 of file aodv.cc.

Referenced by Configure(), and CreateDevices().

◆ printRoutes

bool AodvExample::printRoutes
private

Print routes if true.

Definition at line 88 of file aodv.cc.

Referenced by Configure(), and InstallInternetStack().

◆ size

uint32_t AodvExample::size
private

Number of nodes.

Definition at line 80 of file aodv.cc.

Referenced by Configure(), CreateNodes(), and InstallApplications().

◆ step

double AodvExample::step
private

Distance between nodes, meters.

Definition at line 82 of file aodv.cc.

Referenced by Configure(), and CreateNodes().

◆ totalTime

double AodvExample::totalTime
private

Simulation time, seconds.

Definition at line 84 of file aodv.cc.

Referenced by Configure(), InstallApplications(), and Run().


The documentation for this class was generated from the following file: