mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 01:53:58 +02:00
refactor stuff
This commit is contained in:
parent
57b04d6424
commit
97de8c9d24
15 changed files with 135 additions and 88 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include "ns3/core-module.h"
|
#include "ns3/core-module.h"
|
||||||
#include "ns3/network-module.h"
|
#include "ns3/network-module.h"
|
||||||
#include "ns3/internet-module.h"
|
#include "ns3/internet-module.h"
|
||||||
|
#include "ns3/log.h"
|
||||||
#include "../model/leo-mock-net-device.h"
|
#include "../model/leo-mock-net-device.h"
|
||||||
|
|
||||||
#include "arp-cache-helper.h"
|
#include "arp-cache-helper.h"
|
||||||
|
@ -10,13 +11,18 @@
|
||||||
namespace ns3
|
namespace ns3
|
||||||
{
|
{
|
||||||
|
|
||||||
|
NS_LOG_COMPONENT_DEFINE ("ArpCacheHelper");
|
||||||
|
|
||||||
void
|
void
|
||||||
ArpCacheHelper::Install (NetDeviceContainer &devices, Ipv4InterfaceContainer &interfaces) const
|
ArpCacheHelper::Install (NetDeviceContainer &devices, Ipv4InterfaceContainer &interfaces) const
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
for (size_t i = 0; i < devices.GetN (); i ++)
|
for (size_t i = 0; i < devices.GetN (); i ++)
|
||||||
{
|
{
|
||||||
Ptr<NetDevice> dev = devices.Get (i);
|
Ptr<NetDevice> dev = devices.Get (i);
|
||||||
Ptr<Node> node = dev->GetNode ();
|
Ptr<Node> node = dev->GetNode ();
|
||||||
|
NS_LOG_INFO ("Preparing ARP cache of " << node);
|
||||||
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
|
Ptr<Ipv4L3Protocol> ipv4 = node->GetObject<Ipv4L3Protocol> ();
|
||||||
int32_t ifIndex = ipv4->GetInterfaceForDevice (dev);
|
int32_t ifIndex = ipv4->GetInterfaceForDevice (dev);
|
||||||
Ptr<Ipv4Interface> interface = ipv4->GetInterface (ifIndex);
|
Ptr<Ipv4Interface> interface = ipv4->GetInterface (ifIndex);
|
||||||
|
@ -47,6 +53,8 @@ ArpCacheHelper::Install (NetDeviceContainer &devices, Ipv4InterfaceContainer &in
|
||||||
entry = cache->Add (ipaddr);
|
entry = cache->Add (ipaddr);
|
||||||
}
|
}
|
||||||
entry->SetMacAddress (address);
|
entry->SetMacAddress (address);
|
||||||
|
|
||||||
|
NS_LOG_DEBUG ("Added entry for " << address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,4 @@ public:
|
||||||
|
|
||||||
}; /* namespace ns3 */
|
}; /* namespace ns3 */
|
||||||
|
|
||||||
#endif /* ARP_CACHE_HELPER */
|
#endif /* ARP_CACHE_HELPER_H */
|
||||||
|
|
|
@ -224,12 +224,15 @@ IslHelper::Install (NodeContainer c)
|
||||||
NetDeviceContainer
|
NetDeviceContainer
|
||||||
IslHelper::Install (std::vector<Ptr<Node> > &nodes)
|
IslHelper::Install (std::vector<Ptr<Node> > &nodes)
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
Ptr<MockChannel> channel = m_channelFactory.Create<MockChannel> ();
|
Ptr<MockChannel> channel = m_channelFactory.Create<MockChannel> ();
|
||||||
|
|
||||||
NetDeviceContainer container;
|
NetDeviceContainer container;
|
||||||
|
|
||||||
for (Ptr<Node> node: nodes)
|
for (Ptr<Node> node: nodes)
|
||||||
{
|
{
|
||||||
|
NS_LOG_DEBUG ("Adding device for node " << node->GetId ());
|
||||||
Ptr<MockNetDevice> dev = m_deviceFactory.Create<MockNetDevice> ();
|
Ptr<MockNetDevice> dev = m_deviceFactory.Create<MockNetDevice> ();
|
||||||
dev->SetAddress (Mac48Address::Allocate ());
|
dev->SetAddress (Mac48Address::Allocate ());
|
||||||
node->AddDevice (dev);
|
node->AddDevice (dev);
|
||||||
|
|
|
@ -230,6 +230,8 @@ LeoChannelHelper::EnableAsciiInternal (
|
||||||
NetDeviceContainer
|
NetDeviceContainer
|
||||||
LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<Node> > &stations)
|
LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<Node> > &stations)
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
Ptr<LeoMockChannel> channel = m_channelFactory.Create<LeoMockChannel> ();
|
Ptr<LeoMockChannel> channel = m_channelFactory.Create<LeoMockChannel> ();
|
||||||
|
|
||||||
NetDeviceContainer container;
|
NetDeviceContainer container;
|
||||||
|
@ -243,6 +245,8 @@ LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<
|
||||||
dev->SetQueue (queue);
|
dev->SetQueue (queue);
|
||||||
dev->Attach (channel);
|
dev->Attach (channel);
|
||||||
container.Add (dev);
|
container.Add (dev);
|
||||||
|
|
||||||
|
NS_LOG_DEBUG ("Added device for node " << node->GetId ());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Ptr<Node> node : stations)
|
for (Ptr<Node> node : stations)
|
||||||
|
@ -254,6 +258,8 @@ LeoChannelHelper::Install (std::vector<Ptr<Node> > &satellites, std::vector<Ptr<
|
||||||
dev->SetQueue (queue);
|
dev->SetQueue (queue);
|
||||||
dev->Attach (channel);
|
dev->Attach (channel);
|
||||||
container.Add (dev);
|
container.Add (dev);
|
||||||
|
|
||||||
|
NS_LOG_DEBUG ("Added device for node " << node->GetId ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
|
@ -270,15 +276,19 @@ LeoChannelHelper::Install (NodeContainer &satellites, NodeContainer &stations)
|
||||||
NetDeviceContainer
|
NetDeviceContainer
|
||||||
LeoChannelHelper::Install (std::vector<std::string> &satellites, std::vector<std::string> &stations)
|
LeoChannelHelper::Install (std::vector<std::string> &satellites, std::vector<std::string> &stations)
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
std::vector<Ptr<Node> > sats;
|
std::vector<Ptr<Node> > sats;
|
||||||
std::vector<Ptr<Node> > stats;
|
std::vector<Ptr<Node> > stats;
|
||||||
for (std::string name : satellites)
|
for (std::string name : satellites)
|
||||||
{
|
{
|
||||||
|
NS_LOG_DEBUG ("Adding node " << name);
|
||||||
Ptr<Node> node = Names::Find<Node>(name);
|
Ptr<Node> node = Names::Find<Node>(name);
|
||||||
sats.push_back (node);
|
sats.push_back (node);
|
||||||
}
|
}
|
||||||
for (std::string name : stations)
|
for (std::string name : stations)
|
||||||
{
|
{
|
||||||
|
NS_LOG_DEBUG ("Adding node " << name);
|
||||||
Ptr<Node> node = Names::Find<Node>(name);
|
Ptr<Node> node = Names::Find<Node>(name);
|
||||||
stats.push_back (node);
|
stats.push_back (node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,17 +29,17 @@ LeoHelper::Install (NodeContainer &satellites, NodeContainer &gateways, NodeCont
|
||||||
m_stackHelper.Install (gateways);
|
m_stackHelper.Install (gateways);
|
||||||
m_stackHelper.Install (terminals);
|
m_stackHelper.Install (terminals);
|
||||||
|
|
||||||
// Make all networks addressable
|
//// Make all networks addressable
|
||||||
Ipv6AddressHelper address;
|
//Ipv6AddressHelper address;
|
||||||
Ipv6InterfaceContainer islAddrs = address.Assign (islNet);
|
//Ipv6InterfaceContainer islAddrs = address.Assign (islNet);
|
||||||
Ipv6InterfaceContainer gwAddrs = address.Assign (gwNet);
|
//Ipv6InterfaceContainer gwAddrs = address.Assign (gwNet);
|
||||||
Ipv6InterfaceContainer utAddrs = address.Assign (utNet);
|
//Ipv6InterfaceContainer utAddrs = address.Assign (utNet);
|
||||||
|
|
||||||
// Pre-fill the ND caches of networks
|
//// Pre-fill the ND caches of networks
|
||||||
NdCacheHelper ndCache;
|
//NdCacheHelper ndCache;
|
||||||
ndCache.Install (islNet, islAddrs);
|
//ndCache.Install (islNet, islAddrs);
|
||||||
ndCache.Install (gwNet, gwAddrs);
|
//ndCache.Install (gwNet, gwAddrs);
|
||||||
ndCache.Install (utNet, utAddrs);
|
//ndCache.Install (utNet, utAddrs);
|
||||||
|
|
||||||
// Make all networks addressable for legacy protocol
|
// Make all networks addressable for legacy protocol
|
||||||
Ipv4AddressHelper legacy;
|
Ipv4AddressHelper legacy;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "ns3/core-module.h"
|
#include "ns3/core-module.h"
|
||||||
#include "ns3/network-module.h"
|
#include "ns3/network-module.h"
|
||||||
#include "ns3/internet-module.h"
|
#include "ns3/internet-module.h"
|
||||||
|
#include "ns3/log.h"
|
||||||
#include "../model/leo-mock-net-device.h"
|
#include "../model/leo-mock-net-device.h"
|
||||||
|
|
||||||
#include "nd-cache-helper.h"
|
#include "nd-cache-helper.h"
|
||||||
|
@ -10,9 +11,13 @@
|
||||||
namespace ns3
|
namespace ns3
|
||||||
{
|
{
|
||||||
|
|
||||||
|
NS_LOG_COMPONENT_DEFINE ("NdCacheHelper");
|
||||||
|
|
||||||
void
|
void
|
||||||
NdCacheHelper::Install (NetDeviceContainer &devices, Ipv6InterfaceContainer &interfaces) const
|
NdCacheHelper::Install (NetDeviceContainer &devices, Ipv6InterfaceContainer &interfaces) const
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
// prepare NDS cache
|
// prepare NDS cache
|
||||||
for (uint32_t i = 0; i < devices.GetN (); i++)
|
for (uint32_t i = 0; i < devices.GetN (); i++)
|
||||||
{
|
{
|
||||||
|
@ -47,6 +52,8 @@ NdCacheHelper::Install (NetDeviceContainer &devices, Ipv6InterfaceContainer &int
|
||||||
entry = cache->Add (ipaddr);
|
entry = cache->Add (ipaddr);
|
||||||
}
|
}
|
||||||
entry->SetMacAddress (address);
|
entry->SetMacAddress (address);
|
||||||
|
|
||||||
|
NS_LOG_DEBUG ("Added entry for " << address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ LeoSatNodeHelper::SetAttribute (string name, const AttributeValue &value)
|
||||||
NodeContainer
|
NodeContainer
|
||||||
LeoSatNodeHelper::Install (vector<string> &wpFiles)
|
LeoSatNodeHelper::Install (vector<string> &wpFiles)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (wpFiles);
|
NS_LOG_FUNCTION (this);
|
||||||
|
|
||||||
NodeContainer nodes;
|
NodeContainer nodes;
|
||||||
for (size_t i = 0; i < wpFiles.size (); i ++)
|
for (size_t i = 0; i < wpFiles.size (); i ++)
|
||||||
|
|
|
@ -74,6 +74,7 @@ IslMockChannel::TransmitStart (
|
||||||
{
|
{
|
||||||
if (i == srcId) continue;
|
if (i == srcId) continue;
|
||||||
dst = DynamicCast<MockNetDevice> (GetDevice (i));
|
dst = DynamicCast<MockNetDevice> (GetDevice (i));
|
||||||
|
// TODO check LOS using mobility model
|
||||||
Deliver (p, src, dst, txTime);
|
Deliver (p, src, dst, txTime);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -41,6 +41,8 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
|
||||||
Address dst,
|
Address dst,
|
||||||
Time txTime)
|
Time txTime)
|
||||||
{
|
{
|
||||||
|
NS_LOG_FUNCTION (this << p << devId << dst << txTime);
|
||||||
|
|
||||||
// Find devices joined to channel
|
// Find devices joined to channel
|
||||||
Ptr<MockNetDevice> srcDev = DynamicCast<MockNetDevice> (GetDevice (devId));
|
Ptr<MockNetDevice> srcDev = DynamicCast<MockNetDevice> (GetDevice (devId));
|
||||||
if (srcDev == 0)
|
if (srcDev == 0)
|
||||||
|
@ -50,36 +52,29 @@ LeoMockChannel::TransmitStart (Ptr<const Packet> p,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fromGround = m_groundDevices.find (srcDev->GetAddress ()) != m_groundDevices.end ();
|
bool fromGround = m_groundDevices.find (srcDev->GetAddress ()) != m_groundDevices.end ();
|
||||||
|
bool fromSpace = m_satelliteDevices.find (srcDev->GetAddress ()) != m_satelliteDevices.end ();
|
||||||
|
|
||||||
|
NS_ASSERT_MSG (!(fromGround && fromSpace), "Source device can not be both on ground and in space");
|
||||||
|
|
||||||
|
DeviceIndex *dests;
|
||||||
if (fromGround)
|
if (fromGround)
|
||||||
{
|
{
|
||||||
// Satellites can always directly be addresses
|
dests = &m_satelliteDevices;
|
||||||
// Assume beams are narrow enough to not also receive the signal at other
|
|
||||||
// satellites for performance reasons.
|
|
||||||
DeviceIndex::iterator it = m_satelliteDevices.find (dst);
|
|
||||||
if (it == m_satelliteDevices.end ())
|
|
||||||
{
|
|
||||||
NS_LOG_ERROR ("unable to find satellite with address " << dst);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Deliver (p, srcDev, it->second, txTime);
|
|
||||||
}
|
}
|
||||||
else if (srcDev->IsBroadcast () || srcDev->IsMulticast ())
|
else if (fromSpace)
|
||||||
// space to ground delivers to everything within the beam
|
|
||||||
{
|
{
|
||||||
DeviceIndex::iterator it = m_groundDevices.find (dst);
|
dests = &m_groundDevices;
|
||||||
if (it == m_groundDevices.end ())
|
}
|
||||||
{
|
else
|
||||||
NS_LOG_ERROR ("unable to find satellite with address " << dst);
|
{
|
||||||
return false;
|
NS_LOG_ERROR ("unable to find satellite with address " << dst);
|
||||||
}
|
return false;
|
||||||
for (DeviceIndex::iterator it = m_groundDevices.begin ();
|
}
|
||||||
it != m_groundDevices.end ();
|
|
||||||
it++)
|
for (DeviceIndex::iterator it = dests->begin (); it != dests->end (); it ++)
|
||||||
{
|
{
|
||||||
// TODO deliver only to devices in the same beam
|
// TODO deliver only to devices in the same beam
|
||||||
Deliver (p, srcDev, it->second, txTime);
|
Deliver (p, srcDev, it->second, txTime);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -115,7 +115,7 @@ MockChannel::GetDevice (std::size_t i) const
|
||||||
Time
|
Time
|
||||||
MockChannel::GetDelay (Ptr<const MockNetDevice> src, Ptr<const MockNetDevice> dst, Time txTime) const
|
MockChannel::GetDelay (Ptr<const MockNetDevice> src, Ptr<const MockNetDevice> dst, Time txTime) const
|
||||||
{
|
{
|
||||||
NS_LOG_DEBUG ("Get delay from " << src << " to " << dst);
|
NS_LOG_FUNCTION (this << src << dst << txTime);
|
||||||
|
|
||||||
Ptr<MobilityModel> modSrc = src->GetNode ()->GetObject<MobilityModel> ();
|
Ptr<MobilityModel> modSrc = src->GetNode ()->GetObject<MobilityModel> ();
|
||||||
Ptr<MobilityModel> modDst = dst->GetNode ()->GetObject<MobilityModel> ();
|
Ptr<MobilityModel> modDst = dst->GetNode ()->GetObject<MobilityModel> ();
|
||||||
|
@ -160,29 +160,19 @@ MockChannel::Deliver (
|
||||||
Time txTime)
|
Time txTime)
|
||||||
{
|
{
|
||||||
NS_LOG_FUNCTION (this << p << src->GetAddress () << dst->GetAddress () << txTime);
|
NS_LOG_FUNCTION (this << p << src->GetAddress () << dst->GetAddress () << txTime);
|
||||||
|
|
||||||
Time delay = GetDelay (src, dst, txTime);
|
Time delay = GetDelay (src, dst, txTime);
|
||||||
|
|
||||||
/* Check if there is LOS between the source and destination */
|
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
|
||||||
if (GetPropagationLoss ()->CalcRxPower(1, src->GetNode ()->GetObject<MobilityModel> (), dst->GetNode ()->GetObject<MobilityModel> ()) > 0)
|
delay,
|
||||||
{
|
&MockNetDevice::Receive,
|
||||||
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
|
dst,
|
||||||
delay,
|
p->Copy (),
|
||||||
&MockNetDevice::Receive,
|
src);
|
||||||
dst,
|
|
||||||
p->Copy (),
|
|
||||||
src);
|
|
||||||
|
|
||||||
// Call the tx anim callback on the net device
|
// Call the tx anim callback on the net device
|
||||||
m_txrxMock (p, src, dst, txTime, delay);
|
m_txrxMock (p, src, dst, txTime, delay);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NS_LOG_LOGIC (dst << " unreachable from " << src);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ns3
|
} // namespace ns3
|
||||||
|
|
|
@ -30,7 +30,6 @@ EmptyGndNodeHelperTestCase::EmptyGndNodeHelperTestCase ()
|
||||||
|
|
||||||
EmptyGndNodeHelperTestCase::~EmptyGndNodeHelperTestCase ()
|
EmptyGndNodeHelperTestCase::~EmptyGndNodeHelperTestCase ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -63,7 +62,6 @@ SomeGndNodeHelperTestCase::SomeGndNodeHelperTestCase ()
|
||||||
|
|
||||||
SomeGndNodeHelperTestCase::~SomeGndNodeHelperTestCase ()
|
SomeGndNodeHelperTestCase::~SomeGndNodeHelperTestCase ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,7 +28,6 @@ IslIcmpTestCase::IslIcmpTestCase ()
|
||||||
|
|
||||||
IslIcmpTestCase::~IslIcmpTestCase ()
|
IslIcmpTestCase::~IslIcmpTestCase ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -80,6 +79,7 @@ IslIcmpTestCase::DoRun (void)
|
||||||
serverApps.Stop (Seconds (10.0));
|
serverApps.Stop (Seconds (10.0));
|
||||||
|
|
||||||
Simulator::Run ();
|
Simulator::Run ();
|
||||||
|
Simulator::Destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
class IslTestSuite : public TestSuite
|
class IslTestSuite : public TestSuite
|
||||||
|
|
|
@ -30,13 +30,12 @@ LeoTestCase1::LeoTestCase1 ()
|
||||||
|
|
||||||
LeoTestCase1::~LeoTestCase1 ()
|
LeoTestCase1::~LeoTestCase1 ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LeoTestCase1::DoRun (void)
|
LeoTestCase1::DoRun (void)
|
||||||
{
|
{
|
||||||
Time::SetResolution (Time::NS);
|
Time::SetResolution (Time::MS);
|
||||||
|
|
||||||
std::vector<std::string> satWps =
|
std::vector<std::string> satWps =
|
||||||
{
|
{
|
||||||
|
@ -52,38 +51,78 @@ LeoTestCase1::DoRun (void)
|
||||||
NodeContainer gateways = gndHelper.Install ("contrib/leo/data/test/ground-stations.txt");
|
NodeContainer gateways = gndHelper.Install ("contrib/leo/data/test/ground-stations.txt");
|
||||||
NodeContainer terminals = gndHelper.Install ("contrib/leo/data/test/ground-stations.txt");
|
NodeContainer terminals = gndHelper.Install ("contrib/leo/data/test/ground-stations.txt");
|
||||||
|
|
||||||
LeoHelper leo;
|
NetDeviceContainer islNet, gwNet, utNet;
|
||||||
leo.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
|
||||||
leo.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
|
||||||
AodvHelper aodv;
|
|
||||||
leo.SetRoutingHelper (aodv);
|
|
||||||
|
|
||||||
NetDeviceContainer allDevices = leo.Install (satellites, gateways, terminals);
|
IslHelper islCh;
|
||||||
|
islCh.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
islCh.SetDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
islCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||||
|
//// TODO propagation loss from mobility model
|
||||||
|
islCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::RangePropagationLossModel"));
|
||||||
|
islNet = islCh.Install (satellites);
|
||||||
|
|
||||||
|
LeoChannelHelper gwCh;
|
||||||
|
gwCh.SetGndDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
gwCh.SetGndDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
gwCh.SetSatDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
gwCh.SetSatDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
gwCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||||
|
// TODO propagation loss from mobility model
|
||||||
|
gwCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::RangePropagationLossModel"));
|
||||||
|
gwNet = gwCh.Install (satellites, gateways);
|
||||||
|
|
||||||
|
LeoChannelHelper utCh;
|
||||||
|
utCh.SetGndDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
utCh.SetGndDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
utCh.SetSatDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
utCh.SetSatDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
utCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||||
|
// TODO propagation loss from mobility model
|
||||||
|
utCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::RangePropagationLossModel"));
|
||||||
|
utNet = utCh.Install (satellites, terminals);
|
||||||
|
|
||||||
|
// Install internet stack on nodes
|
||||||
|
InternetStackHelper stack;
|
||||||
|
AodvHelper aodv;
|
||||||
|
stack.SetRoutingHelper (aodv);
|
||||||
|
stack.Install (satellites);
|
||||||
|
stack.Install (gateways);
|
||||||
|
stack.Install (terminals);
|
||||||
|
|
||||||
|
// Make all networks addressable for legacy protocol
|
||||||
|
Ipv4AddressHelper ipv4;
|
||||||
|
ipv4.SetBase ("10.1.0.0", "255.255.0.0");
|
||||||
|
Ipv4InterfaceContainer islIp = ipv4.Assign (islNet);
|
||||||
|
ipv4.SetBase ("10.2.0.0", "255.255.0.0");
|
||||||
|
Ipv4InterfaceContainer gwIp = ipv4.Assign (gwNet);
|
||||||
|
ipv4.SetBase ("10.3.0.0", "255.255.0.0");
|
||||||
|
Ipv4InterfaceContainer utIp = ipv4.Assign (utNet);
|
||||||
|
|
||||||
|
ArpCacheHelper arpCache;
|
||||||
|
arpCache.Install (islNet, islIp);
|
||||||
|
arpCache.Install (gwNet, gwIp);
|
||||||
|
arpCache.Install (utNet, utIp);
|
||||||
|
|
||||||
// we want to ping terminals
|
// we want to ping terminals
|
||||||
UdpEchoServerHelper echoServer (9);
|
UdpEchoServerHelper echoServer (9);
|
||||||
ApplicationContainer serverApps = echoServer.Install (terminals);
|
ApplicationContainer serverApps = echoServer.Install (terminals);
|
||||||
|
|
||||||
// install a client on each of the terminals
|
// install a client on one of the terminals
|
||||||
ApplicationContainer clientApps;
|
ApplicationContainer clientApps;
|
||||||
for (uint32_t i = 1; i < terminals.GetN (); i++)
|
Address remote = utIp.GetAddress (1, 0);
|
||||||
{
|
UdpEchoClientHelper echoClient (remote, 9);
|
||||||
Address remote = terminals.Get (i)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();
|
echoClient.SetAttribute ("MaxPackets", UintegerValue (3));
|
||||||
UdpEchoClientHelper echoClient (remote, 9);
|
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
||||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
|
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
||||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
clientApps.Add (echoClient.Install (terminals.Get (0)));
|
||||||
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
|
||||||
|
|
||||||
clientApps.Add (echoClient.Install (terminals.Get (i-1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
clientApps.Start (Seconds (2.0));
|
|
||||||
clientApps.Stop (Seconds (10.0));
|
|
||||||
|
|
||||||
serverApps.Start (Seconds (1.0));
|
serverApps.Start (Seconds (1.0));
|
||||||
serverApps.Stop (Seconds (10.0));
|
clientApps.Start (Seconds (2.0));
|
||||||
|
clientApps.Stop (Seconds (9.0));
|
||||||
|
serverApps.Stop (Seconds (10));
|
||||||
|
|
||||||
Simulator::Run ();
|
Simulator::Run ();
|
||||||
|
Simulator::Destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
|
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
|
||||||
|
|
|
@ -29,7 +29,6 @@ EmptySatNodeHelperTestCase::EmptySatNodeHelperTestCase ()
|
||||||
|
|
||||||
EmptySatNodeHelperTestCase::~EmptySatNodeHelperTestCase ()
|
EmptySatNodeHelperTestCase::~EmptySatNodeHelperTestCase ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -62,7 +61,6 @@ SingleSatNodeHelperTestCase::SingleSatNodeHelperTestCase ()
|
||||||
|
|
||||||
SingleSatNodeHelperTestCase::~SingleSatNodeHelperTestCase ()
|
SingleSatNodeHelperTestCase::~SingleSatNodeHelperTestCase ()
|
||||||
{
|
{
|
||||||
Simulator::Destroy ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
2
wscript
2
wscript
|
@ -12,7 +12,6 @@ def build(bld):
|
||||||
'helper/arp-cache-helper.cc',
|
'helper/arp-cache-helper.cc',
|
||||||
'helper/isl-helper.cc',
|
'helper/isl-helper.cc',
|
||||||
'helper/leo-channel-helper.cc',
|
'helper/leo-channel-helper.cc',
|
||||||
'helper/leo-helper.cc',
|
|
||||||
'helper/nd-cache-helper.cc',
|
'helper/nd-cache-helper.cc',
|
||||||
'helper/ground-node-helper.cc',
|
'helper/ground-node-helper.cc',
|
||||||
'helper/satellite-node-helper.cc',
|
'helper/satellite-node-helper.cc',
|
||||||
|
@ -45,7 +44,6 @@ def build(bld):
|
||||||
'helper/arp-cache-helper.h',
|
'helper/arp-cache-helper.h',
|
||||||
'helper/isl-helper.h',
|
'helper/isl-helper.h',
|
||||||
'helper/leo-channel-helper.h',
|
'helper/leo-channel-helper.h',
|
||||||
'helper/leo-helper.h',
|
|
||||||
'helper/nd-cache-helper.h',
|
'helper/nd-cache-helper.h',
|
||||||
'helper/ground-node-helper.h',
|
'helper/ground-node-helper.h',
|
||||||
'helper/satellite-node-helper.h',
|
'helper/satellite-node-helper.h',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue