Print node ID and time when printing routing tables

This commit is contained in:
Tommaso Pecorella
2015-11-06 23:09:19 +01:00
parent a0dc9ea83a
commit 79982e8cf4
11 changed files with 73 additions and 20 deletions

View File

@@ -22,12 +22,15 @@ To be determined.
New user-visible features
-------------------------
(internet) The native TCP implementation has been refactored, for the following
improvements: 1) congestion control has been aligned with the Linux
architecture, to facilitate easier coding of new congestion control algorithms
or porting implementations from the Linux kernel, 2) Fast Retransmit and Fast
recovery algorithms, compliant to RFCs, are shared by all TCP variants, unlike
previous releases. 3) TCP Hybla and TCP HighSpeed have been added.
- (internet) The native TCP implementation has been refactored, for the following
improvements: 1) congestion control has been aligned with the Linux
architecture, to facilitate easier coding of new congestion control algorithms
or porting implementations from the Linux kernel, 2) Fast Retransmit and Fast
recovery algorithms, compliant to RFCs, are shared by all TCP variants, unlike
previous releases. 3) TCP Hybla and TCP HighSpeed have been added.
- (general) The PrintRoutingTable* functions now print the following informations
each time they are called: 1) the node ID, 2) the global time, 3) the local time
4) the routing protocol type
Bugs fixed
----------

View File

@@ -298,8 +298,13 @@ RoutingProtocol::DoDispose ()
void
RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId () << " Time: " << Simulator::Now ().GetSeconds () << "s ";
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< "; Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", AODV Routing table" << std::endl;
m_routingTable.Print (stream);
*stream->GetStream () << std::endl;
}
int64_t

View File

@@ -231,8 +231,13 @@ RoutingProtocol::DoDispose ()
void
RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId () << " Time: " << Simulator::Now ().GetSeconds () << "s ";
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", DSDV Routing table" << std::endl;
m_routingTable.Print (stream);
*stream->GetStream () << std::endl;
}
void

View File

@@ -27,6 +27,7 @@
#include "ns3/ipv4-route.h"
#include "ns3/ipv4-routing-table-entry.h"
#include "ns3/boolean.h"
#include "ns3/node.h"
#include "ipv4-global-routing.h"
#include "global-route-manager.h"
@@ -401,6 +402,12 @@ Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Ipv4GlobalRouting table" << std::endl;
if (GetNRoutes () > 0)
{
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
@@ -441,6 +448,7 @@ Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
*os << std::endl;
}
}
*os << std::endl;
}
Ptr<Ipv4Route>

View File

@@ -74,15 +74,15 @@ Ipv4ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
NS_LOG_FUNCTION (this << stream);
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< " Time: " << Simulator::Now ().GetSeconds () << "s "
<< "Ipv4ListRouting table" << std::endl;
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Ipv4ListRouting table" << std::endl;
for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
i != m_routingProtocols.end (); i++)
{
*stream->GetStream () << " Priority: " << (*i).first << " Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
(*i).second->PrintRoutingTable (stream);
}
*stream->GetStream () << std::endl;
}
void

View File

@@ -712,6 +712,12 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Ipv4StaticRouting table" << std::endl;
if (GetNRoutes () > 0)
{
*os << "Destination Gateway Genmask Flags Metric Ref Use Iface" << std::endl;
@@ -751,6 +757,7 @@ Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
*os << std::endl;
}
}
*os << std::endl;
}
Ipv4Address
Ipv4StaticRouting::SourceAddressSelection (uint32_t interfaceIdx, Ipv4Address dest)

View File

@@ -277,15 +277,15 @@ Ipv6ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
NS_LOG_FUNCTION (this);
*stream->GetStream () << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
<< " Time: " << Simulator::Now ().GetSeconds () << "s "
<< "Ipv6ListRouting table" << std::endl;
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Ipv6ListRouting table" << std::endl;
for (Ipv6RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
i != m_routingProtocols.end (); i++)
{
*stream->GetStream () << " Priority: " << (*i).first << " Protocol: " << (*i).second->GetInstanceTypeId () << std::endl;
(*i).second->PrintRoutingTable (stream);
}
*stream->GetStream () << std::endl;
}
void

View File

@@ -85,8 +85,9 @@ Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
<< " Time: " << Simulator::Now ().GetSeconds () << "s "
<< "Ipv6StaticRouting table" << std::endl;
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Ipv6StaticRouting table" << std::endl;
if (GetNRoutes () > 0)
{
@@ -125,6 +126,7 @@ Ipv6StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
*os << std::endl;
}
}
*os << std::endl;
}
void Ipv6StaticRouting::AddHostRouteTo (Ipv6Address dst, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse, uint32_t metric)

View File

@@ -488,8 +488,9 @@ void RipNg::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv6->GetObject<Node> ()->GetId ()
<< " Time: " << Simulator::Now ().GetSeconds () << "s "
<< "Ipv6 RIPng table" << std::endl;
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", IPv6 RIPng table" << std::endl;
if (!m_routes.empty ())
{
@@ -534,6 +535,7 @@ void RipNg::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
}
}
}
*os << std::endl;
}
void RipNg::DoDispose ()

View File

@@ -677,6 +677,12 @@ Ipv4NixVectorRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
CheckCacheStateAndFlush ();
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", Nix Routing" << std::endl;
*os << "NixCache:" << std::endl;
if (m_nixCache.size () > 0)
{
@@ -714,6 +720,7 @@ Ipv4NixVectorRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
*os << std::endl;
}
}
*os << std::endl;
}
// virtual functions from Ipv4RoutingProtocol

View File

@@ -254,6 +254,12 @@ void
RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
std::ostream* os = stream->GetStream ();
*os << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< ", Time: " << Now().As (Time::S)
<< ", Local time: " << GetObject<Node> ()->GetLocalTime ().As (Time::S)
<< ", OLSR Routing table" << std::endl;
*os << "Destination\t\tNextHop\t\tInterface\tDistance\n";
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin ();
@@ -272,9 +278,17 @@ RoutingProtocol::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
*os << iter->second.distance << "\t";
*os << "\n";
}
// Also print the HNA routing table
*os << " HNA Routing Table:\n";
m_hnaRoutingTable->PrintRoutingTable (stream);
if (m_hnaRoutingTable->GetNRoutes () > 0)
{
*os << " HNA Routing Table: ";
m_hnaRoutingTable->PrintRoutingTable (stream);
}
else
{
*os << " HNA Routing Table: empty" << std::endl;
}
}
void RoutingProtocol::DoInitialize ()