NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ns3::ndn::ScenarioHelper Class Reference

Helper class to simplify writing basic simulation scenarios. More...

#include <ndn-scenario-helper.hpp>

Classes

struct  AppInfo
 
struct  RouteInfo
 Route information for addRoutes method. More...
 

Public Member Functions

 ScenarioHelper ()
 
void createTopology (std::initializer_list< std::initializer_list< std::string >> topology, bool shouldInstallNdnStack=true)
 Create topology. More...
 
void addRoutes (std::initializer_list< RouteInfo > routes)
 Create routes between topology nodes. More...
 
void addApps (std::initializer_list< AppInfo > apps)
 Create and install application on nodes. More...
 
Ptr< Node > getNode (const std::string &nodeName)
 Get node. More...
 
shared_ptr< Face > getFace (const std::string &node1, const std::string &node2)
 Get face on the node1 pointing towards node2. More...
 
Ptr< NetDevice > getNetDevice (const std::string &node1, const std::string &node2)
 Get NetDevice on the node1 pointing towards node2. More...
 
void disableRibManager ()
 Disable RIB Manager. More...
 
void disableStrategyChoiceManager ()
 Disable Face Manager. More...
 
void disableForwarderStatusManager ()
 Disable Forwarder Status Manager. More...
 
StackHelpergetStackHelper ()
 Get NDN stack helper, e.g., to adjust its parameters. More...
 

Detailed Description

Helper class to simplify writing basic simulation scenarios.

The following code with scenario helper creates a 3-node topology, with manual routes between nodes and 2 applications, installed on first and last node of the topology:

ScenarioHelper helper;
helper.createTopology({
    {"1", "2"},
    {"2", "3"}
  });

helper.addRoutes({
    {"1", "2", "/prefix", 1},
    {"2", "3", "/prefix", 1}
  });

helper.addApps({
    {"1", "ns3::ndn::ConsumerCbr",
        {{"Prefix", "/prefix"}, {"Frequency", "1"}},
        "0s", "100s"},
    {"3", "ns3::ndn::Producer",
        {{"Prefix", "/prefix"}, {"PayloadSize", "1024"}},
        "0s", "100s"}
  });

Definition at line 63 of file ndn-scenario-helper.hpp.

Constructor & Destructor Documentation

◆ ScenarioHelper()

ns3::ndn::ScenarioHelper::ScenarioHelper ( )

Definition at line 33 of file ndn-scenario-helper.cpp.

Member Function Documentation

◆ createTopology()

void ns3::ndn::ScenarioHelper::createTopology ( std::initializer_list< std::initializer_list< std::string >>  topology,
bool  shouldInstallNdnStack = true 
)

Create topology.

Exceptions
std::logic_errorif createTopology is called more than once

Example:

ScenarioHelper helper;
helper.createTopology({
    {"1", "2"},
    {"2", "3"}
  });

Definition at line 39 of file ndn-scenario-helper.cpp.

References ns3::ndn::StackHelper::InstallAll().

◆ addRoutes()

void ns3::ndn::ScenarioHelper::addRoutes ( std::initializer_list< RouteInfo routes)

Create routes between topology nodes.

Exceptions
std::invalid_argumentif the nodes or links between nodes do not exist

Example:

helper.addRoutes({
    {"1", "2", "/prefix", 1},
    {"2", "3", "/prefix", 1}
  });

Definition at line 92 of file ndn-scenario-helper.cpp.

References ns3::ndn::FibHelper::AddRoute(), getFace(), and getNode().

◆ addApps()

void ns3::ndn::ScenarioHelper::addApps ( std::initializer_list< AppInfo apps)

Create and install application on nodes.

Exceptions
std::invalid_argumentif the nodes or links between nodes do not exist

Example:

helper.addApps({
    {"1", "ns3::ndn::ConsumerCbr",
        {{"Prefix", "/prefix"}, {"Frequency", "1"}},
        "0s", "100s"},
    {"3", "ns3::ndn::Producer",
        {{"Prefix", "/prefix"}, {"PayloadSize", "1024"}},
        "0s", "100s"}
  });

Definition at line 101 of file ndn-scenario-helper.cpp.

References getNode(), ns3::ndn::AppHelper::Install(), and ns3::ndn::AppHelper::SetAttribute().

◆ getNode()

Ptr< Node > ns3::ndn::ScenarioHelper::getNode ( const std::string &  nodeName)

Get node.

Exceptions
std::invalid_argumentif the node does not exist

Definition at line 126 of file ndn-scenario-helper.cpp.

Referenced by addApps(), and addRoutes().

◆ getFace()

shared_ptr< Face > ns3::ndn::ScenarioHelper::getFace ( const std::string &  node1,
const std::string &  node2 
)

Get face on the node1 pointing towards node2.

Exceptions
std::invalid_argumentif the link does not exist

Definition at line 137 of file ndn-scenario-helper.cpp.

References getNetDevice().

Referenced by addRoutes().

◆ getNetDevice()

Ptr< NetDevice > ns3::ndn::ScenarioHelper::getNetDevice ( const std::string &  node1,
const std::string &  node2 
)

Get NetDevice on the node1 pointing towards node2.

Exceptions
std::invalid_argumentif the link does not exist

Definition at line 144 of file ndn-scenario-helper.cpp.

Referenced by getFace().

◆ disableRibManager()

void ns3::ndn::ScenarioHelper::disableRibManager ( )

Disable RIB Manager.

Definition at line 68 of file ndn-scenario-helper.cpp.

References ns3::ndn::StackHelper::disableRibManager().

◆ disableStrategyChoiceManager()

void ns3::ndn::ScenarioHelper::disableStrategyChoiceManager ( )

Disable Face Manager.

Disable Strategy Choice Manager

Definition at line 80 of file ndn-scenario-helper.cpp.

References ns3::ndn::StackHelper::disableStrategyChoiceManager().

◆ disableForwarderStatusManager()

void ns3::ndn::ScenarioHelper::disableForwarderStatusManager ( )

Disable Forwarder Status Manager.

Definition at line 86 of file ndn-scenario-helper.cpp.

References ns3::ndn::StackHelper::disableForwarderStatusManager().

◆ getStackHelper()

StackHelper & ns3::ndn::ScenarioHelper::getStackHelper ( )

Get NDN stack helper, e.g., to adjust its parameters.

Definition at line 158 of file ndn-scenario-helper.cpp.


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