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);
120 
121  m_ipHeader.SetSource (sa);
123  m_ipHeader.SetTos (tos);
124 
127 }
128 
130 {
131 }
132 
133 std::string
136  Ipv4Address sa,
137  Ipv4Address da,
138  uint16_t sp,
139  uint16_t dp,
140  uint8_t tos,
141  uint32_t tftId)
142 {
143  std::ostringstream oss;
144  oss << c
145  << " d = " << d
146  << ", sa = " << sa
147  << ", da = " << da
148  << ", sp = " << sp
149  << ", dp = " << dp
150  << ", tos = 0x" << std::hex << (int) tos
151  << " --> tftId = " << tftId;
152  return oss.str ();
153 }
154 
155 void
157 {
159 
160  Ptr<Packet> udpPacket = Create<Packet> ();
161  m_ipHeader.SetProtocol (UdpL4Protocol::PROT_NUMBER);
162  udpPacket->AddHeader (m_udpHeader);
163  udpPacket->AddHeader (m_ipHeader);
164  NS_LOG_LOGIC (this << *udpPacket);
165  uint32_t obtainedTftId = m_c ->Classify (udpPacket, m_d);
166  NS_TEST_ASSERT_MSG_EQ (obtainedTftId, m_tftId, "bad classification of UDP packet");
167 }
168 
169 
170 
171 
179 {
180 public:
182 };
183 
185 
187  : TestSuite ("eps-tft-classifier", UNIT)
188 {
189  NS_LOG_FUNCTION (this);
190 
191 
193  // check some TFT matches
195 
196 
197  Ptr<EpcTftClassifier> c1 = Create<EpcTftClassifier> ();
198 
199 
200  Ptr<EpcTft> tft1_1 = Create<EpcTft> ();
201 
202  EpcTft::PacketFilter pf1_1_1;
203  pf1_1_1.remoteAddress.Set ("1.0.0.0");
204  pf1_1_1.localAddress.Set ("2.0.0.0");
205  pf1_1_1.remoteMask.Set (0xFF000000);
206  pf1_1_1.localMask.Set (0xFF000000);
207  tft1_1->Add (pf1_1_1);
208 
209  EpcTft::PacketFilter pf1_1_2;
210  pf1_1_2.remoteAddress.Set ("3.3.3.0");
211  pf1_1_2.localAddress.Set ("4.4.4.0");
212  pf1_1_2.remoteMask.Set (0xFFFFFF00);
213  pf1_1_2.localMask.Set (0xFFFFFF00);
214  tft1_1->Add (pf1_1_2);
215 
216  c1->Add (tft1_1, 1);
217 
218 
219 
220  Ptr<EpcTft> tft1_2 = Create<EpcTft> ();
221 
222  EpcTft::PacketFilter pf1_2_1;
223  pf1_2_1.remotePortStart = 1024;
224  pf1_2_1.remotePortEnd = 1035;
225  tft1_2->Add (pf1_2_1);
226 
227  EpcTft::PacketFilter pf1_2_2;
228  pf1_2_2.localPortStart = 3456;
229  pf1_2_2.localPortEnd = 3489;
230  tft1_2->Add (pf1_2_2);
231 
232 
233  EpcTft::PacketFilter pf1_2_3;
234  pf1_2_3.localPortStart = 7895;
235  pf1_2_3.localPortEnd = 7895;
236  tft1_2->Add (pf1_2_3);
237 
238 
239  EpcTft::PacketFilter pf1_2_4;
240  pf1_2_4.remotePortStart = 5897;
241  pf1_2_4.remotePortEnd = 5897;
242  tft1_2->Add (pf1_2_4);
243 
244 
245  c1->Add (tft1_2, 2);
246 
247  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
248 
249  // test IP addresses
250  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
251  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 1), TestCase::QUICK);
252  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 0), TestCase::QUICK);
253  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
254  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 0), TestCase::QUICK);
255  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 0), TestCase::QUICK);
256 
257  // test remote port
258  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 2), TestCase::QUICK);
259  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 2), TestCase::QUICK);
260  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 2), TestCase::QUICK);
261  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 0), TestCase::QUICK);
262  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 0), TestCase::QUICK);
263  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 0), TestCase::QUICK);
264  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 0), TestCase::QUICK);
265 
266  // test local port
267  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 0), TestCase::QUICK);
268  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 0), TestCase::QUICK);
269  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 0), TestCase::QUICK);
270  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 2), TestCase::QUICK);
271  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 2), TestCase::QUICK);
272  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 2), TestCase::QUICK);
273  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 7895, 0, 2), TestCase::QUICK);
274  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 7895, 10, 0, 2), TestCase::QUICK);
275  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 5897, 0, 2), TestCase::QUICK);
276  AddTestCase (new EpcTftClassifierTestCase (c1, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 5897, 10, 0, 2), TestCase::QUICK);
277 
278 
280  // check default TFT
282 
283  Ptr<EpcTftClassifier> c2 = Create<EpcTftClassifier> ();
284  c2->Add (EpcTft::Default (), 1);
285 
286  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
287 
288  // test IP addresses
289  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
290  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 1), TestCase::QUICK);
291  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
292  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
293  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
294  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 1), TestCase::QUICK);
295 
296  // test remote port
297  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
298  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
299  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
300  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
301  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
302  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
303  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
304 
305  // test local port
306  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 1), TestCase::QUICK);
307  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 1), TestCase::QUICK);
308  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 1), TestCase::QUICK);
309  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 1), TestCase::QUICK);
310  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 1), TestCase::QUICK);
311  AddTestCase (new EpcTftClassifierTestCase (c2, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 1), TestCase::QUICK);
312 
313 
314 
316  // check default TFT plus dedicated ones
318 
319  Ptr<EpcTftClassifier> c3 = Create<EpcTftClassifier> ();
320  c3->Add (EpcTft::Default (), 1);
321  c3->Add (tft1_1, 2);
322  c3->Add (tft1_2, 3);
323 
324  // ------------------------------------classifier---direction--------------src address---------------dst address---src port--dst port--ToS--TFT id
325 
326  // test IP addresses
327  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 2), TestCase::QUICK);
328  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("2.2.3.4"), Ipv4Address ("1.0.0.0"), 2, 123, 5, 2), TestCase::QUICK);
329  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("6.2.3.4"), Ipv4Address ("1.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
330  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 2), TestCase::QUICK);
331  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("3.3.4.4"), Ipv4Address ("4.4.4.1"), 4, 1234, 0, 1), TestCase::QUICK);
332  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("3.3.3.4"), Ipv4Address ("4.4.2.1"), 4, 1234, 0, 1), TestCase::QUICK);
333 
334  // test remote port
335  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 3), TestCase::QUICK);
336  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 3), TestCase::QUICK);
337  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 3), TestCase::QUICK);
338  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1234, 0, 1), TestCase::QUICK);
339  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1024, 0, 1), TestCase::QUICK);
340  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1025, 0, 1), TestCase::QUICK);
341  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 1035, 0, 1), TestCase::QUICK);
342 
343  // test local port
344  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3456, 0, 1), TestCase::QUICK);
345  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3457, 0, 1), TestCase::QUICK);
346  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 4, 3489, 0, 1), TestCase::QUICK);
347  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3456, 6, 0, 3), TestCase::QUICK);
348  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 3461, 3461, 0, 3), TestCase::QUICK);
349  AddTestCase (new EpcTftClassifierTestCase (c3, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 3), TestCase::QUICK);
350 
351 
352 
354  // check two TFTs with different ports
356 
357  Ptr<EpcTftClassifier> c4 = Create<EpcTftClassifier> ();
358  Ptr<EpcTft> tft4_1 = Create<EpcTft> ();
359  tft4_1->Add (pf1_2_3);
360  c4->Add (tft4_1, 1);
361  Ptr<EpcTft> tft4_2 = Create<EpcTft> ();
362  tft4_2->Add (pf1_2_4);
363  c4->Add (tft4_2, 2);
364  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 3489, 0, 0), TestCase::QUICK);
365  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 7895, 0, 1), TestCase::QUICK);
366  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 7895, 10, 0, 1), TestCase::QUICK);
367  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::UPLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 9, 5897, 0, 2), TestCase::QUICK);
368  AddTestCase (new EpcTftClassifierTestCase (c4, EpcTft::DOWNLINK, Ipv4Address ("9.1.1.1"), Ipv4Address ("8.1.1.1"), 5897, 10, 0, 2), TestCase::QUICK);
369 
370 }
void SetSource(Ipv4Address source)
Definition: ipv4-header.cc:285
Direction
Indicates the direction of the traffic that is to be classified.
Definition: epc-tft.h:56
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:171
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:201
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:115
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:110
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:107
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:113
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:109
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:108
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:112
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:73
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:114