LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 Magister Solutions | 3 * Copyright (c) 2013 Magister Solutions |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 Simulator::Destroy (); | 217 Simulator::Destroy (); |
218 | 218 |
219 } // end of void LteHandoverDelayTestCase::DoRun () | 219 } // end of void LteHandoverDelayTestCase::DoRun () |
220 | 220 |
221 | 221 |
222 void | 222 void |
223 LteHandoverDelayTestCase::UeHandoverStartCallback (std::string context, | 223 LteHandoverDelayTestCase::UeHandoverStartCallback (std::string context, |
224 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId) | 224 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId) |
225 { | 225 { |
226 NS_LOG_FUNCTION (this << context); | 226 NS_LOG_FUNCTION (this << context); |
227 NS_UNUSED(imsi); | 227 NS_UNUSED (imsi); |
228 NS_UNUSED(cellid); | 228 NS_UNUSED (cellid); |
229 NS_UNUSED(rnti); | 229 NS_UNUSED (rnti); |
230 NS_UNUSED(targetCellId); | 230 NS_UNUSED (targetCellId); |
231 m_ueHandoverStart = Simulator::Now (); | 231 m_ueHandoverStart = Simulator::Now (); |
232 } | 232 } |
233 | 233 |
234 void | 234 void |
235 LteHandoverDelayTestCase::UeHandoverEndOkCallback (std::string context, | 235 LteHandoverDelayTestCase::UeHandoverEndOkCallback (std::string context, |
236 uint64_t imsi, uint16_t cellid, uint16_t rnti) | 236 uint64_t imsi, uint16_t cellid, uint16_t rnti) |
237 { | 237 { |
238 NS_LOG_FUNCTION (this << context); | 238 NS_LOG_FUNCTION (this << context); |
239 NS_UNUSED(imsi); | 239 NS_UNUSED (imsi); |
240 NS_UNUSED(cellid); | 240 NS_UNUSED (cellid); |
241 NS_UNUSED(rnti); | 241 NS_UNUSED (rnti); |
242 NS_ASSERT (m_ueHandoverStart > Seconds (0)); | 242 NS_ASSERT (m_ueHandoverStart > Seconds (0)); |
243 Time delay = Simulator::Now () - m_ueHandoverStart; | 243 Time delay = Simulator::Now () - m_ueHandoverStart; |
244 NS_LOG_DEBUG (this << " UE delay = " << delay.GetSeconds ()); | 244 NS_LOG_DEBUG (this << " UE delay = " << delay.GetSeconds ()); |
245 NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (), | 245 NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (), |
246 "UE handover delay is higher than the allowed threshold " | 246 "UE handover delay is higher than the allowed threshold " |
247 << "(ideal RRC = " << m_useIdealRrc | 247 << "(ideal RRC = " << m_useIdealRrc |
248 << " handover time = " << m_handoverTime.GetSeconds () << ")"); | 248 << " handover time = " << m_handoverTime.GetSeconds () << ")"); |
249 } | 249 } |
250 | 250 |
251 | 251 |
252 void | 252 void |
253 LteHandoverDelayTestCase::EnbHandoverStartCallback (std::string context, | 253 LteHandoverDelayTestCase::EnbHandoverStartCallback (std::string context, |
254 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId) | 254 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId) |
255 { | 255 { |
256 NS_LOG_FUNCTION (this << context); | 256 NS_LOG_FUNCTION (this << context); |
257 NS_UNUSED(imsi); | 257 NS_UNUSED (imsi); |
258 NS_UNUSED(cellid); | 258 NS_UNUSED (cellid); |
259 NS_UNUSED(rnti); | 259 NS_UNUSED (rnti); |
260 NS_UNUSED(targetCellId); | 260 NS_UNUSED (targetCellId); |
261 m_enbHandoverStart = Simulator::Now (); | 261 m_enbHandoverStart = Simulator::Now (); |
262 } | 262 } |
263 | 263 |
264 void | 264 void |
265 LteHandoverDelayTestCase::EnbHandoverEndOkCallback (std::string context, | 265 LteHandoverDelayTestCase::EnbHandoverEndOkCallback (std::string context, |
266 uint64_t imsi, uint16_t cellid, uint16_t rnti) | 266 uint64_t imsi, uint16_t cellid, uint16_t rnti) |
267 { | 267 { |
268 NS_LOG_FUNCTION (this << context); | 268 NS_LOG_FUNCTION (this << context); |
269 NS_UNUSED(imsi); | 269 NS_UNUSED (imsi); |
270 NS_UNUSED(cellid); | 270 NS_UNUSED (cellid); |
271 NS_UNUSED(rnti); | 271 NS_UNUSED (rnti); |
272 NS_ASSERT (m_enbHandoverStart > Seconds (0)); | 272 NS_ASSERT (m_enbHandoverStart > Seconds (0)); |
273 Time delay = Simulator::Now () - m_enbHandoverStart; | 273 Time delay = Simulator::Now () - m_enbHandoverStart; |
274 NS_LOG_DEBUG (this << " eNodeB delay = " << delay.GetSeconds ()); | 274 NS_LOG_DEBUG (this << " eNodeB delay = " << delay.GetSeconds ()); |
275 NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (), | 275 NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (), |
276 "eNodeB handover delay is higher than the allowed threshold " | 276 "eNodeB handover delay is higher than the allowed threshold " |
277 << "(ideal RRC = " << m_useIdealRrc | 277 << "(ideal RRC = " << m_useIdealRrc |
278 << " handover time = " << m_handoverTime.GetSeconds () << ")"); | 278 << " handover time = " << m_handoverTime.GetSeconds () << ")"); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 | 282 |
283 /** | 283 /** |
284 * \ingroup lte-test | 284 * \ingroup lte-test |
285 * \ingroup tests | 285 * \ingroup tests |
286 * | 286 * |
287 * \brief Lte Handover Delay Test Suite | 287 * \brief Lte Handover Delay Test Suite |
288 */ | 288 */ |
289 | 289 |
290 static class LteHandoverDelayTestSuite : public TestSuite | 290 static class LteHandoverDelayTestSuite : public TestSuite |
291 { | 291 { |
292 public: | 292 public: |
293 LteHandoverDelayTestSuite () | 293 LteHandoverDelayTestSuite () |
294 : TestSuite ("lte-handover-delay", TestSuite::SYSTEM) | 294 : TestSuite ("lte-handover-delay", TestSuite::SYSTEM) |
295 { | 295 { |
296 #if 0 | 296 //LogComponentEnable ("LteHandoverDelayTest", LOG_PREFIX_TIME); |
297 LogComponentEnable ("LteHandoverDelayTest", LOG_PREFIX_TIME); | 297 //LogComponentEnable ("LteHandoverDelayTest", LOG_DEBUG); |
298 LogComponentEnable ("LteHandoverDelayTest", LOG_DEBUG); | 298 //LogComponentEnable ("LteHandoverDelayTest", LOG_INFO); |
299 LogComponentEnable ("LteHandoverDelayTest", LOG_INFO); | |
300 #endif | |
301 | 299 |
302 // HANDOVER DELAY TEST CASES WITH IDEAL RRC (THRESHOLD = 0.005 sec) | 300 // HANDOVER DELAY TEST CASES WITH IDEAL RRC (THRESHOLD = 0.005 sec) |
303 | 301 |
304 for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110); | 302 for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110); |
305 handoverTime += Seconds (0.001)) | 303 handoverTime += Seconds (0.001)) |
306 { | 304 { |
307 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDurat
ion | 305 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDurat
ion |
308 AddTestCase ( | 306 AddTestCase ( |
309 new LteHandoverDelayTestCase (1, true, handoverTime, Seconds (0.005)
, | 307 new LteHandoverDelayTestCase (1, true, handoverTime, Seconds (0.005)
, |
310 Seconds (0.200)), TestCase::QUICK); | 308 Seconds (0.200)), TestCase::QUICK); |
311 } | 309 } |
312 | 310 |
313 // HANDOVER DELAY TEST CASES WITH REAL RRC (THRESHOLD = 0.020 sec) | 311 // HANDOVER DELAY TEST CASES WITH REAL RRC (THRESHOLD = 0.020 sec) |
314 | 312 |
315 for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110); | 313 for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110); |
316 handoverTime += Seconds (0.001)) | 314 handoverTime += Seconds (0.001)) |
317 { | 315 { |
318 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDurat
ion | 316 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDurat
ion |
319 AddTestCase ( | 317 AddTestCase ( |
320 new LteHandoverDelayTestCase (1, false, handoverTime, Seconds (0.020
), | 318 new LteHandoverDelayTestCase (1, false, handoverTime, Seconds (0.020
), |
321 Seconds (0.200)), TestCase::QUICK); | 319 Seconds (0.200)), TestCase::QUICK); |
322 } | 320 } |
323 } | 321 } |
324 } g_lteHandoverDelayTestSuite; ///< the test suite | 322 } g_lteHandoverDelayTestSuite; ///< the test suite |
LEFT | RIGHT |