mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 10:03:58 +02:00
Update ISL test
This commit is contained in:
parent
12040289d3
commit
07abd6efca
1 changed files with 41 additions and 30 deletions
|
@ -5,6 +5,9 @@
|
||||||
#include "ns3/internet-module.h"
|
#include "ns3/internet-module.h"
|
||||||
#include "ns3/applications-module.h"
|
#include "ns3/applications-module.h"
|
||||||
#include "ns3/node-container.h"
|
#include "ns3/node-container.h"
|
||||||
|
#include "ns3/aodv-helper.h"
|
||||||
|
#include "ns3/internet-stack-helper.h"
|
||||||
|
#include "ns3/udp-client-server-helper.h"
|
||||||
|
|
||||||
#include "ns3/leo-module.h"
|
#include "ns3/leo-module.h"
|
||||||
#include "ns3/test.h"
|
#include "ns3/test.h"
|
||||||
|
@ -33,51 +36,59 @@ IslIcmpTestCase::~IslIcmpTestCase ()
|
||||||
void
|
void
|
||||||
IslIcmpTestCase::DoRun (void)
|
IslIcmpTestCase::DoRun (void)
|
||||||
{
|
{
|
||||||
NodeContainer nodes;
|
Time::SetResolution (Time::NS);
|
||||||
nodes.Create (3);
|
|
||||||
|
|
||||||
IslHelper isl;
|
std::vector<std::string> satWps =
|
||||||
isl.SetDeviceAttribute ("DataRate", StringValue ("5Gbps"));
|
{
|
||||||
isl.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
// TODO use different waypoints
|
||||||
isl.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel"));
|
"contrib/leo/data/test/waypoints.txt",
|
||||||
isl.SetDeviceAttribute ("MobilityModel", StringValue ("ns3::WaypointMobilityModel"));
|
"contrib/leo/data/test/waypoints.txt",
|
||||||
|
"contrib/leo/data/test/waypoints.txt",
|
||||||
|
"contrib/leo/data/test/waypoints.txt",
|
||||||
|
};
|
||||||
|
|
||||||
NetDeviceContainer devices;
|
LeoSatNodeHelper satHelper;
|
||||||
devices = isl.Install (nodes);
|
NodeContainer satellites = satHelper.Install (satWps);
|
||||||
|
|
||||||
|
IslHelper islCh;
|
||||||
|
islCh.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
|
||||||
|
islCh.SetDeviceAttribute ("ReceiveErrorModel", StringValue ("ns3::BurstErrorModel"));
|
||||||
|
islCh.SetChannelAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel"));
|
||||||
|
islCh.SetDeviceAttribute ("InterframeGap", TimeValue (Seconds (0.001)));
|
||||||
|
islCh.SetChannelAttribute ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel"));
|
||||||
|
NetDeviceContainer islNet = islCh.Install (satellites);
|
||||||
|
|
||||||
|
// Install internet stack on nodes
|
||||||
InternetStackHelper stack;
|
InternetStackHelper stack;
|
||||||
stack.Install (nodes);
|
AodvHelper aodv;
|
||||||
|
stack.SetRoutingHelper (aodv);
|
||||||
|
stack.Install (satellites);
|
||||||
|
|
||||||
Ipv6AddressHelper address;
|
// Make all networks addressable for legacy protocol
|
||||||
|
Ipv4AddressHelper ipv4;
|
||||||
Ipv6InterfaceContainer interfaces = address.Assign (devices);
|
ipv4.SetBase ("10.1.0.0", "255.255.0.0");
|
||||||
|
Ipv4InterfaceContainer islIp = ipv4.Assign (islNet);
|
||||||
NdCacheHelper nsHelper;
|
|
||||||
nsHelper.Install (devices, interfaces);
|
|
||||||
|
|
||||||
// install echo server on all nodes
|
// install echo server on all nodes
|
||||||
UdpEchoServerHelper echoServer (9);
|
UdpEchoServerHelper echoServer (9);
|
||||||
ApplicationContainer serverApps = echoServer.Install (nodes);
|
ApplicationContainer serverApps = echoServer.Install (satellites);
|
||||||
|
|
||||||
ApplicationContainer clientApps;
|
ApplicationContainer clientApps;
|
||||||
UdpEchoClientHelper echoClient (devices.Get (0)->GetAddress (), 9);
|
for (uint32_t i = 0; i < satellites.GetN (); i ++)
|
||||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
|
|
||||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
|
||||||
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
|
||||||
|
|
||||||
for (uint32_t i = 1; i < nodes.GetN (); i++)
|
|
||||||
{
|
{
|
||||||
Address destAddress = interfaces.GetAddress (i, 0);
|
UdpEchoClientHelper echoClient (islIp.GetAddress ((i+1) % satellites.GetN (), 0), 9);
|
||||||
echoClient.SetAttribute ("RemoteAddress", AddressValue (destAddress));
|
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
|
||||||
|
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
|
||||||
clientApps.Add (echoClient.Install (nodes.Get (0)));
|
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
||||||
|
echoClient.Install (satellites.Get (i));
|
||||||
}
|
}
|
||||||
|
|
||||||
serverApps.Start (Seconds (1.0));
|
serverApps.Start (Seconds (1.0));
|
||||||
clientApps.Start (Seconds (2.0));
|
clientApps.Start (Seconds (5.0));
|
||||||
clientApps.Stop (Seconds (10.0));
|
clientApps.Stop (Seconds (20.0));
|
||||||
serverApps.Stop (Seconds (10.0));
|
serverApps.Stop (Seconds (21.0));
|
||||||
|
|
||||||
|
Simulator::Stop (Seconds (22.0));
|
||||||
Simulator::Run ();
|
Simulator::Run ();
|
||||||
Simulator::Destroy ();
|
Simulator::Destroy ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue