NS-3 Advanced Tutorial: Visualization And Data Collection

Transcription

NS-3 Advanced Tutorial:Visualization and Data CollectionTom Henderson (University of Washington andBoeing Research & Technology)L. Felipe Perrone (Bucknell University)March 2013NS-3 Consortium MeetingMarch 20131

OutlineGetting visualization and raw data from ns-3 Tracing and packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 20132

Tracing requirements Tracing is a structured form of simulationoutput Example (from ns-2): rr rcbracktcp210 ------- 0 0.0 3.1 225 610210 ------- 0 0.0 3.1 225 610210 ------- 1 3.0 1.0 195 60040 ------- 2 3.2 0.1 82 6021000 ------- 2 0.1 3.2 102 611Problem: Tracing needs vary widely– would like to change tracing output withoutediting the core– would like to support multiple outputsNS-3 Consortium MeetingMarch 20133

Tracing in ns-3 ns-3 configures multiple 'TraceSource' objects(TracedValue, TracedCallback) Multiple types of 'TraceSink' objects can be hooked tothese sources A special configuration namespace helps to manageaccess to trace nnect ("/path/to/traced/value", callback1);Config::Connect ("/path/to/trace/source", callback2);unattachedNS-3 Consortium MeetingMarch 2013

NetDevice trace hooks Example: ce::Send ive()CsmaChannelNS-3 Consortium MeetingMarch 2013

Enabling tracing in your code examples/tutorial/third.ccDevice helpersprovide commonAPI for enablingpcap tracesGlobal pcap tracingPer-device pcap tracingNS-3 Consortium MeetingMarch 2013

External pcap toolswireshark graph analysisShawn Ostermann's tcptrace toolNS-3 Consortium MeetingMarch 2013

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 20138

Gnuplot src/tools/gnuplot.{cc,h} C wrapper around gnuplot classes:– Gnuplot– GnuplotDataset Gnuplot2dDataset, Gnuplot2dFunction Gnuplot3dDataset, Gnuplot3dFunctionNS-3 Consortium MeetingMarch 2013

Enabling gnuplot for your code examples/wireless/wifi-clear-channel-cmu.ccproduce a plot file thatwill generate an EPS figureone dataset per modeAdd data to datasetAdd dataset to plotNS-3 Consortium MeetingMarch 2013

Matplotlib Matplotlib or other Python plotting programs can be used example: src/core/examples/sample-rng-plot.pyNS-3 Consortium MeetingMarch 201311

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 201312

FlowMonitor Network monitoring framework found insrc/flow-monitor/ Goals:– detect all flows passing through network– stores metrics for analysis such as bitrates,duration, delays, packet sizes, packet lossratiosG. Carneiro, P. Fortuna, M. Ricardo, "FlowMonitor-- a network monitoring frameworkfor the Network Simulator ns-3," Proceedings of NSTools 2009.NS-3 Consortium MeetingMarch 2013

FlowMonitor architecture Basic classes– FlowMonitor– FlowProbe– FlowClassifier– FlowMonitorHelper Ipv4 onlyFigure credit: G. Carneiro, P. Fortuna, M. Ricardo, "FlowMonitor-- a network monitoringframework for the Network Simulator ns-3," Proceedings of NSTools 2009.NS-3 Consortium MeetingMarch 2013

FlowMonitor statistics Statistics gatheredNS-3 Consortium MeetingMarch 2013

FlowMonitor configuration example/wireless/wifi-hidden-terminal.ccNS-3 Consortium MeetingMarch 2013

FlowMonitor output This program exports statistics to stdout Other examples integrate with PyVizNS-3 Consortium MeetingMarch 2013

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 201318

PyViz overview Developed by Gustavo Carneiro Live simulation visualizer (no trace files) Useful for debugging– mobility model behavior– where are packets being dropped? Built-in interactive Python console todebug the state of running objects Works with Python and C programsNS-3 Consortium MeetingMarch 2013

Pyviz screenshot (Graphviz layout)NS-3 Consortium MeetingMarch 2013

Pyviz and FlowMonitor src/flow-monitor/examples/wifi-olsr-flowmon.pyNS-3 Consortium MeetingMarch 2013

Enabling PyViz in your simulations Make sure PyViz is enabled in the build If program supports CommandLineparsing, pass the option--SimulatorImplementationType ns3::VisualSimulatorImpl Alternatively, pass the "--vis" optionNS-3 Consortium MeetingMarch 2013

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 201323

