To Implement a Software-Defined Wide Area Network (SD-WAN) protocol in OMNeT++ has to follow several steps that includes to generate the module then emulate the characteristics of SD-WAN that usually contains the dynamic path selection, centralized management, and enhanced performance and reliability for wide area networks. The INET framework in OMNeT++ is extended to support such protocols.
The given below is the detailed procedures on how to implement the basic SD-WAN protocol in OMNeT++ using the INET framework.
Step-by-Step Implementation:
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Define the SD-WAN Protocol
SD-WAN have numerous key components:
Step 3: Create the SD-WAN Protocol Module
Define the Module in .ned File
Create a .ned file for the SD-WAN protocol module.
simple SDWAN
{
parameters:
@display(“i=block/network”);
double pathCheckInterval @unit(s) = default(5s); // Interval for checking path performance
gates:
input fromNetworkLayer;
output toNetworkLayer;
input fromLowerLayer;
output toLowerLayer;
}
Implement the Module in C++
Create the corresponding .cc and .h files.
SDWAN.h
#ifndef __SDWAN_H_
#define __SDWAN_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/networklayer/contract/IInterfaceTable.h”
#include “inet/networklayer/ipv4/Ipv4Header_m.h”
#include “inet/networklayer/ipv4/Ipv4Route.h”
#include “inet/common/INETDefs.h”
#include <map>
using namespace omnetpp;
using namespace inet;
class SDWAN : public cSimpleModule
{
private:
double pathCheckInterval;
IRoutingTable *routingTable;
IInterfaceTable *interfaceTable;
cMessage *pathCheckMsg;
std::map<L3Address, std::vector<int>> pathMetrics; // Stores performance metrics for paths
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void checkPaths();
void handleUpperLayerPacket(cPacket *packet);
void handleLowerLayerPacket(cPacket *packet);
void forwardPacket(Ipv4Header *ipHeader, cPacket *packet);
void updatePathMetrics();
public:
SDWAN();
virtual ~SDWAN();
};
#endif
SDWAN.cc
#include “SDWAN.h”
Define_Module(SDWAN);
SDWAN::SDWAN()
{
pathCheckMsg = nullptr;
}
SDWAN::~SDWAN()
{
cancelAndDelete(pathCheckMsg);
}
void SDWAN::initialize()
{
pathCheckInterval = par(“pathCheckInterval”);
routingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
interfaceTable = getModuleFromPar<IInterfaceTable>(par(“interfaceTableModule”), this);
pathCheckMsg = new cMessage(“checkPaths”);
scheduleAt(simTime() + pathCheckInterval, pathCheckMsg);
}
void SDWAN::handleMessage(cMessage *msg)
{
if (msg == pathCheckMsg)
{
checkPaths();
scheduleAt(simTime() + pathCheckInterval, pathCheckMsg);
}
else if (msg->arrivedOn(“fromUpperLayer”))
{
handleUpperLayerPacket(check_and_cast<cPacket *>(msg));
}
else if (msg->arrivedOn(“fromLowerLayer”))
{
handleLowerLayerPacket(check_and_cast<cPacket *>(msg));
}
else
{
delete msg;
}
}
void SDWAN::checkPaths()
{
// Code to check path performance metrics
updatePathMetrics();
}
void SDWAN::handleUpperLayerPacket(cPacket *packet)
{
Ipv4Header *ipHeader = new Ipv4Header();
ipHeader->setSrcAddress(interfaceTable->getInterface(0)->getIpv4Address());
ipHeader->setDestAddress(packet->getPar(“destAddr”).stringValue());
packet->insertAtFront(ipHeader);
forwardPacket(ipHeader, packet);
}
void SDWAN::handleLowerLayerPacket(cPacket *packet)
{
Ipv4Header *ipHeader = check_and_cast<Ipv4Header *>(packet->removeAtFront<Ipv4Header>());
if (ipHeader->getDestAddress() == interfaceTable->getInterface(0)->getIpv4Address())
{
send(packet, “toNetworkLayer”);
}
else
{
forwardPacket(ipHeader, packet);
}
}
void SDWAN::forwardPacket(Ipv4Header *ipHeader, cPacket *packet)
{
Ipv4Route *route = routingTable->findBestMatchingRoute(ipHeader->getDestAddress());
if (route)
{
// Check performance metrics and choose the best path
send(packet, “toLowerLayer”);
}
else
{
delete packet;
}
}
void SDWAN::updatePathMetrics()
{
// Code to update path performance metrics
}
Step 4: Integrate with Simulation Model
Incorporate SDWAN module into a network simulation model.
Network Configuration .ned File
network SDWANNetwork
{
parameters:
@display(“bgb=600,400”);
submodules:
host1: StandardHost {
parameters:
@display(“p=100,200”);
}
host2: StandardHost {
parameters:
@display(“p=300,200”);
}
sdwan: SDWAN {
parameters:
@display(“p=200,100”);
}
connections:
host1.ethg++ <–> Eth10M <–> sdwan.fromLowerLayer++;
host2.ethg++ <–> Eth10M <–> sdwan.fromLowerLayer++;
}
Step 5: Configure the Simulation
Configure the simulation parameters in the omnetpp.ini file.
network = SDWANNetwork
*.host*.eth[*].mac.typename = “EthernetMac”
*.host*.ipv4.arp.typename = “GlobalArp”
*.host*.ipv4.routingTable.netmaskRoutes = “true”
*.sdwan.eth[*].mac.typename = “EthernetMac”
*.sdwan.eth[*].mac.promiscuous = true
*.host1.ipv4.config = “host1.config”
*.host2.ipv4.config = “host2.config”
*.host1.ipv4.routingTable.netmaskRoutes = “true”
*.host2.ipv4.routingTable.netmaskRoutes = “true”
Step 6: Test and Debug
The SD-WAN has successfully implemented and executed in OMNeT++ simulator tool that has generate the module then emulate the features of SD-WAN to enhance the performance and reliability dynamic path selection. If you any simulation and implementation queries regarding the SD-WAN we will support and provide that too.