Search code examples
moduleomnet++

Gate is not connected to sibling or parent module


I am trying to add additional EIGRP routers to an example supplied within Omnet++, the square stub example. However, whenever I add another router, with the correct amount of gates, I get this error:

Gate 'EigrpTestNetwork.R5.ethg$i[1]' is not connected to sibling or parent module -- in module (omnetpp::cModule) EigrpTestNetwork (id=1), during network setup

and I am a little perplexed as to what it means.

Here is the NED file:

//
// Copyright (C) 2009 - today Brno University of Technology, Czech Republic
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// @file EigrpTestNetwork.ned
// @date 27.10.2020
// @author Jan Zavrel (honza.zavrel96@gmail.com)
// @author Jan Bloudicek (jbloudicek@gmail.com)
// @author Vit Rek (rek@kn.vutbr.cz)
// @author Vladimir Vesely (ivesely@fit.vutbr.cz)
// @copyright Brno University of Technology (www.fit.vutbr.cz) under GPLv3

package inet.examples.eigrp.square_stub;

import inet.node.eigrp.EigrpRouter;
import inet.node.inet.StandardHost;
import inet.node.ethernet.Eth100M;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.networklayer.configurator.ipv6.Ipv6FlatNetworkConfigurator;
import inet.common.scenario.ScenarioManager;

network EigrpTestNetwork
{
    @display("bgb=609,411");
    submodules:
        configurator: Ipv4NetworkConfigurator {
            parameters:
                config = xml("<config>"+
                            "<interface among='R1 R2' address='10.0.12.x' netmask='255.255.255.252' />"+
                            "<interface among='R1 R3' address='10.0.13.x' netmask='255.255.255.252' />"+
                            "<interface among='R3 R4' address='10.0.34.x' netmask='255.255.255.252' />"+
                            "<interface among='R2 R6' address='10.0.24.x' netmask='255.255.255.252' />"+
                            "<interface among='R4 R5' address='10.0.25.x' netmask='255.255.255.252' />"+
                            "<interface among='R1 LAN1' address='10.0.1.x' netmask='255.255.255.0' />"+
                            "<interface among='R2 LAN2' address='10.0.2.x' netmask='255.255.255.0' />"+
                            "<interface among='R3 LAN3' address='10.0.3.x' netmask='255.255.255.0' />"+
                            "<interface among='R4 LAN4' address='10.0.4.x' netmask='255.255.255.0' />"+
                            "</config>");
                addStaticRoutes = false;
                addDefaultRoutes = false;
                addSubnetRoutes = false;
                optimizeRoutes = false;
                @display("p=499,343");
        }

        R1: EigrpRouter {
            parameters:
                @display("p=178,86");
            gates:
                ethg[3];
        }
        R2: EigrpRouter {
            parameters:
                @display("p=178,207");
            gates:
                ethg[3];
        }
        R3: EigrpRouter {
            @display("p=411,86");
            gates:
                ethg[3];
        }
        R4: EigrpRouter {
            @display("p=411,207");
            gates:
                ethg[3];
        }
        LAN1: StandardHost {
            @display("p=76,86;i=misc/cloud");
        }
        LAN2: StandardHost {
            @display("p=76,207;i=misc/cloud");
        }
        LAN3: StandardHost {
            @display("p=489,86;i=misc/cloud");
        }
        LAN4: StandardHost {
            @display("p=489,207;i=misc/cloud");
        }

        scenarioManager: ScenarioManager {
            @display("p=37,343");
        }

        R5: EigrpRouter {
            @display("p=411,302");
            gates:
                ethg[3];
        }
        R6: EigrpRouter {
            @display("p=178,302");
            gates:
                ethg[3];
        }
    connections:
        R1.ethg[0] <--> Eth100M <--> R2.ethg[0];
        R1.ethg[1] <--> Eth100M <--> R3.ethg[0];
        R3.ethg[1] <--> Eth100M <--> R4.ethg[1];
        R4.ethg[0] <--> Eth100M <--> R5.ethg[0];
        R2.ethg[1] <--> Eth100M <--> R6.ethg[0];
        
        R1.ethg[2] <--> Eth100M <--> LAN1.ethg++;
        R3.ethg[2] <--> Eth100M <--> LAN3.ethg++;
        R4.ethg[2] <--> Eth100M <--> LAN4.ethg++;
        R2.ethg[2] <--> Eth100M <--> LAN2.ethg++;
        
}

I was having problems due to the gates, but I solved that due to some trial and error. However, this I am completely unsure of how to fix or where to even start. I am very new to this, and would appreciate a small helping hand. I am able to provide other files or other information if this doesn't help completely.


Solution

  • For R5 you have declared three ethernet interfaces (line ethg[3];). The first interface (i.e. R5.ethg[0]) is connected to R4. Two remaining interfaces are not connected. However, according OMNeT++ Simulation Manual all gates must be connected. Therefore the error is generated.

    There are at least two ways of resolving that problem.
    Solution 1
    In declaration of R5 (and R6) set the number of interfaces to 1:

       R5: EigrpRouter {
            gates:
                ethg[1];
        }
    

    Solution 2
    Add allowunconnected to connections:

     connections allowunconnected:
        R1.ethg[0] <--> Eth100M <--> R2.ethg[0];
        R1.ethg[1] <--> Eth100M <--> R3.ethg[0];
        ...