25 #include "ns3/emu-fd-net-device-helper.h"
26 #include "ns3/epc-x2.h"
28 #include "ns3/lte-enb-net-device.h"
29 #include "ns3/lte-enb-rrc.h"
30 #include "ns3/string.h"
57 sgwDevice->SetAttribute(
"Address", Mac48AddressValue(
m_sgwMacAddress.c_str()));
76 TypeId(
"ns3::EmuEpcHelper")
80 .AddAttribute(
"SgwDeviceName",
81 "The name of the device used for the S1-U interface of the SGW",
85 .AddAttribute(
"EnbDeviceName",
86 "The name of the device used for the S1-U interface of the eNB",
90 .AddAttribute(
"SgwMacAddress",
91 "MAC address used for the SGW",
95 .AddAttribute(
"EnbMacAddressBase",
96 "First 5 bytes of the eNB MAC address base",
130 std::ostringstream enbMacAddress;
131 enbMacAddress <<
m_enbMacAddressBase <<
":" << std::hex << std::setfill(
'0') << std::setw(2)
133 NS_LOG_LOGIC(
"eNB MAC address: " << enbMacAddress.str());
135 enbDev->SetAttribute(
"Address", Mac48AddressValue(enbMacAddress.str().c_str()));
139 NS_LOG_LOGIC(
"number of Ipv4 ifaces of the eNB after installing emu dev: "
142 NS_LOG_LOGIC(
"number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: "
161 NS_LOG_LOGIC(
"number of Ipv4 ifaces of the eNB #1: " << enb1Ipv4->GetNInterfaces());
162 NS_LOG_LOGIC(
"number of Ipv4 ifaces of the eNB #2: " << enb2Ipv4->GetNInterfaces());
170 int32_t enb1Interface = enb1Ipv4->GetInterfaceForDevice(enb1EpcDev);
171 int32_t enb2Interface = enb2Ipv4->GetInterfaceForDevice(enb2EpcDev);
174 NS_ASSERT(enb1Ipv4->GetNAddresses(enb1Interface) == 1);
175 NS_ASSERT(enb2Ipv4->GetNAddresses(enb2Interface) == 1);
176 Ipv4Address enb1Addr = enb1Ipv4->GetAddress(enb1Interface, 0).GetLocal();
177 Ipv4Address enb2Addr = enb2Ipv4->GetAddress(enb2Interface, 0).GetLocal();
184 std::vector<uint16_t> enb1CellIds = enb1LteDev->
GetCellIds();
185 uint16_t enb1CellId = enb1CellIds.at(0);
186 NS_LOG_LOGIC(
"LteEnbNetDevice #1 = " << enb1LteDev <<
" - CellId = " << enb1CellId);
190 std::vector<uint16_t> enb2CellIds = enb2LteDev->
GetCellIds();
191 uint16_t enb2CellId = enb2CellIds.at(0);
192 NS_LOG_LOGIC(
"LteEnbNetDevice #2 = " << enb2LteDev <<
" - CellId = " << enb2CellId);
194 enb1X2->AddX2Interface(enb1CellId, enb1Addr, enb2CellIds, enb2Addr);
195 enb2X2->AddX2Interface(enb2CellId, enb2Addr, enb1CellIds, enb1Addr);
197 enb1LteDev->GetRrc()->AddX2Neighbour(enb2LteDev->GetCellId());
198 enb2LteDev->GetRrc()->AddX2Neighbour(enb1LteDev->GetCellId());
List of Attribute name, value and checker triples used to construct Objects.
Create an EPC network using EmuFdNetDevice.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
EmuEpcHelper()
Constructor.
static TypeId GetTypeId()
Register this type.
~EmuEpcHelper() override
Destructor.
Ipv4AddressHelper m_epcIpv4AddressHelper
helper to assign addresses to S1-U NetDevices
std::string m_enbMacAddressBase
First 5 bytes of the Enb MAC address base.
void DoDispose() override
Destructor implementation.
std::string m_enbDeviceName
The name of the device used for the S1-U interface of the eNB.
std::string m_sgwDeviceName
The name of the device used for the S1-U interface of the SGW.
std::string m_sgwMacAddress
MAC address used for the SGW.
void AddX2Interface(Ptr< Node > enbNode1, Ptr< Node > enbNode2) override
Add an X2 interface between two eNB.
Ipv4InterfaceContainer m_sgwIpIfaces
Container for Ipv4Interfaces of the SGW.
void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, std::vector< uint16_t > cellIds) override
Add an eNB to the EPC.
build a set of FdNetDevice objects attached to a physical network interface
void SetDeviceName(std::string deviceName)
Set the device name of this device.
Base helper class to handle the creation of the EPC entities.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
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.
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
The eNodeB device implementation.
std::vector< uint16_t > GetCellIds() const
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
uint32_t GetNDevices() const
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Hold variables of type string.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeStringChecker()
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)