LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya
(CTTC) | 3 * Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya
(CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 AddTestCase (new LenaDeactivateBearerTestCase (dist_1,estThrPssDl_1,packetSize
_1,1,errorModel,true), TestCase::QUICK); | 94 AddTestCase (new LenaDeactivateBearerTestCase (dist_1,estThrPssDl_1,packetSize
_1,1,errorModel,true), TestCase::QUICK); |
95 } | 95 } |
96 | 96 |
97 static LenaTestBearerDeactivateSuite lenaTestBearerDeactivateSuite; ///< the tes
t suite | 97 static LenaTestBearerDeactivateSuite lenaTestBearerDeactivateSuite; ///< the tes
t suite |
98 | 98 |
99 | 99 |
100 std::string | 100 std::string |
101 LenaDeactivateBearerTestCase::BuildNameString (uint16_t nUser, std::vector<uint1
6_t> dist) | 101 LenaDeactivateBearerTestCase::BuildNameString (uint16_t nUser, std::vector<uint1
6_t> dist) |
102 { | 102 { |
| 103 NS_UNUSED(nUser); |
103 std::ostringstream oss; | 104 std::ostringstream oss; |
104 oss << "distances (m) = [ "; | 105 oss << "distances (m) = [ "; |
105 for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++
it) | 106 for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++
it) |
106 { | 107 { |
107 oss << *it << " "; | 108 oss << *it << " "; |
108 } | 109 } |
109 oss << "]"; | 110 oss << "]"; |
110 return oss.str (); | 111 return oss.str (); |
111 } | 112 } |
112 | 113 |
113 LenaDeactivateBearerTestCase::LenaDeactivateBearerTestCase (std::vector<uint16_t
> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uin
t16_t interval,bool errorModelEnabled, bool useIdealRrc) | 114 LenaDeactivateBearerTestCase::LenaDeactivateBearerTestCase (std::vector<uint16_t
> dist, std::vector<uint32_t> estThrPssDl, std::vector<uint16_t> packetSize, uin
t16_t interval,bool errorModelEnabled, bool /*useIdealRrc*/) |
114 : TestCase (BuildNameString (dist.size (), dist)), | 115 : TestCase (BuildNameString (static_cast<uint16_t>(dist.size ()), dist)), |
115 m_nUser (dist.size ()), | 116 m_nUser (static_cast<uint16_t>(dist.size ())), |
116 m_dist (dist), | 117 m_dist (dist), |
117 m_packetSize (packetSize), | 118 m_packetSize (packetSize), |
118 m_interval (interval), | 119 m_interval (interval), |
119 m_estThrPssDl (estThrPssDl), | 120 m_estThrPssDl (estThrPssDl), |
120 m_errorModelEnabled (errorModelEnabled) | 121 m_errorModelEnabled (errorModelEnabled) |
121 { | 122 { |
122 } | 123 } |
123 | 124 |
124 LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase () | 125 LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase () |
125 { | 126 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Ipv4AddressHelper ipv4h; | 160 Ipv4AddressHelper ipv4h; |
160 ipv4h.SetBase ("1.0.0.0", "255.0.0.0"); | 161 ipv4h.SetBase ("1.0.0.0", "255.0.0.0"); |
161 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices); | 162 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices); |
162 // interface 0 is localhost, 1 is the p2p device | 163 // interface 0 is localhost, 1 is the p2p device |
163 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1); | 164 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1); |
164 | 165 |
165 Ipv4StaticRoutingHelper ipv4RoutingHelper; | 166 Ipv4StaticRoutingHelper ipv4RoutingHelper; |
166 Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRo
uting (remoteHost->GetObject<Ipv4> ()); | 167 Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRo
uting (remoteHost->GetObject<Ipv4> ()); |
167 remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask
("255.0.0.0"), 1); | 168 remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask
("255.0.0.0"), 1); |
168 | 169 |
169 // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVE
L_ALL); | 170 #if 0 |
170 | 171 LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_A
LL); |
171 // LogComponentEnable ("LenaTestDeactivateBearer", LOG_LEVEL_ALL); | 172 |
172 // LogComponentEnable ("LteHelper", logLevel); | 173 LogComponentEnable ("LenaTestDeactivateBearer", LOG_LEVEL_ALL); |
173 // LogComponentEnable ("EpcHelper", logLevel); | 174 LogComponentEnable ("LteHelper", logLevel); |
174 // LogComponentEnable ("EpcEnbApplication", logLevel); | 175 LogComponentEnable ("EpcHelper", logLevel); |
175 // LogComponentEnable ("EpcSgwPgwApplication", logLevel); | 176 LogComponentEnable ("EpcEnbApplication", logLevel); |
176 // LogComponentEnable ("EpcMme", logLevel); | 177 LogComponentEnable ("EpcSgwPgwApplication", logLevel); |
177 // LogComponentEnable ("LteEnbRrc", logLevel); | 178 LogComponentEnable ("EpcMme", logLevel); |
178 | 179 LogComponentEnable ("LteEnbRrc", logLevel); |
| 180 #endif |
| 181 ·· |
179 lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumProp
agationLossModel")); | 182 lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumProp
agationLossModel")); |
180 | 183 |
181 // Create Nodes: eNodeB and UE | 184 // Create Nodes: eNodeB and UE |
182 NodeContainer enbNodes; | 185 NodeContainer enbNodes; |
183 NodeContainer ueNodes; | 186 NodeContainer ueNodes; |
184 enbNodes.Create (1); | 187 enbNodes.Create (1); |
185 ueNodes.Create (m_nUser); | 188 ueNodes.Create (m_nUser); |
186 | 189 |
187 // Install Mobility Model | 190 // Install Mobility Model |
188 MobilityHelper mobility; | 191 MobilityHelper mobility; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 { | 240 { |
238 Ptr<NetDevice> ueDevice = ueDevs.Get (u); | 241 Ptr<NetDevice> ueDevice = ueDevs.Get (u); |
239 GbrQosInformation qos; | 242 GbrQosInformation qos; |
240 qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/
s, considering IP, UDP, RLC, PDCP header size | 243 qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/
s, considering IP, UDP, RLC, PDCP header size |
241 qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; | 244 qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; |
242 qos.mbrDl = qos.gbrDl; | 245 qos.mbrDl = qos.gbrDl; |
243 qos.mbrUl = qos.gbrUl; | 246 qos.mbrUl = qos.gbrUl; |
244 | 247 |
245 enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; | 248 enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; |
246 EpsBearer bearer (q, qos); | 249 EpsBearer bearer (q, qos); |
247 bearer.arp.priorityLevel = 15 - (u + 1); | 250 bearer.arp.priorityLevel = static_cast<uint8_t>(15 - (u + 1)); |
248 bearer.arp.preemptionCapability = true; | 251 bearer.arp.preemptionCapability = true; |
249 bearer.arp.preemptionVulnerability = true; | 252 bearer.arp.preemptionVulnerability = true; |
250 lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default (
)); | 253 lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default (
)); |
251 } | 254 } |
252 | 255 |
253 | 256 |
254 // Install downlink and uplink applications | 257 // Install downlink and uplink applications |
255 uint16_t dlPort = 1234; | 258 uint16_t dlPort = 1234; |
256 uint16_t ulPort = 2000; | 259 uint16_t ulPort = 2000; |
257 PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddres
s (Ipv4Address::GetAny (), dlPort)); | 260 PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddres
s (Ipv4Address::GetAny (), dlPort)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 298 |
296 //get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer | 299 //get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer |
297 Ptr<NetDevice> ueDevice = ueDevs.Get (0); | 300 Ptr<NetDevice> ueDevice = ueDevs.Get (0); |
298 Ptr<NetDevice> enbDevice = enbDevs.Get (0); | 301 Ptr<NetDevice> enbDevice = enbDevs.Get (0); |
299 | 302 |
300 /* | 303 /* |
301 * Instantiate De-activation using Simulator::Schedule() method which will i
nitiate bearer de-activation after deActivateTime | 304 * Instantiate De-activation using Simulator::Schedule() method which will i
nitiate bearer de-activation after deActivateTime |
302 * Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ
obj, T1 a1, T2 a2, T3 a3) | 305 * Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ
obj, T1 a1, T2 a2, T3 a3) |
303 */ | 306 */ |
304 Time deActivateTime (Seconds (1.5)); | 307 Time deActivateTime (Seconds (1.5)); |
305 Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer,
lteHelper, ueDevice, enbDevice, 2); | 308 Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer,
lteHelper, ueDevice, enbDevice, static_cast<uint8_t>(2)); |
306 | 309 |
307 //stop simulation after 3 seconds | 310 //stop simulation after 3 seconds |
308 Simulator::Stop (Seconds (3.0)); | 311 Simulator::Stop (Seconds (3.0)); |
309 | 312 |
310 Simulator::Run (); | 313 Simulator::Run (); |
311 | 314 |
312 NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)"); | 315 NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)"); |
313 std::vector <uint64_t> dlDataRxed; | 316 std::vector <uint64_t> dlDataRxed; |
314 std::vector <uint64_t> dlDataTxed; | 317 std::vector <uint64_t> dlDataTxed; |
315 for (int i = 0; i < m_nUser; i++) | 318 for (int i = 0; i < m_nUser; i++) |
(...skipping 23 matching lines...) Expand all Loading... |
339 } | 342 } |
340 else | 343 else |
341 { | 344 { |
342 NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration,
m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!"); | 345 NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration,
m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!"); |
343 } | 346 } |
344 } | 347 } |
345 | 348 |
346 Simulator::Destroy (); | 349 Simulator::Destroy (); |
347 } | 350 } |
348 } | 351 } |
LEFT | RIGHT |