A Discrete-Event Network Simulator
API
point-to-point-epc-helper.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011-2013 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jaume Nin <jnin@cttc.es>
19  * Nicola Baldo <nbaldo@cttc.es>
20  * Manuel Requena <manuel.requena@cttc.es>
21  */
22 
23 #include <ns3/point-to-point-epc-helper.h>
24 #include <ns3/log.h>
25 #include <ns3/inet-socket-address.h>
26 #include <ns3/mac48-address.h>
27 #include <ns3/string.h>
28 #include <ns3/boolean.h>
29 #include <ns3/eps-bearer.h>
30 #include <ns3/ipv4-address.h>
31 #include <ns3/internet-stack-helper.h>
32 #include <ns3/point-to-point-helper.h>
33 #include <ns3/packet-socket-helper.h>
34 #include <ns3/packet-socket-address.h>
35 #include <ns3/epc-enb-application.h>
36 #include <ns3/epc-sgw-pgw-application.h>
37 #include "ns3/ipv6-static-routing.h"
38 #include "ns3/ipv6-static-routing-helper.h"
39 #include <ns3/lte-enb-rrc.h>
40 #include <ns3/epc-x2.h>
41 #include <ns3/lte-enb-net-device.h>
42 #include <ns3/lte-ue-net-device.h>
43 #include <ns3/epc-mme.h>
44 #include <ns3/epc-ue-nas.h>
45 #include <ns3/ipv4-address-generator.h>
46 #include <ns3/ipv6-address-generator.h>
47 #include <ns3/icmpv6-l4-protocol.h>
48 
49 namespace ns3 {
50 
51 NS_LOG_COMPONENT_DEFINE ("PointToPointEpcHelper");
52 
53 NS_OBJECT_ENSURE_REGISTERED (PointToPointEpcHelper);
54 
55 
57  : m_gtpuUdpPort (2152) // fixed by the standard
58 {
59  NS_LOG_FUNCTION (this);
60  // To access the attribute value within the constructor
62 
63  // since we use point-to-point links for all S1-U links,
64  // we use a /30 subnet which can hold exactly two addresses
65  // (remember that net broadcast and null address are not valid)
66  m_s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.252");
67 
68  m_x2Ipv4AddressHelper.SetBase ("12.0.0.0", "255.255.255.252");
69 
70  // we use a /8 net for all UEs
71  m_uePgwAddressHelper.SetBase ("7.0.0.0", "255.0.0.0");
72 
73  // we use a /64 IPv6 net all UEs
74  m_uePgwAddressHelper6.SetBase ("7777:f00d::", Ipv6Prefix (64));
75 
76  // create SgwPgwNode
77  m_sgwPgw = CreateObject<Node> ();
78  InternetStackHelper internet;
79  internet.Install (m_sgwPgw);
80 
81  // The Tun device resides in different 64 bit subnet.
82  // We must create an unique route to tun device for all the packets destined
83  // to all 64 bit IPv6 prefixes of UEs, based by the unique 48 bit network prefix of this EPC network
84  Ipv6StaticRoutingHelper ipv6RoutingHelper;
85  Ptr<Ipv6StaticRouting> pgwStaticRouting = ipv6RoutingHelper.GetStaticRouting (m_sgwPgw->GetObject<Ipv6> ());
86  pgwStaticRouting->AddNetworkRouteTo ("7777:f00d::", Ipv6Prefix (64), Ipv6Address ("::"), 1, 0);
87 
88  // create S1-U socket
89  Ptr<Socket> sgwPgwS1uSocket = Socket::CreateSocket (m_sgwPgw, TypeId::LookupByName ("ns3::UdpSocketFactory"));
90  int retval = sgwPgwS1uSocket->Bind (InetSocketAddress (Ipv4Address::GetAny (), m_gtpuUdpPort));
91  NS_ASSERT (retval == 0);
92 
93  // create TUN device implementing tunneling of user data over GTP-U/UDP/IP
94  m_tunDevice = CreateObject<VirtualNetDevice> ();
95 
96  // allow jumbo packets
97  m_tunDevice->SetAttribute ("Mtu", UintegerValue (30000));
98 
99  // yes we need this
101 
103  NetDeviceContainer tunDeviceContainer;
104  tunDeviceContainer.Add (m_tunDevice);
105 
106  // the TUN device is on the same subnet as the UEs, so when a packet
107  // addressed to an UE arrives at the intenet to the WAN interface of
108  // the PGW it will be forwarded to the TUN device.
109  Ipv4InterfaceContainer tunDeviceIpv4IfContainer = AssignUeIpv4Address (tunDeviceContainer);
110 
111 
112  // the TUN device for IPv6 address is on the different subnet as the
113  // UEs, it will forward the UE packets as we have inserted the route
114  // for all UEs at the time of assigning UE addresses
115  Ipv6InterfaceContainer tunDeviceIpv6IfContainer = AssignUeIpv6Address (tunDeviceContainer);
116 
117 
118  //Set Forwarding of the IPv6 interface
119  tunDeviceIpv6IfContainer.SetForwarding (0,true);
120  tunDeviceIpv6IfContainer.SetDefaultRouteInAllNodes (0);
121 
122  // create EpcSgwPgwApplication
123  m_sgwPgwApp = CreateObject<EpcSgwPgwApplication> (m_tunDevice, sgwPgwS1uSocket);
125 
126  // connect SgwPgwApplication and virtual net device for tunneling
127  m_tunDevice->SetSendCallback (MakeCallback (&EpcSgwPgwApplication::RecvFromTunDevice, m_sgwPgwApp));
128 
129 
130  // Create MME and connect with SGW via S11 interface
131  m_mme = CreateObject<EpcMme> ();
132  m_mme->SetS11SapSgw (m_sgwPgwApp->GetS11SapSgw ());
133  m_sgwPgwApp->SetS11SapMme (m_mme->GetS11SapMme ());
134 }
135 
137 {
138  NS_LOG_FUNCTION (this);
139 }
140 
141 TypeId
143 {
144  static TypeId tid = TypeId ("ns3::PointToPointEpcHelper")
145  .SetParent<EpcHelper> ()
146  .SetGroupName("Lte")
147  .AddConstructor<PointToPointEpcHelper> ()
148  .AddAttribute ("S1uLinkDataRate",
149  "The data rate to be used for the next S1-U link to be created",
150  DataRateValue (DataRate ("10Gb/s")),
153  .AddAttribute ("S1uLinkDelay",
154  "The delay to be used for the next S1-U link to be created",
155  TimeValue (Seconds (0)),
157  MakeTimeChecker ())
158  .AddAttribute ("S1uLinkMtu",
159  "The MTU of the next S1-U link to be created. Note that, because of the additional GTP/UDP/IP tunneling overhead, you need a MTU larger than the end-to-end MTU that you want to support.",
160  UintegerValue (2000),
162  MakeUintegerChecker<uint16_t> ())
163  .AddAttribute ("X2LinkDataRate",
164  "The data rate to be used for the next X2 link to be created",
165  DataRateValue (DataRate ("10Gb/s")),
168  .AddAttribute ("X2LinkDelay",
169  "The delay to be used for the next X2 link to be created",
170  TimeValue (Seconds (0)),
172  MakeTimeChecker ())
173  .AddAttribute ("X2LinkMtu",
174  "The MTU of the next X2 link to be created. Note that, because of some big X2 messages, you need a big MTU.",
175  UintegerValue (3000),
177  MakeUintegerChecker<uint16_t> ())
178  .AddAttribute ("S1uLinkPcapPrefix",
179  "Prefix for Pcap generated by S1-U link",
180  StringValue ("s1-u"),
183  .AddAttribute ("X2LinkPcapPrefix",
184  "Prefix for Pcap generated by X2 link",
185  StringValue ("x2"),
188  .AddAttribute ("X2LinkEnablePcap",
189  "Enable Pcap for X2 link",
190  BooleanValue (false),
193  .AddAttribute ("S1uLinkEnablePcap",
194  "Enable Pcap for X2 link",
195  BooleanValue (false),
198  ;
199  return tid;
200 }
201 
202 TypeId
204 {
205  return GetTypeId ();
206 }
207 
208 void
210 {
211  NS_LOG_FUNCTION (this);
212  m_tunDevice->SetSendCallback (MakeNullCallback<bool, Ptr<Packet>, const Address&, const Address&, uint16_t> ());
213  m_tunDevice = 0;
214  m_sgwPgwApp = 0;
215  m_sgwPgw->Dispose ();
216 }
217 
218 
219 void
220 PointToPointEpcHelper::AddEnb (Ptr<Node> enb, Ptr<NetDevice> lteEnbNetDevice, uint16_t cellId)
221 {
222  NS_LOG_FUNCTION (this << enb << lteEnbNetDevice << cellId);
223 
224  NS_ASSERT (enb == lteEnbNetDevice->GetNode ());
225 
226  // add an IPv4 stack to the previously created eNB
227  InternetStackHelper internet;
228  internet.Install (enb);
229  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after node creation: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
230 
231  // create a point to point link between the new eNB and the SGW with
232  // the corresponding new NetDevices on each side
233  NodeContainer enbSgwNodes;
234  enbSgwNodes.Add (m_sgwPgw);
235  enbSgwNodes.Add (enb);
236  PointToPointHelper p2ph;
239  p2ph.SetChannelAttribute ("Delay", TimeValue (m_s1uLinkDelay));
240  NetDeviceContainer enbSgwDevices = p2ph.Install (enb, m_sgwPgw);
241  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after installing p2p dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
242  Ptr<NetDevice> enbDev = enbSgwDevices.Get (0);
243  Ptr<NetDevice> sgwDev = enbSgwDevices.Get (1);
244 
246  {
248  }
249 
251  Ipv4InterfaceContainer enbSgwIpIfaces = m_s1uIpv4AddressHelper.Assign (enbSgwDevices);
252  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
253 
254  Ipv4Address enbAddress = enbSgwIpIfaces.GetAddress (0);
255  Ipv4Address sgwAddress = enbSgwIpIfaces.GetAddress (1);
256 
257  // create S1-U socket for the ENB
258  Ptr<Socket> enbS1uSocket = Socket::CreateSocket (enb, TypeId::LookupByName ("ns3::UdpSocketFactory"));
259  int retval = enbS1uSocket->Bind (InetSocketAddress (enbAddress, m_gtpuUdpPort));
260  NS_ASSERT (retval == 0);
261 
262  // create LTE socket for the ENB
263  Ptr<Socket> enbLteSocket = Socket::CreateSocket (enb, TypeId::LookupByName ("ns3::PacketSocketFactory"));
264  PacketSocketAddress enbLteSocketBindAddress;
265  enbLteSocketBindAddress.SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
266  enbLteSocketBindAddress.SetProtocol (Ipv4L3Protocol::PROT_NUMBER);
267  retval = enbLteSocket->Bind (enbLteSocketBindAddress);
268  NS_ASSERT (retval == 0);
269  PacketSocketAddress enbLteSocketConnectAddress;
270  enbLteSocketConnectAddress.SetPhysicalAddress (Mac48Address::GetBroadcast ());
271  enbLteSocketConnectAddress.SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
272  enbLteSocketConnectAddress.SetProtocol (Ipv4L3Protocol::PROT_NUMBER);
273  retval = enbLteSocket->Connect (enbLteSocketConnectAddress);
274  NS_ASSERT (retval == 0);
275 
276  // create LTE socket for the ENB
277  Ptr<Socket> enbLteSocket6 = Socket::CreateSocket (enb, TypeId::LookupByName ("ns3::PacketSocketFactory"));
278  PacketSocketAddress enbLteSocketBindAddress6;
279  enbLteSocketBindAddress6.SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
280  enbLteSocketBindAddress6.SetProtocol (Ipv6L3Protocol::PROT_NUMBER);
281  retval = enbLteSocket6->Bind (enbLteSocketBindAddress6);
282  NS_ASSERT (retval == 0);
283  PacketSocketAddress enbLteSocketConnectAddress6;
284  enbLteSocketConnectAddress6.SetPhysicalAddress (Mac48Address::GetBroadcast ());
285  enbLteSocketConnectAddress6.SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
286  enbLteSocketConnectAddress6.SetProtocol (Ipv6L3Protocol::PROT_NUMBER);
287  retval = enbLteSocket6->Connect (enbLteSocketConnectAddress6);
288  NS_ASSERT (retval == 0);
289 
290  NS_LOG_INFO ("create EpcEnbApplication");
291  Ptr<EpcEnbApplication> enbApp = CreateObject<EpcEnbApplication> (enbLteSocket, enbLteSocket6, enbS1uSocket, enbAddress, sgwAddress, cellId);
292  enb->AddApplication (enbApp);
293  NS_ASSERT (enb->GetNApplications () == 1);
294  NS_ASSERT_MSG (enb->GetApplication (0)->GetObject<EpcEnbApplication> () != 0, "cannot retrieve EpcEnbApplication");
295  NS_LOG_LOGIC ("enb: " << enb << ", enb->GetApplication (0): " << enb->GetApplication (0));
296 
297 
298  NS_LOG_INFO ("Create EpcX2 entity");
299  Ptr<EpcX2> x2 = CreateObject<EpcX2> ();
300  enb->AggregateObject (x2);
301 
302  NS_LOG_INFO ("connect S1-AP interface");
303  m_mme->AddEnb (cellId, enbAddress, enbApp->GetS1apSapEnb ());
304  m_sgwPgwApp->AddEnb (cellId, enbAddress, sgwAddress);
305  enbApp->SetS1apSapMme (m_mme->GetS1apSapMme ());
306 }
307 
308 
309 void
311 {
312  NS_LOG_FUNCTION (this << enb1 << enb2);
313 
314  // Create a point to point link between the two eNBs with
315  // the corresponding new NetDevices on each side
316  NodeContainer enbNodes;
317  enbNodes.Add (enb1);
318  enbNodes.Add (enb2);
319  PointToPointHelper p2ph;
322  p2ph.SetChannelAttribute ("Delay", TimeValue (m_x2LinkDelay));
323  NetDeviceContainer enbDevices = p2ph.Install (enb1, enb2);
324  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #1 after installing p2p dev: " << enb1->GetObject<Ipv4> ()->GetNInterfaces ());
325  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #2 after installing p2p dev: " << enb2->GetObject<Ipv4> ()->GetNInterfaces ());
326  Ptr<NetDevice> enb1Dev = enbDevices.Get (0);
327  Ptr<NetDevice> enb2Dev = enbDevices.Get (1);
328 
329  if (m_enablePcapOverX2)
330  {
332  }
333 
335  Ipv4InterfaceContainer enbIpIfaces = m_x2Ipv4AddressHelper.Assign (enbDevices);
336  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #1 after assigning Ipv4 addr to X2 dev: " << enb1->GetObject<Ipv4> ()->GetNInterfaces ());
337  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #2 after assigning Ipv4 addr to X2 dev: " << enb2->GetObject<Ipv4> ()->GetNInterfaces ());
338 
339  Ipv4Address enb1X2Address = enbIpIfaces.GetAddress (0);
340  Ipv4Address enb2X2Address = enbIpIfaces.GetAddress (1);
341 
342  // Add X2 interface to both eNBs' X2 entities
343  Ptr<EpcX2> enb1X2 = enb1->GetObject<EpcX2> ();
344  Ptr<LteEnbNetDevice> enb1LteDev = enb1->GetDevice (0)->GetObject<LteEnbNetDevice> ();
345  uint16_t enb1CellId = enb1LteDev->GetCellId ();
346  NS_LOG_LOGIC ("LteEnbNetDevice #1 = " << enb1LteDev << " - CellId = " << enb1CellId);
347 
348  Ptr<EpcX2> enb2X2 = enb2->GetObject<EpcX2> ();
349  Ptr<LteEnbNetDevice> enb2LteDev = enb2->GetDevice (0)->GetObject<LteEnbNetDevice> ();
350  uint16_t enb2CellId = enb2LteDev->GetCellId ();
351  NS_LOG_LOGIC ("LteEnbNetDevice #2 = " << enb2LteDev << " - CellId = " << enb2CellId);
352 
353  enb1X2->AddX2Interface (enb1CellId, enb1X2Address, enb2CellId, enb2X2Address);
354  enb2X2->AddX2Interface (enb2CellId, enb2X2Address, enb1CellId, enb1X2Address);
355 
356  enb1LteDev->GetRrc ()->AddX2Neighbour (enb2LteDev->GetCellId ());
357  enb2LteDev->GetRrc ()->AddX2Neighbour (enb1LteDev->GetCellId ());
358 }
359 
360 
361 void
363 {
364  NS_LOG_FUNCTION (this << imsi << ueDevice );
365 
366  m_mme->AddUe (imsi);
367  m_sgwPgwApp->AddUe (imsi);
368 
369 
370 }
371 
372 uint8_t
374 {
375  NS_LOG_FUNCTION (this << ueDevice << imsi);
376 
377  // we now retrieve the IPv4/IPv6 address of the UE and notify it to the SGW;
378  // we couldn't do it before since address assignment is triggered by
379  // the user simulation program, rather than done by the EPC
380  Ptr<Node> ueNode = ueDevice->GetNode ();
381  Ptr<Ipv4> ueIpv4 = ueNode->GetObject<Ipv4> ();
382  Ptr<Ipv6> ueIpv6 = ueNode->GetObject<Ipv6> ();
383  NS_ASSERT_MSG (ueIpv4 != 0 || ueIpv6 != 0, "UEs need to have IPv4/IPv6 installed before EPS bearers can be activated");
384 
385  if (ueIpv4)
386  {
387  int32_t interface = ueIpv4->GetInterfaceForDevice (ueDevice);
388  if (interface >= 0 && ueIpv4->GetNAddresses (interface) == 1)
389  {
390  Ipv4Address ueAddr = ueIpv4->GetAddress (interface, 0).GetLocal ();
391  NS_LOG_LOGIC (" UE IPv4 address: " << ueAddr);
392  m_sgwPgwApp->SetUeAddress (imsi, ueAddr);
393  }
394  }
395  if (ueIpv6)
396  {
397  int32_t interface6 = ueIpv6->GetInterfaceForDevice (ueDevice);
398  if (interface6 >= 0 && ueIpv6->GetNAddresses (interface6) == 2)
399  {
400  Ipv6Address ueAddr6 = ueIpv6->GetAddress (interface6, 1).GetAddress ();
401  NS_LOG_LOGIC (" UE IPv6 address: " << ueAddr6);
402  m_sgwPgwApp->SetUeAddress6 (imsi, ueAddr6);
403  }
404  }
405  uint8_t bearerId = m_mme->AddBearer (imsi, tft, bearer);
406  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
407  if (ueLteDevice)
408  {
409  Simulator::ScheduleNow (&EpcUeNas::ActivateEpsBearer, ueLteDevice->GetNas (), bearer, tft);
410  }
411  return bearerId;
412 }
413 
414 Ptr<Node>
416 {
417  return m_sgwPgw;
418 }
419 
422 {
423  return m_uePgwAddressHelper.Assign (ueDevices);
424 }
425 
428 {
429  for (NetDeviceContainer::Iterator iter = ueDevices.Begin ();
430  iter != ueDevices.End ();
431  iter ++)
432  {
433  Ptr<Icmpv6L4Protocol> icmpv6 = (*iter)->GetNode ()->GetObject<Icmpv6L4Protocol> ();
434  icmpv6->SetAttribute ("DAD", BooleanValue (false));
435  }
436  return m_uePgwAddressHelper6.Assign (ueDevices);
437 }
438 
441 {
442  // return the address of the tun device
443  return m_sgwPgw->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();
444 }
445 
448 {
449  // return the address of the tun device
450  return m_sgwPgw->GetObject<Ipv6> ()->GetAddress (1, 1).GetAddress ();
451 }
452 
453 } // namespace ns3
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:157
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
void ActivateEpsBearer(EpsBearer bearer, Ptr< EpcTft > tft)
Activate an EPS bearer.
Definition: epc-ue-nas.cc:187
DataRate m_s1uLinkDataRate
The data rate to be used for the next S1-U link to be created.
an Inet address class
static Ipv4Address GetAny(void)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Ptr< EpcMme > m_mme
MME network element.
uint32_t GetNApplications(void) const
Definition: node.cc:176
Keep track of a set of IPv6 interfaces.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uint16_t GetCellId() const
static TypeId GetTypeId(void)
Register this type.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:81
Hold variables of type string.
Definition: string.h:41
void SetDefaultRouteInAllNodes(uint32_t router)
Set the default route for all the devices (except the router itself).
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
uint16_t m_s1uLinkMtu
The MTU of the next S1-U link to be created.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:84
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
an address for a packet socket
std::string m_s1uLinkPcapPrefix
Prefix for the PCAP file for the S1 link.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
Ptr< Ipv6StaticRouting > GetStaticRouting(Ptr< Ipv6 > ipv6) const
Get Ipv6StaticRouting pointer from IPv6 stack.
virtual void AddUe(Ptr< NetDevice > ueLteDevice, uint64_t imsi)
Notify the EPC of the existence of a new UE which might attach at a later time.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
aggregate IP/TCP/UDP functionality to existing Nodes.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ptr< EpcSgwPgwApplication > m_sgwPgwApp
SGW-PGW application.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
Callback< R > MakeNullCallback(void)
Definition: callback.h:1635
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
void SetForwarding(uint32_t i, bool state)
Set the state of the stack (act as a router or as an host) for the specified index.
a polymophic address class
Definition: address.h:90
Ptr< const AttributeChecker > MakeDataRateChecker(void)
Definition: data-rate.cc:30
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
Class for representing data rates.
Definition: data-rate.h:88
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
Ptr< Application > GetApplication(uint32_t index) const
Retrieve the index-th Application associated to this node.
Definition: node.cc:168
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
Time m_s1uLinkDelay
The delay to be used for the next S1-U link to be created.
AttributeValue implementation for Time.
Definition: nstime.h:1069
virtual uint8_t ActivateEpsBearer(Ptr< NetDevice > ueLteDevice, uint64_t imsi, Ptr< EpcTft > tft, EpsBearer bearer)
Activate an EPS bearer, setting up the corresponding S1-U tunnel.
bool RecvFromTunDevice(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Method to be assigned to the callback of the Gi TUN VirtualNetDevice.
virtual Ipv6InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Get IPv6 address on specified IPv6 interface.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Hold an unsigned integer type.
Definition: uinteger.h:44
virtual void SetAddress(Address address)
Set the address of this interface.
List of Attribute name, value and checker triples used to construct Objects.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
static Mac48Address GetBroadcast(void)
Ipv4AddressHelper m_uePgwAddressHelper
helper to assign IPv4 addresses to UE devices as well as to the TUN device of the SGW/PGW ...
An implementation of the ICMPv6 protocol.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:71
virtual void DoDispose()
Destructor implementation.
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: data-rate.h:242
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Ipv4AddressHelper m_x2Ipv4AddressHelper
helper to assign addresses to X2 NetDevices
Base helper class to handle the creation of the EPC entities.
Definition: epc-helper.h:51
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
keep track of a set of node pointers.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
Definition: epc-x2.h:99
Helper class that adds ns3::Ipv6StaticRouting objects.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
std::string m_x2LinkPcapPrefix
Prefix for the PCAP file for the X2 link.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
Definition: object-base.cc:80
Create an EPC network with PointToPoint links.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Time m_x2LinkDelay
The delay to be used for the next X2 link to be created.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1570
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: nstime.h:1070
uint16_t m_gtpuUdpPort
UDP port where the GTP-U Socket is bound, fixed by the standard as 2152.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
Ipv6AddressHelper m_uePgwAddressHelper6
helper to assign IPv6 addresses to UE devices as well as to the TUN device of the SGW/PGW ...
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
Ipv4AddressHelper m_s1uIpv4AddressHelper
S1-U interfaces.
Describes an IPv6 address.
Definition: ipv6-address.h:49
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:128
Ipv6InterfaceContainer AssignUeIpv6Address(NetDeviceContainer ueDevices)
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
virtual ~PointToPointEpcHelper()
Destructor.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1007
void SetProtocol(uint16_t protocol)
Set the protocol.
DataRate m_x2LinkDataRate
The data rate to be used for the next X2 link to be created.
virtual void AddX2Interface(Ptr< Node > enbNode1, Ptr< Node > enbNode2)
Add an X2 interface between two eNB.
Describes an IPv6 prefix.
Definition: ipv6-address.h:428
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
uint16_t m_x2LinkMtu
The MTU of the next X2 link to be created.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: string.h:42
void SetSendCallback(SendCallback transmitCb)
Set the user callback to be called when a L2 packet is to be transmitted.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
The eNodeB device implementation.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
virtual uint32_t GetNInterfaces(void) const =0
static const uint16_t PROT_NUMBER
Protocol number (0x0800)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
bool m_enablePcapOverX2
Enable PCAP generation for X2 link.
Ptr< VirtualNetDevice > m_tunDevice
TUN device implementing tunneling of user data over GTP-U/UDP/IP.
Ptr< Node > m_sgwPgw
SGW-PGW network element.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:824
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
bool m_enablePcapOverS1U
Enable PCAP generation for S1U link.
The LteUeNetDevice class implements the UE net device.