internet: install the default TC configuration (pfifo_fast) on every device by default

This commit is contained in:
Stefano Avallone
2016-03-08 10:45:49 -08:00
parent 7e4d58c204
commit a826db4fbb
2 changed files with 45 additions and 0 deletions

View File

@@ -21,9 +21,12 @@
#include "ns3/ptr.h"
#include "ns3/node.h"
#include "ns3/net-device.h"
#include "ns3/loopback-net-device.h"
#include "ns3/ipv4.h"
#include "ns3/ipv4-address-generator.h"
#include "ns3/simulator.h"
#include "ns3/traffic-control-helper.h"
#include "ns3/traffic-control-layer.h"
#include "ipv4-address-helper.h"
namespace ns3 {
@@ -157,6 +160,19 @@ Ipv4AddressHelper::Assign (const NetDeviceContainer &c)
ipv4->SetMetric (interface, 1);
ipv4->SetUp (interface);
retval.Add (ipv4, interface);
Ptr<TrafficControlLayer> tc = node->GetObject<TrafficControlLayer> ();
NS_ASSERT_MSG (tc, "Ipv4AddressHelper::Assign(): NetDevice is associated"
"with a node without the Traffic Control layer installed");
// Install the default traffic control configuration, if this is not a loopback
// interface and there is no queue disc installed already
if (DynamicCast<LoopbackNetDevice> (device) == 0 && tc->GetRootQueueDiscOnDevice (device) == 0)
{
TrafficControlHelper tcHelper = TrafficControlHelper::Default ();
tcHelper.Install (device);
}
}
return retval;
}

View File

@@ -23,11 +23,14 @@
#include "ns3/ptr.h"
#include "ns3/node.h"
#include "ns3/net-device.h"
#include "ns3/loopback-net-device.h"
#include "ns3/mac16-address.h"
#include "ns3/mac48-address.h"
#include "ns3/mac64-address.h"
#include "ns3/ipv6.h"
#include "ns3/ipv6-address-generator.h"
#include "ns3/traffic-control-helper.h"
#include "ns3/traffic-control-layer.h"
#include "ipv6-address-helper.h"
@@ -140,6 +143,19 @@ Ipv6InterfaceContainer Ipv6AddressHelper::Assign (const NetDeviceContainer &c)
ipv6->SetUp (ifIndex);
retval.Add (ipv6, ifIndex);
Ptr<TrafficControlLayer> tc = node->GetObject<TrafficControlLayer> ();
NS_ASSERT_MSG (tc, "Ipv6AddressHelper::Assign(): NetDevice is associated"
"with a node without the Traffic Control layer installed");
// Install the default traffic control configuration, if this is not a loopback
// interface and there is no queue disc installed already
if (DynamicCast<LoopbackNetDevice> (device) == 0 && tc->GetRootQueueDiscOnDevice (device) == 0)
{
TrafficControlHelper tcHelper = TrafficControlHelper::Default ();
tcHelper.Install (device);
}
}
return retval;
}
@@ -176,6 +192,19 @@ Ipv6InterfaceContainer Ipv6AddressHelper::Assign (const NetDeviceContainer &c, s
ipv6->SetUp (ifIndex);
retval.Add (ipv6, ifIndex);
Ptr<TrafficControlLayer> tc = node->GetObject<TrafficControlLayer> ();
NS_ASSERT_MSG (tc, "Ipv6AddressHelper::Assign(): NetDevice is associated"
"with a node without the Traffic Control layer installed");
// Install the default traffic control configuration, if this is not a loopback
// interface and there is no queue disc installed already
if (DynamicCast<LoopbackNetDevice> (device) == 0 && tc->GetRootQueueDiscOnDevice (device) == 0)
{
TrafficControlHelper tcHelper = TrafficControlHelper::Default ();
tcHelper.Install (device);
}
}
return retval;
}