[ndnSIM] Unexpected output for 3 nodes configuration using wifi

Otávio Augusto otavio.augusto.snc at gmail.com
Sat Jan 18 11:03:27 PST 2025


Hi Sirapop,

Yes, the communication between the nodes at 10,70 and 120,70 takes one hop,
which makes sense. However, I expected the communication to use the
intermediary node (in 70,70), in which case it would use two hops. I mean,
I expected the interest packet to go through nodes 1, 2 and 3, and the data
packet to go the other way around. I don't understand why I get so many
"ndn.Consumer:OnTimeout" and why only direct communications between the
nodes in 10,70 and 120,70 seems to work. It seems like the intermediary
node isn't being used...

Att,

Em sáb., 18 de jan. de 2025 às 05:56, Sirapop Theeranantachai <
sirapop741 at gmail.com> escreveu:

> Hi Otávio,
>
> Are you configuring three nodes in a  presumedly multi-access wifi? Then I
> believe a transmission from the node at (10,70) and the other node at
> (120,70) would take one hop, no?
>
> You can trace packets with a regular ns-3 logging tool. (NetDevice and
> Channel, for example).
> https://www.nsnam.org/docs/release/3.37/manual/html/logging.html
>
>
> On Fri, Jan 17, 2025, 5:08 AM Otávio Augusto via ndnSIM <
> ndnsim at lists.cs.ucla.edu> wrote:
>
>> Hello.
>>
>> The contents of the ndn_wifi_3_nodes.cc file seem to be unavailable. So,
>> here is the code:
>>
>> #include "ns3/core-module.h"
>> #include "ns3/network-module.h"
>> #include "ns3/applications-module.h"
>> #include "ns3/wifi-module.h"
>> #include "ns3/mobility-module.h"
>> #include "ns3/internet-module.h"
>>
>> #include "ns3/ndnSIM-module.h"
>>
>> using namespace std;
>> namespace ns3 {
>>
>> NS_LOG_COMPONENT_DEFINE("ndn.WifiExample1");
>>
>> int
>> main(int argc, char* argv[])
>> {
>>   // disable fragmentation
>>
>> Config::SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold",
>> StringValue("2200"));
>>   Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold",
>> StringValue("2200"));
>>   Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode",
>>                      StringValue("OfdmRate24Mbps"));
>>
>>   CommandLine cmd;
>>   cmd.Parse(argc, argv);
>>
>>   WifiHelper wifi;
>>   // wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
>>   wifi.SetStandard(WIFI_STANDARD_80211a);
>>   wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
>>                                StringValue("OfdmRate24Mbps"));
>>
>>   YansWifiChannelHelper wifiChannel;
>>
>> wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
>>
>> wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel");
>>   wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
>>
>>   YansWifiPhyHelper wifiPhyHelper;
>>   wifiPhyHelper.SetChannel(wifiChannel.Create());
>>   wifiPhyHelper.Set("TxPowerStart", DoubleValue(5));
>>   wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
>>
>>   WifiMacHelper wifiMacHelper;
>>   wifiMacHelper.SetType("ns3::AdhocWifiMac");
>>
>>   MobilityHelper mobility;
>>
>>   NodeContainer nodes;
>>   nodes.Create(3);
>>
>>   ////////////////
>>   // 1. Install Wifi
>>   NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper,
>> wifiMacHelper, nodes);
>>
>>   // 2. Install Mobility model
>>   mobility.Install(nodes);
>>
>>   std::cout << "set position for nodes" << std::endl;
>>
>>   Ptr<ConstantPositionMobilityModel> s1 =
>> nodes.Get(0)->GetObject<ConstantPositionMobilityModel> ();
>>   Ptr<ConstantPositionMobilityModel> s2 =
>> nodes.Get(1)->GetObject<ConstantPositionMobilityModel> ();
>>   Ptr<ConstantPositionMobilityModel> s3 =
>> nodes.Get(2)->GetObject<ConstantPositionMobilityModel> ();
>>
>>   s1->SetPosition (Vector ( 10.0, 70.0, 0));
>>   s2->SetPosition (Vector ( 70.0, 70, 0));
>>   s3->SetPosition (Vector ( 120.0, 70.0, 0));
>>
>>   // 3. Install NDN stack
>>   NS_LOG_INFO("Installing NDN stack");
>>   ndn::StackHelper ndnHelper;
>>   // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId
>> (), MakeCallback(MyNetDeviceFaceCallback));
>>   ndnHelper.setPolicy("nfd::cs::lru");
>>   ndnHelper.setCsSize(0);
>>   ndnHelper.SetDefaultRoutes(true);
>>   ndnHelper.Install(nodes);
>>
>>   // Set strategy
>>   ndn::StrategyChoiceHelper::Install(nodes, "/",
>> "/localhost/nfd/strategy/multicast");
>>
>>   // 4. Set up applications
>>   NS_LOG_INFO("Installing Applications");
>>
>>   ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
>>   consumerHelper.SetPrefix("/test/prefix");
>>   consumerHelper.SetAttribute("Frequency", DoubleValue(1.0));
>>   consumerHelper.Install(nodes.Get(0));
>>
>>   ndn::AppHelper producerHelper("ns3::ndn::Producer");
>>   producerHelper.SetPrefix("/");
>>   producerHelper.SetAttribute("PayloadSize", StringValue("1200"));
>>   producerHelper.Install(nodes.Get(2));
>>
>>
>>   Simulator::Stop(Seconds(30.0));
>>
>>   Simulator::Run();
>>   Simulator::Destroy();
>>
>>   return 0;
>> }
>>
>> } // namespace ns3
>>
>> int
>> main(int argc, char* argv[])
>> {
>>   return ns3::main(argc, argv);
>> }
>>
>>
>> Att,
>> Otávio
>>
>> Em qua., 15 de jan. de 2025 às 10:29, Otávio Augusto <
>> otavio.augusto.snc at gmail.com> escreveu:
>>
>>> Hello everyone.
>>>
>>> I'm testing a multi-node with wifi connection in ndnSIM, the code is
>>> attached (ndn_wifi_3_nodes.cc). In addition, I'm using ndnSIM from Windows
>>> OS with WSL 2, Ubuntu 20.04  (I don't know if this is important).
>>>
>>> Using the following command I get some log information about the
>>> consumer:
>>>
>>>
>>> *NS_LOG=ndn.Consumer ./waf --run=ndn_wifi_3_nodes*
>>> The output is in the out.txt attachment.
>>> I expected the communication to go through the intermediary. However, as
>>> you can see, many messages timed out and the data packets that reached the
>>> consumer contain hop count equal to 1, which probably means that the
>>> consumer and producer are communicating directly, without using the
>>> intermediary node. Why did this happen?
>>>
>>> Note 1: in the 'ndn-simple-wifi' example the best-route strategy is
>>> used, but for me it resulted in NACK, I don't know why. Because of this, I
>>> used the multicast strategy.
>>> Note 2: How can I see the ndn route log (intermediate node, node 1)? I
>>> know how to check the consumer and producer logs, but I don't know what
>>> name I use to check the ndn router log with *NS_LOG*.
>>> --
>>> Otávio da Cruz
>>> Doctor student
>>> Electrical Engineering at the Graduate Program in Electrical Engineering
>>> of the Federal University of Rio Grande do Sul (UFRGS) - Brazil
>>>
>> _______________________________________________
>> ndnSIM mailing list
>> ndnSIM at lists.cs.ucla.edu
>> https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20250118/ea87c5bc/attachment.htm>


More information about the ndnSIM mailing list