A Discrete-Event Network Simulator
API
test-epc-tft-classifier.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011-2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Nicola Baldo <nbaldo@cttc.es>
19  * Manuel Requena <manuel.requena@cttc.es>
20  */
21 
22 #include "ns3/test.h"
23 #include "ns3/log.h"
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"
33 
34 #include "ns3/epc-tft-classifier.h"
35 
36 #include <iomanip>
37 
38 using namespace ns3;
39 
40 NS_LOG_COMPONENT_DEFINE ("TestEpcTftClassifier");
41 
52 {
53 public:
69  std::string sa,
70  std::string da,
71  uint16_t sp,
72  uint16_t dp,
73  uint8_t tos,
74  uint32_t tftId,
75  bool useIpv6);
76 
77  virtual ~EpcTftClassifierTestCase ();
78 
79 private:
80 
83  uint8_t m_tftId;
84  bool m_useIpv6;
89 
103  static std::string BuildNameString (Ptr<EpcTftClassifier> c,
105  std::string sa,
106  std::string da,
107  uint16_t sp,
108  uint16_t dp,
109  uint8_t tos,
110  uint32_t tftId,
111  bool useIpv6);
112 
113  virtual void DoRun (void);
114 };
115 
116 
119  std::string sa,
120  std::string da,
121  uint16_t sp,
122  uint16_t dp,
123  uint8_t tos,
124  uint32_t tftId,
125  bool useIpv6)
126  : TestCase (BuildNameString (c, d, sa, da, sp, dp, tos, tftId, useIpv6)),
127  m_c (c),
128  m_d (d),
129  m_tftId (tftId),
130  m_useIpv6 (useIpv6)
131 {
132  NS_LOG_FUNCTION (this << c << d << sa << da << sp << dp << tos << tftId << useIpv6);
133 
134  if (m_useIpv6)
135  {
136  m_ipv6Header.SetSource (Ipv6Address::MakeIpv4MappedAddress (Ipv4Address (sa.c_str ())));
137  m_ipv6Header.SetDestination (Ipv6Address::MakeIpv4MappedAddress (Ipv4Address (da.c_str ())));
139  m_ipv6Header.SetPayloadLength (8); // Full UDP header
140  m_ipv6Header.SetNextHeader (UdpL4Protocol::PROT_NUMBER);
141  }
142  else
143  {
144  m_ipHeader.SetSource (Ipv4Address (sa.c_str ()));
145  m_ipHeader.SetDestination (Ipv4Address (da.c_str ()));
146  m_ipHeader.SetTos (tos);
147  m_ipHeader.SetPayloadSize (8); // Full UDP header
148  m_ipHeader.SetProtocol (UdpL4Protocol::PROT_NUMBER);
149  }
150 
153 }
154 
156 {
157 }
158 
159 std::string
162  std::string sa,
163  std::string da,
164  uint16_t sp,
165  uint16_t dp,
166  uint8_t tos,
167  uint32_t tftId,
168  bool useIpv6)
169 {
170  std::ostringstream oss;
171  oss << c
172  << " d = " << d;
173  if (useIpv6)
174  {
175  oss << ", sa = " << Ipv6Address::MakeIpv4MappedAddress (Ipv4Address (sa.c_str ()))
176  << ", da = " << Ipv6Address::MakeIpv4MappedAddress (Ipv4Address (da.c_str ()));
177  }
178  else
179  {
180  oss << ", sa = " << sa
181  << ", da = " << da;
182  }
183  oss << ", sp = " << sp
184  << ", dp = " << dp
185  << ", tos = 0x" << std::hex << (int) tos
186  << " --> tftId = " << tftId;
187  return oss.str ();
188 }
189 
190 
191 void
193 {
195 
196  Ptr<Packet> udpPacket = Create<Packet> ();
197  udpPacket->AddHeader (m_udpHeader);
198  if (m_useIpv6)
199  {
200  udpPacket->AddHeader (m_ipv6Header);
201  }
202  else
203  {
204  udpPacket->AddHeader (m_ipHeader);
205  }
206  NS_LOG_LOGIC (this << *udpPacket);
207  uint32_t obtainedTftId = m_c->Classify (udpPacket, m_d,
208  m_useIpv6 ? Ipv6L3Protocol::PROT_NUMBER : Ipv4L3Protocol::PROT_NUMBER);
209  NS_TEST_ASSERT_MSG_EQ (obtainedTftId, (uint16_t) m_tftId, "bad classification of UDP packet");
210 }
211 
212 
213 
214 
222 {
223 public:
225 };
226 
228 
230  : TestSuite ("eps-tft-classifier", UNIT)
231 {
232  NS_LOG_FUNCTION (this);
233 
234 
236  // Same testcases using IPv4 and IPv6 addresses
237  // IPv6 addresses are IPv4 mapped addresses, i.e. 1.2.3.4 -> 0::ffff:1.2.3.4
238  // Currently, we use the format '0::ffff:0102:0304' because
239  // the format '0::ffff:1.2.3.4' is not supported by the Ipv6Address class
241 
242  for (bool useIpv6: {false, true})
243  {
245  // check some TFT matches
247 
248  Ptr<EpcTftClassifier> c1 = Create<EpcTftClassifier> ();
249 
250  Ptr<EpcTft> tft1_1 = Create<EpcTft> ();
251 
252  EpcTft::PacketFilter pf1_1_1;
253  if (useIpv6)
254  {
255  pf1_1_1.remoteIpv6Address.Set ("0::ffff:0100:0000");
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);
259  }
260  else
261  {
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);
266  }
267  tft1_1->Add (pf1_1_1);
268 
269  EpcTft::PacketFilter pf1_1_2;
270  if (useIpv6)
271  {
272  pf1_1_2.remoteIpv6Address.Set ("0::ffff:0303:0300");
273  pf1_1_2.remoteIpv6Prefix = Ipv6Prefix (96 + 24);
274  pf1_1_2.localIpv6Address.Set ("0::ffff:0404:0400");
275  pf1_1_2.localIpv6Prefix = Ipv6Prefix (96 + 24);
276  }
277  else
278  {
279  pf1_1_2.remoteAddress.Set ("3.3.3.0");
280  pf1_1_2.remoteMask.Set (0xffffff00);
281  pf1_1_2.localAddress.Set ("4.4.4.0");
282  pf1_1_2.localMask.Set (0xffffff00);
283  }
284  tft1_1->Add (pf1_1_2);
285 
286  c1->Add (tft1_1, 1);
287 
288  Ptr<EpcTft> tft1_2 = Create<EpcTft> ();
289 
290  EpcTft::PacketFilter pf1_2_1;
291  pf1_2_1.remotePortStart = 1024;
292  pf1_2_1.remotePortEnd = 1035;
293  tft1_2->Add (pf1_2_1);
294 
295  EpcTft::PacketFilter pf1_2_2;
296  pf1_2_2.localPortStart = 3456;
297  pf1_2_2.localPortEnd = 3489;
298  tft1_2->Add (pf1_2_2);
299 
300  EpcTft::PacketFilter pf1_2_3;
301  pf1_2_3.localPortStart = 7895;
302  pf1_2_3.localPortEnd = 7895;
303  tft1_2->Add (pf1_2_3);
304 
305  EpcTft::PacketFilter pf1_2_4;
306  pf1_2_4.remotePortStart = 5897;
307  pf1_2_4.remotePortEnd = 5897;
308  tft1_2->Add (pf1_2_4);
309 
310  c1->Add (tft1_2, 2);
311 
312  // --------------------------------classifier----direction-------src_addr---dst_addr--src_port--dst_port--ToS--TFT_id
313 
314  // test IP addresses
315  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "2.2.3.4", "1.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
316  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "2.2.3.4", "1.0.0.0", 2, 123, 5, 1, useIpv6), TestCase::QUICK);
317  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "6.2.3.4", "1.1.1.1", 4, 1234, 0, 0, useIpv6), TestCase::QUICK);
318  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "3.3.3.4", "4.4.4.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
319  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "3.3.4.4", "4.4.4.1", 4, 1234, 0, 0, useIpv6), TestCase::QUICK);
320  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "3.3.3.4", "4.4.2.1", 4, 1234, 0, 0, useIpv6), TestCase::QUICK);
321 
322  // test remote port
323  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 2, useIpv6), TestCase::QUICK);
324  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 2, useIpv6), TestCase::QUICK);
325  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 2, useIpv6), TestCase::QUICK);
326  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1234, 0, 0, useIpv6), TestCase::QUICK);
327  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 0, useIpv6), TestCase::QUICK);
328  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 0, useIpv6), TestCase::QUICK);
329  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 0, useIpv6), TestCase::QUICK);
330 
331  // test local port
332  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3456, 0, 0, useIpv6), TestCase::QUICK);
333  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3457, 0, 0, useIpv6), TestCase::QUICK);
334  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3489, 0, 0, useIpv6), TestCase::QUICK);
335  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 3456, 6, 0, 2, useIpv6), TestCase::QUICK);
336  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 3461, 3461, 0, 2, useIpv6), TestCase::QUICK);
337  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 3489, 0, 2, useIpv6), TestCase::QUICK);
338  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 7895, 0, 2, useIpv6), TestCase::QUICK);
339  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 7895, 10, 0, 2, useIpv6), TestCase::QUICK);
340  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 9, 5897, 0, 2, useIpv6), TestCase::QUICK);
341  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 5897, 10, 0, 2, useIpv6), TestCase::QUICK);
342 
343 
345  // check default TFT
347 
348  Ptr<EpcTftClassifier> c2 = Create<EpcTftClassifier> ();
349  c2->Add (EpcTft::Default (), 1);
350 
351  // --------------------------------classifier---direction--------src_addr---dst_addr--src_port--dst_port--ToS--TFT id
352 
353  // test IP addresses
354  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "2.2.3.4", "1.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
355  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "2.2.3.4", "1.0.0.0", 2, 123, 5, 1, useIpv6), TestCase::QUICK);
356  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "6.2.3.4", "1.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
357  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "3.3.3.4", "4.4.4.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
358  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "3.3.4.4", "4.4.4.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
359  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "3.3.3.4", "4.4.2.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
360 
361  // test remote port
362  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 1, useIpv6), TestCase::QUICK);
363  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 1, useIpv6), TestCase::QUICK);
364  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 1, useIpv6), TestCase::QUICK);
365  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
366  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 1, useIpv6), TestCase::QUICK);
367  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 1, useIpv6), TestCase::QUICK);
368  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 1, useIpv6), TestCase::QUICK);
369 
370  // test local port
371  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3456, 0, 1, useIpv6), TestCase::QUICK);
372  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3457, 0, 1, useIpv6), TestCase::QUICK);
373  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3489, 0, 1, useIpv6), TestCase::QUICK);
374  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 3456, 6, 0, 1, useIpv6), TestCase::QUICK);
375  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 3461, 3461, 0, 1, useIpv6), TestCase::QUICK);
376  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 3489, 0, 1, useIpv6), TestCase::QUICK);
377 
378 
380  // check default TFT plus dedicated ones
382 
383  Ptr<EpcTftClassifier> c3 = Create<EpcTftClassifier> ();
384  c3->Add (EpcTft::Default (), 1);
385  c3->Add (tft1_1, 2);
386  c3->Add (tft1_2, 3);
387 
388  // --------------------------------classifier---direction--------src_addr---dst_addr---src_port--dst_port--ToS--TFT_id
389 
390  // test IP addresses
391  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "2.2.3.4", "1.1.1.1", 4, 1234, 0, 2, useIpv6), TestCase::QUICK);
392  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "2.2.3.4", "1.0.0.0", 2, 123, 5, 2, useIpv6), TestCase::QUICK);
393  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "6.2.3.4", "1.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
394  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "3.3.3.4", "4.4.4.1", 4, 1234, 0, 2, useIpv6), TestCase::QUICK);
395  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "3.3.4.4", "4.4.4.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
396  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "3.3.3.4", "4.4.2.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
397 
398  // test remote port
399  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 3, useIpv6), TestCase::QUICK);
400  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 3, useIpv6), TestCase::QUICK);
401  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 3, useIpv6), TestCase::QUICK);
402  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 1234, 0, 1, useIpv6), TestCase::QUICK);
403  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1024, 0, 1, useIpv6), TestCase::QUICK);
404  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1025, 0, 1, useIpv6), TestCase::QUICK);
405  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 4, 1035, 0, 1, useIpv6), TestCase::QUICK);
406 
407  // test local port
408  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3456, 0, 1, useIpv6), TestCase::QUICK);
409  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3457, 0, 1, useIpv6), TestCase::QUICK);
410  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 4, 3489, 0, 1, useIpv6), TestCase::QUICK);
411  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 3456, 6, 0, 3, useIpv6), TestCase::QUICK);
412  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 3461, 3461, 0, 3, useIpv6), TestCase::QUICK);
413  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 3489, 0, 3, useIpv6), TestCase::QUICK);
414 
415 
417  // check two TFTs with different ports
419 
420  Ptr<EpcTftClassifier> c4 = Create<EpcTftClassifier> ();
421  Ptr<EpcTft> tft4_1 = Create<EpcTft> ();
422  tft4_1->Add (pf1_2_3);
423  c4->Add (tft4_1, 1);
424  Ptr<EpcTft> tft4_2 = Create<EpcTft> ();
425  tft4_2->Add (pf1_2_4);
426  c4->Add (tft4_2, 2);
427  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 3489, 0, 0, useIpv6), TestCase::QUICK);
428  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 9, 7895, 0, 1, useIpv6), TestCase::QUICK);
429  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 7895, 10, 0, 1, useIpv6), TestCase::QUICK);
430  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, "9.1.1.1", "8.1.1.1", 9, 5897, 0, 2, useIpv6), TestCase::QUICK);
431  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, "9.1.1.1", "8.1.1.1", 5897, 10, 0, 2, useIpv6), TestCase::QUICK);
432  }
433 }
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
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
UdpHeader m_udpHeader
the UDP header
EpcTft::Direction m_d
the EPC TFT direction
Ipv6Header m_ipv6Header
the IPv6 header
Epc Tft Classifier Test Suite.
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction, uint16_t protocolNumber)
classify an IP packet
void Add(Ptr< EpcTft > tft, uint32_t id)
add a TFT to the Classifier
Direction
Indicates the direction of the traffic that is to be classified.
Definition: epc-tft.h:57
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
void Set(uint32_t address)
input address is in host order.
Packet header for IPv4.
Definition: ipv4-header.h:34
void SetDestination(Ipv4Address destination)
Definition: ipv4-header.cc:298
void SetPayloadSize(uint16_t size)
Definition: ipv4-header.cc:56
void SetProtocol(uint8_t num)
Definition: ipv4-header.cc:278
void SetTos(uint8_t tos)
Definition: ipv4-header.cc:82
void SetSource(Ipv4Address source)
Definition: ipv4-header.cc:285
void Set(uint32_t mask)
input mask is in host order.
void Set(char const *address)
Sets an Ipv6Address by parsing the input C-string.
Packet header for IPv6.
Definition: ipv6-header.h:36
void SetDestination(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:115
void SetSource(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:95
void SetPayloadLength(uint16_t len)
Set the "Payload length" field.
Definition: ipv6-header.cc:65
void SetTrafficClass(uint8_t traffic)
Set the "Traffic class" field.
Definition: ipv6-header.cc:45
void SetNextHeader(uint8_t next)
Set the "Next header" field.
Definition: ipv6-header.cc:75
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
static void Enable(void)
Enable the packet metadata.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:45
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
Packet header for UDP packets.
Definition: udp-header.h:40
void SetSourcePort(uint16_t port)
Definition: udp-header.cc:60
void SetDestinationPort(uint16_t port)
Definition: udp-header.cc:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
Definition: test.h:141
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:75
Ipv4Address localAddress
IPv4 address of the UE.
Definition: epc-tft.h:129
Ipv6Prefix localIpv6Prefix
IPv6 address prefix of the UE.
Definition: epc-tft.h:135
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:140
Ipv4Mask localMask
IPv4 address mask of the UE.
Definition: epc-tft.h:130
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
Ipv6Address remoteIpv6Address
IPv6 address of the remote host
Definition: epc-tft.h:132
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Definition: epc-tft.h:128
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
Ipv6Address localIpv6Address
IPv6 address of the UE.
Definition: epc-tft.h:134
Ipv4Address remoteAddress
IPv4 address of the remote host
Definition: epc-tft.h:127
Ipv6Prefix remoteIpv6Prefix
IPv6 address prefix of the remote host
Definition: epc-tft.h:133
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
static EpcTftClassifierTestSuite g_lteTftClassifierTestSuite