IP address as an attribute in LTE

302 views
Skip to first unread message

Gooner 내려왔다

unread,
Jun 21, 2016, 11:47:45 AM6/21/16
to ns-3-users
Hello guys,
   I am trying to use 2 LTE system. But since some hard coding of IP address, some clash is happening resulting in error.
Now I am trying to give these IP address attribute while creating PointToPointEpcHelper> () and I am trying to modify PointToPointEpcHelper.h and PointToPointEpcHelper.cc

void
PointToPointEpcHelper::SetUEIP (std::string ueAddressHelper)
{
  m_ueAddressHelper.SetBase (ueAddressHelper, "255.0.0.0");
}
   
std::string
PointToPointEpcHelper::GetUEIP (void) const
{
  return m_ueAddressHelper;
}

I am wondering if its okay to give "std::string" as the datatype for the second function(above one)?  Also in the AddAttribute
.AddAttribute ("ueAddress",
                   "The ueAddress  ",
                   StringValue("   ");,
                   MakeStringAccessor (&PointToPointEpcHelper::SetUEIP,
                                      &PointToPointEpcHelper::GetUEIP),
                   MakeStringChecker<std::string> ())

What should I give inside the StringValue?

Please help me with this one

Thanks,
G4L

Gooner 내려왔다

unread,
Jun 21, 2016, 5:18:25 PM6/21/16
to ns-3-users
How can I create an attribute for IP address so that IP address of first pgw does not clash with IP address of second one?

Gooner 내려왔다

unread,
Jun 21, 2016, 8:01:46 PM6/21/16
to ns-3-users
 Hi all,
I modified the "point-to-point-epc-helper.cc" like below.

    .AddAttribute ("ueAddress",
                   "The ueAddress",
                   Ipv4Address("7.0.0.0"),
                   MakeIpv4AddressAccessor (&PointToPointEpcHelper::SetUEIP,
                                           &PointToPointEpcHelper::GetUEIP),
                   MakeIpv4AddressChecker ())

But its throwing an error
"no matching function for call to ‘ns3::TypeId::AddAttribute(const char [10], const char [14], ns3::Ipv4Address, ns3::Ptr<const ns3::AttributeAccessor>, ns3::Ptr<const ns3::AttributeChecker>)’
                    MakeIpv4AddressChecker ())
"
But I tried with integer, float etc. Those are fine. If there is problem with IpAddress attribute in this format, how can i proceed. ?

Somebody, please help. Please

Tommaso Pecorella

unread,
Jun 22, 2016, 1:07:25 AM6/22/16
to ns-3-users
The code can help.
It's "Ipv4AddressValue ("7.0.0.0"),"

T.

Gooner 내려왔다

unread,
Jun 22, 2016, 8:15:03 AM6/22/16
to ns-3-users
Thanks a lot Tommaso.
Now its working now.

I have one more question about conversion process.
How can I reverse the operation and get the value in string format from variable, a=Ipv4AddressValue ("7.0.0.0")
The reason I am asking is because, I am doing below operation
m_ueAddressHelper.SetBase (m_ueIPv4Address, m_ueIPv4Mask);   where variables m_ueIPv4Addres and m_ueIPv4Mask are IP address and mask variable.
The above statement is giving me an error. I assume those variables should be string not IP and mask. Please let me know if I am correct in this way. If yes, let me know how to go ahead with the operation.

Sorry about asking basic question, but I could not find any other place for converting. I tried performing string operation, but it was throwing below error
"class ns3::Ipv4Address’ has no member named "substr()" etc

 


Gooner 내려왔다

unread,
Jun 24, 2016, 12:46:35 PM6/24/16
to ns-3-users
Created an attribute like

.AddAttribute ("ueAddress",
                   "The ueAddress",
                   Ipv4AddressValue("7.0.0.0")

Then I used Set and Get(userdefined) function for accessor part.
 
Later I used
m_ueAddressHelper.SetBase (m_ueIPv4Address, "255.0.0.0");
 But error says "Inconsistent network and mask" (Here variable m_ueIPv4Address will be userput value or "7.0.0.0" by default) .
 It works fine if the code is hardcoded like below
m_ueAddressHelper.SetBase (("7.0.0.0"), "255.0.0.0");
It would be great if someone could tell me, why this conversion problem happens.

Any pointers?

Gooner 내려왔다

unread,
Jun 25, 2016, 12:13:54 AM6/25/16
to ns-3-users
Hi,
  I solved the problem defining new constructor. The attribute thing had some issues.

Anyway thanks for the help.

Babu

unread,
Jan 2, 2017, 6:55:03 AM1/2/17
to ns-3-users
I want to sent one IP packet from UE to eNodeB and eNodeB will reply back directly without forwarding to PGW. 

In present eNodeB receive the packet and forward to the PDN gateway. I am not understanding how can I restrict it? How can I enable eNodeB for local delivery or sent packet to the lower layer? If you have idea please share with me.

Tommaso Pecorella

unread,
Jan 3, 2017, 4:07:11 PM1/3/17
to ns-3-users
Hi Babu,

mind reading the posting guidelines before posting ?

Thanks,

T.

Pooja singh

unread,
Apr 9, 2020, 2:52:21 AM4/9/20
to ns-3-users
Hey, I wanted to do something similar Can you help me how you have done this? 
I stuck with my project and was wondering if you can help by telling me how to do this. 

Md Mahfuzur Rahman Bosunia

unread,
Apr 9, 2020, 3:01:03 AM4/9/20
to ns-3-...@googlegroups.com
I did it 3 years back successfully. Currently I dont have the source code. You have to modify the lte source code.

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/Tc3IKky1OKo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/3eb8912b-78f8-4d1e-9ec4-e332237a6975%40googlegroups.com.

Adesoji Bello

unread,
Apr 9, 2020, 6:37:36 AM4/9/20
to ns-3-users
Hi Babu,

Which specific part of the LTE module need to be modified, I have similar setup but anytime the transmitting UE sends a packet nothing is received at the receiving UE. Must we configure a pgw for this to be fine, just looking at the possibility where both the UE's and eNB are wirelessly linked.

Thanks.

Marco Malinverno

unread,
Apr 9, 2020, 7:43:34 AM4/9/20
to ns-3-users
Dear Adesoji Bello,
suppose that you want to pass the Ip address of a node as an attribute to a certain application, that in my example is called simply App:

First you retrieve the Ip address that you want to pass as an attribute by doing:
Ptr<Node> node = myNodes.Get (index_of_the_node);
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> (); 
Ipv4Address addr = ipv4->GetAddress (index, index).GetLocal (); //Modify the indexes to match your needs

or, if you already know the address and you want to statically set it:
Ipv4Address addr("7.0.0.1");

Now suppose that you want to pass it to the application App, that has an AppHelper:
  
AppHelper.SetAttribute ("IPv4Address", Ipv4AddressValue(addr));

then you have to modify the application that receives this address, by adding a new attribute:
.AddAttribute ("IPv4Address",
            "Ip Addr passed as attribute",
            Ipv4AddressValue("7.0.0.1"), //default value
            MakeIpv4AddressAccessor (&App::m_ipv4_addr),
            MakeIpv4AddressChecker ())

now in m_ipv4_addr, that is a global variable of type Ipv4Address, you have the address.

Adesoji Bello

unread,
Apr 9, 2020, 10:57:57 AM4/9/20
to ns-3-users
Hi Marco,

Thanks for your response. I just realized the specific issue i am facing is not the objective of this topic, i would post it on another thread. However, i was able to learn something from your response.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages