LTE Uplink with EPC - zero Rx at remote-host

62 views
Skip to first unread message

L Grace

unread,
Dec 11, 2019, 9:13:02 PM12/11/19
to ns-3-users
Hi,

Nice to meet you all. I'm quite new here. while exploring the LTE example.
I tried to run the lena-simple-epc.cc, and try to trace the uplink to the remote-host. the sink didn't receive any packets.

#include "ns3/lte-helper.h"
#include "ns3/epc-helper.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/applications-module.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/config-store.h"

using namespace ns3;

/**
 * Sample simulation script for LTE+EPC. It instantiates several eNodeB,
 * attaches one UE per eNodeB starts a flow for each UE to  and from a remote host.
 * It also  starts yet another flow between each UE pair.
 */

NS_LOG_COMPONENT_DEFINE ("EpcFirstExample");

Ptr<PacketSink> sink;
uint64_t lastTotalRx;

// Function to calculate throughput each 10ms
void CalculateThroughput ()
{
  Time now = Simulator::Now ();
  double cur = (sink->GetTotalRx () - lastTotalRx) * (double) 8 / 1e4;

  std::cout << now.GetSeconds () << ": \t" << cur << " Mbit/s, \tTotal Rx : " << sink->GetTotalRx() << ", \tCurrent Packets : " << (sink->GetTotalRx () - lastTotalRx) / 1012 << std::endl;

  lastTotalRx = sink->GetTotalRx ();
  Simulator::Schedule (MilliSeconds (10), &CalculateThroughput);
}

int
main (int argc, char *argv[])
{

  uint16_t numberOfNodes = 1;
  double simTime = 1.1;
  double distance = 60.0;
  double interPacketInterval = 1;

  // Command line arguments
  CommandLine cmd;
  cmd.AddValue("numberOfNodes", "Number of eNodeBs + UE pairs", numberOfNodes);
  cmd.AddValue("simTime", "Total duration of the simulation [s])", simTime);
  cmd.AddValue("distance", "Distance between eNBs [m]", distance);
  cmd.AddValue("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
  cmd.Parse(argc, argv);

  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
  Ptr<PointToPointEpcHelper>  epcHelper = CreateObject<PointToPointEpcHelper> ();
  lteHelper->SetEpcHelper (epcHelper);
  
  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("output-attributes.txt"));
  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
  ConfigStore inputConfig;
  inputConfig.ConfigureDefaults();

  // parse again so you can override default values from the command line
  cmd.Parse(argc, argv);

  Ptr<Node> pgw = epcHelper->GetPgwNode ();

   // Create a single RemoteHost
  NodeContainer remoteHostContainer;
  remoteHostContainer.Create (1);
  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
  InternetStackHelper internet;
  internet.Install (remoteHostContainer);

  // Create the Internet
  PointToPointHelper p2ph;
  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
  Ipv4AddressHelper ipv4h;
  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
  // interface 0 is localhost, 1 is the p2p device
  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);

  Ipv4StaticRoutingHelper ipv4RoutingHelper;
  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);

  NodeContainer ueNodes;
  NodeContainer enbNodes;
  enbNodes.Create(numberOfNodes);
  ueNodes.Create(numberOfNodes);

  // Install Mobility Model
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  for (uint16_t i = 0; i < numberOfNodes; i++)
    {
      positionAlloc->Add (Vector(distance * i, 0, 0));
    }
  MobilityHelper mobility;
  mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
  mobility.SetPositionAllocator(positionAlloc);
  mobility.Install(enbNodes);
  mobility.Install(ueNodes);

  // Install LTE Devices to the nodes
  NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
  NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);

  // Install the IP stack on the UEs
  internet.Install (ueNodes);
  Ipv4InterfaceContainer ueIpIface;
  ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
  // Assign IP address to UEs, and install applications
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
    {
      Ptr<Node> ueNode = ueNodes.Get (u);
      // Set the default gateway for the UE
      Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
      ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
      ueStaticRouting->AddNetworkRouteTo ("1.0.0.0", "255.0.0.0", 1);
    }

  // Attach one UE per eNodeB
  for (uint16_t i = 0; i < numberOfNodes; i++)
      {
        lteHelper->Attach (ueLteDevs.Get(i), enbLteDevs.Get(i));
        // side effect: the default EPS bearer will be activated
      }


  // Install and start applications on UEs and remote host
  uint16_t ulPort = 2000;
  ApplicationContainer clientApps;
  ApplicationContainer serverApps;
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
  {
    ++ulPort;
    PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));

    serverApps.Add (ulPacketSinkHelper.Install (remoteHost));

    // ### sink to collect the total Rx received from uplink
    sink = StaticCast<PacketSink> (serverApps.Get(0));

    UdpClientHelper ulClient (remoteHostAddr, ulPort);
    ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
    ulClient.SetAttribute ("MaxPackets", UintegerValue(1000000));

    clientApps.Add (ulClient.Install (ueNodes.Get(u)));
  }
  serverApps.Start (Seconds (0.5));
  clientApps.Start (Seconds (0.5));
  Simulator::Schedule (Seconds (0.5), &CalculateThroughput);

  lteHelper->EnableTraces ();
  // Uncomment to enable PCAP tracing
  // p2ph.EnablePcapAll("lena-epc-first");

  Simulator::Stop(Seconds(simTime));
  Simulator::Run();

  Simulator::Destroy();

  // ### Print the total Rx from packet sink
  double averageThroughput = ((sink->GetTotalRx () * 8) / (1e6 * simTime));
  std::cout << "\nTotal Rx : " << sink->GetTotalRx () << " bytes" << std::endl;
  std::cout << "\nAverage throughput: " << averageThroughput << " Mbit/s" << std::endl;

  return 0;

}

the Packet-sink at remote host didn't receive any packets.

SetS1apSapMme for m_s1apSapEnbProvider is called
InitialUeMessage is called
DoInitialUeMessage for Provider is called
Hihihihihi
Sends packet to 11.0.0.6:36412
IintialUeMessage(1,2,3,4) is called
SetupDataRadioBearer 
Add Data Radio Bearer Info 
0x558f9f90c480 IMSI 1 adding/modifying DRBID 1 LC 3
0.5: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.51: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.52: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.53: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.54: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.55: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.56: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.57: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.58: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.59: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.6: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.61: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.62: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.63: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.64: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.65: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.66: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.67: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.68: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.69: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.7: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.71: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.72: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.73: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.74: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.75: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.76: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.77: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.78: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.79: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.8: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.81: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.82: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.83: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.84: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.85: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.86: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.87: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.88: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.89: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.9: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.91: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.92: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.93: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.94: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.95: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.96: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.97: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.98: 0 Mbit/s, Total Rx : 0, Current Packets : 0
0.99: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.01: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.02: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.03: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.04: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.05: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.06: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.07: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.08: 0 Mbit/s, Total Rx : 0, Current Packets : 0
1.09: 0 Mbit/s, Total Rx : 0, Current Packets : 0
UE will destroy drb in LTE-UE-RRC

Total Rx : 0 bytes

Average throughput: 0 Mbit/s

Anyone kind advice me, is there something wrong with the example or i just missed something here?
Thank You.

Best Regards,
L

L Grace

unread,
Dec 13, 2019, 2:52:15 AM12/13/19
to ns-3-users
The issues is currently i'm using the ns3 version 3.25. the uplink has some problems previously.
after updating to the latest version (currently 3.30) the problem is solved.

Best Regards,
L
Reply all
Reply to author
Forward
0 new messages