diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 7ca516592..64dcd91ae 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -1436,9 +1436,10 @@ void AnimationInterface::SetLinkDescription (uint32_t fromNode, uint32_t toNode, { P2pLinkNodeIdPair ppair = i->first; LinkProperties l = i->second; - NS_LOG_UNCOND ("A:" << ppair.nodeA << " B:" << ppair.nodeB << " ad:" << l.nodeADescription << " bd:" << l.nodeBDescription << " ld:" << l.linkDescription); + NS_LOG_UNCOND ("A:" << ppair.fromNode << " B:" << ppair.toNode << " ad:" << l.fromNodeDescription << " bd:" << l.toNodeDescription << " ld:" << l.linkDescription); - }*/ + } + */ } void AnimationInterface::SetNodeDescription (Ptr n, std::string descr) @@ -1525,21 +1526,25 @@ std::string AnimationInterface::GetXMLOpenClose_link (uint32_t fromLp, uint32_t << "\" toId=\"" << toId << "\" "; - std::string fromNodeDescription = ""; - std::string toNodeDescription = ""; - std::string linkDescription = ""; + LinkProperties lprop ; + lprop.fromNodeDescription = ""; + lprop.toNodeDescription = ""; + lprop.linkDescription = ""; - P2pLinkNodeIdPair p = { fromId, toId }; - if (linkProperties.find (p) != linkProperties.end()) + P2pLinkNodeIdPair p1 = { fromId, toId }; + P2pLinkNodeIdPair p2 = { toId, fromId }; + if (linkProperties.find (p1) != linkProperties.end()) { - LinkProperties lprop = linkProperties[p]; - fromNodeDescription = lprop.fromNodeDescription; - toNodeDescription = lprop.toNodeDescription; - linkDescription = lprop.linkDescription; + lprop = linkProperties[p1]; } - oss << " fd=\"" << fromNodeDescription << "\"" - << " td=\"" << toNodeDescription << "\"" - << " ld=\"" << linkDescription << "\"" + else if (linkProperties.find (p2) != linkProperties.end()) + { + lprop = linkProperties[p2]; + } + + oss << " fd=\"" << lprop.fromNodeDescription << "\"" + << " td=\"" << lprop.toNodeDescription << "\"" + << " ld=\"" << lprop.linkDescription << "\"" << " />\n"; return oss.str (); } diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h index af56e2a1d..dd28301cf 100644 --- a/src/netanim/model/animation-interface.h +++ b/src/netanim/model/animation-interface.h @@ -269,15 +269,15 @@ public: * \brief Helper function to set the description for a link * \param fromNode Node Id of the "from Node" of the p2p link * \param toNode Node Id of the "to Node" of the p2p link + * \param linkDescription Description of the link such as link bandwidth * \param fromNodeDescription Description at the "from Node" end such as IP address * \param toNodeDescription Description at the "to Node" end such as Ip address - * \param linkDescription Description of the link such as link bandwidth * */ static void SetLinkDescription (uint32_t fromNode, uint32_t toNode, - std::string fromNodeDescription, - std::string toNodeDescription, - std::string linkDescription); + std::string linkDescription, + std::string fromNodeDescription = "", + std::string toNodeDescription = ""); /**