LTE: Question about configuring the UEs for IP networking

76 views
Skip to first unread message

RL

unread,
Jul 19, 2016, 6:55:49 AM7/19/16
to ns-3-users
Hello experts,

I would like to do some questions about setting the default gateway for the UE.


1) Could you tell me it is necessary to set a default gateway for each UE into my scenario? The reason of my question is I have a scenario with 22 UEs and 21 eNBs and I use the following sentence:


Ptr<Node> ueNode = ueNodes.Get (0);
Ipv4InterfaceContainer ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);



It works fine with an application UDPSocket.

However if I use the following code provided by the tutorial:


// assign IP address to UEs
for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
  {
    Ptr<Node> ue = ueNodes.Get (u);
    Ptr<NetDevice> ueLteDevice = ueLteDevs.Get (u);
    Ipv4InterfaceContainer ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevice));
    // set the default gateway for the UE
    Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
    ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
  }

When I try to compile the simulation, I have a problem when I use 

OnOffHelper onOffHelper_1("ns3::UdpSocketFactory", InetSocketAddress(ueIpIface.GetAddress (u), dlPort));

because I read the following text:

[ 890/2495] Compiling scratch/handover_21eNB_21UE.cc
../scratch/handover_21eNB_21UE.cc: In function ‘int main(int, char**)’:
../scratch/handover_21eNB_21UE.cc:373:76: error: ‘ueIpIface’ was not declared in this scope
       OnOffHelper onOffHelper_1("ns3::UdpSocketFactory", InetSocketAddress(ueIpIface.GetAddress (u), dlPort));

2)Could anyone help me with this issue?

Thanks very much in advance.

RL


Konstantinos

unread,
Jul 19, 2016, 7:07:21 AM7/19/16
to ns-3-users
Hi,

This is pure C problem regarding scope of variables (http://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm).
The ueIpIface was defined inside the loop. The IP assignment can be done outside of the loop with one line for ALL nodes/devices.
See the examples for LTE.

Regards,
K.

Tommaso Pecorella

unread,
Jul 19, 2016, 7:08:41 AM7/19/16
to ns-3-users
It's a quite simple scope error.
Please search in Internet for the meaning of "scope" in C++. As an example (but there are a lot more), check http://courses.cs.vt.edu/~cs1044/spring01/cstruble/notes/12.scope.pdf

T.

RL

unread,
Jul 19, 2016, 12:19:15 PM7/19/16
to ns-3-users


 Hi Konstantinos and Tommaso,

Thanks very much for your quick and kind response. With your help I found a solution for my issue.

Regards,


RL.
Reply all
Reply to author
Forward
0 new messages