22#include "ns3/epc-tft-classifier.h"
23#include "ns3/ipv4-header.h"
24#include "ns3/ipv4-l3-protocol.h"
25#include "ns3/ipv6-header.h"
26#include "ns3/ipv6-l3-protocol.h"
28#include "ns3/packet.h"
29#include "ns3/tcp-header.h"
30#include "ns3/tcp-l4-protocol.h"
32#include "ns3/udp-header.h"
33#include "ns3/udp-l4-protocol.h"
112 void DoRun()
override;
124 :
TestCase(BuildNameString(c, d, sa, da, sp, dp, tos, tftId, useIpv6)),
130 NS_LOG_FUNCTION(
this << c << d << sa << da << sp << dp << tos << tftId << useIpv6);
168 std::ostringstream oss;
169 oss << c <<
" d = " << d;
177 oss <<
", sa = " << sa <<
", da = " << da;
179 oss <<
", sp = " << sp <<
", dp = " << dp <<
", tos = 0x" << std::hex << (int)tos
180 <<
" --> tftId = " << tftId;
236 for (
bool useIpv6 : {
false,
true})
261 tft1_1->Add(pf1_1_1);
278 tft1_1->Add(pf1_1_2);
287 tft1_2->Add(pf1_2_1);
292 tft1_2->Add(pf1_2_2);
297 tft1_2->Add(pf1_2_3);
302 tft1_2->Add(pf1_2_4);
318 TestCase::Duration::QUICK);
328 TestCase::Duration::QUICK);
338 TestCase::Duration::QUICK);
348 TestCase::Duration::QUICK);
358 TestCase::Duration::QUICK);
368 TestCase::Duration::QUICK);
380 TestCase::Duration::QUICK);
390 TestCase::Duration::QUICK);
400 TestCase::Duration::QUICK);
410 TestCase::Duration::QUICK);
420 TestCase::Duration::QUICK);
430 TestCase::Duration::QUICK);
440 TestCase::Duration::QUICK);
452 TestCase::Duration::QUICK);
462 TestCase::Duration::QUICK);
472 TestCase::Duration::QUICK);
482 TestCase::Duration::QUICK);
492 TestCase::Duration::QUICK);
502 TestCase::Duration::QUICK);
512 TestCase::Duration::QUICK);
522 TestCase::Duration::QUICK);
532 TestCase::Duration::QUICK);
542 TestCase::Duration::QUICK);
564 TestCase::Duration::QUICK);
574 TestCase::Duration::QUICK);
584 TestCase::Duration::QUICK);
594 TestCase::Duration::QUICK);
604 TestCase::Duration::QUICK);
614 TestCase::Duration::QUICK);
626 TestCase::Duration::QUICK);
636 TestCase::Duration::QUICK);
646 TestCase::Duration::QUICK);
656 TestCase::Duration::QUICK);
666 TestCase::Duration::QUICK);
676 TestCase::Duration::QUICK);
686 TestCase::Duration::QUICK);
698 TestCase::Duration::QUICK);
708 TestCase::Duration::QUICK);
718 TestCase::Duration::QUICK);
728 TestCase::Duration::QUICK);
738 TestCase::Duration::QUICK);
748 TestCase::Duration::QUICK);
771 TestCase::Duration::QUICK);
781 TestCase::Duration::QUICK);
791 TestCase::Duration::QUICK);
801 TestCase::Duration::QUICK);
811 TestCase::Duration::QUICK);
821 TestCase::Duration::QUICK);
833 TestCase::Duration::QUICK);
843 TestCase::Duration::QUICK);
853 TestCase::Duration::QUICK);
863 TestCase::Duration::QUICK);
873 TestCase::Duration::QUICK);
883 TestCase::Duration::QUICK);
893 TestCase::Duration::QUICK);
905 TestCase::Duration::QUICK);
915 TestCase::Duration::QUICK);
925 TestCase::Duration::QUICK);
935 TestCase::Duration::QUICK);
945 TestCase::Duration::QUICK);
955 TestCase::Duration::QUICK);
963 tft4_1->Add(pf1_2_3);
966 tft4_2->Add(pf1_2_4);
977 TestCase::Duration::QUICK);
987 TestCase::Duration::QUICK);
997 TestCase::Duration::QUICK);
1007 TestCase::Duration::QUICK);
1017 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()
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
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 const uint16_t PROT_NUMBER
Protocol number (0x0800)
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 const 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 const uint8_t PROT_NUMBER
protocol number (0x11)
#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.
#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