lte: Delete CsmaEpcHelper

This commit is contained in:
Manuel Requena
2019-06-04 17:59:07 +02:00
parent 565781fa41
commit e23e796475
4 changed files with 21 additions and 335 deletions

View File

@@ -21,7 +21,6 @@
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
@@ -58,7 +57,6 @@ main (int argc, char *argv[])
Time interPacketInterval = MilliSeconds (100);
bool disableDl = false;
bool disableUl = false;
std::string backhaulType = "p2p";
bool useHelper = false;
// Command line arguments
@@ -69,7 +67,6 @@ main (int argc, char *argv[])
cmd.AddValue ("interPacketInterval", "Inter packet interval", interPacketInterval);
cmd.AddValue ("disableDl", "Disable downlink data flows", disableDl);
cmd.AddValue ("disableUl", "Disable uplink data flows", disableUl);
cmd.AddValue ("backhaulType", "Type of backhaul network", backhaulType);
cmd.AddValue ("useHelper", "Build the backhaul network using the helper or "
"it is built in the example", useHelper);
cmd.Parse (argc, argv);
@@ -80,11 +77,6 @@ main (int argc, char *argv[])
// parse again so you can override default values from the command line
cmd.Parse(argc, argv);
if (backhaulType != "p2p" && backhaulType != "csma")
{
NS_FATAL_ERROR ("Unknown type of backhaul network: " << backhaulType);
}
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
Ptr<EpcHelper> epcHelper;
if (!useHelper)
@@ -93,14 +85,7 @@ main (int argc, char *argv[])
}
else
{
if (backhaulType == "p2p")
{
epcHelper = CreateObject<PointToPointEpcHelper> ();
}
else if (backhaulType == "csma")
{
epcHelper = CreateObject<CsmaEpcHelper> ();
}
epcHelper = CreateObject<PointToPointEpcHelper> ();
}
lteHelper->SetEpcHelper (epcHelper);
@@ -165,60 +150,32 @@ main (int argc, char *argv[])
{
Ipv4AddressHelper s1uIpv4AddressHelper;
if (backhaulType == "p2p")
// Create networks of the S1 interfaces
s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.252");
for (uint16_t i = 0; i < numNodePairs; ++i)
{
// Create networks of the S1 interfaces
s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.252");
Ptr<Node> enb = enbNodes.Get (i);
for (uint16_t i = 0; i < numNodePairs; ++i)
{
Ptr<Node> enb = enbNodes.Get (i);
// Create a point to point link between the eNB and the SGW with
// the corresponding new NetDevices on each side
PointToPointHelper p2ph;
DataRate s1uLinkDataRate = DataRate ("10Gb/s");
uint16_t s1uLinkMtu = 2000;
Time s1uLinkDelay = Time (0);
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (s1uLinkDataRate));
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (s1uLinkMtu));
p2ph.SetChannelAttribute ("Delay", TimeValue (s1uLinkDelay));
NetDeviceContainer sgwEnbDevices = p2ph.Install (sgw, enb);
Ipv4InterfaceContainer sgwEnbIpIfaces = s1uIpv4AddressHelper.Assign (sgwEnbDevices);
s1uIpv4AddressHelper.NewNetwork ();
Ipv4Address sgwS1uAddress = sgwEnbIpIfaces.GetAddress (0);
Ipv4Address enbS1uAddress = sgwEnbIpIfaces.GetAddress (1);
// Create S1 interface between the SGW and the eNB
epcHelper->AddS1Interface (enb, enbS1uAddress, sgwS1uAddress);
}
}
else if (backhaulType == "csma")
{
// Create networks of the S1 interfaces
s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.0");
NodeContainer sgwEnbNodes;
sgwEnbNodes.Add (sgw);
sgwEnbNodes.Add (enbNodes);
CsmaHelper csmah;
NetDeviceContainer sgwEnbDevices = csmah.Install (sgwEnbNodes);
Ptr<NetDevice> sgwDev = sgwEnbDevices.Get (0);
// Create a point to point link between the eNB and the SGW with
// the corresponding new NetDevices on each side
PointToPointHelper p2ph;
DataRate s1uLinkDataRate = DataRate ("10Gb/s");
uint16_t s1uLinkMtu = 2000;
Time s1uLinkDelay = Time (0);
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (s1uLinkDataRate));
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (s1uLinkMtu));
p2ph.SetChannelAttribute ("Delay", TimeValue (s1uLinkDelay));
NetDeviceContainer sgwEnbDevices = p2ph.Install (sgw, enb);
Ipv4InterfaceContainer sgwEnbIpIfaces = s1uIpv4AddressHelper.Assign (sgwEnbDevices);
s1uIpv4AddressHelper.NewNetwork ();
Ipv4Address sgwS1uAddress = sgwEnbIpIfaces.GetAddress (0);
Ipv4Address enbS1uAddress = sgwEnbIpIfaces.GetAddress (1);
for (uint16_t i = 0; i < numNodePairs; ++i)
{
Ptr<Node> enb = enbNodes.Get (i);
Ipv4Address enbS1uAddress = sgwEnbIpIfaces.GetAddress (i + 1);
// Create S1 interface between the SGW and the eNB
epcHelper->AddS1Interface (enb, enbS1uAddress, sgwS1uAddress);
}
// Create S1 interface between the SGW and the eNB
epcHelper->AddS1Interface (enb, enbS1uAddress, sgwS1uAddress);
}
}

