Re: [FlowMonitor] install node after Simulator::Run()

83 views
Skip to first unread message
Message has been deleted

Tommaso Pecorella

unread,
Aug 4, 2014, 2:25:28 PM8/4/14
to ns-3-...@googlegroups.com
Hi,

honestly, I don't see what's the issue. I mean, you have for sure done thing far more difficult, like creating on the flight nodes, NetDevices the Ip stack and connected all of them together.
Adding also the FlowProbe should be piss easy

The only thing that may be a bit confusing is that some FlowMonitor classes should be refactored to be Singletons, but (again) it should be really a walk in the park after the sort of troubles you faced to have objects aggregation (and initialization!) done right.

Cheers,

T.

On Monday, August 4, 2014 8:12:00 PM UTC+2, Davide D wrote:
Hello,
i am working on a "distributed" project in which ns3 is called via socket from another program. I can not strictly follow the FlowMonitor template (like in https://groups.google.com/forum/#!topic/ns-3-users/9_X3qWt3dBI ) since i do not have a "ns3 main.cpp" that creates all the scenario (nodes, mobility, ipv4, devices, applications...). In particular a central program order NS3 to create nodes and simulate data traffic while the simulation is running.

I would like how to attach a node to FlowMonitor after Simulator::Run() and how to iteratively install nodes to FlowMonitor.
A similar question is how to write FlowMonitor code in a file which is not main.cc.

Thanks for cooperation!

Davide
Message has been deleted

Tommaso Pecorella

unread,
Aug 5, 2014, 11:47:08 AM8/5/14
to ns-3-...@googlegroups.com
Hi,

I just love well paid EU (or non-EU) projects that are using open source software. They do contribute so much to the open source community... 

Sorry Davide, it is next to impossible for us as well. I don't have any clue of the project you are supposed to work with, the changes done to the ns-3 core code to make it work dynamically, and what are the dynamic system used.
All in all, I should assume that the changes are quite large. Moreover, if it's a 4-years old project, most probably it was using a now severely outdated ns-3 version.

As a consequence, it's next to impossible for us as well to give you any advice.

Sorry,

T.


On Tuesday, August 5, 2014 11:33:37 AM UTC+2, Davide D wrote:
Maybe i was confusing and i appeared for someone which i am not.... I didn't write the software, it was an european project (well paid) in which a lot of people were involved that finished 4 years ago. I was asked to take this platform and write little applications with statistics. I have VERY BASIC knowledge of NS3, that's why i am here asking for help. Maybe for most of you "explicity" writing flowMonitor.code with probes, flows, classifier dependency and so on is an easy task, for me unfortunately, even tough i have tried in this weeks, it's not :-( 
I don't know in realtime how to attach probe to a node, how to identify its flowId and how to attach it to the classifier and the Ptr<FlowMonitor> to collect statistic.  
A skeleton would be very welcome!

Thanks for cooperation,
Davide
Message has been deleted

Tommaso Pecorella

unread,
Aug 5, 2014, 1:50:48 PM8/5/14
to ns-3-...@googlegroups.com
Hi,

first and foremost, keep calm. Second, the projects management may not be your business or your fault, but you have to understand that ns-3 i protected by copyrights and a (strong) licensing system. Its use is free provided that [see the licence]. Third, I have no clue what the project is. It may or may not have contributed to ns-3 at large. Nevertheless, I hope you understand my concerns in giving away my spare time without having nothing back.
I'd strongly encourage you to blur the background next time. People working to a project for free are extremely picky in cases like this.

Now, about your question, I already told you where to look. You are just too nervous to see the hint: "objects aggregation (and initialization!) done right".

The most difficult part in creating nodes on the flight is the ConfigStore, i.e., all the traces and attributes. I do not have idea on what "they" did to fix all that stuff, but the probes are relying on traces.
The best advice I can give you is to check if the traces of dynamically created nodes are fired. If they're not fired, then you have found the problem.
How to fix it (if that's the problem)? No idea at all. The only thing one could do is to heavily modify both IP and FlowProbes to have a tight coupling. I.e., use callbacks instead of traces. 

Have fun.

T.

On Tuesday, August 5, 2014 6:47:25 PM UTC+2, Davide D wrote:
Beside of the story of the EU project and other stuff which are not relevant for this forum and for ns3users my question is ns3-related and quite straightforward:

is it possible to create a probe/flow AFTER Simulator::Run()? if yes how?  

In the following i write a scratch that i hope will clarify which is the situation and what i am looking for:

   FlowMonitorHelper flowmon_helper;
   Ptr<FlowMonitor> monitor = flowmon_helper.GetMonitor();
   Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon_helper.GetClassifier());  
   monitor->SetFlowClassifier (classifier);

///************** if i put the following instruction here flowMonitor returns statistics ***************////
   Ptr<Ipv4FlowProbe> ipv4flowProb1 = CreateObject<Ipv4FlowProbe>(monitor, classifier, node );


   Simulator::Run();

///************** if i put the following instruction here WHERE I WISH flowMonitor DOES NOT return statistics ***************////
Ptr<Ipv4FlowProbe> ipv4flowProb1 = CreateObject<Ipv4FlowProbe>(monitor, classifier, node );


//*** print statistics related to my probe ***//
   FlowProbe::Stats statProb1 = ipv4flowProb1->GetStats ();
   for (std::map< FlowId, FlowProbe::FlowStats >::iterator flow = statProb1.begin(); flow!=statProb1.end(); flow++)
            {
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(flow->first);

std::cout<< "\n******* FLOW MONITOR 2*********\n"
                         << "FlowID: " << flow->first  << "\n"
                         << t.sourceAddress << "/" << t.sourcePort << " --> "
                         << t.destinationAddress << "/" << t.destinationPort <<"\n"
                         << "statProb1 Packets: " << (flow->second).packets << "\n"
                         << "statProb1 txBytes: "   << (flow->second).bytes   << "\n"
       <<std::endl;
            }

I need a way to activate the probe installed to node and attached to the classifier and monitor after Simulator::Run(), like the statement previosly written in bold, because in my scenario nodes are created runtime.

PS: i have the same situation if i use flowmon_helper.Install(node). If i place the statement before Simulator::Run() returns statistics if after doesn't.

Thanks again for cooperation!
Davide

Reply all
Reply to author
Forward
0 new messages