11#include "ns3/epc-tft-classifier.h" 
   12#include "ns3/ipv4-header.h" 
   13#include "ns3/ipv4-l3-protocol.h" 
   14#include "ns3/ipv6-header.h" 
   15#include "ns3/ipv6-l3-protocol.h" 
   17#include "ns3/packet.h" 
   18#include "ns3/tcp-header.h" 
   19#include "ns3/tcp-l4-protocol.h" 
   21#include "ns3/udp-header.h" 
   22#include "ns3/udp-l4-protocol.h" 
  101    void DoRun() 
override;
 
 
  113    : 
TestCase(BuildNameString(c, d, sa, da, sp, dp, tos, tftId, useIpv6)),
 
  119    NS_LOG_FUNCTION(
this << c << d << sa << da << sp << dp << tos << tftId << useIpv6);
 
 
  157    std::ostringstream oss;
 
  158    oss << c << 
"  d = " << d;
 
  166        oss << 
", sa = " << sa << 
", da = " << da;
 
  168    oss << 
", sp = " << sp << 
", dp = " << dp << 
", tos = 0x" << std::hex << (int)tos
 
  169        << 
" --> tftId = " << tftId;
 
 
  190        m_c->Classify(udpPacket,
 
 
  225    for (
bool useIpv6 : {
false, 
true})
 
  250        tft1_1->Add(pf1_1_1);
 
  267        tft1_1->Add(pf1_1_2);
 
  276        tft1_2->Add(pf1_2_1);
 
  281        tft1_2->Add(pf1_2_2);
 
  286        tft1_2->Add(pf1_2_3);
 
  291        tft1_2->Add(pf1_2_4);
 
  307                    TestCase::Duration::QUICK);
 
  317                    TestCase::Duration::QUICK);
 
  327                    TestCase::Duration::QUICK);
 
  337                    TestCase::Duration::QUICK);
 
  347                    TestCase::Duration::QUICK);
 
  357                    TestCase::Duration::QUICK);
 
  369                    TestCase::Duration::QUICK);
 
  379                    TestCase::Duration::QUICK);
 
  389                    TestCase::Duration::QUICK);
 
  399                    TestCase::Duration::QUICK);
 
  409                    TestCase::Duration::QUICK);
 
  419                    TestCase::Duration::QUICK);
 
  429                    TestCase::Duration::QUICK);
 
  441                    TestCase::Duration::QUICK);
 
  451                    TestCase::Duration::QUICK);
 
  461                    TestCase::Duration::QUICK);
 
  471                    TestCase::Duration::QUICK);
 
  481                    TestCase::Duration::QUICK);
 
  491                    TestCase::Duration::QUICK);
 
  501                    TestCase::Duration::QUICK);
 
  511                    TestCase::Duration::QUICK);
 
  521                    TestCase::Duration::QUICK);
 
  531                    TestCase::Duration::QUICK);
 
  553                    TestCase::Duration::QUICK);
 
  563                    TestCase::Duration::QUICK);
 
  573                    TestCase::Duration::QUICK);
 
  583                    TestCase::Duration::QUICK);
 
  593                    TestCase::Duration::QUICK);
 
  603                    TestCase::Duration::QUICK);
 
  615                    TestCase::Duration::QUICK);
 
  625                    TestCase::Duration::QUICK);
 
  635                    TestCase::Duration::QUICK);
 
  645                    TestCase::Duration::QUICK);
 
  655                    TestCase::Duration::QUICK);
 
  665                    TestCase::Duration::QUICK);
 
  675                    TestCase::Duration::QUICK);
 
  687                    TestCase::Duration::QUICK);
 
  697                    TestCase::Duration::QUICK);
 
  707                    TestCase::Duration::QUICK);
 
  717                    TestCase::Duration::QUICK);
 
  727                    TestCase::Duration::QUICK);
 
  737                    TestCase::Duration::QUICK);
 
  760                    TestCase::Duration::QUICK);
 
  770                    TestCase::Duration::QUICK);
 
  780                    TestCase::Duration::QUICK);
 
  790                    TestCase::Duration::QUICK);
 
  800                    TestCase::Duration::QUICK);
 
  810                    TestCase::Duration::QUICK);
 
  822                    TestCase::Duration::QUICK);
 
  832                    TestCase::Duration::QUICK);
 
  842                    TestCase::Duration::QUICK);
 
  852                    TestCase::Duration::QUICK);
 
  862                    TestCase::Duration::QUICK);
 
  872                    TestCase::Duration::QUICK);
 
  882                    TestCase::Duration::QUICK);
 
  894                    TestCase::Duration::QUICK);
 
  904                    TestCase::Duration::QUICK);
 
  914                    TestCase::Duration::QUICK);
 
  924                    TestCase::Duration::QUICK);
 
  934                    TestCase::Duration::QUICK);
 
  944                    TestCase::Duration::QUICK);
 
  952        tft4_1->Add(pf1_2_3);
 
  955        tft4_2->Add(pf1_2_4);
 
  966                    TestCase::Duration::QUICK);
 
  976                    TestCase::Duration::QUICK);
 
  986                    TestCase::Duration::QUICK);
 
  996                    TestCase::Duration::QUICK);
 
 1006                    TestCase::Duration::QUICK);
 
 
Test case to check the functionality of the Tft Classifier.
Ipv4Header m_ipHeader
the IPv4 header
TcpHeader m_tcpHeader
the TCP header
Ptr< EpcTftClassifier > m_c
the EPC TFT classifier
static std::string BuildNameString(Ptr< EpcTftClassifier > c, EpcTft::Direction d, std::string sa, std::string da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId, bool useIpv6)
Build name string.
bool m_useIpv6
use IPv4 or IPv6 header/addresses
EpcTftClassifierTestCase(Ptr< EpcTftClassifier > c, EpcTft::Direction d, std::string sa, std::string da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId, bool useIpv6)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
UdpHeader m_udpHeader
the UDP header
~EpcTftClassifierTestCase() override
uint8_t m_tftId
the TFT ID
EpcTft::Direction m_d
the EPC TFT direction
Ipv6Header m_ipv6Header
the IPv6 header
Epc Tft Classifier Test Suite.
EpcTftClassifierTestSuite()
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Direction
Indicates the direction of the traffic that is to be classified.
Ipv4 addresses are stored in host order in this class.
void Set(uint32_t address)
input address is in host order.
static constexpr uint16_t PROT_NUMBER
Protocol number.
void Set(uint32_t mask)
input mask is in host order.
void Set(const char *address)
Sets an Ipv6Address by parsing the input C-string.
static Ipv6Address MakeIpv4MappedAddress(Ipv4Address addr)
Make the Ipv4-mapped IPv6 address.
static constexpr uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
Describes an IPv6 prefix.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr uint8_t PROT_NUMBER
Protocol number (see http://www.iana.org/assignments/protocol-numbers)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
static EpcTftClassifierTestSuite g_lteTftClassifierTestSuite
Static variable for test initialization.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Ipv4Address localAddress
IPv4 address of the UE.
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
uint16_t localPortEnd
end of the port number range of the UE
Ipv4Mask localMask
IPv4 address mask of the UE.
uint16_t remotePortEnd
end of the port number range of the remote host
Ipv6Address remoteIpv6Address
IPv6 address of the remote host.
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
uint16_t remotePortStart
start of the port number range of the remote host
Ipv6Address localIpv6Address
IPv6 address of the UE.
Ipv4Address remoteAddress
IPv4 address of the remote host.
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host.
uint16_t localPortStart
start of the port number range of the UE