From c8c919d1baf05a69aee4895421db507db92d82b6 Mon Sep 17 00:00:00 2001 From: Natale Patriciello Date: Tue, 12 Mar 2019 09:50:38 +0100 Subject: [PATCH] lte: Fix EPC test crashes by removing an assert That's bad, usually the test must be reworked to not fail the assert. However, there's no time in fixing a decade-old test, and also the code worked like this since... forever. My fault was to add the assert in the first instance, thinking that it would be a good service to the users. I was wrong. --- src/lte/helper/point-to-point-epc-helper.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lte/helper/point-to-point-epc-helper.cc b/src/lte/helper/point-to-point-epc-helper.cc index a064fb9b7..0bc8d96ec 100644 --- a/src/lte/helper/point-to-point-epc-helper.cc +++ b/src/lte/helper/point-to-point-epc-helper.cc @@ -569,10 +569,17 @@ PointToPointEpcHelper::DoActivateEpsBearerForUe (const Ptr &ueDevice, const EpsBearer &bearer) const { NS_LOG_FUNCTION (this); - Ptr ueLteDevice = ueDevice->GetObject (); - NS_ABORT_MSG_IF (ueLteDevice == nullptr , "Unable to find LteUeNetDevice while activating the EPS bearer"); - - Simulator::ScheduleNow (&EpcUeNas::ActivateEpsBearer, ueLteDevice->GetNas (), bearer, tft); + Ptr ueLteDevice = DynamicCast (ueDevice); + if (ueLteDevice == nullptr) + { + // You may wonder why this is not an assert. Well, take a look in epc-test-s1u-downlink + // and -uplink: we are using CSMA to simulate UEs. + NS_LOG_WARN ("Unable to find LteUeNetDevice while activating the EPS bearer"); + } + else + { + Simulator::ScheduleNow (&EpcUeNas::ActivateEpsBearer, ueLteDevice->GetNas (), bearer, tft); + } } Ptr