I have a related problem with mesh.cc
Using the original mesh.cc from two different releases (3.12 and 3-
dev), with no alteration at all, no UDP packets are transmitted from
node 8 (echo client)to node 0 (echo server).
* 0 --- 1 --- 2
* | \ | / |
* | \ | / |
* 3 --- 4 --- 5
* | / | \ |
* | / | \ |
* 6 --- 7 --- 8
So at least on my system the original mesh.cc UDP echo application
does not work.
Flow monitor reports 901/ lost packets.
When I change the topology from 3x3 grid to a 3x1 chain, UDP echo
application does work.
Flow monitor reports 0/ lost packets.
Can anyone confirm this behavior?
I am setting up a virtual testbed, to measure aggregate throughput,
delay, packet loss etc on various sizes of grids, so the chain
topology will not be enough. Does anyone have an idea of what could be
wrong?
You will find mesh.cc in your examples directory (ns-3-dev) or src/
mesh/examples on 3.12 release.
Here is the code from 3.12 release.
--Roman
* Author: Kirill Andreev <
and...@iitp.ru>
*
*
* By default this script creates m_xSize * m_ySize square grid
topology with
* IEEE802.11s stack installed at each node with peering management
* and HWMP protocol.
* The side of the square cell is defined by m_step parameter.
* When topology is created, UDP ping is installed to opposite corners
* by diagonals. packet size of the UDP ping and interval between two
* successive packets is configurable.
*
* See also MeshTest::Configure to read more about configurable
* parameters.
*/
#include "ns3/core-module.h"
#include "ns3/internet-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mesh-module.h"
#include "ns3/mobility-module.h"
#include "ns3/mesh-helper.h"
#include "ns3/flow-monitor-helper.h"
#include <iostream>
#include <sstream>
#include <fstream>
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("TestMeshScript");
class MeshTest
{
public:
/// Init test
MeshTest ();
/// Configure test from command line arguments
void Configure (int argc, char ** argv);
/// Run test
int Run ();
private:
int m_xSize;
int m_ySize;
double m_step;
double m_randomStart;
double m_totalTime;
double m_packetInterval;
uint16_t m_packetSize;
uint32_t m_nIfaces;
bool m_chan;
bool m_pcap;
std::string m_stack;
std::string m_root;
/// List of network nodes
NodeContainer nodes;
/// List of all mesh point devices
NetDeviceContainer meshDevices;
//Addresses of interfaces:
Ipv4InterfaceContainer interfaces;
// MeshHelper. Report is not static methods
MeshHelper mesh;
private:
/// Create nodes and setup their mobility
void CreateNodes ();
/// Install internet m_stack on nodes
void InstallInternetStack ();
/// Install applications
void InstallApplication ();
/// Print mesh devices diagnostics
void Report ();
};
MeshTest::MeshTest () :
m_xSize (3),
m_ySize (3),
m_step (100.0),
m_randomStart (0.1),
m_totalTime (100.0),
m_packetInterval (0.1),
m_packetSize (1024),
m_nIfaces (1),
m_chan (true),
m_pcap (false),
m_stack ("ns3::Dot11sStack"),
m_root ("ff:ff:ff:ff:ff:ff")
{
}
void
MeshTest::Configure (int argc, char *argv[])
{
CommandLine cmd;
cmd.AddValue ("x-size", "Number of nodes in a row grid. [6]",
m_xSize);
cmd.AddValue ("y-size", "Number of rows in a grid. [6]", m_ySize);
cmd.AddValue ("step", "Size of edge in our grid, meters. [100 m]",
m_step);
/*
* As soon as starting node means that it sends a beacon,
* simultaneous start is not good.
*/
cmd.AddValue ("start", "Maximum random start delay, seconds. [0.1
s]", m_randomStart);
cmd.AddValue ("time", "Simulation time, seconds [100 s]",
m_totalTime);
cmd.AddValue ("packet-interval", "Interval between packets in UDP
ping, seconds [0.001 s]", m_packetInterval);
cmd.AddValue ("packet-size", "Size of packets in UDP ping",
m_packetSize);
cmd.AddValue ("interfaces", "Number of radio interfaces used by each
mesh point. [1]", m_nIfaces);
cmd.AddValue ("channels", "Use different frequency channels for
different interfaces. [0]", m_chan);
cmd.AddValue ("pcap", "Enable PCAP traces on interfaces. [0]",
m_pcap);
cmd.AddValue ("stack", "Type of protocol stack. ns3::Dot11sStack by
default", m_stack);
cmd.AddValue ("root", "Mac address of root mesh point in HWMP",
m_root);
cmd.Parse (argc, argv);
NS_LOG_DEBUG ("Grid:" << m_xSize << "*" << m_ySize);
NS_LOG_DEBUG ("Simulation time: " << m_totalTime << " s");
}
void
MeshTest::CreateNodes ()
{
/*
* Create m_ySize*m_xSize stations to form a grid topology
*/
nodes.Create (m_ySize*m_xSize);
// Configure YansWifiChannel
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default
();
wifiPhy.SetChannel (wifiChannel.Create ());
/*
* Create mesh helper and set stack installer to it
* Stack installer creates all needed protocols and install them to
* mesh point device
*/
mesh = MeshHelper::Default ();
if (!Mac48Address (m_root.c_str ()).IsBroadcast ())
{
mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue
(Mac48Address (m_root.c_str ())));
}
else
{
//If root is not set, we do not use "Root" attribute, because it
//is specified only for 11s
mesh.SetStackInstaller (m_stack);
}
if (m_chan)
{
mesh.SetSpreadInterfaceChannels (MeshHelper::SPREAD_CHANNELS);
}
else
{
mesh.SetSpreadInterfaceChannels (MeshHelper::ZERO_CHANNEL);
}
mesh.SetMacType ("RandomStart", TimeValue (Seconds
(m_randomStart)));
// Set number of interfaces - default is single-interface mesh point
mesh.SetNumberOfInterfaces (m_nIfaces);
// Install protocols and return container if MeshPointDevices
meshDevices = mesh.Install (wifiPhy, nodes);
// Setup mobility - static grid topology
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (m_step),
"DeltaY", DoubleValue (m_step),
"GridWidth", UintegerValue (m_xSize),
"LayoutType", StringValue
("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (nodes);
if (m_pcap)
wifiPhy.EnablePcapAll (std::string ("mp-"));
}
void
MeshTest::InstallInternetStack ()
{
InternetStackHelper internetStack;
internetStack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
interfaces = address.Assign (meshDevices);
}
void
MeshTest::InstallApplication ()
{
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (nodes.Get
(0));
serverApps.Start (Seconds (0.0));
serverApps.Stop (Seconds (m_totalTime));
UdpEchoClientHelper echoClient (interfaces.GetAddress (0), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue ((uint32_t)
(m_totalTime*(1/m_packetInterval))));
echoClient.SetAttribute ("Interval", TimeValue (Seconds
(m_packetInterval)));
echoClient.SetAttribute ("PacketSize", UintegerValue
(m_packetSize));
ApplicationContainer clientApps = echoClient.Install (nodes.Get
(m_xSize*m_ySize-1));
clientApps.Start (Seconds (0.0));
clientApps.Stop (Seconds (m_totalTime));
}
int
MeshTest::Run ()
{
CreateNodes ();
InstallInternetStack ();
InstallApplication ();
Simulator::Schedule (Seconds (m_totalTime), &MeshTest::Report,
this);
Simulator::Stop (Seconds (m_totalTime));
//Flow Monitor trial
Ptr<FlowMonitor> monitor;
FlowMonitorHelper flowmon_helper;
monitor = flowmon_helper.InstallAll();
Simulator::Run ();
// Flow Monitor Export trial Serializing Flow Monitor output to
XML.")
monitor->SerializeToXmlFile("mesh_01_FM.xml", false, false);
Simulator::Destroy ();
return 0;
}
void
MeshTest::Report ()
{
unsigned n (0);
for (NetDeviceContainer::Iterator i = meshDevices.Begin (); i !=
meshDevices.End (); ++i, ++n)
{
std::ostringstream os;
os << "mp-report-" << n << ".xml";
std::cerr << "Printing mesh point device #" << n << "
diagnostics to " << os.str () << "\n";
std::ofstream of;
of.open (os.str ().c_str ());
if (!of.is_open ())
{
std::cerr << "Error: Can't open file " << os.str () << "\n";
return;
}
mesh.Report (*i, of);
of.close ();
}
}
int
main (int argc, char *argv[])
{
MeshTest t;
t.Configure (argc, argv);
return t.Run ();
}
On Sep 28, 1:16 am, Nuno Namorado <
n.namor...@gmail.com> wrote:
> Any news with this problem?
> I came across the same issue. This time using a simple 3x3 grid (like
> the one the example), see bellow:
> * m_xSize * step
> * |<--------->|
> * step
> * |<--->|
> * 6 --- 7 --- 8 _
> * | \ | / | ^
> * | \ | / | |
> * 3 --- 4 --- 5 m_ySize * step |
> * | / | \ | |
> * | / | \ | |
> * 0 --- 1 --- 2 _
> * ^ sink node
>
> I use the nodes 1,2,3 and 6 to transmitUDPpackets (using
> UdpEchoClient and UdpEchoServer) to node 0 (sink). None of the
> packets are received at the sink.
> Using Proactive or Reactive configurations for HWMP.
>
> Although, if I put all nodes transmitting to sink, then the sink
> receives and echoes back the packets.
> Has anyone come across this problem?
>
> Thanks in advance,
> Nuno
>
> On Sep 19, 11:47 am, silviocs <
silvioc...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Anyways, did you set m_ySize to 1 and m_xSize to 4 (or the number of
> > mesh points in the line)?
>
> > On Sep 16, 11:13 am, francesco calabro <
f.calabro1...@gmail.com>
> > wrote:
>
> > > Hi guys,
> > > as I didn't receive any reply I try to make me clearer.
> > > I started with yourmesh.ccexample in the mesh folder changing the topology
> > > // DefineUDPtraffic for the onoff application