26 #include "ns3/string.h" 27 #include "ns3/lte-enb-net-device.h" 28 #include "ns3/lte-enb-rrc.h" 29 #include "ns3/epc-x2.h" 30 #include "ns3/emu-fd-net-device-helper.h" 31 #include "ns3/emu-epc-helper.h" 78 .AddAttribute (
"SgwDeviceName",
79 "The name of the device used for the S1-U interface of the SGW",
83 .AddAttribute (
"EnbDeviceName",
84 "The name of the device used for the S1-U interface of the eNB",
88 .AddAttribute (
"SgwMacAddress",
89 "MAC address used for the SGW",
93 .AddAttribute (
"EnbMacAddressBase",
94 "First 5 bytes of the eNB MAC address base",
131 std::ostringstream enbMacAddress;
132 enbMacAddress <<
m_enbMacAddressBase <<
":" << std::hex << std::setfill (
'0') << std::setw (2) << cellId;
133 NS_LOG_LOGIC (
"eNB MAC address: " << enbMacAddress.str ());
135 enbDev->SetAttribute (
"Address",
Mac48AddressValue (enbMacAddress.str ().c_str ()));
143 Ipv4Address enbAddress = enbIpIfaces.GetAddress (0);
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 uint16_t enb1CellId = enb1LteDev->
GetCellId ();
185 NS_LOG_LOGIC (
"LteEnbNetDevice #1 = " << enb1LteDev <<
" - CellId = " << enb1CellId);
189 uint16_t enb2CellId = enb2LteDev->
GetCellId ();
190 NS_LOG_LOGIC (
"LteEnbNetDevice #2 = " << enb2LteDev <<
" - CellId = " << enb2CellId);
192 enb1X2->AddX2Interface (enb1CellId, enb1Addr, enb2CellId, enb2Addr);
193 enb2X2->AddX2Interface (enb2CellId, enb2Addr, enb1CellId, enb1Addr);
195 enb1LteDev->GetRrc ()->AddX2Neighbour (enb2LteDev->GetCellId ());
196 enb2LteDev->GetRrc ()->AddX2Neighbour (enb1LteDev->GetCellId ());
static TypeId GetTypeId(void)
Register this type.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
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.
Hold variables of type string.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
std::string m_sgwDeviceName
The name of the device used for the S1-U interface of the SGW.
Ipv4InterfaceContainer m_sgwIpIfaces
Container for Ipv4Interfaces of the SGW.
EmuEpcHelper()
Constructor.
#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.
Ptr< const AttributeChecker > MakeStringChecker(void)
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
uint16_t GetCellId() const
List of Attribute name, value and checker triples used to construct Objects.
holds a vector of ns3::NetDevice pointers
virtual void AddX2Interface(Ptr< Node > enbNode1, Ptr< Node > enbNode2)
Add an X2 interface between two eNB.
virtual void AddS1Interface(Ptr< Node > enb, Ipv4Address enbAddress, Ipv4Address sgwAddress, uint16_t cellId=0)
Add an S1 interface between an eNB and a SGW.
virtual void AddEnb(Ptr< Node > enbNode, Ptr< NetDevice > lteEnbNetDevice, uint16_t cellId)
Add an eNB to the EPC.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Create an EPC network using EmuFdNetDevice.
Access to the IPv4 forwarding table, interfaces, and configuration.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void SetDeviceName(std::string deviceName)
Set the device name of this device.
Create an EPC network with PointToPoint links between the core network nodes.
std::string m_enbMacAddressBase
First 5 bytes of the Enb MAC address base.
std::string m_sgwMacAddress
MAC address used for the SGW.
Base helper class to handle the creation of the EPC entities.
virtual void DoDispose()
Destructor implementation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This entity is installed inside an eNB and provides the functionality for the X2 interface.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
virtual ~EmuEpcHelper()
Destructor.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
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...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
AttributeValue implementation for Mac48Address.
std::string m_enbDeviceName
The name of the device used for the S1-U interface of the eNB.
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ipv4AddressHelper m_epcIpv4AddressHelper
helper to assign addresses to S1-U NetDevices
virtual void DoDispose()
Destructor implementation.
virtual Ptr< Node > GetSgwNode() const
Get the SGW node.
The eNodeB device implementation.
build a set of FdNetDevice objects attached to a physical network interface
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual uint32_t GetNInterfaces(void) const =0
uint32_t GetNDevices(void) const
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.