Hello Hajime,
I'm newbie with network simulation, but in real, OSPF use keep alive
messages (hello protocol) to manage adjacencies. What I expect, would
be that quagga detect itself that a link is down because of missing
hello messages.
Anyway, following is the backtrace of the execution:
Reading symbols from /home/bvidalen/NS3/ns-3-dce-quagga-umip/build/
debug/src/dce/example/quagga-bruno...done.
(gdb) backtrace
No stack.
(gdb) run
Starting program: /home/bvidalen/NS3/ns-3-dce-quagga-umip/build/debug/
src/dce/example/quagga-bruno backtrace
[Thread debugging using libthread_db enabled]
setrlimit: Operation not permitted
topology created with 4 nodes and 4 links (from examples/topology-
read/bruno.topo.txt)
creating ip4 addresses
creating node containers
creating net device containers
creating ipv4 interfaces
creating all the route
creating quagga process
Program received signal SIGUSR1, User defined signal 1.
0x0012d422 in __kernel_vsyscall ()
(gdb) backtrace
#0 0x0012d422 in __kernel_vsyscall ()
#1 0x022ee230 in raise (sig=10)
at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#2 0x011aa921 in StackTrampoline (this=0x80bad80)
at ../src/dce/model/pthread-fiber-manager.cc:139
#3 0x011a80ab in PthreadFiberManager (this=0x80bad70)
at ../src/dce/model/pthread-fiber-manager.cc:240
#4 0x011afee1 in ns3::TaskManager::SetFiberManagerType
(this=0x80bad00,
type=ns3::TaskManager::PTHREAD_FIBER_MANAGER)
at ../src/dce/model/task-manager.cc:375
#5 0x011b0482 in DoSet (this=0x8067c40, object=0x80bad00,
v=0x80647a0)
at debug/ns3/attribute-accessor-helper.h:184
#6 0x011b184e in ns3::AccessorHelper<ns3::TaskManager,
ns3::EnumValue>::Set (
this=0x8067c40, object=0x80bad00, val=...)
at debug/ns3/attribute-accessor-helper.h:74
#7 0x00805a64 in ns3::ObjectBase::DoSet (this=0x80bad00, spec=...,
checker=..., value=...) at ../src/core/object-base.cc:169
#8 0x00805605 in ns3::ObjectBase::ConstructSelf (this=0x80bad00,
attributes=...) at ../src/core/object-base.cc:151
#9 0x00807d60 in ns3::Object::Construct (this=0x80bad00,
attributes=...)
at ../src/core/object.cc:129
#10 0x0083ea9b in ns3::ObjectFactory::Create (this=0xbfffeb38)
at ../src/core/object-factory.cc:72
---Type <return> to continue, or q <return> to quit---
#11 0x01201743 in ns3::ObjectFactory::Create<ns3::TaskManager> (this=
0xbfffeb38) at debug/ns3/object-factory.h:110
#12 0x01200f57 in ns3::DceManagerHelper::Install (this=0xbfffeb14,
nodes=...)
at ../src/dce/helper/dce-manager-helper.cc:82
#13 0x08054205 in main (argc=2, argv=0xbfffef24)
at ../src/dce/example/quagga-bruno.cc:223
And here is the example I used, Its a modification from de quagga-
rockfuel example, but using a simple topology of four routers in the
Inet format.
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "ns3/core-module.h"
#include "ns3/helper-module.h"
#include "ns3/mobility-module.h"
#include "ns3/dce-module.h"
#include "ns3/quagga-helper.h"
#include "ns3/simulator-module.h"
#include "ns3/global-route-manager.h"
#include "ns3/node-module.h"
#include "ns3/log.h"
#include "ns3/wifi-module.h"
#include "ns3/ipv4-l3-protocol.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/ipv6-header.h"
#include "ns3/icmpv6-header.h"
#include "ns3/ipv6-static-routing.h"
#include "ns3/udp-header.h"
#include "ns3/realtime-simulator-impl.h"
#include "ns3/visualizer.h"
#include "ns3/pyviz.h"
#include "ns3/v4ping-module.h"
#include "ns3/mpi-interface.h"
#include <sys/resource.h>
/*/
#ifdef NS3_MPI
#include <mpi.h>
#endif
*/
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("bruno");
// Parameters
uint32_t nNodes = 2;
//uint32_t stopTime = 600;
uint32_t stopTime = 10000;
static void
SetRlimit ()
{
int ret;
struct rlimit limit;
limit.rlim_cur = 1000000;
limit.rlim_max = 1000000;
ret = setrlimit(RLIMIT_NOFILE, &limit);
if (ret == -1)
{
perror ("setrlimit");
}
return;
}
int
main (int argc, char *argv[])
{
LogComponentEnable ("bruno", LOG_LEVEL_INFO);
/*
#ifdef NS3_MPI
// Distributed simulation setup
MpiInterface::Enable (&argc, &argv);
GlobalValue::Bind ("SimulatorImplementationType",
StringValue ("ns3::DistributedSimulatorImpl"));
uint32_t systemId = MpiInterface::GetSystemId ();
uint32_t systemCount = MpiInterface::GetSize ();
#endif
*/
CommandLine cmd;
cmd.AddValue ("nNodes", "Number of Router nodes", nNodes);
cmd.AddValue ("stopTime", "Time to stop(seconds)", stopTime);
cmd.Parse (argc,argv);
SetRlimit ();
//
// Step o
// Read Topology information
// ------------------------------------------------------------
// -- Read topology data.
// --------------------------------------------
// Pick a topology reader based in the requested format.
Ptr<TopologyReader> inFile = 0;
TopologyReaderHelper topoHelp;
NodeContainer nodes;
string format ("Inet");
string input ("examples/topology-read/bruno.topo.txt");
//string input ("3967.weights.intra");
topoHelp.SetFileName(input);
topoHelp.SetFileType(format);
inFile = topoHelp.GetTopologyReader();
if (inFile != 0)
{
nodes = inFile->Read ();
}
if (nodes.GetN () == 0)
{
NS_LOG_ERROR ("Problems reading node information the topology
file. Failing.");
return -1;
}
if (inFile->LinksSize () == 0)
{
NS_LOG_ERROR ("Problems reading the topology file. Failing.");
return -1;
}
NS_LOG_INFO (" topology created with " << nodes.GetN () << " nodes
and " <<
inFile->LinksSize () << " links (from " << input <<
")");
/*
// Tricky things XXX
// Change systemId for MPI by hand...
#ifdef NS3_MPI
for (uint32_t i = 0; i < nodes.GetN (); i++)
{
nodes.Get (i)->SetSystemId (i % systemCount);
}
#endif
*/
//
// Step 1
// Node Basic Configuration
//
// Internet stack install
InternetStackHelper stack; // IPv4 is required for GlobalRouteMan
stack.Install (nodes);
//
// Step 2
// Address Configuration
//
//
Ipv4AddressHelper ipv4AddrHelper;
NS_LOG_INFO ("creating ip4 addresses");
Ipv4AddressHelper address;
address.SetBase ("10.0.0.0", "255.255.255.252");
int totlinks = inFile->LinksSize ();
NS_LOG_INFO ("creating node containers");
NodeContainer nc[totlinks];
TopologyReader::ConstLinksIterator iter;
int i = 0;
for ( iter = inFile->LinksBegin (); iter != inFile->LinksEnd (); iter
++, i++ )
{
nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode
());
}
NS_LOG_INFO ("creating net device containers");
NetDeviceContainer ndc[totlinks];
PointToPointHelper p2p;
for (int i = 0; i < totlinks; i++)
{
// p2p.SetChannelAttribute ("Delay",
TimeValue(MilliSeconds(weight[i])));
p2p.SetChannelAttribute ("Delay", StringValue ("1ns"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
ndc[i] = p2p.Install (nc[i]);
}
// p2p.EnablePcapAll ("bruno");
NS_LOG_INFO ("creating ipv4 interfaces");
Ipv4InterfaceContainer ipic[totlinks];
for (int i = 0; i < totlinks; i++)
{
ipic[i] = address.Assign (ndc[i]);
address.NewNetwork ();
}
//
// Application configuration for Nodes
//
NS_LOG_INFO ("creating all the route");
// Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
NS_LOG_INFO ("creating quagga process");
//run quagga programs in every node
DceManagerHelper processManager;
QuaggaHelper quagga;
//
// Step 3
// Traffic configuration
//
/*
#ifdef NS3_MPI
if (systemId == 0)
#endif
*/
{
Ptr<V4Ping> app = CreateObject<V4Ping> ();
//Ptr<Ipv4> ipv4Server = nodes.Get (25)->GetObject<Ipv4> ();
//Ptr<Ipv4> ipv4Server = nodes.Get (nodes.GetN () - 1)-
>GetObject<Ipv4> ();
Ptr<Ipv4> ipv4Server = nodes.Get (2)->GetObject<Ipv4> ();
app->SetAttribute ("Remote", Ipv4AddressValue (ipv4Server-
>GetAddress (1, 0).GetLocal ()));
app->SetAttribute ("Verbose", BooleanValue (true));
// nodes.Get (0)->AddApplication (app);
//app->SetStartTime (Seconds (20.0));
//app->SetStopTime (Seconds (stopTime));
}
for (uint32_t i = 0; i < nodes.GetN (); i++)
{
#ifdef NS3_MPI
if (i % systemCount == systemId % systemCount)
#endif
{
// std::cout << "[" << systemId << "] start quagga Node
" << i << std::endl;
processManager.Install (nodes.Get (i));
quagga.EnableOspf (nodes.Get (i));
quagga.EnableZebraDebug (nodes.Get (i));
quagga.Install (nodes.Get (i));
}
}
//.getDevice(0).down(Seconds (25.0));
//nodes.Get(1)->GetObject<Ipv4>()->SetDown(0);
//
// Step 9
// Now It's ready to GO!
//
//RunIp (nodes.Get (0), Seconds (0.1), "route show table all");
if (stopTime != 0)
{
Simulator::Stop (Seconds (stopTime));
}
// Visualizer::Run ();
Ptr<Node> n1 = nodes.Get (2);
Ptr<Ipv4> ipv41 = n1->GetObject<Ipv4> ();
// The first ifIndex is 0 for loopback, then the first p2p is
numbered 1,
// then the next p2p is numbered 2
uint32_t ipv4ifIndex1 = 2;
Simulator::Schedule (Seconds (30.0),&Ipv4::SetDown,ipv41,
ipv4ifIndex1);
Simulator::Run ();
//setMetrics
Simulator::Destroy ();
std::cout << "End of experiment" << std::endl;
return 0;
}
--------------------------------------------
lastly , here is the simple topo utilized.
4 4
0 5625 2473
1 4505 4098
2 9866 2148
3 8315 7088
0 1 1
0 3 10
1 2 1
2 3 2
Thank you for your help.
Best regards
Bruno