diff --git a/model/mock-channel.cc b/model/mock-channel.cc index 22fe639..2e20166 100644 --- a/model/mock-channel.cc +++ b/model/mock-channel.cc @@ -117,8 +117,8 @@ MockChannel::GetDelay (Ptr src, Ptr ds { NS_LOG_DEBUG ("Get delay from " << src << " to " << dst); - Ptr modSrc = src->GetMobilityModel (); - Ptr modDst = dst->GetMobilityModel (); + Ptr modSrc = src->GetNode ()->GetObject (); + Ptr modDst = dst->GetNode ()->GetObject (); Time propagationDelay = m_propagationDelay->GetDelay (modSrc, modDst); @@ -163,7 +163,7 @@ MockChannel::Deliver ( Time delay = GetDelay (src, dst, txTime); /* Check if there is LOS between the source and destination */ - if (GetPropagationLoss ()->CalcRxPower(1, src->GetMobilityModel(), dst->GetMobilityModel()) > 0) + if (GetPropagationLoss ()->CalcRxPower(1, src->GetNode ()->GetObject (), dst->GetNode ()->GetObject ()) > 0) { Simulator::ScheduleWithContext (dst->GetNode ()->GetId (), delay, diff --git a/model/mock-net-device.cc b/model/mock-net-device.cc index b9eb988..643567b 100644 --- a/model/mock-net-device.cc +++ b/model/mock-net-device.cc @@ -78,11 +78,6 @@ MockNetDevice::GetTypeId (void) PointerValue (), MakePointerAccessor (&MockNetDevice::m_queue), MakePointerChecker > ()) - .AddAttribute ("MobilityModel", "The mobility model of the device", - PointerValue (), - MakePointerAccessor (&MockNetDevice::SetMobilityModel, - &MockNetDevice::GetMobilityModel), - MakePointerChecker ()) // // Trace sources at the "top" of the net device, where packets transition // to/from higher layers. @@ -713,19 +708,6 @@ MockNetDevice::EtherToPpp (uint16_t proto) return 0; } -Ptr -MockNetDevice::GetMobilityModel (void) const -{ - return m_mobilityModel; -} - -void -MockNetDevice::SetMobilityModel (Ptr model) -{ - NS_LOG_FUNCTION (this); - m_mobilityModel = model; -} - bool MockNetDevice::IsPointToPoint() const { diff --git a/model/mock-net-device.h b/model/mock-net-device.h index c6a070f..ce1d18e 100644 --- a/model/mock-net-device.h +++ b/model/mock-net-device.h @@ -195,8 +195,6 @@ public: virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb); virtual bool SupportsSendFrom (void) const; - Ptr GetMobilityModel (void) const; - void SetMobilityModel (Ptr model); void NotifyLinkDown (void); protected: @@ -477,8 +475,6 @@ private: Ptr m_currentPkt; //!< Current packet processed - Ptr m_mobilityModel; - /** * \brief PPP to Ethernet protocol number mapping * \param protocol A PPP protocol number diff --git a/test/isl-mock-channel-test-suite.cc b/test/isl-mock-channel-test-suite.cc index 64c0241..47e57fc 100644 --- a/test/isl-mock-channel-test-suite.cc +++ b/test/isl-mock-channel-test-suite.cc @@ -42,7 +42,6 @@ IslMockChannelTransmitUnknownTestCase::DoRun (void) Time txTime; channel->SetAttribute ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel")); channel->SetAttribute ("PropagationLoss", StringValue ("ns3::IslPropagationLossModel")); - dev->SetAttribute ("MobilityModel", StringValue ("ns3::WaypointMobilityModel")); bool result = channel->TransmitStart (p, srcId, destAddr, txTime); NS_TEST_ASSERT_MSG_EQ (result, false, "Unknown destination fails to deliver"); @@ -78,15 +77,17 @@ IslMockChannelTransmitKnownTestCase::DoRun (void) Ptr p = Ptr(packet); Ptr srcNode = CreateObject (); + Ptr loc = CreateObject (); + srcNode->AggregateObject (loc); Ptr srcDev = CreateObject (); srcDev->SetNode (srcNode); - srcDev->SetAttribute ("MobilityModel", StringValue ("ns3::WaypointMobilityModel")); int32_t srcId = channel->Attach (srcDev); Ptr dstNode = CreateObject (); + loc = CreateObject (); + dstNode->AggregateObject (loc); Ptr dstDev = CreateObject (); dstDev->SetNode (dstNode); - dstDev->SetAttribute ("MobilityModel", StringValue ("ns3::WaypointMobilityModel")); channel->Attach (dstDev); Address destAddr = dstDev->GetAddress (); diff --git a/test/leo-mock-channel-test-suite.cc b/test/leo-mock-channel-test-suite.cc index 9b473ed..a6643c8 100644 --- a/test/leo-mock-channel-test-suite.cc +++ b/test/leo-mock-channel-test-suite.cc @@ -79,6 +79,8 @@ LeoMockChannelTransmitKnownTestCase::DoRun (void) Ptr p = Ptr(packet); Ptr srcNode = CreateObject (); + Ptr loc = CreateObject (); + srcNode->AggregateObject (loc); Ptr srcDev = CreateObject (); srcDev->SetNode (srcNode); srcDev->SetAttribute ("MobilityModel", StringValue ("ns3::ConstantPositionMobilityModel")); @@ -86,6 +88,8 @@ LeoMockChannelTransmitKnownTestCase::DoRun (void) int32_t srcId = channel->Attach (srcDev); Ptr dstNode = CreateObject (); + loc = CreateObject (); + dstNode->AggregateObject (loc); Ptr dstDev = CreateObject (); dstDev->SetNode (dstNode); dstDev->SetAttribute ("MobilityModel", StringValue ("ns3::WaypointMobilityModel"));