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-2019 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  * (most of the code refactored to no-backhaul-epc-helper.cc)
22  */
23 
24 #include "ns3/boolean.h"
25 #include "ns3/string.h"
26 #include "ns3/log.h"
27 #include "ns3/point-to-point-helper.h"
28 
29 #include "ns3/point-to-point-epc-helper.h"
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("PointToPointEpcHelper");
34 
35 NS_OBJECT_ENSURE_REGISTERED (PointToPointEpcHelper);
36 
37 
40 {
41  NS_LOG_FUNCTION (this);
42  // To access the attribute value within the constructor
44 
45  // since we use point-to-point links for the backhaul links,
46  // we use a /30 subnet which can hold exactly two addresses
47  // (remember that net broadcast and null address are not valid)
48  m_s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.252");
49  m_s1apIpv4AddressHelper.SetBase ("11.0.0.0", "255.255.255.252");
50 }
51 
53 {
54  NS_LOG_FUNCTION (this);
55 }
56 
57 TypeId
59 {
61  static TypeId tid = TypeId ("ns3::PointToPointEpcHelper")
63  .SetGroupName ("Lte")
64  .AddConstructor<PointToPointEpcHelper> ()
65  .AddAttribute ("S1uLinkDataRate",
66  "The data rate to be used for the next S1-U link to be created",
67  DataRateValue (DataRate ("10Gb/s")),
70  .AddAttribute ("S1uLinkDelay",
71  "The delay to be used for the next S1-U link to be created",
72  TimeValue (Seconds (0)),
74  MakeTimeChecker ())
75  .AddAttribute ("S1uLinkMtu",
76  "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.",
77  UintegerValue (2000),
79  MakeUintegerChecker<uint16_t> ())
80  .AddAttribute ("S1uLinkPcapPrefix",
81  "Prefix for Pcap generated by S1-U link",
82  StringValue ("s1u"),
85  .AddAttribute ("S1uLinkEnablePcap",
86  "Enable Pcap for X2 link",
87  BooleanValue (false),
90  ;
91  return tid;
92 }
93 
94 TypeId
96 {
97  return GetTypeId ();
98 }
99 
100 void
102 {
103  NS_LOG_FUNCTION (this);
105 }
106 
107 
108 void
109 PointToPointEpcHelper::AddEnb (Ptr<Node> enb, Ptr<NetDevice> lteEnbNetDevice, uint16_t cellId)
110 {
111  NS_LOG_FUNCTION (this << enb << lteEnbNetDevice << cellId);
112 
113  NoBackhaulEpcHelper::AddEnb (enb, lteEnbNetDevice, cellId);
114 
115  // create a point to point link between the eNB and the SGW with
116  // the corresponding new NetDevices on each side
117  Ptr<Node> sgw = GetSgwNode ();
118 
119  PointToPointHelper p2ph;
122  p2ph.SetChannelAttribute ("Delay", TimeValue (m_s1uLinkDelay));
123  NetDeviceContainer enbSgwDevices = p2ph.Install (enb, sgw);
124  NS_LOG_LOGIC ("Ipv4 ifaces of the eNB after installing p2p dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
125 
127  {
129  }
130 
132  Ipv4InterfaceContainer enbSgwIpIfaces = m_s1uIpv4AddressHelper.Assign (enbSgwDevices);
133  NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
134 
135  Ipv4Address enbS1uAddress = enbSgwIpIfaces.GetAddress (0);
136  Ipv4Address sgwS1uAddress = enbSgwIpIfaces.GetAddress (1);
137 
138  NoBackhaulEpcHelper::AddS1Interface (enb, enbS1uAddress, sgwS1uAddress, cellId);
139 }
140 
141 } // namespace ns3
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::DataRateValue
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
ns3::PointToPointEpcHelper::PointToPointEpcHelper
PointToPointEpcHelper()
Constructor.
Definition: point-to-point-epc-helper.cc:38
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::Ipv4AddressHelper::NewNetwork
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
Definition: ipv4-address-helper.cc:126
ns3::PointToPointEpcHelper::m_s1uLinkEnablePcap
bool m_s1uLinkEnablePcap
Enable PCAP generation for S1 link.
Definition: point-to-point-epc-helper.h:101
ns3::PointToPointEpcHelper::AddEnb
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
Definition: point-to-point-epc-helper.cc:109
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeDataRateAccessor
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:298
ns3::PointToPointHelper::SetDeviceAttribute
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
Definition: point-to-point-helper.cc:69
ns3::PointToPointHelper::SetChannelAttribute
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Definition: point-to-point-helper.cc:75
ns3::NoBackhaulEpcHelper::AddEnb
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
Definition: no-backhaul-epc-helper.cc:310
ns3::PointToPointEpcHelper::m_s1apIpv4AddressHelper
Ipv4AddressHelper m_s1apIpv4AddressHelper
Helper to assign addresses to S1-MME NetDevices.
Definition: point-to-point-epc-helper.h:96
ns3::PcapHelperForDevice::EnablePcapAll
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 ...
Definition: trace-helper.cc:439
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
ns3::PointToPointHelper::Install
NetDeviceContainer Install(NodeContainer c)
Definition: point-to-point-helper.cc:222
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::MakeBooleanAccessor
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:85
ns3::PointToPointEpcHelper::m_s1uIpv4AddressHelper
Ipv4AddressHelper m_s1uIpv4AddressHelper
S1-U interfaces.
Definition: point-to-point-epc-helper.h:73
ns3::ObjectBase::ConstructSelf
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
Definition: object-base.cc:80
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::PointToPointEpcHelper::m_s1uLinkPcapPrefix
std::string m_s1uLinkPcapPrefix
Prefix for the PCAP file for the S1 link.
Definition: point-to-point-epc-helper.h:106
ns3::PointToPointEpcHelper::GetInstanceTypeId
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: point-to-point-epc-helper.cc:95
ns3::PointToPointEpcHelper::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: point-to-point-epc-helper.cc:101
ns3::Ipv4AddressHelper::SetBase
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Definition: ipv4-address-helper.cc:64
ns3::Ipv4
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
ns3::Ptr< Node >
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
ns3::NoBackhaulEpcHelper::DoDispose
virtual void DoDispose()
Destructor implementation.
Definition: no-backhaul-epc-helper.cc:295
ns3::PointToPointEpcHelper::m_s1uLinkDelay
Time m_s1uLinkDelay
The delay to be used for the next S1-U link to be created.
Definition: point-to-point-epc-helper.h:83
ns3::PointToPointEpcHelper::~PointToPointEpcHelper
virtual ~PointToPointEpcHelper()
Destructor.
Definition: point-to-point-epc-helper.cc:52
ns3::NoBackhaulEpcHelper::AddS1Interface
virtual void AddS1Interface(Ptr< Node > enb, Ipv4Address enbAddress, Ipv4Address sgwAddress, uint16_t cellId=0)
Add an S1 interface between an eNB and a SGW.
Definition: no-backhaul-epc-helper.cc:545
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition: ipv4-interface-container.h:55
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::NoBackhaulEpcHelper
Create an EPC network with PointToPoint links between the core network nodes.
Definition: no-backhaul-epc-helper.h:47
ns3::PointToPointEpcHelper::m_s1uLinkDataRate
DataRate m_s1uLinkDataRate
The data rate to be used for the next S1-U link to be created.
Definition: point-to-point-epc-helper.h:78
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log-macros-enabled.h:209
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::Ipv4AddressHelper::Assign
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Definition: ipv4-address-helper.cc:135
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::PointToPointHelper
Build a set of PointToPointNetDevice objects.
Definition: point-to-point-helper.h:45
ns3::MakeStringChecker
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
ns3::Ipv4InterfaceContainer::GetAddress
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Definition: ipv4-interface-container.cc:59
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::MakeUintegerAccessor
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
ns3::Ipv4::GetNInterfaces
virtual uint32_t GetNInterfaces(void) const =0
ns3::PointToPointEpcHelper::m_s1uLinkMtu
uint16_t m_s1uLinkMtu
The MTU of the next S1-U link to be created.
Definition: point-to-point-epc-helper.h:91
ns3::PointToPointEpcHelper
Create an EPC network with PointToPoint links in the backhaul network.
Definition: point-to-point-epc-helper.h:39
ns3::AttributeConstructionList
List of Attribute name, value and checker triples used to construct Objects.
Definition: attribute-construction-list.h:40
ns3::PointToPointEpcHelper::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: point-to-point-epc-helper.cc:58
ns3::MakeStringAccessor
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
ns3::MakeDataRateChecker
Ptr< const AttributeChecker > MakeDataRateChecker(void)
Definition: data-rate.cc:30
ns3::NoBackhaulEpcHelper::GetSgwNode
virtual Ptr< Node > GetSgwNode() const
Get the SGW node.
Definition: no-backhaul-epc-helper.cc:538
ns3::MakeTimeAccessor
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:1354