19 #include "ns3/core-module.h"
20 #include "ns3/network-module.h"
21 #include "ns3/internet-module.h"
22 #include "ns3/point-to-point-module.h"
23 #include "ns3/packet-sink-helper.h"
24 #include "ns3/packet-sink.h"
25 #include "ns3/random-variable-stream.h"
26 #include "ns3/on-off-helper.h"
27 #include "ns3/brite-module.h"
41 virtual void DoRun (
void);
45 BriteTopologyStructureTestCase::BriteTopologyStructureTestCase ()
46 :
TestCase (
"Test that two brite topologies created with same seed value produce same graph (not an exact test)")
50 BriteTopologyStructureTestCase::~BriteTopologyStructureTestCase ()
57 std::string confFile =
"src/brite/test/test.conf";
62 bthA.AssignStreams (1);
67 bthB.AssignStreams (1);
71 bthA.BuildBriteTopology (stack);
72 bthB.BuildBriteTopology (stack);
74 int numAsA = bthA.
GetNAs ();
75 int numAsB = bthB.
GetNAs ();
78 NS_TEST_ASSERT_MSG_EQ (numAsA, 2,
"Number of AS for this topology must be 2");
79 NS_TEST_ASSERT_MSG_EQ (numAsA, numAsB,
"Number of AS should be same for both test topologies");
83 for (
unsigned int i = 0; i < bthA.
GetNAs (); ++i)
85 NS_TEST_ASSERT_MSG_EQ (bthA.GetNLeafNodesForAs (i), bthB.GetNLeafNodesForAs (i),
"Total number of leaf nodes different for AS " << i);
96 virtual void DoRun (
void);
100 BriteTopologyFunctionTestCase::BriteTopologyFunctionTestCase ()
101 :
TestCase (
"Test that packets can be send across a BRITE topology using UDP")
105 BriteTopologyFunctionTestCase::~BriteTopologyFunctionTestCase ()
112 std::string confFile =
"src/brite/test/test.conf";
119 address.
SetBase (
"10.0.0.0",
"255.255.255.0");
121 bth.BuildBriteTopology (stack);
131 int numNodesInAsZero = bth.GetNNodesForAs (0);
132 source.
Add (bth.GetNodeForAs (0, numNodesInAsZero - 1));
138 int numNodesInAsOne = bth.GetNNodesForAs (1);
139 sink.
Add (bth.GetNodeForAs (1, numNodesInAsOne - 1));
147 p2pSourceDevices = p2p.
Install (source);
148 p2pSinkDevices = p2p.
Install (sink);
150 address.
SetBase (
"10.1.0.0",
"255.255.0.0");
152 sourceInterfaces = address.
Assign (p2pSourceDevices);
154 address.
SetBase (
"10.2.0.0",
"255.255.0.0");
156 sinkInterfaces = address.
Assign (p2pSinkDevices);
163 onOff.SetAttribute (
"OffTime",
StringValue (
"ns3::ConstantRandomVariable[Constant=0]"));
holds a vector of ns3::Application pointers.
virtual void DoRun(void)
Implementation to actually run this test case.
static Ipv4Address GetAny(void)
smart pointer class similar to boost::intrusive_ptr
holds a vector of std::pair of Ptr<Ipv4> and interface index.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation. Makes all nodes in the simulation into routers.
hold variables of type string
NetDeviceContainer Install(NodeContainer c)
uint32_t GetNAs(void) const
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
TestSuite(std::string name, Type type=UNIT)
Constuct a new test suite.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
static void SetRun(uint64_t run)
Set the run number of simulation.
a polymophic address class
Class for representing data rates.
uint32_t GetNEdgesTopology() const
void AssignIpv4Addresses(Ipv4AddressHelper &address)
uint32_t GetNNodesTopology() const
holds a vector of ns3::NetDevice pointers
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
virtual void DoRun(void)
Implementation to actually run this test case.
void Install(std::string nodeName) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
void SetChannelAttribute(std::string name, const AttributeValue &value)
static void SetSeed(uint32_t seed)
set the seed it will duplicate the seed value 6 times
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
ApplicationContainer Install(NodeContainer c) const
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetAttribute(std::string name, const AttributeValue &value)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const