To implement Wide Area Network (WAN) protocols in OMNeT++ has numerous steps and one of the frequently used WAN protocols is Multiprotocol Label Switching (MPLS).the given below is the brief procedures to implement the MPLS protocol in OMNeT++ using the INET framework. Be in touch with us to get best simulation results and get novel project ideas.
Step-by-Step Implementation;
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Understand MPLS Protocol
MPLS is a data-carrying method that directs information from one node to the next based on short path labels rather than long network addresses. Key components contain:
Step 3: Create MPLS Protocol Modules
Define the Modules in .ned Files
Create .ned files for the MPLS protocol modules: MPLS, LDP, LSR, and LER.
MPLS.ned
simple MPLS
{
parameters:
double helloInterval @unit(s) = default(1s);
gates:
input fromNetworkLayer;
output toNetworkLayer;
input fromMacLayer;
output toMacLayer;
}
LDP.ned
simple LDP
{
parameters:
double ldpInterval @unit(s) = default(5s);
gates:
input fromMPLS;
output toMPLS;
}
LSR.ned
simple LSR
{
parameters:
double processingDelay @unit(s) = default(0.001s);
gates:
input fromLDP;
output toLDP;
input fromMPLS;
output toMPLS;
}
LER.ned
simple LER
{
parameters:
double processingDelay @unit(s) = default(0.001s);
gates:
input fromLDP;
output toLDP;
input fromMPLS;
output toMPLS;
}
Implement the Modules in C++
Create the corresponding .cc and .h files for each module.
MPLS.h
#ifndef __MPLS_H_
#define __MPLS_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/networklayer/common/L3AddressResolver.h”
#include “inet/networklayer/ipv4/IPv4Datagram.h”
#include <map>
using namespace omnetpp;
using namespace inet;
class MPLS : public cSimpleModule
{
private:
double helloInterval;
IRoutingTable *routingTable;
cMessage *helloMsg;
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendHello();
void processHello(cMessage *msg);
public:
MPLS();
virtual ~MPLS();
};
#endif
MPLS.cc
#include “MPLS.h”
Define_Module(MPLS);
MPLS::MPLS()
{
helloMsg = nullptr;
}
MPLS::~MPLS()
{
cancelAndDelete(helloMsg);
}
void MPLS::initialize()
{
helloInterval = par(“helloInterval”);
routingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
helloMsg = new cMessage(“sendHello”);
scheduleAt(simTime() + helloInterval, helloMsg);
}
void MPLS::handleMessage(cMessage *msg)
{
if (msg == helloMsg)
{
sendHello();
scheduleAt(simTime() + helloInterval, helloMsg);
}
else if (strcmp(msg->getName(), “Hello”) == 0)
{
processHello(msg);
}
else
{
// Handle other messages
}
}
void MPLS::sendHello()
{
cMessage *hello = new cMessage(“Hello”);
send(hello, “toNetworkLayer”);
}
void MPLS::processHello(cMessage *msg)
{
// Implement processing of Hello message
delete msg;
}
LDP.h
#ifndef __LDP_H_
#define __LDP_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
using namespace omnetpp;
using namespace inet;
class LDP : public cSimpleModule
{
private:
double ldpInterval;
cMessage *ldpMsg;
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
public:
LDP();
virtual ~LDP();
};
#endif
LDP.cc
#include “LDP.h”
Define_Module(LDP);
LDP::LDP()
{
ldpMsg = nullptr;
}
LDP::~LDP()
{
cancelAndDelete(ldpMsg);
}
void LDP::initialize()
{
ldpInterval = par(“ldpInterval”);
ldpMsg = new cMessage(“LDP”);
scheduleAt(simTime() + ldpInterval, ldpMsg);
}
void LDP::handleMessage(cMessage *msg)
{
if (msg == ldpMsg)
{
// Implement LDP functionality
scheduleAt(simTime() + ldpInterval, ldpMsg);
}
else
{
// Handle other messages
}
}
LSR.h
#ifndef __LSR_H_
#define __LSR_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
using namespace omnetpp;
using namespace inet;
class LSR : public cSimpleModule
{
private:
double processingDelay;
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
public:
LSR();
virtual ~LSR();
};
#endif
LSR.cc
#include “LSR.h”
Define_Module(LSR);
LSR::LSR()
{
}
LSR::~LSR()
{
}
void LSR::initialize()
{
processingDelay = par(“processingDelay”);
}
void LSR::handleMessage(cMessage *msg)
{
// Implement LSR functionality
sendDelayed(msg, processingDelay, “toMPLS”);
}
LER.h
#ifndef __LER_H_
#define __LER_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
using namespace omnetpp;
using namespace inet;
class LER : public cSimpleModule
{
private:
double processingDelay;
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
public:
LER();
virtual ~LER();
};
#endif
LER.cc
#include “LER.h”
Define_Module(LER);
LER::LER()
{
}
LER::~LER()
{
}
void LER::initialize()
{
processingDelay = par(“processingDelay”);
}
void LER::handleMessage(cMessage *msg)
{
// Implement LER functionality
sendDelayed(msg, processingDelay, “toMPLS”);
}
Step 4: Integrate with Simulation Model
Incorporate MPLS modules inside the network simulation model.
Network Configuration .ned File
network MPLSNetwork
{
submodules:
router1: StandardHost {
parameters:
@display(“p=100,100”);
}
router2: StandardHost {
parameters:
@display(“p=300,100”);
}
// Add more routers as needed
connections:
router1.pppg++ <–> { @display(“m=100,100”); } <–> router2.pppg++;
}
omnetpp.ini Configuration
network = MPLSNetwork
*.router*.pppg[*].queue.typename = “DropTailQueue”
*.router*.ipv4.routingTable = “inet.networklayer.routing.manet.Router”
*.router*.networkLayer.networkProtocol.typename = “IPv4NetworkLayer”
*.router*.transportLayer.tcp.typename = “Tcp”
*.router*.transportLayer.udp.typename = “Udp”
*.router*.application[*].typename = “UdpBasicApp”
*.router*.application[*].destAddresses = “router1” // Set destination as needed
*.router*.application[*].destPort = 2000
*.router*.application[*].startTime = uniform(0s, 10s)
*.router*.application[*].sendInterval = uniform(1s, 2s)
*.router*.application[*].packetLength = 512B
*.router*.app[0].typename = “MPLS”
Step 5: Test and Debug
Overall, we understood how the Wide area network will perform and analyse the results in OMNeT++ simulator. We plan to deliver the additional information regarding the Wide area network.