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 | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | ClientRxDelayCallback (const Time &delay, const Address &from) |
Connected with RxDelay trace source of the client. | |
void | ClientRxEmbeddedObjectCallback (Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet) |
Connected with RxEmbeddedObject trace source of the client. | |
void | ClientRxEmbeddedObjectPacketCallback (Ptr< const Packet > packet) |
Connected with RxEmbeddedObjectPacket trace source of the client. | |
void | ClientRxMainObjectCallback (Ptr< const ThreeGppHttpClient > httpClient, Ptr< const Packet > packet) |
Connected with RxMainObject trace source of the client. | |
void | ClientRxMainObjectPacketCallback (Ptr< const Packet > packet) |
Connected with RxMainObjectPacket trace source of the client. | |
void | ClientRxRttCallback (const Time &rtt, const Address &from) |
Connected with RxRtt trace source of the client. | |
void | ClientStateTransitionCallback (const std::string &oldState, const std::string &newState) |
Connected with StateTransition trace source of the client. | |
void | ClientTxEmbeddedObjectRequestCallback (Ptr< const Packet > packet) |
Connected with TxEmbeddedObjectRequest trace source of the client. | |
void | ClientTxMainObjectRequestCallback (Ptr< const Packet > packet) |
Connected with TxMainObjectRequest trace source of the client. | |
Ptr< Node > | CreateSimpleInternetNode (Ptr< SimpleChannel > channel, Address &assignedAddress) |
Creates a Node, complete with a TCP/IP stack and address assignment. | |
void | DeviceDropCallback (Ptr< const Packet > packet) |
Connected with PhyRxDrop trace source of both the client's and server's devices. | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | DoTeardown () override |
Implementation to do any local setup required for this TestCase. | |
void | ProgressCallback () |
Dummy event. | |
void | ServerEmbeddedObjectCallback (uint32_t size) |
Connected with EmbeddedObject trace source of the server. | |
void | ServerMainObjectCallback (uint32_t size) |
Connected with MainObject trace source of the server. | |
void | ServerRxCallback (Ptr< const Packet > packet, const Address &from) |
Connected with Rx trace source of the server. | |
Private Attributes | |
Time | m_channelDelay |
Time needed by a packet to propagate. | |
Ptr< MinMaxAvgTotalCalculator< double > > | m_delayCalculator |
Keeps statistical information of one-trip delays (in seconds). | |
ThreeGppHttpObjectTracker | m_embeddedObjectTracker |
Tracker of embedded objects. | |
Ptr< RateErrorModel > | m_errorModel |
Receive error model to be attached to the devices of both directions. | |
InternetStackHelper | m_internetStackHelper |
Installs TCP/IP stack on the nodes. | |
Ipv4AddressHelper | m_ipv4AddressHelper |
Assigns IPv4 addresses to the nodes. | |
Ipv6AddressHelper | m_ipv6AddressHelper |
Assigns IPv6 addresses to the nodes. | |
ThreeGppHttpObjectTracker | m_mainObjectTracker |
Tracker of main objects. | |
uint32_t | m_mtuSize |
Maximum transmission unit (in bytes). | |
uint16_t | m_numOfPacketDrops |
Number of packets dropped because of m_errorModel. | |
uint16_t | m_numOfPagesReceived |
Begins with 0. Simulation stops if this reaches 3. | |
ThreeGppHttpObjectTracker | m_requestObjectTracker |
Tracker of request objects. | |
uint32_t | m_rngRun |
Determines the set of random values generated. | |
Ptr< MinMaxAvgTotalCalculator< double > > | m_rttCalculator |
Keeps statistical information of round-trip delays (in seconds). | |
TypeId | m_tcpType |
TCP algorithm used. | |
bool | m_useIpv6 |
Whether to use IPv6 or IPv4. | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::TAKES_FOREVER |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. | |
void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) |
Add an individual child TestCase to this test suite. | |
TestCase * | GetParent () const |
Get the parent of this TestCase. | |
bool | IsStatusFailure () const |
Check if any tests failed. | |
bool | IsStatusSuccess () const |
Check if all tests passed. | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. | |
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. | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. | |
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 56 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 282 of file three-gpp-http-client-server-test.cc.
References ns3::CreateObject(), ns3::RateErrorModel::ERROR_UNIT_BIT, ns3::TestCase::GetName(), ns3::Time::IsPositive(), m_delayCalculator, m_errorModel, m_ipv4AddressHelper, m_ipv6AddressHelper, m_rttCalculator, NS_ASSERT, NS_LOG_FUNCTION, ns3::Ipv4AddressHelper::SetBase(), and ns3::Ipv6AddressHelper::SetBase().
|
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 746 of file three-gpp-http-client-server-test.cc.
References ns3::Time::As(), ns3::Time::GetSeconds(), m_delayCalculator, NS_LOG_FUNCTION, and ns3::Time::S.
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 685 of file three-gpp-http-client-server-test.cc.
References ns3::ThreeGppHttpHeader::EMBEDDED_OBJECT, ns3::ThreeGppHttpHeader::GetClientTs(), ns3::ThreeGppHttpHeader::GetContentLength(), ns3::ThreeGppHttpHeader::GetContentType(), 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 678 of file three-gpp-http-client-server-test.cc.
References 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 637 of file three-gpp-http-client-server-test.cc.
References ns3::ThreeGppHttpHeader::GetClientTs(), ns3::ThreeGppHttpHeader::GetContentLength(), ns3::ThreeGppHttpHeader::GetContentType(), ns3::ThreeGppHttpHeader::GetServerTs(), m_mainObjectTracker, ns3::ThreeGppHttpHeader::MAIN_OBJECT, 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 630 of file three-gpp-http-client-server-test.cc.
References 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 753 of file three-gpp-http-client-server-test.cc.
References ns3::Time::As(), ns3::Time::GetSeconds(), m_rttCalculator, NS_LOG_FUNCTION, and ns3::Time::S.
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 720 of file three-gpp-http-client-server-test.cc.
References m_numOfPagesReceived, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Simulator::Stop().
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 586 of file three-gpp-http-client-server-test.cc.
References 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 579 of file three-gpp-http-client-server-test.cc.
References 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 317 of file three-gpp-http-client-server-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Ipv4AddressHelper::Assign(), ns3::Ipv6AddressHelper::Assign(), ns3::CreateObject(), DeviceDropCallback(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::Ipv6InterfaceContainer::GetAddress(), ns3::Ipv4InterfaceContainer::GetN(), ns3::Ipv6InterfaceContainer::GetN(), ns3::InternetStackHelper::Install(), m_errorModel, m_internetStackHelper, m_ipv4AddressHelper, m_ipv6AddressHelper, m_tcpType, m_useIpv6, ns3::MakeCallback(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
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 760 of file three-gpp-http-client-server-test.cc.
References m_numOfPacketDrops, and NS_LOG_FUNCTION.
Referenced by CreateSimpleInternetNode().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 360 of file three-gpp-http-client-server-test.cc.
References ClientRxDelayCallback(), ClientRxEmbeddedObjectCallback(), ClientRxEmbeddedObjectPacketCallback(), ClientRxMainObjectCallback(), ClientRxMainObjectPacketCallback(), ClientRxRttCallback(), ClientStateTransitionCallback(), ClientTxEmbeddedObjectRequestCallback(), ClientTxMainObjectRequestCallback(), ns3::CreateObject(), CreateSimpleInternetNode(), ns3::Simulator::Destroy(), ns3::ApplicationContainer::Get(), ns3::ApplicationContainer::GetN(), ns3::TestCase::GetName(), ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTracker::GetNumOfObjectsReceived(), ns3::ApplicationHelper::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::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ServerEmbeddedObjectCallback(), ServerMainObjectCallback(), ServerRxCallback(), and ns3::Config::SetGlobal().
|
overrideprivatevirtual |
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 517 of file three-gpp-http-client-server-test.cc.
References ns3::TestCase::GetName(), and NS_LOG_FUNCTION.
|
private |
Dummy event.
Definition at line 739 of file three-gpp-http-client-server-test.cc.
References ns3::Simulator::Now(), NS_LOG_INFO, ProgressCallback(), ns3::Time::S, ns3::Simulator::Schedule(), and ns3::Seconds().
Referenced by DoRun(), and ProgressCallback().
|
private |
Connected with EmbeddedObject
trace source of the server.
Updates m_embeddedObjectTracker.
size | Size of the generated embedded object (in bytes). |
Definition at line 671 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 623 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 593 of file three-gpp-http-client-server-test.cc.
References ns3::ThreeGppHttpHeader::GetClientTs(), 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 257 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 276 of file three-gpp-http-client-server-test.cc.
Referenced by ThreeGppHttpObjectTestCase(), ClientRxDelayCallback(), and DoRun().
|
private |
Tracker of embedded objects.
Definition at line 157 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 264 of file three-gpp-http-client-server-test.cc.
Referenced by ThreeGppHttpObjectTestCase(), and CreateSimpleInternetNode().
|
private |
Installs TCP/IP stack on the nodes.
Definition at line 270 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().
|
private |
Assigns IPv4 addresses to the nodes.
Definition at line 272 of file three-gpp-http-client-server-test.cc.
Referenced by ThreeGppHttpObjectTestCase(), and CreateSimpleInternetNode().
|
private |
Assigns IPv6 addresses to the nodes.
Definition at line 274 of file three-gpp-http-client-server-test.cc.
Referenced by ThreeGppHttpObjectTestCase(), and CreateSimpleInternetNode().
|
private |
Tracker of main objects.
Definition at line 156 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 258 of file three-gpp-http-client-server-test.cc.
Referenced by DoRun().
|
private |
Number of packets dropped because of m_errorModel.
Definition at line 268 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 266 of file three-gpp-http-client-server-test.cc.
Referenced by ClientStateTransitionCallback(), and DoRun().
|
private |
Tracker of request objects.
Definition at line 155 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 255 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 278 of file three-gpp-http-client-server-test.cc.
Referenced by ThreeGppHttpObjectTestCase(), ClientRxRttCallback(), and DoRun().
|
private |
TCP algorithm used.
Definition at line 256 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().
|
private |
Whether to use IPv6 or IPv4.
Definition at line 259 of file three-gpp-http-client-server-test.cc.
Referenced by CreateSimpleInternetNode().