Left: | ||
Right: |
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) 2014 ResiliNets, ITTC, University of Kansas | 3 * Copyright (c) 2014 ResiliNets, ITTC, University of Kansas |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 * | 60 * |
61 * \brief Codel Queue Disc Test Item | 61 * \brief Codel Queue Disc Test Item |
62 */ | 62 */ |
63 class CodelQueueDiscTestItem : public QueueDiscItem { | 63 class CodelQueueDiscTestItem : public QueueDiscItem { |
64 public: | 64 public: |
65 /** | 65 /** |
66 * Constructor | 66 * Constructor |
67 * | 67 * |
68 * \param p packet | 68 * \param p packet |
69 * \param addr address | 69 * \param addr address |
70 * \param protocol | |
Stefano Avallone
2017/12/29 22:56:39
Please remove this line:
* \param protocol
ammo6818-vandals.uidaho.edu
2017/12/31 05:15:03
changed as noted.
| |
71 */ | 70 */ |
72 CodelQueueDiscTestItem (Ptr<Packet> p, const Address & addr); | 71 CodelQueueDiscTestItem (Ptr<Packet> p, const Address & addr); |
73 virtual ~CodelQueueDiscTestItem (); | 72 virtual ~CodelQueueDiscTestItem (); |
74 virtual void AddHeader (void); | 73 virtual void AddHeader (void); |
75 virtual bool Mark(void); | 74 virtual bool Mark(void); |
76 | 75 |
77 private: | 76 private: |
78 CodelQueueDiscTestItem (); | 77 CodelQueueDiscTestItem (); |
79 /** | 78 /** |
80 * \brief Copy constructor | 79 * \brief Copy constructor |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc> (); | 445 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc> (); |
447 | 446 |
448 /* Spot check a few points of m_dropNext | 447 /* Spot check a few points of m_dropNext |
449 The integer approximations in Linux should be within | 448 The integer approximations in Linux should be within |
450 2% of the true floating point value obtained in ns-3 | 449 2% of the true floating point value obtained in ns-3 |
451 */ | 450 */ |
452 uint32_t dropNextTestVals [4] = {292299, 341128, 9804717, 55885007}; | 451 uint32_t dropNextTestVals [4] = {292299, 341128, 9804717, 55885007}; |
453 | 452 |
454 for (int i = 0; i < 4; ++i) | 453 for (int i = 0; i < 4; ++i) |
455 { | 454 { |
456 uint32_t ns3Result = queue->ControlLaw (dropNextTestVals[i]); | 455 uint32_t ns3Result = queue->ControlLaw(dropNextTestVals[i]); |
457 uint32_t upperBound = static_cast<uint32_t>(ns3Result + 0.02 * ns3Result); | 456 uint32_t linuxResult = _codel_control_law(queue, dropNextTestVals[i]); |
458 uint32_t lowerBound = static_cast<uint32_t>(ns3Result - 0.02 * ns3Result); | 457 NS_TEST_EXPECT_MSG_EQ((0.98 * ns3Result < linuxResult && linuxResult < 1.0 2 * ns3Result), true, |
Stefano Avallone
2017/12/29 22:56:39
I would do it this way:
uint32_t ns3Result
ammo6818-vandals.uidaho.edu
2017/12/31 05:15:03
changed as noted.
| |
459 uint32_t linuxResult = _codel_control_law (queue, dropNextTestVals[i]); | 458 "Linux result should stay within 2% of ns-3 result"); |
460 NS_TEST_EXPECT_MSG_EQ ((lowerBound < linuxResult || linuxResult < upperBou nd), true, | |
461 "Linux result should stay within 2% of ns-3 result" ); | |
462 } | 459 } |
463 } | 460 } |
464 | 461 |
465 /** | 462 /** |
466 * \ingroup traffic-control-test | 463 * \ingroup traffic-control-test |
467 * \ingroup tests | 464 * \ingroup tests |
468 * | 465 * |
469 * \brief Test 5: enqueue/dequeue with drops according to CoDel algorithm | 466 * \brief Test 5: enqueue/dequeue with drops according to CoDel algorithm |
470 */ | 467 */ |
471 class CoDelQueueDiscBasicDrop : public TestCase | 468 class CoDelQueueDiscBasicDrop : public TestCase |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 CoDelQueueDiscBasicDrop::CoDelQueueDiscBasicDrop (std::string mode) | 522 CoDelQueueDiscBasicDrop::CoDelQueueDiscBasicDrop (std::string mode) |
526 : TestCase ("Basic drop operations for " + mode) | 523 : TestCase ("Basic drop operations for " + mode) |
527 { | 524 { |
528 m_mode = StringValue (mode); | 525 m_mode = StringValue (mode); |
529 m_dropNextCount = 0; | 526 m_dropNextCount = 0; |
530 } | 527 } |
531 | 528 |
532 void | 529 void |
533 CoDelQueueDiscBasicDrop::DropNextTracer (uint32_t oldVal, uint32_t newVal) | 530 CoDelQueueDiscBasicDrop::DropNextTracer (uint32_t oldVal, uint32_t newVal) |
534 { | 531 { |
535 NS_UNUSED(oldVal); | 532 NS_UNUSED(oldVal); |
Stefano Avallone
2017/12/29 22:56:39
I am not sure if consensus was reached on this.
ammo6818-vandals.uidaho.edu
2017/12/31 05:15:03
i am recommending these be kept since they have ge
Tom Henderson
2017/12/31 05:21:49
Can you clarify? I did not understand the comment
ammo6818-vandals.uidaho.edu
2017/12/31 15:21:45
changes required to address these warnings have ca
| |
536 NS_UNUSED(newVal); | 533 NS_UNUSED(newVal); |
537 m_dropNextCount++; | 534 m_dropNextCount++; |
538 } | 535 } |
539 | 536 |
540 void | 537 void |
541 CoDelQueueDiscBasicDrop::DoRun (void) | 538 CoDelQueueDiscBasicDrop::DoRun (void) |
542 { | 539 { |
543 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc> (); | 540 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc> (); |
544 uint32_t pktSize = 1000; | 541 uint32_t pktSize = 1000; |
545 uint32_t modeSize = 0; | 542 uint32_t modeSize = 0; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 AddTestCase (new CoDelQueueDiscBasicOverflow ("QUEUE_DISC_MODE_BYTES"), Test Case::QUICK); | 670 AddTestCase (new CoDelQueueDiscBasicOverflow ("QUEUE_DISC_MODE_BYTES"), Test Case::QUICK); |
674 // Test 3: test NewtonStep() against explicit port of Linux implementation | 671 // Test 3: test NewtonStep() against explicit port of Linux implementation |
675 AddTestCase (new CoDelQueueDiscNewtonStepTest (), TestCase::QUICK); | 672 AddTestCase (new CoDelQueueDiscNewtonStepTest (), TestCase::QUICK); |
676 // Test 4: test ControlLaw() against explicit port of Linux implementation | 673 // Test 4: test ControlLaw() against explicit port of Linux implementation |
677 AddTestCase (new CoDelQueueDiscControlLawTest (), TestCase::QUICK); | 674 AddTestCase (new CoDelQueueDiscControlLawTest (), TestCase::QUICK); |
678 // Test 5: enqueue/dequeue with drops according to CoDel algorithm | 675 // Test 5: enqueue/dequeue with drops according to CoDel algorithm |
679 AddTestCase (new CoDelQueueDiscBasicDrop ("QUEUE_DISC_MODE_PACKETS"), TestCa se::QUICK); | 676 AddTestCase (new CoDelQueueDiscBasicDrop ("QUEUE_DISC_MODE_PACKETS"), TestCa se::QUICK); |
680 AddTestCase (new CoDelQueueDiscBasicDrop ("QUEUE_DISC_MODE_BYTES"), TestCase ::QUICK); | 677 AddTestCase (new CoDelQueueDiscBasicDrop ("QUEUE_DISC_MODE_BYTES"), TestCase ::QUICK); |
681 } | 678 } |
682 } g_coDelQueueTestSuite; ///< the test suite | 679 } g_coDelQueueTestSuite; ///< the test suite |
LEFT | RIGHT |