[ndnSIM] Configure FIBs based on IP addresses

Moreno Ambrosin morambro at gmail.com
Tue Feb 11 12:56:53 PST 2014


Hi Alex,

 thank you for your reply. Here is a code example for a simple
configuration. The idea is tho have nodes 0,1 and 2 connected to node 3 by
a point-to-point link, node 4 connected to node 3 and node 5 linked to node
4. On this IP network, I would like to build an NDN overlay network,
placing three consumers on nodes 0,1 and 2, a router on node 3, and a
producer on node 5.


#### Example


#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"
#include "ns3/ndnSIM-module.h"
#include <boost/lexical_cast.hpp>

#include "ns3/ndn-l3-rate-tracer.h"

NS_LOG_COMPONENT_DEFINE ("ndn-ip-overlay");

using namespace ns3;

int main (int argc, char *argv[])
{
    Packet::EnablePrinting ();


     // setting default parameters for PointToPoint links and channels
    Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue
("1Mbps"));
    Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue
("10ms"));
    Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue
("20"));

    CommandLine cmd;
    cmd.Parse (argc, argv);

    NodeContainer routerNodes;
    routerNodes.Create(6);

    // Create Ipv4 classes in order to assign IPs in the topology
  Ipv4AddressHelper ipv4_helper;
    InternetStackHelper ipStack;
    ipStack.SetIpv6StackInstall (false);
    ipStack.InstallAll ();
 Ipv4Address base_addr("10.1.1.0");
 PointToPointHelper p2p;
 ipv4_helper.SetBase(base_addr, Ipv4Mask ("/24"));
 ipv4_helper.Assign(p2p.Install(routerNodes.Get(0), routerNodes.Get(3)));
base_addr = Ipv4Address (base_addr.Get () + 256);
 ipv4_helper.SetBase(base_addr, Ipv4Mask ("/24"));
ipv4_helper.Assign(p2p.Install(routerNodes.Get(1), routerNodes.Get(3)));
 base_addr = Ipv4Address (base_addr.Get () + 256);
 ipv4_helper.SetBase(base_addr, Ipv4Mask ("/24"));
 ipv4_helper.Assign(p2p.Install(routerNodes.Get(2), routerNodes.Get(3)));
base_addr = Ipv4Address (base_addr.Get () + 256);
 ipv4_helper.SetBase(base_addr, Ipv4Mask ("/24"));
ipv4_helper.Assign(p2p.Install(routerNodes.Get(3), routerNodes.Get(4)));
 base_addr = Ipv4Address (base_addr.Get () + 256);
 ipv4_helper.SetBase(base_addr, Ipv4Mask ("/24"));
 ipv4_helper.Assign(p2p.Install(routerNodes.Get(4), routerNodes.Get(5)));
base_addr = Ipv4Address (base_addr.Get () + 256);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

    // Install NDN stack on all nodes
    ndn::StackHelper ndnHelper;
    ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
    ndnHelper.SetDefaultRoutes (false);

    ndnHelper.Install(routerNodes.Get(0));
    ndnHelper.Install(routerNodes.Get(1));
    ndnHelper.Install(routerNodes.Get(2));
    ndnHelper.Install(routerNodes.Get(3));
    ndnHelper.Install(routerNodes.Get(5));

    ndn::IpFacesHelper::Install(routerNodes.Get(0));
    ndn::IpFacesHelper::Install(routerNodes.Get(1));
    ndn::IpFacesHelper::Install(routerNodes.Get(2));
    ndn::IpFacesHelper::Install(routerNodes.Get(3));
    ndn::IpFacesHelper::Install(routerNodes.Get(5));


    ndn::IpFacesHelper::CreateUdpFace (
        Seconds (0.5),
        routerNodes.Get(3),
        routerNodes.Get(5)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
        "/upd-route"
    );

    ndn::IpFacesHelper::CreateUdpFace (
        Seconds (0.5),
        routerNodes.Get(0),
        routerNodes.Get(3)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
        "/"
    );
    ndn::IpFacesHelper::CreateUdpFace (
        Seconds (0.5),
        routerNodes.Get(1),
        routerNodes.Get(3)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
        "/"
    );
    ndn::IpFacesHelper::CreateUdpFace (
        Seconds (0.5),
        routerNodes.Get(1),
        routerNodes.Get(3)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
        "/"
    );


    // Consumer
    ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
    // Consumer will request /udp-route1/0, /udp-route1/1, ...
    consumerHelper.SetPrefix ("/upd-route");
    consumerHelper.SetAttribute ("Frequency", StringValue ("1")); // 1
