A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
point-to-point-epc-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors:
7 * Jaume Nin <jnin@cttc.es>
8 * Nicola Baldo <nbaldo@cttc.es>
9 * Manuel Requena <manuel.requena@cttc.es>
10 * (most of the code refactored to no-backhaul-epc-helper.cc)
11 */
12
14
15#include "ns3/boolean.h"
16#include "ns3/log.h"
17#include "ns3/point-to-point-helper.h"
18#include "ns3/string.h"
19
20namespace ns3
21{
22
23NS_LOG_COMPONENT_DEFINE("PointToPointEpcHelper");
24
25NS_OBJECT_ENSURE_REGISTERED(PointToPointEpcHelper);
26
29{
30 NS_LOG_FUNCTION(this);
31 // To access the attribute value within the constructor
33
34 // since we use point-to-point links for the backhaul links,
35 // we use a /30 subnet which can hold exactly two addresses
36 // (remember that net broadcast and null address are not valid)
37 m_s1uIpv4AddressHelper.SetBase("10.0.0.0", "255.255.255.252");
38 m_s1apIpv4AddressHelper.SetBase("11.0.0.0", "255.255.255.252");
39}
40
45
48{
50 static TypeId tid =
51 TypeId("ns3::PointToPointEpcHelper")
53 .SetGroupName("Lte")
54 .AddConstructor<PointToPointEpcHelper>()
55 .AddAttribute("S1uLinkDataRate",
56 "The data rate to be used for the next S1-U link to be created",
57 DataRateValue(DataRate("10Gb/s")),
60 .AddAttribute("S1uLinkDelay",
61 "The delay to be used for the next S1-U link to be created",
65 .AddAttribute("S1uLinkMtu",
66 "The MTU of the next S1-U link to be created. Note that, because of the "
67 "additional GTP/UDP/IP tunneling overhead, you need a MTU larger than "
68 "the end-to-end MTU that you want to support.",
69 UintegerValue(2000),
72 .AddAttribute("S1uLinkPcapPrefix",
73 "Prefix for Pcap generated by S1-U link",
74 StringValue("s1u"),
77 .AddAttribute("S1uLinkEnablePcap",
78 "Enable Pcap for X2 link",
79 BooleanValue(false),
82 return tid;
83}
84
90
91void
97
98void
100 Ptr<NetDevice> lteEnbNetDevice,
101 std::vector<uint16_t> cellIds)
102{
103 NS_LOG_FUNCTION(this << enb << lteEnbNetDevice << cellIds.size());
104
105 NoBackhaulEpcHelper::AddEnb(enb, lteEnbNetDevice, cellIds);
106
107 // create a point to point link between the eNB and the SGW with
108 // the corresponding new NetDevices on each side
109 Ptr<Node> sgw = GetSgwNode();
110
115 NetDeviceContainer enbSgwDevices = p2ph.Install(enb, sgw);
116 NS_LOG_LOGIC("Ipv4 ifaces of the eNB after installing p2p dev: "
117 << enb->GetObject<Ipv4>()->GetNInterfaces());
118
120 {
122 }
123
125 Ipv4InterfaceContainer enbSgwIpIfaces = m_s1uIpv4AddressHelper.Assign(enbSgwDevices);
126 NS_LOG_LOGIC("number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: "
127 << enb->GetObject<Ipv4>()->GetNInterfaces());
128
129 Ipv4Address enbS1uAddress = enbSgwIpIfaces.GetAddress(0);
130 Ipv4Address sgwS1uAddress = enbSgwIpIfaces.GetAddress(1);
131
132 NoBackhaulEpcHelper::AddS1Interface(enb, enbS1uAddress, sgwS1uAddress, cellIds);
133}
134
135} // namespace ns3
List of Attribute name, value and checker triples used to construct Objects.
Class for representing data rates.
Definition data-rate.h:78
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address NewNetwork()
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition ipv4.h:69
virtual uint32_t GetNInterfaces() const =0
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
Create an EPC network with PointToPoint links between the core network nodes.
Ptr< Node > GetSgwNode() const override
Get the SGW node.
void DoDispose() override
Destructor implementation.
void AddS1Interface(Ptr< Node > enb, Ipv4Address enbAddress, Ipv4Address sgwAddress, std::vector< uint16_t > cellIds) override
Add an S1 interface between an eNB and a SGW.
void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, std::vector< uint16_t > cellIds) override
Add an eNB to the EPC.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
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 ...
Create an EPC network with PointToPoint links in the backhaul network.
Ipv4AddressHelper m_s1uIpv4AddressHelper
S1-U interfaces.
Ipv4AddressHelper m_s1apIpv4AddressHelper
Helper to assign addresses to S1-MME NetDevices.
bool m_s1uLinkEnablePcap
Enable PCAP generation for S1 link.
DataRate m_s1uLinkDataRate
The data rate to be used for the next S1-U link to be created.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint16_t m_s1uLinkMtu
The MTU of the next S1-U link to be created.
static TypeId GetTypeId()
Register this type.
void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, std::vector< uint16_t > cellIds) override
Add an eNB to the EPC.
std::string m_s1uLinkPcapPrefix
Prefix for the PCAP file for the S1 link.
void DoDispose() override
Destructor implementation.
Time m_s1uLinkDelay
The delay to be used for the next S1-U link to be created.
~PointToPointEpcHelper() override
Destructor.
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 SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Definition data-rate.h:285
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition nstime.h:1396
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeChecker > MakeDataRateChecker()
Definition data-rate.cc:20
Ptr< const AttributeChecker > MakeStringChecker()
Definition string.cc:19
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition string.h:46
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1416