Setting up and testing the prototype implementation of PSM (Publish-Subscribe) module


These components are necessary to run:

  •  Openfire XMPP server
  • XMLRPC Measurement Handler (MH)
  • PSM prototype software
  • A publish subscribe client: two options are available - a Psi IM client or a trivial subscriber application included with PSM


$ mkdir $IMF_HOME

Install java 1.6 sdk, recent versions of Maven and Ant. Be sure java, mvn and ant executables are on your path.

On geni-imf-dev host append the following to your .bashrc file:

export JAVA_HOME=/opt/java/jdk1.6.0_18
export ANT_HOME=/opt/java/apache-ant-1.8.0
export MAVEN_HOME=/opt/java/apache-maven-2.2.1

Setting up Openfire

Download and setup  Openfire according to instructions. Notice, it is already running on geni-imf-dev.renci-dcr.ben, so this step can be skipped. It is setup to use BEN LDAP credentials.

Setting up XMLRPC server

Follow the MH instructions to install and start binary

Setting up PSM prototype

Check out the code out of the repository :

$ cd $IMF_HOME
$ svn co imf
$ cd $IMF_HOME/imf/src/psm
$ mvn install assembly:assembly

The 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:

$ mvn install:install-file -DgroupId=org.jivesoftware.smackx -DartifactId=smackx-pubsub -Dversion=3.1.0 -Dpackaging=jar -Dfile=lib/smackx.jar 
$ mvn install:install-file -DgroupId=org.jivesoftware.smack -DartifactId=smack-pubsub -Dversion=3.1.0 -Dpackaging=jar -Dfile=lib/smack.jar 
$ mvn install:install-file -DgroupId=javax.mail -DartifactId=mail -Dversion=1.4 -Dpackaging=jar -Dfile=lib/mail-1.4.jar 
$ mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=lib/jms.jar 
$ mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=lib/jmxtools.jar 
$ mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=lib/jmxri.jar 

Repeat the build attempt:

$ mvn install assembly:assembly

A jar including all the dependencies should be built in target/psm-0.1-jar-with-dependencies.jar

Running PSM

Create a file similar to this one:

# how many measurements will we be tracking
IMF.measurement.count = 2
IMF.measurement.url=<URL of MH, typicallly 'http://localhost:8001'>
IMF.pubsub.server=<server:port of the Openfire server, for BEN it is 'geni-imf-dev.renci-dcr.ben:5222'>
IMF.pubsub.login=<openfire login>
IMF.pubsub.password=<openfire password>

# for each measurement provide all necessary properties
# This one is for a Polatis optical power measurement
IMF.measurement1.type = portpower
IMF.measurement1.period = 5000
IMF.measurement1.login = <device login>
IMF.measurement1.password = <device password>
IMF.measurement1.device = Polatis
IMF.measurement1.devport = 3
IMF.measurement1.hostport = os.unc.ben:3082

# This one is for a Polatis optical power measurement
IMF.measurement2.type = portpower
IMF.measurement2.period = 3000
IMF.measurement2.login = <device login>
IMF.measurement2.password = <device password>
IMF.measurement2.device = Polatis
IMF.measurement2.devport = 19
IMF.measurement2.hostport = os.duke.ben:3082

substituting all <parameters> with actual values. Save the file in $IMF_HOME - it must be on Java CLASSPATH to be available to PSM.

Create a file called

### direct log messages to stdout ###
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=debug, stdout

save it in $IMF_HOME.

Start PSM by

$ cd $IMF_HOME/imf/src/psm
$ java -cp $IMF_HOME:target/psm-0.1-jar-with-dependencies.jar org.renci.geni_imf.psm.Simple

You should observe it successfully connect to MH and perform logins to devices and start publishing measurements

Viewing measurements

You 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-dcr.ben:5222 using your BEN credentials) you can do 'Service Discovery', open pubsub.geni-imf-dev.renci-dcr.ben and see the available measurement nodes. You cannot see their values.

Alternatively you can start up a simple subscribe client. First create a file in $IMF_HOME:

IMF.pubsub.server=<openfire host:port, for BEN it is geni-imf-dev.renci-dcr.ben:5222>
IMF.pubsub.login=<login to openfire server>
IMF.pubsub.password=<password to openfire server>

Then start the client

$ cd $IMF_HOME/imf/src/psm
$  java -cp $IMF_HOME:target/psm-0.1-jar-with-dependencies.jar org.renci.geni_imf.psm.SimpleSubscriber

The 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.

Clearing all measurement nodes

$ 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