23 #include <ns3/point-to-point-epc-helper.h>
25 #include <ns3/inet-socket-address.h>
26 #include <ns3/mac48-address.h>
27 #include <ns3/eps-bearer.h>
28 #include <ns3/ipv4-address.h>
29 #include <ns3/internet-stack-helper.h>
30 #include <ns3/point-to-point-helper.h>
31 #include <ns3/packet-socket-helper.h>
32 #include <ns3/packet-socket-address.h>
33 #include <ns3/epc-enb-application.h>
34 #include <ns3/epc-sgw-pgw-application.h>
36 #include <ns3/lte-enb-rrc.h>
37 #include <ns3/epc-x2.h>
38 #include <ns3/lte-enb-net-device.h>
39 #include <ns3/lte-ue-net-device.h>
40 #include <ns3/epc-mme.h>
41 #include <ns3/epc-ue-nas.h>
53 : m_gtpuUdpPort (2152)
102 m_mme = CreateObject<EpcMme> ();
115 static TypeId tid =
TypeId (
"ns3::PointToPointEpcHelper")
117 .AddConstructor<PointToPointEpcHelper> ()
118 .AddAttribute (
"S1uLinkDataRate",
119 "The data rate to be used for the next S1-U link to be created",
122 MakeDataRateChecker ())
123 .AddAttribute (
"S1uLinkDelay",
124 "The delay to be used for the next S1-U link to be created",
128 .AddAttribute (
"S1uLinkMtu",
129 "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.",
132 MakeUintegerChecker<uint16_t> ())
133 .AddAttribute (
"X2LinkDataRate",
134 "The data rate to be used for the next X2 link to be created",
137 MakeDataRateChecker ())
138 .AddAttribute (
"X2LinkDelay",
139 "The delay to be used for the next X2 link to be created",
143 .AddAttribute (
"X2LinkMtu",
144 "The MTU of the next X2 link to be created. Note that, because of some big X2 messages, you need a big MTU.",
147 MakeUintegerChecker<uint16_t> ())
168 NS_ASSERT (enb == lteEnbNetDevice->GetNode ());
179 enbSgwNodes.Add (enb);
208 enbLteSocketBindAddress.
SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
210 retval = enbLteSocket->
Bind (enbLteSocketBindAddress);
214 enbLteSocketConnectAddress.
SetSingleDevice (lteEnbNetDevice->GetIfIndex ());
216 retval = enbLteSocket->
Connect (enbLteSocketConnectAddress);
221 Ptr<EpcEnbApplication> enbApp = CreateObject<EpcEnbApplication> (enbLteSocket, enbS1uSocket, enbAddress, sgwAddress, cellId);
233 m_mme->AddEnb (cellId, enbAddress, enbApp->GetS1apSapEnb ());
234 m_sgwPgwApp->AddEnb (cellId, enbAddress, sgwAddress);
235 enbApp->SetS1apSapMme (
m_mme->GetS1apSapMme ());
270 uint16_t enb1CellId = enb1LteDev->
GetCellId ();
271 NS_LOG_LOGIC (
"LteEnbNetDevice #1 = " << enb1LteDev <<
" - CellId = " << enb1CellId);
275 uint16_t enb2CellId = enb2LteDev->
GetCellId ();
276 NS_LOG_LOGIC (
"LteEnbNetDevice #2 = " << enb2LteDev <<
" - CellId = " << enb2CellId);
278 enb1X2->AddX2Interface (enb1CellId, enb1X2Address, enb2CellId, enb2X2Address);
279 enb2X2->AddX2Interface (enb2CellId, enb2X2Address, enb1CellId, enb1X2Address);
281 enb1LteDev->GetRrc ()->AddX2Neighbour (enb2LteDev->GetCellId ());
282 enb2LteDev->GetRrc ()->AddX2Neighbour (enb1LteDev->GetCellId ());
307 NS_ASSERT_MSG (ueIpv4 != 0,
"UEs need to have IPv4 installed before EPS bearers can be activated");
308 int32_t
interface = ueIpv4->GetInterfaceForDevice (ueDevice);
310 NS_ASSERT (ueIpv4->GetNAddresses (interface) == 1);
311 Ipv4Address ueAddr = ueIpv4->GetAddress (interface, 0).GetLocal ();
314 m_mme->AddBearer (imsi, tft, bearer);
318 ueLteDevice->GetNas ()->ActivateEpsBearer (bearer, tft);
uint32_t AddApplication(Ptr< Application > application)
DataRate m_s1uLinkDataRate
static Ipv4Address GetAny(void)
#define NS_LOG_FUNCTION(parameters)
uint32_t GetNApplications(void) const
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
holds a vector of std::pair of Ptr<Ipv4> and interface index.
virtual void ActivateEpsBearer(Ptr< NetDevice > ueLteDevice, uint64_t imsi, Ptr< EpcTft > tft, EpsBearer bearer)
Activate an EPS bearer, setting up the corresponding S1-U tunnel.
uint16_t GetCellId() const
static TypeId GetTypeId(void)
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
virtual Ptr< Node > GetPgwNode()
an address for a packet socket
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual void AddUe(Ptr< NetDevice > ueLteDevice, uint64_t imsi)
Notify the EPC of the existance of a new UE which might attach at a later time.
aggregate IP/TCP/UDP functionality to existing Nodes.
Ptr< EpcSgwPgwApplication > m_sgwPgwApp
Callback< R > MakeNullCallback(void)
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)
a polymophic address class
Class for representing data rates.
This class contains the specification of EPS Bearers.
Ptr< Application > GetApplication(uint32_t index) const
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
hold objects of type ns3::Time
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.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Hold an unsigned integer type.
virtual void SetAddress(Address address)
Set the address of this interface.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > GetDevice(uint32_t index) const
static Mac48Address GetBroadcast(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
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...
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
PointToPointEpcHelper()
Constructor.
void AggregateObject(Ptr< Object > other)
#define NS_LOG_LOGIC(msg)
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the Ipv4 forwarding table, interfaces, and configuration.
Ipv4AddressHelper m_x2Ipv4AddressHelper
helper to assign addresses to X2 NetDevices
Base helper class to handle the creation of the EPC entities.
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void SetPhysicalAddress(const Address address)
keep track of a set of node pointers.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Ipv4AddressHelper m_ueAddressHelper
SGW-PGW network element.
uint16_t m_gtpuUdpPort
UDP port where the GTP-U Socket is bound, fixed by the standard as 2152.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
#define NS_ASSERT_MSG(condition, message)
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
Ipv4AddressHelper m_s1uIpv4AddressHelper
S1-U interfaces.
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...
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)
hold objects of type ns3::DataRate
virtual ~PointToPointEpcHelper()
Destructor.
void SetProtocol(uint16_t protocol)
DataRate m_x2LinkDataRate
virtual void AddX2Interface(Ptr< Node > enbNode1, Ptr< Node > enbNode2)
Add an X2 interface between two eNB.
Ipv4Address NewNetwork(void)
Increment the network number and reset the IP address counter to the base value provided in the SetBa...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void SetSendCallback(SendCallback transmitCb)
Set the user callback to be called when a L2 packet is to be transmitted.
void SetAttribute(std::string name, const AttributeValue &value)
The eNodeB device implementation.
Ptr< T > GetObject(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void Dispose(void)
Run the DoDispose methods of this object and all the objects aggregated to it.
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.
Ptr< VirtualNetDevice > m_tunDevice
static TypeId LookupByName(std::string name)
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
The LteUeNetDevice class implements the UE net device.