View File

@@ -1,149 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
*/
#include "ns3/boolean.h"
#include "ns3/string.h"
#include "ns3/log.h"
#include "ns3/csma-epc-helper.h"
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("CsmaEpcHelper");
NS_OBJECT_ENSURE_REGISTERED (CsmaEpcHelper);
CsmaEpcHelper::CsmaEpcHelper ()
: NoBackhaulEpcHelper ()
{
NS_LOG_FUNCTION (this);
// To access the attribute value within the constructor
ObjectBase::ConstructSelf (AttributeConstructionList ());
// we use a CSMA network for the backhaul network,
// a /16 subnet will provide 65534 nodes (eNBs + SGW)
// (remember that net broadcast and null address are not valid)
m_s1uIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.0.0");
m_s1apIpv4AddressHelper.SetBase ("11.0.0.0", "255.255.0.0");
m_s1uCsmaChannel = CreateObject<CsmaChannel> ();
m_s1uCsmaChannel->SetAttribute ("DataRate", DataRateValue (m_s1uLinkDataRate));
m_s1uCsmaChannel->SetAttribute ("Delay", TimeValue (m_s1uLinkDelay));
CsmaHelper csmah;
csmah.SetDeviceAttribute ("Mtu", UintegerValue (m_s1uLinkMtu));
Ptr<Node> sgw = GetSgwNode ();
NetDeviceContainer sgwDevice = csmah.Install (sgw, m_s1uCsmaChannel);
NS_LOG_LOGIC ("Ipv4 ifaces of the SGW after installing p2p dev: " << sgw->GetObject<Ipv4> ()->GetNInterfaces ());
if (m_s1uLinkEnablePcap)
{
csmah.EnablePcapAll (m_s1uLinkPcapPrefix);
}
Ipv4InterfaceContainer sgwIpIface = m_s1uIpv4AddressHelper.Assign (sgwDevice);
NS_LOG_LOGIC ("number of Ipv4 ifaces of the SGW after assigning Ipv4 addr to S1 dev: " << sgw->GetObject<Ipv4> ()->GetNInterfaces ());
m_sgwS1uAddress = sgwIpIface.GetAddress (0);
}
CsmaEpcHelper::~CsmaEpcHelper ()
{
NS_LOG_FUNCTION (this);
}
TypeId
CsmaEpcHelper::GetTypeId (void)
{
NS_LOG_FUNCTION_NOARGS ();
static TypeId tid = TypeId ("ns3::CsmaEpcHelper")
.SetParent<NoBackhaulEpcHelper> ()
.SetGroupName("Lte")
.AddConstructor<CsmaEpcHelper> ()
.AddAttribute ("S1uLinkDataRate",
"The data rate to be used for the S1-U link",
DataRateValue (DataRate ("10Gb/s")),
MakeDataRateAccessor (&CsmaEpcHelper::m_s1uLinkDataRate),
MakeDataRateChecker ())
.AddAttribute ("S1uLinkDelay",
"The delay to be used for the S1-U link",
TimeValue (Seconds (0)),
MakeTimeAccessor (&CsmaEpcHelper::m_s1uLinkDelay),
MakeTimeChecker ())
.AddAttribute ("S1uLinkMtu",
"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.",
UintegerValue (2000),
MakeUintegerAccessor (&CsmaEpcHelper::m_s1uLinkMtu),
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("S1uLinkPcapPrefix",
"Prefix for Pcap generated by S1-U link",
StringValue ("s1u"),
MakeStringAccessor (&CsmaEpcHelper::m_s1uLinkPcapPrefix),
MakeStringChecker ())
.AddAttribute ("S1uLinkEnablePcap",
"Enable Pcap for S1-U link",
BooleanValue (false),
MakeBooleanAccessor (&CsmaEpcHelper::m_s1uLinkEnablePcap),
MakeBooleanChecker ())
;
return tid;
}
TypeId
CsmaEpcHelper::GetInstanceTypeId () const
{
return GetTypeId ();
}
void
CsmaEpcHelper::DoDispose ()
{
NS_LOG_FUNCTION (this);
}
void
CsmaEpcHelper::AddEnb (Ptr<Node> enb, Ptr<NetDevice> lteEnbNetDevice, uint16_t cellId)
{
NS_LOG_FUNCTION (this << enb << lteEnbNetDevice << cellId);
NoBackhaulEpcHelper::AddEnb (enb, lteEnbNetDevice, cellId);
// Connect the eNB to the CSMA backhaul network
CsmaHelper csmah;
csmah.SetDeviceAttribute ("Mtu", UintegerValue (m_s1uLinkMtu));
NetDeviceContainer enbDevice = csmah.Install (enb, m_s1uCsmaChannel);
NS_LOG_LOGIC ("Ipv4 ifaces of the eNB after installing p2p dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
if (m_s1uLinkEnablePcap)
{
csmah.EnablePcapAll (m_s1uLinkPcapPrefix);
}
Ipv4InterfaceContainer enbIpIface = m_s1uIpv4AddressHelper.Assign (enbDevice);
NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ());
Ipv4Address enbS1uAddress = enbIpIface.GetAddress (0);
NoBackhaulEpcHelper::AddS1Interface (enb, enbS1uAddress, m_sgwS1uAddress);
}
} // namespace ns3

