[Ns-developers] xml config store

Tom Henderson tomh at tomh.org
Sun Mar 8 22:19:52 PDT 2009


Mathieu Lacage wrote:
> hi,
> 
> By popular demand, I hacked together support for global and default
> values, and xml input and output in ConfigStore:
> 
> http://code.nsnam.org/mathieu/ns-3-xml
> 
> The API:
> 
> int main (...)
> {
>   CommandLine cmd;
>   cmd.Parse (...);
> 
>   ConfigStore config;
>   config.ConfigureEarly ();
> 
>   ... topology creation
> 
>   config.ConfigureLate ();
> 
>   Simulator::Run ();
> }
> 
> The above can be controlled from the command-line:
> 
> ./build/debug/examples/csma-broadcast --ns3::ConfigStore::FileFormat=Xml
> --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::Filename=config.txt
> ./build/debug/examples/csma-broadcast --ns3::ConfigStore::FileFormat=Xml
> --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::Filename=config.txt
> 
> and the file looks like this (full example attached to this email):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <ns3>
>  <default name="ns3::V4Ping::Remote" value="102.102.102.102"/>
>  <default name="ns3::ConstantRateWifiManager::DataMode"
> value="wifia-6mbs"/>
> ...
>  <global name="SimulatorImplementationType"
> value="ns3::DefaultSimulatorImpl"/>
>  <global name="SchedulerType" value="ns3::MapScheduler"/>
>  <global name="TimeStepPrecision" value="NS"/>
>  <global name="RngSeed" value="1"/>
>  <global name="RngRun" value="1"/>
> ...
>  <value
> path="/$ns3::NodeListPriv/NodeList/2/$ns3::Node/$ns3::ArpL3Protocol/CacheList/0/$ns3::ArpCache/MaxRetries" value="3"/>
>  <value
> path="/$ns3::NodeListPriv/NodeList/2/$ns3::Node/$ns3::ArpL3Protocol/CacheList/0/$ns3::ArpCache/PendingQueueSize" value
> ="3"/>
> </ns3>
> 
> Of course, you can write your own configuration file to specify only a
> subset of the above in any order, of course.
> 
> I don't really have enough time to add the necessary code to
> GtkConfigStore to display the global and default values from
> ConfigureEarly and to add a dtd/xml schema so, I would tend to leave
> these as an exercise for interested users/developers.
> 
> Mathieu
> 

Mathieu,
Thanks for this extension, which seemed to be a popular suggestion at 
Simutools last week.  I would be in favor of merging this for ns-3.4 (if 
review and testing works out), and then moving this feature out of 
contrib/ into the main tree for ns-3.5 (plus, updating GtkConfigStore at 
that time).

Suggested name changes:

-   config.ConfigureEarly ();
+   config.ConfigureDefaults ();

-   config.ConfigureLate ();
+   config.ConfigureAttributes ();



More information about the Ns-developers mailing list