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 | disableStrategyChoiceManager () |
| Disable Strategy Choice Manager. More... | |
| void | disableForwarderStatusManager () |
| Disable Forwarder Status Manager. More... | |
| StackHelper & | getStackHelper () |
| Get NDN stack helper, e.g., to adjust its parameters. More... | |
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.
| ns3::ndn::ScenarioHelper::ScenarioHelper | ( | ) |
Definition at line 33 of file ndn-scenario-helper.cpp.
| void ns3::ndn::ScenarioHelper::createTopology | ( | std::initializer_list< std::initializer_list< std::string >> | topology, |
| bool | shouldInstallNdnStack = true |
||
| ) |
Create topology.
| std::logic_error | if 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().
| void ns3::ndn::ScenarioHelper::addRoutes | ( | std::initializer_list< RouteInfo > | routes | ) |
Create routes between topology nodes.
| std::invalid_argument | if the nodes or links between nodes do not exist |
Example:
helper.addRoutes({
{"1", "2", "/prefix", 1},
{"2", "3", "/prefix", 1}
});
Definition at line 80 of file ndn-scenario-helper.cpp.
References ns3::ndn::FibHelper::AddRoute(), getFace(), and getNode().
| void ns3::ndn::ScenarioHelper::addApps | ( | std::initializer_list< AppInfo > | apps | ) |
Create and install application on nodes.
| std::invalid_argument | if 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 89 of file ndn-scenario-helper.cpp.
References getNode(), ns3::ndn::AppHelper::Install(), and ns3::ndn::AppHelper::SetAttribute().
| Ptr< Node > ns3::ndn::ScenarioHelper::getNode | ( | const std::string & | nodeName | ) |
Get node.
| std::invalid_argument | if the node does not exist |
Definition at line 114 of file ndn-scenario-helper.cpp.
Referenced by addApps(), and addRoutes().
| shared_ptr< Face > ns3::ndn::ScenarioHelper::getFace | ( | const std::string & | node1, |
| const std::string & | node2 | ||
| ) |
Get face on the node1 pointing towards node2.
| std::invalid_argument | if the link does not exist |
Definition at line 125 of file ndn-scenario-helper.cpp.
References getNetDevice().
Referenced by addRoutes().
| Ptr< NetDevice > ns3::ndn::ScenarioHelper::getNetDevice | ( | const std::string & | node1, |
| const std::string & | node2 | ||
| ) |
Get NetDevice on the node1 pointing towards node2.
| std::invalid_argument | if the link does not exist |
Definition at line 132 of file ndn-scenario-helper.cpp.
Referenced by getFace().
| void ns3::ndn::ScenarioHelper::disableStrategyChoiceManager | ( | ) |
Disable Strategy Choice Manager.
Definition at line 68 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableStrategyChoiceManager().
| void ns3::ndn::ScenarioHelper::disableForwarderStatusManager | ( | ) |
Disable Forwarder Status Manager.
Definition at line 74 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableForwarderStatusManager().
| StackHelper & ns3::ndn::ScenarioHelper::getStackHelper | ( | ) |
Get NDN stack helper, e.g., to adjust its parameters.
Definition at line 146 of file ndn-scenario-helper.cpp.