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) |
| 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... | |
| void | disableRibManager () |
| Disable RIB Manager. More... | |
| void | disableFaceManager () |
| Disable Face Manager. More... | |
| void | disableStrategyChoiceManager () |
| Disable Strategy Choice Manager. More... | |
| void | disableStatusServer () |
| Disable Status Server. 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 | ) |
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 89 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 98 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 123 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 134 of file ndn-scenario-helper.cpp.
Referenced by addRoutes().
| void ns3::ndn::ScenarioHelper::disableRibManager | ( | ) |
Disable RIB Manager.
Definition at line 65 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableRibManager().
| void ns3::ndn::ScenarioHelper::disableFaceManager | ( | ) |
Disable Face Manager.
Definition at line 71 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableFaceManager().
| void ns3::ndn::ScenarioHelper::disableStrategyChoiceManager | ( | ) |
Disable Strategy Choice Manager.
Definition at line 77 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableStrategyChoiceManager().
| void ns3::ndn::ScenarioHelper::disableStatusServer | ( | ) |
Disable Status Server.
Definition at line 83 of file ndn-scenario-helper.cpp.
References ns3::ndn::StackHelper::disableStatusServer().