interests a second
    consumerHelper.Install (routerNodes.Get (0)).Start (Seconds (3));
    consumerHelper.Install (routerNodes.Get (1)).Start (Seconds (3));
    consumerHelper.Install (routerNodes.Get (2)).Start (Seconds (3));


    // Producer
    ndn::AppHelper producerHelper ("ns3::ndn::Producer");
    // Producer will reply to all requests starting with /prefix
    producerHelper.SetPrefix ("/upd-route");
    producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
    producerHelper.Install (routerNodes.Get(5)); // last node

    Simulator::Stop (Seconds (10));

    ndn::L3RateTracer::Install(routerNodes.Get(3),"node.log", Seconds
(0.1));

    Simulator::Run ();
    Simulator::Destroy ();

    return 0;
}

############################


I tried this code and I still obtain the error:

assert failed. cond="cur->tid != tag.GetInstanceTypeId ()",
file=../src/network/model/packet-tag-list.cc, line=250
terminate called without an active exception


Thank you in advance for your help!

Regards
 Moreno


2014-02-11 20:42 GMT+01:00 Alex Afanasyev <alexander.afanasyev at ucla.edu>:

> Hi Moreno,
>
> Would you mind sharing a full working scenario that can reproduce the
> error?  Tcp and Udp faces are not comprehensively tested and there could be
> some bug in them, or there could be something wrong with the scenario too.
>
> ---
> Alex
>
> On Feb 11, 2014, at 9:55 AM, Moreno Ambrosin <morambro at gmail.com> wrote:
>
> Hi,
>
>  I'm new with ndnSIM; I'm trying to build a configuration with NDN as an
> overlay network. For this reason, I installed the Internet stack, all
> point-to-point links, and assigned an IPv4 address to all nodes.
> Finally, following this example
> https://github.com/NDN-Routing/ndnSIM/blob/master/examples/ndn-simple-udp.cc,
> I tried to configure the FIBs. What I want to achieve, is the following
> overlay configuration:
>
>
>                               /some                          /some/content
>        consumer 1 ------------------->  IP:X.X.X.X
>        consumer 2 ------------------->    router 1
>  ---------------------------->  producer
>        ...
>        consumer n ------------------->
>
> I tried to setup the NDN forwarding in the following way:
>
>
>     ndn::IpFacesHelper::Install(routerNodes.Get(0));
>     ndn::IpFacesHelper::Install(routerNodes.Get(27));
>     // Install IpFacesHelper on all consumers (saved inside a vector
> devices)
>     for (int i=0;i<30;i++)
>     {
>          ndn::IpFacesHelper::Install(devices[0].Get(i));
>     }
>
>     ndn::IpFacesHelper::CreateUdpFace (
>         Seconds (0.5),
>         routerNodes.Get(0),
>
> routerNodes.Get(27)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
>         "/some/upd-route"
>     );
>
>     for (int i=0;i<30;i++) {
>         ndn::IpFacesHelper::CreateTcpFace (
>             Seconds (0.5),
>             devices[0].Get(i),
>
> routerNodes.Get(0)->GetObject<Ipv4>()->GetAddress(1,0).GetLocal(),
>             "/some"
>         );
>     }
>
> When I run my script making all devices to request a content
> (with ConsumerCbr application), I obtain the following run-time error:
>
> assert failed. cond="cur->tid != tag.GetInstanceTypeId ()",
> file=../src/network/model/packet-tag-list.cc, line=250
> terminate called without an active exception
>
> What could be the problem?
> Is there another way to setup the FIB based on IP correctly?
>
> Regards
>  Moreno
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
>
>


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


More information about the ndnSIM mailing list