24 #include "ns3/packet.h" 25 #include "ns3/ipv4-header.h" 26 #include "ns3/ipv6-header.h" 27 #include "ns3/udp-header.h" 28 #include "ns3/tcp-header.h" 29 #include "ns3/ipv4-l3-protocol.h" 30 #include "ns3/ipv6-l3-protocol.h" 31 #include "ns3/udp-l4-protocol.h" 32 #include "ns3/tcp-l4-protocol.h" 34 #include "ns3/epc-tft-classifier.h" 113 virtual void DoRun (
void);
126 :
TestCase (BuildNameString (c, d, sa, da, sp, dp, tos, tftId, useIpv6)),
132 NS_LOG_FUNCTION (
this << c << d << sa << da << sp << dp << tos << tftId << useIpv6);
170 std::ostringstream oss;
175 oss <<
", sa = " << Ipv6Address::MakeIpv4MappedAddress (
Ipv4Address (sa.c_str ()))
176 <<
", da = " << Ipv6Address::MakeIpv4MappedAddress (
Ipv4Address (da.c_str ()));
180 oss <<
", sa = " << sa
183 oss <<
", sp = " << sp
185 <<
", tos = 0x" << std::hex << (int) tos
186 <<
" --> tftId = " << tftId;
208 m_useIpv6 ? Ipv6L3Protocol::PROT_NUMBER : Ipv4L3Protocol::PROT_NUMBER);
242 for (
bool useIpv6: {
false,
true})
256 pf1_1_1.remoteIpv6Prefix =
Ipv6Prefix (96 + 8);
257 pf1_1_1.localIpv6Address.Set (
"0::ffff:0200:0000");
258 pf1_1_1.localIpv6Prefix =
Ipv6Prefix (96 + 8);
262 pf1_1_1.remoteAddress.Set (
"1.0.0.0");
263 pf1_1_1.remoteMask.Set (0xff000000);
264 pf1_1_1.localAddress.Set (
"2.0.0.0");
265 pf1_1_1.localMask.Set (0xff000000);
267 tft1_1->Add (pf1_1_1);
284 tft1_1->Add (pf1_1_2);
292 pf1_2_1.remotePortEnd = 1035;
293 tft1_2->
Add (pf1_2_1);
298 tft1_2->
Add (pf1_2_2);
303 tft1_2->
Add (pf1_2_3);
308 tft1_2->
Add (pf1_2_4);
349 c2->
Add (EpcTft::Default (), 1);
384 c3->
Add (EpcTft::Default (), 1);
422 tft4_1->Add (pf1_2_3);
425 tft4_2->
Add (pf1_2_4);
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.
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host.
Direction
Indicates the direction of the traffic that is to be classified.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
EpcTftClassifierTestSuite()
Ipv6Header m_ipv6Header
the IPv6 header
static EpcTftClassifierTestSuite g_lteTftClassifierTestSuite
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Test case to check the functionality of the Tft Classifier.
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint8_t m_tftId
the TFT ID
uint16_t localPortEnd
end of the port number range of the UE
Ptr< EpcTftClassifier > m_c
the EPC TFT classifier
bool m_useIpv6
use IPv4 or IPv6 header/addresses
Epc Tft Classifier Test Suite.
Ipv6Address localIpv6Address
IPv6 address of the UE.
UdpHeader m_udpHeader
the UDP header
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#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.
Ipv4Mask localMask
IPv4 address mask of the UE.
EpcTft::Direction m_d
the EPC TFT direction
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
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.
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
void Set(char const *address)
Sets an Ipv6Address by parsing the input C-string.
Ipv4Address remoteAddress
IPv4 address of the remote host.
uint16_t remotePortEnd
end of the port number range of the remote host
Ipv4Header m_ipHeader
the IPv4 header
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv4Address localAddress
IPv4 address of the UE.
void Set(uint32_t mask)
input mask is in host order.
Ipv6Address remoteIpv6Address
IPv6 address of the remote host.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Set(uint32_t address)
input address is in host order.
Ipv4 addresses are stored in host order in this class.
virtual ~EpcTftClassifierTestCase()
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Describes an IPv6 prefix.
TcpHeader m_tcpHeader
the TCP header
void AddHeader(const Header &header)
Add header to this packet.
uint16_t remotePortStart
start of the port number range of the remote host
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
uint16_t localPortStart
start of the port number range of the UE