TrafficConditioner.ned 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // Copyright (C) 2012 Opensim Ltd.
  3. // Author: Tamas Borbely
  4. //
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. package inet.examples.diffserv.simple_;
  20. import inet.common.queue.Join;
  21. import inet.common.queue.Sink;
  22. import inet.linklayer.contract.ITrafficConditioner;
  23. import inet.networklayer.diffserv.BehaviorAggregateClassifier;
  24. import inet.networklayer.diffserv.DSCPMarker;
  25. import inet.networklayer.diffserv.MultiFieldClassifier;
  26. import inet.networklayer.diffserv.SingleRateThreeColorMeter;
  27. import inet.networklayer.diffserv.TokenBucketMeter;
  28. //
  29. // TODO documentation
  30. //
  31. module TrafficConditioner like ITrafficConditioner
  32. {
  33. parameters:
  34. string interfaceTableModule;
  35. *.interfaceTableModule = default(absPath(interfaceTableModule));
  36. @display("i=block/classifier");
  37. gates:
  38. input in;
  39. output out;
  40. submodules:
  41. mfClassifier: MultiFieldClassifier {
  42. filters = xmldoc("filters.xml");
  43. @display("p=52,296");
  44. }
  45. efMeter: TokenBucketMeter {
  46. @display("p=339,113");
  47. }
  48. defaultMeter: SingleRateThreeColorMeter {
  49. @display("p=339,356");
  50. }
  51. efMarker: DSCPMarker {
  52. dscps = "EF";
  53. @display("p=204,113");
  54. }
  55. af11Marker: DSCPMarker {
  56. dscps = "AF11";
  57. @display("p=204,236");
  58. }
  59. af21Marker: DSCPMarker {
  60. dscps = "AF21";
  61. @display("p=204,356");
  62. }
  63. af13Marker: DSCPMarker {
  64. dscps = "AF13";
  65. @display("p=556,405");
  66. }
  67. af23Marker: DSCPMarker {
  68. dscps = "AF23";
  69. @display("p=556,512");
  70. }
  71. join: Join {
  72. @display("p=665,296");
  73. }
  74. beMarker: DSCPMarker {
  75. dscps = "BE";
  76. @display("p=204,479");
  77. }
  78. baClassifier: BehaviorAggregateClassifier {
  79. dscps = "AF11 AF21";
  80. @display("p=450,405");
  81. }
  82. af11Marker2: DSCPMarker {
  83. dscps = "AF11";
  84. @display("p=517,114");
  85. }
  86. dropper: Sink {
  87. @display("p=450,512");
  88. }
  89. connections:
  90. in --> mfClassifier.in;
  91. mfClassifier.outs++ --> efMarker.in++;
  92. mfClassifier.outs++ --> af11Marker.in++;
  93. mfClassifier.outs++ --> af21Marker.in++;
  94. mfClassifier.defaultOut --> beMarker.in++;
  95. efMarker.out --> efMeter.in++;
  96. efMeter.greenOut --> { @display("ls=green"); } --> join.in++;
  97. efMeter.redOut --> { @display("ls=red"); } --> af11Marker2.in++;
  98. af11Marker2.out --> join.in++;
  99. af11Marker.out --> defaultMeter.in++;
  100. af21Marker.out --> defaultMeter.in++;
  101. beMarker.out --> defaultMeter.in++;
  102. defaultMeter.greenOut --> { @display("ls=green"); } --> join.in++;
  103. defaultMeter.yellowOut --> { @display("ls=yellow"); } --> baClassifier.in;
  104. baClassifier.outs++ --> af13Marker.in++;
  105. baClassifier.outs++ --> af23Marker.in++;
  106. baClassifier.defaultOut --> join.in++;
  107. af13Marker.out --> join.in++;
  108. af23Marker.out --> join.in++;
  109. join.out --> out;
  110. defaultMeter.redOut --> { @display("ls=red"); } --> dropper.in++;
  111. }