IMF-GEC13-QSR: PubSub_for_PerfSONAR-README.txt

File PubSub_for_PerfSONAR-README.txt, 6.3 KB (added by Rudra Dutta, 12 years ago)

IMF Optical Measurement Handler using IMF Messaging Service - Document

Line 
1Setting up and testing the prototype implementation of PSM (Publish-Subscribe) module to connect to perfSONAR
2
3
4Installation
5-> These components are necessary to run:
6        - Openfire XMPP server(http://www.igniterealtime.org/projects/openfire/). Download and install the latest version.
7        - PSM prototype software (use svn to download the source code. instructions are detailed below).
8        - A publish subscribe client: two options are available
9                -> a Psi IM client (http://psi-im.org/). Download and install the latest version.
10                -> or a trivial subscriber application included with PSM (included in the svn source code download)
11
12
13Preliminary
14$ export IMF_HOME=$HOME/IMF
15Install java 1.6 sdk, recent versions of Maven and Ant. Be sure java, mvn and ant executables are on your path.
16
17
18On geni-imf-dev host append the following to your .bashrc file (may vary on
19different platforms, here CentOS5.5 and default installations are assumed):
20export JAVA_HOME=/opt/java/jdk1.6.0_18
21export ANT_HOME=/opt/java/apache-ant-1.8.0
22export MAVEN_HOME=/opt/java/apache-maven-2.2.1
23export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH
24
25
26Setting up Openfire
27Download and setup  Openfire according to instructions. Notice, it is already running on geni-imf-dev.renci.org, so this step can be skipped. It is setup to use BEN LDAP credentials.
28
29
30Setting up PSM prototype
31Check out the code out of the repository :
32$ cd $HOME
33$ svn co https://geni-imf.renci.org/svn/PubSub_for_PerfSONAR/IMF
34$ cd $IMF_HOME/imf_pfsr/src/psm
35$ mvn install assembly:assembly
36
37The last line attempts to perform a build. If maven reports problems with unavailable jars (jms, mail, jmxtools, jmxri, smack-pubsub, smackx-pubsub) they can be installed manually as follows:
38$ mvn install:install-file -DgroupId=org.jivesoftware.smackx -DartifactId=smackx-pubsub -Dversion=3.1.0 -Dpackaging=jar -Dfile=lib/smackx.jar
39$ mvn install:install-file -DgroupId=org.jivesoftware.smack -DartifactId=smack-pubsub -Dversion=3.1.0 -Dpackaging=jar -Dfile=lib/smack.jar
40$ mvn install:install-file -DgroupId=javax.mail -DartifactId=mail -Dversion=1.4 -Dpackaging=jar -Dfile=lib/mail-1.4.jar
41$ mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=lib/jms.jar
42$ mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=lib/jmxtools.jar
43$ mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=lib/jmxri.jar
44
45Repeat the build attempt:
46$ mvn install assembly:assembly
47A jar including all the dependencies should be built in target/psm-0.1-jar-with-dependencies.jar
48
49Authorization
50
51PSM will require "can_pub" and "can_sub" credentials to the node namespace (for eg. Repository).
52
53Instructions on how to generate the .jks file are as follows:
54
551. Obtain cert-keypairs by emailing to Anirban Mandal ( anirban AT renci.org )  what is the node namespace for which you need pub/sub credentials.
56
572. Creating a pkcs12 file with your cert and key:
58
59   Eg:
60   openssl pkcs12 -export -in ashu-cert.pem -inkey ashu-key.pem -out ashu-gcf-encrypted.p12
61
62   Remember the password you enter in this step. You will need that later in step 2.d  Some clients just need this .p12 file and this password to log in.
63
643. Importing cert-keypair to java keystore.
65
66   Use Portecle: http://portecle.sourceforge.net/
67   Click Launch.
68
69* Create a new keystore of type JKS
70* Click on "Import Key Pair"
71* Locate the .p12 file (ashu-gcf-encrypted.p12 in the example)
72* Enter the password protecting the .p12 file
73* Import the key and certificate, but change the key alias to something simpler than a GUID
74* Enter and confirm a new key password (I usually give the same password as the one protecting .p12 file)
75* Click on "Save Keystore"
76* Enter and confirm the new keystore password (use same as the key password)
77
78This will result in the java keystore. PSM will need path to this keystore and the password above to log in through measurement/subscriber.properties.
79
80Running PSM
81Create a measurements.properties file. A sample file is located on the top directory ~IMF/
82Save it in $IMF_HOME.
83
84Create a file called log4j.properties. A sample file is located on the top directory ~IMF/
85Save it in $IMF_HOME.
86
87
88Start PSM by
89$ cd $IMF_HOME/imf_pfsr/src/psm
90$ java -cp $IMF_HOME:target/psm-0.1-jar-with-dependencies.jar org.renci.geni_imf.psm.Simple
91You should observe it successfully connect to perfSONAR and perform logins to devices and start publishing measurements. You should run this program at background so it can keep publishing data to subscribers.
92
93Viewing measurements
94
95You can observe the measurement nodes by downloading and installing the  Psi IM client. Once you log in to the openfire server (geni-imf-dev.renci.org:5222 using your BEN credentials) you can do 'Service Discovery', open pubsub.geni-imf-dev.renci.org and see the available measurement nodes. You cannot see their values.
96
97Alternatively you can start up a simple subscribe client. First create a subscriber.properties file in $IMF_HOME:
98IMF.pubsub.server=<openfire host:port, for BEN it is geni-imf-dev.renci.org:5222>
99IMF.pubsub.login=<login to openfire server>
100IMF.pubsub.password=<password to openfire server>
101Then start the client
102
103$ cd $IMF_HOME/imf_pfsr/src/psm
104$  java -cp $IMF_HOME:target/psm-0.1-jar-with-dependencies.jar org.renci.geni_imf.psm.SimpleSubscriber
105The window will show available nodes with checkbuttons next to them. Clicking on one or more of them and clicking 'Subscribe' will initiate the XMPP subscription and the values will begin to be displayed. Unclicking nodes and clicking 'Subscribe' will cancel all subscriptions.
106
107Clearing all measurement nodes
108$ java -cp $IMF_HOME:target/psm-0.1-jar-with-dependencies.jar:./src/main/resources/org/renci/geni_imf/psm/ org.renci.geni_imf.psm.ClearPubSub
109
110Troubleshooting
111If your PSM returns errors such as authentication problem, make sure you have
112the right username and password in measurement.properties.
113If there is any existing node that is not created by you, you will be
114forbidden to publish data to that node. You can either use a different root
115node in measurement.properties or ask the owner of that node to delete it.
116
117Note -  for our implementation the modules need VPN access to each other's running machines