View File

@@ -1,120 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
*/
#ifndef CSMA_EPC_HELPER_H
#define CSMA_EPC_HELPER_H
#include "ns3/csma-helper.h"
#include "ns3/no-backhaul-epc-helper.h"
namespace ns3 {
/**
* \ingroup lte
* \brief Create an EPC network with a CSMA network in the backhaul.
*
* This Helper extends NoBackhaulEpcHelper creating a CSMA network in the
* backhaul network (i.e. in the S1-U and S1-MME interfaces)
*/
class CsmaEpcHelper : public NoBackhaulEpcHelper
{
public:
/**
* Constructor
*/
CsmaEpcHelper ();
/**
* Destructor
*/
virtual ~CsmaEpcHelper ();
// inherited from Object
/**
* Register this type.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
TypeId GetInstanceTypeId () const;
virtual void DoDispose ();
// inherited from EpcHelper
virtual void AddEnb (Ptr<Node> enbNode, Ptr<NetDevice> lteEnbNetDevice, uint16_t cellId);
private:
/**
* S1-U interfaces
*/
/**
* CSMA channel to build the CSMA network
*/
Ptr<CsmaChannel> m_s1uCsmaChannel;
/**
* Helper to assign addresses to S1-U NetDevices
*/
Ipv4AddressHelper m_s1uIpv4AddressHelper;
/**
* Address of the SGW S1-U interface
*/
Ipv4Address m_sgwS1uAddress;
/**
* The data rate to be used for the S1-U link
*/
DataRate m_s1uLinkDataRate;
/**
* The delay to be used for the S1-U link
*/
Time m_s1uLinkDelay;
/**
* The MTU of the 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.
*/
uint16_t m_s1uLinkMtu;
/**
* Helper to assign addresses to S1-MME NetDevices
*/
Ipv4AddressHelper m_s1apIpv4AddressHelper;
/**
* Enable PCAP generation for S1 link
*/
bool m_s1uLinkEnablePcap;
/**
* Prefix for the PCAP file for the S1 link
*/
std::string m_s1uLinkPcapPrefix;
};
} // namespace ns3
#endif // CSMA_EPC_HELPER_H

View File

@@ -45,7 +45,6 @@ def build(bld):
'helper/epc-helper.cc',
'helper/no-backhaul-epc-helper.cc',
'helper/point-to-point-epc-helper.cc',
'helper/csma-epc-helper.cc',
'helper/radio-bearer-stats-calculator.cc',
'helper/radio-bearer-stats-connector.cc',
'helper/phy-stats-calculator.cc',
@@ -240,7 +239,6 @@ def build(bld):
'helper/epc-helper.h',
'helper/no-backhaul-epc-helper.h',
'helper/point-to-point-epc-helper.h',
'helper/csma-epc-helper.h',
'helper/phy-stats-calculator.h',
'helper/mac-stats-calculator.h',
'helper/phy-tx-stats-calculator.h',