How to Start Temporary Ordered Routing Projects Using NS3

To start Temporally Ordered Routing Algorithm (TORA) projects using NS3, for follow this procedure:

Steps to Start Temporary Ordered Routing Projects Using NS3

  1. Understand TORA
  • What is TORA?
    • TORA is a highly adaptive, distributed, and scalable routing protocol.
    • It is model for Mobile Ad-hoc Networks (MANETs).
    • It handles the different routes to a destination and offers the loop-free routing.
  • Features:
    • Reactive protocol: Routes are creating on-demand.
    • Temporally-ordered updates we assure the reliability and avoid routing loops.
    • Suitable for highly dynamic networks by regular topology changes.
  1. Set Up NS3
  1. Install NS3:

sudo apt update

sudo apt install g++ python3 git cmake

git clone https://gitlab.com/nsnam/ns-3-dev.git

cd ns-3-dev

./waf configure

./waf build

  1. Verify Installation:

./waf –run scratch/my-first

 

  1. TORA in NS3

The NS3 does not involves a built-in execution of TORA. we could:

  1. Utilized an external TORA execution for module in NS3.
  2. Estimate the TORA from scratch through extending the Ipv4RoutingProtocol class.
  1. Option 1: Using an External TORA Module
  1. Find a TORA Module:
  2. Integrate TORA into NS3:
    • Dwelling the TORA module in the src/ directory.
    • Enhance the module to NS3’s wscript file:

python

obj = bld.create_ns3_module(‘tora’, [‘core’, ‘network’, ‘internet’])

    • Rebuild NS3:

./waf configure

./waf build

  1. Simulate TORA: Use the provided ToraHelper to set up nodes with TORA.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/tora-helper.h”

#include “ns3/mobility-module.h”

#include “ns3/point-to-point-module.h”

#include “ns3/applications-module.h”

 

using namespace ns3;

int main() {

NodeContainer nodes;

nodes.Create(5); // Create 5 nodes

MobilityHelper mobility;

mobility.SetMobilityModel(“ns3::ConstantPositionMobilityModel”);

mobility.Install(nodes);

PointToPointHelper pointToPoint;

pointToPoint.SetDeviceAttribute(“DataRate”, StringValue(“1Mbps”));

pointToPoint.SetChannelAttribute(“Delay”, StringValue(“10ms”));

// Create links

NetDeviceContainer devices1 = pointToPoint.Install(nodes.Get(0), nodes.Get(1));

NetDeviceContainer devices2 = pointToPoint.Install(nodes.Get(1), nodes.Get(2));

NetDeviceContainer devices3 = pointToPoint.Install(nodes.Get(2), nodes.Get(3));

NetDeviceContainer devices4 = pointToPoint.Install(nodes.Get(3), nodes.Get(4));

InternetStackHelper internet;

ToraHelper tora;

internet.SetRoutingHelper(tora);

internet.Install(nodes);

Ipv4AddressHelper ipv4;

ipv4.SetBase(“10.1.1.0”, “255.255.255.0”);

ipv4.Assign(devices1);

 

ipv4.SetBase(“10.1.2.0”, “255.255.255.0”);

ipv4.Assign(devices2);

ipv4.SetBase(“10.1.3.0”, “255.255.255.0”);

ipv4.Assign(devices3);

ipv4.SetBase(“10.1.4.0”, “255.255.255.0”);

ipv4.Assign(devices4);

Simulator::Run();

Simulator::Destroy();

return 0;

}

  1. Option 2: Implement TORA from Scratch

If there is no module is accessible, we could be generating the own TORA protocol in NS3.

Key Steps:

  1. Define the Protocol Class:
    • Encompass the Ipv4RoutingProtocol class.
    • Execute the core TORA operations:
      • Route creation.
      • Route maintenance.
      • Route erasure.
  2. Skeleton Code:

#include “ns3/ipv4-routing-protocol.h”

namespace ns3 {

class ToraRoutingProtocol : public Ipv4RoutingProtocol {

public:

static TypeId GetTypeId();

ToraRoutingProtocol();

virtual ~ToraRoutingProtocol();

Ptr<Ipv4Route> RouteOutput(Ptr<Packet> packet, const Ipv4Header &header,

Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) override;

bool RouteInput(Ptr<const Packet> packet, const Ipv4Header &header,

Ptr<const NetDevice> idev, UnicastForwardCallback ucb,

MulticastForwardCallback mcb, LocalDeliverCallback lcb,

ErrorCallback ecb) override;

private:

void CreateRoute(uint32_t destination);

void MaintainRoute(uint32_t destination);

void EraseRoute(uint32_t destination);

std::map<uint32_t, uint32_t> routeTable; // Destination -> Next Hop

};

} // namespace ns3

  1. Implement Route Management:
    • Utilized the connection failure detection and elevation metrics we accept their topology changes.
    • Estimate a directed acyclic graph (DAG) we assure the loop-free routing.

Example: Route Creation

void ToraRoutingProtocol::CreateRoute(uint32_t destination) {

// Logic to create a route using height metrics

}

  1. Test and Debug
  1. Enable Logging:

NS_LOG=”ToraRoutingProtocol” ./waf –run tora-simulation

  1. Verify Routing Behavior:
    • Utilized .pcap files to analyse packet forwarding with Wireshark.
    • Print routing tables we testing the route creation and maintenance.
  1. Simulate Dynamic Topologies

To test TORA’s adaptability, introduce node mobility or link failures.

Example: Mobility Model

MobilityHelper mobility;

mobility.SetMobilityModel(“ns3::RandomWalk2dMobilityModel”);

mobility.Install(nodes);

Example: Link Failure

Simulator::Schedule(Seconds(5.0), &NetDevice::SetDown, devices1.Get(0)); // Disable link at 5 seconds

  1. Performance Evaluation

The Measure key performance metrics:

  • Packet Delivery Ratio (PDR).
  • End-to-End Delay.
  • Control Overhead: Exchanged the number of control messages are route maintenance.
  • Convergence Time: We stabilize the time taken for routes after a topology change.

In this demonstration we clearly learned and gain knowledge on how the Temporary Ordered Routing project will perform in the network simulation environment using the tool of NS3 and also we deliver the sample snippets to complete the process. More details regarding this process will also be shared.

We assure you of our commitment to achieving outstanding results. Please provide us with the details of your project, and we will assist you in attaining exceptional outcomes. Our developers possess expertise in Mobile Ad-hoc Networks (MANETs) and are equipped to help you generate tailored project ideas and topics. To initiate your Temporally Ordered Routing Algorithm (TORA) projects utilizing NS3, kindly forward all relevant project information to phdprojects.org our team will give you immediate reply.