PlanetSim Peer-to-peer Simulator

Last semester, i worked on the project titled “Security Framework over Peer-to-Peer Overlays” under my professor Chittaranjan Hota, Ph.D. I was asked to work on a p2p simulator to produce some simulation results for the framework designed. I have searched for many simulators like p2psim, ns2 etc.. Some are very hard to learn while others do not suit my purpose. Finally i came across PlanetSim, a java based simulator shipped with a nice API documentation and tutorials. Installing this simulator is not just an easy task. I have come across several installation issues, which i managed to cross after several google searches. I thought why not i post the article on the installation and usage of this simulator so that others will not necessarily do more groundwork for installing it.

Requirements:

  1. PlanetSim Source
  2. Apache Ant
  3. JDK (1.4+)
  4. Windows/Linux PC

Installation Steps:

  1. Install JDK
  2. Copy tools.jar from C:\Program Files\Java\jdk1.6.0\lib to C:\Program Files\Java\jre1.6.0\lib
  3. Extract the source packages of PlanetSim and Ant into the desired directory.
    Note: I assume that the folders are extracted to C:\. i.e. C:\planetsim and C:\ant
  4. Create the environmental variables for ClassPath, ANTHome, ANTPath and JavaHome

    ANT_HOME
    c:\antCLASSPATH
    .;%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\jaxp.jar;
    %ANT_HOME%\lib\parser.jar;C:\planetsim\src;

    JAVA_HOME
    c:\Program Files\Java\jdk1.6.0\bin

    Path
    .;%ANT_HOME%\bin;

The most difficult issue arises in adding the environment variables. To add environment variables, Right Click on MyComputer -> Properties -> Advanced tab -> Environment Variables (button).

The first set of variables are Local/User variables and those are applicable to that particular user who logged on the system. The Second set, called System variables are global to whole system.

You can view, edit or delete the keys in this GUI window…

Environmental variable Path is set to .;%ANT_HOME%\bin. here ‘.;‘ conveys that, if the environment variable is already present, then append the rest of the path to the specified path.

If you still find problem installing the environment variables, please contact me.

Testing:

  1. Change the working directory to %ANT_HOME
    C:\> CD %ANT_HOME
  2. Test the command ANT by executing it in the terminal
    c:\> ANT
  3. If you get the following output in the above step, then ANT installation is successful. Else, environmental variables are not set properly.
    Buildfile: build.xml does not exist!
    Build failed

From now, all the working folder paths will refer to the following

ANT Home : C:\ant\bin
PlanetSim : C:\planetsim\bin

Final Execution:

  1. Now, change your working directory to Planetsim. i.e. C:\planetsim\bin.
  2. Execute ant.
    C:\planetsim\bin> ant
  3. The above command should build the default XML file that is shipped with the simulator. The output of the command should say build successful by listing some options for you.
  4. Run the following command to build the jar file of the source code. (This step can be skipped for testing purpose as by default, planetsim is shipped with a built jar file. If you make any changes in the source code, then you need to rebuild the jar file again with this command.)
    C:\planetsim\bin> ant jar
  5. Lastly, running the following command will generate the simulation reports.
    C:\planetsim\bin> ant test

More about how to modify the source code and how to refer to documentation, shall be provided on request. Please feel free to contact me.