How to Develop Temporally Ordered Routing Projects Using NS3

To develop the Temporally Ordered Routing Algorithm (TORA) Projects use NS-3. The Temporally Ordered Routing Algorithm (TORA) is an adaptive, distributed routing protocol modeled for highly dynamic mobile ad-hoc networks (MANETs). TORA encourage the several paths, loop-free routing, and decrease the overhead through responding only to connection failures.

NS3 does not contain the built-in execution of TORA. Nevertheless, we can:

  1. Incorporate a TORA from an external component for instance from NS2.
  2. Improve the custom for TORA execution of NS3.

Steps to Develop a TORA-Based Project in NS3

Approach 1: Implementing TORA Using AODV as a Reference

Since NS3 does not include TORA, we can build the custom TORA component through change an existing on-demand protocol, like as AODV.

  1. Install and Set Up NS3

We enable the tool NS-3 is installed for your system:

git clone

cd ns-3-dev

./ns3 configure –enable-examples –enable-tests

./ns3 build

  1. Define Network Topology

TORA is model for highly dynamic networks, like as MANETs.

Generate a Network Topology

NodeContainer nodes;

nodes.Create(10);  // Create 10 mobile nodes

Improve the Mobility to Nodes

TORA is calculated for mobile networks, so we increase the mobility:

MobilityHelper mobility;

mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”,

“Speed”, StringValue(“ns3::UniformRandomVariable[Min=1.0|Max=5.0]”),

“Pause”, StringValue(“ns3::ConstantRandomVariable[Constant=2.0]”));

mobility.Install(nodes);

  1. Set Up Wireless Ad-Hoc Communication

TORA is pattern for wireless ad-hoc networks.

Wi-Fi for used the communication

WifiHelper wifi;

wifi.SetStandard(WIFI_STANDARD_80211n);

WifiMacHelper mac;

mac.SetType(“ns3::AdhocWifiMac”);

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();

YansWifiPhyHelper wifiPhy;

wifiPhy.SetChannel(wifiChannel.Create());

NetDeviceContainer devices = wifi.Install(wifiPhy, mac, nodes);

  1. We transfer the IP Addresses

InternetStackHelper stack;

stack.Install(nodes);

Ipv4AddressHelper address;

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

Ipv4InterfaceContainer interfaces = address.Assign(devices);

  1. Employ the TORA Routing

Since NS-3 does not have built-in a TORA execution, we require to:

  • Cover the Ipv4RoutingProtocol class.
  • We apply the execution process for TORA’s key phases: Route generation, Route handling, and Route deletion.

(A) Build a Custom for TORA Routing Class

class ToraRoutingProtocol : public Ipv4RoutingProtocol {

public:

void CreateRoute(Ptr<Packet> packet, Ipv4Address destination);

void MaintainRoute(Ptr<Packet> packet, Ipv4Address destination);

void EraseRoute(Ptr<Packet> packet, Ipv4Address destination);

};

(B) We employ for TORA’s Route Generation

void ToraRoutingProtocol::CreateRoute(Ptr<Packet> packet, Ipv4Address destination) {

// Assign a height metric to the node

uint32_t height = Simulator::Now().GetNanoSeconds();

RouteTable[destination] = height;

}

(C) Implement TORA’s Route handling

void ToraRoutingProtocol::MaintainRoute(Ptr<Packet> packet, Ipv4Address destination) {

if (DetectLinkFailure()) {

// Adjust height value and redirect packets

RouteTable[destination] += 1;

}

}

(D) We estimate the TORA’s Route Deletion

void ToraRoutingProtocol::EraseRoute(Ptr<Packet> packet, Ipv4Address destination) {

RouteTable.erase(destination);

}

(E) It utilized the Custom TORA Protocol

Ptr<ToraRoutingProtocol> toraRouting = CreateObject<ToraRoutingProtocol>();

nodes.Get(0)->AggregateObject(toraRouting);

  1. We configure the congestion applications in TORA

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApps = echoServer.Install(nodes.Get(9));

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(interfaces.GetAddress(9), 9);

echoClient.SetAttribute(“MaxPackets”, UintegerValue(5));

echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0)));

echoClient.SetAttribute(“PacketSize”, UintegerValue(512));

ApplicationContainer clientApps = echoClient.Install(nodes.Get(0));

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

  1. Support the Tracing for Debugging

AsciiTraceHelper ascii;

wifi.EnableAsciiAll(ascii.CreateFileStream(“tora-routing.tr”));

wifi.EnablePcapAll(“tora-routing”);

  1. Implement the Replication

Simulator::Run();

Simulator::Destroy();

  1. Investigate the outcomes for TORA

Ensure the tool like NetAnim for vision:

./waf –run tora-routing

netanim

  1. Extend with Advanced Features
  • Energy-Aware TORA: Change the height values terms on residual for battery life.
  • QoS-Aware TORA: We used the performance of parameter metrics such as delay and jitter to alter the routing decisions.
  • AI-Based TORA: used for machine learning to find the optimal routing paths.

Approach 2: Porting TORA from NS-2

If we require to additional accurate execution of TORA, we can port it from NS-2:

  1. It placed the TORA source files in NS-2 (ns-2.35/tora/).
  2. Exchange the NS-2 TORA code on NS-3 using C++ alterations.
  3. Recompile NS-3 by new TORA component.

We had clearly get knowledge about how to execute the TORA routing example projects that were executes in different scenarios using ns3 simulation and also any queries related to this project will be clarified in a different manual in TORA routing.