Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 1 | Examples |
| 2 | ======== |
| 3 | |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 4 | .. role:: red |
| 5 | |
| 6 | .. note:: |
| 7 | :red:`!!! This page only shows up examples of how to config topology and perform basic operations in ndnSIM (an example equivalent to "Hello, world1") !!! These are **NOT** examples of real experimentations (just like "Hello, world!" is not a real program).` |
| 8 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 9 | .. note:: |
| 10 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 11 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 12 | .. _simple-scenario: |
| 13 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 14 | Simple scenario |
| 15 | --------------- |
| 16 | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 17 | The first example (``ndn-simple.cc``) shows very basics of ndnSIM. In the simulated |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 18 | topology there are 3 nodes, connected with point-to-point links, one |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 19 | NDN consumer, and one NDN producer: |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 20 | |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 21 | .. aafig:: |
| 22 | :aspect: 60 |
| 23 | :scale: 120 |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 25 | +----------+ +--------+ +----------+ |
| 26 | | | 1Mbps | | 1Mbps | | |
| 27 | | Consumer |<-------------->| Router |<-------------->| Producer | |
| 28 | | | 10ms | | 10ms | | |
| 29 | +----------+ +--------+ +----------+ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 30 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 31 | Consumer is simulated using :ndnsim:`ConsumerCbr` reference application and generates Interests towards the producer |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 32 | with frequency of 10 Interests per second (see :doc:`applications`). |
| 33 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 34 | Producer is simulated using :ndnsim:`Producer` class, which is used to satisfy all incoming Interests with virtual payload data (1024 bytes). |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 35 | |
| 36 | FIB on every node is populated using default routes (see :doc:`helpers`). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 37 | |
| 38 | The following code represents all that is necessary to run such a |
| 39 | simple scenario |
| 40 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 41 | .. literalinclude:: ../../examples/ndn-simple.cc |
| 42 | :language: c++ |
| 43 | :linenos: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 44 | :lines: 20-27,48- |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 45 | :emphasize-lines: 30-33,37-49 |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 47 | If this code is placed into ``scratch/ndn-simple.cc`` and NS-3 is compiled in debug mode, you can run and see progress of the |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 48 | simulation using the following command (in optimized mode nothing will be printed out):: |
| 49 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 50 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 51 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 52 | .. note:: |
| 53 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 54 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 55 | .. _9-node-grid-example: |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 56 | |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 57 | 9-node grid example |
| 58 | ------------------- |
| 59 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 60 | This scenario (``ndn-grid.cc``) simulates a grid topology, which is constructed using PointToPointLayout NS-3 module |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 61 | |
| 62 | .. aafig:: |
| 63 | :aspect: 60 |
| 64 | :scale: 120 |
| 65 | |
| 66 | /--------\ /-\ /-\ |
| 67 | |Consumer|<---->| |<------->| | |
| 68 | \--------/ \-/ \-/ |
| 69 | ^ ^ ^ |
| 70 | | | | 1Mbps/10ms delay |
| 71 | v v v |
| 72 | /-\ /-\ /-\ |
| 73 | | |<-------->| |<------->| | |
| 74 | \-/ \-/ \-/ |
| 75 | ^ ^ ^ |
| 76 | | | | |
| 77 | v v v |
| 78 | /-\ /-\ /--------\ |
| 79 | | |<-------->| |<---->|Producer| |
| 80 | \-/ \-/ \--------/ |
| 81 | |
| 82 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 83 | FIB is populated using :ndnsim:`GlobalRoutingHelper` (see :doc:`helpers`). |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 84 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 85 | Consumer is simulated using :ndnsim:`ConsumerCbr` reference application and generates Interests towards the producer |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 86 | with frequency of 100 interests per second (see :doc:`applications`). |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 87 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 88 | Producer is simulated using :ndnsim:`Producer` class, which is used to satisfy all incoming Interests with virtual payload data (1024 bytes). |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 89 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 90 | The following code represents all that is necessary to run such a simple scenario |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 91 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 92 | .. literalinclude:: ../../examples/ndn-grid.cc |
| 93 | :language: c++ |
| 94 | :linenos: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 95 | :lines: 20-27,53- |
| 96 | :emphasize-lines: 28,31-33,35-38,53-57 |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 97 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 98 | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 99 | If this code is placed into ``scratch/ndn-grid.cc`` and NS-3 is compiled in debug mode, you can run and see progress of the |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 100 | simulation using the following command (in optimized mode nothing will be printed out):: |
| 101 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 102 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-grid |
Alexander Afanasyev | 07b0063 | 2012-06-01 23:46:47 -0700 | [diff] [blame] | 103 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 104 | .. note:: |
| 105 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 106 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 107 | .. _9-node-grid-example-using-topology-plugin: |
| 108 | |
| 109 | 9-node grid example using topology plugin |
| 110 | ----------------------------------------- |
| 111 | |
| 112 | Instead of defining topology directly as in :ref:`simple-scenario` or using specialized helpers as in :ref:`9-node-grid-example`, ndnSIM provides experimental extended versions of TopologyReader classes: :ndnsim:`AnnotatedTopologyReader` and :ndnsim:`RocketfuelWeightsReader`. |
| 113 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 114 | While :ndnsim:`RocketfuelWeightsReader` is a specialized version intended to be used with `Rocketfuel <http://www.cs.washington.edu/research/networking/rocketfuel/>`_ topology and link weights files (examples will be provided later), :ndnsim:`AnnotatedTopologyReader` is a more general-use class that uses simple user-readable format. |
| 115 | |
| 116 | :ndnsim:`AnnotatedTopologyReader` expects the following format: |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 117 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 118 | .. literalinclude:: ../../examples/topologies/topo-grid-3x3.txt |
| 119 | :language: bash |
| 120 | :linenos: |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 121 | :lines: 1-2,19- |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 122 | :emphasize-lines: 8,24 |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 123 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 124 | |
| 125 | This scenario (``ndn-grid-topo-plugin.cc``) duplicates the functionality of :ref:`9-node-grid-example` but with the use of :ndnsim:`AnnotatedTopologyReader`. |
| 126 | |
| 127 | .. aafig:: |
| 128 | :aspect: 60 |
| 129 | :scale: 120 |
| 130 | |
| 131 | /--------\ /-\ /-\ |
| 132 | |Consumer|<---->| |<------->| | |
| 133 | \--------/ \-/ \-/ |
| 134 | ^ ^ ^ |
| 135 | | | | 1Mbps/10ms delay |
| 136 | v v v |
| 137 | /-\ /-\ /-\ |
| 138 | | |<-------->| |<------->| | |
| 139 | \-/ \-/ \-/ |
| 140 | ^ ^ ^ |
| 141 | | | | |
| 142 | v v v |
| 143 | /-\ /-\ /--------\ |
| 144 | | |<-------->| |<---->|Producer| |
| 145 | \-/ \-/ \--------/ |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 146 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 147 | .. literalinclude:: ../../examples/ndn-grid-topo-plugin.cc |
| 148 | :language: c++ |
| 149 | :linenos: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 150 | :lines: 20-26,51- |
| 151 | :emphasize-lines: 14-16,20,27-30 |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 152 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 153 | As you can see, scenario code became more compact and more readable. |
| 154 | |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 155 | :ndnsim:`AnnotatedTopologyReader` provides two ways to access topology nodes. |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 156 | First, you can use the method :ndnsim:`AnnotatedTopologyReader::GetNodes` which returns NodeContainer. |
| 157 | |
| 158 | Alternatively, nodes can be accessed by name using `Names::Find<Node> ("nodename")` call, as in the above example. |
| 159 | For this purpose,:ndnsim:`AnnotatedTopologyReader` automatically registers all created nodes with names specified in topology file. |
| 160 | For more information about `Names` class, please refer to `NS-3 documentation <.. http://www.nsnam.org/doxygen/classns3_1_1_names.html>`_ |
| 161 | . |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 162 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 163 | If the topology file is placed into ``src/ndnSIM/examples/topologies/topo-grid-3x3.txt`` and the code is placed into ``scratch/ndn-grid-topo-plugin.cc``, you can run and see progress of the simulation using the following command (in optimized mode nothing will be printed out):: |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 164 | |
| 165 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-grid-topo-plugin |
| 166 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 167 | .. note:: |
| 168 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 169 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 170 | 6-node bottleneck topology |
| 171 | -------------------------- |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 172 | |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 173 | This scenario (``ndn-congestion-topo-plugin.cc``) can be used for congestion-related scenarios |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 174 | |
| 175 | .. aafig:: |
| 176 | :aspect: 60 |
| 177 | :scale: 120 |
| 178 | |
| 179 | /------\ /------\ |
| 180 | | Src1 |<--+ +-->| Dst1 | |
| 181 | \------/ \ / \------/ |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 182 | \ / |
| 183 | +-->/------\ "bottleneck" /------\<-+ |
| 184 | | Rtr1 |<===============>| Rtr2 | |
| 185 | +-->\------/ \------/<-+ |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 186 | / \ |
| 187 | /------\ / \ /------\ |
| 188 | | Src2 |<--+ +-->| Dst2 | |
| 189 | \------/ \------/ |
| 190 | |
| 191 | .. literalinclude:: ../../examples/topologies/topo-6-node.txt |
| 192 | :language: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 193 | :linenos: |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 194 | :lines: 1-2,15- |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 195 | :emphasize-lines: 3,13 |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 196 | |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 197 | .. literalinclude:: ../../examples/ndn-congestion-topo-plugin.cc |
| 198 | :language: c++ |
| 199 | :linenos: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 200 | :lines: 20-26,47- |
| 201 | :emphasize-lines: 15,21-22,29-34,41-47,52-62 |
Alexander Afanasyev | aa1c4c3 | 2012-11-21 16:17:03 -0800 | [diff] [blame] | 202 | |
| 203 | .. :lines: 20-25,53- |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 204 | |
| 205 | To run this scenario and see what is happening, use the following command:: |
| 206 | |
| 207 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-congestion-topo-plugin |
| 208 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 209 | .. note:: |
| 210 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 211 | |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 212 | .. _11-node 2-bottleneck topology with custom forwarding strategy: |
| 213 | |
| 214 | 11-node 2-bottleneck topology with custom forwarding strategy |
| 215 | ------------------------------------------------------------- |
| 216 | |
| 217 | To effectively use the example :ref:`custom strategy <Writing your own custom strategy>`, we need to make sure that FIB entries contain at least two entries. |
| 218 | In the current version of ndnSIM, this can be accomplished using manual route configuration. |
| 219 | |
| 220 | The following example illustrates how the strategy can be used in simulation scenario. |
| 221 | |
| 222 | Let us first define a meaningful topology: |
| 223 | |
| 224 | .. aafig:: |
| 225 | :aspect: 60 |
| 226 | :scale: 120 |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 227 | |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 228 | /------\ 0 0 /------\ |
| 229 | | c1 |<-----+ +----->| p1 | |
| 230 | \------/ \ / \------/ |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 231 | \ /-----\ / |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 232 | /------\ 0 \ +==>| r12 |<==+ / 0 /------\ |
| 233 | | c2 |<--+ \ / \-----/ \ / +-->| p2 | |
| 234 | \------/ \ \ | | / / \------/ |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 235 | \ | | 1Mbps links | | / |
| 236 | \ 1 v0 v5 1v 2v 3 / |
| 237 | +->/------\ /------\<-+ |
| 238 | 2| r1 |<===============>| r2 |4 |
| 239 | +->\------/4 0\------/<-+ |
| 240 | / 3^ ^5 \ |
| 241 | / | | \ |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 242 | /------\ 0 / / \ \ 0 /------\ |
| 243 | | c3 |<--+ / \ +-->| p3 | |
| 244 | \------/ / \ \------/ |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 245 | / "All consumer-router and" \ |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 246 | /------\ 0 / "router-producer links are" \ 0 /------\ |
| 247 | | c4 |<-----+ "10Mbps" +---->| p4 | |
| 248 | \------/ \------/ |
Alexander Afanasyev | 6cf8343 | 2013-02-15 16:02:04 -0800 | [diff] [blame] | 249 | |
Alexander Afanasyev | e97c607 | 2012-11-21 23:51:12 -0800 | [diff] [blame] | 250 | "Numbers near nodes denote face IDs. Face ID is assigned based on the order of link" |
| 251 | "definitions in the topology file" |
| 252 | |
| 253 | The corresponding topology file (``topo-11-node-two-bottlenecks.txt``): |
| 254 | |
| 255 | .. literalinclude:: ../../examples/topologies/topo-11-node-two-bottlenecks.txt |
| 256 | :language: bash |
| 257 | :linenos: |
| 258 | :lines: 1-2,28- |
| 259 | |
| 260 | Example simulation (``ndn-congestion-alt-topo-plugin.cc``) scenario that utilizes CustomStrategy forwarding strategy: |
| 261 | |
| 262 | .. literalinclude:: ../../examples/ndn-congestion-alt-topo-plugin.cc |
| 263 | :language: c++ |
| 264 | :linenos: |
| 265 | :lines: 21-28,61- |
| 266 | :emphasize-lines: 16,21,49-50,65-79 |
| 267 | |
| 268 | |
| 269 | To run this scenario and see what is happening, use the following command:: |
| 270 | |
| 271 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-congestion-alt-topo-plugin |
| 272 | |
| 273 | You can also run using visualizer module to verify that both bottleneck links are utilized:: |
| 274 | |
| 275 | ./waf --run=ndn-congestion-alt-topo-plugin --visualize |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 276 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 277 | .. note:: |
| 278 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 279 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 280 | 3-level binary tree with packet-level trace helpers |
| 281 | --------------------------------------------------- |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 282 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 283 | :ref:`packet trace helper example` |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 284 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 285 | |
| 286 | 3-level binary tree with content store trace helper |
| 287 | --------------------------------------------------- |
| 288 | |
Alexander Afanasyev | db64ff1 | 2013-01-18 16:37:31 -0800 | [diff] [blame] | 289 | :ref:`cs trace helper example` |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 290 | |
Alexander Afanasyev | f4a0359 | 2012-12-10 16:12:34 -0800 | [diff] [blame] | 291 | |
Alexander Afanasyev | 27e365b | 2013-01-18 18:03:43 -0800 | [diff] [blame] | 292 | 3-level binary tree with application-level Interest-Data delay tracer |
| 293 | ---------------------------------------------------------------------- |
| 294 | |
| 295 | :ref:`app delay trace helper example` |
| 296 | |
| 297 | |
Alexander Afanasyev | 71278d4 | 2012-12-12 19:16:54 -0800 | [diff] [blame] | 298 | 3-node topology with Content Store respecting freshness field of ContentObjects |
| 299 | ------------------------------------------------------------------------------- |
| 300 | |
| 301 | :ref:`Content Store respecting freshness field of ContentObjects` |
| 302 | |
| 303 | 1-node topology with custom application |
| 304 | --------------------------------------- |
| 305 | |
| 306 | :ref:`Custom applications` |
| 307 | |
Alexander Afanasyev | 1ab1aad | 2013-02-28 11:32:21 -0800 | [diff] [blame] | 308 | Simple scenario with pcap dump |
| 309 | ------------------------------ |
| 310 | |
| 311 | The following example (``ndn-simple-with-pcap.cc``) demonstrates how to dump all simulated traffic |
| 312 | in pcap-formatted data, which can be used for later analysis by conventional tools, like tcpdump and wireshark. |
| 313 | |
| 314 | .. literalinclude:: ../../examples/ndn-simple-with-pcap.cc |
| 315 | :language: c++ |
| 316 | :linenos: |
| 317 | :lines: 20- |
| 318 | :emphasize-lines: 7-29,70-72 |
| 319 | |
| 320 | If this code is placed into ``scratch/ndn-simple-with-pcap.cc`` and NS-3 is compiled in debug mode, you can run and see progress of the |
| 321 | simulation using the following command (in optimized mode nothing will be printed out):: |
| 322 | |
| 323 | NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-simple-with-pcap |
| 324 | |
| 325 | This will generate ``ndn-simple-trace.pcap``, which can be fed to tcpdump:: |
| 326 | |
| 327 | tcpdump -r ndn-simple-trace.pcap |
Alexander Afanasyev | b99cb6c | 2013-03-12 13:58:30 -0700 | [diff] [blame] | 328 | |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 329 | .. note:: |
| 330 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 331 | |
| 332 | .. _Simple scenario with link failures: |
| 333 | |
| 334 | Simple scenario with link failures |
| 335 | ---------------------------------- |
| 336 | |
| 337 | The following example (``ndn-simple-with-link-failure.cc``) shows how to "fail" links in ndnSIM simulation. |
| 338 | The basic idea is to set ndn::Faces that correspond to the failed link to DOWN state. |
| 339 | ndnSIM now includes a simple helper that simplifies this process. |
| 340 | |
| 341 | .. literalinclude:: ../../examples/ndn-simple-with-link-failure.cc |
| 342 | :language: c++ |
| 343 | :linenos: |
| 344 | :lines: 21-31,52- |
| 345 | :emphasize-lines: 54-56 |
| 346 | |
| 347 | If this code is placed into ``scratch/ndn-simple-with-link-failure.cc`` and NS-3 is compiled in debug mode, you can run and see progress of the |
| 348 | simulation using the following command (in optimized mode nothing will be printed out):: |
| 349 | |
| 350 | NS_LOG=ndn.Consumer:ndn.Producer:ndn.LinkControlHelper ./waf --run=ndn-simple-with-link-failure |
| 351 | |
| 352 | .. note:: |
| 353 | If you compiled ndnSIM with examples (``./waf configure --enable-examples``) you can directly run the example without putting scenario into ``scratch/`` folder. |
| 354 | |
| 355 | |
Alexander Afanasyev | 27370c5 | 2013-03-12 13:54:08 -0700 | [diff] [blame] | 356 | 25-node tree topology with L2Tracer |
| 357 | ----------------------------------- |
| 358 | |
| 359 | :ref:`Example of packet drop tracer (L2Tracer)` |
Alexander Afanasyev | b5e77d8 | 2013-04-10 15:55:26 -0700 | [diff] [blame] | 360 | |
| 361 | 3-node topology with periodic tracing of PIT |
| 362 | -------------------------------------------- |
| 363 | |
| 364 | :ref:`periodic tracing of Pending Interest Table (PIT) size` |