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