A test class which verifies that each HTTP object sent is also received the same size. More...
Classes | |
class | ThreeGppHttpObjectTracker |
Public Member Functions | |
ThreeGppHttpObjectTestCase (const std::string &name, uint32_t rngRun, const TypeId &tcpType, const Time &channelDelay, double bitErrorRate, uint32_t mtuSize, bool useIpv6) | |
Public Member Functions inherited from ns3::TestCase | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName (void) const |
Private Member Functions | |
void | ClientRxDelayCallback (const Time &delay, const Address &from) |
Connected with RxDelay trace source of the client. More... | |
void | ClientRxEmbeddedObjectCallback (Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet) |
Connected with RxEmbeddedObject trace source of the client. More... | |
void | ClientRxEmbeddedObjectPacketCallback (Ptr< const Packet > packet) |
Connected with RxEmbeddedObjectPacket trace source of the client. More... | |
void | ClientRxMainObjectCallback (Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet) |
Connected with RxMainObject trace source of the client. More... | |
void | ClientRxMainObjectPacketCallback (Ptr< const Packet > packet) |
Connected with RxMainObjectPacket trace source of the client. More... | |
void | ClientRxRttCallback (const Time &rtt, const Address &from) |
Connected with RxRtt trace source of the client. More... | |
void | ClientStateTransitionCallback (const std::string &oldState, const std::string &newState) |
Connected with StateTransition trace source of the client. More... | |
void | ClientTxEmbeddedObjectRequestCallback (Ptr< const Packet > packet) |
Connected with TxEmbeddedObjectRequest trace source of the client. More... | |
void | ClientTxMainObjectRequestCallback (Ptr< const Packet > packet) |
Connected with TxMainObjectRequest trace source of the client. More... | |
Ptr< Node > | CreateSimpleInternetNode (Ptr< SimpleChannel > channel, Address &assignedAddress) |
Creates a Node, complete with a TCP/IP stack and address assignment. More... | |
void | DeviceDropCallback (Ptr< const Packet > packet) |
Connected with PhyRxDrop trace source of both the client's and server's devices. More... | |
virtual void | DoRun () |
Implementation to actually run this TestCase. More... | |
virtual void | DoTeardown () |
Implementation to do any local setup required for this TestCase. More... | |
void | ProgressCallback () |
Dummy event. More... | |
void | ServerEmbeddedObjectCallback (uint32_t size) |
Connected with EmbeddedObject trace source of the server. More... | |
void | ServerMainObjectCallback (uint32_t size) |
Connected with MainObject trace source of the server. More... | |
void | ServerRxCallback (Ptr< const Packet > packet, const Address &from) |
Connected with Rx trace source of the server. More... | |
Private Attributes | |
Time | m_channelDelay |
Time needed by a packet to propagate. More... | |
Ptr< MinMaxAvgTotalCalculator< double > > | m_delayCalculator |
Keeps statistical information of one-trip delays (in seconds). More... | |
ThreeGppHttpObjectTracker | m_embeddedObjectTracker |
Tracker of embedded objects. More... | |
Ptr< RateErrorModel > | m_errorModel |
Receive error model to be attached to the devices of both directions. More... | |
InternetStackHelper | m_internetStackHelper |
Installs TCP/IP stack on the nodes. More... | |
Ipv4AddressHelper | m_ipv4AddressHelper |
Assigns IPv4 addresses to the nodes. More... | |
Ipv6AddressHelper | m_ipv6AddressHelper |
Assigns IPv6 addresses to the nodes. More... | |
ThreeGppHttpObjectTracker | m_mainObjectTracker |
Tracker of main objects. More... | |
uint32_t | m_mtuSize |
Maximum transmission unit (in bytes). More... | |
uint16_t | m_numOfPacketDrops |
Number of packets dropped because of m_errorModel. More... | |
uint16_t | m_numOfPagesReceived |
Begins with 0. Simulation stops if this reaches 3. More... | |
ThreeGppHttpObjectTracker | m_requestObjectTracker |
Tracker of request objects. More... | |
uint32_t | m_rngRun |
Determines the set of random values generated. More... | |
Ptr< MinMaxAvgTotalCalculator< double > > | m_rttCalculator |
Keeps statistical information of round-trip delays (in seconds). More... | |
TypeId | m_tcpType |
TCP algorithm used. More... | |
bool | m_useIpv6 |
Whether to use IPv6 or IPv4. More... | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum | TestDuration { QUICK = 1, EXTENSIVE = 2, TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. More... | |
void | AddTestCase (TestCase *testCase, TestDuration duration=QUICK) |
Add an individual child TestCase to this test suite. More... | |
TestCase * | GetParent () const |
Get the parent of this TestCsse. More... | |
bool | IsStatusFailure (void) const |
Check if any tests failed. More... | |
bool | IsStatusSuccess (void) const |
Check if all tests passed. More... | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. More... | |
void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
Log the failure of this TestCase. More... | |
bool | MustAssertOnFailure (void) const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure (void) const |
Check if this run should continue on failure. More... | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. More... | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. More... | |
A test class which verifies that each HTTP object sent is also received the same size.
The test uses a minimalist scenario of one HTTP server and one HTTP client, connected through a SimpleChannel. The simulation runs until 3 web pages have been successfully downloaded by the client.
The test also collects some statistical information from the simulation for informational or debugging purpose. This can be seen by enabling LOG_INFO.
Definition at line 70 of file three-gpp-http-client-server-test.cc.
ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTestCase | ( | const std::string & | name, |
uint32_t | rngRun, | ||
const TypeId & | tcpType, | ||
const Time & | channelDelay, | ||
double | bitErrorRate, | ||
uint32_t | mtuSize, | ||
bool | useIpv6 | ||
) |
name | A textual label to briefly describe the test. |
rngRun | Run index to be used, intended to affect the values produced by random number generators throughout the test. |
tcpType | Type of TCP algorithm to be used by the connection between the client and the server. Must be a child type of ns3::TcpSocketFactory. |
channelDelay | Transmission delay between the client and the server (and vice versa) which is due to the channel. |
bitErrorRate | The probability of transmission error between the client and the server (and vice versa) in the unit of bits. |
mtuSize | Maximum transmission unit (in bytes) to be used by the server model. |
useIpv6 | If true, IPv6 will be used to address both client and server. Otherwise, IPv4 will be used. |
Definition at line 295 of file three-gpp-http-client-server-test.cc.
References ns3::TestCase::GetName(), ns3::Time::IsPositive(), m_delayCalculator, m_errorModel, m_ipv4AddressHelper, m_ipv6AddressHelper, m_rttCalculator, NS_ASSERT, NS_LOG_FUNCTION, ns3::Ipv4AddressHelper::SetBase(), ns3::Ipv6AddressHelper::SetBase(), ns3::RateErrorModel::SetRate(), and ns3::RateErrorModel::SetUnit().
|
private |
Connected with RxDelay
trace source of the client.
Updates the statistics in m_delayCalculator.
delay | The packet one-trip delay time. |
from | The address of the device where the packet originates from. |
Definition at line 761 of file three-gpp-http-client-server-test.cc.
References ns3::Time::GetSeconds(), m_delayCalculator, NS_LOG_FUNCTION, and ns3::MinMaxAvgTotalCalculator< T >::Update().
Referenced by DoRun().
|
private |
Connected with RxEmbeddedObject
trace source of the client.
Updates m_embeddedObjectTracker and perform some tests on the size of the object.
httpClient | Pointer to the application. |
packet | Full packet received by application. |
Definition at line 706 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::Copy(), ns3::ThreeGppHttpHeader::GetClientTs(), ns3::ThreeGppHttpHeader::GetContentLength(), ns3::ThreeGppHttpHeader::GetContentType(), ns3::Node::GetId(), ns3::Application::GetNode(), ns3::ThreeGppHttpHeader::GetServerTs(), m_embeddedObjectTracker, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_GT, ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectReceived(), and ns3::Seconds().
Referenced by DoRun().
|
private |
Connected with RxEmbeddedObjectPacket
trace source of the client.
Updates m_embeddedObjectTracker and perform some tests on the packet.
packet | The packet received. |
Definition at line 699 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::GetSize(), m_embeddedObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::PartReceived().
Referenced by DoRun().
|
private |
Connected with RxMainObject
trace source of the client.
Updates m_mainObjectTracker and perform some tests on the size of the object.
httpClient | Pointer to the application. |
packet | Full packet received by application. |
Definition at line 664 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::Copy(), ns3::ThreeGppHttpHeader::GetClientTs(), ns3::ThreeGppHttpHeader::GetContentLength(), ns3::ThreeGppHttpHeader::GetContentType(), ns3::Node::GetId(), ns3::Application::GetNode(), ns3::ThreeGppHttpHeader::GetServerTs(), m_mainObjectTracker, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_GT, ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectReceived(), and ns3::Seconds().
Referenced by DoRun().
|
private |
Connected with RxMainObjectPacket
trace source of the client.
Updates m_mainObjectTracker and perform some tests on the packet.
packet | The packet received. |
Definition at line 657 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::GetSize(), m_mainObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::PartReceived().
Referenced by DoRun().
|
private |
Connected with RxRtt
trace source of the client.
Updates the statistics in m_rttCalculator.
rtt | The packet round trip delay time. |
from | The address of the device where the packet originates from. |
Definition at line 769 of file three-gpp-http-client-server-test.cc.
References ns3::Time::GetSeconds(), m_rttCalculator, NS_LOG_FUNCTION, and ns3::MinMaxAvgTotalCalculator< T >::Update().
Referenced by DoRun().
|
private |
Connected with StateTransition
trace source of the client.
Increments m_numOfPagesReceived when the client enters READING state.
oldState | The name of the previous state. |
newState | The name of the current state. |
Definition at line 735 of file three-gpp-http-client-server-test.cc.
References m_numOfPagesReceived, NS_LOG_FUNCTION, and NS_LOG_LOGIC().
Referenced by DoRun().
|
private |
Connected with TxEmbeddedObjectRequest
trace source of the client.
Updates m_requestObjectTracker.
packet | The packet of embedded object sent. |
Definition at line 614 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::GetSize(), m_requestObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectSent().
Referenced by DoRun().
|
private |
Connected with TxMainObjectRequest
trace source of the client.
Updates m_requestObjectTracker.
packet | The packet of main object sent. |
Definition at line 607 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::GetSize(), m_requestObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectSent().
Referenced by DoRun().
|
private |
Creates a Node, complete with a TCP/IP stack and address assignment.
m_tcpType determines the TCP algorithm installed at the TCP stack. m_useIpv6 determines whether to use IPv4 addressing or IPv6 addressing.
[in] | channel | Pointer to a channel which the node's device will be attached to. |
[out] | assignedAddress | The resulting address of the node. |
Definition at line 332 of file three-gpp-http-client-server-test.cc.
References ns3::Node::AddDevice(), ns3::Ipv6AddressHelper::Assign(), ns3::Ipv4AddressHelper::Assign(), third::channel, DeviceDropCallback(), ns3::Ipv6InterfaceContainer::GetAddress(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::Ipv6InterfaceContainer::GetN(), ns3::Ipv4InterfaceContainer::GetN(), ns3::Object::GetObject(), ns3::InternetStackHelper::Install(), m_errorModel, m_internetStackHelper, m_ipv4AddressHelper, m_ipv6AddressHelper, m_tcpType, m_useIpv6, ns3::MakeCallback(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::SimpleNetDevice::SetAddress(), ns3::ObjectBase::SetAttribute(), ns3::SimpleNetDevice::SetChannel(), ns3::SimpleNetDevice::SetReceiveErrorModel(), and ns3::ObjectBase::TraceConnectWithoutContext().
Referenced by DoRun().
Connected with PhyRxDrop
trace source of both the client's and server's devices.
Increments m_numOfPacketDrops.
packet | Pointer to the packet being dropped. |
Definition at line 777 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::GetSize(), m_numOfPacketDrops, and NS_LOG_FUNCTION.
Referenced by CreateSimpleInternetNode().
|
privatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 377 of file three-gpp-http-client-server-test.cc.
References third::channel, ClientRxDelayCallback(), ClientRxEmbeddedObjectCallback(), ClientRxEmbeddedObjectPacketCallback(), ClientRxMainObjectCallback(), ClientRxMainObjectPacketCallback(), ClientRxRttCallback(), ClientStateTransitionCallback(), ClientTxEmbeddedObjectRequestCallback(), ClientTxMainObjectRequestCallback(), CreateSimpleInternetNode(), ns3::ApplicationContainer::Get(), ns3::MinMaxAvgTotalCalculator< T >::getMax(), ns3::MinMaxAvgTotalCalculator< T >::getMean(), ns3::MinMaxAvgTotalCalculator< T >::getMin(), ns3::ApplicationContainer::GetN(), ns3::TestCase::GetName(), ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::GetNumOfObjectsReceived(), ns3::Object::GetObject(), ns3::ThreeGppHttpClientHelper::Install(), ns3::ThreeGppHttpServerHelper::Install(), ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::IsEmpty(), m_channelDelay, m_delayCalculator, m_embeddedObjectTracker, m_mainObjectTracker, m_mtuSize, m_numOfPacketDrops, m_numOfPagesReceived, m_requestObjectTracker, m_rngRun, m_rttCalculator, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_NE, NS_TEST_EXPECT_MSG_EQ, ProgressCallback(), ns3::Seconds(), ServerEmbeddedObjectCallback(), ServerMainObjectCallback(), ServerRxCallback(), and ns3::Config::SetGlobal().
|
privatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 545 of file three-gpp-http-client-server-test.cc.
References ns3::TestCase::GetName(), and NS_LOG_FUNCTION.
|
private |
Dummy event.
Definition at line 754 of file three-gpp-http-client-server-test.cc.
References ns3::Now(), NS_LOG_INFO, and ns3::Seconds().
Referenced by DoRun().
|
private |
Connected with EmbeddedObject
trace source of the server.
Updates m_embeddedObjectTracker.
size | Size of the generated embedded object (in bytes). |
Definition at line 692 of file three-gpp-http-client-server-test.cc.
References m_embeddedObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectSent().
Referenced by DoRun().
|
private |
Connected with MainObject
trace source of the server.
Updates m_mainObjectTracker.
size | Size of the generated main object (in bytes). |
Definition at line 650 of file three-gpp-http-client-server-test.cc.
References m_mainObjectTracker, NS_LOG_FUNCTION, and ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectSent().
Referenced by DoRun().
|
private |
Connected with Rx
trace source of the server.
Updates m_requestObjectTracker and perform some tests on the packet and the size of the object.
packet | The packet received. |
from | The address where the packet originates from. |
Definition at line 621 of file three-gpp-http-client-server-test.cc.
References ns3::Packet::Copy(), ns3::ThreeGppHttpHeader::GetClientTs(), ns3::Packet::GetSize(), m_requestObjectTracker, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_GT, ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::ObjectReceived(), ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::PartReceived(), and ns3::Seconds().
Referenced by DoRun().
|
private |
Time needed by a packet to propagate.
Definition at line 270 of file three-gpp-http-client-server-test.cc.
Referenced by DoRun().
|
private |
Keeps statistical information of one-trip delays (in seconds).
Definition at line 289 of file three-gpp-http-client-server-test.cc.
Referenced by ClientRxDelayCallback(), DoRun(), and ThreeGppHttpObjectTestCase().
|
private |
Tracker of embedded objects.
Definition at line 171 of file three-gpp-http-client-server-test.cc.
Referenced by ClientRxEmbeddedObjectCallback(), ClientRxEmbeddedObjectPacketCallback(), DoRun(), and ServerEmbeddedObjectCallback().
|
private |
Receive error model to be attached to the devices of both directions.
Definition at line 277 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode(), and ThreeGppHttpObjectTestCase().
|
private |
Installs TCP/IP stack on the nodes.
Definition at line 283 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().
|
private |
Assigns IPv4 addresses to the nodes.
Definition at line 285 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode(), and ThreeGppHttpObjectTestCase().
|
private |
Assigns IPv6 addresses to the nodes.
Definition at line 287 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode(), and ThreeGppHttpObjectTestCase().
|
private |
Tracker of main objects.
Definition at line 170 of file three-gpp-http-client-server-test.cc.
Referenced by ClientRxMainObjectCallback(), ClientRxMainObjectPacketCallback(), DoRun(), and ServerMainObjectCallback().
|
private |
Maximum transmission unit (in bytes).
Definition at line 271 of file three-gpp-http-client-server-test.cc.
Referenced by DoRun().
|
private |
Number of packets dropped because of m_errorModel.
Definition at line 281 of file three-gpp-http-client-server-test.cc.
Referenced by DeviceDropCallback(), and DoRun().
|
private |
Begins with 0. Simulation stops if this reaches 3.
Definition at line 279 of file three-gpp-http-client-server-test.cc.
Referenced by ClientStateTransitionCallback(), and DoRun().
|
private |
Tracker of request objects.
Definition at line 169 of file three-gpp-http-client-server-test.cc.
Referenced by ClientTxEmbeddedObjectRequestCallback(), ClientTxMainObjectRequestCallback(), DoRun(), and ServerRxCallback().
|
private |
Determines the set of random values generated.
Definition at line 268 of file three-gpp-http-client-server-test.cc.
Referenced by DoRun().
|
private |
Keeps statistical information of round-trip delays (in seconds).
Definition at line 291 of file three-gpp-http-client-server-test.cc.
Referenced by ClientRxRttCallback(), DoRun(), and ThreeGppHttpObjectTestCase().
|
private |
TCP algorithm used.
Definition at line 269 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().
|
private |
Whether to use IPv6 or IPv4.
Definition at line 272 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().