|
18 |
* Author: Jaume Nin <jnin@cttc.es> |
18 |
* Author: Jaume Nin <jnin@cttc.es> |
19 |
* Nicola Baldo <nbaldo@cttc.es> |
19 |
* Nicola Baldo <nbaldo@cttc.es> |
20 |
* Manuel Requena <manuel.requena@cttc.es> |
20 |
* Manuel Requena <manuel.requena@cttc.es> |
|
|
21 |
* Manoj Kumar Rana <manoj24.rana@gmail.com> |
21 |
*/ |
22 |
*/ |
22 |
|
23 |
|
23 |
#include <ns3/point-to-point-epc-helper.h> |
24 |
#include <ns3/point-to-point-epc-helper.h> |
|
26 |
#include <ns3/mac48-address.h> |
27 |
#include <ns3/mac48-address.h> |
27 |
#include <ns3/eps-bearer.h> |
28 |
#include <ns3/eps-bearer.h> |
28 |
#include <ns3/ipv4-address.h> |
29 |
#include <ns3/ipv4-address.h> |
|
|
30 |
#include <ns3/ipv4-address-generator.h> |
29 |
#include <ns3/internet-stack-helper.h> |
31 |
#include <ns3/internet-stack-helper.h> |
30 |
#include <ns3/point-to-point-helper.h> |
32 |
#include <ns3/point-to-point-helper.h> |
31 |
#include <ns3/packet-socket-helper.h> |
33 |
#include <ns3/packet-socket-helper.h> |
|
52 |
{ |
54 |
{ |
53 |
NS_LOG_FUNCTION (this); |
55 |
NS_LOG_FUNCTION (this); |
54 |
|
56 |
|
|
|
57 |
// To access the attribute value within the constructor |
58 |
ObjectBase::ConstructSelf (AttributeConstructionList ()); |
59 |
|
55 |
// since we use point-to-point links for all S1-U links, |
60 |
// since we use point-to-point links for all S1-U links, |
56 |
// we use a /30 subnet which can hold exactly two addresses |
61 |
// we use a /30 subnet which can hold exactly two addresses |
57 |
// (remember that net broadcast and null address are not valid) |
62 |
// (remember that net broadcast and null address are not valid) |
|
59 |
|
64 |
|
60 |
m_x2Ipv4AddressHelper.SetBase ("12.0.0.0", "255.255.255.252"); |
65 |
m_x2Ipv4AddressHelper.SetBase ("12.0.0.0", "255.255.255.252"); |
61 |
|
66 |
|
62 |
// we use a /8 net for all UEs |
67 |
// we use a /16 bit IPv4 net for an EPC network |
63 |
m_ueAddressHelper.SetBase ("7.0.0.0", "255.0.0.0"); |
68 |
m_uePgwCurrentIpv4Prefix = m_uePgwBaseIpv4Prefix.CombineMask (Ipv4Mask ("255.0.0.0")); //Initialize |
|
|
69 |
Ipv4AddressGenerator::Init (m_uePgwCurrentIpv4Prefix, Ipv4Mask ("255.255.0.0")); |
70 |
|
71 |
while (!(Ipv4AddressGenerator::CheckAllocated (Ipv4AddressGenerator::GetNetwork (Ipv4Mask ("255.255.0.0"))))) |
72 |
{ |
73 |
m_uePgwCurrentIpv4Prefix = Ipv4AddressGenerator::NextNetwork (Ipv4Mask ("255.255.0.0")); |
74 |
} |
75 |
|
76 |
m_ueAddressHelper.SetBase (m_uePgwCurrentIpv4Prefix, "255.255.0.0"); //The helper will assign IPv4 addresses using this 16 bit prefix |
77 |
//Now we get an unique 16 bit IPv4 prefix for this EPC, which not used by any other EPC |
64 |
|
78 |
|
65 |
// create SgwPgwNode |
79 |
// create SgwPgwNode |
66 |
m_sgwPgw = CreateObject<Node> (); |
80 |
m_sgwPgw = CreateObject<Node> (); |
|
144 |
UintegerValue (3000), |
158 |
UintegerValue (3000), |
145 |
MakeUintegerAccessor (&PointToPointEpcHelper::m_x2LinkMtu), |
159 |
MakeUintegerAccessor (&PointToPointEpcHelper::m_x2LinkMtu), |
146 |
MakeUintegerChecker<uint16_t> ()) |
160 |
MakeUintegerChecker<uint16_t> ()) |
147 |
; |
161 |
.AddAttribute ("BaseIpv4Prefix", |
|
|
162 |
"The 8 bit IPv4 prefix to be used for the assignment of IPv4 addresses to PGW and UE.", |
163 |
Ipv4AddressValue (Ipv4Address ("7.0.0.0")), |
164 |
MakeIpv4AddressAccessor (&PointToPointEpcHelper::m_uePgwBaseIpv4Prefix), |
165 |
MakeIpv4AddressChecker ()) |
166 |
; |
148 |
return tid; |
167 |
return tid; |
149 |
} |
168 |
} |
150 |
|
169 |
|
|
|
170 |
TypeId |
171 |
PointToPointEpcHelper::GetInstanceTypeId () const |
172 |
{ |
173 |
return GetTypeId (); |
174 |
} |
175 |
|
151 |
void |
176 |
void |
152 |
PointToPointEpcHelper::DoDispose () |
177 |
PointToPointEpcHelper::DoDispose () |
153 |
{ |
178 |
{ |
|
319 |
return bearerId; |
344 |
return bearerId; |
320 |
} |
345 |
} |
321 |
|
346 |
|
322 |
|
|
|
323 |
Ptr<Node> |
347 |
Ptr<Node> |
324 |
PointToPointEpcHelper::GetPgwNode () |
348 |
PointToPointEpcHelper::GetPgwNode () |
325 |
{ |
349 |
{ |
326 |
return m_sgwPgw; |
350 |
return m_sgwPgw; |
327 |
} |
351 |
} |
328 |
|
352 |
|
329 |
|
|
|
330 |
Ipv4InterfaceContainer |
353 |
Ipv4InterfaceContainer |
331 |
PointToPointEpcHelper::AssignUeIpv4Address (NetDeviceContainer ueDevices) |
354 |
PointToPointEpcHelper::AssignUeIpv4Address (NetDeviceContainer ueDevices) |
332 |
{ |
355 |
{ |
333 |
return m_ueAddressHelper.Assign (ueDevices); |
356 |
return m_ueAddressHelper.Assign (ueDevices); |
334 |
} |
357 |
} |
335 |
|
358 |
|
336 |
|
|
|
337 |
|
338 |
Ipv4Address |
359 |
Ipv4Address |
339 |
PointToPointEpcHelper::GetUeDefaultGatewayAddress () |
360 |
PointToPointEpcHelper::GetUeDefaultGatewayAddress () |
340 |
{ |
361 |
{ |