27 #include "ns3/point-to-point-dumbbell.h"
28 #include "ns3/constant-position-mobility-model.h"
30 #include "ns3/node-list.h"
31 #include "ns3/point-to-point-net-device.h"
32 #include "ns3/vector.h"
33 #include "ns3/ipv6-address-generator.h"
48 m_leftLeaf.
Create (nLeftLeaf);
49 m_rightLeaf.
Create (nRightLeaf);
52 m_routerDevices = bottleneckHelper.
Install (m_routers);
54 for (uint32_t i = 0; i < nLeftLeaf; ++i)
58 m_leftRouterDevices.
Add (c.
Get (0));
59 m_leftLeafDevices.
Add (c.
Get (1));
62 for (uint32_t i = 0; i < nRightLeaf; ++i)
66 m_rightRouterDevices.
Add (c.
Get (0));
67 m_rightLeafDevices.
Add (c.
Get (1));
71 PointToPointDumbbellHelper::~PointToPointDumbbellHelper ()
77 return m_routers.
Get (0);
82 return m_leftLeaf.
Get (i);
87 return m_routers.
Get (1);
92 return m_rightLeaf.
Get (i);
107 return m_leftLeafInterfaces6.
GetAddress (i, 1);
112 return m_rightLeafInterfaces6.
GetAddress (i, 1);
117 return m_leftLeaf.
GetN ();
122 return m_rightLeaf.
GetN ();
137 m_routerInterfaces = routerIp.
Assign (m_routerDevices);
139 for (uint32_t i = 0; i <
LeftCount (); ++i)
142 ndc.
Add (m_leftLeafDevices.
Get (i));
143 ndc.
Add (m_leftRouterDevices.
Get (i));
145 m_leftLeafInterfaces.
Add (ifc.
Get (0));
146 m_leftRouterInterfaces.
Add (ifc.
Get (1));
153 ndc.
Add (m_rightLeafDevices.
Get (i));
154 ndc.
Add (m_rightRouterDevices.
Get (i));
156 m_rightLeafInterfaces.
Add (ifc.
Get (0));
157 m_rightRouterInterfaces.
Add (ifc.
Get (1));
170 addressHelper.
SetBase (v6network, prefix);
171 m_routerInterfaces6 = addressHelper.
Assign (m_routerDevices);
175 for (uint32_t i = 0; i <
LeftCount (); ++i)
178 addressHelper.
SetBase (v6network, prefix);
181 ndc.
Add (m_leftLeafDevices.
Get (i));
182 ndc.
Add (m_leftRouterDevices.
Get (i));
184 Ipv6InterfaceContainer::Iterator it = ifc.
Begin ();
185 m_leftLeafInterfaces6.
Add ((*it).first, (*it).second);
187 m_leftRouterInterfaces6.
Add ((*it).first, (*it).second);
194 addressHelper.
SetBase (v6network, prefix);
197 ndc.
Add (m_rightLeafDevices.
Get (i));
198 ndc.
Add (m_rightRouterDevices.
Get (i));
200 Ipv6InterfaceContainer::Iterator it = ifc.
Begin ();
201 m_rightLeafInterfaces6.
Add ((*it).first, (*it).second);
203 m_rightRouterInterfaces6.
Add ((*it).first, (*it).second);
210 double lrx,
double lry)
231 double xAdder = xDist / 3.0;
232 double thetaL = M_PI / (
LeftCount () + 1.0);
240 loc = CreateObject<ConstantPositionMobilityModel> ();
243 Vector lrl (ulx + xAdder, uly + yDist/2.0, 0);
244 loc->SetPosition (lrl);
251 loc = CreateObject<ConstantPositionMobilityModel> ();
254 Vector rrl (ulx + xAdder * 2, uly + yDist/2.0, 0);
255 loc->SetPosition (rrl);
258 double theta = -M_PI_2 + thetaL;
259 for (uint32_t l = 0; l <
LeftCount (); ++l)
263 if ((LeftCount () % 2) == 1)
265 if (l == (LeftCount () / 2))
274 loc = CreateObject<ConstantPositionMobilityModel> ();
277 Vector lnl (lrl.
x - std::cos (theta) * xAdder,
278 lrl.
y + std::sin (theta) * xAdder, 0);
288 loc->SetPosition (lnl);
292 theta = -M_PI_2 + thetaR;
296 if ((RightCount () % 2) == 1)
298 if (r == (RightCount () / 2))
307 loc = CreateObject<ConstantPositionMobilityModel> ();
310 Vector rnl (rrl.
x + std::cos (theta) * xAdder,
311 rrl.
y + std::sin (theta) * xAdder, 0);
321 loc->SetPosition (rnl);
Ipv4Address GetRightIpv4Address(uint32_t i) const
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const
Keep track of a set of IPv6 interfaces.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
void BoundingBox(double ulx, double uly, double lrx, double lry)
void Add(Ptr< Ipv6 > ipv6, uint32_t interface)
Add a couple IPv6/interface.
Mobility model for which the current position does not change once it has been set and until it is se...
#define NS_LOG_COMPONENT_DEFINE(name)
aggregate IP/TCP/UDP functionality to existing Nodes.
static Ipv6Address NextNetwork(const Ipv6Prefix prefix)
Get the next network acoording to the given Ipv6Prefix.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ptr< Node > GetRight() const
Build a set of PointToPointNetDevice objects.
Ptr< Node > GetLeft() const
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
static void Init(const Ipv6Address net, const Ipv6Prefix prefix, const Ipv6Address interfaceId="::1")
Initialise the base network and interfaceId for the generator.
holds a vector of ns3::NetDevice pointers
Ipv6Address GetRightIpv6Address(uint32_t i) const
void AggregateObject(Ptr< Object > other)
uint32_t LeftCount() const
void Install(std::string nodeName) const
void AssignIpv4Addresses(Ipv4AddressHelper leftIp, Ipv4AddressHelper rightIp, Ipv4AddressHelper routerIp)
Helper class to auto-assign global IPv6 unicast addresses.
Describes an IPv6 address.
uint32_t RightCount() const
Ipv4 addresses are stored in host order in this class.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void InstallStack(InternetStackHelper stack)
Ipv6Address GetLeftIpv6Address(uint32_t i) const
Iterator Begin(void) const
Get an iterator which refers to the first pair in the container.
Describes an IPv6 prefix. It is just a bitmask like Ipv4Mask.
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void AssignIpv6Addresses(Ipv6Address network, Ipv6Prefix prefix)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(Ipv4InterfaceContainer other)
Ipv4Address GetLeftIpv4Address(uint32_t i) const
Ptr< T > GetObject(void) const
PointToPointDumbbellHelper(uint32_t nLeftLeaf, PointToPointHelper leftHelper, uint32_t nRightLeaf, PointToPointHelper rightHelper, PointToPointHelper bottleneckHelper)
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
static Ipv6Address GetNetwork(const Ipv6Prefix prefix)
Get the current network of the given Ipv6Prefix.