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:
- PlanetSim Source
- Apache Ant
- JDK (1.4+)
- Windows/Linux PC
Installation Steps:
- Install JDK
- Copy tools.jar from C:\Program Files\Java\jdk1.6.0\lib to C:\Program Files\Java\jre1.6.0\lib
- 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 - 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\binPath
.;%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:
- Change the working directory to %ANT_HOME
C:\> CD %ANT_HOME - Test the command ANT by executing it in the terminal
c:\> ANT - 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:
- Now, change your working directory to Planetsim. i.e. C:\planetsim\bin.
- Execute ant.
C:\planetsim\bin> ant - 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.
- 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 - 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.
December 8, 2007 at 5:18 am
Hi Nice article. could you help me out on deciding whether this tool can be used for a bittorrent simulation project. I need sort of 50-60 logical computers to simulate which run a bittorrent app
thanks
January 31, 2008 at 5:43 pm
Thanks, I manage to run the test by following your instruction. But, how to set the network as ’super-peer P2P’? which code need to be change @ add? Thanks.
February 14, 2008 at 12:18 pm
Please send me adress e-mail Mr. Chittaranjan Hota
September 26, 2008 at 3:15 pm
nice article.I could not setup the environment variable.Could anyone help me in step 4 of installation step?
September 26, 2008 at 9:36 pm
Hi Sijan
In windows, you can set the variables in MyComputer -> Properties -> Advanced tab -> Environment Variables (button).
If the env variable already exists, then modify it.. you can search google on How to set environmental variable
September 27, 2008 at 3:03 am
Hi,
I set the variables now and try testing .When i enter the command C:>Ant ,a merror message came,
” java.exe” is not recognized as an internal or external command,operable program or batch file.
I have installed jdk and jre.Can anyone help please.
thank you in advance.
Sijan.
November 24, 2008 at 2:25 am
Does anybody know how to generate events files like join_1000.txt ? (stored in /bin/data/ )
To Sijan:
Try to fix your classpath
December 30, 2008 at 9:38 pm
respected sir;
i want to know how to run the helloworld source program (C:\planetsim\src\planet\test\helloworld) with planetsim.
and i also want to know how to generate simulation report.
plese give me kindly ur suggestion.
thank you sir
with regards
kalpesh yadav
December 30, 2008 at 9:41 pm
please send me reply at kalpesh.1483@gmail.com
February 8, 2009 at 8:23 pm
thnx for publishing this article
March 28, 2009 at 7:07 pm
Hi people,
how to save-and-load the whole network?
How to create a chord network from the file?