From a55177cd67f013c708e0815a32cff5a2333da498 Mon Sep 17 00:00:00 2001 From: Tim Schubert <tim.schubert@tu-bs.de> Date: Sat, 18 Jul 2020 13:43:51 +0200 Subject: [PATCH] Add a way to set routing helper --- helper/leo-helper.cc | 19 +++++++++++++++---- helper/leo-helper.h | 7 +++++++ test/leo-test-suite.cc | 6 +++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/helper/leo-helper.cc b/helper/leo-helper.cc index da47efb..aa584de 100644 --- a/helper/leo-helper.cc +++ b/helper/leo-helper.cc @@ -25,10 +25,9 @@ LeoHelper::Install (NodeContainer &satellites, NodeContainer &gateways, NodeCont utNet = m_utChannelHelper.Install (satellites, terminals); // Install internet stack on nodes - InternetStackHelper stack; - stack.Install (satellites); - stack.Install (gateways); - stack.Install (terminals); + m_stackHelper.Install (satellites); + m_stackHelper.Install (gateways); + m_stackHelper.Install (terminals); // Make all networks addressable Ipv6AddressHelper address; @@ -201,4 +200,16 @@ LeoHelper::EnableAsciiInternal ( 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 */ diff --git a/helper/leo-helper.h b/helper/leo-helper.h index c38df8d..170591b 100644 --- a/helper/leo-helper.h +++ b/helper/leo-helper.h @@ -10,6 +10,7 @@ #include <ns3/net-device-container.h> #include <ns3/node-container.h> #include <ns3/trace-helper.h> +#include "ns3/internet-stack-helper.h" #include "leo-channel-helper.h" #include "isl-helper.h" @@ -142,6 +143,11 @@ public: void SetIslChannelAttribute (std::string name, const AttributeValue &value); void SetUtChannelAttribute (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: /** * \brief Enable pcap output the indicated net device. @@ -173,6 +179,7 @@ private: Ptr<NetDevice> nd, bool explicitFilename); + InternetStackHelper m_stackHelper; IslHelper m_islChannelHelper; LeoChannelHelper m_utChannelHelper; LeoChannelHelper m_gwChannelHelper; diff --git a/test/leo-test-suite.cc b/test/leo-test-suite.cc index 792ca32..4d25eda 100644 --- a/test/leo-test-suite.cc +++ b/test/leo-test-suite.cc @@ -6,9 +6,10 @@ #include "ns3/applications-module.h" #include "ns3/node-container.h" #include "ns3/core-module.h" +#include "ns3/aodv-module.h" +#include "ns3/test.h" #include "ns3/leo-module.h" -#include "ns3/test.h" using namespace ns3; @@ -54,6 +55,7 @@ LeoTestCase1::DoRun (void) LeoHelper leo; leo.SetDeviceAttribute ("DataRate", StringValue ("10Mbps")); leo.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel")); + leo.SetRoutingHelper (AodvHelper ()); NetDeviceContainer allDevices = leo.Install (satellites, gateways, terminals); @@ -61,8 +63,6 @@ LeoTestCase1::DoRun (void) UdpEchoServerHelper echoServer (9); ApplicationContainer serverApps = echoServer.Install (terminals); - // TODO routing - // install a client on each of the terminals ApplicationContainer clientApps; for (uint32_t i = 1; i < terminals.GetN (); i++)