NetAnim "NetAnim" by George Riley and John AbrahampyvizNS-3 Consortium MeetingMarch 201324

NetAnim key features Animate packets over wired-links and wirelesslinks– limited support for LTE traces Packet timeline with regex filter on packet metadata. Node position statistics with node trajectoryplotting (path of a mobile node). Print brief packet-meta data on packetsNS-3 Consortium MeetingMarch 2013

NetAnim 3.104 overview Forthcoming release– More details in packet animation– Smoother mobility– Plotting the routing path from a source node to adestination IP address– Print routing tables at various times– Flow monitor output parsing– Packet timelines– IP/MAC display– Change color during animation– DesignerNS-3 Consortium MeetingMarch 2013

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 201327

Statistics Statistics module contributed by Joe Kopenaearly in the project– src/stats directory Initial implementation of an experiment controllerNS-3 Consortium MeetingMarch 2013

Statistics module features Metadata– experiment: name of experiment– strategy: description of what is being tested– runID: allows user to identify the trial Data output in either 'omnetpp' or 'sqlite' format Provides a basic statistical data calculatorexample "wifi-example-sim"(packet loss vs distance fordefault wifi settings)NS-3 Consortium MeetingMarch 2013

OutlineGetting visualization and raw data from ns-3 Packet tracesGnuplot and MatplotlibFlow MonitorPyVizNetAnimStatisticsData Collection FrameworkNS-3 Consortium MeetingMarch 201330

Data Collection Framework under review for future ns-3 inclusion part of the SAFE project development ledby Bucknell University– integrates with visualization module– integrates with steady-state detectorNS-3 Consortium MeetingMarch 2013

Data Collection Frameworkns-3 data publishedas trace sourceProbe: wraptrace sourceCollector: datareductionAggregator:marshal datadatabase controlsto enable/disable namedwithinconfigurationnamespaceStatic method forinstrumenting code(Stat::Put() ofns2measure) examples:averaging, timeseries, etc. can bechainedtogether gnuplot postgresql other.filesLeverages prototype developed by Pavel Boyko and Kirill AndreevLeverages ns2measure project (CNG at University of Pisa)NS-3 Consortium MeetingMarch 2013

Data Collection Framework example 'manet-safe.cc' example in ns-3-dcf repository Trace source:"/NodeList/*/ApplicationList/0/ ns3::PacketSink/Rx"Probe packet sinkreceptions betweentime 120-150 secondsSet periodicity to0.5 secondsPlot packet count,total packet byte count(during interval) andmean packet bytecount (within interval)NS-3 Consortium MeetingMarch 2013

Data Collection FrameworkPacketSinktrace sourceProbe filter tracesource datawithin timewindowCollector computestatistics onpacket andbyte countsAggregator gnuplot postgresql SAFE other.Introduce helper to manage configurationcomplexityNS-3 Consortium MeetingMarch 2013

Gnuplot data collection example src/data-collection/examples/manet-safe.ccNS-3 Consortium MeetingMarch 2013

Gnuplot data collection example (2) src/data-collection/examples/manet-safe.ccNS-3 Consortium MeetingMarch 2013

Under construction:steady-state collector Built upon steady-state detector classesReceives samplesApplies steady-state detection algorithmOne pass-through trace source (all samples)One filtered trace source (post-transientsample)MSER-5 and possibly other methodsNS-3 Consortium MeetingMarch 2013

Under construction: in-browservisualizationTime series support:nearly completedSelection buttons for metrics collectedNS-3 Consortium MeetingMarch 2013

Under construction: from browser to filePlot is built interactively, through browser, andconverted to static file (PDF)NS-3 Consortium MeetingMarch 2013

Next priority for in-browser visualization“Estimation” support:in early designSelection buttons for data seriesConfidence intervalsFigure source: Broch et al. “A Performance Comparison of Multi-Hop WirelessAd Hoc Routing Protocols”NS-3 Consortium MeetingMarch 2013

Later priority for in-browser visualization“Distribution” support:in early discussionSelection buttons for data seriesFigure source: Broch et al. “A Performance Comparison of Multi-Hop WirelessAd Hoc Routing Protocols”NS-3 Consortium MeetingMarch 2013

database files examples: averaging, time series, etc. can be chained together gnuplot postgresql other. Static method for . instrumenting code (Stat::Put() of ns2measure) Leverages prototype developed by Pavel Boyko and Kirill Andreev . Leverages ns2measure project (CNG at University of Pisa) NS-3 Consortium Meeting March 2013