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 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  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 
22 
23 #include "ns3/test.h"
24 #include "ns3/log.h"
25 #include "ns3/packet.h"
26 #include "ns3/ipv4-header.h"
27 #include "ns3/udp-header.h"
28 #include "ns3/tcp-header.h"
29 #include "ns3/udp-l4-protocol.h"
30 #include "ns3/tcp-l4-protocol.h"
31 
32 #include "ns3/epc-tft-classifier.h"
33 
34 #include <iomanip>
35 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE ("TestEpcTftClassifier");
39 
50 {
51 public:
66  Ipv4Address sa,
67  Ipv4Address da,
68  uint16_t sp,
69  uint16_t dp,
70  uint8_t tos,
71  uint32_t tftId);
72  virtual ~EpcTftClassifierTestCase ();
73 
74 private:
75 
78  uint8_t m_tftId;
82 
95  static std::string BuildNameString (Ptr<EpcTftClassifier> c,
97  Ipv4Address sa,
98  Ipv4Address da,
99  uint16_t sp,
100  uint16_t dp,
101  uint8_t tos,
102  uint32_t tftId);
103  virtual void DoRun (void);
104 };
105 
108  Ipv4Address sa,
109  Ipv4Address da,
110  uint16_t sp,
111  uint16_t dp,
112  uint8_t tos,
113  uint32_t tftId)
114  : TestCase (BuildNameString (c, d, sa, da, sp, dp, tos, tftId)),
115  m_c (c),
116  m_d (d),
117  m_tftId (tftId)
118 {
119  NS_LOG_FUNCTION (this << c << d << sa << da << sp << dp << tos << tftId);
120 
121  m_ipHeader.SetSource (sa);
123  m_ipHeader.SetTos (tos);
124  m_ipHeader.SetPayloadSize (8); // Full UDP header
125 
128 }
129 
131 {
132 }
133 
134 std::string
137  Ipv4Address sa,
138  Ipv4Address da,
139  uint16_t sp,
140  uint16_t dp,
141  uint8_t tos,
142  uint32_t tftId)
143 {
144  std::ostringstream oss;
145  oss << c
146  << " d = " << d
147  << ", sa = " << sa
148  << ", da = " << da
149  << ", sp = " << sp
150  << ", dp = " << dp
151  << ", tos = 0x" << std::hex << (int) tos
152  << " --> tftId = " << tftId;
153  return oss.str ();
154 }
155 
156 void
158 {
160 
161  Ptr<Packet> udpPacket = Create<Packet> ();
162  m_ipHeader.SetProtocol (UdpL4Protocol::PROT_NUMBER);
163  udpPacket->AddHeader (m_udpHeader);
164  udpPacket->AddHeader (m_ipHeader);
165  NS_LOG_LOGIC (this << *udpPacket);
166  uint32_t obtainedTftId = m_c ->Classify (udpPacket, m_d);
167  NS_TEST_ASSERT_MSG_EQ (obtainedTftId, (uint16_t) m_tftId, "bad classification of UDP packet");
168 }
169 
170 
171 
172 
180 {
181 public:
183 };
184 
186 
188  : TestSuite ("eps-tft-classifier", UNIT)
189 {
190  NS_LOG_FUNCTION (this);
191 
192 
194  // check some TFT matches
196 
197 
198  Ptr<EpcTftClassifier> c1 = Create<EpcTftClassifier> ();
199 
200 
201  Ptr<EpcTft> tft1_1 = Create<EpcTft> ();
202 
203  EpcTft::PacketFilter pf1_1_1;
204  pf1_1_1.remoteAddress.Set ("1.0.0.0");
205  pf1_1_1.localAddress.Set ("2.0.0.0");
206  pf1_1_1.remoteMask.Set (0xFF000000);
207  pf1_1_1.localMask.Set (0xFF000000);
208  tft1_1->Add (pf1_1_1);
209 
210  EpcTft::PacketFilter pf1_1_2;
211  pf1_1_2.remoteAddress.Set ("3.3.3.0");
212  pf1_1_2.localAddress.Set ("4.4.4.0");
213  pf1_1_2.remoteMask.Set (0xFFFFFF00);
214  pf1_1_2.localMask.Set (0xFFFFFF00);
215  tft1_1->Add (pf1_1_2);
216 
217  c1->Add (tft1_1, 1);
218 
219 
220 
221  Ptr<EpcTft> tft1_2 = Create<EpcTft> ();
222 
223  EpcTft::PacketFilter pf1_2_1;
224  pf1_2_1.remotePortStart = 1024;
225  pf1_2_1.remotePortEnd = 1035;
226  tft1_2->Add (pf1_2_1);
227 
228  EpcTft::PacketFilter pf1_2_2;
229  pf1_2_2.localPortStart = 3456;
230  pf1_2_2.localPortEnd = 3489;
231  tft1_2->Add (pf1_2_2);
232 
233 
234  EpcTft::PacketFilter pf1_2_3;
235  pf1_2_3.localPortStart = 7895;
236  pf1_2_3.localPortEnd = 7895;
237  tft1_2->Add (pf1_2_3);
238 
239 
240  EpcTft::PacketFilter pf1_2_4;
241  pf1_2_4.remotePortStart = 5897;
242  pf1_2_4.remotePortEnd = 5897;
243  tft1_2->Add (pf1_2_4);
244 
245 
246  c1->Add (tft1_2, 2);
247 
248  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
249 
250  // test IP addresses
251  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
252  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 1), TestCase::QUICK);
253  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 0), TestCase::QUICK);
254  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
255  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 0), TestCase::QUICK);
256  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 0), TestCase::QUICK);
257 
258  // test remote port
259  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 2), TestCase::QUICK);
260  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 2), TestCase::QUICK);
261  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 2), TestCase::QUICK);
262  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 0), TestCase::QUICK);
263  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 0), TestCase::QUICK);
264  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 0), TestCase::QUICK);
265  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 0), TestCase::QUICK);
266 
267  // test local port
268  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 0), TestCase::QUICK);
269  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 0), TestCase::QUICK);
270  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 0), TestCase::QUICK);
271  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 2), TestCase::QUICK);
272  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 2), TestCase::QUICK);
273  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 2), TestCase::QUICK);
274  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 7895, 0, 2), TestCase::QUICK);
275  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 7895, 10, 0, 2), TestCase::QUICK);
276  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 5897, 0, 2), TestCase::QUICK);
277  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 5897, 10, 0, 2), TestCase::QUICK);
278 
279 
281  // check default TFT
283 
284  Ptr<EpcTftClassifier> c2 = Create<EpcTftClassifier> ();
285  c2->Add (EpcTft::Default (), 1);
286 
287  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
288 
289  // test IP addresses
290  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
291  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 1), TestCase::QUICK);
292  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
293  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
294  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
295  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 1), TestCase::QUICK);
296 
297  // test remote port
298  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
299  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
300  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
301  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
302  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
303  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
304  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
305 
306  // test local port
307  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 1), TestCase::QUICK);
308  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 1), TestCase::QUICK);
309  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 1), TestCase::QUICK);
310  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 1), TestCase::QUICK);
311  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 1), TestCase::QUICK);
312  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 1), TestCase::QUICK);
313 
314 
315 
317  // check default TFT plus dedicated ones
319 
320  Ptr<EpcTftClassifier> c3 = Create<EpcTftClassifier> ();
321  c3->Add (EpcTft::Default (), 1);
322  c3->Add (tft1_1, 2);
323  c3->Add (tft1_2, 3);
324 
325  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
326 
327  // test IP addresses
328  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 2), TestCase::QUICK);
329  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 2), TestCase::QUICK);
330  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
331  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 2), TestCase::QUICK);
332  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
333  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 1), TestCase::QUICK);
334 
335  // test remote port
336  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 3), TestCase::QUICK);
337  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 3), TestCase::QUICK);
338  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 3), TestCase::QUICK);
339  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
340  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
341  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
342  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
343 
344  // test local port
345  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 1), TestCase::QUICK);
346  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 1), TestCase::QUICK);
347  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 1), TestCase::QUICK);
348  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 3), TestCase::QUICK);
349  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 3), TestCase::QUICK);
350  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 3), TestCase::QUICK);
351 
352 
353 
355  // check two TFTs with different ports
357 
358  Ptr<EpcTftClassifier> c4 = Create<EpcTftClassifier> ();
359  Ptr<EpcTft> tft4_1 = Create<EpcTft> ();
360  tft4_1->Add (pf1_2_3);
361  c4->Add (tft4_1, 1);
362  Ptr<EpcTft> tft4_2 = Create<EpcTft> ();
363  tft4_2->Add (pf1_2_4);
364  c4->Add (tft4_2, 2);
365  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 0), TestCase::QUICK);
366  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 7895, 0, 1), TestCase::QUICK);
367  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 7895, 10, 0, 1), TestCase::QUICK);
368  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 5897, 0, 2), TestCase::QUICK);
369  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 5897, 10, 0, 2), TestCase::QUICK);
370 
371 }
void SetSource(Ipv4Address source)
Definition: ipv4-header.cc:285
void SetPayloadSize(uint16_t size)
Definition: ipv4-header.cc:56
Direction
Indicates the direction of the traffic that is to be classified.
Definition: epc-tft.h:57
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:224
static EpcTftClassifierTestSuite g_lteTftClassifierTestSuite
void SetDestination(Ipv4Address destination)
Definition: ipv4-header.cc:298
#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
A suite of tests to run.
Definition: test.h:1342
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:202
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:137
void SetSourcePort(uint16_t port)
Definition: udp-header.cc:60
Ptr< EpcTftClassifier > m_c
the EPC TFT classifier
void SetProtocol(uint8_t num)
Definition: ipv4-header.cc:278
encapsulates test code
Definition: test.h:1155
Epc Tft Classifier Test Suite.
uint32_t Classify(Ptr< Packet > p, EpcTft::Direction direction)
classify an IP packet
UdpHeader m_udpHeader
the UDP header
Packet header for IPv4.
Definition: ipv4-header.h:33
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
#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:168
Ipv4Mask localMask
IPv4 address mask of the UE.
Definition: epc-tft.h:132
EpcTft::Direction m_d
the EPC TFT direction
EpcTftClassifierTestCase(Ptr< EpcTftClassifier > c, EpcTft::Direction d, Ipv4Address sa, Ipv4Address da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId)
Constructor.
Ipv4Address remoteAddress
IPv4 address of the remote host.
Definition: epc-tft.h:127
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:135
static void Enable(void)
Enable the packet metadata.
Ipv4Header m_ipHeader
the IPv4 header
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:44
Packet header for UDP packets.
Definition: udp-header.h:39
void SetTos(uint8_t tos)
Definition: ipv4-header.cc:82
Ipv4Address localAddress
IPv4 address of the UE.
Definition: epc-tft.h:130
void Set(uint32_t mask)
input mask is in host order.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
static std::string BuildNameString(Ptr< EpcTftClassifier > c, EpcTft::Direction d, Ipv4Address sa, Ipv4Address da, uint16_t sp, uint16_t dp, uint8_t tos, uint32_t tftId)
Build name string.
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.
Definition: ipv4-address.h:40
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
Definition: epc-tft.h:129
TcpHeader m_tcpHeader
the TCP header
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:134
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:74
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:136