Usage of ns3-master script

From ResiliNetsWiki
Jump to: navigation, search

1. ns3master (ns3-master.pl) is a perl script to obtain network performance of a given scenario similar to trace_stats but with added features such as multiple runs. The ns3master script needs to run on the scenario itself rather than the trace file that was used in the case of trace_stats.

2. ns3master file should be placed in the same folder as waf in ns3.

3. To make sure that the Packet IDs are printed onto the trace file for use by ns3master, we add the following line of code to the starting of the Print method in packet.cc found in /src/network/model.

os << "ns3PID: " << GetUid() << " ";

4. The topology of the network should be specified in terms of a "node_addresses.csv" file where the different nodes should be listed in terms of the ip addresses used in the simulation. This file should go into the folder containing the ns3master script.

5. We also need to make sure that the traces are printed out into the terminal as ns3master pulls trace output directly from the terminal. This can be done by adding at the tracing part of the simulation.

Ptr<OutputStreamWrapper> ascii_wrap = Create<OutputStreamWrapper>(&std::cout);
<corresponding_layer>.EnableAsciiAll (ascii_wrap);

6. We would also need to define a separate command value argument called run so as to enable multiple runs. This can be done by initializing the parameter run to an arbitary value and introducing it in the command line arguments part of the code using cmd.AddValue "("run", "Number of runs, Default:1", run);".

7. Once the above actions are done, the script is run using

./ns3-master.pl [options] <scratch/simulation> [param1] [param2] [param3] ....

8. The options field include different arguments such as the simulation type, transport protocol type etc. A full list of arguments could be got by running the ns3master script on its own by ./ns3-master.pl.

9. Care should be taken to make sure that the options field are entered correctly. Some of the parameters have default values given in the list of arguments and thus would have to be specified according to the script.

10. The [param] field could contain single values, a list of values, strings or numeric ranges. More information could be got from the parameter specification by running ./ns3-master.pl.

11. Once the ns3 script is run using the needed arguments on the simulation scenario, you should see a <corresponding file name>.out file in the same folder as the ns3master script which gives the different network performance parameters calculated.

Note: there is a updated version of ns3-master used in Cluster which has an additional argv

--statitics_file

12. To run Ns3Master locally

Note: the above commands can be found in the README file.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox