mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-08 01:53:58 +02:00
Prefix LEO tests with leo
This commit is contained in:
parent
096b48f005
commit
55cd581ce1
7 changed files with 130 additions and 6 deletions
|
@ -83,7 +83,7 @@ public:
|
|||
};
|
||||
|
||||
GndNodeHelperTestSuite::GndNodeHelperTestSuite ()
|
||||
: TestSuite ("gnd-node-helper", UNIT)
|
||||
: TestSuite ("leo-gnd-node-helper", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new EmptyGndNodeHelperTestCase, TestCase::QUICK);
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
};
|
||||
|
||||
IslMockChannelTestSuite::IslMockChannelTestSuite ()
|
||||
: TestSuite ("isl-mock-channel", UNIT)
|
||||
: TestSuite ("leo-isl-mock-channel", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new IslMockChannelTransmitUnknownTestCase, TestCase::QUICK);
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
};
|
||||
|
||||
IslPropagationTestSuite::IslPropagationTestSuite ()
|
||||
: TestSuite ("isl-propagation", UNIT)
|
||||
: TestSuite ("leo-isl-propagation", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new IslPropagationAngleTestCase1, TestCase::QUICK);
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
};
|
||||
|
||||
IslTestSuite::IslTestSuite ()
|
||||
: TestSuite ("isl", EXAMPLE)
|
||||
: TestSuite ("leo-isl", EXAMPLE)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new IslIcmpTestCase, TestCase::EXTENSIVE);
|
||||
|
|
123
test/leo-anim-test-suite.cc
Normal file
123
test/leo-anim-test-suite.cc
Normal file
|
@ -0,0 +1,123 @@
|
|||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#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/netanim-module.h"
|
||||
|
||||
#include "ns3/leo-module.h"
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
class LeoAnimTestCase1 : public TestCase
|
||||
{
|
||||
public:
|
||||
LeoAnimTestCase1 ();
|
||||
virtual ~LeoAnimTestCase1 ();
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
NodeContainer MakeSomeNodes (Vector position, size_t amount);
|
||||
};
|
||||
|
||||
LeoAnimTestCase1::LeoAnimTestCase1 ()
|
||||
: TestCase ("Leo test case (does nothing)")
|
||||
{
|
||||
}
|
||||
|
||||
LeoAnimTestCase1::~LeoAnimTestCase1 ()
|
||||
{
|
||||
}
|
||||
|
||||
NodeContainer
|
||||
LeoAnimTestCase1::MakeSomeNodes (Vector position, size_t amount)
|
||||
{
|
||||
NodeContainer nodes;
|
||||
for (uint32_t i = 0; i < amount; i ++)
|
||||
{
|
||||
Ptr<ConstantPositionMobilityModel> mob = CreateObject<ConstantPositionMobilityModel> ();
|
||||
mob->SetPosition (Vector (i, 0, 0) + position);
|
||||
Ptr<Node> node = CreateObject<Node> ();
|
||||
node->AggregateObject (mob);
|
||||
nodes.Add (node);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
void
|
||||
LeoAnimTestCase1::DoRun (void)
|
||||
{
|
||||
Time::SetResolution (Time::NS);
|
||||
|
||||
NodeContainer satellites = MakeSomeNodes (Vector (0, 0, 1), 10);
|
||||
|
||||
NetDeviceContainer islNet;
|
||||
|
||||
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"));
|
||||
islNet = islCh.Install (satellites);
|
||||
|
||||
// Install internet stack on nodes
|
||||
InternetStackHelper stack;
|
||||
AodvHelper aodv;
|
||||
stack.SetRoutingHelper (aodv);
|
||||
stack.Install (satellites);
|
||||
|
||||
// Make all networks addressable for legacy protocol
|
||||
Ipv4AddressHelper ipv4;
|
||||
ipv4.SetBase ("10.1.0.0", "255.255.0.0");
|
||||
Ipv4InterfaceContainer islIp = ipv4.Assign (islNet);
|
||||
|
||||
UdpEchoServerHelper echoServer (9);
|
||||
ApplicationContainer serverApps = echoServer.Install (satellites.Get (1));
|
||||
|
||||
// install a client on one of the terminals
|
||||
ApplicationContainer clientApps;
|
||||
Address remote = islIp.GetAddress (3, 0);
|
||||
UdpEchoClientHelper echoClient (remote, 9);
|
||||
echoClient.SetAttribute ("MaxPackets", UintegerValue (10));
|
||||
echoClient.SetAttribute ("Interval", TimeValue (Seconds (2.0)));
|
||||
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
|
||||
clientApps.Add (echoClient.Install (satellites.Get (0)));
|
||||
|
||||
AnimationInterface anim ("animation.xml");
|
||||
|
||||
serverApps.Start (Seconds (1.0));
|
||||
clientApps.Start (Seconds (2.0));
|
||||
clientApps.Stop (Seconds (60));
|
||||
serverApps.Stop (Seconds (60));
|
||||
|
||||
Simulator::Stop (Seconds (60));
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
// The TestSuite class names the TestSuite, identifies what type of TestSuite,
|
||||
// and enables the TestCases to be run. Typically, only the constructor for
|
||||
// this class must be defined
|
||||
//
|
||||
class LeoAnimTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
LeoAnimTestSuite ();
|
||||
};
|
||||
|
||||
LeoAnimTestSuite::LeoAnimTestSuite ()
|
||||
: TestSuite ("leo-anim", EXAMPLE)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new LeoAnimTestCase1, TestCase::EXTENSIVE);
|
||||
}
|
||||
|
||||
// Do not forget to allocate an instance of this TestSuite
|
||||
static LeoAnimTestSuite leoAnimTestSuite;
|
|
@ -87,7 +87,7 @@ public:
|
|||
};
|
||||
|
||||
SatNodeHelperTestSuite::SatNodeHelperTestSuite ()
|
||||
: TestSuite ("sat-node-helper", UNIT)
|
||||
: TestSuite ("leo-sat-node-helper", UNIT)
|
||||
{
|
||||
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
|
||||
AddTestCase (new EmptySatNodeHelperTestCase, TestCase::QUICK);
|
||||
|
|
3
wscript
3
wscript
|
@ -7,7 +7,7 @@
|
|||
# conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H')
|
||||
|
||||
def build(bld):
|
||||
module = bld.create_ns3_module('leo', ['core','internet', 'propagation', 'stats', 'traffic', 'flow-monitor', 'applications'])
|
||||
module = bld.create_ns3_module('leo', ['core','internet', 'propagation', 'stats', 'traffic', 'flow-monitor', 'applications', 'netanim'])
|
||||
module.source = [
|
||||
'helper/arp-cache-helper.cc',
|
||||
'helper/isl-helper.cc',
|
||||
|
@ -32,6 +32,7 @@ def build(bld):
|
|||
'test/isl-mock-channel-test-suite.cc',
|
||||
'test/isl-propagation-test-suite.cc',
|
||||
'test/isl-test-suite.cc',
|
||||
'test/leo-anim-test-suite.cc',
|
||||
'test/leo-input-fstream-container-test-suite.cc',
|
||||
'test/leo-mobility-test-suite.cc',
|
||||
'test/leo-mock-channel-test-suite.cc',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue