[ndnSIM] collapse during simulation

乐舒原 leshuyuan at 163.com
Tue Oct 29 20:53:28 PDT 2013


 Hi all,
     I've met a trouble during my simulation.I write my own forwarding strategy and run it in the 11-node 2-bottlenect topology.But,the simulation is collapsed during the first data packet returning.I used gdb to debug it and no exception caught.Here is the log when I run the scenario:
Waf: Leaving directory `/home/lok/ndnSIM/scenario/build'
'build' finished successfully (27.229s)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7418,  NodeId:, 0, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7968,  NodeId:, 1, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7c18,  NodeId:, 2, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7eb8,  NodeId:, 3, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 1)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 2)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 3)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 4)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108,  NodeId:, 4, ;FaceId:, 5)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af88e0,  NodeId:, 5, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af88e0,  NodeId:, 5, ;FaceId:, 1)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 1)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 2)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 3)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 4)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70,  NodeId:, 6, ;FaceId:, 5)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9578,  NodeId:, 7, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af98e8,  NodeId:, 8, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9c58,  NodeId:, 9, ;FaceId:, 0)
0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9afa028,  NodeId:, 10, ;FaceId:, 0)
0s 0 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7418,  NodeId:, 0, ;FaceId:, 1)
0s 7 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9578,  NodeId:, 7, ;FaceId:, 1)
0s 8 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af98e8,  NodeId:, 8, ;FaceId:, 1)
0s 9 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9c58,  NodeId:, 9, ;FaceId:, 1)
0s 10 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9afa028,  NodeId:, 10, ;FaceId:, 1)
0s 0 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af7418)
0s 0 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(0)(1,y,1)
0s 0 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af7418, /data/p1/%00,  NodeId:, 0, ;FaceId:, 0)
0s 0 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af7418Interest Sended Count 1
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af8108)
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(4)(1,y,1)
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8108, /data/p1/%00,  NodeId:, 4, ;FaceId:, 4)
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8108Interest Sended Count 1
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(5)(2,y,1)
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8108, /data/p1/%00,  NodeId:, 4, ;FaceId:, 5)
0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8108Interest Sended Count 1
0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af88e0)
0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(1)(1,y,1)
0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af88e0, /data/p1/%00,  NodeId:, 5, ;FaceId:, 1)
0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af88e0Interest Sended Count 1
0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af8d70)
0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(2)(1,y,1)
0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8d70, /data/p1/%00,  NodeId:, 6, ;FaceId:, 2)
0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8d70Interest Sended Count 1
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af9578)
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=local(1)(0,g,0)
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(0x9af9578, /data/p1/%00, /data/p1/%00,  NodeId:, 7, ;FaceId:, 1)
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af9578SatisfyInterest Count 1
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af9578, /data/p1/%00,  NodeId:, 7, ;FaceId:, 1)
0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af9578Interest Sended Count 1
0.0554312s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(0x9af8d70, /data/p1/%00, /data/p1/%00,  NodeId:, 6, ;FaceId:, 2)
0.0554312s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af8d70SatisfyInterest Count 1
0.0649352s 5 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(0x9af88e0, /data/p1/%00, /data/p1/%00,  NodeId:, 5, ;FaceId:, 1)
0.0649352s 5 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af88e0SatisfyInterest Count 1
0.0702904s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(root at ubuntu:/home/lok/ndnSIM/scenario#
    
     The log shows that the simulation collapsed after the router(node 5) receiving the data packet.
     
    The follow is my forwarding strategy:
#include "MyFwStrategy_InterestRate.h"
#include "interestsatisfiedrate.h"

#include "ns3/ndn-fib.h"
#include "ns3/ndn-fib-entry.h"
#include "ns3/ndn-pit-entry.h"
#include "ns3/ndn-interest.h"
#include "ns3/ndn-face.h"
#include "ns3/node.h"

#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/boolean.h"

#include <boost/ref.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

#include "iostream"

namespace ll = boost::lambda;
namespace ns3{
namespace ndn{
namespace fw{
    NS_OBJECT_ENSURE_REGISTERED(MyFwStrategy_InterestRate);

    LogComponent MyFwStrategy_InterestRate::g_log = LogComponent (MyFwStrategy_InterestRate::GetLogName ().c_str ());

    std::string MyFwStrategy_InterestRate::GetLogName ()
    {
          return "ndn.fw.MyFwStrategy_InterestRate";
    }

    TypeId MyFwStrategy_InterestRate::GetTypeId (void)
    {
          static TypeId tid = TypeId ("ns3::ndn::fw::MyFwStrategy_InterestRate")
        .SetGroupName ("Ndn")
        .SetParent <ForwardingStrategy> ()
        .AddConstructor <MyFwStrategy_InterestRate> ()

        // .AddAttribute ("Attribute", "Attribute spec",
        //                         StringValue ("DefaultValue"),
        //                         MakeStringAccessor (&
            //                         MakeStringChecker ())
           ;
          return tid;
    }

    MyFwStrategy_InterestRate::MyFwStrategy_InterestRate(){}

    void MyFwStrategy_InterestRate::AddFace (Ptr<Face> face){
        NS_LOG_FUNCTION(this << " NodeId:" << face->GetNode()->GetId() <<";FaceId:"<< face->GetId());
        ObjectFactory factory;
        const std::string typeId = "ns3::ndn::InterestSatisfiedRate";
        factory.SetTypeId(typeId);
        Ptr<Object> interestSatisfiedRate =factory.Create();
        //Ptr<InterestSatisfiedRate>     interestSatisfiedRate =
        //    CreateObject<InterestSatisfiedRate>();   
        //NS_LOG_DEBUG("after AddFace");
        face->AggregateObject(interestSatisfiedRate);
        super::AddFace(face);
    }

    void MyFwStrategy_InterestRate::DidSendOutInterest (Ptr<Face> inFace,    Ptr<Face> outFace,Ptr<const Interest> interest,Ptr<pit::Entry> pitEntry){
        NS_LOG_FUNCTION(this << pitEntry->GetPrefix()<< " NodeId:" << outFace->GetNode()->GetId() <<";FaceId:"<< outFace->GetId());
        super::DidSendOutInterest (inFace,outFace,interest,pitEntry);
        Ptr<InterestSatisfiedRate>    interestSatisfiedRate =
            outFace->GetObject<InterestSatisfiedRate>();
        interestSatisfiedRate-> addOutInterests();
        NS_LOG_DEBUG(this << "Interest Sended Count " << interestSatisfiedRate-> getOutInterests());
    }

    void MyFwStrategy_InterestRate::WillSatisfyPendingInterest (Ptr<Face> inFace,Ptr<pit::Entry> pitEntry){
        NS_LOG_FUNCTION(this << pitEntry->GetPrefix()<< pitEntry->GetPrefix()<< " NodeId:" << inFace->GetNode()->GetId() <<";FaceId:"<< inFace->GetId());       
        super::WillSatisfyPendingInterest (inFace,pitEntry);
        Ptr<InterestSatisfiedRate>    interestSatisfiedRate =
            inFace->GetObject<InterestSatisfiedRate>();
        interestSatisfiedRate-> addSatisfiedInterests();
        NS_LOG_DEBUG(this << "SatisfyInterest Count " << interestSatisfiedRate-> getSatisfiedInterests());

    }

    //void MyFwStrategy_InterestRate::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry){
    //    NS_LOG_FUNCTION(this << pitEntry->GetPrefix());
    //    super::WillEraseTimedOutPendingInterest (pitEntry);
    //    BOOST_FOREACH(const fib::FaceMetric &metricFace,pitEntry->GetFibEntry())
    //}

    bool MyFwStrategy_InterestRate::DoPropagateInterest (Ptr<Face> inFace,Ptr<const Interest> interest,Ptr<pit::Entry> pitEntry){
        NS_LOG_FUNCTION (this);
        int propagatedCount = 0;
        BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())
        {
            NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));
            if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list
                break;
            if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))
            {
                continue;
            }
            propagatedCount++;
        }
        //NS_LOG_INFO ("Propagated to " << propagatedCount << " faces");
        return propagatedCount > 0;
    }
   
   
   
}
}
}

    By the way,the scenario is correct because I run another forwarding strategy in it successfully.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131030/f74884ff/attachment.html>


More information about the ndnSIM mailing list