CSE247 on YouTube

OMNet Practical Exercise with Solution

Computer Networks Lab · OMNeT++
Packet Forwarding with Forwarding Tables (LUT)
5-node directed network  ·  C++ map-based LUT  ·  End-to-end delay measurement
Assignment Tasks
Task 1 — Network Design
  • Network name: forwardingNetwork
  • 5 nodes with directed links
  • Gate arrays (allowunconnected)
  • Delays: 100ms / 200ms per link
Task 2 — Behavioural Design
  • Source/Dest defined in omnetpp.ini
  • Each node forwards via LUT or accepts
  • LUT using std::map
  • End-to-end delay at destination
Network Topology
100ms 200ms 200ms 100ms 200ms 0 source 1 fork 2 3 4 dest ✓ 400ms (faster) 500ms
Faster path: 0 → 1 → 2 → 4 (400ms)  |  Alternate: 0 → 1 → 3 → 4 (500ms)
Corrections Applied
⚠ What was fixed
Node.ned Fixed gate arrays — gIn[3]gIn[] (auto-sized by connections)
N_PDU.msg Removed redundant Address field (duplicate of Source)
Node.h Removed unused cGate* in and cGate* out variables
Node.cc LUT trimmed — only destination-relevant entries per node
Node.cc Added missing setSource() and setDest() on packet
Node.cc Fixed delay: getArrivalTime()simTime()
Network.ned ✓ Connections, delays, parameters — all correct, no changes needed
Forwarding Tables (LUT) per Node
Node 0 · Source
dest 4 → gOut[0]
→ Node 1
Node 1 · Fork
dest 4 → gOut[1]
→ Node 2 (faster)
Node 2
dest 4 → gOut[1]
→ Node 4
Node 3
dest 4 → gOut[1]
→ Node 4
Node 4 · Dest
No forwarding
Print delay
Corrected Source Code
NED · Node.ned
simple Node
{
    parameters:
        int address;
        int source_address;
        int dest_address;

    gates:
        input  gIn[];   // auto-sized by connections
        output gOut[];
}

No comments:

Powered by Blogger.