Using Flow Monitor to generate statistics about real Tap Bridge data flows

177 views
Skip to first unread message

Rafael Fernandes Lopes

unread,
Apr 15, 2015, 7:46:57 PM4/15/15
to ns-3-...@googlegroups.com
Hi,

I am conducting a research related to the evaluation of some real implemented protocols considering some scenarios (easily configured in the NS-3). As a starting point, I am adapting the tap-wifi-virtual-machine example in order to verify the statistics generated by the Flow Monitor. However, when I run the example, the NS-3 returns a SIGSEGV exactly when I interact with the monitor object. Someone has experimented do something like this?

The error:

Checking for lost packets...
Command ['/usr/local/ns-allinone-3.22/ns-3.22/build/src/tap-bridge/examples/ns3.22-tap-wifi-virtual-machine-debug'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").

The code:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  ...... // same code of the tap-wifi-machine example

  TapBridgeHelper tapBridge;
  tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));
  tapBridge.SetAttribute ("DeviceName", StringValue ("tap-left"));
  tapBridge.Install (nodes.Get (0), devices.Get (0));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap-right"));
  tapBridge.Install (nodes.Get (1), devices.Get (1));

  // Install FlowMonitor on all nodes
  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll();

  Simulator::Stop (Seconds (30.)); // 600.
  Simulator::Run ();

  NS_LOG_UNCOND("Checking for lost packets...");

  monitor->CheckForLostPackets ();

  NS_LOG_UNCOND("Getting flows...");
  
  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

  NS_LOG_UNCOND("Checking flows...");
  
  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter = stats.begin (); iter != stats.end (); ++iter)
    {
      Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);

      const uint16_t port = 4324;
      
      if (t.sourcePort == port || t.destinationPort == port) {
        NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress << " Protocol " << t.protocol);
        NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
        NS_LOG_UNCOND("Rx Packets = " << iter->second.rxPackets);
        NS_LOG_UNCOND("Throughput: " << iter->second.rxBytes * 8.0 / (iter->second.timeLastRxPacket.GetSeconds()-iter->second.timeFirstTxPacket.GetSeconds()) / 1024  << " Kbps");
      }
    }

  Simulator::Destroy ();
 }

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Best regards,

Rafael

Tommaso Pecorella

unread,
Apr 16, 2015, 2:03:30 AM4/16/15
to ns-3-...@googlegroups.com
Hi,

thanks for the bug report.
It's a bug indeed, as the script should have given a meaningful error message instead of a segmentation fault.
The problem is that we didn't foresee the case where a user would want to install FlowMonitor over a set of nodes that doesn't have any IP stack.
No IP, no FlowMonitor, no statistics, the "monitor" pointer is null, crash.

And now... you are lucky that I figured it out just by thinking to it. Next time attach the full code and a meaningful debugger backtrace. 

Have fun,

T.

Rafael Fernandes Lopes

unread,
Apr 16, 2015, 2:32:07 AM4/16/15
to ns-3-...@googlegroups.com
Thanks for the response. Do you have some idea how to calculate the statistics in this case (using the Tap Bridge system)?

Thanks.

Best regards,

Rafael

Tommaso Pecorella

unread,
Apr 16, 2015, 2:44:57 AM4/16/15
to ns-3-...@googlegroups.com
Hi,

FlowMonitor will only help you if the flows are from/to ns-3 nodes.
In your case it depends on the protocol. For a general network test I'd use iperf, but it depends on the protocol.

T.

Rafael Fernandes Lopes

unread,
Apr 16, 2015, 2:48:43 AM4/16/15
to ns-3-...@googlegroups.com
I see... I am evaluating a protocol derived from UDP. I have two applications (one on each VM) transferring a file a number of times. I don't know if iperf can help in this problem.

Anyway, thank you for your time and support.

Best regards,

Rafael. 

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/60pXaBguMQ4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
Rafael Fernandes Lopes
CV Lattes: http://lattes.cnpq.br/1972734433460838
=============================================================
Professor Adjunto
Departamento Acadêmico de Informática - DAI
Instituto Federal de Educação, Ciência e Tecnologia do Maranhão - IFMA
http://www.dai.ifma.edu.br

Pesquisador Associado
Instituto de Estudos Avançados em Comunicações - Iecom
http://www.iecom.org.br
=============================================================
Reply all
Reply to author
Forward
0 new messages