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