LEFT | RIGHT |
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 NS_UNUSED (nUser); |
104 std::ostringstream oss; | 104 std::ostringstream oss; |
105 oss << "distances (m) = [ "; | 105 oss << "distances (m) = [ "; |
106 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) |
107 { | 107 { |
108 oss << *it << " "; | 108 oss << *it << " "; |
109 } | 109 } |
110 oss << "]"; | 110 oss << "]"; |
111 return oss.str (); | 111 return oss.str (); |
112 } | 112 } |
113 | 113 |
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 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*/) |
115 : TestCase (BuildNameString (static_cast<uint16_t>(dist.size ()), dist)), | 115 : TestCase (BuildNameString (static_cast<uint16_t> (dist.size ()), dist)), |
116 m_nUser (static_cast<uint16_t>(dist.size ())), | 116 m_nUser (static_cast<uint16_t> (dist.size ())), |
117 m_dist (dist), | 117 m_dist (dist), |
118 m_packetSize (packetSize), | 118 m_packetSize (packetSize), |
119 m_interval (interval), | 119 m_interval (interval), |
120 m_estThrPssDl (estThrPssDl), | 120 m_estThrPssDl (estThrPssDl), |
121 m_errorModelEnabled (errorModelEnabled) | 121 m_errorModelEnabled (errorModelEnabled) |
122 { | 122 { |
123 } | 123 } |
124 | 124 |
125 LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase () | 125 LenaDeactivateBearerTestCase::~LenaDeactivateBearerTestCase () |
126 { | 126 { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 { | 238 { |
239 Ptr<NetDevice> ueDevice = ueDevs.Get (u); | 239 Ptr<NetDevice> ueDevice = ueDevs.Get (u); |
240 GbrQosInformation qos; | 240 GbrQosInformation qos; |
241 qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/
s, considering IP, UDP, RLC, PDCP header size | 241 qos.gbrDl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; // bit/
s, considering IP, UDP, RLC, PDCP header size |
242 qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; | 242 qos.gbrUl = (m_packetSize.at (u) + 32) * (1000 / m_interval) * 8; |
243 qos.mbrDl = qos.gbrDl; | 243 qos.mbrDl = qos.gbrDl; |
244 qos.mbrUl = qos.gbrUl; | 244 qos.mbrUl = qos.gbrUl; |
245 | 245 |
246 enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; | 246 enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; |
247 EpsBearer bearer (q, qos); | 247 EpsBearer bearer (q, qos); |
248 bearer.arp.priorityLevel = static_cast<uint8_t>(15 - (u + 1)); | 248 bearer.arp.priorityLevel = 15 - (u + 1); |
249 bearer.arp.preemptionCapability = true; | 249 bearer.arp.preemptionCapability = true; |
250 bearer.arp.preemptionVulnerability = true; | 250 bearer.arp.preemptionVulnerability = true; |
251 lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default (
)); | 251 lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default (
)); |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 // Install downlink and uplink applications | 255 // Install downlink and uplink applications |
256 uint16_t dlPort = 1234; | 256 uint16_t dlPort = 1234; |
257 uint16_t ulPort = 2000; | 257 uint16_t ulPort = 2000; |
258 PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddres
s (Ipv4Address::GetAny (), dlPort)); | 258 PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddres
s (Ipv4Address::GetAny (), dlPort)); |
259 PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddres
s (Ipv4Address::GetAny (), ulPort)); | |
260 ApplicationContainer clientApps; | 259 ApplicationContainer clientApps; |
261 ApplicationContainer serverApps; | 260 ApplicationContainer serverApps; |
262 | 261 |
263 serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); // receive packets
from UEs | |
264 for (uint32_t u = 0; u < ueNodes.GetN (); ++u) | 262 for (uint32_t u = 0; u < ueNodes.GetN (); ++u) |
265 { | 263 { |
266 ++ulPort; | 264 ++ulPort; |
267 serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive
packets from remotehost | 265 serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive
packets from remotehost |
| 266 PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAd
dress (Ipv4Address::GetAny (), ulPort)); |
| 267 serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); // receive pack
ets from UEs |
268 | 268 |
269 UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink pac
kets generator | 269 UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink pac
kets generator |
270 dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval))); | 270 dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval))); |
271 dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000)); | 271 dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000)); |
272 dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u))); | 272 dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u))); |
273 | 273 |
274 UdpClientHelper ulClient (remoteHostAddr, ulPort); // downlink p
ackets generator | 274 UdpClientHelper ulClient (remoteHostAddr, ulPort); // downlink p
ackets generator |
275 ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval))); | 275 ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval))); |
276 ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000)); | 276 ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000)); |
277 ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u))); | 277 ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u))); |
(...skipping 18 matching lines...) Expand all Loading... |
296 | 296 |
297 //get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer | 297 //get ue device pointer for UE-ID 0 IMSI 1 and enb device pointer |
298 Ptr<NetDevice> ueDevice = ueDevs.Get (0); | 298 Ptr<NetDevice> ueDevice = ueDevs.Get (0); |
299 Ptr<NetDevice> enbDevice = enbDevs.Get (0); | 299 Ptr<NetDevice> enbDevice = enbDevs.Get (0); |
300 | 300 |
301 /* | 301 /* |
302 * Instantiate De-activation using Simulator::Schedule() method which will i
nitiate bearer de-activation after deActivateTime | 302 * Instantiate De-activation using Simulator::Schedule() method which will i
nitiate bearer de-activation after deActivateTime |
303 * Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ
obj, T1 a1, T2 a2, T3 a3) | 303 * Instantiate De-activation in sequence (Time const &time, MEM mem_ptr, OBJ
obj, T1 a1, T2 a2, T3 a3) |
304 */ | 304 */ |
305 Time deActivateTime (Seconds (1.5)); | 305 Time deActivateTime (Seconds (1.5)); |
306 Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer,
lteHelper, ueDevice, enbDevice, static_cast<uint8_t>(2)); | 306 Simulator::Schedule (deActivateTime, &LteHelper::DeActivateDedicatedEpsBearer,
lteHelper, ueDevice, enbDevice, 2); |
307 | 307 |
308 //stop simulation after 3 seconds | 308 //stop simulation after 3 seconds |
309 Simulator::Stop (Seconds (3.0)); | 309 Simulator::Stop (Seconds (3.0)); |
310 | 310 |
311 Simulator::Run (); | 311 Simulator::Run (); |
312 | 312 |
313 NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)"); | 313 NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)"); |
314 std::vector <uint64_t> dlDataRxed; | 314 std::vector <uint64_t> dlDataRxed; |
315 std::vector <uint64_t> dlDataTxed; | 315 std::vector <uint64_t> dlDataTxed; |
316 for (int i = 0; i < m_nUser; i++) | 316 for (int i = 0; i < m_nUser; i++) |
(...skipping 23 matching lines...) Expand all Loading... |
340 } | 340 } |
341 else | 341 else |
342 { | 342 { |
343 NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration,
m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!"); | 343 NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataTxed.at (i) / statsDuration,
m_estThrPssDl.at (i), m_estThrPssDl.at (i) * tolerance, " Unfair Throughput!"); |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 Simulator::Destroy (); | 347 Simulator::Destroy (); |
348 } | 348 } |
349 } | 349 } |
LEFT | RIGHT |