Multiple "ned-path" and "load-libs" in omnet.ini

322 views
Skip to first unread message

tomasz.jan...@gmail.com

unread,
Feb 21, 2018, 1:35:04 PM2/21/18
to OMNeT++ Users

Hello,
I'm working on OMNET++ and INET based project and I encountered an issue with omnetpp.ini including other INI files and multiple "ned-path" and "load-libs" directives in each INI file. My expectation is that content of "ned-path" and "load-libs" defined in included INI will be joined. Apparently it doesn't happen and I wonder whether it's bug or feature :)

Here's my project configuration (directories tree):

 -- OMNET++/
|
 -- INET/
|
 -- MyFramework/ (something like INET, it provides some common models etc.)
|   |
|    -- src/
|   |
|    -- simulations/
|      |
|       -- omnetpp.ini <- in this INI I specify: "ned-path = ../src:../inet/src" and "load-libs = ../src/MyFramework ../inet/src/INET"
|      |
|       -- scenarion_a/
|         |
|          -- omnetpp.ini <- in this INI I include superior omnetpp.ini: "include ../omnetpp.ini"
|
 -- MyProject/
    |
     -- src/
    |
     -- simulations/
        |
         -- test_case_based_on_scenario_a/
            |
             -- omnetpp.ini <- here I do following things: 
                               1. include INI from "scenarion_a" provided by MyFramework: "include ../../MyFramework/simulations/scenarion_a", 
                               2. load NEDs from MyProject/src with: "ned-path = ../src"
                               3. load libs from MyProject/src with: "load-libs = ../src/MyProject"

I was expecting when I try to run simulation in MyProject/simulatuions/test_case_based_on_scenario_a OMNET++ will join all "ned-path" and "load-libs" directives. Unfortunately it's nod the case and only one ned-path / load-libs directive is interpreted and other are ignored.

Do I do something wrong or my expectation is wrong? I'm going to have many subprojects based on MyFramework, so passing (and maintaining) "-l" and -"n" options to opp_run for each of them will be problematic.

Attila Török

unread,
Feb 23, 2018, 7:59:11 AM2/23/18
to OMNeT++ Users
Generally configuration assignments work like what you are experiencing, by design: The first matching assignment (in a specific search order) is used, and the rest is not even looked at; there is no concatenation at all. And the ned-path and load-libs options are simply not exceptions from this rule, they are not handled specially.
Your expectations sound reasonable though, and the behavior you described might be better, and certainly more intuitive. We will consider implementing some improvements on this, but no promises.

In the meantime, you could try to work around the load-libs issue by linking some of the libraries you wish to load (for example INET) to your simulation and/or framework library, so they will be loaded automatically when the program starts. You might need to use the -Wl,--no-as-needed -lINET -Wl,--as-needed flags to force the linker to include all symbols in the library, even if there is no direct dependency on them.

And the NED path can also be influenced with the NEDPATH environment variable, maybe this helps too.

Attila

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

tomasz.jan...@gmail.com

unread,
Feb 23, 2018, 8:55:25 AM2/23/18
to OMNeT++ Users
Hi,
I'm glad to hear that you will consider it. I'll mention one more case when it will be useful, just to convince you even a bit more :) If final "net-path" and "load-libs" will be composed from included INI files it will simplify "opp_run" usage and automation e.g. on tests on CI. Instead of having weird and long "opp_run" commands (including NED paths and libraries) for every single test scenario user will simply have to specify only two opp_run parameters: UI mode and configuration name/
BR,
Tomasz
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.

Attila Török

unread,
Mar 8, 2018, 3:36:05 PM3/8/18
to OMNeT++ Users
Hi!

I have mentioned this to the lead developers, and they said that you are not supposed to have multiple assignments to the same configuration variable in a single section in the first place, even if they come from different files via an include directive.
And if they are in different configurations, one extending the other, the rules of overriding are not likely to be changed, not even for these two special variables, at least in the near future. We have to prioritize what we work on...

You could take a look at how INET handles this: There is a script named inet in the bin directory that runs opp_run with the appropriate flags, and exports some environment variables containing the command line arguments to allow composition.
Well, being a shell script, it's not the prettiest solution, but does the job.

Attila


To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.

Tomasz Jankowski

unread,
Mar 11, 2018, 1:55:43 PM3/11/18
to omn...@googlegroups.com
Hello,
I'm sad to hear that, but anyway - thanks for help!
BR,
Tomasz

2018-03-08 21:35 GMT+01:00 Attila Török <torok...@gmail.com>:
Hi!

I have mentioned this to the lead developers, and they said that you are not supposed to have multiple assignments to the same configuration variable in a single section in the first place, even if they come from different files via an include directive.
And if they are in different configurations, one extending the other, the rules of overriding are not likely to be changed, not even for these two special variables, at least in the near future. We have to prioritize what we work on...

You could take a look at how INET handles this: There is a script named inet in the bin directory that runs opp_run with the appropriate flags, and exports some environment variables containing the command line arguments to allow composition.
Well, being a shell script, it's not the prettiest solution, but does the job.

Attila

--
You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/eBCgkRFf9q8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages