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