Add a way to set routing helper

This commit is contained in:
Tim Schubert 2020-07-18 13:43:51 +02:00
parent 7ba1d66e8c
commit a55177cd67
3 changed files with 25 additions and 7 deletions

View file

@ -25,10 +25,9 @@ LeoHelper::Install (NodeContainer &satellites, NodeContainer &gateways, NodeCont
utNet = m_utChannelHelper.Install (satellites, terminals); utNet = m_utChannelHelper.Install (satellites, terminals);
// Install internet stack on nodes // Install internet stack on nodes
InternetStackHelper stack; m_stackHelper.Install (satellites);
stack.Install (satellites); m_stackHelper.Install (gateways);
stack.Install (gateways); m_stackHelper.Install (terminals);
stack.Install (terminals);
// Make all networks addressable // Make all networks addressable
Ipv6AddressHelper address; Ipv6AddressHelper address;
@ -201,4 +200,16 @@ LeoHelper::EnableAsciiInternal (
m_utChannelHelper.EnableAsciiInternal (stream, prefix, nd, explicitFilename); m_utChannelHelper.EnableAsciiInternal (stream, prefix, nd, explicitFilename);
} }
void
LeoHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing)
{
m_stackHelper.SetRoutingHelper (routing);
}
void
LeoHelper::SetRoutingHelper (const Ipv6RoutingHelper &routing)
{
m_stackHelper.SetRoutingHelper (routing);
}
} /* namespace ns3 */ } /* namespace ns3 */

View file

@ -10,6 +10,7 @@
#include <ns3/net-device-container.h> #include <ns3/net-device-container.h>
#include <ns3/node-container.h> #include <ns3/node-container.h>
#include <ns3/trace-helper.h> #include <ns3/trace-helper.h>
#include "ns3/internet-stack-helper.h"
#include "leo-channel-helper.h" #include "leo-channel-helper.h"
#include "isl-helper.h" #include "isl-helper.h"
@ -142,6 +143,11 @@ public:
void SetIslChannelAttribute (std::string name, const AttributeValue &value); void SetIslChannelAttribute (std::string name, const AttributeValue &value);
void SetUtChannelAttribute (std::string name, const AttributeValue &value); void SetUtChannelAttribute (std::string name, const AttributeValue &value);
void SetGwChannelAttribute (std::string name, const AttributeValue &value); void SetGwChannelAttribute (std::string name, const AttributeValue &value);
void SetInternetStackAttribute (std::string name, const AttributeValue &value);
void SetRoutingHelper (const Ipv4RoutingHelper &routing);
void SetRoutingHelper (const Ipv6RoutingHelper &routing);
private: private:
/** /**
* \brief Enable pcap output the indicated net device. * \brief Enable pcap output the indicated net device.
@ -173,6 +179,7 @@ private:
Ptr<NetDevice> nd, Ptr<NetDevice> nd,
bool explicitFilename); bool explicitFilename);
InternetStackHelper m_stackHelper;
IslHelper m_islChannelHelper; IslHelper m_islChannelHelper;
LeoChannelHelper m_utChannelHelper; LeoChannelHelper m_utChannelHelper;
LeoChannelHelper m_gwChannelHelper; LeoChannelHelper m_gwChannelHelper;

View file

@ -6,9 +6,10 @@
#include "ns3/applications-module.h" #include "ns3/applications-module.h"
#include "ns3/node-container.h" #include "ns3/node-container.h"
#include "ns3/core-module.h" #include "ns3/core-module.h"
#include "ns3/aodv-module.h"
#include "ns3/test.h"
#include "ns3/leo-module.h" #include "ns3/leo-module.h"
#include "ns3/test.h"
using namespace ns3; using namespace ns3;
@ -54,6 +55,7 @@ LeoTestCase1::DoRun (void)
LeoHelper leo; LeoHelper leo;
leo.SetDeviceAttribute ("DataRate", StringValue ("10Mbps")); leo.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
leo.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel")); leo.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
leo.SetRoutingHelper (AodvHelper ());
NetDeviceContainer allDevices = leo.Install (satellites, gateways, terminals); NetDeviceContainer allDevices = leo.Install (satellites, gateways, terminals);
@ -61,8 +63,6 @@ LeoTestCase1::DoRun (void)
UdpEchoServerHelper echoServer (9); UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (terminals); ApplicationContainer serverApps = echoServer.Install (terminals);
// TODO routing
// install a client on each of the terminals // install a client on each of the terminals
ApplicationContainer clientApps; ApplicationContainer clientApps;
for (uint32_t i = 1; i < terminals.GetN (); i++) for (uint32_t i = 1; i < terminals.GetN (); i++)