I have simulated the leaf-spine datacenter network using ns3-dce-sdn, there exists some problem in the flow monitor module.
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor;
monitor = flowmon.InstallAll();
.........
monitor->SerializeToXmlFile ("dce-python-sdn.xml" , true, true );
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter = stats.begin (); iter != stats.end (); ++iter)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);
NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << t.sourceAddress << " Dst Addr " << t.destinationAddress);
NS_LOG_UNCOND("Tx Packets = " << iter->second.txPackets);
NS_LOG_UNCOND("Tx Bytes = " << iter->second.txBytes);
NS_LOG_UNCOND("Sum jitter = " << iter->second.jitterSum);
NS_LOG_UNCOND("Delay Sum = " << iter->second.delaySum);
NS_LOG_UNCOND("Lost Packet = " << iter->second.lostPackets);
NS_LOG_UNCOND("Rx Bytes = " << iter->second.rxBytes);
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");
NS_LOG_UNCOND("Packet loss %= " << ((iter->second.txPackets-iter->second.rxPackets)*1.0)/iter->second.txPackets);
}
Parts of the results are as follows: there are 4 packets loss as the flow monitor's results, and in the opposite direction of the flow all packets are lost. Actually there are no packets loss. I don't know how to find the reason.
that's very kind of you who will help me! Thank you very much.