TGax voice-over-IP traffic test. More...
Classes | |
| struct | TxInfo |
| Information about transmitted packet. More... | |
| struct | VoipParams |
| Information about VoIP parameters. More... | |
Public Member Functions | |
| TgaxVoipTrafficTestCase (const std::string &name, std::optional< VoipParams > params={}) | |
| Constructor. | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| Caller graph was not generated because of its size. | |
| virtual | ~TestCase () |
| Destructor. | |
| std::string | GetName () const |
| TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
| void | DoRun () override |
| Implementation to actually run this TestCase. | |
| void | DoSetup () override |
| Implementation to do any local setup required for this TestCase. | |
| void | PacketSent (Ptr< const Packet > packet, Time jitter) |
| Record a packets successfully sent. | |
| void | ReceiveRx (std::string context, Ptr< const Packet > p, const Address &addr) |
| Record a packet successfully received. | |
| void | StateUpdated (TgaxVoipTraffic::VoiceActivityState state, Time duration) |
| Record a change in VoIP voice activity state. | |
Private Attributes | |
| std::optional< VoipParams > | m_params |
| VoIP parameters. | |
| uint64_t | m_received {0} |
| number of bytes received | |
| std::map< uint64_t, TxInfo > | m_sent |
| transmitted VoIP packets | |
| std::vector< std::pair< TgaxVoipTraffic::VoiceActivityState, Time > > | m_states |
| Hold voice activity states and the time at which it started. | |
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... | |
| 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. | |
TGax voice-over-IP traffic test.
Definition at line 51 of file tgax-voip-traffic-test-suite.cc.
| TgaxVoipTrafficTestCase::TgaxVoipTrafficTestCase | ( | const std::string & | name, |
| std::optional< VoipParams > | params = {} ) |
Constructor.
| name | the name of the test to run |
| params | the VoIP parameters to use for the test, default parameters are used if not provided |
Definition at line 130 of file tgax-voip-traffic-test-suite.cc.
References ns3::TestCase::TestCase(), and m_params.
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 238 of file tgax-voip-traffic-test-suite.cc.
References ns3::Simulator::Destroy(), ns3::TgaxVoipTraffic::INACTIVE_SILENCE, m_params, m_received, m_sent, m_states, ns3::MilliSeconds(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ_TOL, ns3::Simulator::Run(), anonymous_namespace{tgax-voip-traffic-test-suite.cc}::silencePayloadSize, anonymous_namespace{tgax-voip-traffic-test-suite.cc}::tol, and anonymous_namespace{tgax-voip-traffic-test-suite.cc}::voicePayloadSize.
|
overrideprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.
Reimplemented from ns3::TestCase.
Definition at line 168 of file tgax-voip-traffic-test-suite.cc.
References ns3::ApplicationHelper::AssignStreams(), anonymous_namespace{tgax-voip-traffic-test-suite.cc}::compressedProtocolHeader, ns3::Config::Connect(), ns3::Config::ConnectWithoutContext(), ns3::CreateObject(), ns3::TgaxVoipTraffic::GetTypeId(), ns3::TgaxVoipTraffic::INACTIVE_SILENCE, ns3::ApplicationHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), m_params, m_states, ns3::MakeCallback(), nodes, NS_LOG_FUNCTION, PacketSent(), ReceiveRx(), ns3::Seconds(), ns3::ApplicationHelper::SetAttribute(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::PacketSocketAddress::SetSingleDevice(), anonymous_namespace{tgax-voip-traffic-test-suite.cc}::silencePayloadSize, ns3::ApplicationContainer::Start(), StateUpdated(), and anonymous_namespace{tgax-voip-traffic-test-suite.cc}::voicePayloadSize.
Record a packets successfully sent.
| packet | the transmitted packet |
| jitter | the delay jitter applied to the packet |
Definition at line 138 of file tgax-voip-traffic-test-suite.cc.
References anonymous_namespace{tgax-voip-traffic-test-suite.cc}::compressedProtocolHeader, m_params, m_sent, ns3::Simulator::Now(), NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.
Referenced by DoSetup().
|
private |
Record a packet successfully received.
| context | the context |
| p | the packet |
| addr | the sender's address |
Definition at line 161 of file tgax-voip-traffic-test-suite.cc.
References anonymous_namespace{tgax-voip-traffic-test-suite.cc}::compressedProtocolHeader, m_received, and NS_LOG_FUNCTION.
Referenced by DoSetup().
|
private |
Record a change in VoIP voice activity state.
| state | the new voice activity state |
| duration | the expected duration of the state |
Definition at line 154 of file tgax-voip-traffic-test-suite.cc.
References m_states, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by DoSetup().
|
private |
VoIP parameters.
Definition at line 127 of file tgax-voip-traffic-test-suite.cc.
Referenced by TgaxVoipTrafficTestCase(), DoRun(), DoSetup(), and PacketSent().
|
private |
number of bytes received
Definition at line 123 of file tgax-voip-traffic-test-suite.cc.
Referenced by DoRun(), and ReceiveRx().
|
private |
transmitted VoIP packets
Definition at line 122 of file tgax-voip-traffic-test-suite.cc.
Referenced by DoRun(), and PacketSent().
|
private |
Hold voice activity states and the time at which it started.
Definition at line 125 of file tgax-voip-traffic-test-suite.cc.
Referenced by DoRun(), DoSetup(), and StateUpdated().