To implement network topology in OMNeT++ has needs to state the layout of nodes like hosts, routers, or switches and the connections among them. The topology can signify numerous network architectures such as star, mesh, ring, or custom layouts. Here, we can see the brief procedures on how to implement the network topology in OMNeT++.
Step-by-Step Implementation:
Initiate by generating a simple network topology with a few nodes and connections.
Example 1: Star Topology
In a star topology, all nodes are interconnected to a central hub (or switch/router).
Example NED File (StarTopology.ned):
package mynetwork;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
network StarTopology
{
submodules:
centralRouter: Router {
@display(“p=200,200”);
}
host1: StandardHost {
@display(“p=100,100”);
}
host2: StandardHost {
@display(“p=300,100”);
}
host3: StandardHost {
@display(“p=100,300”);
}
host4: StandardHost {
@display(“p=300,300”);
}
connections:
host1.pppg++ <–> ethernetLine <–> centralRouter.pppg++;
host2.pppg++ <–> ethernetLine <–> centralRouter.pppg++;
host3.pppg++ <–> ethernetLine <–> centralRouter.pppg++;
host4.pppg++ <–> ethernetLine <–> centralRouter.pppg++;
}
This sample describes a basic star topology where four hosts are connected to a central router.
A mesh topology has nodes that are fully interconnected their implication is each node is connected to every other node.
Example NED File (MeshTopology.ned):
package mynetwork;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
network MeshTopology
{
submodules:
host1: StandardHost {
@display(“p=100,100”);
}
host2: StandardHost {
@display(“p=300,100”);
}
host3: StandardHost {
@display(“p=100,300”);
}
host4: StandardHost {
@display(“p=300,300”);
}
connections allowunconnected:
host1.pppg++ <–> ethernetLine <–> host2.pppg++;
host1.pppg++ <–> ethernetLine <–> host3.pppg++;
host1.pppg++ <–> ethernetLine <–> host4.pppg++;
host2.pppg++ <–> ethernetLine <–> host3.pppg++;
host2.pppg++ <–> ethernetLine <–> host4.pppg++;
host3.pppg++ <–> ethernetLine <–> host4.pppg++;
}
This sample generates a fully connected mesh topology with four hosts.
In a ring topology, each node is linked to exactly two other nodes that forms a circular path.
Example NED File (RingTopology.ned):
package mynetwork;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
network RingTopology
{
submodules:
host1: StandardHost {
@display(“p=100,200”);
}
host2: StandardHost {
@display(“p=200,100”);
}
host3: StandardHost {
@display(“p=300,200”);
}
host4: StandardHost {
@display(“p=200,300”);
}
connections:
host1.pppg++ <–> ethernetLine <–> host2.pppg++;
host2.pppg++ <–> ethernetLine <–> host3.pppg++;
host3.pppg++ <–> ethernetLine <–> host4.pppg++;
host4.pppg++ <–> ethernetLine <–> host1.pppg++;
}
This sample forms a ring topology with four hosts.
We need to generate any custom topology by manually stipulating the connections among nodes.
Example NED File (CustomTopology.ned):
package mynetwork;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
network CustomTopology
{
submodules:
router1: Router {
@display(“p=200,200”);
}
router2: Router {
@display(“p=400,200”);
}
host1: StandardHost {
@display(“p=100,100”);
}
host2: StandardHost {
@display(“p=300,100”);
}
host3: StandardHost {
@display(“p=500,100”);
}
host4: StandardHost {
@display(“p=300,300”);
}
connections:
host1.pppg++ <–> ethernetLine <–> router1.pppg++;
router1.pppg++ <–> ethernetLine <–> router2.pppg++;
host2.pppg++ <–> ethernetLine <–> router1.pppg++;
host3.pppg++ <–> ethernetLine <–> router2.pppg++;
host4.pppg++ <–> ethernetLine <–> router2.pppg++;
}
This custom topology connects two routers and four hosts in particular layout.
To track how the topology behaves under traffic, add traffic generators to the network.
Example Traffic Generator (TrafficGenerator.ned):
package mynetwork;
import inet.applications.udpapp.UDPBasicApp;
import inet.applications.udpapp.UDPSink;
network TrafficNetwork
{
submodules:
hostA: StandardHost {
@display(“p=100,100”);
applications: <udpbasicapp> {
localPort = 1234;
destAddresses = “hostB”;
destPort = 5678;
messageLength = 1000B;
sendInterval = 1s;
numPackets = 100;
}
}
hostB: StandardHost {
@display(“p=300,100”);
applications: <udpsink> {
localPort = 5678;
}
}
router: Router {
@display(“p=200,200”);
}
connections:
hostA.pppg++ <–> ethernetLine <–> router.pppg++;
router.pppg++ <–> ethernetLine <–> hostB.pppg++;
}
This example creates UDP traffic from hostA to hostB through a router.
Example NED File (ComplexTopology.ned):
package mynetwork;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
network ComplexTopology
{
submodules:
router1: Router {
@display(“p=100,200”);
}
router2: Router {
@display(“p=300,200”);
}
router3: Router {
@display(“p=500,200”);
}
host1: StandardHost {
@display(“p=50,100”);
}
host2: StandardHost {
@display(“p=150,100”);
}
host3: StandardHost {
@display(“p=350,100”);
}
host4: StandardHost {
@display(“p=550,100”);
}
host5: StandardHost {
@display(“p=650,100”);
}
connections:
host1.pppg++ <–> ethernetLine <–> router1.pppg++;
host2.pppg++ <–> ethernetLine <–> router1.pppg++;
router1.pppg++ <–> ethernetLine <–> router2.pppg++;
host3.pppg++ <–> ethernetLine <–> router2.pppg++;
router2.pppg++ <–> ethernetLine <–> router3.pppg++;
host4.pppg++ <–> ethernetLine <–> router3.pppg++;
host5.pppg++ <–> ethernetLine <–> router3.pppg++;
}
This instance generates a more complex network with three routers and five hosts, that demonstrating how to scale up the topology.
We had understood how to execute and verify the network topology among the various layouts that were implemented in OMNeT++ tool. We also deliver more information regarding the network topology performance in other simulation settings. Our developers work on every aspect of network topology in the OMNeT++ tool; our services are customized. Let our developers take care of your network’s performance.