perfsonar-dev - [pS-dev] [GEANT/SA2/SA2T3-OPPD] r616 - in trun k/build: . debian debian/NMWG-0.02 debian/NMWG-0.0 2/_build debian/NMWG-0.02/blib debian/NMWG-0.02/blib /lib debian/NMWG-0.02/blib/lib/NMWG debian/NMWG-0.02/b lib/libdoc debian/NMWG-0.02/debian debian/NMWG-0.02/de bian/libnmwg-perl debian/NMWG-0.02/debian/libnmwg-perl/D EBIAN debian/NMWG-0.02/debian/libnmwg-perl/usr debian/NM WG-0.02/debian/libnmwg-perl/usr/share debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/doc debian/NMWG-0.02/debi an/libnmwg-perl/usr/share/doc/libnmwg-perl debian/NMWG-0 .02/debian/libnmwg-perl/usr/share/man debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/man/man3 debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/perl5 debian/NMWG-0.02/de bian/libnmwg-perl/usr/share/perl5/NMWG debian/NMWG-0.02/ lib debian/NMWG-0.02/lib/NMWG debian/NMWG-0.02/t debia n/perfsonar-oppd-0.51 debian/perfsonar-oppd-0.51/_bu ild debian/perfsonar-oppd-0.51/bin debian/perfsonar-oppd -0.51/blib debian/perfsonar-oppd-0.51/blib/bindoc debi an/perfsonar-oppd-0.51/blib/etc debian/perfsonar-oppd-0 .51/blib/etc/oppd.d debian/perfsonar-oppd-0.51/blib/ init debian/perfsonar-oppd-0.51/blib/init/default debian /perfsonar-oppd-0.51/blib/init/init.d debian/perfsonar -oppd-0.51/blib/lib debian/perfsonar-oppd-0.51/blib/li b/perfSONAR debian/perfsonar-oppd-0.51/blib/lib/perfSONA R/Client debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/S OAP debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/H TTP debian/perfsonar-oppd-0.51/blib/script debian/perfso nar-oppd-0.51/debian debian/perfsonar-oppd-0.51/debian /perfsonar-oppd debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/DEBIAN debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/etc debian/perfsonar-oppd-0.51/debian/perfsonar -oppd/etc/default debian/perfsonar-oppd-0.51/debian/perf sonar-oppd/etc/init.d debian/perfsonar-oppd-0.51/debia n/perfsonar-oppd/etc/oppd.d debian/perfsonar-oppd-0.51 /debian/perfsonar-oppd/usr debian/perfsonar-oppd-0.51/de bian/perfsonar-oppd/usr/lib debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar debian/perfsonar-op pd-0.51/debian/p! erfsonar-oppd/usr/lib/perfsonar/servic es debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/ lib/perfsonar/services/oppd debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin d ebian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/SA2T3-OPPD] r616 - in trun k/build: . debian debian/NMWG-0.02 debian/NMWG-0.0 2/_build debian/NMWG-0.02/blib debian/NMWG-0.02/blib /lib debian/NMWG-0.02/blib/lib/NMWG debian/NMWG-0.02/b lib/libdoc debian/NMWG-0.02/debian debian/NMWG-0.02/de bian/libnmwg-perl debian/NMWG-0.02/debian/libnmwg-perl/D EBIAN debian/NMWG-0.02/debian/libnmwg-perl/usr debian/NM WG-0.02/debian/libnmwg-perl/usr/share debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/doc debian/NMWG-0.02/debi an/libnmwg-perl/usr/share/doc/libnmwg-perl debian/NMWG-0 .02/debian/libnmwg-perl/usr/share/man debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/man/man3 debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/perl5 debian/NMWG-0.02/de bian/libnmwg-perl/usr/share/perl5/NMWG debian/NMWG-0.02/ lib debian/NMWG-0.02/lib/NMWG debian/NMWG-0.02/t debia n/perfsonar-oppd-0.51 debian/perfsonar-oppd-0.51/_bu ild debian/perfsonar-oppd-0.51/bin debian/perfsonar-oppd -0.51/blib debian/perfsonar-oppd-0.51/blib/bindoc debi an/perfsonar-oppd-0.51/blib/etc debian/perfsonar-oppd-0 .51/blib/etc/oppd.d debian/perfsonar-oppd-0.51/blib/ init debian/perfsonar-oppd-0.51/blib/init/default debian /perfsonar-oppd-0.51/blib/init/init.d debian/perfsonar -oppd-0.51/blib/lib debian/perfsonar-oppd-0.51/blib/li b/perfSONAR debian/perfsonar-oppd-0.51/blib/lib/perfSONA R/Client debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/S OAP debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/H TTP debian/perfsonar-oppd-0.51/blib/script debian/perfso nar-oppd-0.51/debian debian/perfsonar-oppd-0.51/debian /perfsonar-oppd debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/DEBIAN debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/etc debian/perfsonar-oppd-0.51/debian/perfsonar -oppd/etc/default debian/perfsonar-oppd-0.51/debian/perf sonar-oppd/etc/init.d debian/perfsonar-oppd-0.51/debia n/perfsonar-oppd/etc/oppd.d debian/perfsonar-oppd-0.51 /debian/perfsonar-oppd/usr debian/perfsonar-oppd-0.51/de bian/perfsonar-oppd/usr/lib debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar debian/perfsonar-op pd-0.51/debian/p! erfsonar-oppd/usr/lib/perfsonar/servic es debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/ lib/perfsonar/services/oppd debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin d ebian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/SA2T3-OPPD] r616 - in trun k/build: . debian debian/NMWG-0.02 debian/NMWG-0.0 2/_build debian/NMWG-0.02/blib debian/NMWG-0.02/blib /lib debian/NMWG-0.02/blib/lib/NMWG debian/NMWG-0.02/b lib/libdoc debian/NMWG-0.02/debian debian/NMWG-0.02/de bian/libnmwg-perl debian/NMWG-0.02/debian/libnmwg-perl/D EBIAN debian/NMWG-0.02/debian/libnmwg-perl/usr debian/NM WG-0.02/debian/libnmwg-perl/usr/share debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/doc debian/NMWG-0.02/debi an/libnmwg-perl/usr/share/doc/libnmwg-perl debian/NMWG-0 .02/debian/libnmwg-perl/usr/share/man debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/man/man3 debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/perl5 debian/NMWG-0.02/de bian/libnmwg-perl/usr/share/perl5/NMWG debian/NMWG-0.02/ lib debian/NMWG-0.02/lib/NMWG debian/NMWG-0.02/t debia n/perfsonar-oppd-0.51 debian/perfsonar-oppd-0.51/_bu ild debian/perfsonar-oppd-0.51/bin debian/perfsonar-oppd -0.51/blib debian/perfsonar-oppd-0.51/blib/bindoc debi an/perfsonar-oppd-0.51/blib/etc debian/perfsonar-oppd-0 .51/blib/etc/oppd.d debian/perfsonar-oppd-0.51/blib/ init debian/perfsonar-oppd-0.51/blib/init/default debian /perfsonar-oppd-0.51/blib/init/init.d debian/perfsonar -oppd-0.51/blib/lib debian/perfsonar-oppd-0.51/blib/li b/perfSONAR debian/perfsonar-oppd-0.51/blib/lib/perfSONA R/Client debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/S OAP debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/H TTP debian/perfsonar-oppd-0.51/blib/script debian/perfso nar-oppd-0.51/debian debian/perfsonar-oppd-0.51/debian /perfsonar-oppd debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/DEBIAN debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/etc debian/perfsonar-oppd-0.51/debian/perfsonar -oppd/etc/default debian/perfsonar-oppd-0.51/debian/perf sonar-oppd/etc/init.d debian/perfsonar-oppd-0.51/debia n/perfsonar-oppd/etc/oppd.d debian/perfsonar-oppd-0.51 /debian/perfsonar-oppd/usr debian/perfsonar-oppd-0.51/de bian/perfsonar-oppd/usr/lib debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar debian/perfsonar-op pd-0.51/debian/p! erfsonar-oppd/usr/lib/perfsonar/servic es debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/ lib/perfsonar/services/oppd debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin d ebian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/
- Date: Fri, 30 Jul 2010 07:18:46 +0100
Author: dfn.calim
Date: 2010-07-30 07:18:44 +0100 (Fri, 30 Jul 2010)
New Revision: 616
Added:
trunk/build/debian/
trunk/build/debian/NMWG-0.02/
trunk/build/debian/NMWG-0.02/Build
trunk/build/debian/NMWG-0.02/Build.PL
trunk/build/debian/NMWG-0.02/Changes
trunk/build/debian/NMWG-0.02/MANIFEST
trunk/build/debian/NMWG-0.02/META.yml
trunk/build/debian/NMWG-0.02/README
trunk/build/debian/NMWG-0.02/_build/
trunk/build/debian/NMWG-0.02/_build/auto_features
trunk/build/debian/NMWG-0.02/_build/build_params
trunk/build/debian/NMWG-0.02/_build/cleanup
trunk/build/debian/NMWG-0.02/_build/config_data
trunk/build/debian/NMWG-0.02/_build/features
trunk/build/debian/NMWG-0.02/_build/magicnum
trunk/build/debian/NMWG-0.02/_build/notes
trunk/build/debian/NMWG-0.02/_build/prereqs
trunk/build/debian/NMWG-0.02/_build/runtime_params
trunk/build/debian/NMWG-0.02/blib/
trunk/build/debian/NMWG-0.02/blib/arch/
trunk/build/debian/NMWG-0.02/blib/lib/
trunk/build/debian/NMWG-0.02/blib/lib/NMWG.pm
trunk/build/debian/NMWG-0.02/blib/lib/NMWG/
trunk/build/debian/NMWG-0.02/blib/lib/NMWG/Message.pm
trunk/build/debian/NMWG-0.02/blib/libdoc/
trunk/build/debian/NMWG-0.02/blib/libdoc/NMWG.3pm
trunk/build/debian/NMWG-0.02/build-stamp
trunk/build/debian/NMWG-0.02/debian/
trunk/build/debian/NMWG-0.02/debian/changelog
trunk/build/debian/NMWG-0.02/debian/compat
trunk/build/debian/NMWG-0.02/debian/control
trunk/build/debian/NMWG-0.02/debian/copyright
trunk/build/debian/NMWG-0.02/debian/files
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.debhelper.log
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.substvars
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/control
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/md5sums
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/README
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.Debian.gz
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.gz
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/copyright
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/man/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/man/man3/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/man/man3/NMWG.3pm.gz
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG.pm
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG/
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG/Message.pm
trunk/build/debian/NMWG-0.02/debian/rules
trunk/build/debian/NMWG-0.02/debian/watch
trunk/build/debian/NMWG-0.02/install-stamp
trunk/build/debian/NMWG-0.02/lib/
trunk/build/debian/NMWG-0.02/lib/NMWG.pm
trunk/build/debian/NMWG-0.02/lib/NMWG/
trunk/build/debian/NMWG-0.02/lib/NMWG/Message.pm
trunk/build/debian/NMWG-0.02/t/
trunk/build/debian/NMWG-0.02/t/00-load.t
trunk/build/debian/libnmwg-perl_0.02-0rc1.dsc
trunk/build/debian/libnmwg-perl_0.02-0rc1.tar.gz
trunk/build/debian/libnmwg-perl_0.02-0rc1_all.deb
trunk/build/debian/libnmwg-perl_0.02-0rc1_i386.changes
trunk/build/debian/perfsonar-oppd-0.51/
trunk/build/debian/perfsonar-oppd-0.51/Build
trunk/build/debian/perfsonar-oppd-0.51/Build.PL
trunk/build/debian/perfsonar-oppd-0.51/Changes
trunk/build/debian/perfsonar-oppd-0.51/MANIFEST
trunk/build/debian/perfsonar-oppd-0.51/META.yml
trunk/build/debian/perfsonar-oppd-0.51/Makefile.PL
trunk/build/debian/perfsonar-oppd-0.51/README
trunk/build/debian/perfsonar-oppd-0.51/_build/
trunk/build/debian/perfsonar-oppd-0.51/_build/auto_features
trunk/build/debian/perfsonar-oppd-0.51/_build/build_params
trunk/build/debian/perfsonar-oppd-0.51/_build/cleanup
trunk/build/debian/perfsonar-oppd-0.51/_build/config_data
trunk/build/debian/perfsonar-oppd-0.51/_build/features
trunk/build/debian/perfsonar-oppd-0.51/_build/magicnum
trunk/build/debian/perfsonar-oppd-0.51/_build/notes
trunk/build/debian/perfsonar-oppd-0.51/_build/prereqs
trunk/build/debian/perfsonar-oppd-0.51/_build/runtime_params
trunk/build/debian/perfsonar-oppd-0.51/bin/
trunk/build/debian/perfsonar-oppd-0.51/bin/oppd.pl
trunk/build/debian/perfsonar-oppd-0.51/blib/
trunk/build/debian/perfsonar-oppd-0.51/blib/arch/
trunk/build/debian/perfsonar-oppd-0.51/blib/bindoc/
trunk/build/debian/perfsonar-oppd-0.51/blib/bindoc/oppd.pl.1p
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.conf
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_request.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_response.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_KeyRequest.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_deregister.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_keepalive.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_register.xml
trunk/build/debian/perfsonar-oppd-0.51/blib/init/
trunk/build/debian/perfsonar-oppd-0.51/blib/init/default/
trunk/build/debian/perfsonar-oppd-0.51/blib/init/default/oppd
trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/
trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/oppd
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Auth.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Client/
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Client/LS.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Echo.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/MP.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_1.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_2.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Request.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Response.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Message.pm
trunk/build/debian/perfsonar-oppd-0.51/blib/script/
trunk/build/debian/perfsonar-oppd-0.51/blib/script/oppd.pl
trunk/build/debian/perfsonar-oppd-0.51/build-stamp
trunk/build/debian/perfsonar-oppd-0.51/debian/
trunk/build/debian/perfsonar-oppd-0.51/debian/changelog
trunk/build/debian/perfsonar-oppd-0.51/debian/compat
trunk/build/debian/perfsonar-oppd-0.51/debian/control
trunk/build/debian/perfsonar-oppd-0.51/debian/copyright
trunk/build/debian/perfsonar-oppd-0.51/debian/dirs
trunk/build/debian/perfsonar-oppd-0.51/debian/docs
trunk/build/debian/perfsonar-oppd-0.51/debian/files
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.debhelper.log
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.default
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.init
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/conffiles
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/control
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/md5sums
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postinst
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postrm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/preinst
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/prerm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/default/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/default/oppd
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/oppd
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.conf
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_request.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_response.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_KeyRequest.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_deregister.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_keepalive.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_register.xml
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/bin/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/oppd.pl
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Auth.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/LS.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Echo.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_1.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_2.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Request.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Response.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Message.pm
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/man/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/man/oppd.pl.1p
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/sbin/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/README
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.Debian.gz
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.gz
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/copyright
trunk/build/debian/perfsonar-oppd-0.51/debian/postinst
trunk/build/debian/perfsonar-oppd-0.51/debian/postrm
trunk/build/debian/perfsonar-oppd-0.51/debian/preinst
trunk/build/debian/perfsonar-oppd-0.51/debian/prerm
trunk/build/debian/perfsonar-oppd-0.51/debian/rules
trunk/build/debian/perfsonar-oppd-0.51/etc/
trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_request.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_response.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/LS_KeyRequest.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/LS_deregister.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/LS_keepalive.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/LS_register.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf.example
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_request.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_response.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_KeyRequest.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_deregister.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_keepalive.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_register.xml
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.default.debian
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.init.debian
trunk/build/debian/perfsonar-oppd-0.51/install
trunk/build/debian/perfsonar-oppd-0.51/lib/
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Auth.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Client/
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Client/LS.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Echo.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/MP.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_1.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_2.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Request.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Response.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Message.pm
trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.dsc
trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.tar.gz
trunk/build/debian/perfsonar-oppd-0.51/t/
trunk/build/debian/perfsonar-oppd-0.51/t/00-load.t
trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-001-SOAP-Message.t
trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-002-Core.t
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build.PL
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Changes
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/MANIFEST
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/META.yml
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Makefile.PL
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/README
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/auto_features
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/build_params
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/cleanup
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/config_data
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/features
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/magicnum
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/notes
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/prereqs
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/runtime_params
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/arch/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/oppd.d/oppd-bwctl.conf
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/MP/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/build-stamp
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/README.Debian
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/changelog
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/compat
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/control
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/copyright
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/files
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl.debhelper.log
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/conffiles
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/control
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/md5sums
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postinst
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postrm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/preinst
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/prerm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/oppd.d/oppd-bwctl.conf
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/README.Debian
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.Debian.gz
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.gz
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/copyright
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postinst
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postrm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/preinst
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/prerm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/rules
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/etc/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/etc/bwctl.conf
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/install
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/MP/BWCTL.pm
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/00-load.t
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-BWCTL-001.t
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-001.t
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-BWCTL-001.t
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_i386.changes
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build.PL
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Changes
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/MANIFEST
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/META.yml
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Makefile.PL
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/README
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/auto_features
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/build_params
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/cleanup
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/config_data
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/features
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/magicnum
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/notes
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/prereqs
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/runtime_params
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/arch/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/oppd.d/oppd-generic.conf
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/MP/Generic.pm
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/build-stamp
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/README.Debian
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/changelog
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/compat
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/control
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/copyright
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/dirs
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/docs
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/files
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.debhelper.log
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.doc-base.EX
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/conffiles
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/control
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/md5sums
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/postinst
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/preinst
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/prerm
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/oppd.d/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/oppd.d/oppd-generic.conf
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/bin/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/sbin/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README.Debian
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.Debian.gz
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.gz
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/copyright
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/postinst
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/preinst
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/prerm
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/rules
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/etc/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/etc/generic.conf
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/install
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/MP/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/MP/Generic.pm
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/t/
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/t/00-load.t
trunk/build/debian/perfsonar-oppd_0.52-0rc1.dsc
trunk/build/debian/perfsonar-oppd_0.52-0rc1.tar.gz
trunk/build/debian/perfsonar-oppd_0.52-0rc1_all.deb
trunk/build/debian/perfsonar-oppd_0.52-0rc1_i386.changes
Log:
Adding debian build directory
Added: trunk/build/debian/NMWG-0.02/Build
===================================================================
--- trunk/build/debian/NMWG-0.02/Build (rev 0)
+++ trunk/build/debian/NMWG-0.02/Build 2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+#! /usr/bin/perl
+
+use strict;
+use Cwd;
+use File::Basename;
+use File::Spec;
+
+sub magic_number_matches {
+ return 0 unless -e '_build/magicnum';
+ local *FH;
+ open FH, '_build/magicnum' or return 0;
+ my $filenum = <FH>;
+ close FH;
+ return $filenum == 327721;
+}
+
+my $progname;
+my $orig_dir;
+BEGIN {
+ $^W = 1; # Use warnings
+ $progname = basename($0);
+ $orig_dir = Cwd::cwd();
+ my $base_dir = '/home/unrz217/SA2T3-OPPD/trunk/build/debian/NMWG-0.02';
+ if (!magic_number_matches()) {
+ unless (chdir($base_dir)) {
+ die ("Couldn't chdir($base_dir), aborting\n");
+ }
+ unless (magic_number_matches()) {
+ die ("Configuration seems to be out of date, please re-run 'perl
Build.PL' again.\n");
+ }
+ }
+ unshift @INC,
+ (
+
+ );
+}
+
+close(*DATA) unless eof(*DATA); # ensure no open handles to this script
+
+use Module::Build;
+
+# Some platforms have problems setting $^X in shebang contexts, fix it up
here
+$^X = Module::Build->find_perl_interpreter;
+
+if (-e 'Build.PL' and not Module::Build->up_to_date('Build.PL', $progname)) {
+ warn "Warning: Build.PL has been altered. You may need to run 'perl
Build.PL' again.\n";
+}
+
+# This should have just enough arguments to be able to bootstrap the rest.
+my $build = Module::Build->resume (
+ properties => {
+ config_dir => '_build',
+ orig_dir => $orig_dir,
+ },
+);
+
+$build->dispatch;
Property changes on: trunk/build/debian/NMWG-0.02/Build
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/NMWG-0.02/Build.PL
===================================================================
--- trunk/build/debian/NMWG-0.02/Build.PL (rev
0)
+++ trunk/build/debian/NMWG-0.02/Build.PL 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+ module_name => 'NMWG',
+ license => 'apache',
+ dist_author => 'DFN-Labor
<>',
+ dist_version_from => 'lib/NMWG.pm',
+ requires => {
+ 'XML::LibXML' => 1.61, # XPathContext not included before
+ 'LWP::UserAgent' => 2.033, # This is unsure, but version is from 2004
+ },
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ add_to_cleanup => [ 'NMWG-*' ],
+);
+
+$builder->install_base_relpaths('lib' => 'lib');
+$builder->create_build_script();
Added: trunk/build/debian/NMWG-0.02/Changes
===================================================================
--- trunk/build/debian/NMWG-0.02/Changes (rev
0)
+++ trunk/build/debian/NMWG-0.02/Changes 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,5 @@
+Revision history for NMWG
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
Added: trunk/build/debian/NMWG-0.02/MANIFEST
===================================================================
--- trunk/build/debian/NMWG-0.02/MANIFEST (rev
0)
+++ trunk/build/debian/NMWG-0.02/MANIFEST 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,8 @@
+Build.PL
+Changes
+lib/NMWG.pm
+lib/NMWG/Message.pm
+MANIFEST This list of files
+README
+t/00-load.t
+META.yml
Added: trunk/build/debian/NMWG-0.02/META.yml
===================================================================
--- trunk/build/debian/NMWG-0.02/META.yml (rev
0)
+++ trunk/build/debian/NMWG-0.02/META.yml 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,24 @@
+---
+name: NMWG
+version: 0.02
+author:
+ - 'DFN-Labor
<>'
+abstract: The great new NMWG!
+license: apache
+resources:
+ license: http://apache.org/licenses/LICENSE-2.0
+requires:
+ LWP::UserAgent: 2.033
+ XML::LibXML: 1.61
+build_requires:
+ Test::More: 0
+provides:
+ NMWG:
+ file: lib/NMWG.pm
+ version: 0.02
+ NMWG::Message:
+ file: lib/NMWG/Message.pm
+generated_by: Module::Build version 0.280801
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: trunk/build/debian/NMWG-0.02/README
===================================================================
--- trunk/build/debian/NMWG-0.02/README (rev 0)
+++ trunk/build/debian/NMWG-0.02/README 2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,48 @@
+NMWG
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it get an idea of the modules uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Build.PL
+ ./Build
+ ./Build test
+ ./Build install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
perldoc command.
+
+ perldoc NMWG
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/NMWG
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=NMWG
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/NMWG
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/NMWG
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 DFN-Labor
+
+This program is released under the following license: help
Added: trunk/build/debian/NMWG-0.02/_build/auto_features
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/auto_features
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/auto_features 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/build_params
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/build_params
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/build_params 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,267 @@
+do{ my $x = [
+ {
+ 'ARGV' => []
+ },
+ {},
+ {
+ 'verbose' => undef,
+ 'PL_files' => undef,
+ 'pollute' => undef,
+ 'bindoc_dirs' => [
+ 'blib/script'
+ ],
+ 'conflicts' => {},
+ 'recommends' => {},
+ 'scripts' => undef,
+ 'dist_version' => bless( {
+ 'original' => '0.02',
+ 'version' => [
+ 0,
+ 20
+ ]
+ }, 'Module::Build::Version' ),
+ 'pod_files' => undef,
+ 'config_dir' => '_build',
+ 'recurse_into' => [],
+ 'build_bat' => 0,
+ 'extra_linker_flags' => [],
+ 'build_class' => 'Module::Build',
+ 'prereq_action_types' => [
+ 'requires',
+ 'build_requires',
+ 'conflicts',
+ 'recommends'
+ ],
+ 'base_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/NMWG-0.02',
+ 'allow_mb_mismatch' => 0,
+ 'xs_files' => undef,
+ 'destdir' => undef,
+ 'metafile' => 'META.yml',
+ 'mb_version' => '0.280801',
+ 'has_config_data' => undef,
+ 'dist_name' => 'NMWG',
+ 'install_base' => undef,
+ 'module_name' => 'NMWG',
+ 'recursive_test_files' => undef,
+ 'libdoc_dirs' => [
+ 'blib/lib',
+ 'blib/arch'
+ ],
+ 'perl' => '/usr/bin/perl',
+ 'dist_author' => [
+ 'DFN-Labor
<>'
+ ],
+ 'use_rcfile' => 1,
+ 'configure_requires' => {},
+ 'test_files' => undef,
+ 'dist_abstract' => undef,
+ 'create_readme' => undef,
+ 'prefix_relpaths' => {
+ 'core' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ },
+ 'site' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ 'site_perl',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5',
+ 'site_perl'
+ ]
+ },
+ 'vendor' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ }
+ },
+ 'meta_merge' => {},
+ 'get_options' => {},
+ 'dist_version_from' => 'lib/NMWG.pm',
+ 'debugger' => undef,
+ 'html_css' => '',
+ 'build_elements' => [
+ 'PL',
+ 'support',
+ 'pm',
+ 'xs',
+ 'pod',
+ 'script'
+ ],
+ 'orig_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/NMWG-0.02',
+ 'include_dirs' => [],
+ 'installdirs' => 'vendor',
+ 'create_makefile_pl' => undef,
+ 'magic_number' => undef,
+ 'install_sets' => {
+ 'core' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl/5.10',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl/5.10'
+ },
+ 'site' => {
+ 'libdoc' => '/usr/local/man/man3',
+ 'script' => '/usr/local/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/local/man/man1',
+ 'bin' => '/usr/local/bin',
+ 'arch' =>
'/usr/local/lib/perl/5.10.0',
+ 'binhtml' => undef,
+ 'lib' =>
'/usr/local/share/perl/5.10.0'
+ },
+ 'vendor' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl5',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl5'
+ }
+ },
+ 'install_base_relpaths' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib'
+ ]
+ },
+ 'meta_add' => {},
+ 'create_packlist' => 1,
+ 'requires' => {
+ 'LWP::UserAgent' => '2.033',
+ 'XML::LibXML' => '1.61'
+ },
+ 'install_path' => {},
+ 'pm_files' => undef,
+ 'quiet' => undef,
+ 'extra_compiler_flags' => [],
+ 'script_files' => undef,
+ 'build_script' => 'Build',
+ 'original_prefix' => {
+ 'core' => '/usr',
+ 'site' => '/usr/local',
+ 'vendor' => '/usr'
+ },
+ 'c_source' => undef,
+ 'license' => 'apache',
+ 'autosplit' => undef,
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'config' => undef,
+ 'blib' => 'blib',
+ 'prefix' => undef
+ }
+ ];
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/cleanup
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/cleanup (rev
0)
+++ trunk/build/debian/NMWG-0.02/_build/cleanup 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,5 @@
+do{ my $x = {
+ 'NMWG-*' => 1,
+ 'blib' => 1
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/config_data
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/config_data
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/config_data 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/features
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/features
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/features 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/magicnum
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/magicnum
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/magicnum 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1 @@
+327721
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/notes
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/notes (rev
0)
+++ trunk/build/debian/NMWG-0.02/_build/notes 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/prereqs
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/prereqs (rev
0)
+++ trunk/build/debian/NMWG-0.02/_build/prereqs 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,12 @@
+do{ my $x = {
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'conflicts' => {},
+ 'requires' => {
+ 'LWP::UserAgent' => '2.033',
+ 'XML::LibXML' => '1.61'
+ },
+ 'recommends' => {}
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/_build/runtime_params
===================================================================
--- trunk/build/debian/NMWG-0.02/_build/runtime_params
(rev 0)
+++ trunk/build/debian/NMWG-0.02/_build/runtime_params 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,6 @@
+do{ my $x = {
+ 'create_packlist' => '0',
+ 'installdirs' => 'vendor',
+ 'destdir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/NMWG-0.02/debian/libnmwg-perl'
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/NMWG-0.02/blib/lib/NMWG/Message.pm
===================================================================
--- trunk/build/debian/NMWG-0.02/blib/lib/NMWG/Message.pm
(rev 0)
+++ trunk/build/debian/NMWG-0.02/blib/lib/NMWG/Message.pm 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,740 @@
+package NMWG::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Replace more getElementsByTagNameNS and similar using find ?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Carp;
+use XML::LibXML;
+
+
+my $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $ns_perfsonar = "http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";
+my $ns_result = "http://ggf.org/ns/nmwg/result/2.0/";
+my $ns_hades = "http://ggf.org/ns/nmwg/tools/hades/2.0/";
+
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ #my $source = (@_);
+ my $source = shift;
+ if ( UNIVERSAL::isa($source,"XML::LibXML::Node") ) {
+ $self->{dom} = XML::LibXML->createDocument();
+ $self->{dom}->importNode($source);
+ $self->{dom}->setDocumentElement($source);
+ $self->{ns_nmwg} =
$self->{dom}->documentElement->lookupNamespacePrefix($ns_nmwg);
+ } elsif ($source) {
+ $self->parse_xml($source);
+ }
+ return $self;
+}
+
+# Parse XML code of a NMWG message. Also does some beautifications, like
+# making <nmwg:message> the root element of the document. Very helpful for
+# ignoring any SOAP header that might be there...
+sub parse_xml {
+ my $self = shift;
+ my $source = shift;
+ croak "No XML source to parse!" unless $source;
+ my $parser = XML::LibXML->new();
+ my $dom;
+ eval {
+ $dom = $parser->parse_string($source);
+ };
+ if ($@){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ #return ("Error parsing message: $@", "no_id");
+ croak "Error parsing message: $@";
+ }
+ #TODO The following "trick" only works if $dom contains a REAL NWMG
message!
+ # We should at least(!) also check for SOAP errors
+ my $nmwg_node = ($dom->getElementsByTagNameNS($ns_nmwg,"message"))[0];
+ if(!$nmwg_node){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ # This is only relevant the server at all........
+ #return ("Error parsing message: message contains no NMWG message tag",
"no_id");
+ croak "Error parsing message: message contains no NMWG message tag";
+ }
+ $dom->setDocumentElement($nmwg_node);
+ $self->{dom} = $dom;
+ $self->{ns_nmwg} = $dom->documentElement->lookupNamespacePrefix($ns_nmwg);
+}
+
+sub parse_xml_from_file {
+ my $self = shift;
+ my $file = shift;
+ open XMLFILE, "<$file" or croak "Cannot open $file: $!";
+ my $result = join "", <XMLFILE>;
+ close XMLFILE;
+ return $self->parse_xml($result);
+}
+
+sub dump {
+ my $self = shift;
+ my $timestamp = time;
+ my $file = "msgdump-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH Dumper($self->{dom});
+ close FH;
+}
+
+sub clone {
+ my $self = shift;
+ my $new_msg = {
+ %$self,
+ dom => $self->{dom}->cloneNode(1),
+ };
+ return bless $new_msg, "NMWG::Message";
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->as_dom->toString(@_);
+ #TODO Just passing arguments is ugly and breaks separation NWMG<->LibXML
+}
+
+sub as_dom {
+ my $self = shift;
+ return $self->{dom};
+}
+
+sub get_message_type {
+ my $self = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->getAttribute("type");
+}
+
+
+sub set_message_type {
+ my $self = shift;
+ my $type = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->setAttribute("type", $type);
+}
+
+sub add_element {
+ my $self = shift;
+ my ($parent, $node_name, $e_text) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($ns_nmwg, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_element_NS {
+ my $self = shift;
+ my ($parent, $node_name, $e_text, $namespace) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($namespace, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_attribute {
+ my $self = shift;
+ my %params = @_;
+ my $ns = $ns_nmwg;
+ my $prefix;
+ if (defined($params{"namespace"})){
+ $ns = $params{"namespace"};
+ }
+ if (defined($params{"prefix"})){
+ $prefix = $params{"prefix"};
+ }
+ my $name = $params{"parent"}->localname;
+ my $a_node = $params{"parent"}->addNewChild($ns, $params{"nodename"});
+ if ($prefix){
+ $a_node->setNamespace($ns, $prefix, 1);
+ }
+ while ( my ($name, $value) = each %params){
+ next if $name eq "parent";
+ next if $name eq "nodename";
+ next if $name eq "namespace";
+ next if $name eq "prefix";
+ $a_node->setAttribute($name, $value);
+ }
+ return $a_node;
+}
+
+sub add_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = shift;
+ my $childnode = $parentnode->addChild( $node );
+ # TODO if ($childnode != $node){ #error }
+}
+
+sub remove_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ # TODO if ($childnode != $node){ #error! }
+}
+
+sub remove_node_by_ID {
+ my $self = shift;
+ my $ID = shift;
+ my $node = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:*[\@id='$ID']")->[0];
+ if ($node){
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ } # TODO else { error!}
+}
+
+#set list of new parameter blocks
+sub set_parameter_list {
+ my $self = shift;
+ my @list = @_;
+
+
+ my $root = $self->{dom}->documentElement();
+
+ foreach my $par (@list){
+ my $metaid = $$par{"metadataIdRef"};
+ #add child to root node
+ my $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ #$self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid", namespace => $ns_perfsonar);
+ #add new parameters node
+ my $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+ foreach my $key (keys %{$par}){
+ next if $key eq "metadataIdRef";
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $$par{$key});
+ }
+ }
+}
+
+
+#set parameters for response (which are not set already from request)
+sub set_parameter_hash {
+ my $self = shift;
+ my %parameter = @_;
+ my @params;
+ my $newnode = 1;
+ my $paramnode;
+ my @paramnodes;
+ my $metanode;
+ my $metaid = $parameter{"metadataIdRef"};
+
+ # find metadata node:
+ $metanode = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:metadata[\@id='$metaid']"
+ )->[0]; # id should be unique -> use first found element, ignore rest
+ if (defined $metanode && $metanode->isa("XML::LibXML::Element")) {
+
#@paramnodes
= $metanode->getElementsByLocalName("parameters");
+ $paramnode = ($metanode->getElementsByLocalName("parameters"))[0]; #TODO
+ #$paramnode =
+ # ($metanode->getElementsByTagNameNS("$ns_nmwg", "parameters"))[0];
+ }
+
+ #if there was no matching node, create new node
+ if(!($metanode)){
+ #add child to root node
+ my $root = $self->{dom}->documentElement();
+ $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ $self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid");
+
+ }
+
+ #add new parameters node, if none was provided in request
+ if(!($paramnode)){
+ $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+
+ }
+ if ($paramnode->hasChildNodes){
+ @params = $paramnode->getChildNodes();
+ }
+ #startTime, endTime, src, dst, eventType are already set from the request!
+ foreach my $key (keys %parameter){
+ next if ($key eq "startTime" || $key eq "endTime" ||
+ $key eq "src" || $key eq "dst" || $key eq "eventType" ||
+ $key eq "lastmeta" || $key eq "metadataIdRef");
+ #set all other values in nmwg:parameters:
+ #check, if parameter is already set
+ $newnode = 1;
+ if (@params){
+ foreach my $param (@params){
+ next unless ($param->nodeName =~ /parameter/);
+ if ($param->getAttribute("name") eq $key){ #already set
+ $newnode = 0;
+ }
+ }
+ }
+ if ($newnode){ #make new parameter entry
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $parameter{$key});
+ }
+ }
+}
+
+#fill in data lines for response
+sub set_data {
+ my $self = shift;
+ my $dataid = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+#fill in data lines for response with namespace URI
+sub set_data_ns {
+ my $self = shift;
+ my $dataid = shift;
+ my $ns = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ namespace => $ns, %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+
+#fill in "freeform" string data
+sub set_data_string {
+ my $self = shift;
+ my $dataid = shift;
+ my $string = shift;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ $self->add_element_NS($datanode, "datum", $string, $ns_nmwg);
+ }
+}
+
+#parse data AND metadata blocks
+sub parse_all {
+ my $self = shift;
+ my $root = $self->{dom}->documentElement();
+ my @nodes = $root->getChildNodes();
+ my %meta;
+ unless (@nodes){
+ return ("Error parsing message: No metadata tag found", "no_id");
+ }
+ foreach my $node (@nodes){
+ if ($node->nodeName =~ /:metadata/){
+ my $metaid;
+ if (!($metaid= $node->getAttribute("id"))){ #no metadata id given!
+ #error
+ return ("No metadata ID given", "no_id");
+ }
+ #check if metadataID is already existent (has to be unique!)
+ if ($self->{"metadataIDs"}{$metaid}){
+ return ("Multiple assignement of metadata id: $metaid", "$metaid");
+ }
+
+ #TODO
+ #metaref in metadata element also! What to do if defined in metadata
AND subject??
+ #if (my $metaref= $node->getAttribute("metadataIdRef")){
+ # $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ #}
+ my $error = $self->parse_metadata($node, $metaid);
+ if ($error){
+ return ($error, $metaid);
+ }
+ } elsif ($node->nodeName =~ /:data/){
+ my $dataid;
+ if (!($dataid= $node->getAttribute("id"))){ #no data id given!
+ #error
+ return ("No data ID given", "no_id");
+ }
+ my $metaref;
+ if (!($metaref= $node->getAttribute("metadataIdRef"))){ #no reference
to metadata given!
+ #error
+ return ("No reference to metadata block given", "$dataid");
+ }
+ $self->{"dataIDs"}{$dataid}{"node"} = $node;
+ $self->{"dataIDs"}{$dataid}{"metaref"} = $metaref;
+ }
+ }
+ #Check for metadatarefs in metadata tag with different subject namespaces
TODO
+
+}
+
+
+sub parse_metadata {
+ my $self = shift;
+ my ($metanode, $metaid) = @_;
+
+ if (!($metanode->hasChildNodes())){ #empty metadata
+ #error
+ return ("Empty metadata");
+ }
+ #$self->{"metadataIDs"}{$metaid}{"node"} = $metanode;
+ my $error = undef;
+
+ # a metadatablock can contain 4 different kinds of subelements: a
parameters block,
+ # a subject block, a key block, and an eventType element.
+
+ foreach my $child ($metanode->getChildNodes()){
+ if ($child->nodeName =~ /subject/) {
+ return $error if ($error = $self->parse_subject($metaid, $child));
+ }
+
+ if ($child->nodeName =~ /parameters/) {
+ return $error if ($error = $self->parse_parameters($metaid, $child));
+
+ }
+ if ($child->nodeName =~ /key/){
+ return $error if ($error = $self->parse_key($metaid, $child));
+ }
+
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =
+ $child->textContent if ($child->nodeName =~ /eventType/);
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =~ s/^\s*(\S*)\s*/$1/
+ if $self->{"metadataIDs"}{$metaid}{"eventType"}; #Throw away any
whitespace and newlines
+ }
+ if(!$self->{"metadataIDs"}{$metaid}{"eventType"}){ #TODO eventtype could
be in other metadatablock! chaining....
+ #error message only, if
there is no eventtype per _chain_.
+ return ("Error parsing message: No event type given");
+ }
+ if($self->{"metadataIDs"}{$metaid}{"eventType"} eq "success.as.authn"){
#metadata from successful authentication
+ delete $self->{"metadataIDs"}{$metaid}; #throw away
+ return;
+ }
+ #return ("Error parsing message: No subject in metadata", $metaid)
if(!@sub_nodes
&&
!@key_nodes);
#TODO
+
+ if (my $metaref= $metanode->getAttribute("metadataIdRef")){
+ if($self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} eq
$self->{"metadataIDs"}{$metaref}{"subject_ns_uri"}){
+ $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ }
+ else {
+ return ("Metadata $metaid and $metaref have subjects with different
namespaces.");
+ }
+ }
+
+
+ #TODO
+ #print Dumper ($self->{"metadataIDs"});
+ return 0;
+}
+
+
+sub parse_subject {
+ my $self = shift;
+ my $metaid = shift;
+ my $sub = shift;
+
+ if(!($self->{"metadataIDs"}{$metaid}{"subject"} =
$sub->getAttribute("id"))){
+ return ("Error parsing message: No subject id given");
+ }
+ #find out namespace for subject:
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_prefix"} = $sub->prefix;
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} = $sub->namespaceURI();
+
+ my $ref;
+ if ($ref = $sub->getAttribute("metadataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"metaref"} = $ref;
+ }
+ if ($ref = $sub->getAttribute("dataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"dataref"} = $ref;
+ }
+ foreach my $sub_kid ($sub->getChildNodes()){
+ if (($sub_kid->nodeName =~/endPoint/) #get endpoint(pair), get interface
etc still needed.
+ && $sub_kid->hasChildNodes()){
+ foreach my $end_point ($sub_kid->getChildNodes()){
+ if ($end_point->hasAttributes()){
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"type"} =
+ $end_point->getAttribute("type");
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"value"} =
+ $end_point->getAttribute("value");
+
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_parameters {
+ my $self = shift;
+ my $metaid = shift;
+ my $par = shift;
+
+ my $parId;
+ if(!($self->{"metadataIDs"}{$metaid}{"parameter_ID"} =
$par->getAttribute("id"))){
+ return ("Error parsing message: No parameters id given");
+ }
+ #find out namespace for parameters:
+ $self->{"metadataIDs"}{$metaid}{"param_ns_prefix"} = $par->prefix;
+ $self->{"metadataIDs"}{$metaid}{"param_ns_uri"} = $par->namespaceURI();
+
+ if ($par->hasChildNodes()){
+ foreach my $p ($par->getChildNodes){
+ next if $p->nodeName =~ /\#text/ || $p->nodeName =~ /\#comment/;
+ if (!($p->nodeName =~ /:parameter$/)){
+ my $err_msg = "Error parsing message: wrong element found in
parameters: "
+ . $p->nodeName;
+ return ("$err_msg");
+ }
+ if($p->hasAttributes()){
+ my $value;
+ if(!defined($value = $p->getAttribute("value"))){
+ if (!($value = $p->textContent)){
+ return ("Error parsing message: malformed parameter, "
+ . "no textContent or name/value pair found!");
+ }
+ }
+ $self->{"metadataIDs"}{$metaid}{$p->getAttribute("name")} = $value;
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_key {
+ my $self = shift;
+ my $metaid = shift;
+ my $key = shift;
+
+ if (!($key->hasChildNodes())){ #empty key!
+ #error
+ return ("Error parsing message: Empty key");
+ }
+ foreach my $sub_key ($key->getChildNodes){
+ next unless ($sub_key->nodeName =~ /parameters/);
+ foreach my $k ($sub_key->getChildNodes){
+ next unless ($k->nodeName =~ /parameter/);
+ if($k->hasAttributes()){
+ my $value;
+ if(!($value = $k->getAttribute("value"))){
+ $value = $k->textContent;
+ }
+ $self->{"metadataIDs"}{$metaid}{"key"}{$k->getAttribute("name")} =
$value;
+ }
+ }
+ }
+ return 0;
+}
+
+#add parameters from all referenced metadatablocks to corresponding datablock
+sub concatenate_params {
+ my $self = shift;
+
+ foreach my $dataid (keys %{$self->{"dataIDs"}}){
+ my $meta = $self->{"dataIDs"}{$dataid}{"metaref"};
+ my $oldmeta;
+ my $et;
+ do {
+ #check if metadataIDref points to an existing metadata element!
+ if (!defined ($self->{"metadataIDs"}{$meta})){
+ return ("Reference to unknown metadata element (metadataIdRef):
$meta", "$dataid");
+ }
+ if ($self->{"metadataIDs"}{$meta} eq "message") { #authn
+ delete $self->{"dataIDs"}{$dataid}; #throw away
+ next;
+ }
+
+ $et = $self->{"metadataIDs"}{$meta}{"eventType"}; #TODO eventtype is
not necessarily in each metadata block!
+ $self->{"dataIDs"}{$dataid}{$et}{"metaID"} = $meta;
+ foreach my $elem (keys %{$self->{"metadataIDs"}{$meta}}){
+ next if ($elem eq "subject" || $elem eq "metaref" || $elem eq
"eventType"
+ || $elem eq "type");
+ #|| $elem eq "type" || $elem eq "ns_uri" || $elem eq
"ns_prefix");
+ #if ($elem eq "eventType"){
+ # $self->{"dataIDs"}{$dataid}{"eventTypes"}{$meta} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #} else {
+ $self->{"dataIDs"}{$dataid}{$et}{$elem} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #}
+ }
+ $oldmeta = $meta;
+ }
+ while defined ($meta = $self->{"metadataIDs"}{$oldmeta}{"metaref"});
+ }
+}
+
+#parse data section
+sub parse_data {
+ my $self = shift;
+ my @nodes = $self->{dom}->getElementsByTagNameNS("$ns_nmwg", "data");
+ unless (@nodes){
+ return ("Error parsing message: No data tag found", "no_id");
+ }
+ foreach my $datanode (@nodes){
+ my $dataid;
+ if (!($dataid= $datanode->getAttribute("id"))){ #no datadata id given!
+ return ("No data ID given", "no_id");
+ }
+ my $metaref = $datanode->getAttribute("metadataIdRef");
+ if (!($datanode->hasChildNodes())){ #empty data
+ return ("Empty data", $dataid);
+ }
+ my @datum_lines;
+ foreach my $datum ($datanode->getChildNodes()){
+ next unless ($datum->nodeName =~ /datum/ && $datum->hasAttributes());
+ my %line;
+ my @attributelist = $datum->attributes;
+ foreach my $a (@attributelist){
+ $line{$a->name} = $a->value;
+ }
+ push @datum_lines, \%line;
+ }
+ $self->{$dataid}->{"metaref"} = $metaref;
+ $self->{$dataid}->{"data"} =
\@datum_lines;
+ #print Dumper ($self->{$dataid});
+ }
+}
+
+
+#return result codes: e.g. error.ma.whatever/success.mp.great
+sub return_result_code {
+ my $self = shift;
+ my $result_code = shift;
+ my $description = shift;
+ my $metaid = shift;
+ my $id = shift;
+
+ if (!$id){
+ $id = "return_$metaid";
+ }
+
+ #create metadata entry with result_code
+ my $messagenode = $self->{dom}->documentElement();
+ #$messagenode->setAttribute("xmlns:result", $ns_result);
+ $messagenode->setNamespace($ns_result, "nmwgr", 0);
+ my $metanode = $self->add_attribute(parent => $messagenode, nodename =>
"metadata", id => $id);
+ my $string = $self->{dom}->toString;
+ #my $subjectnode = $self->add_attribute(parent => $messagenode, nodename
=> "subject",
+ #my $subjectnode = $self->add_attribute(parent => $metanode, nodename =>
"subject",
+ # id => "subjreturn", metadataIdRef
=> $metaid, "namespace" => $ns_result);
+ my $eventnode = $self->add_element($metanode, "eventType", $result_code);
+
+ #create data entry with description
+ my $datanode = $self->add_attribute(parent => $messagenode, nodename =>
"data",
+ id => "data_$id", metadataIdRef =>
$id);
+ my $datumnode = $self->add_element_NS($datanode, "datum", $description,
$ns_result);
+}
+
+
+sub create_metadatablock {
+ my $self = shift;
+ my %par = @_;
+
+ my $parent;
+ my $metaid;
+
+ if ($par{"parent"}){
+ $parent = $par{"parent"};
+ } else {
+ $parent = $self->{dom}->documentElement();
+ }
+
+ if ($par{"metadata_id"}){
+ $metaid = $par{"metadata_id"};
+ } else {
+ $metaid = rand;
+ }
+
+
+ my $metanode = $self->add_attribute (parent => $parent, nodename =>
"metadata",
+ id => $metaid);
+
+ if ($par{"subject"}){
+ #create subject
+ my $subjectnode = $self->add_attribute (parent => $metanode, nodename =>
"subject",
+ id => "subject-$metaid");
+
+ my $subref = $par{"subject"};
+
+ }
+
+ if ($par{"substring"}){
+ $metanode->appendWellBalancedChunk($par{substring});
+ }
+
+
+ if ($par{"eventtypes"}){
+ #create eventtypes
+ foreach my $et (@{$par{"eventtypes"}}){
+ $self->add_element($metanode, "eventType", $et);
+ }
+ }
+
+ if ($par{"parameters"}){
+ #create parameters
+ my $paramnode = $self->add_attribute (parent => $metanode, nodename =>
"parameters",
+ id => "params-$metaid");
+ foreach my $key (keys %{$par{"parameters"}}){
+ $self->add_attribute (parent => $paramnode, nodename => "parameter",
+ name => $key, value => $par{parameters}{$key});
+ }
+ }
+
+
+}
+
+sub create_subject_recursive {
+ my $self = shift;
+ my $ref = shift;
+ my $parent = shift;
+
+ my $ns = $ref->{"namespace"};
+ my $prefix = $ref->{"prefix"};
+
+
+ foreach my $k (keys %{$ref}){
+ next if $k eq "namespace";
+ next if $k eq "prefix";
+ my $val = $ref->{$k};
+ if (ref $val eq 'HASH'){
+ my $p = $self->add_attribute (nodename => $k, parent => $parent,
+ namespace => $ns, prefix => $prefix);
+ $self->create_subject_recursive (\%{$val}, $p);
+ } else {
+ if ($k eq "element"){
+ $parent->appendText($val);
+ } else {
+ $parent->setAttribute ($k, $val);
+ }
+ }
+ }
+}
+
+
+1;
Added: trunk/build/debian/NMWG-0.02/blib/lib/NMWG.pm
===================================================================
--- trunk/build/debian/NMWG-0.02/blib/lib/NMWG.pm
(rev 0)
+++ trunk/build/debian/NMWG-0.02/blib/lib/NMWG.pm 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,49 @@
+package NMWG;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+=head1 NAME
+
+NMWG - The great new NMWG!
+
+=head1 VERSION
+
+Version 0.02
+
+=cut
+
+our $VERSION = '0.02';
+
+=head1 SYNOPSIS
+
+=cut
+
+our $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+
+our $debug = 0;
+
+
+1;
Added: trunk/build/debian/NMWG-0.02/blib/libdoc/NMWG.3pm
===================================================================
--- trunk/build/debian/NMWG-0.02/blib/libdoc/NMWG.3pm
(rev 0)
+++ trunk/build/debian/NMWG-0.02/blib/libdoc/NMWG.3pm 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,138 @@
+.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10
pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12
pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds :
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o
\\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "NMWG 3pm"
+.TH NMWG 3pm "2010-07-29" "perl v5.10.0" "User Contributed Perl
Documentation"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+NMWG \- The great new NMWG!
+.SH "VERSION"
+.IX Header "VERSION"
+Version 0.02
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
Added: trunk/build/debian/NMWG-0.02/build-stamp
===================================================================
Added: trunk/build/debian/NMWG-0.02/debian/changelog
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/changelog
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/changelog 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,5 @@
+libnmwg-perl (0.02-0rc1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Hakan Calim
<>
Wed, 2 Jun 2010 12:42:47 +0200
Added: trunk/build/debian/NMWG-0.02/debian/compat
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/compat (rev
0)
+++ trunk/build/debian/NMWG-0.02/debian/compat 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1 @@
+5
Added: trunk/build/debian/NMWG-0.02/debian/control
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/control (rev
0)
+++ trunk/build/debian/NMWG-0.02/debian/control 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,17 @@
+Source: libnmwg-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5), libmodule-build-perl
+Build-Depends-Indep: perl (>= 5.6.10-12)
+Maintainer: DFN Labor
<>
+Standards-Version: 3.8.0
+Homepage: http://www.win-labor.dfn.de
+
+Package: libnmwg-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends}, libwww-perl (>= 2.033),
libxml-libxml-perl (>= 1.61)
+Description: The NMWG Perl module
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
Added: trunk/build/debian/NMWG-0.02/debian/copyright
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/copyright
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/copyright 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: trunk/build/debian/NMWG-0.02/debian/files
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/files (rev
0)
+++ trunk/build/debian/NMWG-0.02/debian/files 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1 @@
+libnmwg-perl_0.02-0rc1_all.deb perl optional
Added: trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/control
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/control
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,14 @@
+Package: libnmwg-perl
+Version: 0.02-0rc1
+Architecture: all
+Maintainer: DFN Labor
<>
+Installed-Size: 88
+Depends: perl (>= 5.6.0-16), libwww-perl (>= 2.033), libxml-libxml-perl (>=
1.61)
+Section: perl
+Priority: optional
+Homepage: http://www.win-labor.dfn.de
+Description: The NMWG Perl module
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
Added: trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/md5sums
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/md5sums
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/DEBIAN/md5sums
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,7 @@
+e11c34a0c8d61ff0294740a33db6fb33 usr/share/perl5/NMWG/Message.pm
+30a983b70ac070f1a20088a1dbc03920 usr/share/perl5/NMWG.pm
+383a2696c0e61ed02c203cc92f7f7d5b usr/share/man/man3/NMWG.3pm.gz
+f3597d2153d9f28617c3dd12393f1c3d usr/share/doc/libnmwg-perl/copyright
+2b56ad1be45e105953bc24de96de2cce
usr/share/doc/libnmwg-perl/changelog.Debian.gz
+96af157adebce633c30a71616771555f usr/share/doc/libnmwg-perl/changelog.gz
+7765efc7ae7afac6f15ced83a733b9a0 usr/share/doc/libnmwg-perl/README
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/README
===================================================================
---
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/README
(rev 0)
+++
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/README
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,48 @@
+NMWG
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it get an idea of the modules uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Build.PL
+ ./Build
+ ./Build test
+ ./Build install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
perldoc command.
+
+ perldoc NMWG
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/NMWG
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=NMWG
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/NMWG
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/NMWG
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007 DFN-Labor
+
+This program is released under the following license: help
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.Debian.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.Debian.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/changelog.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/copyright
===================================================================
---
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/copyright
(rev 0)
+++
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/doc/libnmwg-perl/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/man/man3/NMWG.3pm.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/man/man3/NMWG.3pm.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG/Message.pm
===================================================================
---
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG/Message.pm
(rev 0)
+++
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG/Message.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,740 @@
+package NMWG::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Replace more getElementsByTagNameNS and similar using find ?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Carp;
+use XML::LibXML;
+
+
+my $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $ns_perfsonar = "http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";
+my $ns_result = "http://ggf.org/ns/nmwg/result/2.0/";
+my $ns_hades = "http://ggf.org/ns/nmwg/tools/hades/2.0/";
+
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ #my $source = (@_);
+ my $source = shift;
+ if ( UNIVERSAL::isa($source,"XML::LibXML::Node") ) {
+ $self->{dom} = XML::LibXML->createDocument();
+ $self->{dom}->importNode($source);
+ $self->{dom}->setDocumentElement($source);
+ $self->{ns_nmwg} =
$self->{dom}->documentElement->lookupNamespacePrefix($ns_nmwg);
+ } elsif ($source) {
+ $self->parse_xml($source);
+ }
+ return $self;
+}
+
+# Parse XML code of a NMWG message. Also does some beautifications, like
+# making <nmwg:message> the root element of the document. Very helpful for
+# ignoring any SOAP header that might be there...
+sub parse_xml {
+ my $self = shift;
+ my $source = shift;
+ croak "No XML source to parse!" unless $source;
+ my $parser = XML::LibXML->new();
+ my $dom;
+ eval {
+ $dom = $parser->parse_string($source);
+ };
+ if ($@){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ #return ("Error parsing message: $@", "no_id");
+ croak "Error parsing message: $@";
+ }
+ #TODO The following "trick" only works if $dom contains a REAL NWMG
message!
+ # We should at least(!) also check for SOAP errors
+ my $nmwg_node = ($dom->getElementsByTagNameNS($ns_nmwg,"message"))[0];
+ if(!$nmwg_node){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ # This is only relevant the server at all........
+ #return ("Error parsing message: message contains no NMWG message tag",
"no_id");
+ croak "Error parsing message: message contains no NMWG message tag";
+ }
+ $dom->setDocumentElement($nmwg_node);
+ $self->{dom} = $dom;
+ $self->{ns_nmwg} = $dom->documentElement->lookupNamespacePrefix($ns_nmwg);
+}
+
+sub parse_xml_from_file {
+ my $self = shift;
+ my $file = shift;
+ open XMLFILE, "<$file" or croak "Cannot open $file: $!";
+ my $result = join "", <XMLFILE>;
+ close XMLFILE;
+ return $self->parse_xml($result);
+}
+
+sub dump {
+ my $self = shift;
+ my $timestamp = time;
+ my $file = "msgdump-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH Dumper($self->{dom});
+ close FH;
+}
+
+sub clone {
+ my $self = shift;
+ my $new_msg = {
+ %$self,
+ dom => $self->{dom}->cloneNode(1),
+ };
+ return bless $new_msg, "NMWG::Message";
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->as_dom->toString(@_);
+ #TODO Just passing arguments is ugly and breaks separation NWMG<->LibXML
+}
+
+sub as_dom {
+ my $self = shift;
+ return $self->{dom};
+}
+
+sub get_message_type {
+ my $self = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->getAttribute("type");
+}
+
+
+sub set_message_type {
+ my $self = shift;
+ my $type = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->setAttribute("type", $type);
+}
+
+sub add_element {
+ my $self = shift;
+ my ($parent, $node_name, $e_text) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($ns_nmwg, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_element_NS {
+ my $self = shift;
+ my ($parent, $node_name, $e_text, $namespace) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($namespace, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_attribute {
+ my $self = shift;
+ my %params = @_;
+ my $ns = $ns_nmwg;
+ my $prefix;
+ if (defined($params{"namespace"})){
+ $ns = $params{"namespace"};
+ }
+ if (defined($params{"prefix"})){
+ $prefix = $params{"prefix"};
+ }
+ my $name = $params{"parent"}->localname;
+ my $a_node = $params{"parent"}->addNewChild($ns, $params{"nodename"});
+ if ($prefix){
+ $a_node->setNamespace($ns, $prefix, 1);
+ }
+ while ( my ($name, $value) = each %params){
+ next if $name eq "parent";
+ next if $name eq "nodename";
+ next if $name eq "namespace";
+ next if $name eq "prefix";
+ $a_node->setAttribute($name, $value);
+ }
+ return $a_node;
+}
+
+sub add_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = shift;
+ my $childnode = $parentnode->addChild( $node );
+ # TODO if ($childnode != $node){ #error }
+}
+
+sub remove_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ # TODO if ($childnode != $node){ #error! }
+}
+
+sub remove_node_by_ID {
+ my $self = shift;
+ my $ID = shift;
+ my $node = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:*[\@id='$ID']")->[0];
+ if ($node){
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ } # TODO else { error!}
+}
+
+#set list of new parameter blocks
+sub set_parameter_list {
+ my $self = shift;
+ my @list = @_;
+
+
+ my $root = $self->{dom}->documentElement();
+
+ foreach my $par (@list){
+ my $metaid = $$par{"metadataIdRef"};
+ #add child to root node
+ my $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ #$self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid", namespace => $ns_perfsonar);
+ #add new parameters node
+ my $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+ foreach my $key (keys %{$par}){
+ next if $key eq "metadataIdRef";
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $$par{$key});
+ }
+ }
+}
+
+
+#set parameters for response (which are not set already from request)
+sub set_parameter_hash {
+ my $self = shift;
+ my %parameter = @_;
+ my @params;
+ my $newnode = 1;
+ my $paramnode;
+ my @paramnodes;
+ my $metanode;
+ my $metaid = $parameter{"metadataIdRef"};
+
+ # find metadata node:
+ $metanode = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:metadata[\@id='$metaid']"
+ )->[0]; # id should be unique -> use first found element, ignore rest
+ if (defined $metanode && $metanode->isa("XML::LibXML::Element")) {
+
#@paramnodes
= $metanode->getElementsByLocalName("parameters");
+ $paramnode = ($metanode->getElementsByLocalName("parameters"))[0]; #TODO
+ #$paramnode =
+ # ($metanode->getElementsByTagNameNS("$ns_nmwg", "parameters"))[0];
+ }
+
+ #if there was no matching node, create new node
+ if(!($metanode)){
+ #add child to root node
+ my $root = $self->{dom}->documentElement();
+ $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ $self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid");
+
+ }
+
+ #add new parameters node, if none was provided in request
+ if(!($paramnode)){
+ $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+
+ }
+ if ($paramnode->hasChildNodes){
+ @params = $paramnode->getChildNodes();
+ }
+ #startTime, endTime, src, dst, eventType are already set from the request!
+ foreach my $key (keys %parameter){
+ next if ($key eq "startTime" || $key eq "endTime" ||
+ $key eq "src" || $key eq "dst" || $key eq "eventType" ||
+ $key eq "lastmeta" || $key eq "metadataIdRef");
+ #set all other values in nmwg:parameters:
+ #check, if parameter is already set
+ $newnode = 1;
+ if (@params){
+ foreach my $param (@params){
+ next unless ($param->nodeName =~ /parameter/);
+ if ($param->getAttribute("name") eq $key){ #already set
+ $newnode = 0;
+ }
+ }
+ }
+ if ($newnode){ #make new parameter entry
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $parameter{$key});
+ }
+ }
+}
+
+#fill in data lines for response
+sub set_data {
+ my $self = shift;
+ my $dataid = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+#fill in data lines for response with namespace URI
+sub set_data_ns {
+ my $self = shift;
+ my $dataid = shift;
+ my $ns = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ namespace => $ns, %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+
+#fill in "freeform" string data
+sub set_data_string {
+ my $self = shift;
+ my $dataid = shift;
+ my $string = shift;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ $self->add_element_NS($datanode, "datum", $string, $ns_nmwg);
+ }
+}
+
+#parse data AND metadata blocks
+sub parse_all {
+ my $self = shift;
+ my $root = $self->{dom}->documentElement();
+ my @nodes = $root->getChildNodes();
+ my %meta;
+ unless (@nodes){
+ return ("Error parsing message: No metadata tag found", "no_id");
+ }
+ foreach my $node (@nodes){
+ if ($node->nodeName =~ /:metadata/){
+ my $metaid;
+ if (!($metaid= $node->getAttribute("id"))){ #no metadata id given!
+ #error
+ return ("No metadata ID given", "no_id");
+ }
+ #check if metadataID is already existent (has to be unique!)
+ if ($self->{"metadataIDs"}{$metaid}){
+ return ("Multiple assignement of metadata id: $metaid", "$metaid");
+ }
+
+ #TODO
+ #metaref in metadata element also! What to do if defined in metadata
AND subject??
+ #if (my $metaref= $node->getAttribute("metadataIdRef")){
+ # $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ #}
+ my $error = $self->parse_metadata($node, $metaid);
+ if ($error){
+ return ($error, $metaid);
+ }
+ } elsif ($node->nodeName =~ /:data/){
+ my $dataid;
+ if (!($dataid= $node->getAttribute("id"))){ #no data id given!
+ #error
+ return ("No data ID given", "no_id");
+ }
+ my $metaref;
+ if (!($metaref= $node->getAttribute("metadataIdRef"))){ #no reference
to metadata given!
+ #error
+ return ("No reference to metadata block given", "$dataid");
+ }
+ $self->{"dataIDs"}{$dataid}{"node"} = $node;
+ $self->{"dataIDs"}{$dataid}{"metaref"} = $metaref;
+ }
+ }
+ #Check for metadatarefs in metadata tag with different subject namespaces
TODO
+
+}
+
+
+sub parse_metadata {
+ my $self = shift;
+ my ($metanode, $metaid) = @_;
+
+ if (!($metanode->hasChildNodes())){ #empty metadata
+ #error
+ return ("Empty metadata");
+ }
+ #$self->{"metadataIDs"}{$metaid}{"node"} = $metanode;
+ my $error = undef;
+
+ # a metadatablock can contain 4 different kinds of subelements: a
parameters block,
+ # a subject block, a key block, and an eventType element.
+
+ foreach my $child ($metanode->getChildNodes()){
+ if ($child->nodeName =~ /subject/) {
+ return $error if ($error = $self->parse_subject($metaid, $child));
+ }
+
+ if ($child->nodeName =~ /parameters/) {
+ return $error if ($error = $self->parse_parameters($metaid, $child));
+
+ }
+ if ($child->nodeName =~ /key/){
+ return $error if ($error = $self->parse_key($metaid, $child));
+ }
+
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =
+ $child->textContent if ($child->nodeName =~ /eventType/);
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =~ s/^\s*(\S*)\s*/$1/
+ if $self->{"metadataIDs"}{$metaid}{"eventType"}; #Throw away any
whitespace and newlines
+ }
+ if(!$self->{"metadataIDs"}{$metaid}{"eventType"}){ #TODO eventtype could
be in other metadatablock! chaining....
+ #error message only, if
there is no eventtype per _chain_.
+ return ("Error parsing message: No event type given");
+ }
+ if($self->{"metadataIDs"}{$metaid}{"eventType"} eq "success.as.authn"){
#metadata from successful authentication
+ delete $self->{"metadataIDs"}{$metaid}; #throw away
+ return;
+ }
+ #return ("Error parsing message: No subject in metadata", $metaid)
if(!@sub_nodes
&&
!@key_nodes);
#TODO
+
+ if (my $metaref= $metanode->getAttribute("metadataIdRef")){
+ if($self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} eq
$self->{"metadataIDs"}{$metaref}{"subject_ns_uri"}){
+ $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ }
+ else {
+ return ("Metadata $metaid and $metaref have subjects with different
namespaces.");
+ }
+ }
+
+
+ #TODO
+ #print Dumper ($self->{"metadataIDs"});
+ return 0;
+}
+
+
+sub parse_subject {
+ my $self = shift;
+ my $metaid = shift;
+ my $sub = shift;
+
+ if(!($self->{"metadataIDs"}{$metaid}{"subject"} =
$sub->getAttribute("id"))){
+ return ("Error parsing message: No subject id given");
+ }
+ #find out namespace for subject:
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_prefix"} = $sub->prefix;
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} = $sub->namespaceURI();
+
+ my $ref;
+ if ($ref = $sub->getAttribute("metadataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"metaref"} = $ref;
+ }
+ if ($ref = $sub->getAttribute("dataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"dataref"} = $ref;
+ }
+ foreach my $sub_kid ($sub->getChildNodes()){
+ if (($sub_kid->nodeName =~/endPoint/) #get endpoint(pair), get interface
etc still needed.
+ && $sub_kid->hasChildNodes()){
+ foreach my $end_point ($sub_kid->getChildNodes()){
+ if ($end_point->hasAttributes()){
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"type"} =
+ $end_point->getAttribute("type");
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"value"} =
+ $end_point->getAttribute("value");
+
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_parameters {
+ my $self = shift;
+ my $metaid = shift;
+ my $par = shift;
+
+ my $parId;
+ if(!($self->{"metadataIDs"}{$metaid}{"parameter_ID"} =
$par->getAttribute("id"))){
+ return ("Error parsing message: No parameters id given");
+ }
+ #find out namespace for parameters:
+ $self->{"metadataIDs"}{$metaid}{"param_ns_prefix"} = $par->prefix;
+ $self->{"metadataIDs"}{$metaid}{"param_ns_uri"} = $par->namespaceURI();
+
+ if ($par->hasChildNodes()){
+ foreach my $p ($par->getChildNodes){
+ next if $p->nodeName =~ /\#text/ || $p->nodeName =~ /\#comment/;
+ if (!($p->nodeName =~ /:parameter$/)){
+ my $err_msg = "Error parsing message: wrong element found in
parameters: "
+ . $p->nodeName;
+ return ("$err_msg");
+ }
+ if($p->hasAttributes()){
+ my $value;
+ if(!defined($value = $p->getAttribute("value"))){
+ if (!($value = $p->textContent)){
+ return ("Error parsing message: malformed parameter, "
+ . "no textContent or name/value pair found!");
+ }
+ }
+ $self->{"metadataIDs"}{$metaid}{$p->getAttribute("name")} = $value;
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_key {
+ my $self = shift;
+ my $metaid = shift;
+ my $key = shift;
+
+ if (!($key->hasChildNodes())){ #empty key!
+ #error
+ return ("Error parsing message: Empty key");
+ }
+ foreach my $sub_key ($key->getChildNodes){
+ next unless ($sub_key->nodeName =~ /parameters/);
+ foreach my $k ($sub_key->getChildNodes){
+ next unless ($k->nodeName =~ /parameter/);
+ if($k->hasAttributes()){
+ my $value;
+ if(!($value = $k->getAttribute("value"))){
+ $value = $k->textContent;
+ }
+ $self->{"metadataIDs"}{$metaid}{"key"}{$k->getAttribute("name")} =
$value;
+ }
+ }
+ }
+ return 0;
+}
+
+#add parameters from all referenced metadatablocks to corresponding datablock
+sub concatenate_params {
+ my $self = shift;
+
+ foreach my $dataid (keys %{$self->{"dataIDs"}}){
+ my $meta = $self->{"dataIDs"}{$dataid}{"metaref"};
+ my $oldmeta;
+ my $et;
+ do {
+ #check if metadataIDref points to an existing metadata element!
+ if (!defined ($self->{"metadataIDs"}{$meta})){
+ return ("Reference to unknown metadata element (metadataIdRef):
$meta", "$dataid");
+ }
+ if ($self->{"metadataIDs"}{$meta} eq "message") { #authn
+ delete $self->{"dataIDs"}{$dataid}; #throw away
+ next;
+ }
+
+ $et = $self->{"metadataIDs"}{$meta}{"eventType"}; #TODO eventtype is
not necessarily in each metadata block!
+ $self->{"dataIDs"}{$dataid}{$et}{"metaID"} = $meta;
+ foreach my $elem (keys %{$self->{"metadataIDs"}{$meta}}){
+ next if ($elem eq "subject" || $elem eq "metaref" || $elem eq
"eventType"
+ || $elem eq "type");
+ #|| $elem eq "type" || $elem eq "ns_uri" || $elem eq
"ns_prefix");
+ #if ($elem eq "eventType"){
+ # $self->{"dataIDs"}{$dataid}{"eventTypes"}{$meta} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #} else {
+ $self->{"dataIDs"}{$dataid}{$et}{$elem} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #}
+ }
+ $oldmeta = $meta;
+ }
+ while defined ($meta = $self->{"metadataIDs"}{$oldmeta}{"metaref"});
+ }
+}
+
+#parse data section
+sub parse_data {
+ my $self = shift;
+ my @nodes = $self->{dom}->getElementsByTagNameNS("$ns_nmwg", "data");
+ unless (@nodes){
+ return ("Error parsing message: No data tag found", "no_id");
+ }
+ foreach my $datanode (@nodes){
+ my $dataid;
+ if (!($dataid= $datanode->getAttribute("id"))){ #no datadata id given!
+ return ("No data ID given", "no_id");
+ }
+ my $metaref = $datanode->getAttribute("metadataIdRef");
+ if (!($datanode->hasChildNodes())){ #empty data
+ return ("Empty data", $dataid);
+ }
+ my @datum_lines;
+ foreach my $datum ($datanode->getChildNodes()){
+ next unless ($datum->nodeName =~ /datum/ && $datum->hasAttributes());
+ my %line;
+ my @attributelist = $datum->attributes;
+ foreach my $a (@attributelist){
+ $line{$a->name} = $a->value;
+ }
+ push @datum_lines, \%line;
+ }
+ $self->{$dataid}->{"metaref"} = $metaref;
+ $self->{$dataid}->{"data"} =
\@datum_lines;
+ #print Dumper ($self->{$dataid});
+ }
+}
+
+
+#return result codes: e.g. error.ma.whatever/success.mp.great
+sub return_result_code {
+ my $self = shift;
+ my $result_code = shift;
+ my $description = shift;
+ my $metaid = shift;
+ my $id = shift;
+
+ if (!$id){
+ $id = "return_$metaid";
+ }
+
+ #create metadata entry with result_code
+ my $messagenode = $self->{dom}->documentElement();
+ #$messagenode->setAttribute("xmlns:result", $ns_result);
+ $messagenode->setNamespace($ns_result, "nmwgr", 0);
+ my $metanode = $self->add_attribute(parent => $messagenode, nodename =>
"metadata", id => $id);
+ my $string = $self->{dom}->toString;
+ #my $subjectnode = $self->add_attribute(parent => $messagenode, nodename
=> "subject",
+ #my $subjectnode = $self->add_attribute(parent => $metanode, nodename =>
"subject",
+ # id => "subjreturn", metadataIdRef
=> $metaid, "namespace" => $ns_result);
+ my $eventnode = $self->add_element($metanode, "eventType", $result_code);
+
+ #create data entry with description
+ my $datanode = $self->add_attribute(parent => $messagenode, nodename =>
"data",
+ id => "data_$id", metadataIdRef =>
$id);
+ my $datumnode = $self->add_element_NS($datanode, "datum", $description,
$ns_result);
+}
+
+
+sub create_metadatablock {
+ my $self = shift;
+ my %par = @_;
+
+ my $parent;
+ my $metaid;
+
+ if ($par{"parent"}){
+ $parent = $par{"parent"};
+ } else {
+ $parent = $self->{dom}->documentElement();
+ }
+
+ if ($par{"metadata_id"}){
+ $metaid = $par{"metadata_id"};
+ } else {
+ $metaid = rand;
+ }
+
+
+ my $metanode = $self->add_attribute (parent => $parent, nodename =>
"metadata",
+ id => $metaid);
+
+ if ($par{"subject"}){
+ #create subject
+ my $subjectnode = $self->add_attribute (parent => $metanode, nodename =>
"subject",
+ id => "subject-$metaid");
+
+ my $subref = $par{"subject"};
+
+ }
+
+ if ($par{"substring"}){
+ $metanode->appendWellBalancedChunk($par{substring});
+ }
+
+
+ if ($par{"eventtypes"}){
+ #create eventtypes
+ foreach my $et (@{$par{"eventtypes"}}){
+ $self->add_element($metanode, "eventType", $et);
+ }
+ }
+
+ if ($par{"parameters"}){
+ #create parameters
+ my $paramnode = $self->add_attribute (parent => $metanode, nodename =>
"parameters",
+ id => "params-$metaid");
+ foreach my $key (keys %{$par{"parameters"}}){
+ $self->add_attribute (parent => $paramnode, nodename => "parameter",
+ name => $key, value => $par{parameters}{$key});
+ }
+ }
+
+
+}
+
+sub create_subject_recursive {
+ my $self = shift;
+ my $ref = shift;
+ my $parent = shift;
+
+ my $ns = $ref->{"namespace"};
+ my $prefix = $ref->{"prefix"};
+
+
+ foreach my $k (keys %{$ref}){
+ next if $k eq "namespace";
+ next if $k eq "prefix";
+ my $val = $ref->{$k};
+ if (ref $val eq 'HASH'){
+ my $p = $self->add_attribute (nodename => $k, parent => $parent,
+ namespace => $ns, prefix => $prefix);
+ $self->create_subject_recursive (\%{$val}, $p);
+ } else {
+ if ($k eq "element"){
+ $parent->appendText($val);
+ } else {
+ $parent->setAttribute ($k, $val);
+ }
+ }
+ }
+}
+
+
+1;
Added:
trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG.pm
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG.pm
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/libnmwg-perl/usr/share/perl5/NMWG.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+package NMWG;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+=head1 NAME
+
+NMWG - The great new NMWG!
+
+=head1 VERSION
+
+Version 0.02
+
+=cut
+
+our $VERSION = '0.02';
+
+=head1 SYNOPSIS
+
+=cut
+
+our $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+
+our $debug = 0;
+
+
+1;
Added: trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.debhelper.log
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.debhelper.log
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.debhelper.log
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,9 @@
+dh_installdocs
+dh_installchangelogs
+dh_perl
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
Added: trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.substvars
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.substvars
(rev 0)
+++ trunk/build/debian/NMWG-0.02/debian/libnmwg-perl.substvars 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+perl:Depends=perl (>= 5.6.0-16)
Added: trunk/build/debian/NMWG-0.02/debian/rules
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/rules (rev
0)
+++ trunk/build/debian/NMWG-0.02/debian/rules 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,63 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt
<>
for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+#
+# It was later modified by Jason Kohles
<>
+# http://www.jasonkohles.com/ to support Module::Build installed modules
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Build.PL installdirs=vendor
+ $(PERL) Build
+ $(PERL) Build test
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP) here
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs README
+ dh_installchangelogs Changes
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Property changes on: trunk/build/debian/NMWG-0.02/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/NMWG-0.02/debian/watch
===================================================================
--- trunk/build/debian/NMWG-0.02/debian/watch (rev
0)
+++ trunk/build/debian/NMWG-0.02/debian/watch 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,4 @@
+# format version number, currently 3; this line is compulsory!
+version=3
+# URL to the package page followed by a regex to search
+http://search.cpan.org/dist/NMWG/
.*/NMWG-v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$
Added: trunk/build/debian/NMWG-0.02/install-stamp
===================================================================
Added: trunk/build/debian/NMWG-0.02/lib/NMWG/Message.pm
===================================================================
--- trunk/build/debian/NMWG-0.02/lib/NMWG/Message.pm
(rev 0)
+++ trunk/build/debian/NMWG-0.02/lib/NMWG/Message.pm 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,740 @@
+package NMWG::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Replace more getElementsByTagNameNS and similar using find ?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Carp;
+use XML::LibXML;
+
+
+my $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $ns_perfsonar = "http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";
+my $ns_result = "http://ggf.org/ns/nmwg/result/2.0/";
+my $ns_hades = "http://ggf.org/ns/nmwg/tools/hades/2.0/";
+
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ #my $source = (@_);
+ my $source = shift;
+ if ( UNIVERSAL::isa($source,"XML::LibXML::Node") ) {
+ $self->{dom} = XML::LibXML->createDocument();
+ $self->{dom}->importNode($source);
+ $self->{dom}->setDocumentElement($source);
+ $self->{ns_nmwg} =
$self->{dom}->documentElement->lookupNamespacePrefix($ns_nmwg);
+ } elsif ($source) {
+ $self->parse_xml($source);
+ }
+ return $self;
+}
+
+# Parse XML code of a NMWG message. Also does some beautifications, like
+# making <nmwg:message> the root element of the document. Very helpful for
+# ignoring any SOAP header that might be there...
+sub parse_xml {
+ my $self = shift;
+ my $source = shift;
+ croak "No XML source to parse!" unless $source;
+ my $parser = XML::LibXML->new();
+ my $dom;
+ eval {
+ $dom = $parser->parse_string($source);
+ };
+ if ($@){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ #return ("Error parsing message: $@", "no_id");
+ croak "Error parsing message: $@";
+ }
+ #TODO The following "trick" only works if $dom contains a REAL NWMG
message!
+ # We should at least(!) also check for SOAP errors
+ my $nmwg_node = ($dom->getElementsByTagNameNS($ns_nmwg,"message"))[0];
+ if(!$nmwg_node){
+ #TODO The following should be sent as NMWG error, not SOAP error
+ # This is only relevant the server at all........
+ #return ("Error parsing message: message contains no NMWG message tag",
"no_id");
+ croak "Error parsing message: message contains no NMWG message tag";
+ }
+ $dom->setDocumentElement($nmwg_node);
+ $self->{dom} = $dom;
+ $self->{ns_nmwg} = $dom->documentElement->lookupNamespacePrefix($ns_nmwg);
+}
+
+sub parse_xml_from_file {
+ my $self = shift;
+ my $file = shift;
+ open XMLFILE, "<$file" or croak "Cannot open $file: $!";
+ my $result = join "", <XMLFILE>;
+ close XMLFILE;
+ return $self->parse_xml($result);
+}
+
+sub dump {
+ my $self = shift;
+ my $timestamp = time;
+ my $file = "msgdump-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH Dumper($self->{dom});
+ close FH;
+}
+
+sub clone {
+ my $self = shift;
+ my $new_msg = {
+ %$self,
+ dom => $self->{dom}->cloneNode(1),
+ };
+ return bless $new_msg, "NMWG::Message";
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->as_dom->toString(@_);
+ #TODO Just passing arguments is ugly and breaks separation NWMG<->LibXML
+}
+
+sub as_dom {
+ my $self = shift;
+ return $self->{dom};
+}
+
+sub get_message_type {
+ my $self = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->getAttribute("type");
+}
+
+
+sub set_message_type {
+ my $self = shift;
+ my $type = shift;
+ my $node = $self->{dom}->documentElement();
+ return $node->setAttribute("type", $type);
+}
+
+sub add_element {
+ my $self = shift;
+ my ($parent, $node_name, $e_text) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($ns_nmwg, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_element_NS {
+ my $self = shift;
+ my ($parent, $node_name, $e_text, $namespace) = @_;
+ my $e_node;
+ $e_node = $parent->addNewChild($namespace, $node_name);
+ $e_node->appendText($e_text);
+ return $e_node;
+}
+
+sub add_attribute {
+ my $self = shift;
+ my %params = @_;
+ my $ns = $ns_nmwg;
+ my $prefix;
+ if (defined($params{"namespace"})){
+ $ns = $params{"namespace"};
+ }
+ if (defined($params{"prefix"})){
+ $prefix = $params{"prefix"};
+ }
+ my $name = $params{"parent"}->localname;
+ my $a_node = $params{"parent"}->addNewChild($ns, $params{"nodename"});
+ if ($prefix){
+ $a_node->setNamespace($ns, $prefix, 1);
+ }
+ while ( my ($name, $value) = each %params){
+ next if $name eq "parent";
+ next if $name eq "nodename";
+ next if $name eq "namespace";
+ next if $name eq "prefix";
+ $a_node->setAttribute($name, $value);
+ }
+ return $a_node;
+}
+
+sub add_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = shift;
+ my $childnode = $parentnode->addChild( $node );
+ # TODO if ($childnode != $node){ #error }
+}
+
+sub remove_node {
+ my $self = shift;
+ my $node = shift;
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ # TODO if ($childnode != $node){ #error! }
+}
+
+sub remove_node_by_ID {
+ my $self = shift;
+ my $ID = shift;
+ my $node = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:*[\@id='$ID']")->[0];
+ if ($node){
+ my $parentnode = $node->parentNode;
+ my $childnode = $parentnode->removeChild($node);
+ } # TODO else { error!}
+}
+
+#set list of new parameter blocks
+sub set_parameter_list {
+ my $self = shift;
+ my @list = @_;
+
+
+ my $root = $self->{dom}->documentElement();
+
+ foreach my $par (@list){
+ my $metaid = $$par{"metadataIdRef"};
+ #add child to root node
+ my $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ #$self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid", namespace => $ns_perfsonar);
+ #add new parameters node
+ my $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+ foreach my $key (keys %{$par}){
+ next if $key eq "metadataIdRef";
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $$par{$key});
+ }
+ }
+}
+
+
+#set parameters for response (which are not set already from request)
+sub set_parameter_hash {
+ my $self = shift;
+ my %parameter = @_;
+ my @params;
+ my $newnode = 1;
+ my $paramnode;
+ my @paramnodes;
+ my $metanode;
+ my $metaid = $parameter{"metadataIdRef"};
+
+ # find metadata node:
+ $metanode = $self->{dom}->find(
+
"/$self->{ns_nmwg}:message/$self->{ns_nmwg}:metadata[\@id='$metaid']"
+ )->[0]; # id should be unique -> use first found element, ignore rest
+ if (defined $metanode && $metanode->isa("XML::LibXML::Element")) {
+
#@paramnodes
= $metanode->getElementsByLocalName("parameters");
+ $paramnode = ($metanode->getElementsByLocalName("parameters"))[0]; #TODO
+ #$paramnode =
+ # ($metanode->getElementsByTagNameNS("$ns_nmwg", "parameters"))[0];
+ }
+
+ #if there was no matching node, create new node
+ if(!($metanode)){
+ #add child to root node
+ my $root = $self->{dom}->documentElement();
+ $metanode = $self->add_attribute(parent => $root, nodename =>
"metadata", id => $metaid);
+ #add subject node (for completeness)
+ $self->add_attribute(parent => $metanode, nodename => "subject", id =>
"subject-$metaid");
+
+ }
+
+ #add new parameters node, if none was provided in request
+ if(!($paramnode)){
+ $paramnode = $self->add_attribute(parent => $metanode, nodename =>
"parameters", id => "param1");
+
+ }
+ if ($paramnode->hasChildNodes){
+ @params = $paramnode->getChildNodes();
+ }
+ #startTime, endTime, src, dst, eventType are already set from the request!
+ foreach my $key (keys %parameter){
+ next if ($key eq "startTime" || $key eq "endTime" ||
+ $key eq "src" || $key eq "dst" || $key eq "eventType" ||
+ $key eq "lastmeta" || $key eq "metadataIdRef");
+ #set all other values in nmwg:parameters:
+ #check, if parameter is already set
+ $newnode = 1;
+ if (@params){
+ foreach my $param (@params){
+ next unless ($param->nodeName =~ /parameter/);
+ if ($param->getAttribute("name") eq $key){ #already set
+ $newnode = 0;
+ }
+ }
+ }
+ if ($newnode){ #make new parameter entry
+ $self->add_attribute(parent => $paramnode, nodename => "parameter",
+ name => $key, value => $parameter{$key});
+ }
+ }
+}
+
+#fill in data lines for response
+sub set_data {
+ my $self = shift;
+ my $dataid = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+#fill in data lines for response with namespace URI
+sub set_data_ns {
+ my $self = shift;
+ my $dataid = shift;
+ my $ns = shift;
+ my @lines = @_;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ foreach my $line (@lines){
+ my $newdataline = $self->add_attribute(parent => $datanode, nodename
=> "datum",
+ namespace => $ns, %{$line});
+ if(!($newdataline)){
+ return ("Error writing data line", "$dataid");
+ }
+ }
+ }
+}
+
+
+#fill in "freeform" string data
+sub set_data_string {
+ my $self = shift;
+ my $dataid = shift;
+ my $string = shift;
+
+ # find data node:
+ my $datanode = $self->{"dataIDs"}{$dataid}{"node"};
+ if (defined $datanode && $datanode->isa("XML::LibXML::Element")) {
+ $self->add_element_NS($datanode, "datum", $string, $ns_nmwg);
+ }
+}
+
+#parse data AND metadata blocks
+sub parse_all {
+ my $self = shift;
+ my $root = $self->{dom}->documentElement();
+ my @nodes = $root->getChildNodes();
+ my %meta;
+ unless (@nodes){
+ return ("Error parsing message: No metadata tag found", "no_id");
+ }
+ foreach my $node (@nodes){
+ if ($node->nodeName =~ /:metadata/){
+ my $metaid;
+ if (!($metaid= $node->getAttribute("id"))){ #no metadata id given!
+ #error
+ return ("No metadata ID given", "no_id");
+ }
+ #check if metadataID is already existent (has to be unique!)
+ if ($self->{"metadataIDs"}{$metaid}){
+ return ("Multiple assignement of metadata id: $metaid", "$metaid");
+ }
+
+ #TODO
+ #metaref in metadata element also! What to do if defined in metadata
AND subject??
+ #if (my $metaref= $node->getAttribute("metadataIdRef")){
+ # $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ #}
+ my $error = $self->parse_metadata($node, $metaid);
+ if ($error){
+ return ($error, $metaid);
+ }
+ } elsif ($node->nodeName =~ /:data/){
+ my $dataid;
+ if (!($dataid= $node->getAttribute("id"))){ #no data id given!
+ #error
+ return ("No data ID given", "no_id");
+ }
+ my $metaref;
+ if (!($metaref= $node->getAttribute("metadataIdRef"))){ #no reference
to metadata given!
+ #error
+ return ("No reference to metadata block given", "$dataid");
+ }
+ $self->{"dataIDs"}{$dataid}{"node"} = $node;
+ $self->{"dataIDs"}{$dataid}{"metaref"} = $metaref;
+ }
+ }
+ #Check for metadatarefs in metadata tag with different subject namespaces
TODO
+
+}
+
+
+sub parse_metadata {
+ my $self = shift;
+ my ($metanode, $metaid) = @_;
+
+ if (!($metanode->hasChildNodes())){ #empty metadata
+ #error
+ return ("Empty metadata");
+ }
+ #$self->{"metadataIDs"}{$metaid}{"node"} = $metanode;
+ my $error = undef;
+
+ # a metadatablock can contain 4 different kinds of subelements: a
parameters block,
+ # a subject block, a key block, and an eventType element.
+
+ foreach my $child ($metanode->getChildNodes()){
+ if ($child->nodeName =~ /subject/) {
+ return $error if ($error = $self->parse_subject($metaid, $child));
+ }
+
+ if ($child->nodeName =~ /parameters/) {
+ return $error if ($error = $self->parse_parameters($metaid, $child));
+
+ }
+ if ($child->nodeName =~ /key/){
+ return $error if ($error = $self->parse_key($metaid, $child));
+ }
+
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =
+ $child->textContent if ($child->nodeName =~ /eventType/);
+ $self->{"metadataIDs"}{$metaid}{"eventType"} =~ s/^\s*(\S*)\s*/$1/
+ if $self->{"metadataIDs"}{$metaid}{"eventType"}; #Throw away any
whitespace and newlines
+ }
+ if(!$self->{"metadataIDs"}{$metaid}{"eventType"}){ #TODO eventtype could
be in other metadatablock! chaining....
+ #error message only, if
there is no eventtype per _chain_.
+ return ("Error parsing message: No event type given");
+ }
+ if($self->{"metadataIDs"}{$metaid}{"eventType"} eq "success.as.authn"){
#metadata from successful authentication
+ delete $self->{"metadataIDs"}{$metaid}; #throw away
+ return;
+ }
+ #return ("Error parsing message: No subject in metadata", $metaid)
if(!@sub_nodes
&&
!@key_nodes);
#TODO
+
+ if (my $metaref= $metanode->getAttribute("metadataIdRef")){
+ if($self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} eq
$self->{"metadataIDs"}{$metaref}{"subject_ns_uri"}){
+ $self->{"metadataIDs"}{$metaid}{"metaref"}=$metaref;
+ }
+ else {
+ return ("Metadata $metaid and $metaref have subjects with different
namespaces.");
+ }
+ }
+
+
+ #TODO
+ #print Dumper ($self->{"metadataIDs"});
+ return 0;
+}
+
+
+sub parse_subject {
+ my $self = shift;
+ my $metaid = shift;
+ my $sub = shift;
+
+ if(!($self->{"metadataIDs"}{$metaid}{"subject"} =
$sub->getAttribute("id"))){
+ return ("Error parsing message: No subject id given");
+ }
+ #find out namespace for subject:
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_prefix"} = $sub->prefix;
+ $self->{"metadataIDs"}{$metaid}{"subject_ns_uri"} = $sub->namespaceURI();
+
+ my $ref;
+ if ($ref = $sub->getAttribute("metadataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"metaref"} = $ref;
+ }
+ if ($ref = $sub->getAttribute("dataIdRef")){
+ $self->{"metadataIDs"}{$metaid}{"dataref"} = $ref;
+ }
+ foreach my $sub_kid ($sub->getChildNodes()){
+ if (($sub_kid->nodeName =~/endPoint/) #get endpoint(pair), get interface
etc still needed.
+ && $sub_kid->hasChildNodes()){
+ foreach my $end_point ($sub_kid->getChildNodes()){
+ if ($end_point->hasAttributes()){
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"type"} =
+ $end_point->getAttribute("type");
+ $self->{"metadataIDs"}{$metaid}{$end_point->localname}{"value"} =
+ $end_point->getAttribute("value");
+
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_parameters {
+ my $self = shift;
+ my $metaid = shift;
+ my $par = shift;
+
+ my $parId;
+ if(!($self->{"metadataIDs"}{$metaid}{"parameter_ID"} =
$par->getAttribute("id"))){
+ return ("Error parsing message: No parameters id given");
+ }
+ #find out namespace for parameters:
+ $self->{"metadataIDs"}{$metaid}{"param_ns_prefix"} = $par->prefix;
+ $self->{"metadataIDs"}{$metaid}{"param_ns_uri"} = $par->namespaceURI();
+
+ if ($par->hasChildNodes()){
+ foreach my $p ($par->getChildNodes){
+ next if $p->nodeName =~ /\#text/ || $p->nodeName =~ /\#comment/;
+ if (!($p->nodeName =~ /:parameter$/)){
+ my $err_msg = "Error parsing message: wrong element found in
parameters: "
+ . $p->nodeName;
+ return ("$err_msg");
+ }
+ if($p->hasAttributes()){
+ my $value;
+ if(!defined($value = $p->getAttribute("value"))){
+ if (!($value = $p->textContent)){
+ return ("Error parsing message: malformed parameter, "
+ . "no textContent or name/value pair found!");
+ }
+ }
+ $self->{"metadataIDs"}{$metaid}{$p->getAttribute("name")} = $value;
+ }
+ }
+ }
+ return 0;
+}
+
+sub parse_key {
+ my $self = shift;
+ my $metaid = shift;
+ my $key = shift;
+
+ if (!($key->hasChildNodes())){ #empty key!
+ #error
+ return ("Error parsing message: Empty key");
+ }
+ foreach my $sub_key ($key->getChildNodes){
+ next unless ($sub_key->nodeName =~ /parameters/);
+ foreach my $k ($sub_key->getChildNodes){
+ next unless ($k->nodeName =~ /parameter/);
+ if($k->hasAttributes()){
+ my $value;
+ if(!($value = $k->getAttribute("value"))){
+ $value = $k->textContent;
+ }
+ $self->{"metadataIDs"}{$metaid}{"key"}{$k->getAttribute("name")} =
$value;
+ }
+ }
+ }
+ return 0;
+}
+
+#add parameters from all referenced metadatablocks to corresponding datablock
+sub concatenate_params {
+ my $self = shift;
+
+ foreach my $dataid (keys %{$self->{"dataIDs"}}){
+ my $meta = $self->{"dataIDs"}{$dataid}{"metaref"};
+ my $oldmeta;
+ my $et;
+ do {
+ #check if metadataIDref points to an existing metadata element!
+ if (!defined ($self->{"metadataIDs"}{$meta})){
+ return ("Reference to unknown metadata element (metadataIdRef):
$meta", "$dataid");
+ }
+ if ($self->{"metadataIDs"}{$meta} eq "message") { #authn
+ delete $self->{"dataIDs"}{$dataid}; #throw away
+ next;
+ }
+
+ $et = $self->{"metadataIDs"}{$meta}{"eventType"}; #TODO eventtype is
not necessarily in each metadata block!
+ $self->{"dataIDs"}{$dataid}{$et}{"metaID"} = $meta;
+ foreach my $elem (keys %{$self->{"metadataIDs"}{$meta}}){
+ next if ($elem eq "subject" || $elem eq "metaref" || $elem eq
"eventType"
+ || $elem eq "type");
+ #|| $elem eq "type" || $elem eq "ns_uri" || $elem eq
"ns_prefix");
+ #if ($elem eq "eventType"){
+ # $self->{"dataIDs"}{$dataid}{"eventTypes"}{$meta} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #} else {
+ $self->{"dataIDs"}{$dataid}{$et}{$elem} =
$self->{"metadataIDs"}{$meta}{$elem};
+ #}
+ }
+ $oldmeta = $meta;
+ }
+ while defined ($meta = $self->{"metadataIDs"}{$oldmeta}{"metaref"});
+ }
+}
+
+#parse data section
+sub parse_data {
+ my $self = shift;
+ my @nodes = $self->{dom}->getElementsByTagNameNS("$ns_nmwg", "data");
+ unless (@nodes){
+ return ("Error parsing message: No data tag found", "no_id");
+ }
+ foreach my $datanode (@nodes){
+ my $dataid;
+ if (!($dataid= $datanode->getAttribute("id"))){ #no datadata id given!
+ return ("No data ID given", "no_id");
+ }
+ my $metaref = $datanode->getAttribute("metadataIdRef");
+ if (!($datanode->hasChildNodes())){ #empty data
+ return ("Empty data", $dataid);
+ }
+ my @datum_lines;
+ foreach my $datum ($datanode->getChildNodes()){
+ next unless ($datum->nodeName =~ /datum/ && $datum->hasAttributes());
+ my %line;
+ my @attributelist = $datum->attributes;
+ foreach my $a (@attributelist){
+ $line{$a->name} = $a->value;
+ }
+ push @datum_lines, \%line;
+ }
+ $self->{$dataid}->{"metaref"} = $metaref;
+ $self->{$dataid}->{"data"} =
\@datum_lines;
+ #print Dumper ($self->{$dataid});
+ }
+}
+
+
+#return result codes: e.g. error.ma.whatever/success.mp.great
+sub return_result_code {
+ my $self = shift;
+ my $result_code = shift;
+ my $description = shift;
+ my $metaid = shift;
+ my $id = shift;
+
+ if (!$id){
+ $id = "return_$metaid";
+ }
+
+ #create metadata entry with result_code
+ my $messagenode = $self->{dom}->documentElement();
+ #$messagenode->setAttribute("xmlns:result", $ns_result);
+ $messagenode->setNamespace($ns_result, "nmwgr", 0);
+ my $metanode = $self->add_attribute(parent => $messagenode, nodename =>
"metadata", id => $id);
+ my $string = $self->{dom}->toString;
+ #my $subjectnode = $self->add_attribute(parent => $messagenode, nodename
=> "subject",
+ #my $subjectnode = $self->add_attribute(parent => $metanode, nodename =>
"subject",
+ # id => "subjreturn", metadataIdRef
=> $metaid, "namespace" => $ns_result);
+ my $eventnode = $self->add_element($metanode, "eventType", $result_code);
+
+ #create data entry with description
+ my $datanode = $self->add_attribute(parent => $messagenode, nodename =>
"data",
+ id => "data_$id", metadataIdRef =>
$id);
+ my $datumnode = $self->add_element_NS($datanode, "datum", $description,
$ns_result);
+}
+
+
+sub create_metadatablock {
+ my $self = shift;
+ my %par = @_;
+
+ my $parent;
+ my $metaid;
+
+ if ($par{"parent"}){
+ $parent = $par{"parent"};
+ } else {
+ $parent = $self->{dom}->documentElement();
+ }
+
+ if ($par{"metadata_id"}){
+ $metaid = $par{"metadata_id"};
+ } else {
+ $metaid = rand;
+ }
+
+
+ my $metanode = $self->add_attribute (parent => $parent, nodename =>
"metadata",
+ id => $metaid);
+
+ if ($par{"subject"}){
+ #create subject
+ my $subjectnode = $self->add_attribute (parent => $metanode, nodename =>
"subject",
+ id => "subject-$metaid");
+
+ my $subref = $par{"subject"};
+
+ }
+
+ if ($par{"substring"}){
+ $metanode->appendWellBalancedChunk($par{substring});
+ }
+
+
+ if ($par{"eventtypes"}){
+ #create eventtypes
+ foreach my $et (@{$par{"eventtypes"}}){
+ $self->add_element($metanode, "eventType", $et);
+ }
+ }
+
+ if ($par{"parameters"}){
+ #create parameters
+ my $paramnode = $self->add_attribute (parent => $metanode, nodename =>
"parameters",
+ id => "params-$metaid");
+ foreach my $key (keys %{$par{"parameters"}}){
+ $self->add_attribute (parent => $paramnode, nodename => "parameter",
+ name => $key, value => $par{parameters}{$key});
+ }
+ }
+
+
+}
+
+sub create_subject_recursive {
+ my $self = shift;
+ my $ref = shift;
+ my $parent = shift;
+
+ my $ns = $ref->{"namespace"};
+ my $prefix = $ref->{"prefix"};
+
+
+ foreach my $k (keys %{$ref}){
+ next if $k eq "namespace";
+ next if $k eq "prefix";
+ my $val = $ref->{$k};
+ if (ref $val eq 'HASH'){
+ my $p = $self->add_attribute (nodename => $k, parent => $parent,
+ namespace => $ns, prefix => $prefix);
+ $self->create_subject_recursive (\%{$val}, $p);
+ } else {
+ if ($k eq "element"){
+ $parent->appendText($val);
+ } else {
+ $parent->setAttribute ($k, $val);
+ }
+ }
+ }
+}
+
+
+1;
Added: trunk/build/debian/NMWG-0.02/lib/NMWG.pm
===================================================================
--- trunk/build/debian/NMWG-0.02/lib/NMWG.pm (rev
0)
+++ trunk/build/debian/NMWG-0.02/lib/NMWG.pm 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,49 @@
+package NMWG;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+=head1 NAME
+
+NMWG - The great new NMWG!
+
+=head1 VERSION
+
+Version 0.02
+
+=cut
+
+our $VERSION = '0.02';
+
+=head1 SYNOPSIS
+
+=cut
+
+our $ns_nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+
+our $debug = 0;
+
+
+1;
Added: trunk/build/debian/NMWG-0.02/t/00-load.t
===================================================================
--- trunk/build/debian/NMWG-0.02/t/00-load.t (rev
0)
+++ trunk/build/debian/NMWG-0.02/t/00-load.t 2010-07-30 06:18:44 UTC (rev
616)
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'NMWG' );
+}
+
+diag( "Testing NMWG $NMWG::VERSION, Perl $], $^X" );
Added: trunk/build/debian/libnmwg-perl_0.02-0rc1.dsc
===================================================================
--- trunk/build/debian/libnmwg-perl_0.02-0rc1.dsc
(rev 0)
+++ trunk/build/debian/libnmwg-perl_0.02-0rc1.dsc 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,16 @@
+Format: 1.0
+Source: libnmwg-perl
+Binary: libnmwg-perl
+Architecture: all
+Version: 0.02-0rc1
+Maintainer: DFN Labor
<>
+Homepage: http://www.win-labor.dfn.de
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 5), libmodule-build-perl
+Build-Depends-Indep: perl (>= 5.6.10-12)
+Checksums-Sha1:
+ 2893ffbaa6b41d7f3669d023f1b195d51bde537f 8887 libnmwg-perl_0.02-0rc1.tar.gz
+Checksums-Sha256:
+ c18f9e99d26c397c4a6bc06f47b97c645c2f3c1e4f4bd324f451da2034b0e8a5 8887
libnmwg-perl_0.02-0rc1.tar.gz
+Files:
+ 582a324c7fb53bac9b1e2126671eba91 8887 libnmwg-perl_0.02-0rc1.tar.gz
Added: trunk/build/debian/libnmwg-perl_0.02-0rc1.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/build/debian/libnmwg-perl_0.02-0rc1.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/libnmwg-perl_0.02-0rc1_all.deb
===================================================================
(Binary files differ)
Property changes on: trunk/build/debian/libnmwg-perl_0.02-0rc1_all.deb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/libnmwg-perl_0.02-0rc1_i386.changes
===================================================================
--- trunk/build/debian/libnmwg-perl_0.02-0rc1_i386.changes
(rev 0)
+++ trunk/build/debian/libnmwg-perl_0.02-0rc1_i386.changes 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,28 @@
+Format: 1.8
+Date: Wed, 2 Jun 2010 12:42:47 +0200
+Source: libnmwg-perl
+Binary: libnmwg-perl
+Architecture: source all
+Version: 0.02-0rc1
+Distribution: unstable
+Urgency: low
+Maintainer: DFN Labor
<>
+Changed-By: Hakan Calim
<>
+Description:
+ libnmwg-perl - The NMWG Perl module
+Changes:
+ libnmwg-perl (0.02-0rc1) unstable; urgency=low
+ .
+ * Initial Release.
+Checksums-Sha1:
+ 702f9e50054f87ebe9ced27721d1ace8311659aa 581 libnmwg-perl_0.02-0rc1.dsc
+ 2893ffbaa6b41d7f3669d023f1b195d51bde537f 8887 libnmwg-perl_0.02-0rc1.tar.gz
+ 5131b9e825ce2cd492ba6bdd85b8e31a5a56fa4b 10334
libnmwg-perl_0.02-0rc1_all.deb
+Checksums-Sha256:
+ c54aa6c486ca12abf9493d3cf4af08fb519a9e785f7c06a23e2292686d8c7fb2 581
libnmwg-perl_0.02-0rc1.dsc
+ c18f9e99d26c397c4a6bc06f47b97c645c2f3c1e4f4bd324f451da2034b0e8a5 8887
libnmwg-perl_0.02-0rc1.tar.gz
+ 4e53b792f428f8cf078eb3aa3403a43429950d82e5a286e89dca65888cee135e 10334
libnmwg-perl_0.02-0rc1_all.deb
+Files:
+ ed6353bd14f77ce67c57a560e9680451 581 perl optional
libnmwg-perl_0.02-0rc1.dsc
+ 582a324c7fb53bac9b1e2126671eba91 8887 perl optional
libnmwg-perl_0.02-0rc1.tar.gz
+ 437379e43a5ddb35b6b15351011f6c13 10334 perl optional
libnmwg-perl_0.02-0rc1_all.deb
Added: trunk/build/debian/perfsonar-oppd-0.51/Build
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/Build
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/Build 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,57 @@
+#! /usr/bin/perl
+
+use strict;
+use Cwd;
+use File::Basename;
+use File::Spec;
+
+sub magic_number_matches {
+ return 0 unless -e '_build/magicnum';
+ local *FH;
+ open FH, '_build/magicnum' or return 0;
+ my $filenum = <FH>;
+ close FH;
+ return $filenum == 268383;
+}
+
+my $progname;
+my $orig_dir;
+BEGIN {
+ $^W = 1; # Use warnings
+ $progname = basename($0);
+ $orig_dir = Cwd::cwd();
+ my $base_dir =
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-0.51';
+ if (!magic_number_matches()) {
+ unless (chdir($base_dir)) {
+ die ("Couldn't chdir($base_dir), aborting\n");
+ }
+ unless (magic_number_matches()) {
+ die ("Configuration seems to be out of date, please re-run 'perl
Build.PL' again.\n");
+ }
+ }
+ unshift @INC,
+ (
+
+ );
+}
+
+close(*DATA) unless eof(*DATA); # ensure no open handles to this script
+
+use Module::Build;
+
+# Some platforms have problems setting $^X in shebang contexts, fix it up
here
+$^X = Module::Build->find_perl_interpreter;
+
+if (-e 'Build.PL' and not Module::Build->up_to_date('Build.PL', $progname)) {
+ warn "Warning: Build.PL has been altered. You may need to run 'perl
Build.PL' again.\n";
+}
+
+# This should have just enough arguments to be able to bootstrap the rest.
+my $build = Module::Build->resume (
+ properties => {
+ config_dir => '_build',
+ orig_dir => $orig_dir,
+ },
+);
+
+$build->dispatch;
Property changes on: trunk/build/debian/perfsonar-oppd-0.51/Build
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/Build.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/Build.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/Build.PL 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,63 @@
+use strict;
+use warnings;
+use Module::Build;
+use Data::Dumper;
+
+my $builder = Module::Build->new(
+ module_name => 'perfSONAR',
+ dist_name => 'perfsonar-oppd',
+ license => 'apache',
+ dist_author => 'DFN-Labor
<>',
+ dist_abstract => 'perl perfSONAR implementation',
+ dist_version_from => 'lib/perfSONAR.pm',
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ requires => {
+ 'Config::General' => 0,
+ 'HTTP::Daemon' => 0,
+ 'HTTP::Request' => 0,
+ 'HTTP::Response' => 0,
+ 'IPC::Shareable' => 0,
+ 'LWP::UserAgent' => 0,
+ 'Log::Dispatch' => '>= 2.11',
+ 'Log::Dispatch::File' => 0,
+ 'Log::Dispatch::Screen' => 0,
+ 'Log::Dispatch::Syslog' => 0,
+ 'NMWG' => '>= 0.02',
+ 'NMWG::Message' => 0,
+ 'URI' => '>= 1.30',
+ 'XML::LibXML' => 0,
+ 'XML::LibXML::NodeList' => 0,
+ },
+ etc_files => {
+ 'etc/oppd.conf.example' => 'etc/oppd.conf',
+ 'etc/Auth_request.xml' => 'etc/oppd.d/Auth_request.xml',
+ 'etc/Auth_response.xml' => 'etc/oppd.d/Auth_response.xml',
+ 'etc/LS_deregister.xml' => 'etc/oppd.d/LS_deregister.xml',
+ 'etc/LS_register.xml' => 'etc/oppd.d/LS_register.xml',
+ 'etc/LS_keepalive.xml' => 'etc/oppd.d/LS_keepalive.xml',
+ 'etc/LS_KeyRequest.xml' => 'etc/oppd.d/LS_KeyRequest.xml',
+ },
+ init_files => {
+ 'etc/oppd.init.debian' => 'init/init.d/oppd',
+ },
+ sysconfig_files => {
+ 'etc/oppd.default.debian' => 'init/default/oppd',
+ },
+ add_to_cleanup => [ 'perfSONAR-*' ],
+ create_makefile_pl => 'small',
+);
+
+my $install_base = $builder->install_base();
+if ($install_base){
+ $builder->install_path('etc' => "$install_base/etc");
+}
+$builder->install_path('etc' => 'etc');
+$builder->install_path('init' => "/etc");
+
+$builder->add_build_element('etc');
+$builder->add_build_element('init');
+$builder->add_build_element('sysconfig');
+$builder->install_base_relpaths('lib' => 'lib');
+$builder->create_build_script();
Property changes on: trunk/build/debian/perfsonar-oppd-0.51/Build.PL
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/Changes
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/Changes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/Changes 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,14 @@
+Changelog for release 0.50
+
+ - changed name to oppd (= open perl perfSONAR daemon)
+ - enhanced LS communication: Keepalive and Key Request
+ added, moved LS handling code from daemon to own
+ module
+
+
+Changelog for release 0.41
+
+New features:
+ - some bug fixes and better LS registration handling
+ - selftest funcitonality for status monitoring of service
+ - enhancement for logging to external syslog server
Added: trunk/build/debian/perfsonar-oppd-0.51/MANIFEST
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/MANIFEST
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/MANIFEST 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,35 @@
+bin/oppd.pl
+Build.PL
+Changes
+etc/Auth_request.xml
+etc/Auth_response.xml
+etc/LS_deregister.xml
+etc/LS_keepalive.xml
+etc/LS_KeyRequest.xml
+etc/LS_register.xml
+etc/oppd.conf
+etc/oppd.conf.example
+etc/oppd.init.debian
+etc/oppd.default.debian
+lib/perfSONAR.pm
+lib/perfSONAR/Auth.pm
+lib/perfSONAR/Client/LS.pm
+lib/perfSONAR/Echo.pm
+lib/perfSONAR/MP.pm
+lib/perfSONAR/SOAP.pm
+lib/perfSONAR/SOAP/Fault.pm
+lib/perfSONAR/SOAP/Fault_v1_1.pm
+lib/perfSONAR/SOAP/Fault_v1_2.pm
+lib/perfSONAR/SOAP/HTTP/Request.pm
+lib/perfSONAR/SOAP/HTTP/Response.pm
+lib/perfSONAR/SOAP/HTTP/UserAgent.pm
+lib/perfSONAR/SOAP/Message.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+perfsonar-oppd_0.51-1.dsc
+perfsonar-oppd_0.51-1.tar.gz
+README
+t/00-load.t
+t/perfSONAR-001-SOAP-Message.t
+t/perfSONAR-002-Core.t
Added: trunk/build/debian/perfsonar-oppd-0.51/META.yml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/META.yml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/META.yml 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,60 @@
+---
+name: perfsonar-oppd
+version: 0.51
+author:
+ - 'DFN-Labor
<>'
+abstract: perl perfSONAR implementation
+license: apache
+resources:
+ license: http://apache.org/licenses/LICENSE-2.0
+requires:
+ Config::General: 0
+ HTTP::Daemon: 0
+ HTTP::Request: 0
+ HTTP::Response: 0
+ IPC::Shareable: 0
+ LWP::UserAgent: 0
+ Log::Dispatch: '>= 2.11'
+ Log::Dispatch::File: 0
+ Log::Dispatch::Screen: 0
+ Log::Dispatch::Syslog: 0
+ NMWG: '>= 0.02'
+ NMWG::Message: 0
+ URI: '>= 1.30'
+ XML::LibXML: 0
+ XML::LibXML::NodeList: 0
+build_requires:
+ Test::More: 0
+provides:
+ perfSONAR:
+ file: lib/perfSONAR.pm
+ version: 0.51
+ perfSONAR::Auth:
+ file: lib/perfSONAR/Auth.pm
+ perfSONAR::Client::LS:
+ file: lib/perfSONAR/Client/LS.pm
+ version: 0.1
+ perfSONAR::Echo:
+ file: lib/perfSONAR/Echo.pm
+ perfSONAR::MP:
+ file: lib/perfSONAR/MP.pm
+ perfSONAR::SOAP:
+ file: lib/perfSONAR/SOAP.pm
+ perfSONAR::SOAP::Fault:
+ file: lib/perfSONAR/SOAP/Fault.pm
+ perfSONAR::SOAP::Fault_v1_1:
+ file: lib/perfSONAR/SOAP/Fault_v1_1.pm
+ perfSONAR::SOAP::Fault_v1_2:
+ file: lib/perfSONAR/SOAP/Fault_v1_2.pm
+ perfSONAR::SOAP::HTTP::Request:
+ file: lib/perfSONAR/SOAP/HTTP/Request.pm
+ perfSONAR::SOAP::HTTP::Response:
+ file: lib/perfSONAR/SOAP/HTTP/Response.pm
+ perfSONAR::SOAP::HTTP::UserAgent:
+ file: lib/perfSONAR/SOAP/HTTP/UserAgent.pm
+ perfSONAR::SOAP::Message:
+ file: lib/perfSONAR/SOAP/Message.pm
+generated_by: Module::Build version 0.280801
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: trunk/build/debian/perfsonar-oppd-0.51/Makefile.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/Makefile.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/Makefile.PL 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,6 @@
+# Note: this file was auto-generated by Module::Build::Compat version
0.2808_01
+ use Module::Build::Compat 0.02;
+
+ Module::Build::Compat->run_build_pl(args =>
\@ARGV);
+ require Module::Build;
+ Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Added: trunk/build/debian/perfsonar-oppd-0.51/README
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/README
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/README 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,109 @@
+oppd - open perl perfSONAR daemon
+---------------------------------
+
+Version: 0.51
+
+The oppd package contains a perl daemon script to serve as container for
+perfSONAR services. The services itself are implemented as perl module
+plugins and can be added individually. The oppd daemon needs several
+perl modules (available via e.g. CPAN) and the perl-NMWG library to run.
+
+For more information about perfSONAR, see www.perfsonar.net
+For more information about CPAN, see www.cpan.org
+
+1. Preparation:
+---------------
+
+Please make sure you have all dependencies installed properly before
+proceeding with the installation of oppd.
+
+Perl modules dependency list:
+-----------------------------
+perl version 5.8.0 or higher
+perl(Config::General)
+perl(HTTP::Daemon)
+perl(HTTP::Request)
+perl(HTTP::Response)
+perl(IPC::Shareable)
+perl(Log::Dispatch)
+perl(Log::Dispatch::File)
+perl(Log::Dispatch::Screen)
+perl(Log::Dispatch::Syslog)
+perl(LWP::UserAgent)
+perl(NMWG) >= 0.02
+perl(NMWG::Message)
+perl(URI)
+perl(XML::LibXML)
+perl(XML::LibXML::NodeList)
+
+As it is not recommended to run the daemon as root, you should create
+a user "perfsonar". The init script included in this package starts
+the daemon automatically as perfsonar user.
+
+For Linux use the following commands:
+/usr/sbin/groupadd perfsonar
+/usr/sbin/useradd -g perfsonar -s /sbin/nologin -c "perfsonar user" -d /
perfsonar
+
+
+2. Installation:
+----------------
+
+Change to oppd-0.51 directory and type the following commands:
+perl Build.PL --install_base=/usr/lib/perfsonar/services/oppd
+./Build install
+chown perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+
+The package provides a (Linux) init script which you can use to automate
+service start/stop. This script is tested under redhat and may need
+adjustments to work with other Linux flavours.
+If you are using the provided init script, you can add your service to your
+system startup (Linux):
+/sbin/chkconfig --add oppd
+
+You should also add some useful links:
+ln -s /usr/lib/perfsonar/services/oppd/etc/oppd.conf /etc/oppd.conf
+ln -s /usr/lib/perfsonar/services/oppd/doc /usr/share/doc/oppd-0.51/
+
+
+3. Run perfSONAR services:
+--------------------------
+
+To run perfSONAR services, you first have to install service modules, e.g.
+the BWCTL MP service module. When you have done that, you have to add a
+service entry, or a include line to a service configuration to the
+/etc/oppd.conf file.
+
+Then start the service via the startup script:
+oppd start
+
+or by hand:
+/usr/lib/perfsonar/services/oppd/bin/oppd.pl
+
+For start options and configuration file format please refer to the manual
+pages.
+
+
+4. Deinstallation:
+------------------
+
+First make sure that oppd.pl isn't running anymore.
+If you have added oppd.pl via chkconfig to your system, delete it:
+/sbin/chkconfig --del oppd
+
+Remove the links:
+rm -f /etc/oppd.conf
+rm -f /usr/share/doc/oppd-0.51/
+
+Delete the software completely:
+rm -rf usr/lib/perfsonar/services/oppd/
+
+Note that this will also delete any service plugins you might have installed
+additionally.
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008, 2009 DFN-Labor
+
+This program is released under the following license: bsd
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/auto_features
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/auto_features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/auto_features 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/build_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/build_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/build_params 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,308 @@
+do{ my $x = [
+ {
+ 'ARGV' => []
+ },
+ {},
+ {
+ 'verbose' => undef,
+ 'PL_files' => undef,
+ 'pollute' => undef,
+ 'bindoc_dirs' => [
+ 'blib/script'
+ ],
+ 'conflicts' => {},
+ 'recommends' => {},
+ 'scripts' => undef,
+ 'dist_version' => bless( {
+ 'original' => '0.51',
+ 'version' => [
+ 0,
+ 510
+ ]
+ }, 'Module::Build::Version' ),
+ 'pod_files' => undef,
+ 'config_dir' => '_build',
+ 'recurse_into' => [],
+ 'build_bat' => 0,
+ 'extra_linker_flags' => [],
+ 'build_class' => 'Module::Build',
+ 'prereq_action_types' => [
+ 'requires',
+ 'build_requires',
+ 'conflicts',
+ 'recommends'
+ ],
+ 'base_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-0.51',
+ 'allow_mb_mismatch' => 0,
+ 'xs_files' => undef,
+ 'destdir' => undef,
+ 'metafile' => 'META.yml',
+ 'mb_version' => '0.280801',
+ 'has_config_data' => undef,
+ 'dist_name' => 'perfsonar-oppd',
+ 'install_base' => undef,
+ 'module_name' => 'perfSONAR',
+ 'recursive_test_files' => undef,
+ 'init_files' => {
+ 'etc/oppd.init.debian' => 'init/init.d/oppd'
+ },
+ 'libdoc_dirs' => [
+ 'blib/lib',
+ 'blib/arch'
+ ],
+ 'perl' => '/usr/bin/perl',
+ 'dist_author' => [
+ 'DFN-Labor
<>'
+ ],
+ 'use_rcfile' => 1,
+ 'configure_requires' => {},
+ 'test_files' => undef,
+ 'dist_abstract' => 'perl perfSONAR implementation',
+ 'create_readme' => undef,
+ 'prefix_relpaths' => {
+ 'core' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ },
+ 'site' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ 'site_perl',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5',
+ 'site_perl'
+ ]
+ },
+ 'vendor' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ }
+ },
+ 'meta_merge' => {},
+ 'get_options' => {},
+ 'dist_version_from' => 'lib/perfSONAR.pm',
+ 'debugger' => undef,
+ 'html_css' => '',
+ 'build_elements' => [
+ 'PL',
+ 'support',
+ 'pm',
+ 'xs',
+ 'pod',
+ 'script',
+ 'etc',
+ 'init',
+ 'sysconfig'
+ ],
+ 'orig_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-0.51',
+ 'include_dirs' => [],
+ 'installdirs' => 'site',
+ 'create_makefile_pl' => 'small',
+ 'magic_number' => undef,
+ 'sysconfig_files' => {
+ 'etc/oppd.default.debian' =>
'init/default/oppd'
+ },
+ 'install_sets' => {
+ 'core' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl/5.10',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl/5.10'
+ },
+ 'site' => {
+ 'libdoc' => '/usr/local/man/man3',
+ 'script' => '/usr/local/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/local/man/man1',
+ 'bin' => '/usr/local/bin',
+ 'arch' =>
'/usr/local/lib/perl/5.10.0',
+ 'binhtml' => undef,
+ 'lib' =>
'/usr/local/share/perl/5.10.0'
+ },
+ 'vendor' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl5',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl5'
+ }
+ },
+ 'install_base_relpaths' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib'
+ ]
+ },
+ 'meta_add' => {},
+ 'create_packlist' => 1,
+ 'requires' => {
+ 'XML::LibXML::NodeList' => 0,
+ 'URI' => '>= 1.30',
+ 'NMWG' => '>= 0.02',
+ 'Log::Dispatch::File' => 0,
+ 'LWP::UserAgent' => 0,
+ 'HTTP::Response' => 0,
+ 'Config::General' => 0,
+ 'XML::LibXML' => 0,
+ 'Log::Dispatch::Syslog' => 0,
+ 'Log::Dispatch' => '>= 2.11',
+ 'Log::Dispatch::Screen' => 0,
+ 'HTTP::Daemon' => 0,
+ 'IPC::Shareable' => 0,
+ 'NMWG::Message' => 0,
+ 'HTTP::Request' => 0
+ },
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'init' => '/etc',
+ 'etc' => 'etc',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib'
+ },
+ 'etc_files' => {
+ 'etc/LS_register.xml' =>
'etc/oppd.d/LS_register.xml',
+ 'etc/Auth_response.xml' =>
'etc/oppd.d/Auth_response.xml',
+ 'etc/oppd.conf.example' => 'etc/oppd.conf',
+ 'etc/LS_keepalive.xml' =>
'etc/oppd.d/LS_keepalive.xml',
+ 'etc/LS_KeyRequest.xml' =>
'etc/oppd.d/LS_KeyRequest.xml',
+ 'etc/LS_deregister.xml' =>
'etc/oppd.d/LS_deregister.xml',
+ 'etc/Auth_request.xml' =>
'etc/oppd.d/Auth_request.xml'
+ },
+ 'pm_files' => undef,
+ 'quiet' => undef,
+ 'extra_compiler_flags' => [],
+ 'script_files' => undef,
+ 'build_script' => 'Build',
+ 'original_prefix' => {
+ 'core' => '/usr',
+ 'site' => '/usr/local',
+ 'vendor' => '/usr'
+ },
+ 'c_source' => undef,
+ 'license' => 'apache',
+ 'autosplit' => undef,
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'config' => undef,
+ 'blib' => 'blib',
+ 'prefix' => undef
+ }
+ ];
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/cleanup
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/cleanup
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/cleanup 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,5 @@
+do{ my $x = {
+ 'perfSONAR-*' => 1,
+ 'blib' => 1
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/config_data
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/config_data
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/config_data 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/features
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/features 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/magicnum
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/magicnum
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/magicnum 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+268383
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/notes
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/notes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/notes 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/prereqs
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/prereqs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/prereqs 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,25 @@
+do{ my $x = {
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'conflicts' => {},
+ 'requires' => {
+ 'XML::LibXML::NodeList' => 0,
+ 'URI' => '>= 1.30',
+ 'NMWG' => '>= 0.02',
+ 'Log::Dispatch::File' => 0,
+ 'LWP::UserAgent' => 0,
+ 'HTTP::Response' => 0,
+ 'Config::General' => 0,
+ 'XML::LibXML' => 0,
+ 'Log::Dispatch::Syslog' => 0,
+ 'Log::Dispatch' => '>= 2.11',
+ 'Log::Dispatch::Screen' => 0,
+ 'HTTP::Daemon' => 0,
+ 'IPC::Shareable' => 0,
+ 'NMWG::Message' => 0,
+ 'HTTP::Request' => 0
+ },
+ 'recommends' => {}
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/_build/runtime_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/_build/runtime_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/_build/runtime_params
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+do{ my $x = {
+ 'create_packlist' => '0',
+ 'destdir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd',
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib',
+ 'etc' => '/etc'
+ }
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-0.51/bin/oppd.pl
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/bin/oppd.pl
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/bin/oppd.pl 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,1447 @@
+#!/usr/bin/perl
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# See embedded POD below for further information
+
+# TODO
+# - Check config statements (die if multiple logfile statements in config
etc.)
+# - Detect and remove orphaned PID file! Or should it be done in init
scripts?
+# - LS registration options
+# - ls_register and ls_url should be somehow merged and made configurable
for
+# every service individually
+# - Use a decent default for the hostname sent to the LS
+# - hostname, organization and contact should perhaps get an ls_ prefix?
+# - Fail like on missing ls options like on missing ssl options
+# - AS options
+# - auth and as_url should be somehow merged and made configurable for
+# every service individually
+# - Should there be a timeout for processing a request?
+# - Catch more signals? Set to IGNORE or treat them like TERM/INT?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+# Commen modules for all Hades/oppd daemons:
+use locale;
+use POSIX qw(setsid setpgid :sys_wait_h);
+use Log::Dispatch;
+use Log::Dispatch::File;
+use Log::Dispatch::Syslog;
+use Log::Dispatch::Screen;
+use Getopt::Long 2.32 qw(:config auto_help auto_version bundling);
+use Pod::Usage;
+use Config::General;
+# DateTime not needed by now, but this would be necessary, because Hades.pm
is
+# NOT loaded.
+#use DateTime;
+#use DateTime::Locale;
+#BEGIN {
+# if (DateTime::Locale->load(setlocale(LC_TIME))) {
+# DateTime->DefaultLocale(setlocale(LC_TIME));
+# }
+#}
+
+# Modules for this daemon:
+use File::Spec;
+use Socket;
+use HTTP::Daemon;
+#use HTTP::Daemon::SSL qw(debug3);
+#$Net::SSLeay::trace = 2;
+use HTTP::Daemon::SSL;
+use HTTP::Response;
+
+use NMWG;
+use perfSONAR;
+use perfSONAR::Echo;
+use perfSONAR::SOAP::Message;
+use perfSONAR::Client::LS;
+
+use vars qw($VERSION);
+$VERSION = 0.51;
+
+#
+# Important variables that should be available and initialised before the
+# (possible) execution of the END block
+#
+my (
+ $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ $shutting_down
+);
+INIT {
+ $proc_type = "main"; # Some code is executed by all childrens that fork
and
+ # do not exec afterwards. So we have to know
+ # what to do exactly.
+ # See e.g. END block and signal handlers for possible
+ # values.
+ $pidfile_ok = 0; # Care about existing pidfile in END
+ $log = Log::Dispatch->new();
+ # We also need the Log::Dispatch object for option verification quite
early
+ $log_prefix = ""; # Prepended to log message if set. This is intended for
+ # child processes and should not be "missused"!
+ $shutdown_gracefully = 0; # END called without signal is like SIGTERM !!
+ #TODO Use another default?
+ $shutting_down = 0; # This is set directly after entering the END block.
+ # Can be used to determine whether the process is
+ # going down at the moment. Important e.g. in signal
+ # handlers!
+}
+
+
+#
+# Parse Configuration (commandline and file)
+#
+
+my (
+ $configfile, $noconfig,
+ $detach, $syslog, $logfile, $nologfile, $pidfile, $nopidfile,
+ $loglevel, $verbose, $syslog_host, $syslog_ident, $syslog_facility,
+ $ls_register, $keepalive, $max_proc,
+ @ls_url, $auth, $as_url,
+ $hostname, $port, $organization, $contact,
+ $ssl, $ssl_cert_file, $ssl_key_file, $ssl_ca_file, $ssl_ca_path,
+ $ssl_verify_client, $ssl_trusted_webserver_cn,
+);
+
+my %services;
+my %messages;
+my %lsKeys;
+
+GetOptions(
+ "config=s" => \$configfile,
+ "noconfig" => \$noconfig,
+ "detach|D!" => \$detach,
+ "logfile:s" => \$logfile,
+ "nologfile" => \$nologfile,
+ "pidfile:s" => \$pidfile,
+ "nopidfile" => \$nopidfile,
+ "syslog!" => \$syslog,
+ "syslog-host=s" => \$syslog_host,
+ "syslog-ident=s" => \$syslog_ident,
+ "syslog-facility=s" => \$syslog_facility,
+ "loglevel=s" => \$loglevel,
+ "verbose|v" => \$verbose,
+ "register!" => \$ls_register,
+ "keepalive=i" => \$keepalive,
+ "max_proc=i" => \$max_proc,
+ "port=s" => \$port,
+ "auth!" => \$auth,
+ "as_url=s" => \$as_url,
+ "ssl!" => \$ssl,
+ "ssl-cert-file=s" => \$ssl_cert_file,
+ "ssl-key-file=s" => \$ssl_key_file,
+ "ssl-ca-file=s" => \$ssl_ca_file,
+ "ssl-ca-path=s" => \$ssl_ca_path,
+ "ssl-verify-client!" => \$ssl_verify_client,
+ "ssl-trusted-webserver-cn=s" => \$ssl_trusted_webserver_cn,
+) or pod2usage(2);
+
+# Determine and load config file
+my %Config = ();
+my $Config;
+if ($noconfig) {
+ $configfile = undef;
+} else {
+ #$configfile ||= "$FindBin::RealBin/../etc/oppd.conf";
+ $configfile ||= "/etc/oppd.conf";
+ $Config = Config::General->new(
+ -ConfigFile => $configfile,
+ -ApacheCompatible => 1,
+ #-AllowMultiOptions => 'no', # enable for EGEE because no LS is used
+ -AutoTrue => 1, # Could bring in some trouble, but it is really nice
;)
+ -IncludeGlob => 1, # We want to allow something like include
oppd.d/*.conf
+ -IncludeRelative => 1, # Especially useful with -IncludeGlob
+ -CComments => 0, # Parsing is obviously broken in 2.36!
+ # Comments are found everywhere...
+ );
+ %Config = $Config->getall;
+}
+
+
+#
+# Calculate options
+# First not "undef" value is used.
+# Order: command line, config file, default
+#
+$detach = get_opt($detach, $Config{detach}, 1);
+$nologfile = get_opt($nologfile, 0); # No nologfile entry in config file!
+if ($nologfile) {
+ $logfile = undef;
+} else {
+ $logfile = get_opt($logfile, $Config{logfile}, 0);
+ if (!$logfile && $logfile ne "") {
+ # logfile disabled
+ $logfile = undef;
+ } elsif ($logfile eq "1" || $logfile eq "") {
+ # logfile enabled in configuration file or via --logfile without value
+ $logfile = "/var/log/oppd.log";
+ }
+}
+$nopidfile = get_opt($nopidfile, 0); # No nopidfile entry in config file!
+if ($nopidfile) {
+ $pidfile = undef;
+} else {
+ $pidfile = get_opt($pidfile, $Config{pidfile}, 1);
+ if (!$pidfile && $pidfile ne "") {
+ # pidfile disabled
+ $pidfile = undef;
+ } elsif ($pidfile eq "1" || $pidfile eq "") {
+ # pidfile enabled in configuration file or via --pidfile without value
+ $pidfile = "/var/run/oppd.pid";
+ }
+}
+$syslog = get_opt($syslog, $Config{syslog}, 0);
+$syslog_host = get_opt($syslog_host, $Config{'syslog-host'}, "");
+$syslog_ident =
+ get_opt($syslog_ident, $Config{'syslog-ident'}, "oppd");
+$syslog_facility =
+ get_opt($syslog_facility, $Config{'syslog-facility'}, "daemon");
+$loglevel = get_opt($loglevel, $Config{loglevel}, "notice");
+$verbose = get_opt($verbose, 0); # No verbose entry in config file!
+if ($verbose) {
+ $loglevel = "info";
+} else {
+ pod2usage( { -message => "Invalid log level: $loglevel",
+ -exitval => 2 } ) unless $log->level_is_valid($loglevel);
+}
+#$ls_url = get_opt($ls_url, $Config{ls_url}, "");
+#LS URL can be one or more, take care of that:
+my $ls_opt = $Config{ls_url};
+if(ref($ls_opt) eq "ARRAY"){
+ @ls_url = @{$ls_opt};
+} else {
+ @ls_url = ($ls_opt);
+}
+$ls_register = get_opt($ls_register, $Config{ls_register}, 0);
+$keepalive = get_opt($keepalive, $Config{keepalive}, 3600);
+$max_proc = get_opt($max_proc, $Config{max_proc}, 5);
+$hostname = get_opt($hostname, $Config{hostname}, 0);
+$port = get_opt($port, $Config{port}, 8090);
+$organization = get_opt($organization, $Config{organization}, 0);
+$contact = get_opt($contact, $Config{contact}, 0);
+$auth = get_opt($auth, $Config{auth}, 0);
+$as_url = get_opt($as_url, $Config{as_url}, "");
+$ssl = get_opt($ssl, $Config{ssl}, 0);
+$ssl_cert_file = get_opt($ssl_cert_file, $Config{ssl_cert_file}, "");
+$ssl_key_file = get_opt($ssl_key_file, $Config{ssl_key_file}, "");
+$ssl_ca_file = get_opt($ssl_ca_file, $Config{ssl_ca_file}, "");
+$ssl_ca_path = get_opt($ssl_ca_path, $Config{ssl_ca_path}, "");
+$ssl_verify_client =
+ get_opt($ssl_verify_client, $Config{ssl_verify_client}, 1);
+$ssl_trusted_webserver_cn =
+ get_opt($ssl_trusted_webserver_cn, $Config{ssl_trusted_webserver_cn}, "");
+
+#TODO The following parameters need to be configurable by the user or changed
+my $max_conn = $max_proc;
+my $conn_timeout = 30;
+my $gracetime = 30; # Really usefull as a parameter?
+#/TODO
+
+if ($ssl) {
+ # We don't want defaults for the SSL related files, but warn instead that
+ # something is wrong.
+ # We also need to care at least whether $ssl_ca_path really exists, because
+ # the module will only spit out a useless warning and then oppd will die.
+ # Therefore you can find a lot of file test operators below...
+ unless ($ssl_cert_file) {
+ pod2usage(
+ "No SSL certificate specified. Use --ssl-cert-file or edit config
file."
+ );
+ }
+ unless (-f $ssl_cert_file) {
+ die "SSL certificate ($ssl_cert_file) not found\n";
+ }
+ unless(-r _) {
+ die "SSL certificate ($ssl_cert_file) not readable\n";
+ }
+ unless ($ssl_key_file) {
+ pod2usage(
+ "No SSL key specified. Use --ssl-key-file or edit config file."
+ );
+ }
+ unless (-f $ssl_key_file) {
+ die "SSL key file ($ssl_key_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL key file ($ssl_key_file) not readable\n";
+ }
+ unless ($ssl_ca_file || $ssl_ca_path || !$ssl_verify_client) {
+ pod2usage(
+ "No client certificate specified.\n" .
+ "Use --ssl-ca-file, --ssl-ca-path, or edit config file.\n" .
+ "If you know what you are doing you can also disable client
authentication\n" .
+ "by using --no-ssl-verify-client or editing config file
appropriately.\n"
+ );
+ }
+ if ($ssl_verify_client) {
+ if ($ssl_ca_file) {
+ unless (-f $ssl_ca_file) {
+ die "SSL client certificate file ($ssl_ca_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate file ($ssl_ca_file) not readable\n";
+ }
+ }
+ if ($ssl_ca_path) {
+ unless (-d $ssl_ca_path) {
+ die "SSL client certificate path ($ssl_ca_path) not a directory\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate path ($ssl_ca_path) not readable\n";
+ }
+ }
+ }
+}
+
+unless (
+ defined($Config{service}) && ref($Config{service}) eq "HASH"
+ && %{$Config{service}}
+) {
+ pod2usage(
+ "No services specified in config file"
+ );
+}
+%services = %{$Config{service}};
+
+
+#
+# Start logging ($log already initialised above)
+#
+
+$perfSONAR::log = $log;
+
+if (defined $logfile) {
+
+ #check if $logfile is an absolute path, and add current path if not
+ if (!File::Spec->file_name_is_absolute($logfile)){
+ $logfile = File::Spec->rel2abs($logfile);
+ }
+
+ eval {
+ use locale;
+ use POSIX qw(locale_h strftime);
+ # "use locale", POSIX::strftime and localtime faster than DateTime
+ # and this has quite an impact on debug loging. Detected via SmokePing:
+ # http://perfsonar.acad.bg/smokeping
+ #use DateTime;
+ #use DateTime::Locale;
+ #BEGIN {
+ # if (DateTime::Locale->load(setlocale(LC_TIME))) {
+ # DateTime->DefaultLocale(setlocale(LC_TIME));
+ # }
+ #}
+ $log->add(
+ Log::Dispatch::File->new(
+ name => 'file',
+ min_level => $loglevel,
+ filename => $logfile,
+ mode => 'append', close_after_write => 1, autoflush => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = strftime("%FT%T",localtime) . " $p{level}
$p{message}";
+ #DateTime->now(time_zone=>"local")->strftime("%c") .
+ return "$p{message}\n";
+ },
+ )
+ );
+ };
+ die "Cannot write to log file '$logfile':
$@\n"
if $@;
+}
+if ($syslog) {
+ eval {
+ my $syslog_socket = 'unix';
+ if ($syslog_host) {
+ $Sys::Syslog::host = $syslog_host;
+ $syslog_socket = 'inet';
+ }
+ $log->add(
+ Log::Dispatch::Syslog->new(
+ name => 'syslog',
+ min_level => $loglevel,
+ ident => "$syslog_ident",
+ facility => "$syslog_facility",
+ socket => "$syslog_socket",
+ logopt => "ndelay",
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ #TODO Not nice! How can we change this?
+ # callback for SD stuff
+ if ($p{service}) {
+ $p{service} =~ s/\//\_/g;
+ $p{service} .= ".";
+ } else {
+ $p{service} = "";
+ }
+ $p{message} = "OPPD." . $p{service} . uc($p{level}) . "%
$p{message}";
+ #/TODO
+ return "$p{message}\n";
+ },
+ #mode => 'append', close_after_write => 0, autoflush => 1,
+ )
+ );
+ };
+ die "Cannot write to syslog:
$@\n"
if $@;
+}
+unless ($detach) {
+ $log->add(
+ Log::Dispatch::Screen->new(
+ name => 'screen',
+ min_level => $loglevel,
+ stderr => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = "$p{level}: $p{message}";
+ return "$p{message}\n";
+ },
+ )
+ );
+}
+
+# More flexible die:
+# Put error into Log and afterwards die with same message.
+# Also handy, because in the following code $@ is undef in die call:
+# $log->error($@); die $@;
+$SIG{__DIE__} = sub {
+ die @_ if $^S; # Ignore dies from evals
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->error($logmsg) if defined $log &&
UNIVERSAL::isa($log,'Log::Dispatch');
+ die @_;
+};
+
+# More flexible warn:
+# Put error into Log and afterwards warn with same message.
+$SIG{__WARN__} = sub {
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->warning($logmsg)
+ if defined $log && UNIVERSAL::isa($log,'Log::Dispatch');
+ warn @_;
+};
+
+
+#
+# Load Authentication module for AA
+#
+
+if ($auth){
+ if ($as_url eq ""){
+ die ("Authentication not possible: variable $as_url not set!\n");
+ }
+ eval require perfSONAR::Auth;
+ if ($@){
+ die ("Error loading module perfSONAR::Auth:
$@\n");
+ }
+}
+
+#
+# Load data modules for services
+#
+
+foreach my $service (keys %services){
+ my $module = $services{$service}->{module};
+ eval "require perfSONAR::$module";
+ if ($@){
+ die "Error loading module perfSONAR::$module:
$@\n";
+ }
+ $services{$service}->{handler} =
+ "perfSONAR::$module"->new(%{$services{$service}->{module_param}});
+}
+
+# Set modules in dispatch module/class:
+%perfSONAR::services = %services;
+
+#
+# Daemonize
+#
+
+#First check pidfile path to be absolute!
+if ($pidfile){
+ if (!File::Spec->file_name_is_absolute($pidfile)){
+ $pidfile = File::Spec->rel2abs($pidfile);
+ }
+}
+
+if ($detach) {
+ # Fork once, and let the parent exit.
+ my $pid = fork;
+ if ($pid) { $proc_type = "dummy"; exit; }
+ defined($pid) or die "Could not fork: $!\n";
+
+ # Dissociate from the controlling terminal that started us and stop being
+ # part of whatever process group we had been a member of.
+ setsid() or die "Cannot start a new session: $!\n";
+
+ # In Proc::Daemon there is a second fork executed with the following
comment:
+ # "Forks another child process and exits first child. This prevents the
+ # potential of acquiring a controlling terminal."
+ # This is nowhere else mentioned! Neither in Perl nor standard UNIX
+ # documentation.
+ # IMPORTANT: If you put a second fork here, the process group is most
likely
+ # not correct for sending signals e.g. in the END block!
+
+ # chdir and set umask
+ chdir '/' or die "Cannot chdir to '/': $!\n";
+ #umask 0;
+
+ setup_pidfile() if defined $pidfile;
+ # Do it before closing file handles! We need the error messages!
+
+ # Close default file handles
+ close STDIN or die "Could not close STDIN: $!\n";
+ close STDOUT or die "Could not close STDOUT: $!\n";
+ close STDERR or die "Could not close STDERR: $!\n";
+ # Reopen stderr, stdout, stdin to /dev/null
+ open(STDIN, "</dev/null");
+ open(STDOUT, ">/dev/null");
+ open(STDERR, ">/dev/null");
+} else {
+ setpgid(0,0) or die "Cannot set process group id: $!\n";
+ setup_pidfile() if defined $pidfile;
+}
+
+#
+# Signal handlers
+#
+
+# Note: Signal handler are also called by children, if not changed after
fork!
+
+# die on typical signals
+$SIG{INT} = $SIG{TERM} = sub {
+ $log->notice("Caught SIG$_[0] - initiating shutdown");
+ $shutdown_gracefully = 0;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR1} = sub {
+ # Gracefull shutdown with timeout
+ $log->notice("Caught SIGUSR1 - initiating gracefull shutdown");
+ $shutdown_gracefully = $gracetime;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR2} = sub {
+ # Gracefull shutdown WITHOUT timeout -> Possibly blocking forever!
+ $log->notice("Caught SIGUSR2 - initiating gracefull shutdown");
+ $shutdown_gracefully = -1;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{HUP} = sub {
+ $log->warning("Caught SIGHUP - NO RELOAD SUPPORTED AT THE MOMENT");
+ #TODO
+};
+$SIG{PIPE} = 'IGNORE';
+$SIG{TSTP} = $SIG{TTOU} = $SIG{TTIN} = 'IGNORE'; # ignore tty signals
+$SIG{CHLD} = \&REAPER; # Care about connection processes. See below.
+
+#
+# Inform that everything looks good
+#
+
+$log->notice("oppd service started");
+$log->info("available services: " . join(",", sort keys(%services)));
+$log->info("PID $$ written to $pidfile") if defined $pidfile;
+
+#
+# Start "daemon", the network side of the job ;-)
+#
+
+#TODO: enable tracing output for our own SOAP implementation
+# Use Log::Dispatcher for debug/error handling somehow?
+
+my $http_daemon;
+my $errno = 0;
+my %server_options = (
+ LocalPort => $port, ReuseAddr => 1
+);
+if ($ssl){
+ my %ssl_options = (
+ SSL_verify_mode => 0x0,
+ SSL_cert_file => $ssl_cert_file,
+ SSL_key_file => $ssl_key_file,
+ SSL_passwd_cb => sub {
+ die "Password protected server key file not supported\n";
+ },
+ );
+ if ($ssl_verify_client) {
+ $ssl_options{SSL_verify_mode} = 0x03;
+ if ($ssl_ca_file) {
+ $ssl_options{SSL_ca_file} = $ssl_ca_file;
+ }
+ if ($ssl_ca_path) {
+ $ssl_options{SSL_ca_path} = $ssl_ca_path;
+ }
+ }
+ $! = 0;
+ $http_daemon = HTTP::Daemon::SSL->new(%server_options, %ssl_options);
+ $errno = $!;
+ if (!$http_daemon && (my $errstr = IO::Socket::SSL->errstr())) {
+ # We are perhaps ignoring $! here ...
+ die "SSL error while starting daemon: $errstr\n";
+ }
+} else {
+ $! = 0;
+ $http_daemon = HTTP::Daemon->new(%server_options);
+ $errno = $!;
+}
+
+unless ($http_daemon){
+ if ($errno != 0) {
+ $! = $errno;
+ die "Error starting HTTP daemon: $!\n";
+ } else {
+ die "Unknown error starting HTTP daemon\n";
+ }
+}
+
+#
+# start process for LS registration and keepalive
+#
+
+my $ls_reg_pid; # The pid of the LS registration process.
+ # "undef", if no such process running (at the moment).
+my $ls_reg_starttime = 0; # The time the registration process has started.
+ # "0" is important for first start!
+my $ls_reg_respawn_threshold = 60; # Respawn threshold for registration
process
+if ($ls_register){
+ if
(!@ls_url){
+ $log->notice(
+ "No URL for LS registration - Continuing without registration"
+ );
+ } else {
+ fork_ls_reg();
+ }
+}
+
+
+#
+# start process for selftest functionality
+#
+
+#TODO rework fork code completely!!
+#TODO add more messages and checks
+
+#selftesting functions are defined in plugin modules and
+#can be configured in oppd.conf per service
+=cut
+my @testservices;
+
+foreach my $service (keys %services){
+ if ($services{$service}{"selftest"}){
+ push @testservices, $service;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "No selftests specified for $service."
+ );
+ }
+}
+
+while (my $service = pop @testservices){
+ foreach my $test (keys %{$services{$service}{"selftest"}}){
+ my $pid = fork();
+ defined($pid) or $log->log(
+ level => "warning", service => $service,
+ message => "Could not fork selftest process $test for module $service:
$!"
+ );
+ #last if ($pid!=0);
+ if ($pid==0){ #child process, do selftest
+ $SIG{INT} = $SIG{TERM} = sub {
+ $log->log(
+ level => "notice", service => $service,
+ message => "Signal caught - exiting selftest process $test for
$service"
+ );
+ exit 1;
+ };
+ # do not call REAPER on SIGCHLD and avoid zombie children
+ $SIG{CHLD} = 'IGNORE';
+ while (1){
+ my $result = $services{$service}->{handler}->selftest($test);
+ $log->log(
+ level => "notice", service => $service,
+ message => "selftesting service $service: $test returned $result"
+ );
+ sleep($services{$service}{"selftest"}{$test});
+ }
+ }
+ }
+}
+=cut
+
+#
+# Accept connections
+#
+
+my %connections = (); # We hold the pids for all connection processes to keep
+ # track of the correct number of connections
+my ($conn, $peer); # We need at least $conn outside the main loop
+while (1) {
+ # We cannot use 'while (my ($conn, $peer) = $http_daemon->accept)', because
+ # HTTP:Daemon returns undef on signals and HTTP::Daemon::SSL also returns
+ # undef on failure (see man page).
+ ($conn, $peer) = $http_daemon->accept;
+ unless (defined $conn) {
+ # We haven't set a timeout that can also make accept() return undef!
+ next if $!{EINTR};
+ # Just ignore if accept() returned because a signal (most likely
SIGCHLD)
+ # was received. See 'man perlipc'.
+ if ($!) {
+ $log->info("Error in incoming connection: $!");
+ } elsif (my $errstr = IO::Socket::SSL->errstr()) {
+ # SSL stuff is obviously not setting $! ...
+ $log->info("SSL error in incoming connection: $errstr");
+ } else {
+ $log->info("Unknown error in incoming connection");
+ }
+ next;
+ }
+ my $peer_str = "UNKNOWN";
+ if ($peer) {
+ my ($port, $iaddr) = sockaddr_in($peer);
+ $peer_str = inet_ntoa($iaddr) . ":" . $port;
+ }
+ $log->info("Incoming connection from $peer_str");
+ if (scalar(keys %connections)+1 > $max_conn) {
+ my $msg = "Too many connections";
+ $log->notice("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ if($ssl and $ssl_trusted_webserver_cn and
$conn->peer_certificate("commonName") ne $ssl_trusted_webserver_cn) {
+ my $msg = "CN of certificate (".$conn->peer_certificate("commonName").")
not matching CN of trusted webserver";
+ $log->warning("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ $log->debug("Forking connection process for $peer_str");
+ my $pid = fork();
+ unless (defined $pid) {
+ # The fork failed
+ $log->error("Forking connection process failed: $!");
+ # Close the connection, because we have no process to care for it
+ close_socket($conn, "Error closing incoming connection after failed
fork");
+ next;
+ }
+ unless ($pid == 0) {
+ #
+ # We are the parent
+ #
+ # Child cares about the connection -> We can close it
+ close_socket($conn, "Error closing incoming connection in parent");
+ $log->debug("Connection process $pid/$peer_str started");
+ $connections{$pid} = $peer_str; # We care about our children!
+ $log->debug(
+ "Number of connections increased to " . scalar(keys %connections)
+ );
+ next;
+ }
+
+ #
+ # We are the child handling the connection
+ #
+
+ $proc_type = "connection";
+ $log_prefix = "$$/$peer_str";
+
+ $log->debug("Connection process running");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+ $SIG{USR1} = $SIG{USR2} = 'IGNORE'; # graceful -> do not cut connections!
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ #
+ # Handle requests as they come in
+ #
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ # http://rt.cpan.org/Public/Bug/Display.html?id=45625
+ # http://www.perlmonks.org/?node_id=761270
+ $conn->timeout($conn_timeout) unless($ssl);
+ while (my $request = $conn->get_request) {
+ $log->info("Incoming request");
+ $log->debug("Disabling connection timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout(0) unless($ssl);
+ my $response = new HTTP::Response;
+ eval {
+ my $soap_message =
+ perfSONAR::SOAP::Message->from_http_request($request);
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO: Auth
+ if ($auth){
+ perfSONAR::Auth::authenticate($soap_message, $nmwg_message, $as_url);
+ }
+ my $nmwg_response = perfSONAR->handle_request(
+ $soap_message->uri, $nmwg_message
+ );
+ #TODO $nmwg_message <-> $nmwg_response? clone?
+ #TODO what about header?
+ $soap_message->body($nmwg_response->as_dom()->documentElement);
+ $response->content($soap_message->as_string);
+ };
+ if (my $eval_err = $@) {
+ $log->info("Processing SOAP request failed: $eval_err");
+ $response->content(
+ perfSONAR::SOAP::Message->new(
+ fault => perfSONAR::SOAP::Fault_v1_1->new(
+ "", "Server.Internal", $eval_err
+ )
+ )->as_string
+ );
+ }
+ $log->debug("Sending response");
+ $log->debug("Response:\n".$response->content());
+ $conn->send_response($response);
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout($conn_timeout) unless ($ssl);
+ }
+ if (my $reason = $conn->reason) {
+ $log->info("Connection terminated: $reason");
+ }
+ # Cleanup -> close connection
+ close_socket($conn, "Closing connection failed");
+ $log->debug("Exiting connection process");
+ exit 0; # We are the child and have done our job -> exit
+}
+
+
+die "Internal error: This code should not be reached!\n";
+
+
+
+### END OF MAIN ###
+
+
+
+# Returns the first found parameter with a "defined" value
+sub get_opt {
+ foreach (@_) {
+ return $_ if defined;
+ }
+ return undef;
+}
+
+
+END {
+ # END could be executed without most if the initialisation from above
already
+ # done!
+ # At least the following variables should be already available via the INIT
+ # block (other should be considered to be possibly undef or empty):
+ # $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ # $shutting_down
+ # Keep this also in mind for subs called in the code below!
+ $shutting_down = 1;
+ return if $proc_type eq "dummy"; # Do not execute anything below
+ my $exitcode = $?; # Save $?
+ if ($proc_type eq "main") {
+ $log->info("Starting shutdown sequence");
+
+ my @pids = sort keys %connections;
+ push @pids, $ls_reg_pid if $ls_reg_pid;
+ if ($shutdown_gracefully && @pids) {
+ $log->info("Trying to terminate all known children gracefully");
+ my $signal = $shutdown_gracefully > 0 ? "USR1" : "USR2";
+ my @pids_new = ();
+ foreach my $pid (@pids) {
+ next if waitpid($pid, WNOHANG) != 0; # Already dead ...
+ kill $signal => $pid;
+ push @pids_new, $pid;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ # Some processes were signaled
+ $log->debug("Sent SIG$signal to " . join(', ', @pids));
+ # Wait till processes have ended or timeout is reached.
+ # $shutdown_gracefully < 0 => Wait possibly forever!!
+ my $timeout = $shutdown_gracefully < 0 ? 0 : $shutdown_gracefully;
+ $log->debug("Waiting for childern to exit" .
+ ($timeout ? " with timeout of $timeout s" : " WITHOUT timeout")
+ );
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ do {
+ foreach my $pid (@pids) {
+ push @pids_new, $pid if waitpid($pid, WNOHANG) == 0;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ $log->debug("Processes alive: " . join(', ', @pids));
+ sleep 1;
+ }
+ } until ! @pids;
+ alarm 0;
+ };
+ die if $@ && $@ ne "alarm\n"; # propagate unexpected errors
+ }
+ }
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There are childern alive
+ $log->info("Trying to terminate all children using SIGTERM");
+ local $SIG{TERM} = 'IGNORE';
+ kill TERM => -$$;
+ sleep 1; # Give everyone at least one second!
+ }
+ if ($pidfile_ok && -e $pidfile) {
+ # Clean up PID file
+ unlink $pidfile or $log->warning("Cannot delete pid file: $!");
+ }
+ $log->notice("Exiting");
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There is still someone alive! -> Take the axe and cut our branch
+ $log->warning("Not all children exited on SIGTERM -> KILLING
EVERYTHING");
+ kill KILL => -$$;
+ }
+ } elsif ($proc_type eq "connection") {
+ # We don't want to log as many messages as with the other processes!
+ #
+ # Close connection socket. Connection is definitively available in
+ # connection process, but may be closed. close_socket() is handling this
+ # case correctly, though.
+ close_socket($conn, "Closing connection failed");
+ } elsif ($proc_type eq "lsreg") {
+ $log->info("Starting shutdown sequence");
+ if ($shutdown_gracefully) {
+ $log->info("Deregistering services");
+ perfSONAR::Client::LS::deregister();
+ } else {
+ #TODO Change this? Perhaps a deregistration with a small timeout?
+ $log->info("Not deregistering services. Not a graceful shutdown.");
+ #TODO Quit reg/dereg (close conn) somehow if they are running?
+ }
+ $log->notice("Exiting");
+ } else {
+ warn "Internal error: END block executed with unknown process type: " .
+ "\"$proc_type\"\n";
+ }
+ $? = $exitcode; # Restore $?
+}
+
+#
+# setup pid file
+#
+sub setup_pidfile {
+ die("PID file ($pidfile) contains pid! Already running?\n")
+ if -e $pidfile && -s $pidfile;
+ open(PIDFILE, ">$pidfile")
+ or die("Could not write PID file ($pidfile): $!\n");
+ print PIDFILE "$$\n";
+ $pidfile_ok = 1;
+ close PIDFILE
+ or die("Could not write PID file ($pidfile): $!\n");
+}
+
+
+#
+# This is our SIGCHLD handler. We have to care of some things:
+# - Make sure that connection processes are correctly withdrawn from
+# %connections.
+# - Respawn LS registration process.
+#
+sub REAPER { # see also 'man perlipc'
+ local $!; # waitpid() and others may overwrite current error
+ while ((my $pid = waitpid(-1,WNOHANG)) > 0) {
+ my $reason = $? ? " with exit code $?" : "";
+ if (exists $connections{$pid}) {
+ $log->debug(
+ "Connection process $pid for connection $connections{$pid} exited"
+ . $reason
+ );
+ delete $connections{$pid};
+ $log->debug(
+ "Number of connections decreased to " . scalar(keys %connections)
+ );
+ } elsif ($pid == $ls_reg_pid) {
+ $log->debug("LS registration process $pid exited" . $reason);
+ $ls_reg_pid = undef;
+ fork_ls_reg() unless $shutting_down;
+ } else {
+ $log->debug("Unknown child process $pid exited" . $reason);
+ }
+ }
+ $SIG{CHLD} = \&REAPER; # loathe sysV
+}
+
+
+#
+# Close a socket with special care about SSL sockets.
+# Do only close sockets that are really open.
+#
+sub close_socket {
+ my ($socket, $err_msg) = @_;
+ return 1 unless $socket->opened; # Handle already closed sockets "silently"
+ if (UNIVERSAL::isa($socket, "IO::Socket::SSL")) {
+ unless ($socket->close(SSL_no_shutdown => 1)) {
+ $log->warning("$err_msg: $?");
+ return;
+ }
+ if(my $errstr = $socket->errstr()) {
+ $log->warning("$err_msg: $errstr");
+ return;
+ }
+ return 1;
+ }
+ if (UNIVERSAL::isa($socket, "IO::Socket")) {
+ unless ($socket->close) {
+ $log->warning("$err_msg: $!");
+ return;
+ }
+ return 1;
+ }
+ die "Internal error: close_socket(): Not a valid socket!\n";
+}
+
+
+#
+# Fork away the child process for LS registration.
+#
+sub fork_ls_reg {
+ my $ppid = $$; # Give our pid to the child
+ $log->info("Starting LS registration process");
+ my $pid = fork();
+ if (!defined($pid)) {
+ #
+ # Fork failed
+ #
+ $log->warning("Could not fork LS registration process: $!");
+ $log->warning("Continuing without registration");
+ return;
+ }
+ if ($pid != 0) {
+ #
+ # Child started, we are the parent, and child pid is in $pid
+ #
+ $ls_reg_pid = $pid;
+ $ls_reg_starttime = time;
+ return $pid; # return a bit more than just "true"
+ }
+
+ #
+ # Child process
+ #
+
+ $proc_type = "lsreg";
+ $log_prefix = "heartbeat/$$";
+
+ # First try to prevent lots of respawns of ls registration process:
+ if ($ls_reg_starttime+$ls_reg_respawn_threshold > time) {
+ # Our $ls_reg_starttime is still the start time of our predecessor!
+ $log->notice(
+ "LS registration process respawning too fast" .
+ " - delayed for $ls_reg_respawn_threshold s"
+ );
+ sleep $ls_reg_respawn_threshold;
+ }
+ # Check if everything seems ok:
+ unless (getppid == $ppid) {
+ die "Internal error: Got wrong ppid from getppid!\n";
+ }
+ $log->info("LS Registration process started");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ # Start registration process
+ perfSONAR::Client::LS::init(
+ services => \%services, ls_url =>
\@ls_url,
+ hostname => $hostname, port => $port,
+ organization => $organization, contact => $contact,
+ log => $log
+ );
+ while (1) {
+ sleep $keepalive;
+ # Our parent may have died without being able to send us a signal. So
take
+ # a look whether it's already there and exit if not:
+ unless (getppid == $ppid) {
+ $log->notice("Parent died - initiating shutdown");
+ exit 1;
+ }
+ perfSONAR::Client::LS::heartbeat();
+ }
+ die "Internal error: This code should not be reached!\n";
+}
+
+
+
+__END__
+
+
+
+=head1 NAME
+
+B<oppd.pl> - open perl perfSONAR daemon
+
+=head1 SYNOPSIS
+
+B<oppd.pl> [OPTIONS]
+
+
+
+=head1 DESCRIPTION
+
+This is the perl perfSONAR deamon script, running different perl perfSONAR
+services.
+Services can be configured in the oppd.conf file.
+For more information about perfSONAR, see L<http://www.perfsonar.net/>.
+
+
+=head1 OPTIONS
+
+This is a full list of available command line options. Please keep in mind
+that this script does NOT provide the normal Hades command line options
+or configuration file options!
+Some options might even look familiar, although they are used slightly
+different!
+
+Nearly all options have a built in default that can be overwritten using
+command line arguments or variables in the configuration file.
+Arguments have precedence over variables in the configuration file.
+
+
+=over
+
+
+=item B<--help>
+
+Prints a help message and exits.
+
+
+=item B<--config>=F<CONFIGFILE>
+
+Read configuration file F<CONFIGFILE> for options.
+
+Default: F</etc/oppd.conf>
+
+
+=item B<--noconfig>
+
+Do not read any configuration file. The parameter B<--config> is also
ignored!
+
+Default: off
+
+
+=item B<--[no]detach>
+
+Detach from terminal, aka run in background (instead of foreground).
+Log messages will not be sent to F<STDERR>.
+
+Default: on
+
+Configuration file: B<detach>
+
+
+=item B<--logfile>[=F<LOGFILE>]
+
+Append messages to file F<LOGFILE>.
+
+Just use B<--logfile> without the optional value to enable logging to default
+log file F</var/log/oppd.log>.
+
+You can use this option together with B<--syslog>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<logfile>
+
+
+=item B<--nologfile>
+
+Do not write to any log file. The parameter B<--logfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<logfile>
+
+
+=item B<--[no]syslog>
+
+Whether messages should be written to system log.
+
+You can use this option together with B<--logfile>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<syslog>
+
+
+=item B<--syslog-host>=I<HOST>
+
+Use I<HOST> as host to which system log messages are forwarded.
+
+If this option is set to a dns name or ip address, all system log messages
+are forwarded to the specified remote host.
+If set to the empty string ("") logging is done locally.
+
+Default: log locally
+
+Configuration file: B<syslog-host>
+
+
+=item B<--syslog-ident>=I<IDENT>
+
+The string I<IDENT> will be prepended to all messages in the system log.
+
+Default: I<oppd>
+
+Configuration file: B<syslog-ident>
+
+
+=item B<--syslog-facility>=I<FACILITY>
+
+Use I<FACILITY> as type of program for system logging.
+
+This string will be used as the system log facility for messages sent to
+the system log.
+
+See your C<syslog(3)> documentation for the facilities available on your
+system.
+Typical facilities are I<auth>, I<authpriv>, I<cron>, I<daemon>, I<kern>,
+I<local0> through I<local7>, I<mail>, I<news>, I<syslog>, I<user>, I<uucp>.
+
+Default: I<daemon>
+
+Configuration file: B<syslog-facility>
+
+
+=item B<--loglevel>=I<LOGLEVEL>
+
+Use I<LOGLEVEL> as log level used for logging to syslog and to the log files.
+
+This option is used for setting the verbosity of the running daemon.
+The log levels available are the log levels defined by Log::Dispatch.
+
+This is a list of values that should be accepted:
+ 0 = debug
+ 1 = info
+ 2 = notice
+ 3 = warning
+ 4 = err = error
+ 5 = crit = critical
+ 6 = alert
+ 7 = emerg = emergency
+
+Default: I<notice>
+
+Configuration file: B<loglevel>
+
+
+=item B<--verbose>
+
+Just a handy abbreviation for B<--loglevel>=I<info>.
+
+Default: not set, see B<--loglevel>
+
+Configuration file: use B<loglevel>=I<info>
+
+
+=item B<--pidfile>[=F<PIDFILE>]
+
+Use PIDFILE as name of pid file.
+The pid file contains the Process ID of the running oppd service.
+
+Just use B<--pidfile> without the optional value to use the default pid file
+F</var/run/oppd.pid>.
+
+Default: F</var/run/oppd.pid>
+
+Configuration file: B<pidfile>
+
+
+=item B<--nopidfile>
+
+Do not use a pid file. The parameter B<--pidfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<pidfile>
+
+
+=item B<--max_proc>=F<number of processes>
+
+Maximum Number of processes to get forked for listening to requests.
+This means that the service is able to handle B<--max_proc>
+numbers of requests simultaneously.
+
+Default: 5
+
+
+=item B<--port>=PORT
+
+Port number the service is listening to incoming requests.
+
+Default: 8090
+
+
+=item B<--[no]auth>
+
+Use authentication with an perfSONAR Authentication Server.
+Note that you have to provide the option to specify the URL
+for the Authentication Server also.
+
+Default: disabled
+
+
+=item B<--as_url>=F<AS URL>
+
+Provide URL for Authentication Server (see above).
+Only needed when authentication is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--[no]register>
+
+Registration to perfSONAR Lookup Server.
+When enabled, sends registration messages to Lookup Server specified by
ls_url.
+
+Default: disabled
+
+
+=item B<--keepalive>=F<keepalive interval>
+
+Interval in seconds when keepalive messages are sent to Lookup Service.
+This option has no effect, if Lookup Service registration is disabled.
+Note that the interval should be as long as possible, as this reduces
+communication overhead.
+
+Default: none. At least 12 hours recommended.
+
+
+=item B<--ls_url>=F<LS URL>
+
+Provide URL for Lookup Server (see above).
+Only needed when Lookup Service registration is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--hostname>=F<HOSTNAME>
+
+=item B<--organization>=F<ORGANIZATION>
+
+=item B<--contact>=F<CONATCT>
+
+These information are sent in the registration message to the
+Lookup Service.
+If registration is not enabled, these options have no effect.
+
+Default: none
+
+
+=back
+
+
+
+=head1 SIGNALS
+
+The oppd can be controlled by using various signals.
+
+
+=over
+
+
+=item SIGHUP
+
+Ignored and daemon is NOT reconfigured at the moment.
+
+
+=item SIGINT and SIGTERM
+
+Daemon terminates immediately. A SIGKILL is sent to the child processes
+shortly after giving them the chance to exit properly by sending them a
+SIGTERM.
+
+
+=item SIGUSR1
+
+Daemon terminates gracefully by sending all child processes a SIGUSR1 and
+waiting a specified time (at the moment 30 seconds) before sending them a
+SIGKILL.
+
+=for comment TODO There might be an option for $gracetime in the future.
+
+
+=item SIGUSR2
+
+Daemon terminates gracefully by sending all child processes a SIGUSR2 and
+will NEVER send a SIGKILL. The daemon might therefore wait forever and never
+return!
+
+
+=back
+
+
+
+=head1 EXAMPLES
+
+Start with a different configuration file:
+
+ $ oppd.pl --config=/usr/local/etc/oppd.conf
+
+Debug the daemon:
+
+ $ oppd.pl --nodetach \
+ --loglevel=debug --nologfile --nopidfile --nosyslog
+
+Use other some other options instead of the ones from configuration file:
+
+ $ oppd.pl --port=51234 --nologfile --pidfile=oppd.pid
+
+=head1 SEE ALSO
+
+oppd.conf
+
+
+
+=head1 AUTHORS
+
+DFN Labor Erlangen,
Property changes on: trunk/build/debian/perfsonar-oppd-0.51/bin/oppd.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/bindoc/oppd.pl.1p
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/bindoc/oppd.pl.1p
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/bindoc/oppd.pl.1p
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,398 @@
+.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10
pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12
pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds :
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o
\\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "OPPD 1p"
+.TH OPPD 1p "2010-07-30" "perl v5.10.0" "User Contributed Perl Documentation"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+\&\fBoppd.pl\fR \- open perl perfSONAR daemon
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBoppd.pl\fR [\s-1OPTIONS\s0]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+This is the perl perfSONAR deamon script, running different perl perfSONAR
+services.
+Services can be configured in the oppd.conf file.
+For more information about perfSONAR, see <http://www.perfsonar.net/>.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+This is a full list of available command line options. Please keep in mind
+that this script does \s-1NOT\s0 provide the normal Hades command line
options
+or configuration file options!
+Some options might even look familiar, although they are used slightly
+different!
+.PP
+Nearly all options have a built in default that can be overwritten using
+command line arguments or variables in the configuration file.
+Arguments have precedence over variables in the configuration file.
+.IP "\fB\-\-help\fR" 4
+.IX Item "--help"
+Prints a help message and exits.
+.IP "\fB\-\-config\fR=\fI\s-1CONFIGFILE\s0\fR" 4
+.IX Item "--config=CONFIGFILE"
+Read configuration file \fI\s-1CONFIGFILE\s0\fR for options.
+.Sp
+Default: \fI/etc/oppd.conf\fR
+.IP "\fB\-\-noconfig\fR" 4
+.IX Item "--noconfig"
+Do not read any configuration file. The parameter \fB\-\-config\fR is also
ignored!
+.Sp
+Default: off
+.IP "\fB\-\-[no]detach\fR" 4
+.IX Item "--[no]detach"
+Detach from terminal, aka run in background (instead of foreground).
+Log messages will not be sent to \fI\s-1STDERR\s0\fR.
+.Sp
+Default: on
+.Sp
+Configuration file: \fBdetach\fR
+.IP "\fB\-\-logfile\fR[=\fI\s-1LOGFILE\s0\fR]" 4
+.IX Item "--logfile[=LOGFILE]"
+Append messages to file \fI\s-1LOGFILE\s0\fR.
+.Sp
+Just use \fB\-\-logfile\fR without the optional value to enable logging to
default
+log file \fI/var/log/oppd.log\fR.
+.Sp
+You can use this option together with \fB\-\-syslog\fR.
+Messages will then be written to both, log file and system log.
+.Sp
+Default: off
+.Sp
+Configuration file: \fBlogfile\fR
+.IP "\fB\-\-nologfile\fR" 4
+.IX Item "--nologfile"
+Do not write to any log file. The parameter \fB\-\-logfile\fR is also
ignored!
+.Sp
+Default: off
+.Sp
+Configuration file: use \fBlogfile\fR
+.IP "\fB\-\-[no]syslog\fR" 4
+.IX Item "--[no]syslog"
+Whether messages should be written to system log.
+.Sp
+You can use this option together with \fB\-\-logfile\fR.
+Messages will then be written to both, log file and system log.
+.Sp
+Default: off
+.Sp
+Configuration file: \fBsyslog\fR
+.IP "\fB\-\-syslog\-host\fR=\fI\s-1HOST\s0\fR" 4
+.IX Item "--syslog-host=HOST"
+Use \fI\s-1HOST\s0\fR as host to which system log messages are forwarded.
+.Sp
+If this option is set to a dns name or ip address, all system log messages
+are forwarded to the specified remote host.
+If set to the empty string ("") logging is done locally.
+.Sp
+Default: log locally
+.Sp
+Configuration file: \fBsyslog-host\fR
+.IP "\fB\-\-syslog\-ident\fR=\fI\s-1IDENT\s0\fR" 4
+.IX Item "--syslog-ident=IDENT"
+The string \fI\s-1IDENT\s0\fR will be prepended to all messages in the
system log.
+.Sp
+Default: \fIoppd\fR
+.Sp
+Configuration file: \fBsyslog-ident\fR
+.IP "\fB\-\-syslog\-facility\fR=\fI\s-1FACILITY\s0\fR" 4
+.IX Item "--syslog-facility=FACILITY"
+Use \fI\s-1FACILITY\s0\fR as type of program for system logging.
+.Sp
+This string will be used as the system log facility for messages sent to
+the system log.
+.Sp
+See your \f(CWsyslog(3)\fR documentation for the facilities available on your
+system.
+Typical facilities are \fIauth\fR, \fIauthpriv\fR, \fIcron\fR, \fIdaemon\fR,
\fIkern\fR,
+\&\fIlocal0\fR through \fIlocal7\fR, \fImail\fR, \fInews\fR, \fIsyslog\fR,
\fIuser\fR, \fIuucp\fR.
+.Sp
+Default: \fIdaemon\fR
+.Sp
+Configuration file: \fBsyslog-facility\fR
+.IP "\fB\-\-loglevel\fR=\fI\s-1LOGLEVEL\s0\fR" 4
+.IX Item "--loglevel=LOGLEVEL"
+Use \fI\s-1LOGLEVEL\s0\fR as log level used for logging to syslog and to the
log files.
+.Sp
+This option is used for setting the verbosity of the running daemon.
+The log levels available are the log levels defined by Log::Dispatch.
+.Sp
+This is a list of values that should be accepted:
+ 0 = debug
+ 1 = info
+ 2 = notice
+ 3 = warning
+ 4 = err = error
+ 5 = crit = critical
+ 6 = alert
+ 7 = emerg = emergency
+.Sp
+Default: \fInotice\fR
+.Sp
+Configuration file: \fBloglevel\fR
+.IP "\fB\-\-verbose\fR" 4
+.IX Item "--verbose"
+Just a handy abbreviation for \fB\-\-loglevel\fR=\fIinfo\fR.
+.Sp
+Default: not set, see \fB\-\-loglevel\fR
+.Sp
+Configuration file: use \fBloglevel\fR=\fIinfo\fR
+.IP "\fB\-\-pidfile\fR[=\fI\s-1PIDFILE\s0\fR]" 4
+.IX Item "--pidfile[=PIDFILE]"
+Use \s-1PIDFILE\s0 as name of pid file.
+The pid file contains the Process \s-1ID\s0 of the running oppd service.
+.Sp
+Just use \fB\-\-pidfile\fR without the optional value to use the default pid
file
+\&\fI/var/run/oppd.pid\fR.
+.Sp
+Default: \fI/var/run/oppd.pid\fR
+.Sp
+Configuration file: \fBpidfile\fR
+.IP "\fB\-\-nopidfile\fR" 4
+.IX Item "--nopidfile"
+Do not use a pid file. The parameter \fB\-\-pidfile\fR is also ignored!
+.Sp
+Default: off
+.Sp
+Configuration file: use \fBpidfile\fR
+.IP "\fB\-\-max_proc\fR=\fInumber of processes\fR" 4
+.IX Item "--max_proc=number of processes"
+Maximum Number of processes to get forked for listening to requests.
+This means that the service is able to handle \fB\-\-max_proc\fR
+numbers of requests simultaneously.
+.Sp
+Default: 5
+.IP "\fB\-\-port\fR=PORT" 4
+.IX Item "--port=PORT"
+Port number the service is listening to incoming requests.
+.Sp
+Default: 8090
+.IP "\fB\-\-[no]auth\fR" 4
+.IX Item "--[no]auth"
+Use authentication with an perfSONAR Authentication Server.
+Note that you have to provide the option to specify the \s-1URL\s0
+for the Authentication Server also.
+.Sp
+Default: disabled
+.IP "\fB\-\-as_url\fR=\fI\s-1AS\s0 \s-1URL\s0\fR" 4
+.IX Item "--as_url=AS URL"
+Provide \s-1URL\s0 for Authentication Server (see above).
+Only needed when authentication is enabled.
+Otherwise this option has no effect.
+.Sp
+Default: none
+.IP "\fB\-\-[no]register\fR" 4
+.IX Item "--[no]register"
+Registration to perfSONAR Lookup Server.
+When enabled, sends registration messages to Lookup Server specified by
ls_url.
+.Sp
+Default: disabled
+.IP "\fB\-\-keepalive\fR=\fIkeepalive interval\fR" 4
+.IX Item "--keepalive=keepalive interval"
+Interval in seconds when keepalive messages are sent to Lookup Service.
+This option has no effect, if Lookup Service registration is disabled.
+Note that the interval should be as long as possible, as this reduces
+communication overhead.
+.Sp
+Default: none. At least 12 hours recommended.
+.IP "\fB\-\-ls_url\fR=\fI\s-1LS\s0 \s-1URL\s0\fR" 4
+.IX Item "--ls_url=LS URL"
+Provide \s-1URL\s0 for Lookup Server (see above).
+Only needed when Lookup Service registration is enabled.
+Otherwise this option has no effect.
+.Sp
+Default: none
+.IP "\fB\-\-hostname\fR=\fI\s-1HOSTNAME\s0\fR" 4
+.IX Item "--hostname=HOSTNAME"
+.PD 0
+.IP "\fB\-\-organization\fR=\fI\s-1ORGANIZATION\s0\fR" 4
+.IX Item "--organization=ORGANIZATION"
+.IP "\fB\-\-contact\fR=\fI\s-1CONATCT\s0\fR" 4
+.IX Item "--contact=CONATCT"
+.PD
+These information are sent in the registration message to the
+Lookup Service.
+If registration is not enabled, these options have no effect.
+.Sp
+Default: none
+.SH "SIGNALS"
+.IX Header "SIGNALS"
+The oppd can be controlled by using various signals.
+.IP "\s-1SIGHUP\s0" 4
+.IX Item "SIGHUP"
+Ignored and daemon is \s-1NOT\s0 reconfigured at the moment.
+.IP "\s-1SIGINT\s0 and \s-1SIGTERM\s0" 4
+.IX Item "SIGINT and SIGTERM"
+Daemon terminates immediately. A \s-1SIGKILL\s0 is sent to the child
processes
+shortly after giving them the chance to exit properly by sending them a
+\&\s-1SIGTERM\s0.
+.IP "\s-1SIGUSR1\s0" 4
+.IX Item "SIGUSR1"
+Daemon terminates gracefully by sending all child processes a \s-1SIGUSR1\s0
and
+waiting a specified time (at the moment 30 seconds) before sending them a
+\&\s-1SIGKILL\s0.
+.IP "\s-1SIGUSR2\s0" 4
+.IX Item "SIGUSR2"
+Daemon terminates gracefully by sending all child processes a \s-1SIGUSR2\s0
and
+will \s-1NEVER\s0 send a \s-1SIGKILL\s0. The daemon might therefore wait
forever and never
+return!
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Start with a different configuration file:
+.PP
+.Vb 1
+\& $ oppd.pl \-\-config=/usr/local/etc/oppd.conf
+.Ve
+.PP
+Debug the daemon:
+.PP
+.Vb 2
+\& $ oppd.pl \-\-nodetach \e
+\& \-\-loglevel=debug \-\-nologfile \-\-nopidfile \-\-nosyslog
+.Ve
+.PP
+Use other some other options instead of the ones from configuration file:
+.PP
+.Vb 1
+\& $ oppd.pl \-\-port=51234 \-\-nologfile \-\-pidfile=oppd.pid
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+oppd.conf
+.SH "AUTHORS"
+.IX Header "AUTHORS"
+\&\s-1DFN\s0 Labor Erlangen,
win\-
+.SH "POD ERRORS"
+.IX Header "POD ERRORS"
+Hey! \fBThe above document had some coding errors, which are explained
below:\fR
+.IP "Around line 658:" 4
+.IX Item "Around line 658:"
+=cut found outside a pod block. Skipping to next block.
+.IP "Around line 701:" 4
+.IX Item "Around line 701:"
+=cut found outside a pod block. Skipping to next block.
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.conf
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.conf
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.conf 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,470 @@
+#
+# Example configuration file for the Open Perl PerfSONAR Daemon (oppd)
+#
+# Comments are indicated by a leading '#'.
+# All configuration options are commented out in this example and therefore
+# their default values are used. Each option is set via a key and value pair
+# either separated by one or more whitspaces, or by '='.
+# See 'man oppd' and 'man oppd.conf' for more information.
+#
+
+
+#
+# detach - Detach from terminal.
+#
+# Detach from terminal, aka run in background (instead of foreground).
+# Log messages will not be sent to STDERR.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# detach off
+#
+#detach on
+
+
+#
+# logfile - Name of log file.
+#
+# Append messages to the specified file.
+#
+# Set it to no, off, 0, or false to disable log file usage.
+# Set it to yes, on, 1, or true to enable logging to default log file
+# "/var/log/oppd.log".
+#
+# You can use this option together with "syslog" (see below).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to log file
+#
+# Default: off
+#
+# Example:
+# logfile "/var/log/oppd.log"
+#
+#logfile off
+
+
+#
+# syslog - Whether messages should be written to system log.
+#
+# Set it to no, off, 0, or false to disable sending messages to system log.
+# Set it to yes, on, 1, or true to enable sending messages to system log.
+#
+# You can use this option together with "logfile" (see above).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# syslog on
+#
+#syslog off
+
+
+#
+# syslog-host - The (optional) host to which system log messages are
forwarded.
+#
+# If this option is set to a dns name or ip address, all system log messages
+# are forwarded to the specified remote host.
+# If set to no, off, 0, false, or "" logging is done locally.
+#
+# Valid options: no, off, 0, false, name or ip of syslog host
+#
+# Default: off
+#
+# Example:
+# syslog-host "syslog.nowhere.com"
+#
+#syslog-host off
+
+
+#
+# syslog-ident - Identification string for system log messages.
+#
+# This string will be prepended to all messages in the system log.
+#
+# Default: oppd
+#
+# Example:
+# syslog-ident "hades-tracert"
+#
+#syslog-ident "oppd"
+
+
+#
+# syslog-facility - Type of program for system logging.
+#
+# This string will be used as the system log facility for messages sent to
+# the system log.
+# See your syslog documentation for the facilities available on your system.
+#
+# Valid options: (Typical facilities.)
+# auth, authpriv, cron, daemon, kern, local0 through local7, mail, news,
+# syslog, user, uucp
+#
+# Default: daemon
+#
+# Example:
+# syslog-facility "local0"
+#
+#syslog-facility "daemon"
+
+
+#
+# loglevel - The log level used for logging to syslog and to the log files.
+#
+# This option is used for setting the verbosity of the running daemon.
+# The log levels available are the log levels defined by Log::Dispatch.
+#
+# Valid options: (This is a list of values that should be accepted.)
+# 0 = debug
+# 1 = info
+# 2 = notice
+# 3 = warning
+# 4 = err = error
+# 5 = crit = critical
+# 6 = alert
+# 7 = emerg = emergency
+#
+# Default: notice
+#
+# Example:
+# loglevel "info"
+#
+#loglevel "notice"
+
+
+#
+# pidfile - Name of pid file.
+#
+# Set it to no, off, 0, or false to disable pid file usage.
+# Set it to yes, on, 1, or true to write pid file to default position
+# "/var/run/oppd.pid".
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to pid file
+#
+# Default: /var/run/oppd.pid
+#
+# Example:
+# pidfile off
+#
+#pidfile "/var/run/oppd.pid"
+
+
+#
+# port - Port used to listen on incoming connections
+#
+# Port used to listen on incoming connections.
+#
+# Valid options: integer number
+#
+# Default: 8090
+#
+# Example:
+# port 12345
+#
+#port 8090
+
+
+#
+# max_proc - Maximum number of parallel running request processes.
+#
+# Set the maximum number of processes to be spawned for handling incoming
+# requests.
+#
+# Valid options: integer number
+#
+# Default: 5
+#
+# Example:
+# max_proc 20
+#
+#max_proc 5
+
+
+###############################################################################
+#
+# Options for Lookup Service communication:
+#
+###############################################################################
+
+#
+# ls_register - Lookup Service registration.
+#
+# Enable or disable Lookup Service registration.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ls_register on
+#
+#ls_register off
+
+
+#
+# keepalive - Keep alive interval.
+#
+# The keep alive interval for sending registration information to Lookup
+# Service in seconds.
+#
+# Valid options: integer number
+#
+# Default: 3600 (1 hour)
+#
+# Example:
+# keepalive 7200
+#
+#keepalive 3600
+
+
+#
+# ls_url - Lookup Service address.
+#
+# For every Lookup Service you want to send the registration information to
+# you should put one ls_url line in the configuration file. All you need is
to
+# give the address of the service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# ls_url "http://myls.mydomain.org:8080/ervices/LookupService"
+# ls_url "http://188.1.36.53:8080/axis/services/LookupService"
+# ls_url
"http://loco3.man.poznan.pl:8080/LookupService/services/LookupService"
+# ls_url "http://selena.acad.bg:8070/axis/services/LookupService"
+# ls_url
"http://ndb0-aami.internet2.edu:9095/perfSONAR_PS/services/hLS"
+# ls_url "http://ndb1.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url "http://dc211.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url
"http://loco4.man.poznan.pl:8180/geant2-java-xml-ls/services/LookupService"
+#
+#ls_url [FILL ME]
+
+
+#
+# hostname - Host name sent to the Lookup Service.
+#
+# Host name sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# hostname "myhost.mydomain.org"
+#
+#hostname [FILL ME]
+
+
+#
+# organization - Organization sent to the Lookup Service.
+#
+# Organization sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# organization "My Company"
+#
+#organization [FILL ME]
+
+
+#
+# contact - Contact e-mail address sent to the Lookup Service.
+#
+# Contact e-mail address sent to the Lookup Service.
+#
+# Valid options: e-mail address
+#
+# Default: none
+#
+# Example:
+# contact
""
+#
+#contact [FILL ME]
+
+
+###############################################################################
+#
+# Options for Authentication communication:
+#
+###############################################################################
+
+#
+# auth - Use Authentication Service.
+#
+# Enable or disable authentication via Authentication Service.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# auth on
+#
+#auth off
+
+
+#
+# as_url - Location of Authentication Service.
+#
+# Location of the Authentication Service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# as_url "http://myas.mydomain.org:8080/services/AuthService"
+# as_url "http://myas.rediris.es:8080/services/AuthService"
+# as_url
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService"
+#
+#as_url [FILL ME]
+
+
+###############################################################################
+#
+# SSL configuration options
+#
+###############################################################################
+
+#
+# ssl - SSL (Secure Socket Layer) support.
+#
+# Enable or disable SSL (Secure Socket Layer) support, which means that
+# the daemon will expect HTTPS requests instead of normal HTTP request.
+# IMPORTANT: Normal HTTP requests will not work anymore if SSL is enabled!
+# IMPORTANT: Most of the following options are necessary for SSL. You should
+# take care of all of them and make sure that you really know what
+# you are doing! If oppd is missing a necessary option, you will
get
+# an error message and the daemon will not start!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ssl on
+#
+#ssl off
+
+
+#
+# ssl_cert_file - SSL certificate file.
+#
+# Use this option to specify the location of your certificate.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_cert_file /var/www/certs/server-cert.pem
+#
+#ssl_cert_file [FILL ME]
+
+
+#
+# ssl_key_file - SSL server key file.
+#
+# Use this option to specify the location of your server key file.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_key_file /var/www/certs/server-key.pem
+#
+#ssl_key_file [FILL ME]
+
+
+#
+# ssl_verify_client - Verify SSL client certificate.
+#
+# Enable or Disable the verification of the SSL client certificate. This is
+# normally used as a method of client authentication.
+# IMPORTANT: This option is enabled by default, because you normally don't
want
+# to allow access to perfSONAR services by untrusted users. You
+# should only disable it if you really know what you are doing!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# ssl_verify_client off
+#
+#ssl_verify_client on
+
+
+#
+# ssl_ca_file - SSL certificate(s) of the reputable certificate authorities.
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_path below) to locate the file
+# containing the certificate(s) of the reputable certificate authorities.
+# There is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_ca_file /var/www/certs/my-ca.pem
+#
+#ssl_ca_file [FILL ME]
+
+
+#
+# ssl_ca_path - Directory containing SSL certificate(s)
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_file above) to locate the
certificate(s)
+# of the reputable certificate authorities.
+# If you are unusually friendly with the OpenSSL documentation, you might
have
+# set yourself up a directory containing several trusted certificates as
+# separate files as well as an index of the certificates.
+# Use this option to specify the location of this directory.
+# There is NO default value!
+#
+# Valid options: Directory path
+#
+# Default: none
+#
+# Example:
+# ssl_ca_path /var/www/certs/ca/
+#
+#ssl_ca_path [FILL ME]
+
+
+###############################################################################
+#
+# Configuring services
+#
+###############################################################################
+#
+# You have to define (at least) one or more <service> sections for every
+# perfSONAR services you want to provide. Instead of defining them all here
+# in this file, it is most likely more comfortable to use the following
+# statement to include all files in the subdirectory oppd.d ending with
suffix
+# .conf. In this directory you should put every service into it's own file.
+# But you are, of course, free to do everything your own way!
+#
+###############################################################################
+
+include oppd.d/*.conf
+
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_request.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_request.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_request.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,8 @@
+<nmwg:message id="authNMessage1" type="AuthNEERequest"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="authNMetadata">
+ <nmwg:parameters id="keys">
+ <nmwg:parameter name="SecurityToken"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:data id="authN1" metadataIdRef="authNMetadata"/>
+ </nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_response.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_response.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/Auth_response.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+<nmwg:message id="authNMessage1_resp" messageIdRef="authNMessage1"
type="AuthNEEResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="localhost.localdomain.2c534c44:114b3c44663:-7fcd">
+ <nmwg:eventType>success.as.authn</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="localhost.localdomain.2c534c44:114b3c44663:-7fcc"
metadataIdRef="localhost.localdomain.2c534c44:114b3c44663:-7fcd"/>
+ </nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_KeyRequest.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_KeyRequest.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_KeyRequest.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<nmwg:message type="LSKeyRequest"
+ id="msg1"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters"
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/">
+ <psservice:service id="serviceParameters"
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+ <psservice:serviceName>My_test_MA</psservice:serviceName>
+
<psservice:accessPoint>http://localhost:8080/axis/services/snmpMA</psservice:accessPoint>
+ <psservice:serviceType>MA</psservice:serviceType>
+ <psservice:serviceDescription>This is my testing
MA</psservice:serviceDescription>
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo" />
+
+</nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_deregister.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_deregister.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_deregister.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSDeregisterRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_remove">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_remove" id="data"/> <!-- empty trigger
-->
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_keepalive.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_keepalive.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_keepalive.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,17 @@
+<nmwg:message type="LSKeepaliveRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_keepalive">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ <!--
+ <nmwg:parameter
name="lsKey">5cfb07ea7a5b840ce4f8f48b842ac9c0</nmwg:parameter>
+ -->
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_keepalive" id="d1"/>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_register.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_register.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/etc/oppd.d/LS_register.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSRegisterRequest"
+ id="msg1"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <!--
+
xmlns:nmtl3="http://ogf.org/schema/network/topology/l3/20070828/"
+
xmlns:nmtb="http://ogf.org/schema/network/topology/base/20070828/">
+ -->
+
+ <!-- Contains service description with accessPoint which will be the key
in the database! -->
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters">
+ <psservice:service id="serviceParameters">
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo">
+ </nmwg:data>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/init/default/oppd
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/init/default/oppd
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/init/default/oppd
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,40 @@
+# Path to oppd.
+DAEMON=/usr/lib/perfsonar/services/oppd//bin/oppd.pl
+
+# Configuration file to be used by oppd.
+CONFFILE=/etc/oppd.conf
+
+# pid file to use. The init script overwrites the pid file used (from
+# configuration file or default) to make sure that the init script can
control
+# the daemon via the pid file. Therefore you can change the pid file ONLY
here!
+PIDFILE=/var/run/oppd.pid
+
+# log file to use. If you set a log file here, it will not only be set as the
+# log file used by the daemon (overriding value from configuration file). The
+# daemon will also care about the ownership of the file based on the
variables
+# DAEMONUSER and DAEMONGROUP you can find below.
+LOGFILE=""
+
+# User to run the daemon as. Files (especially the pid file and log file, see
+# above) created by the daemon will be owned by this user.
+#DAEMONUSER=perfsonar
+
+# Group id used for pid file and log file (see above).
+#DAEMONGROUP=perfsonar
+
+# Additional command line arguments (overriding options from configuration
+# file!).
+#DAEMON_ARGS=""
+
+# Time to wait for the daemon to die, in seconds. If this value is set too
low
+# you might not let the daemon die gracefully and 'restart' may not work.
+#DIETIME=30
+
+# Time to wait for the daemon to start, in seconds. If this value is set each
+# time the daemon is started (on start or restart) the script will stall to
try
+# to determine if it is running. If it is not set and the server takes time
+# to setup a pid file the log message might be a false positive (says it did
+# not start when it actually did)
+# Example: STARTTIME=2
+#STARTTIME=""
+
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/oppd
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/oppd
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/oppd
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,183 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: perfsonar-oppd
+# Required-Start: $network $local_fs
+# Required-Stop:
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: oppd (Open Perl PerfSONAR Daemon)
+# Description: oppd (Open Perl PerfSONAR Daemon)
+### END INIT INFO
+
+# Author: WiN-Labor
<>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+NAME=oppd
+# For start-stop-daemon's --name
+SNAME=oppd.pl
+DAEMON=/usr/bin/oppd.pl
+DESC="Open Perl PerfSONAR Daemon"
+
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_ARGS=""
+DIETIME=30
+#STARTTIME=2
+LOGFILE=""
+CONFFILE=/etc/oppd.conf
+DAEMONUSER=perfsonar
+DAEMONGROUP=perfsonar
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Check that the user exists (if we set a user)
+# Does the user exist?
+if [ -n "$DAEMONUSER" ] ; then
+ if getent passwd | grep -q "^$DAEMONUSER:"; then
+ # Obtain the uid and gid
+ DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
+ DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
+ else
+ log_failure_msg "The user $DAEMONUSER, required to run $NAME does not
exist."
+ exit 1
+ fi
+fi
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ touch "$PIDFILE"
+ chown $DAEMONUSER:$DAEMONGROUP "$PIDFILE"
+ if [ -n "$LOGFILE" ]
+ then
+ touch $LOGFILE
+ chown $DAEMONUSER:$DAEMONUSER $LOGFILE
+ DAEMON_ARGS="$DAEMON_ARGS --logfile=$LOGFILE"
+ fi
+
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test
> /dev/null \
+ || return 1
+ if [ -z "$DAEMONUSER" ] ; then
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ else
+ # if we are using a daemonuser then change the user id
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
+ --chuid $DAEMONUSER -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ fi
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
+ pidofproc -p $PIDFILE > /dev/null || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/$DIETIME/KILL/5 --pidfile
$PIDFILE --name $SNAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # oppd takes care about its children. Nevertheless take care about them
here!
+ # Important: The following command will kill more or less all running oppd.
+ #TODO Is this working at all? Or is start-stop-daemon only seeing
+ # /usr/bin/perl ?
+ start-stop-daemon --stop --quiet --oknodo --retry=0/$DIETIME/KILL/5 --exec
$DAEMON
+ [ "$?" = 2 ] && return 2
+ # oppd should delete its pid file, but perhaps it doesn't have the right
+ # to do it!!
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name
$SNAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ #reload|force-reload)
+ #
+ # do_reload() is available above, but not implemented by oppd yet. So leave
+ # this commented out and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ status_of_proc -p $PIDFILE "" $NAME
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}"
>&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/blib/init/init.d/oppd
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Auth.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Auth.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Auth.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,228 @@
+package perfSONAR::Auth;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use perfSONAR qw(print_log);
+
+## Authentication: send Auth-request to server, then proceed.
+# do the following:
+# - get <nmwg:parameter name="SecurityToken"> from header
+# - check <wsse:Security> element
+# - read in template fill in <nmwg:parameter name="SecurityToken">
+# - add $header to message
+# - send message to AS
+# - wait for response from AS (timeout)
+# - parse response from AS for <nmwg:eventType>XXXXXXX</nmwg:eventType>
+# - either respond with error result (see
<nmwg:eventType>XXXXXXX</nmwg:eventType>)
+# - or: go on with normal operation (adding a result code with
+# <nmwg:eventType>XXXXXXX</nmwg:eventType>)
+#
+# TODO:
+# - parse error description from AS (necessary?)
+# - authenticate based on messagetype!! (-> different structure, is this
useful?
+# better: athentication based on service!)
+
+ my $saml_token =
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
+ my $x509_token =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ my $AS_uri =
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService";
+
+
+sub authenticate {
+ my $soapmsg = shift;
+ my $reqmsg =shift;
+ my $as_uri = shift;
+
+ my $token;
+
+ print_log("info", "Authentication:\n");
+ if ((!defined ($soapmsg)) ||
!(UNIVERSAL::isa($soapmsg,"perfSONAR::SOAP::Message"))){
+ croak "No valid message given!\n";
+ }
+ if ((!defined ($as_uri)) || UNIVERSAL::isa($as_uri,"URI")){
+ #croak;
+ $as_uri = $AS_uri; #get default
+ }
+ if (!$soapmsg->header){
+ my $errorstring = "No authentication information in SOAP header!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ return $reqmsg;
+ } else {
+ $token = check_token($soapmsg->header);
+ }
+ if (!(defined $token)) {
+ my $errorstring = "Authentication token in header is missing!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "AuthNEERequest"){ #authorization request
to dummy AS
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "EchoRequest"){ #EchoRequest ping
unauthorized
+ return $reqmsg;
+ }
+ my $authmsg = create_authmsg($token);
+ #clone header TODO: necessary??
+ my @header = clone_header($soapmsg->header);
+ #my @header = $soapmsg->header;
+ #send message to server:
+ my $soap_auth_msg = perfSONAR::SOAP::Message->new(
+ body => $authmsg->as_dom,
+ uri => $AS_uri,
+ header =>
\@header
+ );
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_request-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_msg->as_string;
+ close FH;
+ #/DEBUG
+=cut
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $auth_request = perfSONAR::SOAP::HTTP::Request->new(message =>
$soap_auth_msg);
+ #DEBUG print "auth_reqeust\n";
+ #DEBUG print $auth_request->as_string . "\n";
+ #DEBUG print "auth_request end\n";
+ my $auth_response = $userAgent->request($auth_request);
+
+ my $soap_auth_response = $auth_response->soap_message;
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_response-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_response->as_string;
+ close FH;
+ #/DEBUG
+=cut
+
+
+
+ unless ($auth_response->is_success) {
+ #HTTP error
+ my $code = $auth_response->code();
+ my $description = $auth_response->message();
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "HTTP error: $code,
$description", "message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ $soapmsg->clear_header;
+ if ($soap_auth_response->is_fault){
+ #SOAP error
+ my $description = $soap_auth_response->{fault}->as_string;
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "SOAP error:
$description", "message");
+ return $reqmsg;
+ }
+
+ my $auth_nmwg = NMWG::Message->new( ($soap_auth_response->body)[0] );
+ #print "DEBUG: Return message: \n" . $auth_nmwg->as_string . "\n";
+ if (!$auth_nmwg){
+ my $errorstring = "Authentication failed: No response from
Authentication Service";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ my $event_node =
($auth_nmwg->{dom}->getElementsByLocalName("eventType"))[0];
+ my $auth_event = $event_node->textContent;
+ if ($auth_event ne "success.as.authn") { #some error occured
+ #find description of error
+ my $desc_node = ($auth_nmwg->{dom}->getElementsByLocalName("datum"))[0];
+ my $description = $desc_node->textContent;
+ my $errorstring = "Authentication failed on server: $description";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("$auth_event", "$errorstring", "message");
+ return $reqmsg;
+ }
+ #else just proceed
+ my $returnstring = "Authentication succeded";
+ $reqmsg->return_result_code("$auth_event", "$returnstring", "message");
+}
+
+
+
+sub check_token {
+ my @header = shift;
+ foreach my $entry (@header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ if ($entry->localname =~ /Security/){
+ my @sec_elems = $entry->getChildNodes();
+ foreach my $sec_elem (@sec_elems){
+ next unless (defined $sec_elem->localname);
+ if ($sec_elem->localname =~ /BinarySecurityToken/){
+ return $x509_token;
+ #return $saml_token;
+ } elsif ($sec_elem->localname =~ /Assertion/){
+ return $saml_token;
+ #return $x509_token;
+ }
+ }
+ }
+ }
+ }
+ return undef;
+}
+
+
+sub create_authmsg {
+ my $token = shift;
+
+ #read in template:
+ my $authmsg = NMWG::Message->new();
+ $authmsg->parse_xml_from_file("$FindBin::RealBin/../etc/Auth_request.xml");
+ if (!$authmsg){
+ $authmsg->parse_xml_from_file("/etc/oppd/Auth_request.xml");
+ }
+
+ #set token
+ my $tokennode = ($authmsg->{dom}->getElementsByLocalName("parameter"))[0];
+ if ($tokennode) {
+ $tokennode->appendText("$token");
+ }
+
+ return $authmsg;
+}
+
+sub clone_header {
+ my @orig_header = shift;
+ my @new_header;
+ foreach my $entry (@orig_header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ my $new_entry = $entry->cloneNode(1);
+ unshift @new_header, $new_entry;
+ }
+ }
+ return @new_header;
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Client/LS.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Client/LS.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Client/LS.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,425 @@
+package perfSONAR::Client::LS;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Please make me a proper class! There should be an object for every
service
+# and this class brings everything together.
+# - Replace the usage of $log with something more useful.
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Socket;
+use Socket6;
+
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT);
+ use Exporter;
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.10;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+
#@EXPORT
= qw(heartbeat deregister); # Symbols to autoexport (:DEFAULT
tag)
+}
+
+use NMWG::Message;
+#use perfSONAR qw(print_log);
+
+my $register_template;
+my $deregister_template;
+my $keepalive_template;
+
+
+if (-e "$FindBin::RealBin/../etc/"){
+ $register_template = "$FindBin::RealBin/../etc/LS_register.xml";
+ $deregister_template = "$FindBin::RealBin/../etc/LS_deregister.xml";
+ $keepalive_template = "$FindBin::RealBin/../etc/LS_keepalive.xml";
+} else {
+ $register_template = "/etc/oppd/LS_register.xml";
+ $deregister_template = "/etc/oppd/LS_deregister.xml";
+ $keepalive_template = "/etc/oppd/LS_keepalive.xml";
+}
+
+my $psservice = "http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/";
+my $nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $nmtb = "http://ogf.org/schema/network/topology/base/20070828/";
+my $nmtl3 = "http://ogf.org/schema/network/topology/l3/20070828/";
+my $nmwgr = "http://ggf.org/ns/nmwg/result/2.0/";
+
+our %services = ();
+our (
+ $hostname, $port, $organization, $contact, $log,
+);
+
+our @ls_url = ();
+my %messages;
+
+my $debug_write = 0;
+
+# Setup everything und sent initial registration ("first" heartbeat).
+sub init {
+ my %p = @_;
+ %services = %{$p{services}}; @ls_url = @{$p{ls_url}};
+ $hostname = $p{hostname}; $port = $p{port};
+ $organization = $p{organization}; $contact = $p{contact};
+ $log = $p{log};
+
+ #first registration:
+ foreach my $service (keys %services){
+ create_register_message($service);
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+}
+
+# Send keepalive messages for each service
+sub heartbeat {
+ foreach my $service (keys %messages){ #get services from global hash
+ my $message;
+ if (exists $messages{$service}{"keepalive_msg"}){
+ foreach my $url (@ls_url){
+ $message = $messages{$service}{"keepalive_msg"}->clone();
+ $log->log(
+ level => "notice", service => $service,
+ message => "Sending keepalive for $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "keepalive-response");
+ #TODO What to do if keepalive fails? At the moment: Nothing.
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "Keepalive for $service returend $eventtype:
$datumstring"
+ );
+ } else { #no response...
+ $log->log(
+ level => "notice", service => $service,
+ message => "error sending keepalive for $service: No response
from Lookup Server!"
+ );
+ }
+ }
+ } else { #something went wrong with first registration, otherwise there
would be a keepalive message!
+ #try to send registration message again:
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+ }
+}
+
+
+sub create_register_message{
+ my $service = shift;
+
+ # read in template for LS registration message and fill in module specific
+ # values:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($register_template);
+ my $servicenode = ($message->{dom}->getElementsByTagNameNS("$psservice",
"service"))[0];
+
+ $message->add_element_NS($servicenode, "serviceName",
"$services{$service}->{name}", $psservice);
+ $message->add_element_NS($servicenode, "accessPoint",
"http://$hostname:$port/services/$service", $psservice);
+ $message->add_element_NS($servicenode, "serviceType",
"$services{$service}->{servicetype}", $psservice);
+ $message->add_element_NS($servicenode, "serviceDescription",
"$services{$service}->{description}", $psservice);
+
+ my $datanode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"data"))[0];
+ my $metanode = $message->add_attribute (namespace => $nmwg,
+ parent => $datanode,
+ nodename => "metadata",
+ id => "topo-metadata",
+ );
+ my $subjectnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "subject",
+ id => "topo-subject",
+ );
+ my @addresses = lookup_interfaces();
+
+ my $nodenode = $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $subjectnode,
+ nodename => "node",
+ );
+ foreach my $addr (@addresses) {
+ my $name = lookup_hostname($addr);
+ next unless $name;
+ $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $nodenode,
+ nodename => "name",
+ type => "dns",
+ value => $name,
+ );
+ }
+ foreach my $addr (@addresses) {
+ my $addr_type;
+
+ if ($addr =~ /:/) {
+ $addr_type = "ipv6";
+ } else {
+ $addr_type = "ipv4";
+ }
+
+ my $portnode = $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtl3",
+ parent => $nodenode,
+ nodename => "port",
+ );
+ $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtb",
+ parent => $portnode,
+ nodename => "address",
+ type => $addr_type,
+ value => $addr,
+ );
+ }
+
+ foreach my $et (@{$services{$service}{"eventtype"}}){
+ $message->add_element_NS($metanode, "eventType", "$et", $nmwg);
+ }
+ my $paramnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "parameters",
+ );
+ if (exists $services{$service}->{"keyword"}){
+ my $keywordnode = $message->add_attribute (namespace => $nmwg,
+ parent => $paramnode,
+ nodename =>"parameter",
+ name => "keyword",
+ value =>
$services{$service}->{keyword},
+ );
+ }
+
+
+ if ($service =~/MA/){
+ $services{$service}->{handler}->get_meta_info($message);
+ }
+ $messages{$service}{"register_msg"} = $message;
+}
+
+sub check_response {
+ my $response = shift;
+ my $service = shift;
+
+
+ my ($errorstring, $metaid) = $response->parse_all;
+ if($errorstring){
+ $log->log(level => "notice", service => $service, message =>
$errorstring);
+ }
+ #parse content, write to log if successfull registration or error happened
+ my $eventtype;
+ my $key;
+ foreach my $meta (keys %{$response->{"metadataIDs"}}){
+ $eventtype = $response->{"metadataIDs"}{$meta}{"eventType"};
+ if (!$eventtype =~ /success/){
+ $log->log(
+ level => "notice", service => $service,
+ message => "LS returned $eventtype for service $service"
+ );
+ #return;
+ } else {
+ if ($eventtype =~ /register/){
+ $key = $response->{"metadataIDs"}{$meta}{"key"}{"lsKey"};
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully registered service $service with key $key"
+ );
+ $messages{$service}{"ls_key"} = $key;
+ }
+ }
+ }
+ return $key;
+}
+
+sub create_keepalive_message {
+ my $key = shift;
+
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($keepalive_template);
+ my $paramnode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"parameters"))[0];
+ $message->add_attribute(parent => $paramnode, nodename => "parameter",
value => $key, name => "lsKey");
+ write_message($message, "keepalive");
+ return $message;
+}
+
+sub send_registration {
+
+ my $message = shift;
+ my $service = shift;
+
+ write_message($message, "register");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "registering service $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "register-response");
+ my $key = check_response($response, $service);
+ if ($key){
+ $messages{$service}{"keepalive_msg"} =
create_keepalive_message($key);
+ } else {
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service with $eventtype:
$datumstring"
+ );
+ }
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service: No response from
Lookup Server!"
+ );
+ }
+ }
+}
+
+
+
+sub deregister{
+ #read in deregistration template:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($deregister_template);
+
+ #send deregistration
+ foreach my $service (keys %messages){
+ my $key = $messages{$service}{"ls_key"};
+ if (!$key){
+ $log->log(
+ level => "notice", service => $service,
+ message => "no key for deregistering service $service found!"
+ );
+ next;
+ }
+ my $deregmsg = $message->clone;
+ my $parametersnode = (
+ $deregmsg->{dom}->getElementsByTagNameNS("$nmwg", "parameters")
+ )[0];
+ my $key_parameter = $deregmsg->add_attribute(
+ parent => $parametersnode,
+ nodename => "parameter",
+ name => "lsKey"
+ );
+ $key_parameter->appendText($key);
+ write_message($deregmsg, "deregister");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "deregistering service $service from $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $deregmsg->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "dereg-response");
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully deregistered service $service with key
$key"
+ );
+ #TODO do something interesting with result
+ #$response->parse_meta;
+ #$response->parse_data;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "could not deregister $key: No response from Looukup
Server!"
+ );
+ }
+ }
+ }
+ #lay down to die
+}
+
+sub get_key{
+#TODO not implemented yet
+}
+
+sub re_register{
+#TODO not implemented yet
+}
+
+sub lookup_interfaces {
+ my @ret_interfaces = ();
+
+ open(IFCONFIG, "/sbin/ifconfig |");
+ my $is_eth = 0;
+ while(<IFCONFIG>) {
+ if (/Link encap:([^ ]+)/) {
+ if (lc($1) eq "ethernet") {
+ $is_eth = 1;
+ } else {
+ $is_eth = 0;
+ }
+ }
+ next if (not $is_eth);
+
+ if (/inet \w+:(\d+\.\d+\.\d+\.\d+)/) {
+ push @ret_interfaces, $1;
+ } elsif (/inet6 \w+: (\d*:[^\/ ]*)(\/\d+)? .*:Global/) {
+ push @ret_interfaces, $1;
+ }
+ }
+ close (IFCONFIG);
+ return @ret_interfaces;
+}
+
+sub lookup_hostname {
+ my $ip = shift;
+
+ my $result;
+ if ($ip =~ /:/) {
+ # IPv6
+ $result = gethostbyaddr(inet_pton(AF_INET6, $ip), AF_INET6);
+ } else {
+ # IPv4
+ $result = gethostbyaddr(inet_aton($ip), AF_INET);
+ }
+ return $result;
+}
+
+sub write_message{
+ my $message = shift;
+ my $name = shift;
+
+ if ($debug_write){
+ my $timestamp = time;
+ open (FH, ">", "$name-$timestamp.xml");
+ print FH $message->as_string();
+ close FH;
+ sleep(1);
+ }
+}
+
+
+1;
+
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Echo.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Echo.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/Echo.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,78 @@
+package perfSONAR::Echo;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use perfSONAR qw(print_log %services);
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+my $selftest_et = "http://schemas.perfsonar.net/tools/admin/selftest/1.0";
+my $response_et = "http://schemas.perfsonar.net/tools/admin/selftest/";
+
+my $returnstring = "I'm still alive and happy to talk to you!";
+
+sub handle_echo_request{
+#sub start_action {
+ my $msg = shift;
+ my $service = shift;
+
+ print Dumper($msg->{"metadataIDs"});
+
+ foreach my $key (keys %{$msg->{"metadataIDs"}}){
+ my $et = $msg->{"metadataIDs"}{$key}{"eventType"};
+ if ($et =~ /$echo_et/){
+ #echo request
+ print_log("info", "Reply to EchoRequest ping");
+ $msg->return_result_code("success.echo", "$returnstring", "$key");
+ }
+ elsif ($et =~ /$selftest_et/){
+
+ #my %refs = $services{$service}->{handler}->selftest();
+ my $refs = $services{$service}->{handler}->selftest();
+ if (!$refs){
+ print_log("notice", "error.echo: Action not supported: $et.");
+ $msg->return_result_code("error.echo", "Action not supported: $et.",
$key);
+ return $msg;
+ }
+ foreach my $name (keys %{$refs}){
+ my $ref = $refs->{$name};
+ my ($message, $status) = $services{$service}->{handler}->$ref;
+ print_log("notice", "$message $service");
+ $msg->return_result_code("$response_et$service/$name/$status/1.0",
"$message", "$key", "$name");
+ }
+
+ }
+ else { #some different eventtype, return error
+ $msg->return_result_code("error.echo", "Unknown eventType: $et", $key);
+ return $msg;
+ }
+ #return success message
+ return $msg;
+ }
+
+}
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/MP.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/MP.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/MP.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,189 @@
+package perfSONAR::MP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+BEGIN {
+ use vars qw(@ISA);
+
#@ISA
= qw(SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+ @EXPORT = qw(store check_parameters get_parameters);
+}
+
+
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+use perfSONAR qw(print_log);
+use NMWG;
+use NMWG::Message;
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %param = (@_);
+
+ my $self = {
+ };
+ $self->{"supportedEventtypes"} = [
+ "http://ggf.org/ns/nmwg/ops/store/2.0",
+ ];
+ $self->{"command"} = $param{"command"};
+ $self->{"store"} = $param{"store"};
+ $self->{"store_url"} = $param{"store_url"};
+
+ bless $self, $class;
+ return $self;
+}
+
+sub open_request {
+ #initialize whatever you have to initiliaze
+}
+
+sub close_request{
+ #close request if necessary
+}
+
+
+#obsolete!
+sub set_command {
+ my $self = shift;
+ my $c = shift;
+ $self->{"command"} = $c;
+}
+
+sub selftest {
+ my $self = shift;
+ return undef;
+}
+
+
+sub start_action {
+
+}
+
+
+sub store {
+
+ my $self = shift;
+ my $msg = shift;
+
+ if (!$self->{"store_url"}){
+ $self->print_log_id("error", "Store to MA failed: no url to SQL MA
given!");
+ } else {
+ my $store_msg = $msg->clone;
+ if (!$store_msg){
+ $self->print_log_id("error", "Store to MA failed: Could not clone
storage message.");
+ return;
+ }
+ $store_msg->set_message_type("MeasurementArchiveStoreRequest");
+
+ #my $store_string = $store_msg->as_string(1);
+ #print "$store_string\n";
+
+ my $response = perfSONAR::sendReceive( message => $store_msg,
+ uri => $self->{"store_url"},
+ );
+
+ if ($response){
+ my $result = $response->as_string(2);
+ $self->print_log_id("info", "Answer from SQL MA:\n$result");
+ #print "$result\n"; #TODO parse response?
+ } else {
+ $self->print_log_id("error", "Store to MA failed: No response from SQL
MA!");
+ }
+ }
+}
+
+
+sub get_parameters {
+
+ my $self = shift;
+ my $datablock = shift;
+
+ my %parameters;
+
+ foreach my $key (keys %{$datablock}){ #get eventtypes
+ next if ($key eq "node" || $key eq "metaref" ); #no eventtype
+ foreach my $k (keys %{$datablock->{$key}}){
+ if (!defined $parameters{$k}){
+ if ($k eq "src" || $k eq "dst"){
+ $parameters{$k} = $datablock->{$key}{$k}{"value"};
+ } else {
+ $parameters{$k} = $datablock->{$key}{$k};
+ }
+ }
+ }
+ }
+
+ return %parameters;
+}
+
+
+sub check_parameters {
+
+ my $self = shift;
+ my %params = @_;
+
+ my @unknown;
+ my @unsupported;
+
+
+ foreach my $par (keys %params){
+ next if ($par eq "ns_prefix" ||
+ $par eq "param_ns_prefix" ||
+ $par eq "subject_ns_prefix" ||
+ $par eq "subject_ns_uri" ||
+ $par eq "param_ns_uri" ||
+ $par eq "parameter_ID" ||
+ $par eq "metaID" ||
+ $par eq "address" ||
+ $par eq "metadatakey"
+ );
+ next if exists $self->{"known_parameters"}{$par};
+ if (exists $self->{"unsupported_parameters"}->{$par}){
+ push @unsupported, $par;
+ } else {
+ push @unknown, $par;
+ }
+
+ }
+#TODO
+ if ($#unknown >= 0){
+ my $error = "Unknown parameter(s): " . join (", ", @unknown);
+ return $error;
+ }
+
+ if ($#unsupported >= 0){
+ my $error = "Unsupported parameters(s): " . join (", ", @unsupported);
+ return $error;
+ }
+}
+
+
+sub print_log_id {
+ my ($self, $level,$message) = @_;
+ print_log($level,$message,$self->{"service_id"});
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,83 @@
+package perfSONAR::SOAP::Fault;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+sub new {
+ #TODO Make building a SOAP Fault simple. But which version to choose?
+ #TODO Extract version from Namespaces and load corresponding module
+ # Is this really useful. Is the benefit worth doing such complicated
+ # things?
+ croak "Direct call on perfSONAR::SOAP::Fault not supported (yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($source) = @_;
+ #my $self = {};
+ #bless $self, $class;
+ #return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Fault->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP Fault element here?
+ unless ($self->{dom}->nodeName =~ m/:Fault$/) {
+ croak "Not a valid SOAP fault: Missing element Fault";
+ }
+
+ return $self;
+}
+
+sub from_string {
+ #TODO Do we really need this feature? Should it rather be added somehow
+ # to new method(s).
+ croak "perfSONAR::SOAP::Fault cannot be created from string source
(yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($xml) = @_;
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_1.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_1.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_1.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,273 @@
+package perfSONAR::SOAP::Fault_v1_1;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507
+
+#NOTES
+# Order and number of children of Fault element are not restricted by
+# by SOAP 1.1 specification. We use XPath to get at least what we need...
+# Further we ignore other children, since they are explicitly allowed by
+# specification. It is not clear, whether more than one element is allowed
for
+# the explicitly expected element. This module simply only uses the first one
+# to make parsing fail as seldom as possible.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($faultcode_uri, $faultcode, $faultstring,
+ $faultfactor, $detail, @additional) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ my $ns_soap = $perfSONAR::SOAP::ns_soap11;
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Fault");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+
+ # faultcode and faultstring are obligatory.
+ # Also the elements have to be created here, since other methods expect
them
+ # to exist already.
+ # Btw: namespace of faultcode is optional, because Envelope namespace is
+ # default.
+ unless ($faultcode) {
+ croak "Missing faultcode";
+ }
+ $self->{dom}->addNewChild(undef,"faultcode");
+ $self->faultcode($faultcode_uri,$faultcode);
+ unless ($faultstring) {
+ croak "Missing faultstring";
+ }
+ $self->{dom}->addNewChild(undef,"faultstring");
+ $self->faultstring($faultstring);
+
+ # Now the optional elements:
+ if ($faultfactor) {
+ $self->faultfactor($faultfactor);
+ }
+ if ($detail) {
+ $self->detail($detail);
+ }
+ #TODO Are these "other" elements really useful?
+ if (@additional) {
+ $self->additional(@additional);
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = $class->SUPER::from_dom($dom);
+ bless $self, $class;
+
+ # Check for correct namespace/version:
+ my $ns_soap = $self->{dom}->namespaceURI();
+ unless ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ croak "Invalid namespace for SOAP Fault element";
+ }
+ # Create XPathContext with appropriate namespace
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for necessary elements by retrieving them via our own methods:
+ $self->faultcode;
+ $self->faultstring;
+
+ return $self;
+}
+
+# Default namespace uri is http://schemas.xmlsoap.org/soap/envelope/
+sub faultcode {
+ my $self = shift;
+ my ($ns_uri,$code) = @_;
+
+ # There should really always be a faultcode element and we need it anyway.
+ # -> We can already retrieve it here
+ my $faultcode = $self->{xpc}->findnodes("faultcode")->get_node(1)
+ or croak "Missing faultcode element below Fault element";
+ unless ($ns_uri || $code) {
+ # No arguments => return current content
+ my $content = $faultcode->textContent
+ or croak "Empty faultcode element in SOAP Fault";
+ #TODO Is textContent really correct?
+ $content =~ m/(.+):(.+)/ or croak "Invalid faultcode in SOAP Fault";
+ my $ns_prefix = $1;
+ my $ns_uri = $faultcode->lookupNamespaceURI($ns_prefix)
+ or croak "Cannot determine namespace URI for SOAP Fault faultcode";
+ my $code = $2;
+ return $ns_uri, $code;
+ }
+
+ unless ($code) {
+ croak "faultcode needs at least a text string as second parameter";
+ }
+ $ns_uri ||= $perfSONAR::SOAP::ns_soap11;
+
+ # Set code
+ if ($faultcode->hasChildNodes) {
+ $faultcode->removeChildNodes;
+ }
+ my $ns_prefix = $faultcode->lookupNamespacePrefix($ns_uri);
+ unless ($ns_prefix) {
+ $ns_prefix = "nscode";
+ $faultcode->setNamespace($ns_uri,$ns_prefix,0);
+ }
+ #$faultcode->addChild(
+ # $faultcode->ownerDocument->createTextNode("$ns_prefix:$code")
+ #);
+ $faultcode->appendTextNode("$ns_prefix:$code");
+ return $self;
+}
+
+sub faultstring {
+ my $self = shift;
+ my ($string) = @_;
+
+ # There should really always be a faultstring element and we need it
anyway.
+ # -> We can already retrieve it here
+ my $faultstring = $self->{xpc}->findnodes("faultstring")->get_node(1)
+ or croak "Missing faultstring element below Fault element";
+ unless ($string) {
+ # No arguments => return current content
+ my $content = $faultstring->textContent
+ or croak "Empty faultstring element in SOAP Fault";
+ #TODO Is textContent really correct?
+ return $content;
+ }
+
+ # Set string
+ if ($faultstring->hasChildNodes) {
+ $faultstring->removeChildNodes;
+ }
+ #$faultstring->addChild(
+ # $faultstring->ownerDocument->createTextNode($string)
+ #);
+ $faultstring->appendTextNode($string);
+ return $self;
+}
+
+# TODO Should we check the factor itself somehow? It should be a URI, but
that
+# might lead to unnecessary parsing errors.
+sub faultfactor {
+ my $self = shift;
+ my ($factor) = @_;
+
+ unless ($factor) {
+ # No arguments => return current content
+ my $faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)
+ or return;
+ return $faultfactor->textContent;
+ #TODO Is textContent really correct?
+ }
+
+ # Set factor
+ my $faultfactor;
+ if ($faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)) {
+ if ($faultfactor->hasChildNodes) {
+ $faultfactor->removeChildNodes;
+ }
+ } else {
+ # We have to create the faultfactor element first:
+ $faultfactor = $self->{dom}->ownerDocument->createElementNS(
+ undef, "faultfactor"
+ );
+ $self->{dom}->insertAfter(
+ $faultfactor, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ #$faultfactor->addChild(
+ # $faultfactor->ownerDocument->createTextNode($factor)
+ #);
+ $faultfactor->appendTextNode($factor);
+ return $self;
+}
+
+sub detail {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("detail/*")};
+ }
+
+ # Set detail
+ my $detail;
+ if ($detail = $self->{xpc}->findnodes("detail")->get_node(1)) {
+ if ($detail->hasChildNodes) {
+ $detail->removeChildNodes;
+ }
+ } else {
+ # We have to create the detail element first:
+ $detail = $self->{dom}->ownerDocument->createElementNS(
+ undef, "detail"
+ );
+ $self->{dom}->insertAfter(
+ $detail, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $detail->appendChild($_);
+ }
+ return $self;
+}
+
+#TODO
+# IMPORTANT:
+# This method is only adding additional elements and NOT deleting already
+# existing additional elements! But don't use it anyway!
+sub additional {
+ my $self = shift;
+
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $self->{dom}->appendChild($_);
+ }
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_2.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_2.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Fault_v1_2.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,99 @@
+package perfSONAR::SOAP::Fault_v1_2;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/soap12-part1/#soapfault
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($Values, $Reasons, $Node, $Role, $Detail) = @_;
+=cut
+$Value = [
+
"VersionMismatch"|"MustUnderstand"|"DataEncodingUnknown"|"Sender"|"Receiver",
+ *:*, ....
+];
+$Reason = {
+ <lang> => <text>,
+ ....
+};
+$Node = <uri>;
+$Role = "http://www.w3.org/2003/05/soap-envelope/role/next" | "next" |
+ "http://www.w3.org/2003/05/soap-envelope/role/none" | "none" |
+ "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" |
+ "ultimateReceiver";
+$Detail = [ <nodelist> ];
+=cut
+
+ my $self = {};
+ bless $self, $class;
+ return $self;
+}
+
+#TODO Remove this 1.1 dummy API and "enhance" 1.1 to 1.2
+sub faultcode {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported", "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultstring {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultfactor {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub detail {
+ my $self = shift;
+ if (@_) {
+ return XML::LibXML->new->parse_string("<error>SOAP 1.2 Fault not
supported</error>")->documentElement;
+ } else {
+ return $self;
+ }
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Request.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Request.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Request.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,120 @@
+package perfSONAR::SOAP::HTTP::Request;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Request;
+use perfSONAR::SOAP::Message;
+
+use base 'HTTP::Request';
+
+
+# More or less a wrapper around HTTP::Request->new, setting a lot of defaults
+# useful for SOAP requests.
+# Parameters are set as hash to provide better flexibility and concentrate
more
+# on SOAP requirements.
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ method => "POST",
+ uri => undef,
+ # The HTTP(!) header
+ # If header is a HTTP::Headers object, this object will be used and all
+ # SOAP specific defaults will NOT be set. If header is a plan array
+ # reference, a HTTP::Headers object will be created, all SOAP specific
+ # defaults will be set and finally the values from the array will be set.
+ header => undef,
+ # The SOAP message:
+ message => undef,
+ @_
+ );
+
+ my $header;
+ my @header_defaults = (
+ SOAPAction => '""',
+ pragma => 'no-cache',
+ cache_control => 'no-cache',
+ accept => 'application/soap+xml, application/dime,
multipart/related, text/*',
+ );
+ if (defined $p{header}) {
+ croak("Bad header argument") unless ref $p{header};
+ if (ref($p{header}) eq "ARRAY") {
+ $header = HTTP::Headers->new(@header_defaults, @{$p{header}});
+ } else {
+ $header = $header->clone;
+ }
+ } else {
+ $header = HTTP::Headers->new(@header_defaults);
+ }
+
+ if (defined $p{message}) {
+ unless (UNIVERSAL::isa($p{message},'perfSONAR::SOAP::Message')) {
+ croak "Parameter \"message\" to perfSONAR::SOAP::HTTP::Request " .
+ "must be of type perfSONAR::SOAP::Message";
+ }
+ if (!defined $p{uri}) {
+ $p{uri} = $p{message}->uri;
+ }
+ }
+
+ my $self = $class->SUPER::new($p{method}, $p{uri}, $header);
+
+ $self->protocol("HTTP/1.0");
+
+ bless $self, $class;
+
+ if (defined $p{message}) {
+ $self->soap_message($p{message},1);
+ }
+
+ return $self;
+}
+
+# This method behaves like HTTP::Request::content, but expects one mandatory
+# parameter of type perfSONAR::SOAP::Message instead of a string.
+# This is a one-way method! You can only set a SOAP message!
+# The URI of this object will be set to the URI of the
perfSONAR::SOAP::Message
+# object, if it is set.
+sub soap_message {
+ my $self = shift;
+ my ($message, $do_not_set_uri) = @_;
+
+ unless (UNIVERSAL::isa($message,'perfSONAR::SOAP::Message')) {
+ croak "perfSONAR::SOAP::HTTP::Request->soap_message has to be called" .
+ "with one parameter of type perfSONAR::SOAP::Message";
+ }
+ my $content = $message->as_string;
+ $self->content_length(length($content));
+ if (!$do_not_set_uri && defined $message->uri) {
+ $self->uri($message->uri);
+ }
+ return $self->content($content);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Response.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Response.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/Response.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,52 @@
+package perfSONAR::SOAP::HTTP::Response;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Response;
+
+use base 'HTTP::Response';
+
+
+# This method behaves like HTTP::Response::content, but will croak if an
+# argument is passed!
+# This is a one-way method! You can only get a SOAP message from it, not set
+# it!
+sub soap_message {
+ my $self = shift;
+ my ($message) = @_;
+
+ if (@_) {
+ carp "No parameters allowed for soap_message"
+ if $^W;
+ }
+
+ return perfSONAR::SOAP::Message->from_http_response($self);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+package perfSONAR::SOAP::HTTP::UserAgent;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use LWP::UserAgent;
+
+use base 'LWP::UserAgent';
+
+
+our $timeout = 5000;
+
+
+# More or less a wrapper around LWP::UserAgent->new
+# You can use the same parameters as for LWP::UserAgent->new
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+
+ my $self = $class->SUPER::new(
+ timeout => $timeout, # our own default here
+ @_
+ );
+ bless $self, $class;
+}
+
+sub request {
+ my $self = shift;
+ return bless($self->SUPER::request(@_), 'perfSONAR::SOAP::HTTP::Response');
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Message.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Message.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/Message.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,483 @@
+package perfSONAR::SOAP::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more parsing and checking could be implemented...
+
+#NOTES
+# - Regarding SOAP Faults this module enforces some rules:
+# - There is only one fault allowed in a message
+# - For SOAP 1.2 there is explicitly no other element allowed if the
message
+# contains a Fault element. For SOAP 1.1 this is unsure!
+# It is only explicitly requested if SOAP is used for RPC (See "Using
SOAP
+# for RPC, http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383533)
+# If a message contains a fault, other body elements that might exist are
+# not deleted, but ignored! This should make it possible to stay
+# compatible with "strange" SOAP 1.1 messages that we might have to
parse.
+# But: It is NOT possible to create such a message using this module or
+# add children to the Body element of a Fault message.
+#
+# Important keys of $self hash:
+# dom: The root (aka. Envelope) element. NOT necessarily the Document root.
+# xpc: An XPathContext with context node set to $self->{dom} and the
namespace
+# prefix "soap" set to the correct namespace URI.
+# fault: The corresponding SOAP::Fault object, if message contains a fault.
+# Otherwise the key doesn't exist at all.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use URI;
+use XML::LibXML;
+use XML::LibXML::NodeList;
+
+use perfSONAR::SOAP;
+use perfSONAR::SOAP::Fault;
+use perfSONAR::SOAP::Fault_v1_1;
+use perfSONAR::SOAP::Fault_v1_2;
+
+
+# All parameters optional! Header and body are empty by default. Version
+# defaults to "1.1".
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ header => undef, body => undef, fault => undef,
+ uri => undef, version => "1.1",
+ @_
+ );
+
+ my $self = {};
+ bless $self, $class;
+
+ # Set version
+ $self->version($p{version});
+ # We don't care about versions from header or body!
+ my $ns_soap = $perfSONAR::SOAP::version2ns{$self->version};
+
+ # Set URI
+ $self->uri($p{uri}) if defined $p{uri};
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Envelope");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # We always need a Body element:
+ $self->{dom}->addNewChild($ns_soap,"Body");
+
+ # Now we add the (optional) head
+ if (defined $p{header}) {
+ unless (ref($p{header}) eq "ARRAY") {
+ croak "Parameter \"header\" of perfSONAR::SOAP::Message->new must be "
.
+ "a list of XML::LibXML::Node objects";
+ }
+ if (@{$p{header}}) {
+ $self->header($p{header});
+ }
+ }
+
+ # Fault needs more thinking:
+ if (defined $p{body}) {
+ if (defined $p{fault}) {
+ croak
+ "perfSONAR::SOAP::Message::new needs either body or fault, not
both!";
+ }
+ # Body, no fault
+ $self->body($p{body});
+ } elsif (defined $p{fault} && $p{fault}->isa('perfSONAR::SOAP::Fault')) {
+ # No body, but fault
+ $self->fault($p{fault});
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom,$uri) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Message->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP envelope?
+ unless ($self->{dom}->nodeName =~ m/:Envelope$/) {
+ croak "Not a valid SOAP message: Missing element Envelope";
+ }
+
+ # First determine SOAP version and create XPathContext with appropriate
+ # namespace:
+ my $version;
+ my $ns_soap = $self->{dom}->namespaceURI;
+ if ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ $version = "1.1";
+ } elsif ($ns_soap eq $perfSONAR::SOAP::ns_soap12) {
+ $version = "1.2";
+ } else {
+ #TODO SOAP Fault: VersionMismatch
+ croak "Not a valid SOAP message: Unknown namespace";
+ }
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for the necessary body element:
+ unless ($self->{xpc}->findnodes("soap:Body")->size == 1) {
+ croak "Not a valid SOAP message: Missing element Body";
+ }
+
+ # Set uri and version
+ $self->uri($uri) if defined $uri;
+ $self->version($version); # We don't care about versions from header or
body!
+
+ # Handle faults
+ if (
+ my @faults = $self->{xpc}->findnodes("soap:Body/soap:Fault")
+ ) {
+ my $fault_src = shift @faults;
+ if (@faults) {
+ croak "More than one Fault element not allowed in SOAP Message";
+ }
+ $self->fault($fault_src);
+ }
+
+ #TODO Check for "invalid" elements?
+
+ return $self;
+}
+
+sub from_string {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($source,$uri) = @_;
+
+ croak "No XML source to parse" unless $source;
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($source);
+ };
+ if ($@){
+ #TODO Make me a special Exception!
+ croak "Error parsing message: $@";
+ }
+ #TODO Is the following really needed, or is already implicitly handled
above?
+ unless (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ croak "First argument to perfSONAR::SOAP::Message->from_libxml " .
+ "must be a valid XML string\n";
+ }
+ return $class->from_dom($dom,$uri);
+}
+
+sub from_http_request {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($request) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($request,"HTTP::Request")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_request"
+ . " must be of type HTTP::Request\n";
+ }
+
+ my $content = $request->content;
+ my $uri = $request->uri;
+ #DEBUG print "HTTP request URI: $uri\n";
+ #DEBUG print "HTTP request content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+sub from_http_response {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($response) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($response,"HTTP::Response")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_response"
+ . " must be of type HTTP::Response\n";
+ }
+
+ my $content = $response->content;
+ my $uri = $response->base;
+ #DEBUG print "HTTP response URI: $uri\n";
+ #DEBUG print "HTTP response content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+
+# Converts a list to DOM nodes (e.g. body or header content).
+# Parameters are a mixed list of:
+# - Array reference (will be flattened)
+# - XML::LibXML::Node (will be included directly)
+# - XML::LibXML::NodeList (Nodes in list will be included directly)
+# - String (will be parsed as XML Document and root Element will be included)
+sub _prepare_nodes {
+ my @result = (); # the result list
+ my @sources = (); # the flattened intermediate step
+ foreach my $entry (@_) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::NodeList")) {
+ push @sources, $entry->get_nodelist;
+ } elsif (ref($entry) eq "ARRAY") {
+ push @sources, @{$entry};
+ } else {
+ push @sources, $entry;
+ }
+ }
+ foreach my $entry (@sources) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Document")) {
+ # Special case: Although Document is also a Node, appendChild is not
+ # working. This should always work:
+ push @result, $entry->documentElement;
+ } elsif (UNIVERSAL::isa($entry,"XML::LibXML::Node")) {
+ push @result, $entry;
+ } else {
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($entry);
+ };
+ if ($@){
+ croak "Error parsing XML source: $@";
+ }
+ push @result, $dom->documentElement();
+ }
+ }
+ return @result;
+}
+
+# No parameter: Header will be returned as list of XML::LibXML::Node.
+sub header {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("soap:Header/*")};
+ }
+
+ # Set header
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ } else {
+ # We have to create the Header element first:
+ $header = $self->{dom}->ownerDocument->createElementNS(
+ $self->{dom}->namespaceURI(), "Header"
+ );
+ $self->{dom}->insertBefore(
+ $header, $self->{xpc}->findnodes("soap:Body")->get_node(1)
+ );
+ }
+ foreach (_prepare_nodes(@_)) {
+ $header->appendChild($_);
+ }
+ return $self;
+}
+
+sub clear_header {
+ my $self = shift;
+
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ }
+ return $self;
+}
+
+# No parameter: Body will be returned as list of XML::LibXML::Node.
+# If one of the parameters is a Fault element, all other elements are ignored
+# and the message becomes a Fault message.
+sub body {
+ my $self = shift;
+
+ unless (@_) {
+ return undef if exists $self->{fault};
+ return @{$self->{xpc}->findnodes("soap:Body/*")};
+ }
+
+ my @nodes = _prepare_nodes(@_);
+
+ # Check whether one of the nodes is a Fault element.
+ # If so, we will ignore all others and use $self->fault to turn message
+ # into a Fault message! We will use only the first Fault element and ignore
+ # all other.
+ foreach my $node (@nodes) {
+ next unless $node->nodeName =~ m/:Fault$/;
+ next unless $node->namespaceURI eq
+ $perfSONAR::SOAP::version2ns{$self->version};
+ $self->fault($node);
+ return $self;
+ }
+
+ # Set body
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ foreach (@nodes) {
+ $body->appendChild($_);
+ }
+ delete $self->{fault} if exists $self->{fault}; # Now we have a correct
body!
+
+ return $self;
+}
+
+# This internal sub is the simple way to set a SOAP Fault. It sets the
+# SOAP fault that is already in the message...
+# It only works with a DOM node as parameter and does neither import this
node
+# nor put it "to the right place".
+sub _fault {
+ my $self = shift;
+ my $source = shift;
+
+ if ($self->{version} eq "1.1") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_1->from_dom($source);
+ } elsif ($self->{version} eq "1.2") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_2->from_dom($source);
+ } else {
+ croak "Cannot determine version of SOAP message";
+ }
+ return $self;
+}
+
+sub fault {
+ my $self = shift;
+ my $source = shift;
+
+ if (!defined($source)) {
+ return $self->{fault};
+ }
+
+ if (UNIVERSAL::isa($source,'perfSONAR::SOAP::Fault')) {
+ if (
+ ($source->isa('perfSONAR::SOAP::Fault_v1_1') && ($self->version eq
"1.2"))
+ ||
+ ($source->isa('perfSONAR::SOAP::Fault_v1_2') && ($self->version eq
"1.1"))
+ ) {
+ croak "Version of SOAP Fault not matching version of SOAP Message";
+ }
+ $self->{fault} = $source;
+ } elsif (UNIVERSAL::isa($source,'XML::LibXML::Node')) {
+ $self->_fault($source);
+ } else {
+ croak "Invalid parameter for perfSONAR::SOAP::Message->fault";
+ }
+
+ # Now add fault to Body element (deleting all other elements!)
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ $body->appendChild($self->{fault}->{dom});
+
+ return $self;
+}
+
+# Only for convenience
+sub is_fault {
+ my $self = shift;
+
+ return exists $self->{fault};
+}
+
+sub uri {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return $self->{uri};
+ } elsif (UNIVERSAL::isa($uri,"URI")) {
+ $self->{uri} = $uri;
+ } elsif (my $u = URI->new($uri)) {
+ unless (UNIVERSAL::isa($u,"URI")) {
+ croak "Invalid URI: $uri\n";
+ }
+ $self->{uri} = $u;
+ } else {
+ croak "Invalid URI: $uri";
+ }
+ #TODO Check $uri further?
+ return $self;
+}
+
+sub uri_string {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return unless defined $self->{uri};
+ return $self->{uri}->as_string;
+ } else {
+ $self->uri($uri);
+ }
+ return $self;
+}
+
+# Does NOT convert a message from 1.1 to 1.2 or vice versa!
+# This is difficult (e.g. regarding Faults), but might be added in the
+# future...
+sub version {
+ my $self = shift;
+ my $version = shift;
+ if (!defined($version)) {
+ return $self->{version};
+ } elsif ($version eq "1.1") {
+ $self->{version} = "1.1";
+ } elsif ($version eq "1.2") {
+ $self->{version} = "1.2";
+ } else {
+ croak "Unknown SOAP version: $version";
+ }
+ return $self;
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->{dom}->toString;
+}
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+package perfSONAR::SOAP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more feature of SOAP that could be implemented...
+# (http://www.w3.org/TR/soap/)
+# E.g. the "application/soap+xml" media type
+# (http://www.ietf.org/rfc/rfc3902.txt)
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+our $ns_soap11 = 'http://schemas.xmlsoap.org/soap/envelope/';
+our $ns_soap12 = 'http://www.w3.org/2003/05/soap-envelope';
+our %version2ns = (
+ 1.1 => $ns_soap11,
+ 1.2 => $ns_soap12,
+);
+our %ns2version = (
+ $ns_soap11 => "1.1",
+ $ns_soap12 => "1.2",
+);
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,269 @@
+package perfSONAR;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+ use Exporter;
+
#@ISA
= qw(Exporter SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.51;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+ @EXPORT = qw(); # Symbols to autoexport (:DEFAULT tag)
+ @EXPORT_OK = qw(print_log %services); # Symbols to export on request
+ %EXPORT_TAGS = qw(); # Define names for sets of symbols
+ # eg: TAG => [ qw(name1 name2) ],
+}
+
+use Carp;
+
+use perfSONAR::SOAP::HTTP::Request;
+use perfSONAR::SOAP::HTTP::Response;
+use perfSONAR::SOAP::HTTP::UserAgent;
+#use perfSONAR::Echo;
+use NMWG;
+use NMWG::Message;
+
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+
+sub handle_request {
+ my $class = shift; # TODO
+ my ($uri,$reqmsg) = (@_);
+ my $xmlmsg = $reqmsg->as_string;
+ print_log("info","Received message");
+ print_log("debug","Raw Message:\n$xmlmsg");
+ #print_log("debug","Parsed Message:\n" . Dumper($reqmsg));
+ # How to print DOM tree? Useful???
+
+ my $service = undef;
+
+ #if no accesspoint is given we do not know what service is meant!
+ if (!$uri){
+ croak "No service specified!";
+ } else {
+ ($service = $uri) =~ s/^.*\/services\///;
+ $service =~ s/\/$//;
+ my $serviceurl = $service;
+ print_log("info", "Service: $service");
+ if (!$services{$service}){
+ croak "Service $serviceurl not known!";
+ }
+ }
+
+ my @module_ets =
@{$services{$service}->{"handler"}->{"supportedEventtypes"}};
+ push @module_ets, $echo_et;
+
+
+ my $messagetype = $reqmsg->get_message_type();
+ if ($messagetype eq "ErrorResponse"){ #error from authentication!
+ return $reqmsg;
+ }
+ if ($messagetype eq "AuthNEERequest"){ #authorization rquest to dummy AS
+ require perfSONAR::AS;
+ return perfSONAR::AS::dummy();
+ }
+ if ($messagetype eq "SetupDataRequest"){
+ $reqmsg->set_message_type("SetupDataResponse");
+ }
+ elsif ($messagetype eq "MeasurementRequest"){
+ $reqmsg->set_message_type("MeasurementResponse");
+ }
+ elsif ($messagetype eq "MetadataKeyRequest"){
+ $reqmsg->set_message_type("MetadataKeyResponse");
+ }
+ elsif ($messagetype =~ /EchoRequest/){
+ $reqmsg->set_message_type("EchoResponse");
+ }
+ else {
+ my $errorstring = "Unknown messagetype: $messagetype";
+ print_log("info",$errorstring);
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.common.action_not_supported",
"$errorstring", "message");
+ return $reqmsg;
+ }
+
+ #create $reqmsg->{"dataIDs"} and
+ # $reqmsg->{"metadataIDs"} hashes from document
+ my ($errorstring, $metaid) = $reqmsg->parse_all;
+
+ if($errorstring){
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #check if at least one metadata and one data element is in message
+ if(!($reqmsg->{"metadataIDs"})){
+ $errorstring = "No metadata definition in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ if(!(defined $reqmsg->{"dataIDs"})){
+ $errorstring = "No data trigger in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ #do some checks on metadata content
+ foreach my $meta (keys %{$reqmsg->{"metadataIDs"}}){
+ #check for unknown eventTypes
+ my $et = $reqmsg->{"metadataIDs"}{$meta}{"eventType"};
+ if ($et =~ /admin/){ #dispatch to Echo module
+ return perfSONAR::Echo::handle_echo_request($reqmsg, $service);
+ return $reqmsg;
+ }
+
+ my $found = undef;
+ #foreach my $sup_et (@{$services{$service}{"eventtype"}}){
+ foreach my $sup_et (@module_ets){
+ next unless ($sup_et =~ /$et/);
+ $found = 1;
+ }
+ if (!defined $found){
+ my $errorstring = "Unknown eventType: $et";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ #check times
+ my $startTime = $reqmsg->{"metadataIDs"}{$meta}{"startTime"};
+ my $endTime = $reqmsg->{"metadataIDs"}{$meta}{"endTime"};
+ if ($endTime && $startTime && ($endTime < $startTime)){
+ my $errorstring = "Illegal time duration specified: " .
+ "$endTime is later than $startTime!";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ }
+
+ #add metadata parameters to data hashes
+ ($errorstring, $metaid) = $reqmsg->concatenate_params;
+ if ($errorstring){
+ print_log("info", $errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #DEBUG output:
+ print Dumper ($reqmsg->{"dataIDs"});
+ #print Dumper ($reqmsg->{"metadataIDs"});
+
+
+ #initialize data module
+ $services{$service}->{handler}->open_request();
+
+ #start action for each data block
+ foreach my $dataid (keys %{$reqmsg->{"dataIDs"}}){
+ $services{$service}->{handler}->start_action($reqmsg, $dataid, $service);
+ }
+
+ $services{$service}->{handler}->close_request();
+
+ return $reqmsg;
+}
+
+
+sub sendReceive {
+ my %p = (
+ message => undef,
+ host => "localhost",
+ port => "8090",
+ endpoint => "/",
+ uri => "",
+ soapheader => "", #TODO TODO noch nicht fertig und kein String!
+ @_
+ );
+
+ my $uri = $p{uri} || "http://$p{host}:$p{port}$p{endpoint}";
+ my $body = $p{message}->as_dom;
+
+ # Message is NMWG::Message
+ my $message = perfSONAR::SOAP::Message->new(
+ body => $body,
+ uri => $uri
+ );
+ # Modify SOAP header using $message or set via "new" call directly
+
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $request = perfSONAR::SOAP::HTTP::Request->new(message => $message);
+
+ my $response = $userAgent->request($request);
+ unless ($response->is_success) {
+ # HTTP error
+ #my $code = $response->code();
+ #my $message = $response->message();
+ carp $response->status_line if $^W; # "<code> <message>"
+ return;
+ }
+
+ my $soap_message = $response->soap_message;
+ if ($soap_message->is_fault) {
+ carp "TODO" if $^W;
+ return;
+ }
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO This should perhaps be
NMWG::Message->from_soap_message($soap_message);
+
+ return $nmwg_message;
+}
+
+
+sub print_log_old {
+ my ($level,$message) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, message => $message);
+ } else {
+ print STDERR "$level: $message\n";
+ }
+ return 1;
+}
+
+sub print_log {
+ my ($level,$message,$service) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, service => $service, message => $message);
+ } else {
+ print STDERR ($service ? "$service: " : "unknown service: ") .
+ "$level: $message\n";
+ }
+ return 1;
+}
+1;
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/blib/lib/perfSONAR.pm
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/blib/script/oppd.pl
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/blib/script/oppd.pl
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/blib/script/oppd.pl 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,1450 @@
+#!/usr/bin/perl
+
+eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+ if 0; # not running under some shell
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# See embedded POD below for further information
+
+# TODO
+# - Check config statements (die if multiple logfile statements in config
etc.)
+# - Detect and remove orphaned PID file! Or should it be done in init
scripts?
+# - LS registration options
+# - ls_register and ls_url should be somehow merged and made configurable
for
+# every service individually
+# - Use a decent default for the hostname sent to the LS
+# - hostname, organization and contact should perhaps get an ls_ prefix?
+# - Fail like on missing ls options like on missing ssl options
+# - AS options
+# - auth and as_url should be somehow merged and made configurable for
+# every service individually
+# - Should there be a timeout for processing a request?
+# - Catch more signals? Set to IGNORE or treat them like TERM/INT?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+# Commen modules for all Hades/oppd daemons:
+use locale;
+use POSIX qw(setsid setpgid :sys_wait_h);
+use Log::Dispatch;
+use Log::Dispatch::File;
+use Log::Dispatch::Syslog;
+use Log::Dispatch::Screen;
+use Getopt::Long 2.32 qw(:config auto_help auto_version bundling);
+use Pod::Usage;
+use Config::General;
+# DateTime not needed by now, but this would be necessary, because Hades.pm
is
+# NOT loaded.
+#use DateTime;
+#use DateTime::Locale;
+#BEGIN {
+# if (DateTime::Locale->load(setlocale(LC_TIME))) {
+# DateTime->DefaultLocale(setlocale(LC_TIME));
+# }
+#}
+
+# Modules for this daemon:
+use File::Spec;
+use Socket;
+use HTTP::Daemon;
+#use HTTP::Daemon::SSL qw(debug3);
+#$Net::SSLeay::trace = 2;
+use HTTP::Daemon::SSL;
+use HTTP::Response;
+
+use NMWG;
+use perfSONAR;
+use perfSONAR::Echo;
+use perfSONAR::SOAP::Message;
+use perfSONAR::Client::LS;
+
+use vars qw($VERSION);
+$VERSION = 0.51;
+
+#
+# Important variables that should be available and initialised before the
+# (possible) execution of the END block
+#
+my (
+ $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ $shutting_down
+);
+INIT {
+ $proc_type = "main"; # Some code is executed by all childrens that fork
and
+ # do not exec afterwards. So we have to know
+ # what to do exactly.
+ # See e.g. END block and signal handlers for possible
+ # values.
+ $pidfile_ok = 0; # Care about existing pidfile in END
+ $log = Log::Dispatch->new();
+ # We also need the Log::Dispatch object for option verification quite
early
+ $log_prefix = ""; # Prepended to log message if set. This is intended for
+ # child processes and should not be "missused"!
+ $shutdown_gracefully = 0; # END called without signal is like SIGTERM !!
+ #TODO Use another default?
+ $shutting_down = 0; # This is set directly after entering the END block.
+ # Can be used to determine whether the process is
+ # going down at the moment. Important e.g. in signal
+ # handlers!
+}
+
+
+#
+# Parse Configuration (commandline and file)
+#
+
+my (
+ $configfile, $noconfig,
+ $detach, $syslog, $logfile, $nologfile, $pidfile, $nopidfile,
+ $loglevel, $verbose, $syslog_host, $syslog_ident, $syslog_facility,
+ $ls_register, $keepalive, $max_proc,
+ @ls_url, $auth, $as_url,
+ $hostname, $port, $organization, $contact,
+ $ssl, $ssl_cert_file, $ssl_key_file, $ssl_ca_file, $ssl_ca_path,
+ $ssl_verify_client, $ssl_trusted_webserver_cn,
+);
+
+my %services;
+my %messages;
+my %lsKeys;
+
+GetOptions(
+ "config=s" => \$configfile,
+ "noconfig" => \$noconfig,
+ "detach|D!" => \$detach,
+ "logfile:s" => \$logfile,
+ "nologfile" => \$nologfile,
+ "pidfile:s" => \$pidfile,
+ "nopidfile" => \$nopidfile,
+ "syslog!" => \$syslog,
+ "syslog-host=s" => \$syslog_host,
+ "syslog-ident=s" => \$syslog_ident,
+ "syslog-facility=s" => \$syslog_facility,
+ "loglevel=s" => \$loglevel,
+ "verbose|v" => \$verbose,
+ "register!" => \$ls_register,
+ "keepalive=i" => \$keepalive,
+ "max_proc=i" => \$max_proc,
+ "port=s" => \$port,
+ "auth!" => \$auth,
+ "as_url=s" => \$as_url,
+ "ssl!" => \$ssl,
+ "ssl-cert-file=s" => \$ssl_cert_file,
+ "ssl-key-file=s" => \$ssl_key_file,
+ "ssl-ca-file=s" => \$ssl_ca_file,
+ "ssl-ca-path=s" => \$ssl_ca_path,
+ "ssl-verify-client!" => \$ssl_verify_client,
+ "ssl-trusted-webserver-cn=s" => \$ssl_trusted_webserver_cn,
+) or pod2usage(2);
+
+# Determine and load config file
+my %Config = ();
+my $Config;
+if ($noconfig) {
+ $configfile = undef;
+} else {
+ #$configfile ||= "$FindBin::RealBin/../etc/oppd.conf";
+ $configfile ||= "/etc/oppd.conf";
+ $Config = Config::General->new(
+ -ConfigFile => $configfile,
+ -ApacheCompatible => 1,
+ #-AllowMultiOptions => 'no', # enable for EGEE because no LS is used
+ -AutoTrue => 1, # Could bring in some trouble, but it is really nice
;)
+ -IncludeGlob => 1, # We want to allow something like include
oppd.d/*.conf
+ -IncludeRelative => 1, # Especially useful with -IncludeGlob
+ -CComments => 0, # Parsing is obviously broken in 2.36!
+ # Comments are found everywhere...
+ );
+ %Config = $Config->getall;
+}
+
+
+#
+# Calculate options
+# First not "undef" value is used.
+# Order: command line, config file, default
+#
+$detach = get_opt($detach, $Config{detach}, 1);
+$nologfile = get_opt($nologfile, 0); # No nologfile entry in config file!
+if ($nologfile) {
+ $logfile = undef;
+} else {
+ $logfile = get_opt($logfile, $Config{logfile}, 0);
+ if (!$logfile && $logfile ne "") {
+ # logfile disabled
+ $logfile = undef;
+ } elsif ($logfile eq "1" || $logfile eq "") {
+ # logfile enabled in configuration file or via --logfile without value
+ $logfile = "/var/log/oppd.log";
+ }
+}
+$nopidfile = get_opt($nopidfile, 0); # No nopidfile entry in config file!
+if ($nopidfile) {
+ $pidfile = undef;
+} else {
+ $pidfile = get_opt($pidfile, $Config{pidfile}, 1);
+ if (!$pidfile && $pidfile ne "") {
+ # pidfile disabled
+ $pidfile = undef;
+ } elsif ($pidfile eq "1" || $pidfile eq "") {
+ # pidfile enabled in configuration file or via --pidfile without value
+ $pidfile = "/var/run/oppd.pid";
+ }
+}
+$syslog = get_opt($syslog, $Config{syslog}, 0);
+$syslog_host = get_opt($syslog_host, $Config{'syslog-host'}, "");
+$syslog_ident =
+ get_opt($syslog_ident, $Config{'syslog-ident'}, "oppd");
+$syslog_facility =
+ get_opt($syslog_facility, $Config{'syslog-facility'}, "daemon");
+$loglevel = get_opt($loglevel, $Config{loglevel}, "notice");
+$verbose = get_opt($verbose, 0); # No verbose entry in config file!
+if ($verbose) {
+ $loglevel = "info";
+} else {
+ pod2usage( { -message => "Invalid log level: $loglevel",
+ -exitval => 2 } ) unless $log->level_is_valid($loglevel);
+}
+#$ls_url = get_opt($ls_url, $Config{ls_url}, "");
+#LS URL can be one or more, take care of that:
+my $ls_opt = $Config{ls_url};
+if(ref($ls_opt) eq "ARRAY"){
+ @ls_url = @{$ls_opt};
+} else {
+ @ls_url = ($ls_opt);
+}
+$ls_register = get_opt($ls_register, $Config{ls_register}, 0);
+$keepalive = get_opt($keepalive, $Config{keepalive}, 3600);
+$max_proc = get_opt($max_proc, $Config{max_proc}, 5);
+$hostname = get_opt($hostname, $Config{hostname}, 0);
+$port = get_opt($port, $Config{port}, 8090);
+$organization = get_opt($organization, $Config{organization}, 0);
+$contact = get_opt($contact, $Config{contact}, 0);
+$auth = get_opt($auth, $Config{auth}, 0);
+$as_url = get_opt($as_url, $Config{as_url}, "");
+$ssl = get_opt($ssl, $Config{ssl}, 0);
+$ssl_cert_file = get_opt($ssl_cert_file, $Config{ssl_cert_file}, "");
+$ssl_key_file = get_opt($ssl_key_file, $Config{ssl_key_file}, "");
+$ssl_ca_file = get_opt($ssl_ca_file, $Config{ssl_ca_file}, "");
+$ssl_ca_path = get_opt($ssl_ca_path, $Config{ssl_ca_path}, "");
+$ssl_verify_client =
+ get_opt($ssl_verify_client, $Config{ssl_verify_client}, 1);
+$ssl_trusted_webserver_cn =
+ get_opt($ssl_trusted_webserver_cn, $Config{ssl_trusted_webserver_cn}, "");
+
+#TODO The following parameters need to be configurable by the user or changed
+my $max_conn = $max_proc;
+my $conn_timeout = 30;
+my $gracetime = 30; # Really usefull as a parameter?
+#/TODO
+
+if ($ssl) {
+ # We don't want defaults for the SSL related files, but warn instead that
+ # something is wrong.
+ # We also need to care at least whether $ssl_ca_path really exists, because
+ # the module will only spit out a useless warning and then oppd will die.
+ # Therefore you can find a lot of file test operators below...
+ unless ($ssl_cert_file) {
+ pod2usage(
+ "No SSL certificate specified. Use --ssl-cert-file or edit config
file."
+ );
+ }
+ unless (-f $ssl_cert_file) {
+ die "SSL certificate ($ssl_cert_file) not found\n";
+ }
+ unless(-r _) {
+ die "SSL certificate ($ssl_cert_file) not readable\n";
+ }
+ unless ($ssl_key_file) {
+ pod2usage(
+ "No SSL key specified. Use --ssl-key-file or edit config file."
+ );
+ }
+ unless (-f $ssl_key_file) {
+ die "SSL key file ($ssl_key_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL key file ($ssl_key_file) not readable\n";
+ }
+ unless ($ssl_ca_file || $ssl_ca_path || !$ssl_verify_client) {
+ pod2usage(
+ "No client certificate specified.\n" .
+ "Use --ssl-ca-file, --ssl-ca-path, or edit config file.\n" .
+ "If you know what you are doing you can also disable client
authentication\n" .
+ "by using --no-ssl-verify-client or editing config file
appropriately.\n"
+ );
+ }
+ if ($ssl_verify_client) {
+ if ($ssl_ca_file) {
+ unless (-f $ssl_ca_file) {
+ die "SSL client certificate file ($ssl_ca_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate file ($ssl_ca_file) not readable\n";
+ }
+ }
+ if ($ssl_ca_path) {
+ unless (-d $ssl_ca_path) {
+ die "SSL client certificate path ($ssl_ca_path) not a directory\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate path ($ssl_ca_path) not readable\n";
+ }
+ }
+ }
+}
+
+unless (
+ defined($Config{service}) && ref($Config{service}) eq "HASH"
+ && %{$Config{service}}
+) {
+ pod2usage(
+ "No services specified in config file"
+ );
+}
+%services = %{$Config{service}};
+
+
+#
+# Start logging ($log already initialised above)
+#
+
+$perfSONAR::log = $log;
+
+if (defined $logfile) {
+
+ #check if $logfile is an absolute path, and add current path if not
+ if (!File::Spec->file_name_is_absolute($logfile)){
+ $logfile = File::Spec->rel2abs($logfile);
+ }
+
+ eval {
+ use locale;
+ use POSIX qw(locale_h strftime);
+ # "use locale", POSIX::strftime and localtime faster than DateTime
+ # and this has quite an impact on debug loging. Detected via SmokePing:
+ # http://perfsonar.acad.bg/smokeping
+ #use DateTime;
+ #use DateTime::Locale;
+ #BEGIN {
+ # if (DateTime::Locale->load(setlocale(LC_TIME))) {
+ # DateTime->DefaultLocale(setlocale(LC_TIME));
+ # }
+ #}
+ $log->add(
+ Log::Dispatch::File->new(
+ name => 'file',
+ min_level => $loglevel,
+ filename => $logfile,
+ mode => 'append', close_after_write => 1, autoflush => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = strftime("%FT%T",localtime) . " $p{level}
$p{message}";
+ #DateTime->now(time_zone=>"local")->strftime("%c") .
+ return "$p{message}\n";
+ },
+ )
+ );
+ };
+ die "Cannot write to log file '$logfile':
$@\n"
if $@;
+}
+if ($syslog) {
+ eval {
+ my $syslog_socket = 'unix';
+ if ($syslog_host) {
+ $Sys::Syslog::host = $syslog_host;
+ $syslog_socket = 'inet';
+ }
+ $log->add(
+ Log::Dispatch::Syslog->new(
+ name => 'syslog',
+ min_level => $loglevel,
+ ident => "$syslog_ident",
+ facility => "$syslog_facility",
+ socket => "$syslog_socket",
+ logopt => "ndelay",
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ #TODO Not nice! How can we change this?
+ # callback for SD stuff
+ if ($p{service}) {
+ $p{service} =~ s/\//\_/g;
+ $p{service} .= ".";
+ } else {
+ $p{service} = "";
+ }
+ $p{message} = "OPPD." . $p{service} . uc($p{level}) . "%
$p{message}";
+ #/TODO
+ return "$p{message}\n";
+ },
+ #mode => 'append', close_after_write => 0, autoflush => 1,
+ )
+ );
+ };
+ die "Cannot write to syslog:
$@\n"
if $@;
+}
+unless ($detach) {
+ $log->add(
+ Log::Dispatch::Screen->new(
+ name => 'screen',
+ min_level => $loglevel,
+ stderr => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = "$p{level}: $p{message}";
+ return "$p{message}\n";
+ },
+ )
+ );
+}
+
+# More flexible die:
+# Put error into Log and afterwards die with same message.
+# Also handy, because in the following code $@ is undef in die call:
+# $log->error($@); die $@;
+$SIG{__DIE__} = sub {
+ die @_ if $^S; # Ignore dies from evals
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->error($logmsg) if defined $log &&
UNIVERSAL::isa($log,'Log::Dispatch');
+ die @_;
+};
+
+# More flexible warn:
+# Put error into Log and afterwards warn with same message.
+$SIG{__WARN__} = sub {
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->warning($logmsg)
+ if defined $log && UNIVERSAL::isa($log,'Log::Dispatch');
+ warn @_;
+};
+
+
+#
+# Load Authentication module for AA
+#
+
+if ($auth){
+ if ($as_url eq ""){
+ die ("Authentication not possible: variable $as_url not set!\n");
+ }
+ eval require perfSONAR::Auth;
+ if ($@){
+ die ("Error loading module perfSONAR::Auth:
$@\n");
+ }
+}
+
+#
+# Load data modules for services
+#
+
+foreach my $service (keys %services){
+ my $module = $services{$service}->{module};
+ eval "require perfSONAR::$module";
+ if ($@){
+ die "Error loading module perfSONAR::$module:
$@\n";
+ }
+ $services{$service}->{handler} =
+ "perfSONAR::$module"->new(%{$services{$service}->{module_param}});
+}
+
+# Set modules in dispatch module/class:
+%perfSONAR::services = %services;
+
+#
+# Daemonize
+#
+
+#First check pidfile path to be absolute!
+if ($pidfile){
+ if (!File::Spec->file_name_is_absolute($pidfile)){
+ $pidfile = File::Spec->rel2abs($pidfile);
+ }
+}
+
+if ($detach) {
+ # Fork once, and let the parent exit.
+ my $pid = fork;
+ if ($pid) { $proc_type = "dummy"; exit; }
+ defined($pid) or die "Could not fork: $!\n";
+
+ # Dissociate from the controlling terminal that started us and stop being
+ # part of whatever process group we had been a member of.
+ setsid() or die "Cannot start a new session: $!\n";
+
+ # In Proc::Daemon there is a second fork executed with the following
comment:
+ # "Forks another child process and exits first child. This prevents the
+ # potential of acquiring a controlling terminal."
+ # This is nowhere else mentioned! Neither in Perl nor standard UNIX
+ # documentation.
+ # IMPORTANT: If you put a second fork here, the process group is most
likely
+ # not correct for sending signals e.g. in the END block!
+
+ # chdir and set umask
+ chdir '/' or die "Cannot chdir to '/': $!\n";
+ #umask 0;
+
+ setup_pidfile() if defined $pidfile;
+ # Do it before closing file handles! We need the error messages!
+
+ # Close default file handles
+ close STDIN or die "Could not close STDIN: $!\n";
+ close STDOUT or die "Could not close STDOUT: $!\n";
+ close STDERR or die "Could not close STDERR: $!\n";
+ # Reopen stderr, stdout, stdin to /dev/null
+ open(STDIN, "</dev/null");
+ open(STDOUT, ">/dev/null");
+ open(STDERR, ">/dev/null");
+} else {
+ setpgid(0,0) or die "Cannot set process group id: $!\n";
+ setup_pidfile() if defined $pidfile;
+}
+
+#
+# Signal handlers
+#
+
+# Note: Signal handler are also called by children, if not changed after
fork!
+
+# die on typical signals
+$SIG{INT} = $SIG{TERM} = sub {
+ $log->notice("Caught SIG$_[0] - initiating shutdown");
+ $shutdown_gracefully = 0;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR1} = sub {
+ # Gracefull shutdown with timeout
+ $log->notice("Caught SIGUSR1 - initiating gracefull shutdown");
+ $shutdown_gracefully = $gracetime;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR2} = sub {
+ # Gracefull shutdown WITHOUT timeout -> Possibly blocking forever!
+ $log->notice("Caught SIGUSR2 - initiating gracefull shutdown");
+ $shutdown_gracefully = -1;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{HUP} = sub {
+ $log->warning("Caught SIGHUP - NO RELOAD SUPPORTED AT THE MOMENT");
+ #TODO
+};
+$SIG{PIPE} = 'IGNORE';
+$SIG{TSTP} = $SIG{TTOU} = $SIG{TTIN} = 'IGNORE'; # ignore tty signals
+$SIG{CHLD} = \&REAPER; # Care about connection processes. See below.
+
+#
+# Inform that everything looks good
+#
+
+$log->notice("oppd service started");
+$log->info("available services: " . join(",", sort keys(%services)));
+$log->info("PID $$ written to $pidfile") if defined $pidfile;
+
+#
+# Start "daemon", the network side of the job ;-)
+#
+
+#TODO: enable tracing output for our own SOAP implementation
+# Use Log::Dispatcher for debug/error handling somehow?
+
+my $http_daemon;
+my $errno = 0;
+my %server_options = (
+ LocalPort => $port, ReuseAddr => 1
+);
+if ($ssl){
+ my %ssl_options = (
+ SSL_verify_mode => 0x0,
+ SSL_cert_file => $ssl_cert_file,
+ SSL_key_file => $ssl_key_file,
+ SSL_passwd_cb => sub {
+ die "Password protected server key file not supported\n";
+ },
+ );
+ if ($ssl_verify_client) {
+ $ssl_options{SSL_verify_mode} = 0x03;
+ if ($ssl_ca_file) {
+ $ssl_options{SSL_ca_file} = $ssl_ca_file;
+ }
+ if ($ssl_ca_path) {
+ $ssl_options{SSL_ca_path} = $ssl_ca_path;
+ }
+ }
+ $! = 0;
+ $http_daemon = HTTP::Daemon::SSL->new(%server_options, %ssl_options);
+ $errno = $!;
+ if (!$http_daemon && (my $errstr = IO::Socket::SSL->errstr())) {
+ # We are perhaps ignoring $! here ...
+ die "SSL error while starting daemon: $errstr\n";
+ }
+} else {
+ $! = 0;
+ $http_daemon = HTTP::Daemon->new(%server_options);
+ $errno = $!;
+}
+
+unless ($http_daemon){
+ if ($errno != 0) {
+ $! = $errno;
+ die "Error starting HTTP daemon: $!\n";
+ } else {
+ die "Unknown error starting HTTP daemon\n";
+ }
+}
+
+#
+# start process for LS registration and keepalive
+#
+
+my $ls_reg_pid; # The pid of the LS registration process.
+ # "undef", if no such process running (at the moment).
+my $ls_reg_starttime = 0; # The time the registration process has started.
+ # "0" is important for first start!
+my $ls_reg_respawn_threshold = 60; # Respawn threshold for registration
process
+if ($ls_register){
+ if
(!@ls_url){
+ $log->notice(
+ "No URL for LS registration - Continuing without registration"
+ );
+ } else {
+ fork_ls_reg();
+ }
+}
+
+
+#
+# start process for selftest functionality
+#
+
+#TODO rework fork code completely!!
+#TODO add more messages and checks
+
+#selftesting functions are defined in plugin modules and
+#can be configured in oppd.conf per service
+=cut
+my @testservices;
+
+foreach my $service (keys %services){
+ if ($services{$service}{"selftest"}){
+ push @testservices, $service;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "No selftests specified for $service."
+ );
+ }
+}
+
+while (my $service = pop @testservices){
+ foreach my $test (keys %{$services{$service}{"selftest"}}){
+ my $pid = fork();
+ defined($pid) or $log->log(
+ level => "warning", service => $service,
+ message => "Could not fork selftest process $test for module $service:
$!"
+ );
+ #last if ($pid!=0);
+ if ($pid==0){ #child process, do selftest
+ $SIG{INT} = $SIG{TERM} = sub {
+ $log->log(
+ level => "notice", service => $service,
+ message => "Signal caught - exiting selftest process $test for
$service"
+ );
+ exit 1;
+ };
+ # do not call REAPER on SIGCHLD and avoid zombie children
+ $SIG{CHLD} = 'IGNORE';
+ while (1){
+ my $result = $services{$service}->{handler}->selftest($test);
+ $log->log(
+ level => "notice", service => $service,
+ message => "selftesting service $service: $test returned $result"
+ );
+ sleep($services{$service}{"selftest"}{$test});
+ }
+ }
+ }
+}
+=cut
+
+#
+# Accept connections
+#
+
+my %connections = (); # We hold the pids for all connection processes to keep
+ # track of the correct number of connections
+my ($conn, $peer); # We need at least $conn outside the main loop
+while (1) {
+ # We cannot use 'while (my ($conn, $peer) = $http_daemon->accept)', because
+ # HTTP:Daemon returns undef on signals and HTTP::Daemon::SSL also returns
+ # undef on failure (see man page).
+ ($conn, $peer) = $http_daemon->accept;
+ unless (defined $conn) {
+ # We haven't set a timeout that can also make accept() return undef!
+ next if $!{EINTR};
+ # Just ignore if accept() returned because a signal (most likely
SIGCHLD)
+ # was received. See 'man perlipc'.
+ if ($!) {
+ $log->info("Error in incoming connection: $!");
+ } elsif (my $errstr = IO::Socket::SSL->errstr()) {
+ # SSL stuff is obviously not setting $! ...
+ $log->info("SSL error in incoming connection: $errstr");
+ } else {
+ $log->info("Unknown error in incoming connection");
+ }
+ next;
+ }
+ my $peer_str = "UNKNOWN";
+ if ($peer) {
+ my ($port, $iaddr) = sockaddr_in($peer);
+ $peer_str = inet_ntoa($iaddr) . ":" . $port;
+ }
+ $log->info("Incoming connection from $peer_str");
+ if (scalar(keys %connections)+1 > $max_conn) {
+ my $msg = "Too many connections";
+ $log->notice("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ if($ssl and $ssl_trusted_webserver_cn and
$conn->peer_certificate("commonName") ne $ssl_trusted_webserver_cn) {
+ my $msg = "CN of certificate (".$conn->peer_certificate("commonName").")
not matching CN of trusted webserver";
+ $log->warning("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ $log->debug("Forking connection process for $peer_str");
+ my $pid = fork();
+ unless (defined $pid) {
+ # The fork failed
+ $log->error("Forking connection process failed: $!");
+ # Close the connection, because we have no process to care for it
+ close_socket($conn, "Error closing incoming connection after failed
fork");
+ next;
+ }
+ unless ($pid == 0) {
+ #
+ # We are the parent
+ #
+ # Child cares about the connection -> We can close it
+ close_socket($conn, "Error closing incoming connection in parent");
+ $log->debug("Connection process $pid/$peer_str started");
+ $connections{$pid} = $peer_str; # We care about our children!
+ $log->debug(
+ "Number of connections increased to " . scalar(keys %connections)
+ );
+ next;
+ }
+
+ #
+ # We are the child handling the connection
+ #
+
+ $proc_type = "connection";
+ $log_prefix = "$$/$peer_str";
+
+ $log->debug("Connection process running");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+ $SIG{USR1} = $SIG{USR2} = 'IGNORE'; # graceful -> do not cut connections!
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ #
+ # Handle requests as they come in
+ #
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ # http://rt.cpan.org/Public/Bug/Display.html?id=45625
+ # http://www.perlmonks.org/?node_id=761270
+ $conn->timeout($conn_timeout) unless($ssl);
+ while (my $request = $conn->get_request) {
+ $log->info("Incoming request");
+ $log->debug("Disabling connection timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout(0) unless($ssl);
+ my $response = new HTTP::Response;
+ eval {
+ my $soap_message =
+ perfSONAR::SOAP::Message->from_http_request($request);
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO: Auth
+ if ($auth){
+ perfSONAR::Auth::authenticate($soap_message, $nmwg_message, $as_url);
+ }
+ my $nmwg_response = perfSONAR->handle_request(
+ $soap_message->uri, $nmwg_message
+ );
+ #TODO $nmwg_message <-> $nmwg_response? clone?
+ #TODO what about header?
+ $soap_message->body($nmwg_response->as_dom()->documentElement);
+ $response->content($soap_message->as_string);
+ };
+ if (my $eval_err = $@) {
+ $log->info("Processing SOAP request failed: $eval_err");
+ $response->content(
+ perfSONAR::SOAP::Message->new(
+ fault => perfSONAR::SOAP::Fault_v1_1->new(
+ "", "Server.Internal", $eval_err
+ )
+ )->as_string
+ );
+ }
+ $log->debug("Sending response");
+ $log->debug("Response:\n".$response->content());
+ $conn->send_response($response);
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout($conn_timeout) unless ($ssl);
+ }
+ if (my $reason = $conn->reason) {
+ $log->info("Connection terminated: $reason");
+ }
+ # Cleanup -> close connection
+ close_socket($conn, "Closing connection failed");
+ $log->debug("Exiting connection process");
+ exit 0; # We are the child and have done our job -> exit
+}
+
+
+die "Internal error: This code should not be reached!\n";
+
+
+
+### END OF MAIN ###
+
+
+
+# Returns the first found parameter with a "defined" value
+sub get_opt {
+ foreach (@_) {
+ return $_ if defined;
+ }
+ return undef;
+}
+
+
+END {
+ # END could be executed without most if the initialisation from above
already
+ # done!
+ # At least the following variables should be already available via the INIT
+ # block (other should be considered to be possibly undef or empty):
+ # $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ # $shutting_down
+ # Keep this also in mind for subs called in the code below!
+ $shutting_down = 1;
+ return if $proc_type eq "dummy"; # Do not execute anything below
+ my $exitcode = $?; # Save $?
+ if ($proc_type eq "main") {
+ $log->info("Starting shutdown sequence");
+
+ my @pids = sort keys %connections;
+ push @pids, $ls_reg_pid if $ls_reg_pid;
+ if ($shutdown_gracefully && @pids) {
+ $log->info("Trying to terminate all known children gracefully");
+ my $signal = $shutdown_gracefully > 0 ? "USR1" : "USR2";
+ my @pids_new = ();
+ foreach my $pid (@pids) {
+ next if waitpid($pid, WNOHANG) != 0; # Already dead ...
+ kill $signal => $pid;
+ push @pids_new, $pid;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ # Some processes were signaled
+ $log->debug("Sent SIG$signal to " . join(', ', @pids));
+ # Wait till processes have ended or timeout is reached.
+ # $shutdown_gracefully < 0 => Wait possibly forever!!
+ my $timeout = $shutdown_gracefully < 0 ? 0 : $shutdown_gracefully;
+ $log->debug("Waiting for childern to exit" .
+ ($timeout ? " with timeout of $timeout s" : " WITHOUT timeout")
+ );
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ do {
+ foreach my $pid (@pids) {
+ push @pids_new, $pid if waitpid($pid, WNOHANG) == 0;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ $log->debug("Processes alive: " . join(', ', @pids));
+ sleep 1;
+ }
+ } until ! @pids;
+ alarm 0;
+ };
+ die if $@ && $@ ne "alarm\n"; # propagate unexpected errors
+ }
+ }
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There are childern alive
+ $log->info("Trying to terminate all children using SIGTERM");
+ local $SIG{TERM} = 'IGNORE';
+ kill TERM => -$$;
+ sleep 1; # Give everyone at least one second!
+ }
+ if ($pidfile_ok && -e $pidfile) {
+ # Clean up PID file
+ unlink $pidfile or $log->warning("Cannot delete pid file: $!");
+ }
+ $log->notice("Exiting");
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There is still someone alive! -> Take the axe and cut our branch
+ $log->warning("Not all children exited on SIGTERM -> KILLING
EVERYTHING");
+ kill KILL => -$$;
+ }
+ } elsif ($proc_type eq "connection") {
+ # We don't want to log as many messages as with the other processes!
+ #
+ # Close connection socket. Connection is definitively available in
+ # connection process, but may be closed. close_socket() is handling this
+ # case correctly, though.
+ close_socket($conn, "Closing connection failed");
+ } elsif ($proc_type eq "lsreg") {
+ $log->info("Starting shutdown sequence");
+ if ($shutdown_gracefully) {
+ $log->info("Deregistering services");
+ perfSONAR::Client::LS::deregister();
+ } else {
+ #TODO Change this? Perhaps a deregistration with a small timeout?
+ $log->info("Not deregistering services. Not a graceful shutdown.");
+ #TODO Quit reg/dereg (close conn) somehow if they are running?
+ }
+ $log->notice("Exiting");
+ } else {
+ warn "Internal error: END block executed with unknown process type: " .
+ "\"$proc_type\"\n";
+ }
+ $? = $exitcode; # Restore $?
+}
+
+#
+# setup pid file
+#
+sub setup_pidfile {
+ die("PID file ($pidfile) contains pid! Already running?\n")
+ if -e $pidfile && -s $pidfile;
+ open(PIDFILE, ">$pidfile")
+ or die("Could not write PID file ($pidfile): $!\n");
+ print PIDFILE "$$\n";
+ $pidfile_ok = 1;
+ close PIDFILE
+ or die("Could not write PID file ($pidfile): $!\n");
+}
+
+
+#
+# This is our SIGCHLD handler. We have to care of some things:
+# - Make sure that connection processes are correctly withdrawn from
+# %connections.
+# - Respawn LS registration process.
+#
+sub REAPER { # see also 'man perlipc'
+ local $!; # waitpid() and others may overwrite current error
+ while ((my $pid = waitpid(-1,WNOHANG)) > 0) {
+ my $reason = $? ? " with exit code $?" : "";
+ if (exists $connections{$pid}) {
+ $log->debug(
+ "Connection process $pid for connection $connections{$pid} exited"
+ . $reason
+ );
+ delete $connections{$pid};
+ $log->debug(
+ "Number of connections decreased to " . scalar(keys %connections)
+ );
+ } elsif ($pid == $ls_reg_pid) {
+ $log->debug("LS registration process $pid exited" . $reason);
+ $ls_reg_pid = undef;
+ fork_ls_reg() unless $shutting_down;
+ } else {
+ $log->debug("Unknown child process $pid exited" . $reason);
+ }
+ }
+ $SIG{CHLD} = \&REAPER; # loathe sysV
+}
+
+
+#
+# Close a socket with special care about SSL sockets.
+# Do only close sockets that are really open.
+#
+sub close_socket {
+ my ($socket, $err_msg) = @_;
+ return 1 unless $socket->opened; # Handle already closed sockets "silently"
+ if (UNIVERSAL::isa($socket, "IO::Socket::SSL")) {
+ unless ($socket->close(SSL_no_shutdown => 1)) {
+ $log->warning("$err_msg: $?");
+ return;
+ }
+ if(my $errstr = $socket->errstr()) {
+ $log->warning("$err_msg: $errstr");
+ return;
+ }
+ return 1;
+ }
+ if (UNIVERSAL::isa($socket, "IO::Socket")) {
+ unless ($socket->close) {
+ $log->warning("$err_msg: $!");
+ return;
+ }
+ return 1;
+ }
+ die "Internal error: close_socket(): Not a valid socket!\n";
+}
+
+
+#
+# Fork away the child process for LS registration.
+#
+sub fork_ls_reg {
+ my $ppid = $$; # Give our pid to the child
+ $log->info("Starting LS registration process");
+ my $pid = fork();
+ if (!defined($pid)) {
+ #
+ # Fork failed
+ #
+ $log->warning("Could not fork LS registration process: $!");
+ $log->warning("Continuing without registration");
+ return;
+ }
+ if ($pid != 0) {
+ #
+ # Child started, we are the parent, and child pid is in $pid
+ #
+ $ls_reg_pid = $pid;
+ $ls_reg_starttime = time;
+ return $pid; # return a bit more than just "true"
+ }
+
+ #
+ # Child process
+ #
+
+ $proc_type = "lsreg";
+ $log_prefix = "heartbeat/$$";
+
+ # First try to prevent lots of respawns of ls registration process:
+ if ($ls_reg_starttime+$ls_reg_respawn_threshold > time) {
+ # Our $ls_reg_starttime is still the start time of our predecessor!
+ $log->notice(
+ "LS registration process respawning too fast" .
+ " - delayed for $ls_reg_respawn_threshold s"
+ );
+ sleep $ls_reg_respawn_threshold;
+ }
+ # Check if everything seems ok:
+ unless (getppid == $ppid) {
+ die "Internal error: Got wrong ppid from getppid!\n";
+ }
+ $log->info("LS Registration process started");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ # Start registration process
+ perfSONAR::Client::LS::init(
+ services => \%services, ls_url =>
\@ls_url,
+ hostname => $hostname, port => $port,
+ organization => $organization, contact => $contact,
+ log => $log
+ );
+ while (1) {
+ sleep $keepalive;
+ # Our parent may have died without being able to send us a signal. So
take
+ # a look whether it's already there and exit if not:
+ unless (getppid == $ppid) {
+ $log->notice("Parent died - initiating shutdown");
+ exit 1;
+ }
+ perfSONAR::Client::LS::heartbeat();
+ }
+ die "Internal error: This code should not be reached!\n";
+}
+
+
+
+__END__
+
+
+
+=head1 NAME
+
+B<oppd.pl> - open perl perfSONAR daemon
+
+=head1 SYNOPSIS
+
+B<oppd.pl> [OPTIONS]
+
+
+
+=head1 DESCRIPTION
+
+This is the perl perfSONAR deamon script, running different perl perfSONAR
+services.
+Services can be configured in the oppd.conf file.
+For more information about perfSONAR, see L<http://www.perfsonar.net/>.
+
+
+=head1 OPTIONS
+
+This is a full list of available command line options. Please keep in mind
+that this script does NOT provide the normal Hades command line options
+or configuration file options!
+Some options might even look familiar, although they are used slightly
+different!
+
+Nearly all options have a built in default that can be overwritten using
+command line arguments or variables in the configuration file.
+Arguments have precedence over variables in the configuration file.
+
+
+=over
+
+
+=item B<--help>
+
+Prints a help message and exits.
+
+
+=item B<--config>=F<CONFIGFILE>
+
+Read configuration file F<CONFIGFILE> for options.
+
+Default: F</etc/oppd.conf>
+
+
+=item B<--noconfig>
+
+Do not read any configuration file. The parameter B<--config> is also
ignored!
+
+Default: off
+
+
+=item B<--[no]detach>
+
+Detach from terminal, aka run in background (instead of foreground).
+Log messages will not be sent to F<STDERR>.
+
+Default: on
+
+Configuration file: B<detach>
+
+
+=item B<--logfile>[=F<LOGFILE>]
+
+Append messages to file F<LOGFILE>.
+
+Just use B<--logfile> without the optional value to enable logging to default
+log file F</var/log/oppd.log>.
+
+You can use this option together with B<--syslog>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<logfile>
+
+
+=item B<--nologfile>
+
+Do not write to any log file. The parameter B<--logfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<logfile>
+
+
+=item B<--[no]syslog>
+
+Whether messages should be written to system log.
+
+You can use this option together with B<--logfile>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<syslog>
+
+
+=item B<--syslog-host>=I<HOST>
+
+Use I<HOST> as host to which system log messages are forwarded.
+
+If this option is set to a dns name or ip address, all system log messages
+are forwarded to the specified remote host.
+If set to the empty string ("") logging is done locally.
+
+Default: log locally
+
+Configuration file: B<syslog-host>
+
+
+=item B<--syslog-ident>=I<IDENT>
+
+The string I<IDENT> will be prepended to all messages in the system log.
+
+Default: I<oppd>
+
+Configuration file: B<syslog-ident>
+
+
+=item B<--syslog-facility>=I<FACILITY>
+
+Use I<FACILITY> as type of program for system logging.
+
+This string will be used as the system log facility for messages sent to
+the system log.
+
+See your C<syslog(3)> documentation for the facilities available on your
+system.
+Typical facilities are I<auth>, I<authpriv>, I<cron>, I<daemon>, I<kern>,
+I<local0> through I<local7>, I<mail>, I<news>, I<syslog>, I<user>, I<uucp>.
+
+Default: I<daemon>
+
+Configuration file: B<syslog-facility>
+
+
+=item B<--loglevel>=I<LOGLEVEL>
+
+Use I<LOGLEVEL> as log level used for logging to syslog and to the log files.
+
+This option is used for setting the verbosity of the running daemon.
+The log levels available are the log levels defined by Log::Dispatch.
+
+This is a list of values that should be accepted:
+ 0 = debug
+ 1 = info
+ 2 = notice
+ 3 = warning
+ 4 = err = error
+ 5 = crit = critical
+ 6 = alert
+ 7 = emerg = emergency
+
+Default: I<notice>
+
+Configuration file: B<loglevel>
+
+
+=item B<--verbose>
+
+Just a handy abbreviation for B<--loglevel>=I<info>.
+
+Default: not set, see B<--loglevel>
+
+Configuration file: use B<loglevel>=I<info>
+
+
+=item B<--pidfile>[=F<PIDFILE>]
+
+Use PIDFILE as name of pid file.
+The pid file contains the Process ID of the running oppd service.
+
+Just use B<--pidfile> without the optional value to use the default pid file
+F</var/run/oppd.pid>.
+
+Default: F</var/run/oppd.pid>
+
+Configuration file: B<pidfile>
+
+
+=item B<--nopidfile>
+
+Do not use a pid file. The parameter B<--pidfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<pidfile>
+
+
+=item B<--max_proc>=F<number of processes>
+
+Maximum Number of processes to get forked for listening to requests.
+This means that the service is able to handle B<--max_proc>
+numbers of requests simultaneously.
+
+Default: 5
+
+
+=item B<--port>=PORT
+
+Port number the service is listening to incoming requests.
+
+Default: 8090
+
+
+=item B<--[no]auth>
+
+Use authentication with an perfSONAR Authentication Server.
+Note that you have to provide the option to specify the URL
+for the Authentication Server also.
+
+Default: disabled
+
+
+=item B<--as_url>=F<AS URL>
+
+Provide URL for Authentication Server (see above).
+Only needed when authentication is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--[no]register>
+
+Registration to perfSONAR Lookup Server.
+When enabled, sends registration messages to Lookup Server specified by
ls_url.
+
+Default: disabled
+
+
+=item B<--keepalive>=F<keepalive interval>
+
+Interval in seconds when keepalive messages are sent to Lookup Service.
+This option has no effect, if Lookup Service registration is disabled.
+Note that the interval should be as long as possible, as this reduces
+communication overhead.
+
+Default: none. At least 12 hours recommended.
+
+
+=item B<--ls_url>=F<LS URL>
+
+Provide URL for Lookup Server (see above).
+Only needed when Lookup Service registration is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--hostname>=F<HOSTNAME>
+
+=item B<--organization>=F<ORGANIZATION>
+
+=item B<--contact>=F<CONATCT>
+
+These information are sent in the registration message to the
+Lookup Service.
+If registration is not enabled, these options have no effect.
+
+Default: none
+
+
+=back
+
+
+
+=head1 SIGNALS
+
+The oppd can be controlled by using various signals.
+
+
+=over
+
+
+=item SIGHUP
+
+Ignored and daemon is NOT reconfigured at the moment.
+
+
+=item SIGINT and SIGTERM
+
+Daemon terminates immediately. A SIGKILL is sent to the child processes
+shortly after giving them the chance to exit properly by sending them a
+SIGTERM.
+
+
+=item SIGUSR1
+
+Daemon terminates gracefully by sending all child processes a SIGUSR1 and
+waiting a specified time (at the moment 30 seconds) before sending them a
+SIGKILL.
+
+=for comment TODO There might be an option for $gracetime in the future.
+
+
+=item SIGUSR2
+
+Daemon terminates gracefully by sending all child processes a SIGUSR2 and
+will NEVER send a SIGKILL. The daemon might therefore wait forever and never
+return!
+
+
+=back
+
+
+
+=head1 EXAMPLES
+
+Start with a different configuration file:
+
+ $ oppd.pl --config=/usr/local/etc/oppd.conf
+
+Debug the daemon:
+
+ $ oppd.pl --nodetach \
+ --loglevel=debug --nologfile --nopidfile --nosyslog
+
+Use other some other options instead of the ones from configuration file:
+
+ $ oppd.pl --port=51234 --nologfile --pidfile=oppd.pid
+
+=head1 SEE ALSO
+
+oppd.conf
+
+
+
+=head1 AUTHORS
+
+DFN Labor Erlangen,
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/blib/script/oppd.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/build-stamp
===================================================================
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/changelog
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/changelog
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/changelog 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,7 @@
+perfsonar-oppd (0.52-0rc1) unstable; urgency=low
+
+ * Conflict with old oppd packages resolved
+ * This is the first revision of oppd debian package
+
+ -- DFN Labor
<>
Wed, 14 Apr 2010 09:23:27 +0200
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/compat
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/compat
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/compat 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+7
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/control
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/control
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/control 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,19 @@
+Source: perfsonar-oppd
+Section: net
+Priority: extra
+Maintainer: DFN Labor
<>
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Standards-Version: 3.7.3
+Homepage: http://www.win-labor.dfn.de
+
+Package: perfsonar-oppd
+Architecture: all
+Pre-Depends: ${shlibs:Depends}, ${misc:Depends}, perl,
libconfig-general-perl, libwww-perl, libipc-shareable-perl,
liblog-dispatch-perl, libnmwg-perl, liburi-perl, libxml-libxml-perl,
libsocket6-perl,libhttp-daemon-ssl-perl
+Conflicts: oppd
+Replaces: oppd
+Description: open PERL perfSONAR daemon
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/copyright
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/copyright
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/copyright 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/dirs
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/dirs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/dirs 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/docs
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/docs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/docs 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1 @@
+README
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/files
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/files
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/files 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1 @@
+perfsonar-oppd_0.52-0rc1_all.deb net extra
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/conffiles
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/conffiles
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/conffiles
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,9 @@
+/etc/oppd.d/LS_KeyRequest.xml
+/etc/oppd.d/LS_keepalive.xml
+/etc/oppd.d/Auth_request.xml
+/etc/oppd.d/LS_deregister.xml
+/etc/oppd.d/Auth_response.xml
+/etc/oppd.d/LS_register.xml
+/etc/init.d/oppd
+/etc/oppd.conf
+/etc/default/oppd
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/control
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/control
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,16 @@
+Package: perfsonar-oppd
+Version: 0.52-0rc1
+Architecture: all
+Maintainer: DFN Labor
<>
+Installed-Size: 328
+Pre-Depends: perl, libconfig-general-perl, libwww-perl,
libipc-shareable-perl, liblog-dispatch-perl, libnmwg-perl, liburi-perl,
libxml-libxml-perl, libsocket6-perl, libhttp-daemon-ssl-perl
+Conflicts: oppd
+Replaces: oppd
+Section: net
+Priority: extra
+Homepage: http://www.win-labor.dfn.de
+Description: open PERL perfSONAR daemon
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/md5sums
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/md5sums
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/md5sums
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,19 @@
+94b476134861cec32f42602547e1d52e
usr/lib/perfsonar/services/oppd/lib/perfSONAR/Echo.pm
+47ad59d9ef4aded85a884673b0a3ece7
usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/LS.pm
+b2ec87f18c293d1a0be598ef997108b7
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Message.pm
+9f01ec5eabdff2571255073986a47a9f
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_2.pm
+d78b03fb8e1c368ac4a0dbe8ce089ea9
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Request.pm
+a8fa7533203b1713205b8d1ac7d6b3d3
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Response.pm
+dd0308d8f9079f48196cdc7e2ac4d8a8
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
+662e4fcc407f6d1a0c5ce5b9ba7f8e50
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_1.pm
+673ca1e56edb27cae751a76c7f4b9a6a
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault.pm
+df671c4147437950e65054923d98253b
usr/lib/perfsonar/services/oppd/lib/perfSONAR/Auth.pm
+7763bffcd9d58afb29d69017d22eff5f
usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP.pm
+8a7017f49d2d4db5355ef7dd21b66eed
usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP.pm
+10fb8fa4b1f0d0050b4dc89a546233fa
usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
+50e9000754507ae39b11a65dbff9a375 usr/lib/perfsonar/services/oppd/bin/oppd.pl
+9e8c4130564900805870ba1e5dd3a4c2
usr/lib/perfsonar/services/oppd/man/oppd.pl.1p
+f3597d2153d9f28617c3dd12393f1c3d usr/share/doc/perfsonar-oppd/copyright
+8afec3fda6147f6ed650eb4eba21b9ee
usr/share/doc/perfsonar-oppd/changelog.Debian.gz
+28dfa37cfb6840db76370beacff16639 usr/share/doc/perfsonar-oppd/changelog.gz
+2511791a9cc09818ad662c6056dbfe85 usr/share/doc/perfsonar-oppd/README
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ chown root:root /etc/init.d/oppd
+ chmod 755 /etc/init.d/oppd
+ chown -R perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postrm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postrm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postrm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,55 @@
+#!/bin/sh
+# postrm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge|abort-install)
+ #/usr/sbin/userdel perfsonar
+ #/usr/sbin/groupdel perfsonar
+ ;;
+
+ remove|disappear)
+ ;;
+
+ upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ ;;
+
+ failed-upgrade|abort-upgrade)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/postrm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/preinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/preinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/preinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,99 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+ install)
+ [ -z "$SERVER_HOME" ] && SERVER_HOME=/usr/lib/perfsonar
+ [ -z "$SERVER_USER" ] && SERVER_USER=perfsonar
+ [ -z "$SERVER_NAME" ] && SERVER_NAME="Open Perl perfSONAR Daemon"
+ [ -z "$SERVER_GROUP" ] && SERVER_GROUP=perfsonar
+
+ # create group if not existing
+ if ! getent group | grep -q "^$SERVER_GROUP:" ; then
+ echo -n "Adding group $SERVER_GROUP.."
+ addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
+ echo "..done"
+ fi
+ # create user if not existing
+ if ! getent passwd | grep -q "^$SERVER_USER:"; then
+ echo -n "Adding system user $SERVER_USER.."
+ adduser --quiet \
+ --system \
+ --ingroup $SERVER_GROUP \
+ --no-create-home \
+ --disabled-password \
+ $SERVER_USER 2>/dev/null || true
+ echo "..done"
+ fi
+ # 4. adjust passwd entry
+ usermod -c "$SERVER_NAME" \
+ -d $SERVER_HOME \
+ -g $SERVER_GROUP \
+ $SERVER_USER
+ # 5. adjust file and directory permissions
+ if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
+ then
+ #Check if directory exist
+ if [ ! -d $SERVER_HOME ];
+ then
+ mkdir -p $SERVER_HOME
+ fi
+
+ chown -R $SERVER_USER:$SERVER_GROUP $SERVER_HOME
+ chmod u=rwx,g=rx,o=rx $SERVER_HOME
+ fi
+ ;;
+ configure)
+
+
+ #/usr/sbin/groupadd -f perfsonar
+ #/usr/sbin/useradd -g perfsonar -s /sbin/nologin -c "perfsonar user" -d
/ perfsonar
+ #mkdir -p /usr/lib/perfsonar/services/oppd
+ #chown perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+ ;;
+
+ upgrade)
+ #Check if oppd is running. If running stop it first
+ if ps ax | grep -v grep | grep oppd > /dev/null; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/preinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/prerm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/prerm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/prerm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ upgrade)
+ /etc/init.d/oppd stop
+ ;;
+
+ remove|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/DEBIAN/prerm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/default/oppd
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/default/oppd
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/default/oppd
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,40 @@
+# Path to oppd.
+DAEMON=/usr/lib/perfsonar/services/oppd//bin/oppd.pl
+
+# Configuration file to be used by oppd.
+CONFFILE=/etc/oppd.conf
+
+# pid file to use. The init script overwrites the pid file used (from
+# configuration file or default) to make sure that the init script can
control
+# the daemon via the pid file. Therefore you can change the pid file ONLY
here!
+PIDFILE=/var/run/oppd.pid
+
+# log file to use. If you set a log file here, it will not only be set as the
+# log file used by the daemon (overriding value from configuration file). The
+# daemon will also care about the ownership of the file based on the
variables
+# DAEMONUSER and DAEMONGROUP you can find below.
+LOGFILE=""
+
+# User to run the daemon as. Files (especially the pid file and log file, see
+# above) created by the daemon will be owned by this user.
+#DAEMONUSER=perfsonar
+
+# Group id used for pid file and log file (see above).
+#DAEMONGROUP=perfsonar
+
+# Additional command line arguments (overriding options from configuration
+# file!).
+#DAEMON_ARGS=""
+
+# Time to wait for the daemon to die, in seconds. If this value is set too
low
+# you might not let the daemon die gracefully and 'restart' may not work.
+#DIETIME=30
+
+# Time to wait for the daemon to start, in seconds. If this value is set each
+# time the daemon is started (on start or restart) the script will stall to
try
+# to determine if it is running. If it is not set and the server takes time
+# to setup a pid file the log message might be a false positive (says it did
+# not start when it actually did)
+# Example: STARTTIME=2
+#STARTTIME=""
+
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/oppd
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/oppd
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/oppd
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,183 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: perfsonar-oppd
+# Required-Start: $network $local_fs
+# Required-Stop:
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: oppd (Open Perl PerfSONAR Daemon)
+# Description: oppd (Open Perl PerfSONAR Daemon)
+### END INIT INFO
+
+# Author: WiN-Labor
<>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+NAME=oppd
+# For start-stop-daemon's --name
+SNAME=oppd.pl
+DAEMON=/usr/bin/oppd.pl
+DESC="Open Perl PerfSONAR Daemon"
+
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_ARGS=""
+DIETIME=30
+#STARTTIME=2
+LOGFILE=""
+CONFFILE=/etc/oppd.conf
+DAEMONUSER=perfsonar
+DAEMONGROUP=perfsonar
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Check that the user exists (if we set a user)
+# Does the user exist?
+if [ -n "$DAEMONUSER" ] ; then
+ if getent passwd | grep -q "^$DAEMONUSER:"; then
+ # Obtain the uid and gid
+ DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
+ DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
+ else
+ log_failure_msg "The user $DAEMONUSER, required to run $NAME does not
exist."
+ exit 1
+ fi
+fi
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ touch "$PIDFILE"
+ chown $DAEMONUSER:$DAEMONGROUP "$PIDFILE"
+ if [ -n "$LOGFILE" ]
+ then
+ touch $LOGFILE
+ chown $DAEMONUSER:$DAEMONUSER $LOGFILE
+ DAEMON_ARGS="$DAEMON_ARGS --logfile=$LOGFILE"
+ fi
+
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test
> /dev/null \
+ || return 1
+ if [ -z "$DAEMONUSER" ] ; then
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ else
+ # if we are using a daemonuser then change the user id
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
+ --chuid $DAEMONUSER -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ fi
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
+ pidofproc -p $PIDFILE > /dev/null || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/$DIETIME/KILL/5 --pidfile
$PIDFILE --name $SNAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # oppd takes care about its children. Nevertheless take care about them
here!
+ # Important: The following command will kill more or less all running oppd.
+ #TODO Is this working at all? Or is start-stop-daemon only seeing
+ # /usr/bin/perl ?
+ start-stop-daemon --stop --quiet --oknodo --retry=0/$DIETIME/KILL/5 --exec
$DAEMON
+ [ "$?" = 2 ] && return 2
+ # oppd should delete its pid file, but perhaps it doesn't have the right
+ # to do it!!
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name
$SNAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ #reload|force-reload)
+ #
+ # do_reload() is available above, but not implemented by oppd yet. So leave
+ # this commented out and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ status_of_proc -p $PIDFILE "" $NAME
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}"
>&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/init.d/oppd
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.conf
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.conf
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,470 @@
+#
+# Example configuration file for the Open Perl PerfSONAR Daemon (oppd)
+#
+# Comments are indicated by a leading '#'.
+# All configuration options are commented out in this example and therefore
+# their default values are used. Each option is set via a key and value pair
+# either separated by one or more whitspaces, or by '='.
+# See 'man oppd' and 'man oppd.conf' for more information.
+#
+
+
+#
+# detach - Detach from terminal.
+#
+# Detach from terminal, aka run in background (instead of foreground).
+# Log messages will not be sent to STDERR.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# detach off
+#
+#detach on
+
+
+#
+# logfile - Name of log file.
+#
+# Append messages to the specified file.
+#
+# Set it to no, off, 0, or false to disable log file usage.
+# Set it to yes, on, 1, or true to enable logging to default log file
+# "/var/log/oppd.log".
+#
+# You can use this option together with "syslog" (see below).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to log file
+#
+# Default: off
+#
+# Example:
+# logfile "/var/log/oppd.log"
+#
+#logfile off
+
+
+#
+# syslog - Whether messages should be written to system log.
+#
+# Set it to no, off, 0, or false to disable sending messages to system log.
+# Set it to yes, on, 1, or true to enable sending messages to system log.
+#
+# You can use this option together with "logfile" (see above).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# syslog on
+#
+#syslog off
+
+
+#
+# syslog-host - The (optional) host to which system log messages are
forwarded.
+#
+# If this option is set to a dns name or ip address, all system log messages
+# are forwarded to the specified remote host.
+# If set to no, off, 0, false, or "" logging is done locally.
+#
+# Valid options: no, off, 0, false, name or ip of syslog host
+#
+# Default: off
+#
+# Example:
+# syslog-host "syslog.nowhere.com"
+#
+#syslog-host off
+
+
+#
+# syslog-ident - Identification string for system log messages.
+#
+# This string will be prepended to all messages in the system log.
+#
+# Default: oppd
+#
+# Example:
+# syslog-ident "hades-tracert"
+#
+#syslog-ident "oppd"
+
+
+#
+# syslog-facility - Type of program for system logging.
+#
+# This string will be used as the system log facility for messages sent to
+# the system log.
+# See your syslog documentation for the facilities available on your system.
+#
+# Valid options: (Typical facilities.)
+# auth, authpriv, cron, daemon, kern, local0 through local7, mail, news,
+# syslog, user, uucp
+#
+# Default: daemon
+#
+# Example:
+# syslog-facility "local0"
+#
+#syslog-facility "daemon"
+
+
+#
+# loglevel - The log level used for logging to syslog and to the log files.
+#
+# This option is used for setting the verbosity of the running daemon.
+# The log levels available are the log levels defined by Log::Dispatch.
+#
+# Valid options: (This is a list of values that should be accepted.)
+# 0 = debug
+# 1 = info
+# 2 = notice
+# 3 = warning
+# 4 = err = error
+# 5 = crit = critical
+# 6 = alert
+# 7 = emerg = emergency
+#
+# Default: notice
+#
+# Example:
+# loglevel "info"
+#
+#loglevel "notice"
+
+
+#
+# pidfile - Name of pid file.
+#
+# Set it to no, off, 0, or false to disable pid file usage.
+# Set it to yes, on, 1, or true to write pid file to default position
+# "/var/run/oppd.pid".
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to pid file
+#
+# Default: /var/run/oppd.pid
+#
+# Example:
+# pidfile off
+#
+#pidfile "/var/run/oppd.pid"
+
+
+#
+# port - Port used to listen on incoming connections
+#
+# Port used to listen on incoming connections.
+#
+# Valid options: integer number
+#
+# Default: 8090
+#
+# Example:
+# port 12345
+#
+#port 8090
+
+
+#
+# max_proc - Maximum number of parallel running request processes.
+#
+# Set the maximum number of processes to be spawned for handling incoming
+# requests.
+#
+# Valid options: integer number
+#
+# Default: 5
+#
+# Example:
+# max_proc 20
+#
+#max_proc 5
+
+
+###############################################################################
+#
+# Options for Lookup Service communication:
+#
+###############################################################################
+
+#
+# ls_register - Lookup Service registration.
+#
+# Enable or disable Lookup Service registration.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ls_register on
+#
+#ls_register off
+
+
+#
+# keepalive - Keep alive interval.
+#
+# The keep alive interval for sending registration information to Lookup
+# Service in seconds.
+#
+# Valid options: integer number
+#
+# Default: 3600 (1 hour)
+#
+# Example:
+# keepalive 7200
+#
+#keepalive 3600
+
+
+#
+# ls_url - Lookup Service address.
+#
+# For every Lookup Service you want to send the registration information to
+# you should put one ls_url line in the configuration file. All you need is
to
+# give the address of the service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# ls_url "http://myls.mydomain.org:8080/ervices/LookupService"
+# ls_url "http://188.1.36.53:8080/axis/services/LookupService"
+# ls_url
"http://loco3.man.poznan.pl:8080/LookupService/services/LookupService"
+# ls_url "http://selena.acad.bg:8070/axis/services/LookupService"
+# ls_url
"http://ndb0-aami.internet2.edu:9095/perfSONAR_PS/services/hLS"
+# ls_url "http://ndb1.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url "http://dc211.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url
"http://loco4.man.poznan.pl:8180/geant2-java-xml-ls/services/LookupService"
+#
+#ls_url [FILL ME]
+
+
+#
+# hostname - Host name sent to the Lookup Service.
+#
+# Host name sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# hostname "myhost.mydomain.org"
+#
+#hostname [FILL ME]
+
+
+#
+# organization - Organization sent to the Lookup Service.
+#
+# Organization sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# organization "My Company"
+#
+#organization [FILL ME]
+
+
+#
+# contact - Contact e-mail address sent to the Lookup Service.
+#
+# Contact e-mail address sent to the Lookup Service.
+#
+# Valid options: e-mail address
+#
+# Default: none
+#
+# Example:
+# contact
""
+#
+#contact [FILL ME]
+
+
+###############################################################################
+#
+# Options for Authentication communication:
+#
+###############################################################################
+
+#
+# auth - Use Authentication Service.
+#
+# Enable or disable authentication via Authentication Service.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# auth on
+#
+#auth off
+
+
+#
+# as_url - Location of Authentication Service.
+#
+# Location of the Authentication Service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# as_url "http://myas.mydomain.org:8080/services/AuthService"
+# as_url "http://myas.rediris.es:8080/services/AuthService"
+# as_url
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService"
+#
+#as_url [FILL ME]
+
+
+###############################################################################
+#
+# SSL configuration options
+#
+###############################################################################
+
+#
+# ssl - SSL (Secure Socket Layer) support.
+#
+# Enable or disable SSL (Secure Socket Layer) support, which means that
+# the daemon will expect HTTPS requests instead of normal HTTP request.
+# IMPORTANT: Normal HTTP requests will not work anymore if SSL is enabled!
+# IMPORTANT: Most of the following options are necessary for SSL. You should
+# take care of all of them and make sure that you really know what
+# you are doing! If oppd is missing a necessary option, you will
get
+# an error message and the daemon will not start!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ssl on
+#
+#ssl off
+
+
+#
+# ssl_cert_file - SSL certificate file.
+#
+# Use this option to specify the location of your certificate.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_cert_file /var/www/certs/server-cert.pem
+#
+#ssl_cert_file [FILL ME]
+
+
+#
+# ssl_key_file - SSL server key file.
+#
+# Use this option to specify the location of your server key file.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_key_file /var/www/certs/server-key.pem
+#
+#ssl_key_file [FILL ME]
+
+
+#
+# ssl_verify_client - Verify SSL client certificate.
+#
+# Enable or Disable the verification of the SSL client certificate. This is
+# normally used as a method of client authentication.
+# IMPORTANT: This option is enabled by default, because you normally don't
want
+# to allow access to perfSONAR services by untrusted users. You
+# should only disable it if you really know what you are doing!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# ssl_verify_client off
+#
+#ssl_verify_client on
+
+
+#
+# ssl_ca_file - SSL certificate(s) of the reputable certificate authorities.
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_path below) to locate the file
+# containing the certificate(s) of the reputable certificate authorities.
+# There is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_ca_file /var/www/certs/my-ca.pem
+#
+#ssl_ca_file [FILL ME]
+
+
+#
+# ssl_ca_path - Directory containing SSL certificate(s)
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_file above) to locate the
certificate(s)
+# of the reputable certificate authorities.
+# If you are unusually friendly with the OpenSSL documentation, you might
have
+# set yourself up a directory containing several trusted certificates as
+# separate files as well as an index of the certificates.
+# Use this option to specify the location of this directory.
+# There is NO default value!
+#
+# Valid options: Directory path
+#
+# Default: none
+#
+# Example:
+# ssl_ca_path /var/www/certs/ca/
+#
+#ssl_ca_path [FILL ME]
+
+
+###############################################################################
+#
+# Configuring services
+#
+###############################################################################
+#
+# You have to define (at least) one or more <service> sections for every
+# perfSONAR services you want to provide. Instead of defining them all here
+# in this file, it is most likely more comfortable to use the following
+# statement to include all files in the subdirectory oppd.d ending with
suffix
+# .conf. In this directory you should put every service into it's own file.
+# But you are, of course, free to do everything your own way!
+#
+###############################################################################
+
+include oppd.d/*.conf
+
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_request.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_request.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_request.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,8 @@
+<nmwg:message id="authNMessage1" type="AuthNEERequest"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="authNMetadata">
+ <nmwg:parameters id="keys">
+ <nmwg:parameter name="SecurityToken"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:data id="authN1" metadataIdRef="authNMetadata"/>
+ </nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_response.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_response.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/Auth_response.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+<nmwg:message id="authNMessage1_resp" messageIdRef="authNMessage1"
type="AuthNEEResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="localhost.localdomain.2c534c44:114b3c44663:-7fcd">
+ <nmwg:eventType>success.as.authn</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="localhost.localdomain.2c534c44:114b3c44663:-7fcc"
metadataIdRef="localhost.localdomain.2c534c44:114b3c44663:-7fcd"/>
+ </nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_KeyRequest.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_KeyRequest.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_KeyRequest.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<nmwg:message type="LSKeyRequest"
+ id="msg1"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters"
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/">
+ <psservice:service id="serviceParameters"
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+ <psservice:serviceName>My_test_MA</psservice:serviceName>
+
<psservice:accessPoint>http://localhost:8080/axis/services/snmpMA</psservice:accessPoint>
+ <psservice:serviceType>MA</psservice:serviceType>
+ <psservice:serviceDescription>This is my testing
MA</psservice:serviceDescription>
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo" />
+
+</nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_deregister.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_deregister.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_deregister.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSDeregisterRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_remove">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_remove" id="data"/> <!-- empty trigger
-->
+
+</nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_keepalive.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_keepalive.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_keepalive.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,17 @@
+<nmwg:message type="LSKeepaliveRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_keepalive">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ <!--
+ <nmwg:parameter
name="lsKey">5cfb07ea7a5b840ce4f8f48b842ac9c0</nmwg:parameter>
+ -->
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_keepalive" id="d1"/>
+
+</nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_register.xml
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_register.xml
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/etc/oppd.d/LS_register.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSRegisterRequest"
+ id="msg1"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <!--
+
xmlns:nmtl3="http://ogf.org/schema/network/topology/l3/20070828/"
+
xmlns:nmtb="http://ogf.org/schema/network/topology/base/20070828/">
+ -->
+
+ <!-- Contains service description with accessPoint which will be the key
in the database! -->
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters">
+ <psservice:service id="serviceParameters">
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo">
+ </nmwg:data>
+
+</nmwg:message>
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/oppd.pl
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/oppd.pl
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/oppd.pl
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,1450 @@
+#!/usr/bin/perl
+
+eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+ if 0; # not running under some shell
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# See embedded POD below for further information
+
+# TODO
+# - Check config statements (die if multiple logfile statements in config
etc.)
+# - Detect and remove orphaned PID file! Or should it be done in init
scripts?
+# - LS registration options
+# - ls_register and ls_url should be somehow merged and made configurable
for
+# every service individually
+# - Use a decent default for the hostname sent to the LS
+# - hostname, organization and contact should perhaps get an ls_ prefix?
+# - Fail like on missing ls options like on missing ssl options
+# - AS options
+# - auth and as_url should be somehow merged and made configurable for
+# every service individually
+# - Should there be a timeout for processing a request?
+# - Catch more signals? Set to IGNORE or treat them like TERM/INT?
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+# Commen modules for all Hades/oppd daemons:
+use locale;
+use POSIX qw(setsid setpgid :sys_wait_h);
+use Log::Dispatch;
+use Log::Dispatch::File;
+use Log::Dispatch::Syslog;
+use Log::Dispatch::Screen;
+use Getopt::Long 2.32 qw(:config auto_help auto_version bundling);
+use Pod::Usage;
+use Config::General;
+# DateTime not needed by now, but this would be necessary, because Hades.pm
is
+# NOT loaded.
+#use DateTime;
+#use DateTime::Locale;
+#BEGIN {
+# if (DateTime::Locale->load(setlocale(LC_TIME))) {
+# DateTime->DefaultLocale(setlocale(LC_TIME));
+# }
+#}
+
+# Modules for this daemon:
+use File::Spec;
+use Socket;
+use HTTP::Daemon;
+#use HTTP::Daemon::SSL qw(debug3);
+#$Net::SSLeay::trace = 2;
+use HTTP::Daemon::SSL;
+use HTTP::Response;
+
+use NMWG;
+use perfSONAR;
+use perfSONAR::Echo;
+use perfSONAR::SOAP::Message;
+use perfSONAR::Client::LS;
+
+use vars qw($VERSION);
+$VERSION = 0.51;
+
+#
+# Important variables that should be available and initialised before the
+# (possible) execution of the END block
+#
+my (
+ $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ $shutting_down
+);
+INIT {
+ $proc_type = "main"; # Some code is executed by all childrens that fork
and
+ # do not exec afterwards. So we have to know
+ # what to do exactly.
+ # See e.g. END block and signal handlers for possible
+ # values.
+ $pidfile_ok = 0; # Care about existing pidfile in END
+ $log = Log::Dispatch->new();
+ # We also need the Log::Dispatch object for option verification quite
early
+ $log_prefix = ""; # Prepended to log message if set. This is intended for
+ # child processes and should not be "missused"!
+ $shutdown_gracefully = 0; # END called without signal is like SIGTERM !!
+ #TODO Use another default?
+ $shutting_down = 0; # This is set directly after entering the END block.
+ # Can be used to determine whether the process is
+ # going down at the moment. Important e.g. in signal
+ # handlers!
+}
+
+
+#
+# Parse Configuration (commandline and file)
+#
+
+my (
+ $configfile, $noconfig,
+ $detach, $syslog, $logfile, $nologfile, $pidfile, $nopidfile,
+ $loglevel, $verbose, $syslog_host, $syslog_ident, $syslog_facility,
+ $ls_register, $keepalive, $max_proc,
+ @ls_url, $auth, $as_url,
+ $hostname, $port, $organization, $contact,
+ $ssl, $ssl_cert_file, $ssl_key_file, $ssl_ca_file, $ssl_ca_path,
+ $ssl_verify_client, $ssl_trusted_webserver_cn,
+);
+
+my %services;
+my %messages;
+my %lsKeys;
+
+GetOptions(
+ "config=s" => \$configfile,
+ "noconfig" => \$noconfig,
+ "detach|D!" => \$detach,
+ "logfile:s" => \$logfile,
+ "nologfile" => \$nologfile,
+ "pidfile:s" => \$pidfile,
+ "nopidfile" => \$nopidfile,
+ "syslog!" => \$syslog,
+ "syslog-host=s" => \$syslog_host,
+ "syslog-ident=s" => \$syslog_ident,
+ "syslog-facility=s" => \$syslog_facility,
+ "loglevel=s" => \$loglevel,
+ "verbose|v" => \$verbose,
+ "register!" => \$ls_register,
+ "keepalive=i" => \$keepalive,
+ "max_proc=i" => \$max_proc,
+ "port=s" => \$port,
+ "auth!" => \$auth,
+ "as_url=s" => \$as_url,
+ "ssl!" => \$ssl,
+ "ssl-cert-file=s" => \$ssl_cert_file,
+ "ssl-key-file=s" => \$ssl_key_file,
+ "ssl-ca-file=s" => \$ssl_ca_file,
+ "ssl-ca-path=s" => \$ssl_ca_path,
+ "ssl-verify-client!" => \$ssl_verify_client,
+ "ssl-trusted-webserver-cn=s" => \$ssl_trusted_webserver_cn,
+) or pod2usage(2);
+
+# Determine and load config file
+my %Config = ();
+my $Config;
+if ($noconfig) {
+ $configfile = undef;
+} else {
+ #$configfile ||= "$FindBin::RealBin/../etc/oppd.conf";
+ $configfile ||= "/etc/oppd.conf";
+ $Config = Config::General->new(
+ -ConfigFile => $configfile,
+ -ApacheCompatible => 1,
+ #-AllowMultiOptions => 'no', # enable for EGEE because no LS is used
+ -AutoTrue => 1, # Could bring in some trouble, but it is really nice
;)
+ -IncludeGlob => 1, # We want to allow something like include
oppd.d/*.conf
+ -IncludeRelative => 1, # Especially useful with -IncludeGlob
+ -CComments => 0, # Parsing is obviously broken in 2.36!
+ # Comments are found everywhere...
+ );
+ %Config = $Config->getall;
+}
+
+
+#
+# Calculate options
+# First not "undef" value is used.
+# Order: command line, config file, default
+#
+$detach = get_opt($detach, $Config{detach}, 1);
+$nologfile = get_opt($nologfile, 0); # No nologfile entry in config file!
+if ($nologfile) {
+ $logfile = undef;
+} else {
+ $logfile = get_opt($logfile, $Config{logfile}, 0);
+ if (!$logfile && $logfile ne "") {
+ # logfile disabled
+ $logfile = undef;
+ } elsif ($logfile eq "1" || $logfile eq "") {
+ # logfile enabled in configuration file or via --logfile without value
+ $logfile = "/var/log/oppd.log";
+ }
+}
+$nopidfile = get_opt($nopidfile, 0); # No nopidfile entry in config file!
+if ($nopidfile) {
+ $pidfile = undef;
+} else {
+ $pidfile = get_opt($pidfile, $Config{pidfile}, 1);
+ if (!$pidfile && $pidfile ne "") {
+ # pidfile disabled
+ $pidfile = undef;
+ } elsif ($pidfile eq "1" || $pidfile eq "") {
+ # pidfile enabled in configuration file or via --pidfile without value
+ $pidfile = "/var/run/oppd.pid";
+ }
+}
+$syslog = get_opt($syslog, $Config{syslog}, 0);
+$syslog_host = get_opt($syslog_host, $Config{'syslog-host'}, "");
+$syslog_ident =
+ get_opt($syslog_ident, $Config{'syslog-ident'}, "oppd");
+$syslog_facility =
+ get_opt($syslog_facility, $Config{'syslog-facility'}, "daemon");
+$loglevel = get_opt($loglevel, $Config{loglevel}, "notice");
+$verbose = get_opt($verbose, 0); # No verbose entry in config file!
+if ($verbose) {
+ $loglevel = "info";
+} else {
+ pod2usage( { -message => "Invalid log level: $loglevel",
+ -exitval => 2 } ) unless $log->level_is_valid($loglevel);
+}
+#$ls_url = get_opt($ls_url, $Config{ls_url}, "");
+#LS URL can be one or more, take care of that:
+my $ls_opt = $Config{ls_url};
+if(ref($ls_opt) eq "ARRAY"){
+ @ls_url = @{$ls_opt};
+} else {
+ @ls_url = ($ls_opt);
+}
+$ls_register = get_opt($ls_register, $Config{ls_register}, 0);
+$keepalive = get_opt($keepalive, $Config{keepalive}, 3600);
+$max_proc = get_opt($max_proc, $Config{max_proc}, 5);
+$hostname = get_opt($hostname, $Config{hostname}, 0);
+$port = get_opt($port, $Config{port}, 8090);
+$organization = get_opt($organization, $Config{organization}, 0);
+$contact = get_opt($contact, $Config{contact}, 0);
+$auth = get_opt($auth, $Config{auth}, 0);
+$as_url = get_opt($as_url, $Config{as_url}, "");
+$ssl = get_opt($ssl, $Config{ssl}, 0);
+$ssl_cert_file = get_opt($ssl_cert_file, $Config{ssl_cert_file}, "");
+$ssl_key_file = get_opt($ssl_key_file, $Config{ssl_key_file}, "");
+$ssl_ca_file = get_opt($ssl_ca_file, $Config{ssl_ca_file}, "");
+$ssl_ca_path = get_opt($ssl_ca_path, $Config{ssl_ca_path}, "");
+$ssl_verify_client =
+ get_opt($ssl_verify_client, $Config{ssl_verify_client}, 1);
+$ssl_trusted_webserver_cn =
+ get_opt($ssl_trusted_webserver_cn, $Config{ssl_trusted_webserver_cn}, "");
+
+#TODO The following parameters need to be configurable by the user or changed
+my $max_conn = $max_proc;
+my $conn_timeout = 30;
+my $gracetime = 30; # Really usefull as a parameter?
+#/TODO
+
+if ($ssl) {
+ # We don't want defaults for the SSL related files, but warn instead that
+ # something is wrong.
+ # We also need to care at least whether $ssl_ca_path really exists, because
+ # the module will only spit out a useless warning and then oppd will die.
+ # Therefore you can find a lot of file test operators below...
+ unless ($ssl_cert_file) {
+ pod2usage(
+ "No SSL certificate specified. Use --ssl-cert-file or edit config
file."
+ );
+ }
+ unless (-f $ssl_cert_file) {
+ die "SSL certificate ($ssl_cert_file) not found\n";
+ }
+ unless(-r _) {
+ die "SSL certificate ($ssl_cert_file) not readable\n";
+ }
+ unless ($ssl_key_file) {
+ pod2usage(
+ "No SSL key specified. Use --ssl-key-file or edit config file."
+ );
+ }
+ unless (-f $ssl_key_file) {
+ die "SSL key file ($ssl_key_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL key file ($ssl_key_file) not readable\n";
+ }
+ unless ($ssl_ca_file || $ssl_ca_path || !$ssl_verify_client) {
+ pod2usage(
+ "No client certificate specified.\n" .
+ "Use --ssl-ca-file, --ssl-ca-path, or edit config file.\n" .
+ "If you know what you are doing you can also disable client
authentication\n" .
+ "by using --no-ssl-verify-client or editing config file
appropriately.\n"
+ );
+ }
+ if ($ssl_verify_client) {
+ if ($ssl_ca_file) {
+ unless (-f $ssl_ca_file) {
+ die "SSL client certificate file ($ssl_ca_file) not found\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate file ($ssl_ca_file) not readable\n";
+ }
+ }
+ if ($ssl_ca_path) {
+ unless (-d $ssl_ca_path) {
+ die "SSL client certificate path ($ssl_ca_path) not a directory\n";
+ }
+ unless (-r _) {
+ die "SSL client certificate path ($ssl_ca_path) not readable\n";
+ }
+ }
+ }
+}
+
+unless (
+ defined($Config{service}) && ref($Config{service}) eq "HASH"
+ && %{$Config{service}}
+) {
+ pod2usage(
+ "No services specified in config file"
+ );
+}
+%services = %{$Config{service}};
+
+
+#
+# Start logging ($log already initialised above)
+#
+
+$perfSONAR::log = $log;
+
+if (defined $logfile) {
+
+ #check if $logfile is an absolute path, and add current path if not
+ if (!File::Spec->file_name_is_absolute($logfile)){
+ $logfile = File::Spec->rel2abs($logfile);
+ }
+
+ eval {
+ use locale;
+ use POSIX qw(locale_h strftime);
+ # "use locale", POSIX::strftime and localtime faster than DateTime
+ # and this has quite an impact on debug loging. Detected via SmokePing:
+ # http://perfsonar.acad.bg/smokeping
+ #use DateTime;
+ #use DateTime::Locale;
+ #BEGIN {
+ # if (DateTime::Locale->load(setlocale(LC_TIME))) {
+ # DateTime->DefaultLocale(setlocale(LC_TIME));
+ # }
+ #}
+ $log->add(
+ Log::Dispatch::File->new(
+ name => 'file',
+ min_level => $loglevel,
+ filename => $logfile,
+ mode => 'append', close_after_write => 1, autoflush => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = strftime("%FT%T",localtime) . " $p{level}
$p{message}";
+ #DateTime->now(time_zone=>"local")->strftime("%c") .
+ return "$p{message}\n";
+ },
+ )
+ );
+ };
+ die "Cannot write to log file '$logfile':
$@\n"
if $@;
+}
+if ($syslog) {
+ eval {
+ my $syslog_socket = 'unix';
+ if ($syslog_host) {
+ $Sys::Syslog::host = $syslog_host;
+ $syslog_socket = 'inet';
+ }
+ $log->add(
+ Log::Dispatch::Syslog->new(
+ name => 'syslog',
+ min_level => $loglevel,
+ ident => "$syslog_ident",
+ facility => "$syslog_facility",
+ socket => "$syslog_socket",
+ logopt => "ndelay",
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ #TODO Not nice! How can we change this?
+ # callback for SD stuff
+ if ($p{service}) {
+ $p{service} =~ s/\//\_/g;
+ $p{service} .= ".";
+ } else {
+ $p{service} = "";
+ }
+ $p{message} = "OPPD." . $p{service} . uc($p{level}) . "%
$p{message}";
+ #/TODO
+ return "$p{message}\n";
+ },
+ #mode => 'append', close_after_write => 0, autoflush => 1,
+ )
+ );
+ };
+ die "Cannot write to syslog:
$@\n"
if $@;
+}
+unless ($detach) {
+ $log->add(
+ Log::Dispatch::Screen->new(
+ name => 'screen',
+ min_level => $loglevel,
+ stderr => 1,
+ callbacks => sub {
+ my
%p=@_;
+ $p{message} = "$log_prefix: $p{message}" if $log_prefix;
+ $p{message} = "$p{level}: $p{message}";
+ return "$p{message}\n";
+ },
+ )
+ );
+}
+
+# More flexible die:
+# Put error into Log and afterwards die with same message.
+# Also handy, because in the following code $@ is undef in die call:
+# $log->error($@); die $@;
+$SIG{__DIE__} = sub {
+ die @_ if $^S; # Ignore dies from evals
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->error($logmsg) if defined $log &&
UNIVERSAL::isa($log,'Log::Dispatch');
+ die @_;
+};
+
+# More flexible warn:
+# Put error into Log and afterwards warn with same message.
+$SIG{__WARN__} = sub {
+ my $logmsg = join " - ", @_;
+ chomp $logmsg; # No new line for Log::Dispatch !
+ # We should only be called with initialised $log, but we can be a bit
+ # more friendly by only using it if it was initialised:
+ $log->warning($logmsg)
+ if defined $log && UNIVERSAL::isa($log,'Log::Dispatch');
+ warn @_;
+};
+
+
+#
+# Load Authentication module for AA
+#
+
+if ($auth){
+ if ($as_url eq ""){
+ die ("Authentication not possible: variable $as_url not set!\n");
+ }
+ eval require perfSONAR::Auth;
+ if ($@){
+ die ("Error loading module perfSONAR::Auth:
$@\n");
+ }
+}
+
+#
+# Load data modules for services
+#
+
+foreach my $service (keys %services){
+ my $module = $services{$service}->{module};
+ eval "require perfSONAR::$module";
+ if ($@){
+ die "Error loading module perfSONAR::$module:
$@\n";
+ }
+ $services{$service}->{handler} =
+ "perfSONAR::$module"->new(%{$services{$service}->{module_param}});
+}
+
+# Set modules in dispatch module/class:
+%perfSONAR::services = %services;
+
+#
+# Daemonize
+#
+
+#First check pidfile path to be absolute!
+if ($pidfile){
+ if (!File::Spec->file_name_is_absolute($pidfile)){
+ $pidfile = File::Spec->rel2abs($pidfile);
+ }
+}
+
+if ($detach) {
+ # Fork once, and let the parent exit.
+ my $pid = fork;
+ if ($pid) { $proc_type = "dummy"; exit; }
+ defined($pid) or die "Could not fork: $!\n";
+
+ # Dissociate from the controlling terminal that started us and stop being
+ # part of whatever process group we had been a member of.
+ setsid() or die "Cannot start a new session: $!\n";
+
+ # In Proc::Daemon there is a second fork executed with the following
comment:
+ # "Forks another child process and exits first child. This prevents the
+ # potential of acquiring a controlling terminal."
+ # This is nowhere else mentioned! Neither in Perl nor standard UNIX
+ # documentation.
+ # IMPORTANT: If you put a second fork here, the process group is most
likely
+ # not correct for sending signals e.g. in the END block!
+
+ # chdir and set umask
+ chdir '/' or die "Cannot chdir to '/': $!\n";
+ #umask 0;
+
+ setup_pidfile() if defined $pidfile;
+ # Do it before closing file handles! We need the error messages!
+
+ # Close default file handles
+ close STDIN or die "Could not close STDIN: $!\n";
+ close STDOUT or die "Could not close STDOUT: $!\n";
+ close STDERR or die "Could not close STDERR: $!\n";
+ # Reopen stderr, stdout, stdin to /dev/null
+ open(STDIN, "</dev/null");
+ open(STDOUT, ">/dev/null");
+ open(STDERR, ">/dev/null");
+} else {
+ setpgid(0,0) or die "Cannot set process group id: $!\n";
+ setup_pidfile() if defined $pidfile;
+}
+
+#
+# Signal handlers
+#
+
+# Note: Signal handler are also called by children, if not changed after
fork!
+
+# die on typical signals
+$SIG{INT} = $SIG{TERM} = sub {
+ $log->notice("Caught SIG$_[0] - initiating shutdown");
+ $shutdown_gracefully = 0;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR1} = sub {
+ # Gracefull shutdown with timeout
+ $log->notice("Caught SIGUSR1 - initiating gracefull shutdown");
+ $shutdown_gracefully = $gracetime;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{USR2} = sub {
+ # Gracefull shutdown WITHOUT timeout -> Possibly blocking forever!
+ $log->notice("Caught SIGUSR2 - initiating gracefull shutdown");
+ $shutdown_gracefully = -1;
+ exit 1;
+ # See END {} for shutdown sequence
+};
+$SIG{HUP} = sub {
+ $log->warning("Caught SIGHUP - NO RELOAD SUPPORTED AT THE MOMENT");
+ #TODO
+};
+$SIG{PIPE} = 'IGNORE';
+$SIG{TSTP} = $SIG{TTOU} = $SIG{TTIN} = 'IGNORE'; # ignore tty signals
+$SIG{CHLD} = \&REAPER; # Care about connection processes. See below.
+
+#
+# Inform that everything looks good
+#
+
+$log->notice("oppd service started");
+$log->info("available services: " . join(",", sort keys(%services)));
+$log->info("PID $$ written to $pidfile") if defined $pidfile;
+
+#
+# Start "daemon", the network side of the job ;-)
+#
+
+#TODO: enable tracing output for our own SOAP implementation
+# Use Log::Dispatcher for debug/error handling somehow?
+
+my $http_daemon;
+my $errno = 0;
+my %server_options = (
+ LocalPort => $port, ReuseAddr => 1
+);
+if ($ssl){
+ my %ssl_options = (
+ SSL_verify_mode => 0x0,
+ SSL_cert_file => $ssl_cert_file,
+ SSL_key_file => $ssl_key_file,
+ SSL_passwd_cb => sub {
+ die "Password protected server key file not supported\n";
+ },
+ );
+ if ($ssl_verify_client) {
+ $ssl_options{SSL_verify_mode} = 0x03;
+ if ($ssl_ca_file) {
+ $ssl_options{SSL_ca_file} = $ssl_ca_file;
+ }
+ if ($ssl_ca_path) {
+ $ssl_options{SSL_ca_path} = $ssl_ca_path;
+ }
+ }
+ $! = 0;
+ $http_daemon = HTTP::Daemon::SSL->new(%server_options, %ssl_options);
+ $errno = $!;
+ if (!$http_daemon && (my $errstr = IO::Socket::SSL->errstr())) {
+ # We are perhaps ignoring $! here ...
+ die "SSL error while starting daemon: $errstr\n";
+ }
+} else {
+ $! = 0;
+ $http_daemon = HTTP::Daemon->new(%server_options);
+ $errno = $!;
+}
+
+unless ($http_daemon){
+ if ($errno != 0) {
+ $! = $errno;
+ die "Error starting HTTP daemon: $!\n";
+ } else {
+ die "Unknown error starting HTTP daemon\n";
+ }
+}
+
+#
+# start process for LS registration and keepalive
+#
+
+my $ls_reg_pid; # The pid of the LS registration process.
+ # "undef", if no such process running (at the moment).
+my $ls_reg_starttime = 0; # The time the registration process has started.
+ # "0" is important for first start!
+my $ls_reg_respawn_threshold = 60; # Respawn threshold for registration
process
+if ($ls_register){
+ if
(!@ls_url){
+ $log->notice(
+ "No URL for LS registration - Continuing without registration"
+ );
+ } else {
+ fork_ls_reg();
+ }
+}
+
+
+#
+# start process for selftest functionality
+#
+
+#TODO rework fork code completely!!
+#TODO add more messages and checks
+
+#selftesting functions are defined in plugin modules and
+#can be configured in oppd.conf per service
+=cut
+my @testservices;
+
+foreach my $service (keys %services){
+ if ($services{$service}{"selftest"}){
+ push @testservices, $service;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "No selftests specified for $service."
+ );
+ }
+}
+
+while (my $service = pop @testservices){
+ foreach my $test (keys %{$services{$service}{"selftest"}}){
+ my $pid = fork();
+ defined($pid) or $log->log(
+ level => "warning", service => $service,
+ message => "Could not fork selftest process $test for module $service:
$!"
+ );
+ #last if ($pid!=0);
+ if ($pid==0){ #child process, do selftest
+ $SIG{INT} = $SIG{TERM} = sub {
+ $log->log(
+ level => "notice", service => $service,
+ message => "Signal caught - exiting selftest process $test for
$service"
+ );
+ exit 1;
+ };
+ # do not call REAPER on SIGCHLD and avoid zombie children
+ $SIG{CHLD} = 'IGNORE';
+ while (1){
+ my $result = $services{$service}->{handler}->selftest($test);
+ $log->log(
+ level => "notice", service => $service,
+ message => "selftesting service $service: $test returned $result"
+ );
+ sleep($services{$service}{"selftest"}{$test});
+ }
+ }
+ }
+}
+=cut
+
+#
+# Accept connections
+#
+
+my %connections = (); # We hold the pids for all connection processes to keep
+ # track of the correct number of connections
+my ($conn, $peer); # We need at least $conn outside the main loop
+while (1) {
+ # We cannot use 'while (my ($conn, $peer) = $http_daemon->accept)', because
+ # HTTP:Daemon returns undef on signals and HTTP::Daemon::SSL also returns
+ # undef on failure (see man page).
+ ($conn, $peer) = $http_daemon->accept;
+ unless (defined $conn) {
+ # We haven't set a timeout that can also make accept() return undef!
+ next if $!{EINTR};
+ # Just ignore if accept() returned because a signal (most likely
SIGCHLD)
+ # was received. See 'man perlipc'.
+ if ($!) {
+ $log->info("Error in incoming connection: $!");
+ } elsif (my $errstr = IO::Socket::SSL->errstr()) {
+ # SSL stuff is obviously not setting $! ...
+ $log->info("SSL error in incoming connection: $errstr");
+ } else {
+ $log->info("Unknown error in incoming connection");
+ }
+ next;
+ }
+ my $peer_str = "UNKNOWN";
+ if ($peer) {
+ my ($port, $iaddr) = sockaddr_in($peer);
+ $peer_str = inet_ntoa($iaddr) . ":" . $port;
+ }
+ $log->info("Incoming connection from $peer_str");
+ if (scalar(keys %connections)+1 > $max_conn) {
+ my $msg = "Too many connections";
+ $log->notice("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ if($ssl and $ssl_trusted_webserver_cn and
$conn->peer_certificate("commonName") ne $ssl_trusted_webserver_cn) {
+ my $msg = "CN of certificate (".$conn->peer_certificate("commonName").")
not matching CN of trusted webserver";
+ $log->warning("$msg - closing connection to $peer_str");
+ $conn->send_error(503, $msg); #RC_SERVICE_NOT_AVAILABLE
+ close_socket($conn, "Error closing rejected connection");
+ next;
+ }
+ $log->debug("Forking connection process for $peer_str");
+ my $pid = fork();
+ unless (defined $pid) {
+ # The fork failed
+ $log->error("Forking connection process failed: $!");
+ # Close the connection, because we have no process to care for it
+ close_socket($conn, "Error closing incoming connection after failed
fork");
+ next;
+ }
+ unless ($pid == 0) {
+ #
+ # We are the parent
+ #
+ # Child cares about the connection -> We can close it
+ close_socket($conn, "Error closing incoming connection in parent");
+ $log->debug("Connection process $pid/$peer_str started");
+ $connections{$pid} = $peer_str; # We care about our children!
+ $log->debug(
+ "Number of connections increased to " . scalar(keys %connections)
+ );
+ next;
+ }
+
+ #
+ # We are the child handling the connection
+ #
+
+ $proc_type = "connection";
+ $log_prefix = "$$/$peer_str";
+
+ $log->debug("Connection process running");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+ $SIG{USR1} = $SIG{USR2} = 'IGNORE'; # graceful -> do not cut connections!
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ #
+ # Handle requests as they come in
+ #
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ # http://rt.cpan.org/Public/Bug/Display.html?id=45625
+ # http://www.perlmonks.org/?node_id=761270
+ $conn->timeout($conn_timeout) unless($ssl);
+ while (my $request = $conn->get_request) {
+ $log->info("Incoming request");
+ $log->debug("Disabling connection timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout(0) unless($ssl);
+ my $response = new HTTP::Response;
+ eval {
+ my $soap_message =
+ perfSONAR::SOAP::Message->from_http_request($request);
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO: Auth
+ if ($auth){
+ perfSONAR::Auth::authenticate($soap_message, $nmwg_message, $as_url);
+ }
+ my $nmwg_response = perfSONAR->handle_request(
+ $soap_message->uri, $nmwg_message
+ );
+ #TODO $nmwg_message <-> $nmwg_response? clone?
+ #TODO what about header?
+ $soap_message->body($nmwg_response->as_dom()->documentElement);
+ $response->content($soap_message->as_string);
+ };
+ if (my $eval_err = $@) {
+ $log->info("Processing SOAP request failed: $eval_err");
+ $response->content(
+ perfSONAR::SOAP::Message->new(
+ fault => perfSONAR::SOAP::Fault_v1_1->new(
+ "", "Server.Internal", $eval_err
+ )
+ )->as_string
+ );
+ }
+ $log->debug("Sending response");
+ $log->debug("Response:\n".$response->content());
+ $conn->send_response($response);
+ $log->debug("Setting connection timeout to $conn_timeout");
+ # TODO: timeout() is broken with HTTP::Daemon::SSL
+ $conn->timeout($conn_timeout) unless ($ssl);
+ }
+ if (my $reason = $conn->reason) {
+ $log->info("Connection terminated: $reason");
+ }
+ # Cleanup -> close connection
+ close_socket($conn, "Closing connection failed");
+ $log->debug("Exiting connection process");
+ exit 0; # We are the child and have done our job -> exit
+}
+
+
+die "Internal error: This code should not be reached!\n";
+
+
+
+### END OF MAIN ###
+
+
+
+# Returns the first found parameter with a "defined" value
+sub get_opt {
+ foreach (@_) {
+ return $_ if defined;
+ }
+ return undef;
+}
+
+
+END {
+ # END could be executed without most if the initialisation from above
already
+ # done!
+ # At least the following variables should be already available via the INIT
+ # block (other should be considered to be possibly undef or empty):
+ # $proc_type, $pidfile_ok, $log, $log_prefix, $shutdown_gracefully,
+ # $shutting_down
+ # Keep this also in mind for subs called in the code below!
+ $shutting_down = 1;
+ return if $proc_type eq "dummy"; # Do not execute anything below
+ my $exitcode = $?; # Save $?
+ if ($proc_type eq "main") {
+ $log->info("Starting shutdown sequence");
+
+ my @pids = sort keys %connections;
+ push @pids, $ls_reg_pid if $ls_reg_pid;
+ if ($shutdown_gracefully && @pids) {
+ $log->info("Trying to terminate all known children gracefully");
+ my $signal = $shutdown_gracefully > 0 ? "USR1" : "USR2";
+ my @pids_new = ();
+ foreach my $pid (@pids) {
+ next if waitpid($pid, WNOHANG) != 0; # Already dead ...
+ kill $signal => $pid;
+ push @pids_new, $pid;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ # Some processes were signaled
+ $log->debug("Sent SIG$signal to " . join(', ', @pids));
+ # Wait till processes have ended or timeout is reached.
+ # $shutdown_gracefully < 0 => Wait possibly forever!!
+ my $timeout = $shutdown_gracefully < 0 ? 0 : $shutdown_gracefully;
+ $log->debug("Waiting for childern to exit" .
+ ($timeout ? " with timeout of $timeout s" : " WITHOUT timeout")
+ );
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm $timeout;
+ do {
+ foreach my $pid (@pids) {
+ push @pids_new, $pid if waitpid($pid, WNOHANG) == 0;
+ }
+ @pids = @pids_new; @pids_new = ();
+ if (@pids) {
+ $log->debug("Processes alive: " . join(', ', @pids));
+ sleep 1;
+ }
+ } until ! @pids;
+ alarm 0;
+ };
+ die if $@ && $@ ne "alarm\n"; # propagate unexpected errors
+ }
+ }
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There are childern alive
+ $log->info("Trying to terminate all children using SIGTERM");
+ local $SIG{TERM} = 'IGNORE';
+ kill TERM => -$$;
+ sleep 1; # Give everyone at least one second!
+ }
+ if ($pidfile_ok && -e $pidfile) {
+ # Clean up PID file
+ unlink $pidfile or $log->warning("Cannot delete pid file: $!");
+ }
+ $log->notice("Exiting");
+ while (waitpid(-1,WNOHANG) > 0) {} # wait on all possibly exited children
+ if (waitpid(-1, WNOHANG) >= 0) {
+ # There is still someone alive! -> Take the axe and cut our branch
+ $log->warning("Not all children exited on SIGTERM -> KILLING
EVERYTHING");
+ kill KILL => -$$;
+ }
+ } elsif ($proc_type eq "connection") {
+ # We don't want to log as many messages as with the other processes!
+ #
+ # Close connection socket. Connection is definitively available in
+ # connection process, but may be closed. close_socket() is handling this
+ # case correctly, though.
+ close_socket($conn, "Closing connection failed");
+ } elsif ($proc_type eq "lsreg") {
+ $log->info("Starting shutdown sequence");
+ if ($shutdown_gracefully) {
+ $log->info("Deregistering services");
+ perfSONAR::Client::LS::deregister();
+ } else {
+ #TODO Change this? Perhaps a deregistration with a small timeout?
+ $log->info("Not deregistering services. Not a graceful shutdown.");
+ #TODO Quit reg/dereg (close conn) somehow if they are running?
+ }
+ $log->notice("Exiting");
+ } else {
+ warn "Internal error: END block executed with unknown process type: " .
+ "\"$proc_type\"\n";
+ }
+ $? = $exitcode; # Restore $?
+}
+
+#
+# setup pid file
+#
+sub setup_pidfile {
+ die("PID file ($pidfile) contains pid! Already running?\n")
+ if -e $pidfile && -s $pidfile;
+ open(PIDFILE, ">$pidfile")
+ or die("Could not write PID file ($pidfile): $!\n");
+ print PIDFILE "$$\n";
+ $pidfile_ok = 1;
+ close PIDFILE
+ or die("Could not write PID file ($pidfile): $!\n");
+}
+
+
+#
+# This is our SIGCHLD handler. We have to care of some things:
+# - Make sure that connection processes are correctly withdrawn from
+# %connections.
+# - Respawn LS registration process.
+#
+sub REAPER { # see also 'man perlipc'
+ local $!; # waitpid() and others may overwrite current error
+ while ((my $pid = waitpid(-1,WNOHANG)) > 0) {
+ my $reason = $? ? " with exit code $?" : "";
+ if (exists $connections{$pid}) {
+ $log->debug(
+ "Connection process $pid for connection $connections{$pid} exited"
+ . $reason
+ );
+ delete $connections{$pid};
+ $log->debug(
+ "Number of connections decreased to " . scalar(keys %connections)
+ );
+ } elsif ($pid == $ls_reg_pid) {
+ $log->debug("LS registration process $pid exited" . $reason);
+ $ls_reg_pid = undef;
+ fork_ls_reg() unless $shutting_down;
+ } else {
+ $log->debug("Unknown child process $pid exited" . $reason);
+ }
+ }
+ $SIG{CHLD} = \&REAPER; # loathe sysV
+}
+
+
+#
+# Close a socket with special care about SSL sockets.
+# Do only close sockets that are really open.
+#
+sub close_socket {
+ my ($socket, $err_msg) = @_;
+ return 1 unless $socket->opened; # Handle already closed sockets "silently"
+ if (UNIVERSAL::isa($socket, "IO::Socket::SSL")) {
+ unless ($socket->close(SSL_no_shutdown => 1)) {
+ $log->warning("$err_msg: $?");
+ return;
+ }
+ if(my $errstr = $socket->errstr()) {
+ $log->warning("$err_msg: $errstr");
+ return;
+ }
+ return 1;
+ }
+ if (UNIVERSAL::isa($socket, "IO::Socket")) {
+ unless ($socket->close) {
+ $log->warning("$err_msg: $!");
+ return;
+ }
+ return 1;
+ }
+ die "Internal error: close_socket(): Not a valid socket!\n";
+}
+
+
+#
+# Fork away the child process for LS registration.
+#
+sub fork_ls_reg {
+ my $ppid = $$; # Give our pid to the child
+ $log->info("Starting LS registration process");
+ my $pid = fork();
+ if (!defined($pid)) {
+ #
+ # Fork failed
+ #
+ $log->warning("Could not fork LS registration process: $!");
+ $log->warning("Continuing without registration");
+ return;
+ }
+ if ($pid != 0) {
+ #
+ # Child started, we are the parent, and child pid is in $pid
+ #
+ $ls_reg_pid = $pid;
+ $ls_reg_starttime = time;
+ return $pid; # return a bit more than just "true"
+ }
+
+ #
+ # Child process
+ #
+
+ $proc_type = "lsreg";
+ $log_prefix = "heartbeat/$$";
+
+ # First try to prevent lots of respawns of ls registration process:
+ if ($ls_reg_starttime+$ls_reg_respawn_threshold > time) {
+ # Our $ls_reg_starttime is still the start time of our predecessor!
+ $log->notice(
+ "LS registration process respawning too fast" .
+ " - delayed for $ls_reg_respawn_threshold s"
+ );
+ sleep $ls_reg_respawn_threshold;
+ }
+ # Check if everything seems ok:
+ unless (getppid == $ppid) {
+ die "Internal error: Got wrong ppid from getppid!\n";
+ }
+ $log->info("LS Registration process started");
+
+ #
+ # Signal handlers (if different from parent)
+ #
+ $SIG{CHLD} = 'IGNORE'; # Do not call REAPER and avoid zombie children
+
+ # Close the listening socket (always done in children):
+ close_socket($http_daemon, "Closing listening socket failed");
+
+ # Start registration process
+ perfSONAR::Client::LS::init(
+ services => \%services, ls_url =>
\@ls_url,
+ hostname => $hostname, port => $port,
+ organization => $organization, contact => $contact,
+ log => $log
+ );
+ while (1) {
+ sleep $keepalive;
+ # Our parent may have died without being able to send us a signal. So
take
+ # a look whether it's already there and exit if not:
+ unless (getppid == $ppid) {
+ $log->notice("Parent died - initiating shutdown");
+ exit 1;
+ }
+ perfSONAR::Client::LS::heartbeat();
+ }
+ die "Internal error: This code should not be reached!\n";
+}
+
+
+
+__END__
+
+
+
+=head1 NAME
+
+B<oppd.pl> - open perl perfSONAR daemon
+
+=head1 SYNOPSIS
+
+B<oppd.pl> [OPTIONS]
+
+
+
+=head1 DESCRIPTION
+
+This is the perl perfSONAR deamon script, running different perl perfSONAR
+services.
+Services can be configured in the oppd.conf file.
+For more information about perfSONAR, see L<http://www.perfsonar.net/>.
+
+
+=head1 OPTIONS
+
+This is a full list of available command line options. Please keep in mind
+that this script does NOT provide the normal Hades command line options
+or configuration file options!
+Some options might even look familiar, although they are used slightly
+different!
+
+Nearly all options have a built in default that can be overwritten using
+command line arguments or variables in the configuration file.
+Arguments have precedence over variables in the configuration file.
+
+
+=over
+
+
+=item B<--help>
+
+Prints a help message and exits.
+
+
+=item B<--config>=F<CONFIGFILE>
+
+Read configuration file F<CONFIGFILE> for options.
+
+Default: F</etc/oppd.conf>
+
+
+=item B<--noconfig>
+
+Do not read any configuration file. The parameter B<--config> is also
ignored!
+
+Default: off
+
+
+=item B<--[no]detach>
+
+Detach from terminal, aka run in background (instead of foreground).
+Log messages will not be sent to F<STDERR>.
+
+Default: on
+
+Configuration file: B<detach>
+
+
+=item B<--logfile>[=F<LOGFILE>]
+
+Append messages to file F<LOGFILE>.
+
+Just use B<--logfile> without the optional value to enable logging to default
+log file F</var/log/oppd.log>.
+
+You can use this option together with B<--syslog>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<logfile>
+
+
+=item B<--nologfile>
+
+Do not write to any log file. The parameter B<--logfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<logfile>
+
+
+=item B<--[no]syslog>
+
+Whether messages should be written to system log.
+
+You can use this option together with B<--logfile>.
+Messages will then be written to both, log file and system log.
+
+Default: off
+
+Configuration file: B<syslog>
+
+
+=item B<--syslog-host>=I<HOST>
+
+Use I<HOST> as host to which system log messages are forwarded.
+
+If this option is set to a dns name or ip address, all system log messages
+are forwarded to the specified remote host.
+If set to the empty string ("") logging is done locally.
+
+Default: log locally
+
+Configuration file: B<syslog-host>
+
+
+=item B<--syslog-ident>=I<IDENT>
+
+The string I<IDENT> will be prepended to all messages in the system log.
+
+Default: I<oppd>
+
+Configuration file: B<syslog-ident>
+
+
+=item B<--syslog-facility>=I<FACILITY>
+
+Use I<FACILITY> as type of program for system logging.
+
+This string will be used as the system log facility for messages sent to
+the system log.
+
+See your C<syslog(3)> documentation for the facilities available on your
+system.
+Typical facilities are I<auth>, I<authpriv>, I<cron>, I<daemon>, I<kern>,
+I<local0> through I<local7>, I<mail>, I<news>, I<syslog>, I<user>, I<uucp>.
+
+Default: I<daemon>
+
+Configuration file: B<syslog-facility>
+
+
+=item B<--loglevel>=I<LOGLEVEL>
+
+Use I<LOGLEVEL> as log level used for logging to syslog and to the log files.
+
+This option is used for setting the verbosity of the running daemon.
+The log levels available are the log levels defined by Log::Dispatch.
+
+This is a list of values that should be accepted:
+ 0 = debug
+ 1 = info
+ 2 = notice
+ 3 = warning
+ 4 = err = error
+ 5 = crit = critical
+ 6 = alert
+ 7 = emerg = emergency
+
+Default: I<notice>
+
+Configuration file: B<loglevel>
+
+
+=item B<--verbose>
+
+Just a handy abbreviation for B<--loglevel>=I<info>.
+
+Default: not set, see B<--loglevel>
+
+Configuration file: use B<loglevel>=I<info>
+
+
+=item B<--pidfile>[=F<PIDFILE>]
+
+Use PIDFILE as name of pid file.
+The pid file contains the Process ID of the running oppd service.
+
+Just use B<--pidfile> without the optional value to use the default pid file
+F</var/run/oppd.pid>.
+
+Default: F</var/run/oppd.pid>
+
+Configuration file: B<pidfile>
+
+
+=item B<--nopidfile>
+
+Do not use a pid file. The parameter B<--pidfile> is also ignored!
+
+Default: off
+
+Configuration file: use B<pidfile>
+
+
+=item B<--max_proc>=F<number of processes>
+
+Maximum Number of processes to get forked for listening to requests.
+This means that the service is able to handle B<--max_proc>
+numbers of requests simultaneously.
+
+Default: 5
+
+
+=item B<--port>=PORT
+
+Port number the service is listening to incoming requests.
+
+Default: 8090
+
+
+=item B<--[no]auth>
+
+Use authentication with an perfSONAR Authentication Server.
+Note that you have to provide the option to specify the URL
+for the Authentication Server also.
+
+Default: disabled
+
+
+=item B<--as_url>=F<AS URL>
+
+Provide URL for Authentication Server (see above).
+Only needed when authentication is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--[no]register>
+
+Registration to perfSONAR Lookup Server.
+When enabled, sends registration messages to Lookup Server specified by
ls_url.
+
+Default: disabled
+
+
+=item B<--keepalive>=F<keepalive interval>
+
+Interval in seconds when keepalive messages are sent to Lookup Service.
+This option has no effect, if Lookup Service registration is disabled.
+Note that the interval should be as long as possible, as this reduces
+communication overhead.
+
+Default: none. At least 12 hours recommended.
+
+
+=item B<--ls_url>=F<LS URL>
+
+Provide URL for Lookup Server (see above).
+Only needed when Lookup Service registration is enabled.
+Otherwise this option has no effect.
+
+Default: none
+
+
+=item B<--hostname>=F<HOSTNAME>
+
+=item B<--organization>=F<ORGANIZATION>
+
+=item B<--contact>=F<CONATCT>
+
+These information are sent in the registration message to the
+Lookup Service.
+If registration is not enabled, these options have no effect.
+
+Default: none
+
+
+=back
+
+
+
+=head1 SIGNALS
+
+The oppd can be controlled by using various signals.
+
+
+=over
+
+
+=item SIGHUP
+
+Ignored and daemon is NOT reconfigured at the moment.
+
+
+=item SIGINT and SIGTERM
+
+Daemon terminates immediately. A SIGKILL is sent to the child processes
+shortly after giving them the chance to exit properly by sending them a
+SIGTERM.
+
+
+=item SIGUSR1
+
+Daemon terminates gracefully by sending all child processes a SIGUSR1 and
+waiting a specified time (at the moment 30 seconds) before sending them a
+SIGKILL.
+
+=for comment TODO There might be an option for $gracetime in the future.
+
+
+=item SIGUSR2
+
+Daemon terminates gracefully by sending all child processes a SIGUSR2 and
+will NEVER send a SIGKILL. The daemon might therefore wait forever and never
+return!
+
+
+=back
+
+
+
+=head1 EXAMPLES
+
+Start with a different configuration file:
+
+ $ oppd.pl --config=/usr/local/etc/oppd.conf
+
+Debug the daemon:
+
+ $ oppd.pl --nodetach \
+ --loglevel=debug --nologfile --nopidfile --nosyslog
+
+Use other some other options instead of the ones from configuration file:
+
+ $ oppd.pl --port=51234 --nologfile --pidfile=oppd.pid
+
+=head1 SEE ALSO
+
+oppd.conf
+
+
+
+=head1 AUTHORS
+
+DFN Labor Erlangen,
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin/oppd.pl
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Auth.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Auth.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Auth.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,228 @@
+package perfSONAR::Auth;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use perfSONAR qw(print_log);
+
+## Authentication: send Auth-request to server, then proceed.
+# do the following:
+# - get <nmwg:parameter name="SecurityToken"> from header
+# - check <wsse:Security> element
+# - read in template fill in <nmwg:parameter name="SecurityToken">
+# - add $header to message
+# - send message to AS
+# - wait for response from AS (timeout)
+# - parse response from AS for <nmwg:eventType>XXXXXXX</nmwg:eventType>
+# - either respond with error result (see
<nmwg:eventType>XXXXXXX</nmwg:eventType>)
+# - or: go on with normal operation (adding a result code with
+# <nmwg:eventType>XXXXXXX</nmwg:eventType>)
+#
+# TODO:
+# - parse error description from AS (necessary?)
+# - authenticate based on messagetype!! (-> different structure, is this
useful?
+# better: athentication based on service!)
+
+ my $saml_token =
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
+ my $x509_token =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ my $AS_uri =
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService";
+
+
+sub authenticate {
+ my $soapmsg = shift;
+ my $reqmsg =shift;
+ my $as_uri = shift;
+
+ my $token;
+
+ print_log("info", "Authentication:\n");
+ if ((!defined ($soapmsg)) ||
!(UNIVERSAL::isa($soapmsg,"perfSONAR::SOAP::Message"))){
+ croak "No valid message given!\n";
+ }
+ if ((!defined ($as_uri)) || UNIVERSAL::isa($as_uri,"URI")){
+ #croak;
+ $as_uri = $AS_uri; #get default
+ }
+ if (!$soapmsg->header){
+ my $errorstring = "No authentication information in SOAP header!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ return $reqmsg;
+ } else {
+ $token = check_token($soapmsg->header);
+ }
+ if (!(defined $token)) {
+ my $errorstring = "Authentication token in header is missing!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "AuthNEERequest"){ #authorization request
to dummy AS
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "EchoRequest"){ #EchoRequest ping
unauthorized
+ return $reqmsg;
+ }
+ my $authmsg = create_authmsg($token);
+ #clone header TODO: necessary??
+ my @header = clone_header($soapmsg->header);
+ #my @header = $soapmsg->header;
+ #send message to server:
+ my $soap_auth_msg = perfSONAR::SOAP::Message->new(
+ body => $authmsg->as_dom,
+ uri => $AS_uri,
+ header =>
\@header
+ );
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_request-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_msg->as_string;
+ close FH;
+ #/DEBUG
+=cut
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $auth_request = perfSONAR::SOAP::HTTP::Request->new(message =>
$soap_auth_msg);
+ #DEBUG print "auth_reqeust\n";
+ #DEBUG print $auth_request->as_string . "\n";
+ #DEBUG print "auth_request end\n";
+ my $auth_response = $userAgent->request($auth_request);
+
+ my $soap_auth_response = $auth_response->soap_message;
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_response-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_response->as_string;
+ close FH;
+ #/DEBUG
+=cut
+
+
+
+ unless ($auth_response->is_success) {
+ #HTTP error
+ my $code = $auth_response->code();
+ my $description = $auth_response->message();
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "HTTP error: $code,
$description", "message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ $soapmsg->clear_header;
+ if ($soap_auth_response->is_fault){
+ #SOAP error
+ my $description = $soap_auth_response->{fault}->as_string;
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "SOAP error:
$description", "message");
+ return $reqmsg;
+ }
+
+ my $auth_nmwg = NMWG::Message->new( ($soap_auth_response->body)[0] );
+ #print "DEBUG: Return message: \n" . $auth_nmwg->as_string . "\n";
+ if (!$auth_nmwg){
+ my $errorstring = "Authentication failed: No response from
Authentication Service";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ my $event_node =
($auth_nmwg->{dom}->getElementsByLocalName("eventType"))[0];
+ my $auth_event = $event_node->textContent;
+ if ($auth_event ne "success.as.authn") { #some error occured
+ #find description of error
+ my $desc_node = ($auth_nmwg->{dom}->getElementsByLocalName("datum"))[0];
+ my $description = $desc_node->textContent;
+ my $errorstring = "Authentication failed on server: $description";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("$auth_event", "$errorstring", "message");
+ return $reqmsg;
+ }
+ #else just proceed
+ my $returnstring = "Authentication succeded";
+ $reqmsg->return_result_code("$auth_event", "$returnstring", "message");
+}
+
+
+
+sub check_token {
+ my @header = shift;
+ foreach my $entry (@header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ if ($entry->localname =~ /Security/){
+ my @sec_elems = $entry->getChildNodes();
+ foreach my $sec_elem (@sec_elems){
+ next unless (defined $sec_elem->localname);
+ if ($sec_elem->localname =~ /BinarySecurityToken/){
+ return $x509_token;
+ #return $saml_token;
+ } elsif ($sec_elem->localname =~ /Assertion/){
+ return $saml_token;
+ #return $x509_token;
+ }
+ }
+ }
+ }
+ }
+ return undef;
+}
+
+
+sub create_authmsg {
+ my $token = shift;
+
+ #read in template:
+ my $authmsg = NMWG::Message->new();
+ $authmsg->parse_xml_from_file("$FindBin::RealBin/../etc/Auth_request.xml");
+ if (!$authmsg){
+ $authmsg->parse_xml_from_file("/etc/oppd/Auth_request.xml");
+ }
+
+ #set token
+ my $tokennode = ($authmsg->{dom}->getElementsByLocalName("parameter"))[0];
+ if ($tokennode) {
+ $tokennode->appendText("$token");
+ }
+
+ return $authmsg;
+}
+
+sub clone_header {
+ my @orig_header = shift;
+ my @new_header;
+ foreach my $entry (@orig_header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ my $new_entry = $entry->cloneNode(1);
+ unshift @new_header, $new_entry;
+ }
+ }
+ return @new_header;
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/LS.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/LS.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Client/LS.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,425 @@
+package perfSONAR::Client::LS;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Please make me a proper class! There should be an object for every
service
+# and this class brings everything together.
+# - Replace the usage of $log with something more useful.
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Socket;
+use Socket6;
+
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT);
+ use Exporter;
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.10;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+
#@EXPORT
= qw(heartbeat deregister); # Symbols to autoexport (:DEFAULT
tag)
+}
+
+use NMWG::Message;
+#use perfSONAR qw(print_log);
+
+my $register_template;
+my $deregister_template;
+my $keepalive_template;
+
+
+if (-e "$FindBin::RealBin/../etc/"){
+ $register_template = "$FindBin::RealBin/../etc/LS_register.xml";
+ $deregister_template = "$FindBin::RealBin/../etc/LS_deregister.xml";
+ $keepalive_template = "$FindBin::RealBin/../etc/LS_keepalive.xml";
+} else {
+ $register_template = "/etc/oppd/LS_register.xml";
+ $deregister_template = "/etc/oppd/LS_deregister.xml";
+ $keepalive_template = "/etc/oppd/LS_keepalive.xml";
+}
+
+my $psservice = "http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/";
+my $nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $nmtb = "http://ogf.org/schema/network/topology/base/20070828/";
+my $nmtl3 = "http://ogf.org/schema/network/topology/l3/20070828/";
+my $nmwgr = "http://ggf.org/ns/nmwg/result/2.0/";
+
+our %services = ();
+our (
+ $hostname, $port, $organization, $contact, $log,
+);
+
+our @ls_url = ();
+my %messages;
+
+my $debug_write = 0;
+
+# Setup everything und sent initial registration ("first" heartbeat).
+sub init {
+ my %p = @_;
+ %services = %{$p{services}}; @ls_url = @{$p{ls_url}};
+ $hostname = $p{hostname}; $port = $p{port};
+ $organization = $p{organization}; $contact = $p{contact};
+ $log = $p{log};
+
+ #first registration:
+ foreach my $service (keys %services){
+ create_register_message($service);
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+}
+
+# Send keepalive messages for each service
+sub heartbeat {
+ foreach my $service (keys %messages){ #get services from global hash
+ my $message;
+ if (exists $messages{$service}{"keepalive_msg"}){
+ foreach my $url (@ls_url){
+ $message = $messages{$service}{"keepalive_msg"}->clone();
+ $log->log(
+ level => "notice", service => $service,
+ message => "Sending keepalive for $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "keepalive-response");
+ #TODO What to do if keepalive fails? At the moment: Nothing.
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "Keepalive for $service returend $eventtype:
$datumstring"
+ );
+ } else { #no response...
+ $log->log(
+ level => "notice", service => $service,
+ message => "error sending keepalive for $service: No response
from Lookup Server!"
+ );
+ }
+ }
+ } else { #something went wrong with first registration, otherwise there
would be a keepalive message!
+ #try to send registration message again:
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+ }
+}
+
+
+sub create_register_message{
+ my $service = shift;
+
+ # read in template for LS registration message and fill in module specific
+ # values:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($register_template);
+ my $servicenode = ($message->{dom}->getElementsByTagNameNS("$psservice",
"service"))[0];
+
+ $message->add_element_NS($servicenode, "serviceName",
"$services{$service}->{name}", $psservice);
+ $message->add_element_NS($servicenode, "accessPoint",
"http://$hostname:$port/services/$service", $psservice);
+ $message->add_element_NS($servicenode, "serviceType",
"$services{$service}->{servicetype}", $psservice);
+ $message->add_element_NS($servicenode, "serviceDescription",
"$services{$service}->{description}", $psservice);
+
+ my $datanode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"data"))[0];
+ my $metanode = $message->add_attribute (namespace => $nmwg,
+ parent => $datanode,
+ nodename => "metadata",
+ id => "topo-metadata",
+ );
+ my $subjectnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "subject",
+ id => "topo-subject",
+ );
+ my @addresses = lookup_interfaces();
+
+ my $nodenode = $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $subjectnode,
+ nodename => "node",
+ );
+ foreach my $addr (@addresses) {
+ my $name = lookup_hostname($addr);
+ next unless $name;
+ $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $nodenode,
+ nodename => "name",
+ type => "dns",
+ value => $name,
+ );
+ }
+ foreach my $addr (@addresses) {
+ my $addr_type;
+
+ if ($addr =~ /:/) {
+ $addr_type = "ipv6";
+ } else {
+ $addr_type = "ipv4";
+ }
+
+ my $portnode = $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtl3",
+ parent => $nodenode,
+ nodename => "port",
+ );
+ $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtb",
+ parent => $portnode,
+ nodename => "address",
+ type => $addr_type,
+ value => $addr,
+ );
+ }
+
+ foreach my $et (@{$services{$service}{"eventtype"}}){
+ $message->add_element_NS($metanode, "eventType", "$et", $nmwg);
+ }
+ my $paramnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "parameters",
+ );
+ if (exists $services{$service}->{"keyword"}){
+ my $keywordnode = $message->add_attribute (namespace => $nmwg,
+ parent => $paramnode,
+ nodename =>"parameter",
+ name => "keyword",
+ value =>
$services{$service}->{keyword},
+ );
+ }
+
+
+ if ($service =~/MA/){
+ $services{$service}->{handler}->get_meta_info($message);
+ }
+ $messages{$service}{"register_msg"} = $message;
+}
+
+sub check_response {
+ my $response = shift;
+ my $service = shift;
+
+
+ my ($errorstring, $metaid) = $response->parse_all;
+ if($errorstring){
+ $log->log(level => "notice", service => $service, message =>
$errorstring);
+ }
+ #parse content, write to log if successfull registration or error happened
+ my $eventtype;
+ my $key;
+ foreach my $meta (keys %{$response->{"metadataIDs"}}){
+ $eventtype = $response->{"metadataIDs"}{$meta}{"eventType"};
+ if (!$eventtype =~ /success/){
+ $log->log(
+ level => "notice", service => $service,
+ message => "LS returned $eventtype for service $service"
+ );
+ #return;
+ } else {
+ if ($eventtype =~ /register/){
+ $key = $response->{"metadataIDs"}{$meta}{"key"}{"lsKey"};
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully registered service $service with key $key"
+ );
+ $messages{$service}{"ls_key"} = $key;
+ }
+ }
+ }
+ return $key;
+}
+
+sub create_keepalive_message {
+ my $key = shift;
+
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($keepalive_template);
+ my $paramnode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"parameters"))[0];
+ $message->add_attribute(parent => $paramnode, nodename => "parameter",
value => $key, name => "lsKey");
+ write_message($message, "keepalive");
+ return $message;
+}
+
+sub send_registration {
+
+ my $message = shift;
+ my $service = shift;
+
+ write_message($message, "register");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "registering service $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "register-response");
+ my $key = check_response($response, $service);
+ if ($key){
+ $messages{$service}{"keepalive_msg"} =
create_keepalive_message($key);
+ } else {
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service with $eventtype:
$datumstring"
+ );
+ }
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service: No response from
Lookup Server!"
+ );
+ }
+ }
+}
+
+
+
+sub deregister{
+ #read in deregistration template:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($deregister_template);
+
+ #send deregistration
+ foreach my $service (keys %messages){
+ my $key = $messages{$service}{"ls_key"};
+ if (!$key){
+ $log->log(
+ level => "notice", service => $service,
+ message => "no key for deregistering service $service found!"
+ );
+ next;
+ }
+ my $deregmsg = $message->clone;
+ my $parametersnode = (
+ $deregmsg->{dom}->getElementsByTagNameNS("$nmwg", "parameters")
+ )[0];
+ my $key_parameter = $deregmsg->add_attribute(
+ parent => $parametersnode,
+ nodename => "parameter",
+ name => "lsKey"
+ );
+ $key_parameter->appendText($key);
+ write_message($deregmsg, "deregister");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "deregistering service $service from $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $deregmsg->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "dereg-response");
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully deregistered service $service with key
$key"
+ );
+ #TODO do something interesting with result
+ #$response->parse_meta;
+ #$response->parse_data;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "could not deregister $key: No response from Looukup
Server!"
+ );
+ }
+ }
+ }
+ #lay down to die
+}
+
+sub get_key{
+#TODO not implemented yet
+}
+
+sub re_register{
+#TODO not implemented yet
+}
+
+sub lookup_interfaces {
+ my @ret_interfaces = ();
+
+ open(IFCONFIG, "/sbin/ifconfig |");
+ my $is_eth = 0;
+ while(<IFCONFIG>) {
+ if (/Link encap:([^ ]+)/) {
+ if (lc($1) eq "ethernet") {
+ $is_eth = 1;
+ } else {
+ $is_eth = 0;
+ }
+ }
+ next if (not $is_eth);
+
+ if (/inet \w+:(\d+\.\d+\.\d+\.\d+)/) {
+ push @ret_interfaces, $1;
+ } elsif (/inet6 \w+: (\d*:[^\/ ]*)(\/\d+)? .*:Global/) {
+ push @ret_interfaces, $1;
+ }
+ }
+ close (IFCONFIG);
+ return @ret_interfaces;
+}
+
+sub lookup_hostname {
+ my $ip = shift;
+
+ my $result;
+ if ($ip =~ /:/) {
+ # IPv6
+ $result = gethostbyaddr(inet_pton(AF_INET6, $ip), AF_INET6);
+ } else {
+ # IPv4
+ $result = gethostbyaddr(inet_aton($ip), AF_INET);
+ }
+ return $result;
+}
+
+sub write_message{
+ my $message = shift;
+ my $name = shift;
+
+ if ($debug_write){
+ my $timestamp = time;
+ open (FH, ">", "$name-$timestamp.xml");
+ print FH $message->as_string();
+ close FH;
+ sleep(1);
+ }
+}
+
+
+1;
+
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Echo.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Echo.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/Echo.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,78 @@
+package perfSONAR::Echo;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use perfSONAR qw(print_log %services);
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+my $selftest_et = "http://schemas.perfsonar.net/tools/admin/selftest/1.0";
+my $response_et = "http://schemas.perfsonar.net/tools/admin/selftest/";
+
+my $returnstring = "I'm still alive and happy to talk to you!";
+
+sub handle_echo_request{
+#sub start_action {
+ my $msg = shift;
+ my $service = shift;
+
+ print Dumper($msg->{"metadataIDs"});
+
+ foreach my $key (keys %{$msg->{"metadataIDs"}}){
+ my $et = $msg->{"metadataIDs"}{$key}{"eventType"};
+ if ($et =~ /$echo_et/){
+ #echo request
+ print_log("info", "Reply to EchoRequest ping");
+ $msg->return_result_code("success.echo", "$returnstring", "$key");
+ }
+ elsif ($et =~ /$selftest_et/){
+
+ #my %refs = $services{$service}->{handler}->selftest();
+ my $refs = $services{$service}->{handler}->selftest();
+ if (!$refs){
+ print_log("notice", "error.echo: Action not supported: $et.");
+ $msg->return_result_code("error.echo", "Action not supported: $et.",
$key);
+ return $msg;
+ }
+ foreach my $name (keys %{$refs}){
+ my $ref = $refs->{$name};
+ my ($message, $status) = $services{$service}->{handler}->$ref;
+ print_log("notice", "$message $service");
+ $msg->return_result_code("$response_et$service/$name/$status/1.0",
"$message", "$key", "$name");
+ }
+
+ }
+ else { #some different eventtype, return error
+ $msg->return_result_code("error.echo", "Unknown eventType: $et", $key);
+ return $msg;
+ }
+ #return success message
+ return $msg;
+ }
+
+}
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,189 @@
+package perfSONAR::MP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+BEGIN {
+ use vars qw(@ISA);
+
#@ISA
= qw(SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+ @EXPORT = qw(store check_parameters get_parameters);
+}
+
+
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+use perfSONAR qw(print_log);
+use NMWG;
+use NMWG::Message;
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %param = (@_);
+
+ my $self = {
+ };
+ $self->{"supportedEventtypes"} = [
+ "http://ggf.org/ns/nmwg/ops/store/2.0",
+ ];
+ $self->{"command"} = $param{"command"};
+ $self->{"store"} = $param{"store"};
+ $self->{"store_url"} = $param{"store_url"};
+
+ bless $self, $class;
+ return $self;
+}
+
+sub open_request {
+ #initialize whatever you have to initiliaze
+}
+
+sub close_request{
+ #close request if necessary
+}
+
+
+#obsolete!
+sub set_command {
+ my $self = shift;
+ my $c = shift;
+ $self->{"command"} = $c;
+}
+
+sub selftest {
+ my $self = shift;
+ return undef;
+}
+
+
+sub start_action {
+
+}
+
+
+sub store {
+
+ my $self = shift;
+ my $msg = shift;
+
+ if (!$self->{"store_url"}){
+ $self->print_log_id("error", "Store to MA failed: no url to SQL MA
given!");
+ } else {
+ my $store_msg = $msg->clone;
+ if (!$store_msg){
+ $self->print_log_id("error", "Store to MA failed: Could not clone
storage message.");
+ return;
+ }
+ $store_msg->set_message_type("MeasurementArchiveStoreRequest");
+
+ #my $store_string = $store_msg->as_string(1);
+ #print "$store_string\n";
+
+ my $response = perfSONAR::sendReceive( message => $store_msg,
+ uri => $self->{"store_url"},
+ );
+
+ if ($response){
+ my $result = $response->as_string(2);
+ $self->print_log_id("info", "Answer from SQL MA:\n$result");
+ #print "$result\n"; #TODO parse response?
+ } else {
+ $self->print_log_id("error", "Store to MA failed: No response from SQL
MA!");
+ }
+ }
+}
+
+
+sub get_parameters {
+
+ my $self = shift;
+ my $datablock = shift;
+
+ my %parameters;
+
+ foreach my $key (keys %{$datablock}){ #get eventtypes
+ next if ($key eq "node" || $key eq "metaref" ); #no eventtype
+ foreach my $k (keys %{$datablock->{$key}}){
+ if (!defined $parameters{$k}){
+ if ($k eq "src" || $k eq "dst"){
+ $parameters{$k} = $datablock->{$key}{$k}{"value"};
+ } else {
+ $parameters{$k} = $datablock->{$key}{$k};
+ }
+ }
+ }
+ }
+
+ return %parameters;
+}
+
+
+sub check_parameters {
+
+ my $self = shift;
+ my %params = @_;
+
+ my @unknown;
+ my @unsupported;
+
+
+ foreach my $par (keys %params){
+ next if ($par eq "ns_prefix" ||
+ $par eq "param_ns_prefix" ||
+ $par eq "subject_ns_prefix" ||
+ $par eq "subject_ns_uri" ||
+ $par eq "param_ns_uri" ||
+ $par eq "parameter_ID" ||
+ $par eq "metaID" ||
+ $par eq "address" ||
+ $par eq "metadatakey"
+ );
+ next if exists $self->{"known_parameters"}{$par};
+ if (exists $self->{"unsupported_parameters"}->{$par}){
+ push @unsupported, $par;
+ } else {
+ push @unknown, $par;
+ }
+
+ }
+#TODO
+ if ($#unknown >= 0){
+ my $error = "Unknown parameter(s): " . join (", ", @unknown);
+ return $error;
+ }
+
+ if ($#unsupported >= 0){
+ my $error = "Unsupported parameters(s): " . join (", ", @unsupported);
+ return $error;
+ }
+}
+
+
+sub print_log_id {
+ my ($self, $level,$message) = @_;
+ print_log($level,$message,$self->{"service_id"});
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,83 @@
+package perfSONAR::SOAP::Fault;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+sub new {
+ #TODO Make building a SOAP Fault simple. But which version to choose?
+ #TODO Extract version from Namespaces and load corresponding module
+ # Is this really useful. Is the benefit worth doing such complicated
+ # things?
+ croak "Direct call on perfSONAR::SOAP::Fault not supported (yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($source) = @_;
+ #my $self = {};
+ #bless $self, $class;
+ #return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Fault->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP Fault element here?
+ unless ($self->{dom}->nodeName =~ m/:Fault$/) {
+ croak "Not a valid SOAP fault: Missing element Fault";
+ }
+
+ return $self;
+}
+
+sub from_string {
+ #TODO Do we really need this feature? Should it rather be added somehow
+ # to new method(s).
+ croak "perfSONAR::SOAP::Fault cannot be created from string source
(yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($xml) = @_;
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_1.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_1.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_1.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,273 @@
+package perfSONAR::SOAP::Fault_v1_1;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507
+
+#NOTES
+# Order and number of children of Fault element are not restricted by
+# by SOAP 1.1 specification. We use XPath to get at least what we need...
+# Further we ignore other children, since they are explicitly allowed by
+# specification. It is not clear, whether more than one element is allowed
for
+# the explicitly expected element. This module simply only uses the first one
+# to make parsing fail as seldom as possible.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($faultcode_uri, $faultcode, $faultstring,
+ $faultfactor, $detail, @additional) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ my $ns_soap = $perfSONAR::SOAP::ns_soap11;
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Fault");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+
+ # faultcode and faultstring are obligatory.
+ # Also the elements have to be created here, since other methods expect
them
+ # to exist already.
+ # Btw: namespace of faultcode is optional, because Envelope namespace is
+ # default.
+ unless ($faultcode) {
+ croak "Missing faultcode";
+ }
+ $self->{dom}->addNewChild(undef,"faultcode");
+ $self->faultcode($faultcode_uri,$faultcode);
+ unless ($faultstring) {
+ croak "Missing faultstring";
+ }
+ $self->{dom}->addNewChild(undef,"faultstring");
+ $self->faultstring($faultstring);
+
+ # Now the optional elements:
+ if ($faultfactor) {
+ $self->faultfactor($faultfactor);
+ }
+ if ($detail) {
+ $self->detail($detail);
+ }
+ #TODO Are these "other" elements really useful?
+ if (@additional) {
+ $self->additional(@additional);
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = $class->SUPER::from_dom($dom);
+ bless $self, $class;
+
+ # Check for correct namespace/version:
+ my $ns_soap = $self->{dom}->namespaceURI();
+ unless ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ croak "Invalid namespace for SOAP Fault element";
+ }
+ # Create XPathContext with appropriate namespace
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for necessary elements by retrieving them via our own methods:
+ $self->faultcode;
+ $self->faultstring;
+
+ return $self;
+}
+
+# Default namespace uri is http://schemas.xmlsoap.org/soap/envelope/
+sub faultcode {
+ my $self = shift;
+ my ($ns_uri,$code) = @_;
+
+ # There should really always be a faultcode element and we need it anyway.
+ # -> We can already retrieve it here
+ my $faultcode = $self->{xpc}->findnodes("faultcode")->get_node(1)
+ or croak "Missing faultcode element below Fault element";
+ unless ($ns_uri || $code) {
+ # No arguments => return current content
+ my $content = $faultcode->textContent
+ or croak "Empty faultcode element in SOAP Fault";
+ #TODO Is textContent really correct?
+ $content =~ m/(.+):(.+)/ or croak "Invalid faultcode in SOAP Fault";
+ my $ns_prefix = $1;
+ my $ns_uri = $faultcode->lookupNamespaceURI($ns_prefix)
+ or croak "Cannot determine namespace URI for SOAP Fault faultcode";
+ my $code = $2;
+ return $ns_uri, $code;
+ }
+
+ unless ($code) {
+ croak "faultcode needs at least a text string as second parameter";
+ }
+ $ns_uri ||= $perfSONAR::SOAP::ns_soap11;
+
+ # Set code
+ if ($faultcode->hasChildNodes) {
+ $faultcode->removeChildNodes;
+ }
+ my $ns_prefix = $faultcode->lookupNamespacePrefix($ns_uri);
+ unless ($ns_prefix) {
+ $ns_prefix = "nscode";
+ $faultcode->setNamespace($ns_uri,$ns_prefix,0);
+ }
+ #$faultcode->addChild(
+ # $faultcode->ownerDocument->createTextNode("$ns_prefix:$code")
+ #);
+ $faultcode->appendTextNode("$ns_prefix:$code");
+ return $self;
+}
+
+sub faultstring {
+ my $self = shift;
+ my ($string) = @_;
+
+ # There should really always be a faultstring element and we need it
anyway.
+ # -> We can already retrieve it here
+ my $faultstring = $self->{xpc}->findnodes("faultstring")->get_node(1)
+ or croak "Missing faultstring element below Fault element";
+ unless ($string) {
+ # No arguments => return current content
+ my $content = $faultstring->textContent
+ or croak "Empty faultstring element in SOAP Fault";
+ #TODO Is textContent really correct?
+ return $content;
+ }
+
+ # Set string
+ if ($faultstring->hasChildNodes) {
+ $faultstring->removeChildNodes;
+ }
+ #$faultstring->addChild(
+ # $faultstring->ownerDocument->createTextNode($string)
+ #);
+ $faultstring->appendTextNode($string);
+ return $self;
+}
+
+# TODO Should we check the factor itself somehow? It should be a URI, but
that
+# might lead to unnecessary parsing errors.
+sub faultfactor {
+ my $self = shift;
+ my ($factor) = @_;
+
+ unless ($factor) {
+ # No arguments => return current content
+ my $faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)
+ or return;
+ return $faultfactor->textContent;
+ #TODO Is textContent really correct?
+ }
+
+ # Set factor
+ my $faultfactor;
+ if ($faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)) {
+ if ($faultfactor->hasChildNodes) {
+ $faultfactor->removeChildNodes;
+ }
+ } else {
+ # We have to create the faultfactor element first:
+ $faultfactor = $self->{dom}->ownerDocument->createElementNS(
+ undef, "faultfactor"
+ );
+ $self->{dom}->insertAfter(
+ $faultfactor, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ #$faultfactor->addChild(
+ # $faultfactor->ownerDocument->createTextNode($factor)
+ #);
+ $faultfactor->appendTextNode($factor);
+ return $self;
+}
+
+sub detail {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("detail/*")};
+ }
+
+ # Set detail
+ my $detail;
+ if ($detail = $self->{xpc}->findnodes("detail")->get_node(1)) {
+ if ($detail->hasChildNodes) {
+ $detail->removeChildNodes;
+ }
+ } else {
+ # We have to create the detail element first:
+ $detail = $self->{dom}->ownerDocument->createElementNS(
+ undef, "detail"
+ );
+ $self->{dom}->insertAfter(
+ $detail, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $detail->appendChild($_);
+ }
+ return $self;
+}
+
+#TODO
+# IMPORTANT:
+# This method is only adding additional elements and NOT deleting already
+# existing additional elements! But don't use it anyway!
+sub additional {
+ my $self = shift;
+
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $self->{dom}->appendChild($_);
+ }
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_2.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_2.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Fault_v1_2.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,99 @@
+package perfSONAR::SOAP::Fault_v1_2;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/soap12-part1/#soapfault
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($Values, $Reasons, $Node, $Role, $Detail) = @_;
+=cut
+$Value = [
+
"VersionMismatch"|"MustUnderstand"|"DataEncodingUnknown"|"Sender"|"Receiver",
+ *:*, ....
+];
+$Reason = {
+ <lang> => <text>,
+ ....
+};
+$Node = <uri>;
+$Role = "http://www.w3.org/2003/05/soap-envelope/role/next" | "next" |
+ "http://www.w3.org/2003/05/soap-envelope/role/none" | "none" |
+ "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" |
+ "ultimateReceiver";
+$Detail = [ <nodelist> ];
+=cut
+
+ my $self = {};
+ bless $self, $class;
+ return $self;
+}
+
+#TODO Remove this 1.1 dummy API and "enhance" 1.1 to 1.2
+sub faultcode {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported", "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultstring {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultfactor {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub detail {
+ my $self = shift;
+ if (@_) {
+ return XML::LibXML->new->parse_string("<error>SOAP 1.2 Fault not
supported</error>")->documentElement;
+ } else {
+ return $self;
+ }
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Request.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Request.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Request.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,120 @@
+package perfSONAR::SOAP::HTTP::Request;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Request;
+use perfSONAR::SOAP::Message;
+
+use base 'HTTP::Request';
+
+
+# More or less a wrapper around HTTP::Request->new, setting a lot of defaults
+# useful for SOAP requests.
+# Parameters are set as hash to provide better flexibility and concentrate
more
+# on SOAP requirements.
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ method => "POST",
+ uri => undef,
+ # The HTTP(!) header
+ # If header is a HTTP::Headers object, this object will be used and all
+ # SOAP specific defaults will NOT be set. If header is a plan array
+ # reference, a HTTP::Headers object will be created, all SOAP specific
+ # defaults will be set and finally the values from the array will be set.
+ header => undef,
+ # The SOAP message:
+ message => undef,
+ @_
+ );
+
+ my $header;
+ my @header_defaults = (
+ SOAPAction => '""',
+ pragma => 'no-cache',
+ cache_control => 'no-cache',
+ accept => 'application/soap+xml, application/dime,
multipart/related, text/*',
+ );
+ if (defined $p{header}) {
+ croak("Bad header argument") unless ref $p{header};
+ if (ref($p{header}) eq "ARRAY") {
+ $header = HTTP::Headers->new(@header_defaults, @{$p{header}});
+ } else {
+ $header = $header->clone;
+ }
+ } else {
+ $header = HTTP::Headers->new(@header_defaults);
+ }
+
+ if (defined $p{message}) {
+ unless (UNIVERSAL::isa($p{message},'perfSONAR::SOAP::Message')) {
+ croak "Parameter \"message\" to perfSONAR::SOAP::HTTP::Request " .
+ "must be of type perfSONAR::SOAP::Message";
+ }
+ if (!defined $p{uri}) {
+ $p{uri} = $p{message}->uri;
+ }
+ }
+
+ my $self = $class->SUPER::new($p{method}, $p{uri}, $header);
+
+ $self->protocol("HTTP/1.0");
+
+ bless $self, $class;
+
+ if (defined $p{message}) {
+ $self->soap_message($p{message},1);
+ }
+
+ return $self;
+}
+
+# This method behaves like HTTP::Request::content, but expects one mandatory
+# parameter of type perfSONAR::SOAP::Message instead of a string.
+# This is a one-way method! You can only set a SOAP message!
+# The URI of this object will be set to the URI of the
perfSONAR::SOAP::Message
+# object, if it is set.
+sub soap_message {
+ my $self = shift;
+ my ($message, $do_not_set_uri) = @_;
+
+ unless (UNIVERSAL::isa($message,'perfSONAR::SOAP::Message')) {
+ croak "perfSONAR::SOAP::HTTP::Request->soap_message has to be called" .
+ "with one parameter of type perfSONAR::SOAP::Message";
+ }
+ my $content = $message->as_string;
+ $self->content_length(length($content));
+ if (!$do_not_set_uri && defined $message->uri) {
+ $self->uri($message->uri);
+ }
+ return $self->content($content);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Response.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Response.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/Response.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,52 @@
+package perfSONAR::SOAP::HTTP::Response;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Response;
+
+use base 'HTTP::Response';
+
+
+# This method behaves like HTTP::Response::content, but will croak if an
+# argument is passed!
+# This is a one-way method! You can only get a SOAP message from it, not set
+# it!
+sub soap_message {
+ my $self = shift;
+ my ($message) = @_;
+
+ if (@_) {
+ carp "No parameters allowed for soap_message"
+ if $^W;
+ }
+
+ return perfSONAR::SOAP::Message->from_http_response($self);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+package perfSONAR::SOAP::HTTP::UserAgent;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use LWP::UserAgent;
+
+use base 'LWP::UserAgent';
+
+
+our $timeout = 5000;
+
+
+# More or less a wrapper around LWP::UserAgent->new
+# You can use the same parameters as for LWP::UserAgent->new
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+
+ my $self = $class->SUPER::new(
+ timeout => $timeout, # our own default here
+ @_
+ );
+ bless $self, $class;
+}
+
+sub request {
+ my $self = shift;
+ return bless($self->SUPER::request(@_), 'perfSONAR::SOAP::HTTP::Response');
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Message.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Message.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP/Message.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,483 @@
+package perfSONAR::SOAP::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more parsing and checking could be implemented...
+
+#NOTES
+# - Regarding SOAP Faults this module enforces some rules:
+# - There is only one fault allowed in a message
+# - For SOAP 1.2 there is explicitly no other element allowed if the
message
+# contains a Fault element. For SOAP 1.1 this is unsure!
+# It is only explicitly requested if SOAP is used for RPC (See "Using
SOAP
+# for RPC, http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383533)
+# If a message contains a fault, other body elements that might exist are
+# not deleted, but ignored! This should make it possible to stay
+# compatible with "strange" SOAP 1.1 messages that we might have to
parse.
+# But: It is NOT possible to create such a message using this module or
+# add children to the Body element of a Fault message.
+#
+# Important keys of $self hash:
+# dom: The root (aka. Envelope) element. NOT necessarily the Document root.
+# xpc: An XPathContext with context node set to $self->{dom} and the
namespace
+# prefix "soap" set to the correct namespace URI.
+# fault: The corresponding SOAP::Fault object, if message contains a fault.
+# Otherwise the key doesn't exist at all.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use URI;
+use XML::LibXML;
+use XML::LibXML::NodeList;
+
+use perfSONAR::SOAP;
+use perfSONAR::SOAP::Fault;
+use perfSONAR::SOAP::Fault_v1_1;
+use perfSONAR::SOAP::Fault_v1_2;
+
+
+# All parameters optional! Header and body are empty by default. Version
+# defaults to "1.1".
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ header => undef, body => undef, fault => undef,
+ uri => undef, version => "1.1",
+ @_
+ );
+
+ my $self = {};
+ bless $self, $class;
+
+ # Set version
+ $self->version($p{version});
+ # We don't care about versions from header or body!
+ my $ns_soap = $perfSONAR::SOAP::version2ns{$self->version};
+
+ # Set URI
+ $self->uri($p{uri}) if defined $p{uri};
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Envelope");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # We always need a Body element:
+ $self->{dom}->addNewChild($ns_soap,"Body");
+
+ # Now we add the (optional) head
+ if (defined $p{header}) {
+ unless (ref($p{header}) eq "ARRAY") {
+ croak "Parameter \"header\" of perfSONAR::SOAP::Message->new must be "
.
+ "a list of XML::LibXML::Node objects";
+ }
+ if (@{$p{header}}) {
+ $self->header($p{header});
+ }
+ }
+
+ # Fault needs more thinking:
+ if (defined $p{body}) {
+ if (defined $p{fault}) {
+ croak
+ "perfSONAR::SOAP::Message::new needs either body or fault, not
both!";
+ }
+ # Body, no fault
+ $self->body($p{body});
+ } elsif (defined $p{fault} && $p{fault}->isa('perfSONAR::SOAP::Fault')) {
+ # No body, but fault
+ $self->fault($p{fault});
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom,$uri) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Message->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP envelope?
+ unless ($self->{dom}->nodeName =~ m/:Envelope$/) {
+ croak "Not a valid SOAP message: Missing element Envelope";
+ }
+
+ # First determine SOAP version and create XPathContext with appropriate
+ # namespace:
+ my $version;
+ my $ns_soap = $self->{dom}->namespaceURI;
+ if ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ $version = "1.1";
+ } elsif ($ns_soap eq $perfSONAR::SOAP::ns_soap12) {
+ $version = "1.2";
+ } else {
+ #TODO SOAP Fault: VersionMismatch
+ croak "Not a valid SOAP message: Unknown namespace";
+ }
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for the necessary body element:
+ unless ($self->{xpc}->findnodes("soap:Body")->size == 1) {
+ croak "Not a valid SOAP message: Missing element Body";
+ }
+
+ # Set uri and version
+ $self->uri($uri) if defined $uri;
+ $self->version($version); # We don't care about versions from header or
body!
+
+ # Handle faults
+ if (
+ my @faults = $self->{xpc}->findnodes("soap:Body/soap:Fault")
+ ) {
+ my $fault_src = shift @faults;
+ if (@faults) {
+ croak "More than one Fault element not allowed in SOAP Message";
+ }
+ $self->fault($fault_src);
+ }
+
+ #TODO Check for "invalid" elements?
+
+ return $self;
+}
+
+sub from_string {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($source,$uri) = @_;
+
+ croak "No XML source to parse" unless $source;
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($source);
+ };
+ if ($@){
+ #TODO Make me a special Exception!
+ croak "Error parsing message: $@";
+ }
+ #TODO Is the following really needed, or is already implicitly handled
above?
+ unless (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ croak "First argument to perfSONAR::SOAP::Message->from_libxml " .
+ "must be a valid XML string\n";
+ }
+ return $class->from_dom($dom,$uri);
+}
+
+sub from_http_request {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($request) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($request,"HTTP::Request")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_request"
+ . " must be of type HTTP::Request\n";
+ }
+
+ my $content = $request->content;
+ my $uri = $request->uri;
+ #DEBUG print "HTTP request URI: $uri\n";
+ #DEBUG print "HTTP request content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+sub from_http_response {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($response) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($response,"HTTP::Response")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_response"
+ . " must be of type HTTP::Response\n";
+ }
+
+ my $content = $response->content;
+ my $uri = $response->base;
+ #DEBUG print "HTTP response URI: $uri\n";
+ #DEBUG print "HTTP response content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+
+# Converts a list to DOM nodes (e.g. body or header content).
+# Parameters are a mixed list of:
+# - Array reference (will be flattened)
+# - XML::LibXML::Node (will be included directly)
+# - XML::LibXML::NodeList (Nodes in list will be included directly)
+# - String (will be parsed as XML Document and root Element will be included)
+sub _prepare_nodes {
+ my @result = (); # the result list
+ my @sources = (); # the flattened intermediate step
+ foreach my $entry (@_) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::NodeList")) {
+ push @sources, $entry->get_nodelist;
+ } elsif (ref($entry) eq "ARRAY") {
+ push @sources, @{$entry};
+ } else {
+ push @sources, $entry;
+ }
+ }
+ foreach my $entry (@sources) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Document")) {
+ # Special case: Although Document is also a Node, appendChild is not
+ # working. This should always work:
+ push @result, $entry->documentElement;
+ } elsif (UNIVERSAL::isa($entry,"XML::LibXML::Node")) {
+ push @result, $entry;
+ } else {
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($entry);
+ };
+ if ($@){
+ croak "Error parsing XML source: $@";
+ }
+ push @result, $dom->documentElement();
+ }
+ }
+ return @result;
+}
+
+# No parameter: Header will be returned as list of XML::LibXML::Node.
+sub header {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("soap:Header/*")};
+ }
+
+ # Set header
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ } else {
+ # We have to create the Header element first:
+ $header = $self->{dom}->ownerDocument->createElementNS(
+ $self->{dom}->namespaceURI(), "Header"
+ );
+ $self->{dom}->insertBefore(
+ $header, $self->{xpc}->findnodes("soap:Body")->get_node(1)
+ );
+ }
+ foreach (_prepare_nodes(@_)) {
+ $header->appendChild($_);
+ }
+ return $self;
+}
+
+sub clear_header {
+ my $self = shift;
+
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ }
+ return $self;
+}
+
+# No parameter: Body will be returned as list of XML::LibXML::Node.
+# If one of the parameters is a Fault element, all other elements are ignored
+# and the message becomes a Fault message.
+sub body {
+ my $self = shift;
+
+ unless (@_) {
+ return undef if exists $self->{fault};
+ return @{$self->{xpc}->findnodes("soap:Body/*")};
+ }
+
+ my @nodes = _prepare_nodes(@_);
+
+ # Check whether one of the nodes is a Fault element.
+ # If so, we will ignore all others and use $self->fault to turn message
+ # into a Fault message! We will use only the first Fault element and ignore
+ # all other.
+ foreach my $node (@nodes) {
+ next unless $node->nodeName =~ m/:Fault$/;
+ next unless $node->namespaceURI eq
+ $perfSONAR::SOAP::version2ns{$self->version};
+ $self->fault($node);
+ return $self;
+ }
+
+ # Set body
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ foreach (@nodes) {
+ $body->appendChild($_);
+ }
+ delete $self->{fault} if exists $self->{fault}; # Now we have a correct
body!
+
+ return $self;
+}
+
+# This internal sub is the simple way to set a SOAP Fault. It sets the
+# SOAP fault that is already in the message...
+# It only works with a DOM node as parameter and does neither import this
node
+# nor put it "to the right place".
+sub _fault {
+ my $self = shift;
+ my $source = shift;
+
+ if ($self->{version} eq "1.1") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_1->from_dom($source);
+ } elsif ($self->{version} eq "1.2") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_2->from_dom($source);
+ } else {
+ croak "Cannot determine version of SOAP message";
+ }
+ return $self;
+}
+
+sub fault {
+ my $self = shift;
+ my $source = shift;
+
+ if (!defined($source)) {
+ return $self->{fault};
+ }
+
+ if (UNIVERSAL::isa($source,'perfSONAR::SOAP::Fault')) {
+ if (
+ ($source->isa('perfSONAR::SOAP::Fault_v1_1') && ($self->version eq
"1.2"))
+ ||
+ ($source->isa('perfSONAR::SOAP::Fault_v1_2') && ($self->version eq
"1.1"))
+ ) {
+ croak "Version of SOAP Fault not matching version of SOAP Message";
+ }
+ $self->{fault} = $source;
+ } elsif (UNIVERSAL::isa($source,'XML::LibXML::Node')) {
+ $self->_fault($source);
+ } else {
+ croak "Invalid parameter for perfSONAR::SOAP::Message->fault";
+ }
+
+ # Now add fault to Body element (deleting all other elements!)
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ $body->appendChild($self->{fault}->{dom});
+
+ return $self;
+}
+
+# Only for convenience
+sub is_fault {
+ my $self = shift;
+
+ return exists $self->{fault};
+}
+
+sub uri {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return $self->{uri};
+ } elsif (UNIVERSAL::isa($uri,"URI")) {
+ $self->{uri} = $uri;
+ } elsif (my $u = URI->new($uri)) {
+ unless (UNIVERSAL::isa($u,"URI")) {
+ croak "Invalid URI: $uri\n";
+ }
+ $self->{uri} = $u;
+ } else {
+ croak "Invalid URI: $uri";
+ }
+ #TODO Check $uri further?
+ return $self;
+}
+
+sub uri_string {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return unless defined $self->{uri};
+ return $self->{uri}->as_string;
+ } else {
+ $self->uri($uri);
+ }
+ return $self;
+}
+
+# Does NOT convert a message from 1.1 to 1.2 or vice versa!
+# This is difficult (e.g. regarding Faults), but might be added in the
+# future...
+sub version {
+ my $self = shift;
+ my $version = shift;
+ if (!defined($version)) {
+ return $self->{version};
+ } elsif ($version eq "1.1") {
+ $self->{version} = "1.1";
+ } elsif ($version eq "1.2") {
+ $self->{version} = "1.2";
+ } else {
+ croak "Unknown SOAP version: $version";
+ }
+ return $self;
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->{dom}->toString;
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR/SOAP.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+package perfSONAR::SOAP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more feature of SOAP that could be implemented...
+# (http://www.w3.org/TR/soap/)
+# E.g. the "application/soap+xml" media type
+# (http://www.ietf.org/rfc/rfc3902.txt)
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+our $ns_soap11 = 'http://schemas.xmlsoap.org/soap/envelope/';
+our $ns_soap12 = 'http://www.w3.org/2003/05/soap-envelope';
+our %version2ns = (
+ 1.1 => $ns_soap11,
+ 1.2 => $ns_soap12,
+);
+our %ns2version = (
+ $ns_soap11 => "1.1",
+ $ns_soap12 => "1.2",
+);
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,269 @@
+package perfSONAR;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+ use Exporter;
+
#@ISA
= qw(Exporter SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.51;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+ @EXPORT = qw(); # Symbols to autoexport (:DEFAULT tag)
+ @EXPORT_OK = qw(print_log %services); # Symbols to export on request
+ %EXPORT_TAGS = qw(); # Define names for sets of symbols
+ # eg: TAG => [ qw(name1 name2) ],
+}
+
+use Carp;
+
+use perfSONAR::SOAP::HTTP::Request;
+use perfSONAR::SOAP::HTTP::Response;
+use perfSONAR::SOAP::HTTP::UserAgent;
+#use perfSONAR::Echo;
+use NMWG;
+use NMWG::Message;
+
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+
+sub handle_request {
+ my $class = shift; # TODO
+ my ($uri,$reqmsg) = (@_);
+ my $xmlmsg = $reqmsg->as_string;
+ print_log("info","Received message");
+ print_log("debug","Raw Message:\n$xmlmsg");
+ #print_log("debug","Parsed Message:\n" . Dumper($reqmsg));
+ # How to print DOM tree? Useful???
+
+ my $service = undef;
+
+ #if no accesspoint is given we do not know what service is meant!
+ if (!$uri){
+ croak "No service specified!";
+ } else {
+ ($service = $uri) =~ s/^.*\/services\///;
+ $service =~ s/\/$//;
+ my $serviceurl = $service;
+ print_log("info", "Service: $service");
+ if (!$services{$service}){
+ croak "Service $serviceurl not known!";
+ }
+ }
+
+ my @module_ets =
@{$services{$service}->{"handler"}->{"supportedEventtypes"}};
+ push @module_ets, $echo_et;
+
+
+ my $messagetype = $reqmsg->get_message_type();
+ if ($messagetype eq "ErrorResponse"){ #error from authentication!
+ return $reqmsg;
+ }
+ if ($messagetype eq "AuthNEERequest"){ #authorization rquest to dummy AS
+ require perfSONAR::AS;
+ return perfSONAR::AS::dummy();
+ }
+ if ($messagetype eq "SetupDataRequest"){
+ $reqmsg->set_message_type("SetupDataResponse");
+ }
+ elsif ($messagetype eq "MeasurementRequest"){
+ $reqmsg->set_message_type("MeasurementResponse");
+ }
+ elsif ($messagetype eq "MetadataKeyRequest"){
+ $reqmsg->set_message_type("MetadataKeyResponse");
+ }
+ elsif ($messagetype =~ /EchoRequest/){
+ $reqmsg->set_message_type("EchoResponse");
+ }
+ else {
+ my $errorstring = "Unknown messagetype: $messagetype";
+ print_log("info",$errorstring);
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.common.action_not_supported",
"$errorstring", "message");
+ return $reqmsg;
+ }
+
+ #create $reqmsg->{"dataIDs"} and
+ # $reqmsg->{"metadataIDs"} hashes from document
+ my ($errorstring, $metaid) = $reqmsg->parse_all;
+
+ if($errorstring){
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #check if at least one metadata and one data element is in message
+ if(!($reqmsg->{"metadataIDs"})){
+ $errorstring = "No metadata definition in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ if(!(defined $reqmsg->{"dataIDs"})){
+ $errorstring = "No data trigger in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ #do some checks on metadata content
+ foreach my $meta (keys %{$reqmsg->{"metadataIDs"}}){
+ #check for unknown eventTypes
+ my $et = $reqmsg->{"metadataIDs"}{$meta}{"eventType"};
+ if ($et =~ /admin/){ #dispatch to Echo module
+ return perfSONAR::Echo::handle_echo_request($reqmsg, $service);
+ return $reqmsg;
+ }
+
+ my $found = undef;
+ #foreach my $sup_et (@{$services{$service}{"eventtype"}}){
+ foreach my $sup_et (@module_ets){
+ next unless ($sup_et =~ /$et/);
+ $found = 1;
+ }
+ if (!defined $found){
+ my $errorstring = "Unknown eventType: $et";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ #check times
+ my $startTime = $reqmsg->{"metadataIDs"}{$meta}{"startTime"};
+ my $endTime = $reqmsg->{"metadataIDs"}{$meta}{"endTime"};
+ if ($endTime && $startTime && ($endTime < $startTime)){
+ my $errorstring = "Illegal time duration specified: " .
+ "$endTime is later than $startTime!";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ }
+
+ #add metadata parameters to data hashes
+ ($errorstring, $metaid) = $reqmsg->concatenate_params;
+ if ($errorstring){
+ print_log("info", $errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #DEBUG output:
+ print Dumper ($reqmsg->{"dataIDs"});
+ #print Dumper ($reqmsg->{"metadataIDs"});
+
+
+ #initialize data module
+ $services{$service}->{handler}->open_request();
+
+ #start action for each data block
+ foreach my $dataid (keys %{$reqmsg->{"dataIDs"}}){
+ $services{$service}->{handler}->start_action($reqmsg, $dataid, $service);
+ }
+
+ $services{$service}->{handler}->close_request();
+
+ return $reqmsg;
+}
+
+
+sub sendReceive {
+ my %p = (
+ message => undef,
+ host => "localhost",
+ port => "8090",
+ endpoint => "/",
+ uri => "",
+ soapheader => "", #TODO TODO noch nicht fertig und kein String!
+ @_
+ );
+
+ my $uri = $p{uri} || "http://$p{host}:$p{port}$p{endpoint}";
+ my $body = $p{message}->as_dom;
+
+ # Message is NMWG::Message
+ my $message = perfSONAR::SOAP::Message->new(
+ body => $body,
+ uri => $uri
+ );
+ # Modify SOAP header using $message or set via "new" call directly
+
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $request = perfSONAR::SOAP::HTTP::Request->new(message => $message);
+
+ my $response = $userAgent->request($request);
+ unless ($response->is_success) {
+ # HTTP error
+ #my $code = $response->code();
+ #my $message = $response->message();
+ carp $response->status_line if $^W; # "<code> <message>"
+ return;
+ }
+
+ my $soap_message = $response->soap_message;
+ if ($soap_message->is_fault) {
+ carp "TODO" if $^W;
+ return;
+ }
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO This should perhaps be
NMWG::Message->from_soap_message($soap_message);
+
+ return $nmwg_message;
+}
+
+
+sub print_log_old {
+ my ($level,$message) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, message => $message);
+ } else {
+ print STDERR "$level: $message\n";
+ }
+ return 1;
+}
+
+sub print_log {
+ my ($level,$message,$service) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, service => $service, message => $message);
+ } else {
+ print STDERR ($service ? "$service: " : "unknown service: ") .
+ "$level: $message\n";
+ }
+ return 1;
+}
+1;
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/lib/perfSONAR.pm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/man/oppd.pl.1p
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/man/oppd.pl.1p
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/man/oppd.pl.1p
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,398 @@
+.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10
pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12
pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds :
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o
\\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "OPPD 1p"
+.TH OPPD 1p "2010-07-30" "perl v5.10.0" "User Contributed Perl Documentation"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+\&\fBoppd.pl\fR \- open perl perfSONAR daemon
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBoppd.pl\fR [\s-1OPTIONS\s0]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+This is the perl perfSONAR deamon script, running different perl perfSONAR
+services.
+Services can be configured in the oppd.conf file.
+For more information about perfSONAR, see <http://www.perfsonar.net/>.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+This is a full list of available command line options. Please keep in mind
+that this script does \s-1NOT\s0 provide the normal Hades command line
options
+or configuration file options!
+Some options might even look familiar, although they are used slightly
+different!
+.PP
+Nearly all options have a built in default that can be overwritten using
+command line arguments or variables in the configuration file.
+Arguments have precedence over variables in the configuration file.
+.IP "\fB\-\-help\fR" 4
+.IX Item "--help"
+Prints a help message and exits.
+.IP "\fB\-\-config\fR=\fI\s-1CONFIGFILE\s0\fR" 4
+.IX Item "--config=CONFIGFILE"
+Read configuration file \fI\s-1CONFIGFILE\s0\fR for options.
+.Sp
+Default: \fI/etc/oppd.conf\fR
+.IP "\fB\-\-noconfig\fR" 4
+.IX Item "--noconfig"
+Do not read any configuration file. The parameter \fB\-\-config\fR is also
ignored!
+.Sp
+Default: off
+.IP "\fB\-\-[no]detach\fR" 4
+.IX Item "--[no]detach"
+Detach from terminal, aka run in background (instead of foreground).
+Log messages will not be sent to \fI\s-1STDERR\s0\fR.
+.Sp
+Default: on
+.Sp
+Configuration file: \fBdetach\fR
+.IP "\fB\-\-logfile\fR[=\fI\s-1LOGFILE\s0\fR]" 4
+.IX Item "--logfile[=LOGFILE]"
+Append messages to file \fI\s-1LOGFILE\s0\fR.
+.Sp
+Just use \fB\-\-logfile\fR without the optional value to enable logging to
default
+log file \fI/var/log/oppd.log\fR.
+.Sp
+You can use this option together with \fB\-\-syslog\fR.
+Messages will then be written to both, log file and system log.
+.Sp
+Default: off
+.Sp
+Configuration file: \fBlogfile\fR
+.IP "\fB\-\-nologfile\fR" 4
+.IX Item "--nologfile"
+Do not write to any log file. The parameter \fB\-\-logfile\fR is also
ignored!
+.Sp
+Default: off
+.Sp
+Configuration file: use \fBlogfile\fR
+.IP "\fB\-\-[no]syslog\fR" 4
+.IX Item "--[no]syslog"
+Whether messages should be written to system log.
+.Sp
+You can use this option together with \fB\-\-logfile\fR.
+Messages will then be written to both, log file and system log.
+.Sp
+Default: off
+.Sp
+Configuration file: \fBsyslog\fR
+.IP "\fB\-\-syslog\-host\fR=\fI\s-1HOST\s0\fR" 4
+.IX Item "--syslog-host=HOST"
+Use \fI\s-1HOST\s0\fR as host to which system log messages are forwarded.
+.Sp
+If this option is set to a dns name or ip address, all system log messages
+are forwarded to the specified remote host.
+If set to the empty string ("") logging is done locally.
+.Sp
+Default: log locally
+.Sp
+Configuration file: \fBsyslog-host\fR
+.IP "\fB\-\-syslog\-ident\fR=\fI\s-1IDENT\s0\fR" 4
+.IX Item "--syslog-ident=IDENT"
+The string \fI\s-1IDENT\s0\fR will be prepended to all messages in the
system log.
+.Sp
+Default: \fIoppd\fR
+.Sp
+Configuration file: \fBsyslog-ident\fR
+.IP "\fB\-\-syslog\-facility\fR=\fI\s-1FACILITY\s0\fR" 4
+.IX Item "--syslog-facility=FACILITY"
+Use \fI\s-1FACILITY\s0\fR as type of program for system logging.
+.Sp
+This string will be used as the system log facility for messages sent to
+the system log.
+.Sp
+See your \f(CWsyslog(3)\fR documentation for the facilities available on your
+system.
+Typical facilities are \fIauth\fR, \fIauthpriv\fR, \fIcron\fR, \fIdaemon\fR,
\fIkern\fR,
+\&\fIlocal0\fR through \fIlocal7\fR, \fImail\fR, \fInews\fR, \fIsyslog\fR,
\fIuser\fR, \fIuucp\fR.
+.Sp
+Default: \fIdaemon\fR
+.Sp
+Configuration file: \fBsyslog-facility\fR
+.IP "\fB\-\-loglevel\fR=\fI\s-1LOGLEVEL\s0\fR" 4
+.IX Item "--loglevel=LOGLEVEL"
+Use \fI\s-1LOGLEVEL\s0\fR as log level used for logging to syslog and to the
log files.
+.Sp
+This option is used for setting the verbosity of the running daemon.
+The log levels available are the log levels defined by Log::Dispatch.
+.Sp
+This is a list of values that should be accepted:
+ 0 = debug
+ 1 = info
+ 2 = notice
+ 3 = warning
+ 4 = err = error
+ 5 = crit = critical
+ 6 = alert
+ 7 = emerg = emergency
+.Sp
+Default: \fInotice\fR
+.Sp
+Configuration file: \fBloglevel\fR
+.IP "\fB\-\-verbose\fR" 4
+.IX Item "--verbose"
+Just a handy abbreviation for \fB\-\-loglevel\fR=\fIinfo\fR.
+.Sp
+Default: not set, see \fB\-\-loglevel\fR
+.Sp
+Configuration file: use \fBloglevel\fR=\fIinfo\fR
+.IP "\fB\-\-pidfile\fR[=\fI\s-1PIDFILE\s0\fR]" 4
+.IX Item "--pidfile[=PIDFILE]"
+Use \s-1PIDFILE\s0 as name of pid file.
+The pid file contains the Process \s-1ID\s0 of the running oppd service.
+.Sp
+Just use \fB\-\-pidfile\fR without the optional value to use the default pid
file
+\&\fI/var/run/oppd.pid\fR.
+.Sp
+Default: \fI/var/run/oppd.pid\fR
+.Sp
+Configuration file: \fBpidfile\fR
+.IP "\fB\-\-nopidfile\fR" 4
+.IX Item "--nopidfile"
+Do not use a pid file. The parameter \fB\-\-pidfile\fR is also ignored!
+.Sp
+Default: off
+.Sp
+Configuration file: use \fBpidfile\fR
+.IP "\fB\-\-max_proc\fR=\fInumber of processes\fR" 4
+.IX Item "--max_proc=number of processes"
+Maximum Number of processes to get forked for listening to requests.
+This means that the service is able to handle \fB\-\-max_proc\fR
+numbers of requests simultaneously.
+.Sp
+Default: 5
+.IP "\fB\-\-port\fR=PORT" 4
+.IX Item "--port=PORT"
+Port number the service is listening to incoming requests.
+.Sp
+Default: 8090
+.IP "\fB\-\-[no]auth\fR" 4
+.IX Item "--[no]auth"
+Use authentication with an perfSONAR Authentication Server.
+Note that you have to provide the option to specify the \s-1URL\s0
+for the Authentication Server also.
+.Sp
+Default: disabled
+.IP "\fB\-\-as_url\fR=\fI\s-1AS\s0 \s-1URL\s0\fR" 4
+.IX Item "--as_url=AS URL"
+Provide \s-1URL\s0 for Authentication Server (see above).
+Only needed when authentication is enabled.
+Otherwise this option has no effect.
+.Sp
+Default: none
+.IP "\fB\-\-[no]register\fR" 4
+.IX Item "--[no]register"
+Registration to perfSONAR Lookup Server.
+When enabled, sends registration messages to Lookup Server specified by
ls_url.
+.Sp
+Default: disabled
+.IP "\fB\-\-keepalive\fR=\fIkeepalive interval\fR" 4
+.IX Item "--keepalive=keepalive interval"
+Interval in seconds when keepalive messages are sent to Lookup Service.
+This option has no effect, if Lookup Service registration is disabled.
+Note that the interval should be as long as possible, as this reduces
+communication overhead.
+.Sp
+Default: none. At least 12 hours recommended.
+.IP "\fB\-\-ls_url\fR=\fI\s-1LS\s0 \s-1URL\s0\fR" 4
+.IX Item "--ls_url=LS URL"
+Provide \s-1URL\s0 for Lookup Server (see above).
+Only needed when Lookup Service registration is enabled.
+Otherwise this option has no effect.
+.Sp
+Default: none
+.IP "\fB\-\-hostname\fR=\fI\s-1HOSTNAME\s0\fR" 4
+.IX Item "--hostname=HOSTNAME"
+.PD 0
+.IP "\fB\-\-organization\fR=\fI\s-1ORGANIZATION\s0\fR" 4
+.IX Item "--organization=ORGANIZATION"
+.IP "\fB\-\-contact\fR=\fI\s-1CONATCT\s0\fR" 4
+.IX Item "--contact=CONATCT"
+.PD
+These information are sent in the registration message to the
+Lookup Service.
+If registration is not enabled, these options have no effect.
+.Sp
+Default: none
+.SH "SIGNALS"
+.IX Header "SIGNALS"
+The oppd can be controlled by using various signals.
+.IP "\s-1SIGHUP\s0" 4
+.IX Item "SIGHUP"
+Ignored and daemon is \s-1NOT\s0 reconfigured at the moment.
+.IP "\s-1SIGINT\s0 and \s-1SIGTERM\s0" 4
+.IX Item "SIGINT and SIGTERM"
+Daemon terminates immediately. A \s-1SIGKILL\s0 is sent to the child
processes
+shortly after giving them the chance to exit properly by sending them a
+\&\s-1SIGTERM\s0.
+.IP "\s-1SIGUSR1\s0" 4
+.IX Item "SIGUSR1"
+Daemon terminates gracefully by sending all child processes a \s-1SIGUSR1\s0
and
+waiting a specified time (at the moment 30 seconds) before sending them a
+\&\s-1SIGKILL\s0.
+.IP "\s-1SIGUSR2\s0" 4
+.IX Item "SIGUSR2"
+Daemon terminates gracefully by sending all child processes a \s-1SIGUSR2\s0
and
+will \s-1NEVER\s0 send a \s-1SIGKILL\s0. The daemon might therefore wait
forever and never
+return!
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Start with a different configuration file:
+.PP
+.Vb 1
+\& $ oppd.pl \-\-config=/usr/local/etc/oppd.conf
+.Ve
+.PP
+Debug the daemon:
+.PP
+.Vb 2
+\& $ oppd.pl \-\-nodetach \e
+\& \-\-loglevel=debug \-\-nologfile \-\-nopidfile \-\-nosyslog
+.Ve
+.PP
+Use other some other options instead of the ones from configuration file:
+.PP
+.Vb 1
+\& $ oppd.pl \-\-port=51234 \-\-nologfile \-\-pidfile=oppd.pid
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+oppd.conf
+.SH "AUTHORS"
+.IX Header "AUTHORS"
+\&\s-1DFN\s0 Labor Erlangen,
win\-
+.SH "POD ERRORS"
+.IX Header "POD ERRORS"
+Hey! \fBThe above document had some coding errors, which are explained
below:\fR
+.IP "Around line 658:" 4
+.IX Item "Around line 658:"
+=cut found outside a pod block. Skipping to next block.
+.IP "Around line 701:" 4
+.IX Item "Around line 701:"
+=cut found outside a pod block. Skipping to next block.
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/README
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/README
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/README
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,109 @@
+oppd - open perl perfSONAR daemon
+---------------------------------
+
+Version: 0.51
+
+The oppd package contains a perl daemon script to serve as container for
+perfSONAR services. The services itself are implemented as perl module
+plugins and can be added individually. The oppd daemon needs several
+perl modules (available via e.g. CPAN) and the perl-NMWG library to run.
+
+For more information about perfSONAR, see www.perfsonar.net
+For more information about CPAN, see www.cpan.org
+
+1. Preparation:
+---------------
+
+Please make sure you have all dependencies installed properly before
+proceeding with the installation of oppd.
+
+Perl modules dependency list:
+-----------------------------
+perl version 5.8.0 or higher
+perl(Config::General)
+perl(HTTP::Daemon)
+perl(HTTP::Request)
+perl(HTTP::Response)
+perl(IPC::Shareable)
+perl(Log::Dispatch)
+perl(Log::Dispatch::File)
+perl(Log::Dispatch::Screen)
+perl(Log::Dispatch::Syslog)
+perl(LWP::UserAgent)
+perl(NMWG) >= 0.02
+perl(NMWG::Message)
+perl(URI)
+perl(XML::LibXML)
+perl(XML::LibXML::NodeList)
+
+As it is not recommended to run the daemon as root, you should create
+a user "perfsonar". The init script included in this package starts
+the daemon automatically as perfsonar user.
+
+For Linux use the following commands:
+/usr/sbin/groupadd perfsonar
+/usr/sbin/useradd -g perfsonar -s /sbin/nologin -c "perfsonar user" -d /
perfsonar
+
+
+2. Installation:
+----------------
+
+Change to oppd-0.51 directory and type the following commands:
+perl Build.PL --install_base=/usr/lib/perfsonar/services/oppd
+./Build install
+chown perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+
+The package provides a (Linux) init script which you can use to automate
+service start/stop. This script is tested under redhat and may need
+adjustments to work with other Linux flavours.
+If you are using the provided init script, you can add your service to your
+system startup (Linux):
+/sbin/chkconfig --add oppd
+
+You should also add some useful links:
+ln -s /usr/lib/perfsonar/services/oppd/etc/oppd.conf /etc/oppd.conf
+ln -s /usr/lib/perfsonar/services/oppd/doc /usr/share/doc/oppd-0.51/
+
+
+3. Run perfSONAR services:
+--------------------------
+
+To run perfSONAR services, you first have to install service modules, e.g.
+the BWCTL MP service module. When you have done that, you have to add a
+service entry, or a include line to a service configuration to the
+/etc/oppd.conf file.
+
+Then start the service via the startup script:
+oppd start
+
+or by hand:
+/usr/lib/perfsonar/services/oppd/bin/oppd.pl
+
+For start options and configuration file format please refer to the manual
+pages.
+
+
+4. Deinstallation:
+------------------
+
+First make sure that oppd.pl isn't running anymore.
+If you have added oppd.pl via chkconfig to your system, delete it:
+/sbin/chkconfig --del oppd
+
+Remove the links:
+rm -f /etc/oppd.conf
+rm -f /usr/share/doc/oppd-0.51/
+
+Delete the software completely:
+rm -rf usr/lib/perfsonar/services/oppd/
+
+Note that this will also delete any service plugins you might have installed
+additionally.
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008, 2009 DFN-Labor
+
+This program is released under the following license: bsd
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.Debian.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.Debian.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/changelog.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/copyright
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/copyright
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/share/doc/perfsonar-oppd/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.debhelper.log
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.debhelper.log
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.debhelper.log
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,16 @@
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_install
+dh_installinit
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb
Added:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.default
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.default
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.default
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,39 @@
+# Path to oppd.
+DAEMON=/usr/lib/perfsonar/services/oppd/bin/oppd.pl
+
+# Configuration file to parse for additional options.
+#CONFFILE=/etc/oppd.conf
+
+# pid file to use. The init script overwrites the pid file used (from
+# configuration file or default) to make sure that the init script can
control
+# the daemon via the pid file. Therefore you can change the pid file ONLY
here!
+#PIDFILE=/var/run/oppd.pid
+
+# log file to use. If you set a log file here, it will not only be set as the
+# log file used by the daemon (overriding value from configuration file). The
+# daemon will also care about the ownership of the file based on the
variables
+# DAEMONUSER and DAEMONGROUP you can find below.
+#LOGFILE=""
+
+# User to run the daemon as. Files (especially the pid file and log file, see
+# above) created by the daemon will be owned by this user.
+#DAEMONUSER=perfsonar
+
+# Group id used for pid file and log file (see above).
+#DAEMONGROUP=perfsonar
+
+# Additional command line options (overriding options from configuration
file!).
+#DAEMON_OPTS=""
+
+# Time to wait for the daemon to die, in seconds. If this value is set too
low
+# you might not let the daemon to die gracefully and 'restart' will not work
+#DIETIME=10
+
+# Time to wait for the daemon to start, in seconds. If this value is set each
+# time the daemon is started (on start or restart) the script will stall to
try
+# to determine if it is running. If it is not set and the server takes time
+# to setup a pid file the log message might be a false positive (says it did
+# not start when it actually did)
+#STARTTIME=2
+#STARTTIME=""
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.init
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.init
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.init
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,264 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: perfsonar-oppd
+# Required-Start: $network $local_fs
+# Required-Stop:
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: oppd (Open Perl PerfSONAR Daemon)
+# Description: oppd (Open Perl PerfSONAR Daemon)
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+DAEMON=/usr/bin/oppd.pl # Introduce the server's location here
+NAME=oppd # Introduce the short server's name here
+DESC="Open Perl PerfSONAR Daemon" # Introduce a short description here
+
+PIDFILE=/var/run/$NAME.pid
+
+. /lib/lsb/init-functions
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_OPTS=""
+DIETIME=10
+STARTTIME=2
+LOGFILE=/var/log/$NAME.log
+CONFFILE=/etc/oppd.conf
+DAEMONUSER=perfsonar
+DAEMONGROUP=perfsonar
+
+# Include defaults if available
+if [ -f /etc/default/$NAME ] ; then
+ . /etc/default/$NAME
+fi
+
+test -x $DAEMON || exit 0
+
+# Check that the user exists (if we set a user)
+# Does the user exist?
+if [ -n "$DAEMONUSER" ] ; then
+ if getent passwd | grep -q "^$DAEMONUSER:"; then
+ # Obtain the uid and gid
+ DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print
$3}'`
+ DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print
$4}'`
+ else
+ log_failure_msg "The user $DAEMONUSER, required to run $NAME does
not exist."
+ exit 1
+ fi
+fi
+
+
+set -e
+
+running_pid() {
+# Check if a given process pid's cmdline matches a given name
+ pid=$1
+ name=$2
+ [ -z "$pid" ] && return 1
+ [ ! -d /proc/$pid ] && return 1
+ cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 2 |tail -n 1|cut -d
: -f 1`
+ # Is this the expected server
+ [ "$cmd" != "$name" ] && return 1
+ return 0
+}
+
+running() {
+# Check if the process is running looking at /proc
+# (works for all users)
+
+ # No pidfile, probably no daemon present
+ [ ! -f "$PIDFILE" ] && return 1
+ pid=`cat $PIDFILE`
+ running_pid $pid $DAEMON || return 1
+ return 0
+}
+
+start_server() {
+# Start the process using the wrapper
+ touch "$PIDFILE"
+ chown $DAEMONUSER:$DAEMONGROUP "$PIDFILE"
+ if [ -n "$LOGFILE" ]
+ then
+ touch $LOGFILE
+ chown $DAEMONUSER:$DAEMONUSER $LOGFILE
+ DAEMON_OPTS="$DAEMON_OPTS --logfile=$LOGFILE"
+ fi
+
+ if [ -z "$DAEMONUSER" ] ; then
+ start_daemon -p $PIDFILE $DAEMON -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_OPTS
+ errcode=$?
+ else
+# if we are using a daemonuser then change the user id
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
+ --chuid $DAEMONUSER --exec $DAEMON -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_OPTS
+ errcode=$?
+ fi
+ return $errcode
+}
+
+stop_server() {
+# Stop the process using the wrapper
+# if [ -z "$DAEMONUSER" ] ; then
+# killproc -p $PIDFILE $DAEMON
+# errcode=$?
+# else
+# if we are using a daemonuser then look for process that match
+# start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+# --user $DAEMONUSER \
+# --name oppd.pl \
+# --retry 5
+# errcode=$?
+# fi
+#
+# return $errcode
+ killproc -p $PIDFILE /usr/bin/perl
+ errcode=$?
+ return $errcode
+}
+
+reload_server() {
+ [ ! -f "$PIDFILE" ] && return 1
+ pid=pidofproc $PIDFILE # This is the daemon's pid
+ # Send a SIGHUP
+ kill -1 $pid
+ return $?
+}
+
+force_stop() {
+# Force the process to die killing it manually
+ [ ! -e "$PIDFILE" ] && return
+ if running ; then
+ kill -15 $pid
+ # Is it really dead?
+ sleep "$DIETIME"s
+ if running ; then
+ kill -9 $pid
+ sleep "$DIETIME"s
+ if running ; then
+ echo "Cannot kill $NAME (pid=$pid)!"
+ exit 1
+ fi
+ fi
+ fi
+ rm -f $PIDFILE
+}
+
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC " "$NAME"
+ # Check if it's running first
+ if running ; then
+ log_progress_msg "apparently already running"
+ log_end_msg 0
+ exit 0
+ fi
+ if start_server ; then
+ # NOTE: Some servers might die some time after they start,
+ # this code will detect this issue if STARTTIME is set
+ # to a reasonable value
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
+ if running ; then
+ # It's ok, the server started and is running
+ log_end_msg 0
+ else
+ # It is not running after we did start
+ log_end_msg 1
+ fi
+ else
+ # Either we could not start it
+ log_end_msg 1
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ if running ; then
+ # Only stop the server if we see it running
+ errcode=0
+ stop_server || errcode=$?
+ log_end_msg $errcode
+ else
+ # If it's not running don't do anything
+ log_progress_msg "apparently not running"
+ log_end_msg 0
+ exit 0
+ fi
+ ;;
+ force-stop)
+ # First try to stop gracefully the program
+ $0 stop
+ if running; then
+ # If it's still running try to kill it more forcefully
+ log_daemon_msg "Stopping (force) $DESC" "$NAME"
+ errcode=0
+ force_stop || errcode=$?
+ log_end_msg $errcode
+ fi
+ ;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ errcode=0
+ stop_server || errcode=$?
+ # Wait some sensible amount, some server need this
+ [ -n "$DIETIME" ] && sleep $DIETIME
+ start_server || errcode=$?
+ [ -n "$STARTTIME" ] && sleep $STARTTIME
+ running || errcode=$?
+ log_end_msg $errcode
+ ;;
+ status)
+
+ log_daemon_msg "Checking status of $DESC" "$NAME"
+ if running ; then
+ log_progress_msg "running"
+ log_end_msg 0
+ else
+ log_progress_msg "apparently not running"
+ log_end_msg 1
+ exit 1
+ fi
+ ;;
+ # Use this if the daemon cannot reload
+ reload)
+ log_warning_msg "Reloading $NAME daemon: not implemented, as the
daemon"
+ log_warning_msg "cannot re-read the config file (use restart)."
+ ;;
+ # And this if it cann
+ #reload)
+ #
+ # If the daemon can reload its config files on the fly
+ # for example by sending it SIGHUP, do it here.
+ #
+ # If the daemon responds to changes in its config file
+ # directly anyway, make this a do-nothing entry.
+ #
+ # log_daemon_msg "Reloading $DESC configuration files" "$NAME"
+ # if running ; then
+ # reload_server
+ # if ! running ; then
+ # Process died after we tried to reload
+ # log_progress_msg "died on reload"
+ # log_end_msg 1
+ # exit 1
+ # fi
+ # else
+ # log_progress_msg "server is not running"
+ # log_end_msg 1
+ # exit 1
+ # fi
+
#;;
+
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}"
>&2
+ exit 1
+ ;;
+esac
+
+exit 0
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/debian/perfsonar-oppd.oppd.init
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/postinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/postinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/postinst 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ chown root:root /etc/init.d/oppd
+ chmod 755 /etc/init.d/oppd
+ chown -R perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/postrm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/postrm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/postrm 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,55 @@
+#!/bin/sh
+# postrm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge|abort-install)
+ #/usr/sbin/userdel perfsonar
+ #/usr/sbin/groupdel perfsonar
+ ;;
+
+ remove|disappear)
+ ;;
+
+ upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ ;;
+
+ failed-upgrade|abort-upgrade)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/preinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/preinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/preinst 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,99 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+ install)
+ [ -z "$SERVER_HOME" ] && SERVER_HOME=/usr/lib/perfsonar
+ [ -z "$SERVER_USER" ] && SERVER_USER=perfsonar
+ [ -z "$SERVER_NAME" ] && SERVER_NAME="Open Perl perfSONAR Daemon"
+ [ -z "$SERVER_GROUP" ] && SERVER_GROUP=perfsonar
+
+ # create group if not existing
+ if ! getent group | grep -q "^$SERVER_GROUP:" ; then
+ echo -n "Adding group $SERVER_GROUP.."
+ addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
+ echo "..done"
+ fi
+ # create user if not existing
+ if ! getent passwd | grep -q "^$SERVER_USER:"; then
+ echo -n "Adding system user $SERVER_USER.."
+ adduser --quiet \
+ --system \
+ --ingroup $SERVER_GROUP \
+ --no-create-home \
+ --disabled-password \
+ $SERVER_USER 2>/dev/null || true
+ echo "..done"
+ fi
+ # 4. adjust passwd entry
+ usermod -c "$SERVER_NAME" \
+ -d $SERVER_HOME \
+ -g $SERVER_GROUP \
+ $SERVER_USER
+ # 5. adjust file and directory permissions
+ if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
+ then
+ #Check if directory exist
+ if [ ! -d $SERVER_HOME ];
+ then
+ mkdir -p $SERVER_HOME
+ fi
+
+ chown -R $SERVER_USER:$SERVER_GROUP $SERVER_HOME
+ chmod u=rwx,g=rx,o=rx $SERVER_HOME
+ fi
+ ;;
+ configure)
+
+
+ #/usr/sbin/groupadd -f perfsonar
+ #/usr/sbin/useradd -g perfsonar -s /sbin/nologin -c "perfsonar user" -d
/ perfsonar
+ #mkdir -p /usr/lib/perfsonar/services/oppd
+ #chown perfsonar:perfsonar /usr/lib/perfsonar/services/oppd
+ ;;
+
+ upgrade)
+ #Check if oppd is running. If running stop it first
+ if ps ax | grep -v grep | grep oppd > /dev/null; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/prerm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/prerm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/prerm 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ upgrade)
+ /etc/init.d/oppd stop
+ ;;
+
+ remove|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-0.51/debian/rules
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/debian/rules
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/debian/rules 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,88 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+
+build-stamp:
+ dh_testdir
+
+ # Add here commands to compile the package.
+ #docbook-to-man debian/perfsonar-oppd.sgml > perfsonar-oppd.1
+ $(PERL) Build.PL --install_path etc=$(DESTDIR)/etc --install_path
bin=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
script=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
lib=$(DESTDIR)/usr/lib/perfsonar/services/oppd/lib --install_path
bindoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
libdoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
xmltemplates=$(DESTDIR)/usr/lib/perfsonar/services/oppd/etc/oppd
--install_path oppd_doc=$(DESTDIR)/usr/share/doc/perfsonar-oppd
+ $(PERL) Build
+ $(PERL) Build test
+
+ touch $@
+
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ dh_clean build-stamp install-stamp
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/perfsonar-oppd.
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs Changes
+ dh_installdocs
+ dh_installexamples
+ dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+ dh_installinit --restart-after-upgrade
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on: trunk/build/debian/perfsonar-oppd-0.51/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_request.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_request.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_request.xml 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,8 @@
+<nmwg:message id="authNMessage1" type="AuthNEERequest"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="authNMetadata">
+ <nmwg:parameters id="keys">
+ <nmwg:parameter name="SecurityToken"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:data id="authN1" metadataIdRef="authNMetadata"/>
+ </nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_response.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_response.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/Auth_response.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+<nmwg:message id="authNMessage1_resp" messageIdRef="authNMessage1"
type="AuthNEEResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="localhost.localdomain.2c534c44:114b3c44663:-7fcd">
+ <nmwg:eventType>success.as.authn</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="localhost.localdomain.2c534c44:114b3c44663:-7fcc"
metadataIdRef="localhost.localdomain.2c534c44:114b3c44663:-7fcd"/>
+ </nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/LS_KeyRequest.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/LS_KeyRequest.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/LS_KeyRequest.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<nmwg:message type="LSKeyRequest"
+ id="msg1"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters"
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/">
+ <psservice:service id="serviceParameters"
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+ <psservice:serviceName>My_test_MA</psservice:serviceName>
+
<psservice:accessPoint>http://localhost:8080/axis/services/snmpMA</psservice:accessPoint>
+ <psservice:serviceType>MA</psservice:serviceType>
+ <psservice:serviceDescription>This is my testing
MA</psservice:serviceDescription>
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo" />
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/LS_deregister.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/LS_deregister.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/LS_deregister.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSDeregisterRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_remove">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_remove" id="data"/> <!-- empty trigger
-->
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/LS_keepalive.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/LS_keepalive.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/LS_keepalive.xml 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,17 @@
+<nmwg:message type="LSKeepaliveRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_keepalive">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ <!--
+ <nmwg:parameter
name="lsKey">5cfb07ea7a5b840ce4f8f48b842ac9c0</nmwg:parameter>
+ -->
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_keepalive" id="d1"/>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/LS_register.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/LS_register.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/LS_register.xml 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSRegisterRequest"
+ id="msg1"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <!--
+
xmlns:nmtl3="http://ogf.org/schema/network/topology/l3/20070828/"
+
xmlns:nmtb="http://ogf.org/schema/network/topology/base/20070828/">
+ -->
+
+ <!-- Contains service description with accessPoint which will be the key
in the database! -->
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters">
+ <psservice:service id="serviceParameters">
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo">
+ </nmwg:data>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,470 @@
+#
+# Example configuration file for the Open Perl PerfSONAR Daemon (oppd)
+#
+# Comments are indicated by a leading '#'.
+# All configuration options are commented out in this example and therefore
+# their default values are used. Each option is set via a key and value pair
+# either separated by one or more whitspaces, or by '='.
+# See 'man oppd' and 'man oppd.conf' for more information.
+#
+
+
+#
+# detach - Detach from terminal.
+#
+# Detach from terminal, aka run in background (instead of foreground).
+# Log messages will not be sent to STDERR.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# detach off
+#
+#detach on
+
+
+#
+# logfile - Name of log file.
+#
+# Append messages to the specified file.
+#
+# Set it to no, off, 0, or false to disable log file usage.
+# Set it to yes, on, 1, or true to enable logging to default log file
+# "/var/log/oppd.log".
+#
+# You can use this option together with "syslog" (see below).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to log file
+#
+# Default: off
+#
+# Example:
+# logfile "/var/log/oppd.log"
+#
+#logfile off
+
+
+#
+# syslog - Whether messages should be written to system log.
+#
+# Set it to no, off, 0, or false to disable sending messages to system log.
+# Set it to yes, on, 1, or true to enable sending messages to system log.
+#
+# You can use this option together with "logfile" (see above).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# syslog on
+#
+#syslog off
+
+
+#
+# syslog-host - The (optional) host to which system log messages are
forwarded.
+#
+# If this option is set to a dns name or ip address, all system log messages
+# are forwarded to the specified remote host.
+# If set to no, off, 0, false, or "" logging is done locally.
+#
+# Valid options: no, off, 0, false, name or ip of syslog host
+#
+# Default: off
+#
+# Example:
+# syslog-host "syslog.nowhere.com"
+#
+#syslog-host off
+
+
+#
+# syslog-ident - Identification string for system log messages.
+#
+# This string will be prepended to all messages in the system log.
+#
+# Default: oppd
+#
+# Example:
+# syslog-ident "hades-tracert"
+#
+#syslog-ident "oppd"
+
+
+#
+# syslog-facility - Type of program for system logging.
+#
+# This string will be used as the system log facility for messages sent to
+# the system log.
+# See your syslog documentation for the facilities available on your system.
+#
+# Valid options: (Typical facilities.)
+# auth, authpriv, cron, daemon, kern, local0 through local7, mail, news,
+# syslog, user, uucp
+#
+# Default: daemon
+#
+# Example:
+# syslog-facility "local0"
+#
+#syslog-facility "daemon"
+
+
+#
+# loglevel - The log level used for logging to syslog and to the log files.
+#
+# This option is used for setting the verbosity of the running daemon.
+# The log levels available are the log levels defined by Log::Dispatch.
+#
+# Valid options: (This is a list of values that should be accepted.)
+# 0 = debug
+# 1 = info
+# 2 = notice
+# 3 = warning
+# 4 = err = error
+# 5 = crit = critical
+# 6 = alert
+# 7 = emerg = emergency
+#
+# Default: notice
+#
+# Example:
+# loglevel "info"
+#
+#loglevel "notice"
+
+
+#
+# pidfile - Name of pid file.
+#
+# Set it to no, off, 0, or false to disable pid file usage.
+# Set it to yes, on, 1, or true to write pid file to default position
+# "/var/run/oppd.pid".
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to pid file
+#
+# Default: /var/run/oppd.pid
+#
+# Example:
+# pidfile off
+#
+#pidfile "/var/run/oppd.pid"
+
+
+#
+# port - Port used to listen on incoming connections
+#
+# Port used to listen on incoming connections.
+#
+# Valid options: integer number
+#
+# Default: 8090
+#
+# Example:
+# port 12345
+#
+#port 8090
+
+
+#
+# max_proc - Maximum number of parallel running request processes.
+#
+# Set the maximum number of processes to be spawned for handling incoming
+# requests.
+#
+# Valid options: integer number
+#
+# Default: 5
+#
+# Example:
+# max_proc 20
+#
+#max_proc 5
+
+
+###############################################################################
+#
+# Options for Lookup Service communication:
+#
+###############################################################################
+
+#
+# ls_register - Lookup Service registration.
+#
+# Enable or disable Lookup Service registration.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ls_register on
+#
+#ls_register off
+
+
+#
+# keepalive - Keep alive interval.
+#
+# The keep alive interval for sending registration information to Lookup
+# Service in seconds.
+#
+# Valid options: integer number
+#
+# Default: 3600 (1 hour)
+#
+# Example:
+# keepalive 7200
+#
+#keepalive 3600
+
+
+#
+# ls_url - Lookup Service address.
+#
+# For every Lookup Service you want to send the registration information to
+# you should put one ls_url line in the configuration file. All you need is
to
+# give the address of the service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# ls_url "http://myls.mydomain.org:8080/ervices/LookupService"
+# ls_url "http://188.1.36.53:8080/axis/services/LookupService"
+# ls_url
"http://loco3.man.poznan.pl:8080/LookupService/services/LookupService"
+# ls_url "http://selena.acad.bg:8070/axis/services/LookupService"
+# ls_url
"http://ndb0-aami.internet2.edu:9095/perfSONAR_PS/services/hLS"
+# ls_url "http://ndb1.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url "http://dc211.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url
"http://loco4.man.poznan.pl:8180/geant2-java-xml-ls/services/LookupService"
+#
+#ls_url [FILL ME]
+
+
+#
+# hostname - Host name sent to the Lookup Service.
+#
+# Host name sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# hostname "myhost.mydomain.org"
+#
+#hostname [FILL ME]
+
+
+#
+# organization - Organization sent to the Lookup Service.
+#
+# Organization sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# organization "My Company"
+#
+#organization [FILL ME]
+
+
+#
+# contact - Contact e-mail address sent to the Lookup Service.
+#
+# Contact e-mail address sent to the Lookup Service.
+#
+# Valid options: e-mail address
+#
+# Default: none
+#
+# Example:
+# contact
""
+#
+#contact [FILL ME]
+
+
+###############################################################################
+#
+# Options for Authentication communication:
+#
+###############################################################################
+
+#
+# auth - Use Authentication Service.
+#
+# Enable or disable authentication via Authentication Service.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# auth on
+#
+#auth off
+
+
+#
+# as_url - Location of Authentication Service.
+#
+# Location of the Authentication Service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# as_url "http://myas.mydomain.org:8080/services/AuthService"
+# as_url "http://myas.rediris.es:8080/services/AuthService"
+# as_url
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService"
+#
+#as_url [FILL ME]
+
+
+###############################################################################
+#
+# SSL configuration options
+#
+###############################################################################
+
+#
+# ssl - SSL (Secure Socket Layer) support.
+#
+# Enable or disable SSL (Secure Socket Layer) support, which means that
+# the daemon will expect HTTPS requests instead of normal HTTP request.
+# IMPORTANT: Normal HTTP requests will not work anymore if SSL is enabled!
+# IMPORTANT: Most of the following options are necessary for SSL. You should
+# take care of all of them and make sure that you really know what
+# you are doing! If oppd is missing a necessary option, you will
get
+# an error message and the daemon will not start!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ssl on
+#
+#ssl off
+
+
+#
+# ssl_cert_file - SSL certificate file.
+#
+# Use this option to specify the location of your certificate.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_cert_file /var/www/certs/server-cert.pem
+#
+#ssl_cert_file [FILL ME]
+
+
+#
+# ssl_key_file - SSL server key file.
+#
+# Use this option to specify the location of your server key file.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_key_file /var/www/certs/server-key.pem
+#
+#ssl_key_file [FILL ME]
+
+
+#
+# ssl_verify_client - Verify SSL client certificate.
+#
+# Enable or Disable the verification of the SSL client certificate. This is
+# normally used as a method of client authentication.
+# IMPORTANT: This option is enabled by default, because you normally don't
want
+# to allow access to perfSONAR services by untrusted users. You
+# should only disable it if you really know what you are doing!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# ssl_verify_client off
+#
+#ssl_verify_client on
+
+
+#
+# ssl_ca_file - SSL certificate(s) of the reputable certificate authorities.
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_path below) to locate the file
+# containing the certificate(s) of the reputable certificate authorities.
+# There is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_ca_file /var/www/certs/my-ca.pem
+#
+#ssl_ca_file [FILL ME]
+
+
+#
+# ssl_ca_path - Directory containing SSL certificate(s)
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_file above) to locate the
certificate(s)
+# of the reputable certificate authorities.
+# If you are unusually friendly with the OpenSSL documentation, you might
have
+# set yourself up a directory containing several trusted certificates as
+# separate files as well as an index of the certificates.
+# Use this option to specify the location of this directory.
+# There is NO default value!
+#
+# Valid options: Directory path
+#
+# Default: none
+#
+# Example:
+# ssl_ca_path /var/www/certs/ca/
+#
+#ssl_ca_path [FILL ME]
+
+
+###############################################################################
+#
+# Configuring services
+#
+###############################################################################
+#
+# You have to define (at least) one or more <service> sections for every
+# perfSONAR services you want to provide. Instead of defining them all here
+# in this file, it is most likely more comfortable to use the following
+# statement to include all files in the subdirectory oppd.d ending with
suffix
+# .conf. In this directory you should put every service into it's own file.
+# But you are, of course, free to do everything your own way!
+#
+###############################################################################
+
+include oppd.d/*.conf
+
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf.example
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf.example
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.conf.example
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,470 @@
+#
+# Example configuration file for the Open Perl PerfSONAR Daemon (oppd)
+#
+# Comments are indicated by a leading '#'.
+# All configuration options are commented out in this example and therefore
+# their default values are used. Each option is set via a key and value pair
+# either separated by one or more whitspaces, or by '='.
+# See 'man oppd' and 'man oppd.conf' for more information.
+#
+
+
+#
+# detach - Detach from terminal.
+#
+# Detach from terminal, aka run in background (instead of foreground).
+# Log messages will not be sent to STDERR.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# detach off
+#
+#detach on
+
+
+#
+# logfile - Name of log file.
+#
+# Append messages to the specified file.
+#
+# Set it to no, off, 0, or false to disable log file usage.
+# Set it to yes, on, 1, or true to enable logging to default log file
+# "/var/log/oppd.log".
+#
+# You can use this option together with "syslog" (see below).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to log file
+#
+# Default: off
+#
+# Example:
+# logfile "/var/log/oppd.log"
+#
+#logfile off
+
+
+#
+# syslog - Whether messages should be written to system log.
+#
+# Set it to no, off, 0, or false to disable sending messages to system log.
+# Set it to yes, on, 1, or true to enable sending messages to system log.
+#
+# You can use this option together with "logfile" (see above).
+# Messages will then be written to both, log file and system log.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# syslog on
+#
+#syslog off
+
+
+#
+# syslog-host - The (optional) host to which system log messages are
forwarded.
+#
+# If this option is set to a dns name or ip address, all system log messages
+# are forwarded to the specified remote host.
+# If set to no, off, 0, false, or "" logging is done locally.
+#
+# Valid options: no, off, 0, false, name or ip of syslog host
+#
+# Default: off
+#
+# Example:
+# syslog-host "syslog.nowhere.com"
+#
+#syslog-host off
+
+
+#
+# syslog-ident - Identification string for system log messages.
+#
+# This string will be prepended to all messages in the system log.
+#
+# Default: oppd
+#
+# Example:
+# syslog-ident "hades-tracert"
+#
+#syslog-ident "oppd"
+
+
+#
+# syslog-facility - Type of program for system logging.
+#
+# This string will be used as the system log facility for messages sent to
+# the system log.
+# See your syslog documentation for the facilities available on your system.
+#
+# Valid options: (Typical facilities.)
+# auth, authpriv, cron, daemon, kern, local0 through local7, mail, news,
+# syslog, user, uucp
+#
+# Default: daemon
+#
+# Example:
+# syslog-facility "local0"
+#
+#syslog-facility "daemon"
+
+
+#
+# loglevel - The log level used for logging to syslog and to the log files.
+#
+# This option is used for setting the verbosity of the running daemon.
+# The log levels available are the log levels defined by Log::Dispatch.
+#
+# Valid options: (This is a list of values that should be accepted.)
+# 0 = debug
+# 1 = info
+# 2 = notice
+# 3 = warning
+# 4 = err = error
+# 5 = crit = critical
+# 6 = alert
+# 7 = emerg = emergency
+#
+# Default: notice
+#
+# Example:
+# loglevel "info"
+#
+#loglevel "notice"
+
+
+#
+# pidfile - Name of pid file.
+#
+# Set it to no, off, 0, or false to disable pid file usage.
+# Set it to yes, on, 1, or true to write pid file to default position
+# "/var/run/oppd.pid".
+#
+# Valid options: yes, on, 1, true, no, off, 0, false, path to pid file
+#
+# Default: /var/run/oppd.pid
+#
+# Example:
+# pidfile off
+#
+#pidfile "/var/run/oppd.pid"
+
+
+#
+# port - Port used to listen on incoming connections
+#
+# Port used to listen on incoming connections.
+#
+# Valid options: integer number
+#
+# Default: 8090
+#
+# Example:
+# port 12345
+#
+#port 8090
+
+
+#
+# max_proc - Maximum number of parallel running request processes.
+#
+# Set the maximum number of processes to be spawned for handling incoming
+# requests.
+#
+# Valid options: integer number
+#
+# Default: 5
+#
+# Example:
+# max_proc 20
+#
+#max_proc 5
+
+
+###############################################################################
+#
+# Options for Lookup Service communication:
+#
+###############################################################################
+
+#
+# ls_register - Lookup Service registration.
+#
+# Enable or disable Lookup Service registration.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ls_register on
+#
+#ls_register off
+
+
+#
+# keepalive - Keep alive interval.
+#
+# The keep alive interval for sending registration information to Lookup
+# Service in seconds.
+#
+# Valid options: integer number
+#
+# Default: 3600 (1 hour)
+#
+# Example:
+# keepalive 7200
+#
+#keepalive 3600
+
+
+#
+# ls_url - Lookup Service address.
+#
+# For every Lookup Service you want to send the registration information to
+# you should put one ls_url line in the configuration file. All you need is
to
+# give the address of the service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# ls_url "http://myls.mydomain.org:8080/ervices/LookupService"
+# ls_url "http://188.1.36.53:8080/axis/services/LookupService"
+# ls_url
"http://loco3.man.poznan.pl:8080/LookupService/services/LookupService"
+# ls_url "http://selena.acad.bg:8070/axis/services/LookupService"
+# ls_url
"http://ndb0-aami.internet2.edu:9095/perfSONAR_PS/services/hLS"
+# ls_url "http://ndb1.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url "http://dc211.internet2.edu:9995/perfSONAR_PS/services/hLS"
+# ls_url
"http://loco4.man.poznan.pl:8180/geant2-java-xml-ls/services/LookupService"
+#
+#ls_url [FILL ME]
+
+
+#
+# hostname - Host name sent to the Lookup Service.
+#
+# Host name sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# hostname "myhost.mydomain.org"
+#
+#hostname [FILL ME]
+
+
+#
+# organization - Organization sent to the Lookup Service.
+#
+# Organization sent to the Lookup Service.
+#
+# Valid options: String
+#
+# Default: none
+#
+# Example:
+# organization "My Company"
+#
+#organization [FILL ME]
+
+
+#
+# contact - Contact e-mail address sent to the Lookup Service.
+#
+# Contact e-mail address sent to the Lookup Service.
+#
+# Valid options: e-mail address
+#
+# Default: none
+#
+# Example:
+# contact
""
+#
+#contact [FILL ME]
+
+
+###############################################################################
+#
+# Options for Authentication communication:
+#
+###############################################################################
+
+#
+# auth - Use Authentication Service.
+#
+# Enable or disable authentication via Authentication Service.
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# auth on
+#
+#auth off
+
+
+#
+# as_url - Location of Authentication Service.
+#
+# Location of the Authentication Service as URL.
+#
+# Valid options: URL
+#
+# Default: none
+#
+# Example:
+# as_url "http://myas.mydomain.org:8080/services/AuthService"
+# as_url "http://myas.rediris.es:8080/services/AuthService"
+# as_url
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService"
+#
+#as_url [FILL ME]
+
+
+###############################################################################
+#
+# SSL configuration options
+#
+###############################################################################
+
+#
+# ssl - SSL (Secure Socket Layer) support.
+#
+# Enable or disable SSL (Secure Socket Layer) support, which means that
+# the daemon will expect HTTPS requests instead of normal HTTP request.
+# IMPORTANT: Normal HTTP requests will not work anymore if SSL is enabled!
+# IMPORTANT: Most of the following options are necessary for SSL. You should
+# take care of all of them and make sure that you really know what
+# you are doing! If oppd is missing a necessary option, you will
get
+# an error message and the daemon will not start!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: off
+#
+# Example:
+# ssl on
+#
+#ssl off
+
+
+#
+# ssl_cert_file - SSL certificate file.
+#
+# Use this option to specify the location of your certificate.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_cert_file /var/www/certs/server-cert.pem
+#
+#ssl_cert_file [FILL ME]
+
+
+#
+# ssl_key_file - SSL server key file.
+#
+# Use this option to specify the location of your server key file.
+# This option is required and there is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_key_file /var/www/certs/server-key.pem
+#
+#ssl_key_file [FILL ME]
+
+
+#
+# ssl_verify_client - Verify SSL client certificate.
+#
+# Enable or Disable the verification of the SSL client certificate. This is
+# normally used as a method of client authentication.
+# IMPORTANT: This option is enabled by default, because you normally don't
want
+# to allow access to perfSONAR services by untrusted users. You
+# should only disable it if you really know what you are doing!
+#
+# Valid options: yes, on, 1, true, no, off, 0, false
+#
+# Default: on
+#
+# Example:
+# ssl_verify_client off
+#
+#ssl_verify_client on
+
+
+#
+# ssl_ca_file - SSL certificate(s) of the reputable certificate authorities.
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_path below) to locate the file
+# containing the certificate(s) of the reputable certificate authorities.
+# There is NO default value!
+#
+# Valid options: File path (file format should be PEM)
+#
+# Default: none
+#
+# Example:
+# ssl_ca_file /var/www/certs/my-ca.pem
+#
+#ssl_ca_file [FILL ME]
+
+
+#
+# ssl_ca_path - Directory containing SSL certificate(s)
+#
+# If you want to verify that the peer certificate has been signed by a
+# reputable certificate authority (see ssl_verify_client above), then you
+# must use this option (and/or ssl_ca_file above) to locate the
certificate(s)
+# of the reputable certificate authorities.
+# If you are unusually friendly with the OpenSSL documentation, you might
have
+# set yourself up a directory containing several trusted certificates as
+# separate files as well as an index of the certificates.
+# Use this option to specify the location of this directory.
+# There is NO default value!
+#
+# Valid options: Directory path
+#
+# Default: none
+#
+# Example:
+# ssl_ca_path /var/www/certs/ca/
+#
+#ssl_ca_path [FILL ME]
+
+
+###############################################################################
+#
+# Configuring services
+#
+###############################################################################
+#
+# You have to define (at least) one or more <service> sections for every
+# perfSONAR services you want to provide. Instead of defining them all here
+# in this file, it is most likely more comfortable to use the following
+# statement to include all files in the subdirectory oppd.d ending with
suffix
+# .conf. In this directory you should put every service into it's own file.
+# But you are, of course, free to do everything your own way!
+#
+###############################################################################
+
+include oppd.d/*.conf
+
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_request.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_request.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_request.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,8 @@
+<nmwg:message id="authNMessage1" type="AuthNEERequest"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="authNMetadata">
+ <nmwg:parameters id="keys">
+ <nmwg:parameter name="SecurityToken"/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:data id="authN1" metadataIdRef="authNMetadata"/>
+ </nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_response.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_response.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/Auth_response.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+<nmwg:message id="authNMessage1_resp" messageIdRef="authNMessage1"
type="AuthNEEResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="localhost.localdomain.2c534c44:114b3c44663:-7fcd">
+ <nmwg:eventType>success.as.authn</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="localhost.localdomain.2c534c44:114b3c44663:-7fcc"
metadataIdRef="localhost.localdomain.2c534c44:114b3c44663:-7fcd"/>
+ </nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_KeyRequest.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_KeyRequest.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_KeyRequest.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<nmwg:message type="LSKeyRequest"
+ id="msg1"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters"
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/">
+ <psservice:service id="serviceParameters"
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+ <psservice:serviceName>My_test_MA</psservice:serviceName>
+
<psservice:accessPoint>http://localhost:8080/axis/services/snmpMA</psservice:accessPoint>
+ <psservice:serviceType>MA</psservice:serviceType>
+ <psservice:serviceDescription>This is my testing
MA</psservice:serviceDescription>
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo" />
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_deregister.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_deregister.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_deregister.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSDeregisterRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_remove">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_remove" id="data"/> <!-- empty trigger
-->
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_keepalive.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_keepalive.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_keepalive.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,17 @@
+<nmwg:message type="LSKeepaliveRequest"
+ id="msg1"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+
+ <nmwg:metadata id="key_to_keepalive">
+ <nmwg:key>
+ <nmwg:parameters id="keys">
+ <!--
+ <nmwg:parameter
name="lsKey">5cfb07ea7a5b840ce4f8f48b842ac9c0</nmwg:parameter>
+ -->
+ </nmwg:parameters>
+ </nmwg:key>
+ </nmwg:metadata>
+
+ <nmwg:data metadataIdRef="key_to_keepalive" id="d1"/>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_register.xml
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_register.xml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.d/LS_register.xml
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<nmwg:message type="LSRegisterRequest"
+ id="msg1"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+
xmlns:perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/"
+
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
+ <!--
+
xmlns:nmtl3="http://ogf.org/schema/network/topology/l3/20070828/"
+
xmlns:nmtb="http://ogf.org/schema/network/topology/base/20070828/">
+ -->
+
+ <!-- Contains service description with accessPoint which will be the key
in the database! -->
+
+ <nmwg:metadata id="serviceLookupInfo">
+ <perfsonar:subject id="commonParameters">
+ <psservice:service id="serviceParameters">
+ </psservice:service>
+ </perfsonar:subject>
+ </nmwg:metadata>
+ <nmwg:data id="data" metadataIdRef="serviceLookupInfo">
+ </nmwg:data>
+
+</nmwg:message>
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.default.debian
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.default.debian
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.default.debian
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,40 @@
+# Path to oppd.
+DAEMON=/usr/lib/perfsonar/services/oppd//bin/oppd.pl
+
+# Configuration file to be used by oppd.
+CONFFILE=/etc/oppd.conf
+
+# pid file to use. The init script overwrites the pid file used (from
+# configuration file or default) to make sure that the init script can
control
+# the daemon via the pid file. Therefore you can change the pid file ONLY
here!
+PIDFILE=/var/run/oppd.pid
+
+# log file to use. If you set a log file here, it will not only be set as the
+# log file used by the daemon (overriding value from configuration file). The
+# daemon will also care about the ownership of the file based on the
variables
+# DAEMONUSER and DAEMONGROUP you can find below.
+LOGFILE=""
+
+# User to run the daemon as. Files (especially the pid file and log file, see
+# above) created by the daemon will be owned by this user.
+#DAEMONUSER=perfsonar
+
+# Group id used for pid file and log file (see above).
+#DAEMONGROUP=perfsonar
+
+# Additional command line arguments (overriding options from configuration
+# file!).
+#DAEMON_ARGS=""
+
+# Time to wait for the daemon to die, in seconds. If this value is set too
low
+# you might not let the daemon die gracefully and 'restart' may not work.
+#DIETIME=30
+
+# Time to wait for the daemon to start, in seconds. If this value is set each
+# time the daemon is started (on start or restart) the script will stall to
try
+# to determine if it is running. If it is not set and the server takes time
+# to setup a pid file the log message might be a false positive (says it did
+# not start when it actually did)
+# Example: STARTTIME=2
+#STARTTIME=""
+
Added: trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.init.debian
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.init.debian
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.init.debian 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,183 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: perfsonar-oppd
+# Required-Start: $network $local_fs
+# Required-Stop:
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: oppd (Open Perl PerfSONAR Daemon)
+# Description: oppd (Open Perl PerfSONAR Daemon)
+### END INIT INFO
+
+# Author: WiN-Labor
<>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+NAME=oppd
+# For start-stop-daemon's --name
+SNAME=oppd.pl
+DAEMON=/usr/bin/oppd.pl
+DESC="Open Perl PerfSONAR Daemon"
+
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Default options, these can be overriden by the information
+# at /etc/default/$NAME
+DAEMON_ARGS=""
+DIETIME=30
+#STARTTIME=2
+LOGFILE=""
+CONFFILE=/etc/oppd.conf
+DAEMONUSER=perfsonar
+DAEMONGROUP=perfsonar
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Check that the user exists (if we set a user)
+# Does the user exist?
+if [ -n "$DAEMONUSER" ] ; then
+ if getent passwd | grep -q "^$DAEMONUSER:"; then
+ # Obtain the uid and gid
+ DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
+ DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
+ else
+ log_failure_msg "The user $DAEMONUSER, required to run $NAME does not
exist."
+ exit 1
+ fi
+fi
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ touch "$PIDFILE"
+ chown $DAEMONUSER:$DAEMONGROUP "$PIDFILE"
+ if [ -n "$LOGFILE" ]
+ then
+ touch $LOGFILE
+ chown $DAEMONUSER:$DAEMONUSER $LOGFILE
+ DAEMON_ARGS="$DAEMON_ARGS --logfile=$LOGFILE"
+ fi
+
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test
> /dev/null \
+ || return 1
+ if [ -z "$DAEMONUSER" ] ; then
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ else
+ # if we are using a daemonuser then change the user id
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
+ --chuid $DAEMONUSER -- \
+ --config="$CONFFILE" --pidfile="$PIDFILE" $DAEMON_ARGS \
+ || return 2
+ fi
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
+ pidofproc -p $PIDFILE > /dev/null || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/$DIETIME/KILL/5 --pidfile
$PIDFILE --name $SNAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # oppd takes care about its children. Nevertheless take care about them
here!
+ # Important: The following command will kill more or less all running oppd.
+ #TODO Is this working at all? Or is start-stop-daemon only seeing
+ # /usr/bin/perl ?
+ start-stop-daemon --stop --quiet --oknodo --retry=0/$DIETIME/KILL/5 --exec
$DAEMON
+ [ "$?" = 2 ] && return 2
+ # oppd should delete its pid file, but perhaps it doesn't have the right
+ # to do it!!
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name
$SNAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ #reload|force-reload)
+ #
+ # do_reload() is available above, but not implemented by oppd yet. So leave
+ # this commented out and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ status_of_proc -p $PIDFILE "" $NAME
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}"
>&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/etc/oppd.init.debian
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/install
===================================================================
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Auth.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Auth.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Auth.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,228 @@
+package perfSONAR::Auth;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use Carp;
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use perfSONAR qw(print_log);
+
+## Authentication: send Auth-request to server, then proceed.
+# do the following:
+# - get <nmwg:parameter name="SecurityToken"> from header
+# - check <wsse:Security> element
+# - read in template fill in <nmwg:parameter name="SecurityToken">
+# - add $header to message
+# - send message to AS
+# - wait for response from AS (timeout)
+# - parse response from AS for <nmwg:eventType>XXXXXXX</nmwg:eventType>
+# - either respond with error result (see
<nmwg:eventType>XXXXXXX</nmwg:eventType>)
+# - or: go on with normal operation (adding a result code with
+# <nmwg:eventType>XXXXXXX</nmwg:eventType>)
+#
+# TODO:
+# - parse error description from AS (necessary?)
+# - authenticate based on messagetype!! (-> different structure, is this
useful?
+# better: athentication based on service!)
+
+ my $saml_token =
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
+ my $x509_token =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ my $AS_uri =
"http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService";
+
+
+sub authenticate {
+ my $soapmsg = shift;
+ my $reqmsg =shift;
+ my $as_uri = shift;
+
+ my $token;
+
+ print_log("info", "Authentication:\n");
+ if ((!defined ($soapmsg)) ||
!(UNIVERSAL::isa($soapmsg,"perfSONAR::SOAP::Message"))){
+ croak "No valid message given!\n";
+ }
+ if ((!defined ($as_uri)) || UNIVERSAL::isa($as_uri,"URI")){
+ #croak;
+ $as_uri = $AS_uri; #get default
+ }
+ if (!$soapmsg->header){
+ my $errorstring = "No authentication information in SOAP header!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ return $reqmsg;
+ } else {
+ $token = check_token($soapmsg->header);
+ }
+ if (!(defined $token)) {
+ my $errorstring = "Authentication token in header is missing!";
+ print_log("error", "$errorstring\n");
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.no_sectoken", "$errorstring",
"message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "AuthNEERequest"){ #authorization request
to dummy AS
+ return $reqmsg;
+ }
+ if ($reqmsg->get_message_type eq "EchoRequest"){ #EchoRequest ping
unauthorized
+ return $reqmsg;
+ }
+ my $authmsg = create_authmsg($token);
+ #clone header TODO: necessary??
+ my @header = clone_header($soapmsg->header);
+ #my @header = $soapmsg->header;
+ #send message to server:
+ my $soap_auth_msg = perfSONAR::SOAP::Message->new(
+ body => $authmsg->as_dom,
+ uri => $AS_uri,
+ header =>
\@header
+ );
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_request-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_msg->as_string;
+ close FH;
+ #/DEBUG
+=cut
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $auth_request = perfSONAR::SOAP::HTTP::Request->new(message =>
$soap_auth_msg);
+ #DEBUG print "auth_reqeust\n";
+ #DEBUG print $auth_request->as_string . "\n";
+ #DEBUG print "auth_request end\n";
+ my $auth_response = $userAgent->request($auth_request);
+
+ my $soap_auth_response = $auth_response->soap_message;
+ #DEBUG
+=cut
+ my $timestamp = time;
+ my $file = "soap_response-$timestamp.xml";
+ open (FH, ">", "$file");
+ print FH $soap_auth_response->as_string;
+ close FH;
+ #/DEBUG
+=cut
+
+
+
+ unless ($auth_response->is_success) {
+ #HTTP error
+ my $code = $auth_response->code();
+ my $description = $auth_response->message();
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "HTTP error: $code,
$description", "message");
+ $soapmsg->clear_header;
+ return $reqmsg;
+ }
+ $soapmsg->clear_header;
+ if ($soap_auth_response->is_fault){
+ #SOAP error
+ my $description = $soap_auth_response->{fault}->as_string;
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "SOAP error:
$description", "message");
+ return $reqmsg;
+ }
+
+ my $auth_nmwg = NMWG::Message->new( ($soap_auth_response->body)[0] );
+ #print "DEBUG: Return message: \n" . $auth_nmwg->as_string . "\n";
+ if (!$auth_nmwg){
+ my $errorstring = "Authentication failed: No response from
Authentication Service";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.authn.server", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ my $event_node =
($auth_nmwg->{dom}->getElementsByLocalName("eventType"))[0];
+ my $auth_event = $event_node->textContent;
+ if ($auth_event ne "success.as.authn") { #some error occured
+ #find description of error
+ my $desc_node = ($auth_nmwg->{dom}->getElementsByLocalName("datum"))[0];
+ my $description = $desc_node->textContent;
+ my $errorstring = "Authentication failed on server: $description";
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("$auth_event", "$errorstring", "message");
+ return $reqmsg;
+ }
+ #else just proceed
+ my $returnstring = "Authentication succeded";
+ $reqmsg->return_result_code("$auth_event", "$returnstring", "message");
+}
+
+
+
+sub check_token {
+ my @header = shift;
+ foreach my $entry (@header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ if ($entry->localname =~ /Security/){
+ my @sec_elems = $entry->getChildNodes();
+ foreach my $sec_elem (@sec_elems){
+ next unless (defined $sec_elem->localname);
+ if ($sec_elem->localname =~ /BinarySecurityToken/){
+ return $x509_token;
+ #return $saml_token;
+ } elsif ($sec_elem->localname =~ /Assertion/){
+ return $saml_token;
+ #return $x509_token;
+ }
+ }
+ }
+ }
+ }
+ return undef;
+}
+
+
+sub create_authmsg {
+ my $token = shift;
+
+ #read in template:
+ my $authmsg = NMWG::Message->new();
+ $authmsg->parse_xml_from_file("$FindBin::RealBin/../etc/Auth_request.xml");
+ if (!$authmsg){
+ $authmsg->parse_xml_from_file("/etc/oppd/Auth_request.xml");
+ }
+
+ #set token
+ my $tokennode = ($authmsg->{dom}->getElementsByLocalName("parameter"))[0];
+ if ($tokennode) {
+ $tokennode->appendText("$token");
+ }
+
+ return $authmsg;
+}
+
+sub clone_header {
+ my @orig_header = shift;
+ my @new_header;
+ foreach my $entry (@orig_header){
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Node")){
+ my $new_entry = $entry->cloneNode(1);
+ unshift @new_header, $new_entry;
+ }
+ }
+ return @new_header;
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Client/LS.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Client/LS.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Client/LS.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,425 @@
+package perfSONAR::Client::LS;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - Please make me a proper class! There should be an object for every
service
+# and this class brings everything together.
+# - Replace the usage of $log with something more useful.
+
+use strict;
+use warnings;
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use Socket;
+use Socket6;
+
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT);
+ use Exporter;
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.10;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+
#@EXPORT
= qw(heartbeat deregister); # Symbols to autoexport (:DEFAULT
tag)
+}
+
+use NMWG::Message;
+#use perfSONAR qw(print_log);
+
+my $register_template;
+my $deregister_template;
+my $keepalive_template;
+
+
+if (-e "$FindBin::RealBin/../etc/"){
+ $register_template = "$FindBin::RealBin/../etc/LS_register.xml";
+ $deregister_template = "$FindBin::RealBin/../etc/LS_deregister.xml";
+ $keepalive_template = "$FindBin::RealBin/../etc/LS_keepalive.xml";
+} else {
+ $register_template = "/etc/oppd/LS_register.xml";
+ $deregister_template = "/etc/oppd/LS_deregister.xml";
+ $keepalive_template = "/etc/oppd/LS_keepalive.xml";
+}
+
+my $psservice = "http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/";
+my $nmwg = "http://ggf.org/ns/nmwg/base/2.0/";
+my $nmtb = "http://ogf.org/schema/network/topology/base/20070828/";
+my $nmtl3 = "http://ogf.org/schema/network/topology/l3/20070828/";
+my $nmwgr = "http://ggf.org/ns/nmwg/result/2.0/";
+
+our %services = ();
+our (
+ $hostname, $port, $organization, $contact, $log,
+);
+
+our @ls_url = ();
+my %messages;
+
+my $debug_write = 0;
+
+# Setup everything und sent initial registration ("first" heartbeat).
+sub init {
+ my %p = @_;
+ %services = %{$p{services}}; @ls_url = @{$p{ls_url}};
+ $hostname = $p{hostname}; $port = $p{port};
+ $organization = $p{organization}; $contact = $p{contact};
+ $log = $p{log};
+
+ #first registration:
+ foreach my $service (keys %services){
+ create_register_message($service);
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+}
+
+# Send keepalive messages for each service
+sub heartbeat {
+ foreach my $service (keys %messages){ #get services from global hash
+ my $message;
+ if (exists $messages{$service}{"keepalive_msg"}){
+ foreach my $url (@ls_url){
+ $message = $messages{$service}{"keepalive_msg"}->clone();
+ $log->log(
+ level => "notice", service => $service,
+ message => "Sending keepalive for $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "keepalive-response");
+ #TODO What to do if keepalive fails? At the moment: Nothing.
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "Keepalive for $service returend $eventtype:
$datumstring"
+ );
+ } else { #no response...
+ $log->log(
+ level => "notice", service => $service,
+ message => "error sending keepalive for $service: No response
from Lookup Server!"
+ );
+ }
+ }
+ } else { #something went wrong with first registration, otherwise there
would be a keepalive message!
+ #try to send registration message again:
+ send_registration($messages{$service}{"register_msg"}, $service);
+ }
+ }
+}
+
+
+sub create_register_message{
+ my $service = shift;
+
+ # read in template for LS registration message and fill in module specific
+ # values:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($register_template);
+ my $servicenode = ($message->{dom}->getElementsByTagNameNS("$psservice",
"service"))[0];
+
+ $message->add_element_NS($servicenode, "serviceName",
"$services{$service}->{name}", $psservice);
+ $message->add_element_NS($servicenode, "accessPoint",
"http://$hostname:$port/services/$service", $psservice);
+ $message->add_element_NS($servicenode, "serviceType",
"$services{$service}->{servicetype}", $psservice);
+ $message->add_element_NS($servicenode, "serviceDescription",
"$services{$service}->{description}", $psservice);
+
+ my $datanode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"data"))[0];
+ my $metanode = $message->add_attribute (namespace => $nmwg,
+ parent => $datanode,
+ nodename => "metadata",
+ id => "topo-metadata",
+ );
+ my $subjectnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "subject",
+ id => "topo-subject",
+ );
+ my @addresses = lookup_interfaces();
+
+ my $nodenode = $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $subjectnode,
+ nodename => "node",
+ );
+ foreach my $addr (@addresses) {
+ my $name = lookup_hostname($addr);
+ next unless $name;
+ $message->add_attribute (namespace => $nmtb,
+ prefix => "nmtb",
+ parent => $nodenode,
+ nodename => "name",
+ type => "dns",
+ value => $name,
+ );
+ }
+ foreach my $addr (@addresses) {
+ my $addr_type;
+
+ if ($addr =~ /:/) {
+ $addr_type = "ipv6";
+ } else {
+ $addr_type = "ipv4";
+ }
+
+ my $portnode = $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtl3",
+ parent => $nodenode,
+ nodename => "port",
+ );
+ $message->add_attribute (namespace => $nmtl3,
+ prefix => "nmtb",
+ parent => $portnode,
+ nodename => "address",
+ type => $addr_type,
+ value => $addr,
+ );
+ }
+
+ foreach my $et (@{$services{$service}{"eventtype"}}){
+ $message->add_element_NS($metanode, "eventType", "$et", $nmwg);
+ }
+ my $paramnode = $message->add_attribute (namespace => $nmwg,
+ parent => $metanode,
+ nodename => "parameters",
+ );
+ if (exists $services{$service}->{"keyword"}){
+ my $keywordnode = $message->add_attribute (namespace => $nmwg,
+ parent => $paramnode,
+ nodename =>"parameter",
+ name => "keyword",
+ value =>
$services{$service}->{keyword},
+ );
+ }
+
+
+ if ($service =~/MA/){
+ $services{$service}->{handler}->get_meta_info($message);
+ }
+ $messages{$service}{"register_msg"} = $message;
+}
+
+sub check_response {
+ my $response = shift;
+ my $service = shift;
+
+
+ my ($errorstring, $metaid) = $response->parse_all;
+ if($errorstring){
+ $log->log(level => "notice", service => $service, message =>
$errorstring);
+ }
+ #parse content, write to log if successfull registration or error happened
+ my $eventtype;
+ my $key;
+ foreach my $meta (keys %{$response->{"metadataIDs"}}){
+ $eventtype = $response->{"metadataIDs"}{$meta}{"eventType"};
+ if (!$eventtype =~ /success/){
+ $log->log(
+ level => "notice", service => $service,
+ message => "LS returned $eventtype for service $service"
+ );
+ #return;
+ } else {
+ if ($eventtype =~ /register/){
+ $key = $response->{"metadataIDs"}{$meta}{"key"}{"lsKey"};
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully registered service $service with key $key"
+ );
+ $messages{$service}{"ls_key"} = $key;
+ }
+ }
+ }
+ return $key;
+}
+
+sub create_keepalive_message {
+ my $key = shift;
+
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($keepalive_template);
+ my $paramnode = ($message->{dom}->getElementsByTagNameNS("$nmwg",
"parameters"))[0];
+ $message->add_attribute(parent => $paramnode, nodename => "parameter",
value => $key, name => "lsKey");
+ write_message($message, "keepalive");
+ return $message;
+}
+
+sub send_registration {
+
+ my $message = shift;
+ my $service = shift;
+
+ write_message($message, "register");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "registering service $service to $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $message->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "register-response");
+ my $key = check_response($response, $service);
+ if ($key){
+ $messages{$service}{"keepalive_msg"} =
create_keepalive_message($key);
+ } else {
+ my $eventtype = ($response->{dom}->getElementsByTagNameNS("$nmwg",
"eventType"))[0]->textContent;
+ my $datumstring =
($response->{dom}->getElementsByTagNameNS("$nmwgr", "datum"))[0]->textContent;
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service with $eventtype:
$datumstring"
+ );
+ }
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "error registering service $service: No response from
Lookup Server!"
+ );
+ }
+ }
+}
+
+
+
+sub deregister{
+ #read in deregistration template:
+ my $message = NMWG::Message->new();
+ $message->parse_xml_from_file($deregister_template);
+
+ #send deregistration
+ foreach my $service (keys %messages){
+ my $key = $messages{$service}{"ls_key"};
+ if (!$key){
+ $log->log(
+ level => "notice", service => $service,
+ message => "no key for deregistering service $service found!"
+ );
+ next;
+ }
+ my $deregmsg = $message->clone;
+ my $parametersnode = (
+ $deregmsg->{dom}->getElementsByTagNameNS("$nmwg", "parameters")
+ )[0];
+ my $key_parameter = $deregmsg->add_attribute(
+ parent => $parametersnode,
+ nodename => "parameter",
+ name => "lsKey"
+ );
+ $key_parameter->appendText($key);
+ write_message($deregmsg, "deregister");
+ foreach my $url (@ls_url){
+ $log->log(
+ level => "notice", service => $service,
+ message => "deregistering service $service from $url"
+ );
+ my $response = perfSONAR::sendReceive(
+ message => $deregmsg->clone,
+ uri => $url,
+ );
+ if ($response){
+ write_message($response, "dereg-response");
+ $log->log(
+ level => "notice", service => $service,
+ message => "successfully deregistered service $service with key
$key"
+ );
+ #TODO do something interesting with result
+ #$response->parse_meta;
+ #$response->parse_data;
+ } else {
+ $log->log(
+ level => "notice", service => $service,
+ message => "could not deregister $key: No response from Looukup
Server!"
+ );
+ }
+ }
+ }
+ #lay down to die
+}
+
+sub get_key{
+#TODO not implemented yet
+}
+
+sub re_register{
+#TODO not implemented yet
+}
+
+sub lookup_interfaces {
+ my @ret_interfaces = ();
+
+ open(IFCONFIG, "/sbin/ifconfig |");
+ my $is_eth = 0;
+ while(<IFCONFIG>) {
+ if (/Link encap:([^ ]+)/) {
+ if (lc($1) eq "ethernet") {
+ $is_eth = 1;
+ } else {
+ $is_eth = 0;
+ }
+ }
+ next if (not $is_eth);
+
+ if (/inet \w+:(\d+\.\d+\.\d+\.\d+)/) {
+ push @ret_interfaces, $1;
+ } elsif (/inet6 \w+: (\d*:[^\/ ]*)(\/\d+)? .*:Global/) {
+ push @ret_interfaces, $1;
+ }
+ }
+ close (IFCONFIG);
+ return @ret_interfaces;
+}
+
+sub lookup_hostname {
+ my $ip = shift;
+
+ my $result;
+ if ($ip =~ /:/) {
+ # IPv6
+ $result = gethostbyaddr(inet_pton(AF_INET6, $ip), AF_INET6);
+ } else {
+ # IPv4
+ $result = gethostbyaddr(inet_aton($ip), AF_INET);
+ }
+ return $result;
+}
+
+sub write_message{
+ my $message = shift;
+ my $name = shift;
+
+ if ($debug_write){
+ my $timestamp = time;
+ open (FH, ">", "$name-$timestamp.xml");
+ print FH $message->as_string();
+ close FH;
+ sleep(1);
+ }
+}
+
+
+1;
+
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Echo.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Echo.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/Echo.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,78 @@
+package perfSONAR::Echo;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use perfSONAR qw(print_log %services);
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+my $selftest_et = "http://schemas.perfsonar.net/tools/admin/selftest/1.0";
+my $response_et = "http://schemas.perfsonar.net/tools/admin/selftest/";
+
+my $returnstring = "I'm still alive and happy to talk to you!";
+
+sub handle_echo_request{
+#sub start_action {
+ my $msg = shift;
+ my $service = shift;
+
+ print Dumper($msg->{"metadataIDs"});
+
+ foreach my $key (keys %{$msg->{"metadataIDs"}}){
+ my $et = $msg->{"metadataIDs"}{$key}{"eventType"};
+ if ($et =~ /$echo_et/){
+ #echo request
+ print_log("info", "Reply to EchoRequest ping");
+ $msg->return_result_code("success.echo", "$returnstring", "$key");
+ }
+ elsif ($et =~ /$selftest_et/){
+
+ #my %refs = $services{$service}->{handler}->selftest();
+ my $refs = $services{$service}->{handler}->selftest();
+ if (!$refs){
+ print_log("notice", "error.echo: Action not supported: $et.");
+ $msg->return_result_code("error.echo", "Action not supported: $et.",
$key);
+ return $msg;
+ }
+ foreach my $name (keys %{$refs}){
+ my $ref = $refs->{$name};
+ my ($message, $status) = $services{$service}->{handler}->$ref;
+ print_log("notice", "$message $service");
+ $msg->return_result_code("$response_et$service/$name/$status/1.0",
"$message", "$key", "$name");
+ }
+
+ }
+ else { #some different eventtype, return error
+ $msg->return_result_code("error.echo", "Unknown eventType: $et", $key);
+ return $msg;
+ }
+ #return success message
+ return $msg;
+ }
+
+}
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/MP.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/MP.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/MP.pm 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,189 @@
+package perfSONAR::MP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+BEGIN {
+ use vars qw(@ISA);
+
#@ISA
= qw(SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+ @EXPORT = qw(store check_parameters get_parameters);
+}
+
+
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+use perfSONAR qw(print_log);
+use NMWG;
+use NMWG::Message;
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %param = (@_);
+
+ my $self = {
+ };
+ $self->{"supportedEventtypes"} = [
+ "http://ggf.org/ns/nmwg/ops/store/2.0",
+ ];
+ $self->{"command"} = $param{"command"};
+ $self->{"store"} = $param{"store"};
+ $self->{"store_url"} = $param{"store_url"};
+
+ bless $self, $class;
+ return $self;
+}
+
+sub open_request {
+ #initialize whatever you have to initiliaze
+}
+
+sub close_request{
+ #close request if necessary
+}
+
+
+#obsolete!
+sub set_command {
+ my $self = shift;
+ my $c = shift;
+ $self->{"command"} = $c;
+}
+
+sub selftest {
+ my $self = shift;
+ return undef;
+}
+
+
+sub start_action {
+
+}
+
+
+sub store {
+
+ my $self = shift;
+ my $msg = shift;
+
+ if (!$self->{"store_url"}){
+ $self->print_log_id("error", "Store to MA failed: no url to SQL MA
given!");
+ } else {
+ my $store_msg = $msg->clone;
+ if (!$store_msg){
+ $self->print_log_id("error", "Store to MA failed: Could not clone
storage message.");
+ return;
+ }
+ $store_msg->set_message_type("MeasurementArchiveStoreRequest");
+
+ #my $store_string = $store_msg->as_string(1);
+ #print "$store_string\n";
+
+ my $response = perfSONAR::sendReceive( message => $store_msg,
+ uri => $self->{"store_url"},
+ );
+
+ if ($response){
+ my $result = $response->as_string(2);
+ $self->print_log_id("info", "Answer from SQL MA:\n$result");
+ #print "$result\n"; #TODO parse response?
+ } else {
+ $self->print_log_id("error", "Store to MA failed: No response from SQL
MA!");
+ }
+ }
+}
+
+
+sub get_parameters {
+
+ my $self = shift;
+ my $datablock = shift;
+
+ my %parameters;
+
+ foreach my $key (keys %{$datablock}){ #get eventtypes
+ next if ($key eq "node" || $key eq "metaref" ); #no eventtype
+ foreach my $k (keys %{$datablock->{$key}}){
+ if (!defined $parameters{$k}){
+ if ($k eq "src" || $k eq "dst"){
+ $parameters{$k} = $datablock->{$key}{$k}{"value"};
+ } else {
+ $parameters{$k} = $datablock->{$key}{$k};
+ }
+ }
+ }
+ }
+
+ return %parameters;
+}
+
+
+sub check_parameters {
+
+ my $self = shift;
+ my %params = @_;
+
+ my @unknown;
+ my @unsupported;
+
+
+ foreach my $par (keys %params){
+ next if ($par eq "ns_prefix" ||
+ $par eq "param_ns_prefix" ||
+ $par eq "subject_ns_prefix" ||
+ $par eq "subject_ns_uri" ||
+ $par eq "param_ns_uri" ||
+ $par eq "parameter_ID" ||
+ $par eq "metaID" ||
+ $par eq "address" ||
+ $par eq "metadatakey"
+ );
+ next if exists $self->{"known_parameters"}{$par};
+ if (exists $self->{"unsupported_parameters"}->{$par}){
+ push @unsupported, $par;
+ } else {
+ push @unknown, $par;
+ }
+
+ }
+#TODO
+ if ($#unknown >= 0){
+ my $error = "Unknown parameter(s): " . join (", ", @unknown);
+ return $error;
+ }
+
+ if ($#unsupported >= 0){
+ my $error = "Unsupported parameters(s): " . join (", ", @unsupported);
+ return $error;
+ }
+}
+
+
+sub print_log_id {
+ my ($self, $level,$message) = @_;
+ print_log($level,$message,$self->{"service_id"});
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,83 @@
+package perfSONAR::SOAP::Fault;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+sub new {
+ #TODO Make building a SOAP Fault simple. But which version to choose?
+ #TODO Extract version from Namespaces and load corresponding module
+ # Is this really useful. Is the benefit worth doing such complicated
+ # things?
+ croak "Direct call on perfSONAR::SOAP::Fault not supported (yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($source) = @_;
+ #my $self = {};
+ #bless $self, $class;
+ #return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Fault->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP Fault element here?
+ unless ($self->{dom}->nodeName =~ m/:Fault$/) {
+ croak "Not a valid SOAP fault: Missing element Fault";
+ }
+
+ return $self;
+}
+
+sub from_string {
+ #TODO Do we really need this feature? Should it rather be added somehow
+ # to new method(s).
+ croak "perfSONAR::SOAP::Fault cannot be created from string source
(yet).\n";
+ #my $this = shift;
+ #my $class = ref($this) || $this;
+ #my ($xml) = @_;
+}
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_1.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_1.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_1.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,273 @@
+package perfSONAR::SOAP::Fault_v1_1;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507
+
+#NOTES
+# Order and number of children of Fault element are not restricted by
+# by SOAP 1.1 specification. We use XPath to get at least what we need...
+# Further we ignore other children, since they are explicitly allowed by
+# specification. It is not clear, whether more than one element is allowed
for
+# the explicitly expected element. This module simply only uses the first one
+# to make parsing fail as seldom as possible.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($faultcode_uri, $faultcode, $faultstring,
+ $faultfactor, $detail, @additional) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ my $ns_soap = $perfSONAR::SOAP::ns_soap11;
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Fault");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+
+ # faultcode and faultstring are obligatory.
+ # Also the elements have to be created here, since other methods expect
them
+ # to exist already.
+ # Btw: namespace of faultcode is optional, because Envelope namespace is
+ # default.
+ unless ($faultcode) {
+ croak "Missing faultcode";
+ }
+ $self->{dom}->addNewChild(undef,"faultcode");
+ $self->faultcode($faultcode_uri,$faultcode);
+ unless ($faultstring) {
+ croak "Missing faultstring";
+ }
+ $self->{dom}->addNewChild(undef,"faultstring");
+ $self->faultstring($faultstring);
+
+ # Now the optional elements:
+ if ($faultfactor) {
+ $self->faultfactor($faultfactor);
+ }
+ if ($detail) {
+ $self->detail($detail);
+ }
+ #TODO Are these "other" elements really useful?
+ if (@additional) {
+ $self->additional(@additional);
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom) = @_;
+
+ my $self = $class->SUPER::from_dom($dom);
+ bless $self, $class;
+
+ # Check for correct namespace/version:
+ my $ns_soap = $self->{dom}->namespaceURI();
+ unless ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ croak "Invalid namespace for SOAP Fault element";
+ }
+ # Create XPathContext with appropriate namespace
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for necessary elements by retrieving them via our own methods:
+ $self->faultcode;
+ $self->faultstring;
+
+ return $self;
+}
+
+# Default namespace uri is http://schemas.xmlsoap.org/soap/envelope/
+sub faultcode {
+ my $self = shift;
+ my ($ns_uri,$code) = @_;
+
+ # There should really always be a faultcode element and we need it anyway.
+ # -> We can already retrieve it here
+ my $faultcode = $self->{xpc}->findnodes("faultcode")->get_node(1)
+ or croak "Missing faultcode element below Fault element";
+ unless ($ns_uri || $code) {
+ # No arguments => return current content
+ my $content = $faultcode->textContent
+ or croak "Empty faultcode element in SOAP Fault";
+ #TODO Is textContent really correct?
+ $content =~ m/(.+):(.+)/ or croak "Invalid faultcode in SOAP Fault";
+ my $ns_prefix = $1;
+ my $ns_uri = $faultcode->lookupNamespaceURI($ns_prefix)
+ or croak "Cannot determine namespace URI for SOAP Fault faultcode";
+ my $code = $2;
+ return $ns_uri, $code;
+ }
+
+ unless ($code) {
+ croak "faultcode needs at least a text string as second parameter";
+ }
+ $ns_uri ||= $perfSONAR::SOAP::ns_soap11;
+
+ # Set code
+ if ($faultcode->hasChildNodes) {
+ $faultcode->removeChildNodes;
+ }
+ my $ns_prefix = $faultcode->lookupNamespacePrefix($ns_uri);
+ unless ($ns_prefix) {
+ $ns_prefix = "nscode";
+ $faultcode->setNamespace($ns_uri,$ns_prefix,0);
+ }
+ #$faultcode->addChild(
+ # $faultcode->ownerDocument->createTextNode("$ns_prefix:$code")
+ #);
+ $faultcode->appendTextNode("$ns_prefix:$code");
+ return $self;
+}
+
+sub faultstring {
+ my $self = shift;
+ my ($string) = @_;
+
+ # There should really always be a faultstring element and we need it
anyway.
+ # -> We can already retrieve it here
+ my $faultstring = $self->{xpc}->findnodes("faultstring")->get_node(1)
+ or croak "Missing faultstring element below Fault element";
+ unless ($string) {
+ # No arguments => return current content
+ my $content = $faultstring->textContent
+ or croak "Empty faultstring element in SOAP Fault";
+ #TODO Is textContent really correct?
+ return $content;
+ }
+
+ # Set string
+ if ($faultstring->hasChildNodes) {
+ $faultstring->removeChildNodes;
+ }
+ #$faultstring->addChild(
+ # $faultstring->ownerDocument->createTextNode($string)
+ #);
+ $faultstring->appendTextNode($string);
+ return $self;
+}
+
+# TODO Should we check the factor itself somehow? It should be a URI, but
that
+# might lead to unnecessary parsing errors.
+sub faultfactor {
+ my $self = shift;
+ my ($factor) = @_;
+
+ unless ($factor) {
+ # No arguments => return current content
+ my $faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)
+ or return;
+ return $faultfactor->textContent;
+ #TODO Is textContent really correct?
+ }
+
+ # Set factor
+ my $faultfactor;
+ if ($faultfactor = $self->{xpc}->findnodes("faultfactor")->get_node(1)) {
+ if ($faultfactor->hasChildNodes) {
+ $faultfactor->removeChildNodes;
+ }
+ } else {
+ # We have to create the faultfactor element first:
+ $faultfactor = $self->{dom}->ownerDocument->createElementNS(
+ undef, "faultfactor"
+ );
+ $self->{dom}->insertAfter(
+ $faultfactor, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ #$faultfactor->addChild(
+ # $faultfactor->ownerDocument->createTextNode($factor)
+ #);
+ $faultfactor->appendTextNode($factor);
+ return $self;
+}
+
+sub detail {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("detail/*")};
+ }
+
+ # Set detail
+ my $detail;
+ if ($detail = $self->{xpc}->findnodes("detail")->get_node(1)) {
+ if ($detail->hasChildNodes) {
+ $detail->removeChildNodes;
+ }
+ } else {
+ # We have to create the detail element first:
+ $detail = $self->{dom}->ownerDocument->createElementNS(
+ undef, "detail"
+ );
+ $self->{dom}->insertAfter(
+ $detail, $self->{xpc}->find("faultstring")->get_node(1)
+ );
+ }
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $detail->appendChild($_);
+ }
+ return $self;
+}
+
+#TODO
+# IMPORTANT:
+# This method is only adding additional elements and NOT deleting already
+# existing additional elements! But don't use it anyway!
+sub additional {
+ my $self = shift;
+
+ foreach (perfSONAR::SOAP::Message::_prepare_nodes(@_)) {
+ $self->{dom}->appendChild($_);
+ }
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_2.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_2.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Fault_v1_2.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,99 @@
+package perfSONAR::SOAP::Fault_v1_2;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - A lot more information extraction could be done here.....
+
+# See http://www.w3.org/TR/soap12-part1/#soapfault
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+use base 'perfSONAR::SOAP::Fault';
+
+
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($Values, $Reasons, $Node, $Role, $Detail) = @_;
+=cut
+$Value = [
+
"VersionMismatch"|"MustUnderstand"|"DataEncodingUnknown"|"Sender"|"Receiver",
+ *:*, ....
+];
+$Reason = {
+ <lang> => <text>,
+ ....
+};
+$Node = <uri>;
+$Role = "http://www.w3.org/2003/05/soap-envelope/role/next" | "next" |
+ "http://www.w3.org/2003/05/soap-envelope/role/none" | "none" |
+ "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" |
+ "ultimateReceiver";
+$Detail = [ <nodelist> ];
+=cut
+
+ my $self = {};
+ bless $self, $class;
+ return $self;
+}
+
+#TODO Remove this 1.1 dummy API and "enhance" 1.1 to 1.2
+sub faultcode {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported", "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultstring {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub faultfactor {
+ my $self = shift;
+ if (@_) {
+ return "SOAP 1.2 Fault not supported";
+ } else {
+ return $self;
+ }
+}
+sub detail {
+ my $self = shift;
+ if (@_) {
+ return XML::LibXML->new->parse_string("<error>SOAP 1.2 Fault not
supported</error>")->documentElement;
+ } else {
+ return $self;
+ }
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Request.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Request.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Request.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,120 @@
+package perfSONAR::SOAP::HTTP::Request;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Request;
+use perfSONAR::SOAP::Message;
+
+use base 'HTTP::Request';
+
+
+# More or less a wrapper around HTTP::Request->new, setting a lot of defaults
+# useful for SOAP requests.
+# Parameters are set as hash to provide better flexibility and concentrate
more
+# on SOAP requirements.
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ method => "POST",
+ uri => undef,
+ # The HTTP(!) header
+ # If header is a HTTP::Headers object, this object will be used and all
+ # SOAP specific defaults will NOT be set. If header is a plan array
+ # reference, a HTTP::Headers object will be created, all SOAP specific
+ # defaults will be set and finally the values from the array will be set.
+ header => undef,
+ # The SOAP message:
+ message => undef,
+ @_
+ );
+
+ my $header;
+ my @header_defaults = (
+ SOAPAction => '""',
+ pragma => 'no-cache',
+ cache_control => 'no-cache',
+ accept => 'application/soap+xml, application/dime,
multipart/related, text/*',
+ );
+ if (defined $p{header}) {
+ croak("Bad header argument") unless ref $p{header};
+ if (ref($p{header}) eq "ARRAY") {
+ $header = HTTP::Headers->new(@header_defaults, @{$p{header}});
+ } else {
+ $header = $header->clone;
+ }
+ } else {
+ $header = HTTP::Headers->new(@header_defaults);
+ }
+
+ if (defined $p{message}) {
+ unless (UNIVERSAL::isa($p{message},'perfSONAR::SOAP::Message')) {
+ croak "Parameter \"message\" to perfSONAR::SOAP::HTTP::Request " .
+ "must be of type perfSONAR::SOAP::Message";
+ }
+ if (!defined $p{uri}) {
+ $p{uri} = $p{message}->uri;
+ }
+ }
+
+ my $self = $class->SUPER::new($p{method}, $p{uri}, $header);
+
+ $self->protocol("HTTP/1.0");
+
+ bless $self, $class;
+
+ if (defined $p{message}) {
+ $self->soap_message($p{message},1);
+ }
+
+ return $self;
+}
+
+# This method behaves like HTTP::Request::content, but expects one mandatory
+# parameter of type perfSONAR::SOAP::Message instead of a string.
+# This is a one-way method! You can only set a SOAP message!
+# The URI of this object will be set to the URI of the
perfSONAR::SOAP::Message
+# object, if it is set.
+sub soap_message {
+ my $self = shift;
+ my ($message, $do_not_set_uri) = @_;
+
+ unless (UNIVERSAL::isa($message,'perfSONAR::SOAP::Message')) {
+ croak "perfSONAR::SOAP::HTTP::Request->soap_message has to be called" .
+ "with one parameter of type perfSONAR::SOAP::Message";
+ }
+ my $content = $message->as_string;
+ $self->content_length(length($content));
+ if (!$do_not_set_uri && defined $message->uri) {
+ $self->uri($message->uri);
+ }
+ return $self->content($content);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Response.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Response.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/Response.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,52 @@
+package perfSONAR::SOAP::HTTP::Response;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use HTTP::Response;
+
+use base 'HTTP::Response';
+
+
+# This method behaves like HTTP::Response::content, but will croak if an
+# argument is passed!
+# This is a one-way method! You can only get a SOAP message from it, not set
+# it!
+sub soap_message {
+ my $self = shift;
+ my ($message) = @_;
+
+ if (@_) {
+ carp "No parameters allowed for soap_message"
+ if $^W;
+ }
+
+ return perfSONAR::SOAP::Message->from_http_response($self);
+}
+
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/HTTP/UserAgent.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+package perfSONAR::SOAP::HTTP::UserAgent;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use LWP::UserAgent;
+
+use base 'LWP::UserAgent';
+
+
+our $timeout = 5000;
+
+
+# More or less a wrapper around LWP::UserAgent->new
+# You can use the same parameters as for LWP::UserAgent->new
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+
+ my $self = $class->SUPER::new(
+ timeout => $timeout, # our own default here
+ @_
+ );
+ bless $self, $class;
+}
+
+sub request {
+ my $self = shift;
+ return bless($self->SUPER::request(@_), 'perfSONAR::SOAP::HTTP::Response');
+}
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Message.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Message.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP/Message.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,483 @@
+package perfSONAR::SOAP::Message;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more parsing and checking could be implemented...
+
+#NOTES
+# - Regarding SOAP Faults this module enforces some rules:
+# - There is only one fault allowed in a message
+# - For SOAP 1.2 there is explicitly no other element allowed if the
message
+# contains a Fault element. For SOAP 1.1 this is unsure!
+# It is only explicitly requested if SOAP is used for RPC (See "Using
SOAP
+# for RPC, http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383533)
+# If a message contains a fault, other body elements that might exist are
+# not deleted, but ignored! This should make it possible to stay
+# compatible with "strange" SOAP 1.1 messages that we might have to
parse.
+# But: It is NOT possible to create such a message using this module or
+# add children to the Body element of a Fault message.
+#
+# Important keys of $self hash:
+# dom: The root (aka. Envelope) element. NOT necessarily the Document root.
+# xpc: An XPathContext with context node set to $self->{dom} and the
namespace
+# prefix "soap" set to the correct namespace URI.
+# fault: The corresponding SOAP::Fault object, if message contains a fault.
+# Otherwise the key doesn't exist at all.
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use URI;
+use XML::LibXML;
+use XML::LibXML::NodeList;
+
+use perfSONAR::SOAP;
+use perfSONAR::SOAP::Fault;
+use perfSONAR::SOAP::Fault_v1_1;
+use perfSONAR::SOAP::Fault_v1_2;
+
+
+# All parameters optional! Header and body are empty by default. Version
+# defaults to "1.1".
+sub new {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my %p = (
+ header => undef, body => undef, fault => undef,
+ uri => undef, version => "1.1",
+ @_
+ );
+
+ my $self = {};
+ bless $self, $class;
+
+ # Set version
+ $self->version($p{version});
+ # We don't care about versions from header or body!
+ my $ns_soap = $perfSONAR::SOAP::version2ns{$self->version};
+
+ # Set URI
+ $self->uri($p{uri}) if defined $p{uri};
+
+ # We are creating from scratch
+ # -> Create container document and basic elements
+ my $doc = XML::LibXML::Document->createDocument();
+ #TODO version and encoding?
+
+ $self->{dom} = $doc->createElementNS($ns_soap,"soapenv:Envelope");
+ $doc->setDocumentElement($self->{dom});
+
+ # Create XPathContext with appropriate namespace:
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # We always need a Body element:
+ $self->{dom}->addNewChild($ns_soap,"Body");
+
+ # Now we add the (optional) head
+ if (defined $p{header}) {
+ unless (ref($p{header}) eq "ARRAY") {
+ croak "Parameter \"header\" of perfSONAR::SOAP::Message->new must be "
.
+ "a list of XML::LibXML::Node objects";
+ }
+ if (@{$p{header}}) {
+ $self->header($p{header});
+ }
+ }
+
+ # Fault needs more thinking:
+ if (defined $p{body}) {
+ if (defined $p{fault}) {
+ croak
+ "perfSONAR::SOAP::Message::new needs either body or fault, not
both!";
+ }
+ # Body, no fault
+ $self->body($p{body});
+ } elsif (defined $p{fault} && $p{fault}->isa('perfSONAR::SOAP::Fault')) {
+ # No body, but fault
+ $self->fault($p{fault});
+ }
+
+ return $self;
+}
+
+sub from_dom {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($dom,$uri) = @_;
+
+ my $self = {};
+ bless $self, $class;
+
+ if (UNIVERSAL::isa($dom,"XML::LibXML::Element")) {
+ $self->{dom} = $dom;
+ } elsif (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ $self->{dom} = $dom->documentElement();
+ } else {
+ croak "First argument to perfSONAR::SOAP::Message->from_dom " .
+ "must be of type XML::LibXML:Element or XML::LibXML::Document\n";
+ }
+
+ # Do we have a SOAP envelope?
+ unless ($self->{dom}->nodeName =~ m/:Envelope$/) {
+ croak "Not a valid SOAP message: Missing element Envelope";
+ }
+
+ # First determine SOAP version and create XPathContext with appropriate
+ # namespace:
+ my $version;
+ my $ns_soap = $self->{dom}->namespaceURI;
+ if ($ns_soap eq $perfSONAR::SOAP::ns_soap11) {
+ $version = "1.1";
+ } elsif ($ns_soap eq $perfSONAR::SOAP::ns_soap12) {
+ $version = "1.2";
+ } else {
+ #TODO SOAP Fault: VersionMismatch
+ croak "Not a valid SOAP message: Unknown namespace";
+ }
+ $self->{xpc} = XML::LibXML::XPathContext->new($self->{dom});
+ #TODO Is it really save to create context once at the beginning?
+ $self->{xpc}->registerNs('soap',$ns_soap);
+
+ # Now check for the necessary body element:
+ unless ($self->{xpc}->findnodes("soap:Body")->size == 1) {
+ croak "Not a valid SOAP message: Missing element Body";
+ }
+
+ # Set uri and version
+ $self->uri($uri) if defined $uri;
+ $self->version($version); # We don't care about versions from header or
body!
+
+ # Handle faults
+ if (
+ my @faults = $self->{xpc}->findnodes("soap:Body/soap:Fault")
+ ) {
+ my $fault_src = shift @faults;
+ if (@faults) {
+ croak "More than one Fault element not allowed in SOAP Message";
+ }
+ $self->fault($fault_src);
+ }
+
+ #TODO Check for "invalid" elements?
+
+ return $self;
+}
+
+sub from_string {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($source,$uri) = @_;
+
+ croak "No XML source to parse" unless $source;
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($source);
+ };
+ if ($@){
+ #TODO Make me a special Exception!
+ croak "Error parsing message: $@";
+ }
+ #TODO Is the following really needed, or is already implicitly handled
above?
+ unless (UNIVERSAL::isa($dom,"XML::LibXML::Document")) {
+ croak "First argument to perfSONAR::SOAP::Message->from_libxml " .
+ "must be a valid XML string\n";
+ }
+ return $class->from_dom($dom,$uri);
+}
+
+sub from_http_request {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($request) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($request,"HTTP::Request")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_request"
+ . " must be of type HTTP::Request\n";
+ }
+
+ my $content = $request->content;
+ my $uri = $request->uri;
+ #DEBUG print "HTTP request URI: $uri\n";
+ #DEBUG print "HTTP request content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+sub from_http_response {
+ my $this = shift;
+ my $class = ref($this) || $this;
+ my ($response) = @_;
+ my $self = {};
+
+ unless (UNIVERSAL::isa($response,"HTTP::Response")) {
+ croak "First and only argument to "
+ . "perfSONAR::SOAP::Message->from_http_response"
+ . " must be of type HTTP::Response\n";
+ }
+
+ my $content = $response->content;
+ my $uri = $response->base;
+ #DEBUG print "HTTP response URI: $uri\n";
+ #DEBUG print "HTTP response content:\n$content\n";
+ return $class->from_string($content,$uri);
+ #TODO use SOAPAction / application/soap+xml action for uri ???
+}
+
+
+# Converts a list to DOM nodes (e.g. body or header content).
+# Parameters are a mixed list of:
+# - Array reference (will be flattened)
+# - XML::LibXML::Node (will be included directly)
+# - XML::LibXML::NodeList (Nodes in list will be included directly)
+# - String (will be parsed as XML Document and root Element will be included)
+sub _prepare_nodes {
+ my @result = (); # the result list
+ my @sources = (); # the flattened intermediate step
+ foreach my $entry (@_) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::NodeList")) {
+ push @sources, $entry->get_nodelist;
+ } elsif (ref($entry) eq "ARRAY") {
+ push @sources, @{$entry};
+ } else {
+ push @sources, $entry;
+ }
+ }
+ foreach my $entry (@sources) {
+ if (UNIVERSAL::isa($entry,"XML::LibXML::Document")) {
+ # Special case: Although Document is also a Node, appendChild is not
+ # working. This should always work:
+ push @result, $entry->documentElement;
+ } elsif (UNIVERSAL::isa($entry,"XML::LibXML::Node")) {
+ push @result, $entry;
+ } else {
+ my $dom;
+ eval {
+ $dom = XML::LibXML->new->parse_string($entry);
+ };
+ if ($@){
+ croak "Error parsing XML source: $@";
+ }
+ push @result, $dom->documentElement();
+ }
+ }
+ return @result;
+}
+
+# No parameter: Header will be returned as list of XML::LibXML::Node.
+sub header {
+ my $self = shift;
+
+ unless (@_) {
+ return @{$self->{xpc}->findnodes("soap:Header/*")};
+ }
+
+ # Set header
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ } else {
+ # We have to create the Header element first:
+ $header = $self->{dom}->ownerDocument->createElementNS(
+ $self->{dom}->namespaceURI(), "Header"
+ );
+ $self->{dom}->insertBefore(
+ $header, $self->{xpc}->findnodes("soap:Body")->get_node(1)
+ );
+ }
+ foreach (_prepare_nodes(@_)) {
+ $header->appendChild($_);
+ }
+ return $self;
+}
+
+sub clear_header {
+ my $self = shift;
+
+ my $header;
+ if ($header = $self->{xpc}->findnodes("soap:Header")->get_node(1)) {
+ if ($header->hasChildNodes) {
+ $header->removeChildNodes;
+ }
+ }
+ return $self;
+}
+
+# No parameter: Body will be returned as list of XML::LibXML::Node.
+# If one of the parameters is a Fault element, all other elements are ignored
+# and the message becomes a Fault message.
+sub body {
+ my $self = shift;
+
+ unless (@_) {
+ return undef if exists $self->{fault};
+ return @{$self->{xpc}->findnodes("soap:Body/*")};
+ }
+
+ my @nodes = _prepare_nodes(@_);
+
+ # Check whether one of the nodes is a Fault element.
+ # If so, we will ignore all others and use $self->fault to turn message
+ # into a Fault message! We will use only the first Fault element and ignore
+ # all other.
+ foreach my $node (@nodes) {
+ next unless $node->nodeName =~ m/:Fault$/;
+ next unless $node->namespaceURI eq
+ $perfSONAR::SOAP::version2ns{$self->version};
+ $self->fault($node);
+ return $self;
+ }
+
+ # Set body
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ foreach (@nodes) {
+ $body->appendChild($_);
+ }
+ delete $self->{fault} if exists $self->{fault}; # Now we have a correct
body!
+
+ return $self;
+}
+
+# This internal sub is the simple way to set a SOAP Fault. It sets the
+# SOAP fault that is already in the message...
+# It only works with a DOM node as parameter and does neither import this
node
+# nor put it "to the right place".
+sub _fault {
+ my $self = shift;
+ my $source = shift;
+
+ if ($self->{version} eq "1.1") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_1->from_dom($source);
+ } elsif ($self->{version} eq "1.2") {
+ $self->{fault} = perfSONAR::SOAP::Fault_v1_2->from_dom($source);
+ } else {
+ croak "Cannot determine version of SOAP message";
+ }
+ return $self;
+}
+
+sub fault {
+ my $self = shift;
+ my $source = shift;
+
+ if (!defined($source)) {
+ return $self->{fault};
+ }
+
+ if (UNIVERSAL::isa($source,'perfSONAR::SOAP::Fault')) {
+ if (
+ ($source->isa('perfSONAR::SOAP::Fault_v1_1') && ($self->version eq
"1.2"))
+ ||
+ ($source->isa('perfSONAR::SOAP::Fault_v1_2') && ($self->version eq
"1.1"))
+ ) {
+ croak "Version of SOAP Fault not matching version of SOAP Message";
+ }
+ $self->{fault} = $source;
+ } elsif (UNIVERSAL::isa($source,'XML::LibXML::Node')) {
+ $self->_fault($source);
+ } else {
+ croak "Invalid parameter for perfSONAR::SOAP::Message->fault";
+ }
+
+ # Now add fault to Body element (deleting all other elements!)
+ my $body = $self->{xpc}->findnodes("soap:Body")->get_node(1);
+ if ($body->hasChildNodes) {
+ $body->removeChildNodes;
+ }
+ $body->appendChild($self->{fault}->{dom});
+
+ return $self;
+}
+
+# Only for convenience
+sub is_fault {
+ my $self = shift;
+
+ return exists $self->{fault};
+}
+
+sub uri {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return $self->{uri};
+ } elsif (UNIVERSAL::isa($uri,"URI")) {
+ $self->{uri} = $uri;
+ } elsif (my $u = URI->new($uri)) {
+ unless (UNIVERSAL::isa($u,"URI")) {
+ croak "Invalid URI: $uri\n";
+ }
+ $self->{uri} = $u;
+ } else {
+ croak "Invalid URI: $uri";
+ }
+ #TODO Check $uri further?
+ return $self;
+}
+
+sub uri_string {
+ my $self = shift;
+ my $uri = shift;
+ if (!defined($uri)) {
+ return unless defined $self->{uri};
+ return $self->{uri}->as_string;
+ } else {
+ $self->uri($uri);
+ }
+ return $self;
+}
+
+# Does NOT convert a message from 1.1 to 1.2 or vice versa!
+# This is difficult (e.g. regarding Faults), but might be added in the
+# future...
+sub version {
+ my $self = shift;
+ my $version = shift;
+ if (!defined($version)) {
+ return $self->{version};
+ } elsif ($version eq "1.1") {
+ $self->{version} = "1.1";
+ } elsif ($version eq "1.2") {
+ $self->{version} = "1.2";
+ } else {
+ croak "Unknown SOAP version: $version";
+ }
+ return $self;
+}
+
+sub as_string {
+ my $self = shift;
+ return $self->{dom}->toString;
+}
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR/SOAP.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+package perfSONAR::SOAP;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#TODO
+# - There are a lot more feature of SOAP that could be implemented...
+# (http://www.w3.org/TR/soap/)
+# E.g. the "application/soap+xml" media type
+# (http://www.ietf.org/rfc/rfc3902.txt)
+
+use strict;
+use warnings;
+
+#DEBUG
+#use Data::Dumper;
+#/DEBUG
+
+use Carp;
+
+use XML::LibXML;
+
+
+our $ns_soap11 = 'http://schemas.xmlsoap.org/soap/envelope/';
+our $ns_soap12 = 'http://www.w3.org/2003/05/soap-envelope';
+our %version2ns = (
+ 1.1 => $ns_soap11,
+ 1.2 => $ns_soap12,
+);
+our %ns2version = (
+ $ns_soap11 => "1.1",
+ $ns_soap12 => "1.2",
+);
+
+
+1;
Added: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR.pm 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,269 @@
+package perfSONAR;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+BEGIN {
+ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+ use Exporter;
+
#@ISA
= qw(Exporter SOAP::Server::Parameters);
+ @ISA = qw(Exporter);
+
+ # set the version for version checking
+ $VERSION = 0.51;
+ # if using RCS/CVS, this may be preferred
+ #$VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;
+ @EXPORT = qw(); # Symbols to autoexport (:DEFAULT tag)
+ @EXPORT_OK = qw(print_log %services); # Symbols to export on request
+ %EXPORT_TAGS = qw(); # Define names for sets of symbols
+ # eg: TAG => [ qw(name1 name2) ],
+}
+
+use Carp;
+
+use perfSONAR::SOAP::HTTP::Request;
+use perfSONAR::SOAP::HTTP::Response;
+use perfSONAR::SOAP::HTTP::UserAgent;
+#use perfSONAR::Echo;
+use NMWG;
+use NMWG::Message;
+
+
+our $log = undef;
+
+our %services = ();
+
+my $echo_et = "http://schemas.perfsonar.net/tools/admin/echo/2.0";
+
+sub handle_request {
+ my $class = shift; # TODO
+ my ($uri,$reqmsg) = (@_);
+ my $xmlmsg = $reqmsg->as_string;
+ print_log("info","Received message");
+ print_log("debug","Raw Message:\n$xmlmsg");
+ #print_log("debug","Parsed Message:\n" . Dumper($reqmsg));
+ # How to print DOM tree? Useful???
+
+ my $service = undef;
+
+ #if no accesspoint is given we do not know what service is meant!
+ if (!$uri){
+ croak "No service specified!";
+ } else {
+ ($service = $uri) =~ s/^.*\/services\///;
+ $service =~ s/\/$//;
+ my $serviceurl = $service;
+ print_log("info", "Service: $service");
+ if (!$services{$service}){
+ croak "Service $serviceurl not known!";
+ }
+ }
+
+ my @module_ets =
@{$services{$service}->{"handler"}->{"supportedEventtypes"}};
+ push @module_ets, $echo_et;
+
+
+ my $messagetype = $reqmsg->get_message_type();
+ if ($messagetype eq "ErrorResponse"){ #error from authentication!
+ return $reqmsg;
+ }
+ if ($messagetype eq "AuthNEERequest"){ #authorization rquest to dummy AS
+ require perfSONAR::AS;
+ return perfSONAR::AS::dummy();
+ }
+ if ($messagetype eq "SetupDataRequest"){
+ $reqmsg->set_message_type("SetupDataResponse");
+ }
+ elsif ($messagetype eq "MeasurementRequest"){
+ $reqmsg->set_message_type("MeasurementResponse");
+ }
+ elsif ($messagetype eq "MetadataKeyRequest"){
+ $reqmsg->set_message_type("MetadataKeyResponse");
+ }
+ elsif ($messagetype =~ /EchoRequest/){
+ $reqmsg->set_message_type("EchoResponse");
+ }
+ else {
+ my $errorstring = "Unknown messagetype: $messagetype";
+ print_log("info",$errorstring);
+ $reqmsg->set_message_type("ErrorResponse");
+ $reqmsg->return_result_code("error.common.action_not_supported",
"$errorstring", "message");
+ return $reqmsg;
+ }
+
+ #create $reqmsg->{"dataIDs"} and
+ # $reqmsg->{"metadataIDs"} hashes from document
+ my ($errorstring, $metaid) = $reqmsg->parse_all;
+
+ if($errorstring){
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #check if at least one metadata and one data element is in message
+ if(!($reqmsg->{"metadataIDs"})){
+ $errorstring = "No metadata definition in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ if(!(defined $reqmsg->{"dataIDs"})){
+ $errorstring = "No data trigger in message.";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.message", "$errorstring",
"message");
+ return $reqmsg;
+ }
+
+ #do some checks on metadata content
+ foreach my $meta (keys %{$reqmsg->{"metadataIDs"}}){
+ #check for unknown eventTypes
+ my $et = $reqmsg->{"metadataIDs"}{$meta}{"eventType"};
+ if ($et =~ /admin/){ #dispatch to Echo module
+ return perfSONAR::Echo::handle_echo_request($reqmsg, $service);
+ return $reqmsg;
+ }
+
+ my $found = undef;
+ #foreach my $sup_et (@{$services{$service}{"eventtype"}}){
+ foreach my $sup_et (@module_ets){
+ next unless ($sup_et =~ /$et/);
+ $found = 1;
+ }
+ if (!defined $found){
+ my $errorstring = "Unknown eventType: $et";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ #check times
+ my $startTime = $reqmsg->{"metadataIDs"}{$meta}{"startTime"};
+ my $endTime = $reqmsg->{"metadataIDs"}{$meta}{"endTime"};
+ if ($endTime && $startTime && ($endTime < $startTime)){
+ my $errorstring = "Illegal time duration specified: " .
+ "$endTime is later than $startTime!";
+ print_log("info",$errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", $errorstring,
$meta);
+ return $reqmsg;
+ }
+ }
+
+ #add metadata parameters to data hashes
+ ($errorstring, $metaid) = $reqmsg->concatenate_params;
+ if ($errorstring){
+ print_log("info", $errorstring);
+ $reqmsg->return_result_code("error.common.parse_error", "$errorstring",
$metaid);
+ return $reqmsg;
+ }
+
+ #DEBUG output:
+ print Dumper ($reqmsg->{"dataIDs"});
+ #print Dumper ($reqmsg->{"metadataIDs"});
+
+
+ #initialize data module
+ $services{$service}->{handler}->open_request();
+
+ #start action for each data block
+ foreach my $dataid (keys %{$reqmsg->{"dataIDs"}}){
+ $services{$service}->{handler}->start_action($reqmsg, $dataid, $service);
+ }
+
+ $services{$service}->{handler}->close_request();
+
+ return $reqmsg;
+}
+
+
+sub sendReceive {
+ my %p = (
+ message => undef,
+ host => "localhost",
+ port => "8090",
+ endpoint => "/",
+ uri => "",
+ soapheader => "", #TODO TODO noch nicht fertig und kein String!
+ @_
+ );
+
+ my $uri = $p{uri} || "http://$p{host}:$p{port}$p{endpoint}";
+ my $body = $p{message}->as_dom;
+
+ # Message is NMWG::Message
+ my $message = perfSONAR::SOAP::Message->new(
+ body => $body,
+ uri => $uri
+ );
+ # Modify SOAP header using $message or set via "new" call directly
+
+ my $userAgent = perfSONAR::SOAP::HTTP::UserAgent->new;
+ my $request = perfSONAR::SOAP::HTTP::Request->new(message => $message);
+
+ my $response = $userAgent->request($request);
+ unless ($response->is_success) {
+ # HTTP error
+ #my $code = $response->code();
+ #my $message = $response->message();
+ carp $response->status_line if $^W; # "<code> <message>"
+ return;
+ }
+
+ my $soap_message = $response->soap_message;
+ if ($soap_message->is_fault) {
+ carp "TODO" if $^W;
+ return;
+ }
+
+ my $nmwg_message = NMWG::Message->new( ($soap_message->body)[0] );
+ #TODO This should perhaps be
NMWG::Message->from_soap_message($soap_message);
+
+ return $nmwg_message;
+}
+
+
+sub print_log_old {
+ my ($level,$message) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, message => $message);
+ } else {
+ print STDERR "$level: $message\n";
+ }
+ return 1;
+}
+
+sub print_log {
+ my ($level,$message,$service) = @_;
+
+ if (defined $log) {
+ $level = "debug" unless $log->level_is_valid($level);
+ $log->log(level => $level, service => $service, message => $message);
+ } else {
+ print STDERR ($service ? "$service: " : "unknown service: ") .
+ "$level: $message\n";
+ }
+ return 1;
+}
+1;
Property changes on: trunk/build/debian/perfsonar-oppd-0.51/lib/perfSONAR.pm
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.dsc
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.dsc
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.dsc
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+Format: 1.0
+Source: perfsonar-oppd
+Binary: perfsonar-oppd
+Architecture: any
+Version: 0.51-1
+Maintainer: DFN Labor
<>
+Homepage: http://www.win-labor.dfn.de
+Standards-Version: 3.7.3
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Checksums-Sha1:
+ 17778a567e562f16b599d74f5cee726eb5567084 46188 perfsonar-oppd_0.51-1.tar.gz
+Checksums-Sha256:
+ c7076c6629f851fe9b9da6067dab6cb61bbd5f2fde96b2297b92269e23860669 46188
perfsonar-oppd_0.51-1.tar.gz
+Files:
+ 9d379ed0629597717498df1cf33234a3 46188 perfsonar-oppd_0.51-1.tar.gz
Added: trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.tar.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-0.51/perfsonar-oppd_0.51-1.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/perfsonar-oppd-0.51/t/00-load.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/t/00-load.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/t/00-load.t 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'perfSONAR' );
+}
+
+diag( "Testing perfSONAR $perfSONAR::VERSION, Perl $], $^X" );
Added: trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-001-SOAP-Message.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-001-SOAP-Message.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-001-SOAP-Message.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,531 @@
+#TODO
+# - Test::XML (or something similar) could be a good idea, but brings in
+# additional dependencies.
+
+use strict;
+use warnings;
+
+use Test::More tests => 75;
+
+BEGIN {
+ # Third party modules:
+ use_ok('XML::LibXML');
+ # The modules we want to test:
+ use_ok('perfSONAR::SOAP');
+ use_ok('perfSONAR::SOAP::Message');
+}
+
+
+#
+# First create a message from scratch
+#
+
+ok(
+ my $msg11_scratch = perfSONAR::SOAP::Message->new(),
+ "Creating empty message - SOAP version 1.1 (default)"
+);
+is(
+ $msg11_scratch->version, "1.1",
+ "Verifying that version was detected correctly"
+);
+
+ok(
+ my $msg12_scratch = perfSONAR::SOAP::Message->new(version => "1.2"),
+ "Creating empty message - SOAP version 1.2"
+);
+is(
+ $msg12_scratch->version, "1.2",
+ "Verifying that version was detected correctly"
+);
+
+
+#
+# Tests for setting body and Header
+#
+
+# This is done by using strings, which automatically tests the string parsing
+# functionalities.
+
+my $body_scratch = <<__EOXML__;
+ <ns:body xmlns:ns="http://test.org/ns/body/" attr1="1">
+ <test>Test</test>
+ </ns:body>
+__EOXML__
+
+my $header_scratch = <<__EOXML__;
+ <ns:header xmlns:ns="http://test.org/ns/body/" attr1="1">
+ <test>Test</test>
+ </ns:header>
+__EOXML__
+
+# SOAP 1.1
+
+ok(
+ $msg11_scratch->body($body_scratch),
+ "Setting body - SOAP version 1.1"
+);
+
+ok(
+ my $msgtest11_scratch = $msg11_scratch->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+like($msgtest11_scratch, qr/Body.+Test.+Body/s, "Verifying body content");
+
+ok(
+ $msg11_scratch->header($header_scratch),
+ "Setting header - SOAP version 1.1"
+);
+
+ok(
+ $msgtest11_scratch = $msg11_scratch->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+like(
+ $msgtest11_scratch, qr/Header.+Test.+Header/s, "Verifying header content"
+);
+
+# SOAP 1.2
+
+ok(
+ $msg12_scratch->body($body_scratch),
+ "Setting body - SOAP version 1.2"
+);
+
+ok(
+ my $msgtest12_scratch = $msg12_scratch->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+like($msgtest12_scratch, qr/Body.+Test.+Body/s, "Verifying body content");
+
+ok(
+ $msg12_scratch->header($header_scratch),
+ "Setting header - SOAP version 1.2"
+);
+
+ok(
+ $msgtest12_scratch = $msg12_scratch->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+like(
+ $msgtest12_scratch, qr/Header.+Test.+Header/s, "Verifying header content"
+);
+
+# Very simple comparison, that might fail in future version:
+$msgtest11_scratch =~ s!$perfSONAR::SOAP::ns_soap11!!g;
+$msgtest12_scratch =~ s!$perfSONAR::SOAP::ns_soap12!!g;
+is(
+ $msgtest11_scratch,$msgtest12_scratch,
+ "Comparing retrieved Messages (1.1 <-> 1.2)"
+);
+
+#TODO Test setting via NodeList. Really necessary?
+
+
+#
+# Full blown "new" call
+#
+
+# SOAP 1.1
+
+my $foo = XML::LibXML->new()->parse_string($header_scratch)->documentElement;
+my $bar = XML::LibXML->new()->parse_string($body_scratch);
+ # IMPORTANT: Body is here an XML::LibXML::Document. This way we also test
+ # this special case!
+ok(
+ my $msg11_scratch_full = perfSONAR::SOAP::Message->new(
+ version => "1.1",
+ header => [$foo],
+ body => [$bar],
+ uri => "uri:/test"
+ ),
+ "Creating full message - SOAP version 1.1 (default)"
+);
+is(
+ $msg11_scratch_full->version, "1.1",
+ "Verifying that version was detected correctly"
+);
+
+ok(
+ my $msgtest11_scratch_full = $msg11_scratch_full->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+like($msgtest11_scratch_full, qr/Body.+Test.+Body/s, "Verifying body
content");
+
+ok(
+ $msgtest11_scratch_full = $msg11_scratch_full->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+like(
+ $msgtest11_scratch_full, qr/Header.+Test.+Header/s, "Verifying header
content"
+);
+
+# SOAP 1.2
+
+# We need to recreate DOM structures, since the previous Message->new "took
+# them away"
+$foo = XML::LibXML->new()->parse_string($header_scratch)->documentElement;
+$bar = XML::LibXML->new()->parse_string($body_scratch);
+ok(
+ my $msg12_scratch_full = perfSONAR::SOAP::Message->new(
+ version => "1.2",
+ header => [$foo],
+ body => [$bar],
+ uri => "uri:/test"
+ ),
+ "Creating full message - SOAP version 1.2"
+);
+is(
+ $msg12_scratch_full->version, "1.2",
+ "Verifying that version was detected correctly"
+);
+
+ok(
+ my $msgtest12_scratch_full = $msg12_scratch_full->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+like($msgtest12_scratch_full, qr/Body.+Test.+Body/s, "Verifying body
content");
+
+ok(
+ $msgtest12_scratch_full = $msg12_scratch_full->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+like(
+ $msgtest12_scratch_full, qr/Header.+Test.+Header/s, "Verifying header
content"
+);
+
+# Very simple comparison, that might fail in future version:
+$msgtest11_scratch_full =~ s!$perfSONAR::SOAP::ns_soap11!!g;
+$msgtest12_scratch_full =~ s!$perfSONAR::SOAP::ns_soap12!!g;
+is(
+ $msgtest11_scratch_full,$msgtest12_scratch_full,
+ "Comparing retrieved Messages (1.1 <-> 1.2)"
+);
+
+#TODO calling "new" setting fault directly!
+
+
+#
+# Create messages from XML source
+#
+
+my $body = <<__EOXML__;
+ <ns:body1 xmlns:ns="http://test.org/ns/body/" attr1="1"/>
+ <ns:body2 xmlns:ns="http://test.org/ns/body/" attr1="2">
+ <test>Test A</test>
+ </ns:body2>
+__EOXML__
+
+my $header = <<__EOXML__;
+ <ns:header1 xmlns:ns="http://test.org/ns/body/" attr1="1"/>
+ <ns:header2 xmlns:ns="http://test.org/ns/body/" attr1="2">
+ <test>Test A</test>
+ </ns:header2>
+__EOXML__
+
+my $msgxml11 = <<__EOXML__;
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Header>
+ $header
+ </soapenv:Header>
+ <soapenv:Body>
+ $body
+ </soapenv:Body>
+</soapenv:Envelope>
+__EOXML__
+
+ok(
+ my $msg11 = perfSONAR::SOAP::Message->from_string($msgxml11,"uri:/test"),
+ "Creating message from XML source - SOAP version 1.1"
+);
+is($msg11->version, "1.1", "Verifying that version was detected correctly");
+
+my $msgxml12 = <<__EOXML__;
+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
+ <soapenv:Header>
+ $header
+ </soapenv:Header>
+ <soapenv:Body>
+ $body
+ </soapenv:Body>
+</soapenv:Envelope>
+__EOXML__
+
+ok(
+ my $msg12 = perfSONAR::SOAP::Message->from_string($msgxml12,"uri:/test"),
+ "Creating message from XML source - SOAP version 1.2"
+);
+is($msg12->version, "1.2", "Verifying that version was detected correctly");
+
+
+ok(
+ my $msgtest11 = $msg11->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+like($msgtest11, qr/Header.+Test A.+Header/s, "Verifying header content");
+like($msgtest11, qr/Body.+Test A.+Body/s, "Verifying body content");
+
+ok(
+ my $msgtest12 = $msg12->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+like($msgtest12, qr/Header.+Test A.+Header/s, "Verifying header content");
+like($msgtest12, qr/Body.+Test A.+Body/s, "Verifying body content");
+
+# Very simple comparison, that might fail in future version:
+$msgtest11 =~ s!$perfSONAR::SOAP::ns_soap11!!g;
+$msgtest12 =~ s!$perfSONAR::SOAP::ns_soap12!!g;
+is($msgtest11,$msgtest12,"Comparing retrieved Messages (1.1 <-> 1.2)");
+
+
+#
+# Tests for setting body and Header
+#
+
+# This is done by using strings, which automatically tests the string parsing
+# functionalities.
+
+my $body_new = <<__EOXML__;
+ <ns:bodynew xmlns:ns="http://test.org/ns/body/" attr1="3">
+ <test>Test B</test>
+ </ns:bodynew>
+__EOXML__
+
+my $header_new = <<__EOXML__;
+ <ns:headernew xmlns:ns="http://test.org/ns/body/" attr1="3">
+ <test>Test B</test>
+ </ns:headernew>
+__EOXML__
+
+# SOAP 1.1
+
+ok($msg11->body($body_new), "Setting new body - SOAP version 1.1");
+
+ok(
+ my $msgtest11_new = $msg11->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+ok(
+ $msgtest11_new =~ m/Body.+Test B.+Body/s
+ && ! ($msgtest11_new =~ m/Body.+Test A.+Body/s),
+ "Verifying new body content"
+);
+
+ok($msg11->header($header_new), "Setting new header - SOAP version 1.1");
+
+ok(
+ $msgtest11_new = $msg11->as_string,
+ "Retrieving message as XML - SOAP version 1.1"
+);
+
+ok(
+ $msgtest11_new =~ m/Header.+Test B.+Header/s
+ && ! ($msgtest11_new =~ m/Header.+Test A.+Header/s),
+ "Verifying new header content"
+);
+
+# SOAP 1.2
+
+ok($msg12->body($body_new), "Setting new body - SOAP version 1.2");
+
+ok(
+ my $msgtest12_new = $msg12->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+ok(
+ $msgtest12_new =~ m/Body.+Test B.+Body/s
+ && ! ($msgtest12_new =~ m/Body.+Test A.+Body/s),
+ "Verifying new body content"
+);
+
+ok($msg12->header($header_new), "Setting new header - SOAP version 1.2");
+
+ok(
+ $msgtest12_new = $msg12->as_string,
+ "Retrieving message as XML - SOAP version 1.2"
+);
+
+ok(
+ $msgtest12_new =~ m/Header.+Test B.+Header/s
+ && ! ($msgtest12_new =~ m/Header.+Test A.+Header/s),
+ "Verifying new header content"
+);
+
+#TODO Test setting via NodeList. Really necessary?
+
+
+#
+# Some special tests
+#
+
+my $msgxml_transport = <<__EOXML__;
+<outer-transport>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Header>
+ $header
+ </soapenv:Header>
+ <soapenv:Body>
+ $body
+ </soapenv:Body>
+</soapenv:Envelope>
+</outer-transport>
+__EOXML__
+
+my @foo =
+
XML::LibXML->new()->parse_string($msgxml_transport)->getElementsByTagNameNS(
+ "http://schemas.xmlsoap.org/soap/envelope/","Envelope"
+ );
+ok(
+ my $msg_transport = perfSONAR::SOAP::Message->from_dom($foo[0],
"uri:/test"),
+ "Creating message from not document root element"
+);
+is($msg11->version, "1.1", "Verifying that version was detected correctly");
+
+
+#
+# Creating SOAP Fault
+#
+
+ok(
+ my $msg11_fault_simple = perfSONAR::SOAP::Fault_v1_1->new(
+ "http://test.org/ns/faultcode", "Server.Test", "This is a test fault",
+ "http://mydomain.org/my_fault"
+ ),
+ "Creating simple SOAP 1.1 fault from scratch"
+);
+
+#TODO Use a clone instead of message from above directly...
+ok(!$msg11->is_fault, "Verifying message from above (1.1) is not a fault");
+ok(
+ $msg11->fault($msg11_fault_simple),
+ "Adding Fault to message"
+);
+ok($msg11->is_fault, "Verifying that message now is a fault");
+is(
+ $msg11->body, undef, "Verifying that message has no valid body"
+);
+is_deeply(
+ [$msg11->fault->faultcode],
+ ["http://test.org/ns/faultcode","Server.Test"],
+ "Verifying correct fault code (and its namespace)"
+);
+is(
+ $msg11->fault->faultstring, "This is a test fault",
+ "Verifying correct fault string"
+);
+is(
+ $msg11->fault->faultfactor, "http://mydomain.org/my_fault",
+ "Verifying correct fault factor"
+);
+#TODO some checks about "detail"? But also tested below!
+#TODO do we really want to test additional "crap"?
+
+#
+# Creating message with SOAP Fault
+#
+
+# SOAP 1.1 Fault as seen from Apache Axis
+my $msgxml11_fault = <<__EOXML__;
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <soapenv:Body>
+ <soapenv:Fault>
+ <faultcode
+ xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.NoService
+ </faultcode>
+ <faultstring>
+ The AXIS engine could not find a target service to invoke!
+ targetService is
+ </faultstring>
+ <detail>
+ <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">host</ns2:hostname>
+ </detail>
+ </soapenv:Fault>
+ </soapenv:Body>
+</soapenv:Envelope>
+__EOXML__
+
+ok(
+ my $msg11_fault = perfSONAR::SOAP::Message->from_string(
+ $msgxml11_fault,"uri:/test"
+ ),
+ "Creating fault message from XML source - SOAP version 1.1"
+);
+is(
+ $msg11_fault->version, "1.1",
+ "Verifying that version was detected correctly"
+);
+ok($msg11_fault->is_fault, "Verifying that fault was recognized correctly");
+is(
+ $msg11_fault->body, undef, "Verifying that message has no valid body"
+);
+is_deeply(
+ [$msg11_fault->fault->faultcode],
+ ["http://xml.apache.org/axis/","Server.NoService"],
+ "Verifying correct fault code (and its namespace)"
+);
+like(
+ $msg11_fault->fault->faultstring,
+ qr/The AXIS engine could not find a target service to invoke/s,
+ "Verifying correct fault string"
+);
+like(
+ join('',map({ $_->toString } $msg11_fault->fault->detail)),
+ qr'<ns2:hostname
xmlns:ns2="http://xml.apache.org/axis/">host</ns2:hostname>'s,
+ "Retrieving detail elements"
+);
+
+# SOAP 1.2 Fault as provided by W3C
+# http://www.w3.org/TR/2007/REC-soap12-part1-20070427/#faultcodes
+my $msgxml12_fault = <<__EOXML__;
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+ xmlns:m="http://www.example.org/timeouts"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace">
+ <env:Body>
+ <env:Fault>
+ <env:Code>
+ <env:Value>env:Sender</env:Value>
+ <env:Subcode>
+ <env:Value>m:MessageTimeout</env:Value>
+ </env:Subcode>
+ </env:Code>
+ <env:Reason>
+ <env:Text xml:lang="en">Sender Timeout</env:Text>
+ </env:Reason>
+ <env:Detail>
+ <m:MaxTime>P5M</m:MaxTime>
+ </env:Detail>
+ </env:Fault>
+ </env:Body>
+</env:Envelope>
+__EOXML__
+
+ok(
+ my $msg12_fault = perfSONAR::SOAP::Message->from_string(
+ $msgxml12_fault,"uri:/test"
+ ),
+ "Creating fault message from XML source - SOAP version 1.2"
+);
+is(
+ $msg12_fault->version, "1.2",
+ "Verifying that version was detected correctly"
+);
+
+
+
+
+
+
+
Added: trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-002-Core.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-002-Core.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-0.51/t/perfSONAR-002-Core.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,156 @@
+#TODO
+
+use strict;
+use warnings;
+
+use Test::More tests => 48;
+
+BEGIN {
+ # Third party modules:
+ use_ok('XML::LibXML');
+ # Additional modules (should be tested before!):
+ use_ok('perfSONAR::SOAP::Message');
+ # The modules we want to test:
+ use_ok('perfSONAR');
+ use_ok('perfSONAR::SOAP::HTTP::Request');
+ use_ok('perfSONAR::SOAP::HTTP::Response');
+ use_ok('perfSONAR::SOAP::HTTP::UserAgent');
+}
+
+
+#
+# Test UserAgent
+#
+
+ok(
+ my $ua = perfSONAR::SOAP::HTTP::UserAgent->new(),
+ "Creating perfSONAR::SOAP::HTTP::UserAgent"
+);
+
+#
+# Test creating Request
+#
+
+ok(
+ my $request_empty = perfSONAR::SOAP::HTTP::Request->new(),
+ "Creating empty perfSONAR::SOAP::HTTP::Request"
+);
+
+ok(
+ my $request_uri = perfSONAR::SOAP::HTTP::Request->new(uri => "uri:/test"),
+ "Creating Request with URI"
+);
+is($request_uri->uri->as_string, "uri:/test", "Verifying URI");
+
+ok(
+ my $request_get = perfSONAR::SOAP::HTTP::Request->new(method => "GET"),
+ "Creating Request with method GET"
+);
+is($request_get->method, "GET", "Verifying method");
+
+
+foreach my $soap_version (qw(1.1 1.2)) {
+
+ # We need a perfSONAR::SOAP::Message object:
+ my $soap_body_src = <<__EOXML__;
+ <ns:body xmlns:ns="http://test.org/ns/body/" attr1="1">
+ <test>Test</test>
+ </ns:body>
+__EOXML__
+
+ my $soap_header_src = <<__EOXML__;
+ <ns:header xmlns:ns="http://test.org/ns/body/" attr1="1">
+ <test>Test</test>
+ </ns:header>
+__EOXML__
+ my $soap_body =
+ XML::LibXML->new()->parse_string($soap_header_src)->documentElement;
+ my $soap_header =
+ XML::LibXML->new()->parse_string($soap_body_src)->documentElement;
+ my $soap_message = perfSONAR::SOAP::Message->new(
+ version => $soap_version,
+ header => [$soap_header],
+ body => [$soap_body],
+ uri => "uri:/test"
+ );
+
+ ok(
+ my $request_full =
+ perfSONAR::SOAP::HTTP::Request->new(message => $soap_message),
+ "Creating Request with full perfSONAR::SOAP::Message - SOAP
$soap_version"
+ );
+ ok(my $request_full_content = $request_full->content, "Retrieving
content");
+ like(
+ $request_full_content,
+ qr/Envelope.*Header.+Test.+Header.+Body.+Test.+Body.+Envelope/s,
+ "Verifying content"
+ );
+ is($request_full->uri->as_string, "uri:/test", "Verifying URI");
+
+ # Now set a different URI
+ ok(
+ my $request_full_uri = perfSONAR::SOAP::HTTP::Request->new(
+ message => $soap_message, uri => "uri:/test/diff"
+ ),
+ "Creating Request with filled message AND different URI - SOAP
$soap_version"
+ );
+ ok(
+ my $request_full_uri_content = $request_full_uri->content,
+ "Retrieving content"
+ );
+ like(
+ $request_full_uri_content,
+ qr/Envelope.*Header.+Test.+Header.+Body.+Test.+Body.+Envelope/s,
+ "Verifying content"
+ );
+ is($request_full_uri->uri->as_string, "uri:/test/diff", "Verifying URI");
+
+ # Now create with empty message and then fill it
+ ok(
+ my $request_msg_empty = perfSONAR::SOAP::HTTP::Request->new(
+ message => perfSONAR::SOAP::Message->new(version => $soap_version)
+ ),
+ "Creating Request with empty perfSONAR::SOAP::Message - SOAP
$soap_version"
+ );
+ is($request_msg_empty->uri, undef, "Verifying empty URI");
+ ok(
+ $request_msg_empty->soap_message($soap_message,1),
+ "Setting filled Message via method soap_message without URI - SOAP
$soap_version"
+ );
+ ok(
+ my $request_msg_empty_content = $request_msg_empty->content,
+ "Retrieving content"
+ );
+ like(
+ $request_msg_empty_content,
+ qr/Envelope.*Header.+Test.+Header.+Body.+Test.+Body.+Envelope/s,
+ "Verifying content"
+ );
+ is($request_msg_empty->uri, undef, "Verifying empty URI");
+
+ # We want to test changing of URI:
+ $request_msg_empty->uri("uri:/test/change/me");
+
+ ok(
+ $request_msg_empty->soap_message($soap_message),
+ "Setting filled Message via method soap_message with URI - SOAP
$soap_version"
+ );
+ ok(
+ $request_msg_empty_content = $request_msg_empty->content,
+ "Retrieving content"
+ );
+ like(
+ $request_msg_empty_content,
+ qr/Envelope.*Header.+Test.+Header.+Body.+Test.+Body.+Envelope/s,
+ "Verifying content"
+ );
+ is($request_msg_empty->uri->as_string, "uri:/test", "Verifying URI");
+
+ #TODO test "header"
+}
+
+#TODO How to do "real" tests?
+# Perhaps this way: http://www.perlmonks.org/?node_id=427740
+
+#TODO Echo Request ???
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+#! /usr/bin/perl
+
+use strict;
+use Cwd;
+use File::Basename;
+use File::Spec;
+
+sub magic_number_matches {
+ return 0 unless -e '_build/magicnum';
+ local *FH;
+ open FH, '_build/magicnum' or return 0;
+ my $filenum = <FH>;
+ close FH;
+ return $filenum == 379975;
+}
+
+my $progname;
+my $orig_dir;
+BEGIN {
+ $^W = 1; # Use warnings
+ $progname = basename($0);
+ $orig_dir = Cwd::cwd();
+ my $base_dir =
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51';
+ if (!magic_number_matches()) {
+ unless (chdir($base_dir)) {
+ die ("Couldn't chdir($base_dir), aborting\n");
+ }
+ unless (magic_number_matches()) {
+ die ("Configuration seems to be out of date, please re-run 'perl
Build.PL' again.\n");
+ }
+ }
+ unshift @INC,
+ (
+
+ );
+}
+
+close(*DATA) unless eof(*DATA); # ensure no open handles to this script
+
+use Module::Build;
+
+# Some platforms have problems setting $^X in shebang contexts, fix it up
here
+$^X = Module::Build->find_perl_interpreter;
+
+if (-e 'Build.PL' and not Module::Build->up_to_date('Build.PL', $progname)) {
+ warn "Warning: Build.PL has been altered. You may need to run 'perl
Build.PL' again.\n";
+}
+
+# This should have just enough arguments to be able to bootstrap the rest.
+my $build = Module::Build->resume (
+ properties => {
+ config_dir => '_build',
+ orig_dir => $orig_dir,
+ },
+);
+
+$build->dispatch;
Property changes on: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Build.PL 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+ module_name => 'perfSONAR::MP::BWCTL',
+ dist_name => 'perfsonar-oppd-mp-bwctl',
+ license => 'apache',
+ dist_author => 'DFN-Labor
<>',
+ dist_version_from => 'lib/perfSONAR/MP/BWCTL.pm',
+ dist_abstract => 'BWCTL MP module for perl-perfSONAR',
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ requires => {
+ 'perfSONAR' => 0.51,
+ 'IPC::Run' => 0,
+ 'IO::Tty' => '>= 1.02',
+ },
+ etc_files => {
+ 'etc/bwctl.conf' => 'etc/oppd.d/oppd-bwctl.conf',
+ },
+ add_to_cleanup => [ 'perfSONAR-MP-BWCTL-*' ],
+ create_makefile_pl => 'small',
+);
+
+my $install_base = $builder->install_base();
+if ($install_base){
+ $builder->install_path('etc' => "$install_base/etc");
+}
+$builder->install_path('etc' => 'etc');
+$builder->add_build_element('etc');
+$builder->install_base_relpaths('lib' => 'lib');
+$builder->create_build_script();
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Changes
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Changes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Changes 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,12 @@
+Changelog for release 0.5
+
+ - added logging strings
+ - handling of supported/unknown features
+ - better support of BWCTL schema
+
+Changelog for release 0.41
+
+New features:
+ - some bug fixes and better LS registration handling
+ - selftest funcitonality for status monitoring of service
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/MANIFEST
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/MANIFEST
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/MANIFEST 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,13 @@
+Build.PL
+Changes
+etc/bwctl.conf
+lib/perfSONAR/BWCTL.pm
+lib/perfSONAR/MP/BWCTL.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/00-load.t
+t/perfSONAR-BWCTL-001.t
+t/perfSONAR-MP-001.t
+t/perfSONAR-MP-BWCTL-001.t
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/META.yml
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/META.yml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/META.yml 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,25 @@
+---
+name: perfsonar-oppd-mp-bwctl
+version: 0.51
+author:
+ - 'DFN-Labor
<>'
+abstract: BWCTL MP module for perl-perfSONAR
+license: apache
+resources:
+ license: http://apache.org/licenses/LICENSE-2.0
+requires:
+ IO::Tty: '>= 1.02'
+ IPC::Run: 0
+ perfSONAR: 0.51
+build_requires:
+ Test::More: 0
+provides:
+ perfSONAR::BWCTL:
+ file: lib/perfSONAR/BWCTL.pm
+ perfSONAR::MP::BWCTL:
+ file: lib/perfSONAR/MP/BWCTL.pm
+ version: 0.51
+generated_by: Module::Build version 0.280801
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Makefile.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Makefile.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/Makefile.PL 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+# Note: this file was auto-generated by Module::Build::Compat version
0.2808_01
+ use Module::Build::Compat 0.02;
+
+ Module::Build::Compat->run_build_pl(args =>
\@ARGV);
+ require Module::Build;
+ Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/README
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/README
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/README 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,79 @@
+oppd-MP-BWCTL
+-------------
+
+Version 0.51
+
+The oppd BWCTL MP is a service plugin for oppd (open perl perfSONAR daemon).
+It's purpose is to provide a perfSONAR interface to bwctl measurements.
+To use this module you need to install the oppd package first. The BWCTL
+MP module needs several perl modules (available via e.g. CPAN) in addition.
+
+For more information about perfSONAR, see www.perfsonar.net
+For more information about CPAN, see www.cpan.org
+
+1. Preparation:
+---------------
+
+You need to install the bwctl and iperf tools, to be able to perform a BWCTL
+measurement. You can get these at:
+
+Iperf: http://sourceforge.net/projects/iperf. Note that version 2.0.2 is
+recommended, as newer versions have a bug preventing proper output of
interval
+measurements.
+
+BWCTL: http://e2epi.internet2.edu/bwctl/. Version 1.3 recommended.
+
+Moreover, you need to have a proper time synchronization (via NTP) set up and
+running to get proper test results.
+
+
+Perl modules dependency list:
+-----------------------------
+perl version 5.8.0 or higher
+perl(IO::Tty) >= 1.02
+perl(IPC::Run)
+perl(perfSONAR) >= 0.51
+
+
+2. Installation:
+----------------
+
+Change to oppd-mp-bwctl-0.51 directory and type the following commands:
+perl Build.PL --install_base=/usr/lib/perfsonar/services/oppd
+./Build install
+
+
+3. Run BWCTL MP:
+----------------
+
+To run the BWCTL MP, you first have to make sure that the bwctld is properly
+running. If this is the case, you should include the BWCTL MP service
definition
+included in /usr/lib/perfsonar/services/oppd/etc/bwctl.conf to
/etc/oppd.conf.
+You can either include it by adding an include line to oppd.conf, or by
attaching
+the contents of bwctl.conf to oppd.conf. When you have done this, restart the
+oppd daemon.
+
+For start options and configuration file format please refer to the manual
+pages.
+
+4. Deinstallation:
+------------------
+
+First make sure that oppd.pl isn't running and stop it, if it is running.
Either
+delete the include line or the definition block for BWCTL MP from
/etc/oppd.conf.
+
+You can now restart the oppd service, if you still have other perfSONAR
services
+provided by oppd other than the BWCTL MP.
+
+To delete BWCTL MP completely, remove the following files from your system:
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
+
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008, 2009 DFN-Labor
+
+This program is released under the following license: bsd
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/auto_features
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/auto_features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/auto_features
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/build_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/build_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/build_params
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,281 @@
+do{ my $x = [
+ {
+ 'ARGV' => []
+ },
+ {},
+ {
+ 'verbose' => undef,
+ 'PL_files' => undef,
+ 'pollute' => undef,
+ 'bindoc_dirs' => [
+ 'blib/script'
+ ],
+ 'conflicts' => {},
+ 'recommends' => {},
+ 'scripts' => undef,
+ 'dist_version' => bless( {
+ 'original' => '0.51',
+ 'version' => [
+ 0,
+ 510
+ ]
+ }, 'Module::Build::Version' ),
+ 'pod_files' => undef,
+ 'config_dir' => '_build',
+ 'recurse_into' => [],
+ 'build_bat' => 0,
+ 'extra_linker_flags' => [],
+ 'build_class' => 'Module::Build',
+ 'prereq_action_types' => [
+ 'requires',
+ 'build_requires',
+ 'conflicts',
+ 'recommends'
+ ],
+ 'base_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51',
+ 'allow_mb_mismatch' => 0,
+ 'xs_files' => undef,
+ 'destdir' => undef,
+ 'metafile' => 'META.yml',
+ 'mb_version' => '0.280801',
+ 'has_config_data' => undef,
+ 'dist_name' => 'perfsonar-oppd-mp-bwctl',
+ 'install_base' => undef,
+ 'module_name' => 'perfSONAR::MP::BWCTL',
+ 'recursive_test_files' => undef,
+ 'libdoc_dirs' => [
+ 'blib/lib',
+ 'blib/arch'
+ ],
+ 'perl' => '/usr/bin/perl',
+ 'dist_author' => [
+ 'DFN-Labor
<>'
+ ],
+ 'use_rcfile' => 1,
+ 'configure_requires' => {},
+ 'test_files' => undef,
+ 'dist_abstract' => 'BWCTL MP module for perl-perfSONAR',
+ 'create_readme' => undef,
+ 'prefix_relpaths' => {
+ 'core' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ },
+ 'site' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ 'site_perl',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5',
+ 'site_perl'
+ ]
+ },
+ 'vendor' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ }
+ },
+ 'meta_merge' => {},
+ 'get_options' => {},
+ 'dist_version_from' => 'lib/perfSONAR/MP/BWCTL.pm',
+ 'debugger' => undef,
+ 'html_css' => '',
+ 'build_elements' => [
+ 'PL',
+ 'support',
+ 'pm',
+ 'xs',
+ 'pod',
+ 'script',
+ 'etc'
+ ],
+ 'orig_dir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51',
+ 'include_dirs' => [],
+ 'installdirs' => 'site',
+ 'create_makefile_pl' => 'small',
+ 'magic_number' => undef,
+ 'install_sets' => {
+ 'core' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl/5.10',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl/5.10'
+ },
+ 'site' => {
+ 'libdoc' => '/usr/local/man/man3',
+ 'script' => '/usr/local/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/local/man/man1',
+ 'bin' => '/usr/local/bin',
+ 'arch' =>
'/usr/local/lib/perl/5.10.0',
+ 'binhtml' => undef,
+ 'lib' =>
'/usr/local/share/perl/5.10.0'
+ },
+ 'vendor' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl5',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl5'
+ }
+ },
+ 'install_base_relpaths' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib'
+ ]
+ },
+ 'meta_add' => {},
+ 'create_packlist' => 1,
+ 'requires' => {
+ 'IPC::Run' => 0,
+ 'IO::Tty' => '>= 1.02',
+ 'perfSONAR' => '0.51'
+ },
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib',
+ 'etc' => 'etc'
+ },
+ 'etc_files' => {
+ 'etc/bwctl.conf' => 'etc/oppd.d/oppd-bwctl.conf'
+ },
+ 'pm_files' => undef,
+ 'quiet' => undef,
+ 'extra_compiler_flags' => [],
+ 'script_files' => undef,
+ 'build_script' => 'Build',
+ 'original_prefix' => {
+ 'core' => '/usr',
+ 'site' => '/usr/local',
+ 'vendor' => '/usr'
+ },
+ 'c_source' => undef,
+ 'license' => 'apache',
+ 'autosplit' => undef,
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'config' => undef,
+ 'blib' => 'blib',
+ 'prefix' => undef
+ }
+ ];
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/cleanup
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/cleanup
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/cleanup
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,5 @@
+do{ my $x = {
+ 'perfSONAR-MP-BWCTL-*' => 1,
+ 'blib' => 1
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/config_data
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/config_data
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/config_data
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/features
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/features
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/magicnum
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/magicnum
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/magicnum
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+379975
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/notes
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/notes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/notes
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/prereqs
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/prereqs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/prereqs
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,13 @@
+do{ my $x = {
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'conflicts' => {},
+ 'requires' => {
+ 'IPC::Run' => 0,
+ 'IO::Tty' => '>= 1.02',
+ 'perfSONAR' => '0.51'
+ },
+ 'recommends' => {}
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/runtime_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/runtime_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/_build/runtime_params
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+do{ my $x = {
+ 'create_packlist' => '0',
+ 'destdir' =>
'/home/unrz217/SA2T3-OPPD/trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl',
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib',
+ 'etc' => '/etc'
+ }
+ };
+$x; }
\ No newline at end of file
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/oppd.d/oppd-bwctl.conf
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/oppd.d/oppd-bwctl.conf
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/etc/oppd.d/oppd-bwctl.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,45 @@
+#
+# BWCTL MP example configuration
+#
+
+<service MP/BWCTL>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::BWCTL # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "BWCTL Measurement Point"
+ description "Measurement Point for doing on-demand BWCTL tests"
+ keyword "project:mybwctl"
+
+ #
+ # Further parameters
+ #
+ metric "bandwidth"
+ # Measurement metric(s). More than one element definition possible.
+ tool "bwctl" # Tool name
+
+ #
+ # Module parameters
+ #
+ <module_param>
+
+ command "bwctl"
+ # Command to execute e.g. "/usr/bin/bwctl" or "/bin/bwctl".
+ # Omitting path searches $PATH.
+
+ #
+ # Store functionality
+ #
+ store off # Enable/disable store functionality
+ store_url "http://www.mySQL-MA:8090"
+ # URL of a MA service to sent the results of measurements to
+
+ </module_param>
+
+</service MP/BWCTL>
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/BWCTL.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/BWCTL.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,220 @@
+package perfSONAR::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use IPC::Run qw( run timeout start finish pump);
+use IO::Pty;
+
+use perfSONAR qw( print_log);
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+#TODO Error handling
+#composing of commandline and parsing of results of bwctl
+
+sub commandline {
+ my %parameters = @_;
+ my @commandline;
+ unless ($parameters{"src"} || $parameters{"dst"}) {
+ return "ERROR", "Neither source nor destination ip address specified.";
+ }
+ if (!$parameters{"src"} || !$parameters{"dst"}){ #find out end point
+ #my @result = `/sbin/ifconfig eth0`;
+ #grep(/^\s+\w+\s+\w+\:(\d+\.\d+\.\d+\.\d+)/, @result);
+ my $ip_result = `/sbin/ip addr show dev eth0 scope global primary`;
+ $ip_result =~ /\n\s+inet\s+(\d+\.\d+\.\d+\.\d+)/;
+ my $local_ip = $1;
+ unless ($local_ip) {
+ return "ERROR", "Cannot determine local ip address.";
+ }
+ $parameters{"src"} = $local_ip unless $parameters{"src"};
+ $parameters{"dst"} = $local_ip unless $parameters{"dst"};
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Measurement requested " .
+ "using same local IP address as source and destination.";
+ }
+ }
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Source ip address equal to destination ip address.";
+ }
+
+ #check parameters to be correct input:
+ foreach my $param (keys %parameters){
+ next if ($param eq "param_ns_prefix" ||
+ $param eq "metaID" ||
+ $param eq "subject_ns_prefix" ||
+ $param eq "parameter_ID" ||
+ $param eq "param_ns_uri" ||
+ $param eq "subject_ns_uri");
+
+ next if ($param eq "src" || $param eq "dst");
+ if ($param eq "login" || $param eq "password"){
+ unless ($parameters{$param} =~ /^\w+$/){
+ return "ERROR", "Invalid login/password string specified.";
+ }
+ next;
+ }
+ if ($param eq "TOS"){
+ unless ($parameters{$param} =~ /^\d+|0x\d+$/){
+ return "ERROR", "Invalid TOS string specified.";
+ }
+ next;
+ }
+ if ($param eq "protocol"){
+ unless ($parameters{$param} =~ /^udp$/i || $parameters{$param} =~
/^tcp$/i){
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+ next;
+ }
+ unless ($parameters{$param} =~ /^\d+$/){
+ return "ERROR", "Invalid value specified for $param.";
+ }
+
+ }
+
+ push @commandline , "-s" , $parameters{"src"};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+ push @commandline , "-c", $parameters{dst};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+
+
+ push @commandline , "-i", $parameters{interval}
if($parameters{"interval"});
+ push @commandline , "-t", $parameters{duration}
if($parameters{"duration"});
+ push @commandline , "-w", $parameters{windowSize}
if($parameters{"windowSize"});
+
+=cut obsolete
+ if (! $parameters{"protocol"}) {
+ # We assume default for undef, "" and 0
+ # => Do nothing
+ } elsif ($parameters{"protocol"} =~ /^udp$/i) {
+ push @commandline , "-u";
+ } elsif ($parameters{"protocol"} =~ /^tcp$/i) {
+ # tcp is default
+ } else {
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+=cut
+
+ push @commandline , "-u" if ($parameters{"protocol"} &&
$parameters{"protocol"} =~ /^udp$/i);
+ push @commandline , "-l", $parameters{bufferSize}
if($parameters{"bufferSize"});
+ push @commandline , "-b", $parameters{bandwidth}
if($parameters{"bandwidth"});
+ push @commandline , "-S", $parameters{TOS} if($parameters{"TOS"});
+ return @commandline;
+}
+
+sub do_bwctl {
+ my $tool = shift;
+ my $pass = shift;
+ my @bwctl = @_;
+
+ print_log ("info", "do_bwctl called with $tool\n");
+ my ($in, $out, $err);
+ unshift @bwctl, $tool;
+
+ if(!$pass){
+ my $command = join (" ", @bwctl);
+ my $out=`$command 2>&1`;
+ return $out;
+ }
+ my $h = start
(\@bwctl,
'<pty<', \$in, '>pty>', \$out, '2>', \$err);
+ while (1){
+ pump $h;
+ if ($err =~ /passphrase/){
+ $in = "$pass\n" ;
+ $err = "";
+ }
+ elsif ($err ne "\n"){
+ last;
+ }
+ }
+
+ my $out_tmp = $out;
+ my $err_tmp = $err;
+
+ finish $h;
+ if (!$out){
+ return "$err_tmp" . "$err";
+ }
+ return "$out_tmp" . "$out";
+
+}
+sub parse_result {
+ my $time = shift;
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my @datalines;
+
+ foreach my $resultline (@result){
+ next unless ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+
+ my %data_hash;
+ $data_hash{"timeType"} = "unix";
+ $data_hash{"timeValue"} = $time;
+ $data_hash{"interval"} = $1;
+ $data_hash{"numBytes"} = $2;
+ $data_hash{"numBytesUnits"} = $3;
+ $data_hash{"value"} = $4;
+ $data_hash{"valueUnits"} = $5;
+ push @datalines, \%data_hash;
+
+ }
+ if($#datalines < 0){
+ #no data -> something wrong, write result as error description:
+ $datalines[0]="BWCTL Error:";
+ foreach my $resultline (@result){
+ push @datalines, $resultline;
+ }
+ }
+
+ return @datalines;
+}
+
+
+sub parse_header {
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my %header;
+
+ foreach my $resultline (@result){
+ next if ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+ #print "header: $resultline\n";
+ if ($resultline =~ /TCP/){
+ $header{"proto"} = "TCP";
+ }
+ if ($resultline =~ /UDP/){
+ $header{"proto"} = "UDP";
+ }
+ if ($resultline =~ /TCP window size:\s*(\d+)\s*(\w+)/){
+ $header{"windowsize"} = $1; #$2 is always "Byte"
+ }
+ if ($resultline =~ /-t\s*(\d+)/){
+ $header{"duration"} = $1;
+ }
+ }
+ return %header;
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/MP/BWCTL.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/MP/BWCTL.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/blib/lib/perfSONAR/MP/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,277 @@
+package perfSONAR::MP::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::BWCTL;
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0/";
+
+sub new {
+ my $this = shift;
+
+ my $self = perfSONAR::MP->new (@_);
+ push @{$self->{"supportedEventtypes"}},
+
+ ("bwctl",
+ "http://ggf.org/ns/nmwg/tools/bwctl/2.0/",
+ "http://ggf.org/ns/nmwg/tools/iperf/2.0/");
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ interval => 1,
+ duration => 1,
+ windowSize => 1,
+ protocol => 1,
+ bufferSize => 1,
+ bandwidth => 1,
+ login => 1,
+ password => 1,
+ TOS => 1,
+ };
+
+ $self->{"unsupported_parameters"} = {
+
+ advisoryWindowsize => 1,
+ scheduleInterval => 1,
+ numberOfTests => 1,
+ latest => 1,
+ alpha => 1,
+ };
+
+ bless $self, qw(perfSONAR::MP::BWCTL);
+ return $self;
+}
+
+sub parse_key {
+
+ my $self = shift;
+ my %parameters = shift;
+ my %key = split (',', $parameters{"metadatakey"});
+ $parameters{"src"} = $key{"src"}{"value"} if $key{"src"}{"value"};
+ $parameters{"dst"} = $key{"dst"}{"value"} if $key{"dst"}{"value"};
+ $parameters{"interval"} = $key{"int"} if $key{"int"};
+ $parameters{"duration"} = $key{"dur"} if $key{"dur"};
+ $parameters{"windowSize"} = $key{"win"} if $key{"win"};
+ $parameters{"protocol"} = $key{"pro"} if $key{"pro"};
+ $parameters{"bufferSize"} = $key{"buf"} if $key{"buf"};
+ $parameters{"bandwidth"} = $key{"ban"} if $key{"ban"};
+ $parameters{"TOS"} = $key{"tos"} if $key{"tos"};
+}
+
+
+sub selftest {
+ my $self = shift;
+ return {
+ bwctl_command_test => \&bwctl_command_test,
+ bwctl_exec_test => \&bwctl_exec_test,
+ bwctld_running_test => \&bwctld_running_test,
+ ntpd_running_test => \&ntpd_running_test,
+ };
+}
+
+
+sub bwctl_command_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!(-e "$commandpath")){
+ $message = "BWCTL tool $command not found!";
+ #die "BWCTL tool $commandpath not found!\n";
+ } else {
+ $message = "BWCTL tool $command found ";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctl_exec_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!( -x "$commandpath")){
+ $message = "BWCTL tool $command not executable!";
+ #die "No executable $commandpath found!\n";
+ } else {
+ $message = "BWCTL tool $command executable.";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctld_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep bwctld`;
+ my $bwctld = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $bwctld = 1;
+ }
+ if ($bwctld){
+ $message = "bwctld running.";
+ $status = "success";
+ } else {
+ $message = "bwctld not running! ";
+ $self->print_log_id ("warning", "bwctld not running!");
+ }
+ return ($message, $status);
+}
+
+sub ntpd_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep ntpd`;
+ my $ntpd = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $ntpd = 1;
+ }
+ if ($ntpd){
+ $message = "ntpd running.";
+ $status = "success";
+ } else {
+ $message .= "ntpd not running!";
+ $self->print_log_id ("warning", "ntpd not running!");
+ }
+ return ($message, $status);
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+ my $ns = "http://ggf.org/ns/nmwg/tools/iperf/2.0/";
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests
+ my @tests = ("bwctl_command_test",
+ "bwctl_exec_test",
+ "bwctld_running_test",
+ "ntpd_running_test");
+ foreach my $test (@tests){
+ $self->print_log_id("debug", "Perform test: $test");
+ my ($message, $status) = $self->$test;
+ my $et =
"http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/$test/$status/1.0";
+ $msg->return_result_code(
+ $et, $message, $msg->{"dataIDs"}{$dataid}{"metaref"}, $test);
+ }
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ my %data_hash;
+ my $key;
+ $key .= "src,$parameters{src}" if $parameters{"src"};
+ $key .= ",dst,$parameters{dst}" if $parameters{"dst"};
+ $key .= ",int,$parameters{interval}" if $parameters{"interval"};
+ $key .= ",dur,$parameters{duration}" if $parameters{"duration"};
+ $key .= ",win,$parameters{windowSize}" if $parameters{"windowSize"};
+ $key .= ",pro,$parameters{protocol}" if $parameters{"protocol"};
+ $key .= ",buf,$parameters{bufferSize}" if $parameters{"bufferSize"};
+ $key .= ",ban,$parameters{bandwidth}" if $parameters{"bandwidth"};
+ $key .= ",tos,$parameters{TOS}" if $parameters{"TOS"};
+
+ $data_hash{"MetadataKey"} = "$key";
+ push @datalines, \%data_hash;
+ $msg->set_data($dataid, @datalines);
+ return 1;
+ }
+
+ my $unixtime = time;
+ my @commandline = perfSONAR::BWCTL::commandline(%parameters);
+ if ($commandline[0] eq "ERROR") {
+ return $msg->return_result_code("error.mp.bwctl", $commandline[1],
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+ $self->print_log_id("info", "BWCTL commandline: @commandline");
+ my @result = perfSONAR::BWCTL::do_bwctl($self->{"command"},
$parameters{"password"}, @commandline);
+ @datalines = perfSONAR::BWCTL::parse_result($unixtime, @result);
+ if ($datalines[0] eq "BWCTL Error:"){
+ my $errorstring = join(" ", @datalines);
+ $errorstring =~ s/usage.*$//;
+ return $msg->return_result_code("error.mp.bwctl", $errorstring,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ $msg->set_data_ns ($dataid, $ns, @datalines);
+
+=cut
+ my $datanode = $msg->{"dataIDs"}{$dataid}{"node"};
+ my $timenode = $msg->add_attribute(parent => $datanode, nodename =>
"commonTime",
+ type => "unix", value => $unixtime);
+ foreach my $data_hash (@datalines){
+
+ $msg->add_attribute(parent => $timenode, nodename => "datum",
+ namespace => $ns, %{$data_hash});
+ }
+=cut
+
+ if ($self->{"store"} == 1){
+ $self->store($msg);
+ }
+
+
+ return 1;
+
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/build-stamp
===================================================================
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/README.Debian
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/README.Debian
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/README.Debian
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-bwctl for Debian
+----------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Hakan Calim
<>
Tue, 20 Apr 2010 14:06:49 +0200
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/changelog
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/changelog
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/changelog
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-bwctl (0.52-0rc1) unstable; urgency=low
+
+ * Initial release
+
+ -- DFN Labor
<>
Tue, 20 Apr 2010 14:06:49 +0200
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/compat
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/compat
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/compat
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+7
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/control
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/control
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,18 @@
+Source: perfsonar-oppd-mp-bwctl
+Section: net
+Priority: extra
+Maintainer: DFN Labor
<>
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Standards-Version: 3.7.3
+Homepage: http://www.win-labor.dfn.de
+
+Package: perfsonar-oppd-mp-bwctl
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: perfsonar-oppd
+Description: perfSONAR::MP::BWCTL Perl module, plugin for oppd
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/copyright
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/copyright
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/files
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/files
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/files
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb net extra
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/conffiles
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/conffiles
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/conffiles
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+/etc/oppd.d/oppd-bwctl.conf
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/control
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/control
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,14 @@
+Package: perfsonar-oppd-mp-bwctl
+Version: 0.52-0rc1
+Architecture: all
+Maintainer: DFN Labor
<>
+Installed-Size: 116
+Pre-Depends: perfsonar-oppd
+Section: net
+Priority: extra
+Homepage: http://www.win-labor.dfn.de
+Description: perfSONAR::MP::BWCTL Perl module, plugin for oppd
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/md5sums
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/md5sums
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/md5sums
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+722d4e51787c95b4c4d303bbc0751da7
usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
+1a75fc71af3d6885bf1a785190d80a59
usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
+f3597d2153d9f28617c3dd12393f1c3d
usr/share/doc/perfsonar-oppd-mp-bwctl/copyright
+dafe02ce530e145a1641fe9e30fa17ec
usr/share/doc/perfsonar-oppd-mp-bwctl/README.Debian
+54bd018bdb5dc2ee1f6a7b208abb6787
usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.Debian.gz
+58f77b9a15530142ccc737228f3d1855
usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.gz
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ if [ ! -f /var/run/oppd.pid ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postrm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postrm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postrm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postrm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge|remove|upgrade)
+ if [ ! -a /var/run/oppd.pid ] && [ -a /etc/init.d/oppd ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+ failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/postrm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/preinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/preinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/preinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+
+ install|upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/preinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/prerm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/prerm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/prerm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,46 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/DEBIAN/prerm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/oppd.d/oppd-bwctl.conf
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/oppd.d/oppd-bwctl.conf
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/etc/oppd.d/oppd-bwctl.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,45 @@
+#
+# BWCTL MP example configuration
+#
+
+<service MP/BWCTL>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::BWCTL # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "BWCTL Measurement Point"
+ description "Measurement Point for doing on-demand BWCTL tests"
+ keyword "project:mybwctl"
+
+ #
+ # Further parameters
+ #
+ metric "bandwidth"
+ # Measurement metric(s). More than one element definition possible.
+ tool "bwctl" # Tool name
+
+ #
+ # Module parameters
+ #
+ <module_param>
+
+ command "bwctl"
+ # Command to execute e.g. "/usr/bin/bwctl" or "/bin/bwctl".
+ # Omitting path searches $PATH.
+
+ #
+ # Store functionality
+ #
+ store off # Enable/disable store functionality
+ store_url "http://www.mySQL-MA:8090"
+ # URL of a MA service to sent the results of measurements to
+
+ </module_param>
+
+</service MP/BWCTL>
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,220 @@
+package perfSONAR::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use IPC::Run qw( run timeout start finish pump);
+use IO::Pty;
+
+use perfSONAR qw( print_log);
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+#TODO Error handling
+#composing of commandline and parsing of results of bwctl
+
+sub commandline {
+ my %parameters = @_;
+ my @commandline;
+ unless ($parameters{"src"} || $parameters{"dst"}) {
+ return "ERROR", "Neither source nor destination ip address specified.";
+ }
+ if (!$parameters{"src"} || !$parameters{"dst"}){ #find out end point
+ #my @result = `/sbin/ifconfig eth0`;
+ #grep(/^\s+\w+\s+\w+\:(\d+\.\d+\.\d+\.\d+)/, @result);
+ my $ip_result = `/sbin/ip addr show dev eth0 scope global primary`;
+ $ip_result =~ /\n\s+inet\s+(\d+\.\d+\.\d+\.\d+)/;
+ my $local_ip = $1;
+ unless ($local_ip) {
+ return "ERROR", "Cannot determine local ip address.";
+ }
+ $parameters{"src"} = $local_ip unless $parameters{"src"};
+ $parameters{"dst"} = $local_ip unless $parameters{"dst"};
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Measurement requested " .
+ "using same local IP address as source and destination.";
+ }
+ }
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Source ip address equal to destination ip address.";
+ }
+
+ #check parameters to be correct input:
+ foreach my $param (keys %parameters){
+ next if ($param eq "param_ns_prefix" ||
+ $param eq "metaID" ||
+ $param eq "subject_ns_prefix" ||
+ $param eq "parameter_ID" ||
+ $param eq "param_ns_uri" ||
+ $param eq "subject_ns_uri");
+
+ next if ($param eq "src" || $param eq "dst");
+ if ($param eq "login" || $param eq "password"){
+ unless ($parameters{$param} =~ /^\w+$/){
+ return "ERROR", "Invalid login/password string specified.";
+ }
+ next;
+ }
+ if ($param eq "TOS"){
+ unless ($parameters{$param} =~ /^\d+|0x\d+$/){
+ return "ERROR", "Invalid TOS string specified.";
+ }
+ next;
+ }
+ if ($param eq "protocol"){
+ unless ($parameters{$param} =~ /^udp$/i || $parameters{$param} =~
/^tcp$/i){
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+ next;
+ }
+ unless ($parameters{$param} =~ /^\d+$/){
+ return "ERROR", "Invalid value specified for $param.";
+ }
+
+ }
+
+ push @commandline , "-s" , $parameters{"src"};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+ push @commandline , "-c", $parameters{dst};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+
+
+ push @commandline , "-i", $parameters{interval}
if($parameters{"interval"});
+ push @commandline , "-t", $parameters{duration}
if($parameters{"duration"});
+ push @commandline , "-w", $parameters{windowSize}
if($parameters{"windowSize"});
+
+=cut obsolete
+ if (! $parameters{"protocol"}) {
+ # We assume default for undef, "" and 0
+ # => Do nothing
+ } elsif ($parameters{"protocol"} =~ /^udp$/i) {
+ push @commandline , "-u";
+ } elsif ($parameters{"protocol"} =~ /^tcp$/i) {
+ # tcp is default
+ } else {
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+=cut
+
+ push @commandline , "-u" if ($parameters{"protocol"} &&
$parameters{"protocol"} =~ /^udp$/i);
+ push @commandline , "-l", $parameters{bufferSize}
if($parameters{"bufferSize"});
+ push @commandline , "-b", $parameters{bandwidth}
if($parameters{"bandwidth"});
+ push @commandline , "-S", $parameters{TOS} if($parameters{"TOS"});
+ return @commandline;
+}
+
+sub do_bwctl {
+ my $tool = shift;
+ my $pass = shift;
+ my @bwctl = @_;
+
+ print_log ("info", "do_bwctl called with $tool\n");
+ my ($in, $out, $err);
+ unshift @bwctl, $tool;
+
+ if(!$pass){
+ my $command = join (" ", @bwctl);
+ my $out=`$command 2>&1`;
+ return $out;
+ }
+ my $h = start
(\@bwctl,
'<pty<', \$in, '>pty>', \$out, '2>', \$err);
+ while (1){
+ pump $h;
+ if ($err =~ /passphrase/){
+ $in = "$pass\n" ;
+ $err = "";
+ }
+ elsif ($err ne "\n"){
+ last;
+ }
+ }
+
+ my $out_tmp = $out;
+ my $err_tmp = $err;
+
+ finish $h;
+ if (!$out){
+ return "$err_tmp" . "$err";
+ }
+ return "$out_tmp" . "$out";
+
+}
+sub parse_result {
+ my $time = shift;
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my @datalines;
+
+ foreach my $resultline (@result){
+ next unless ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+
+ my %data_hash;
+ $data_hash{"timeType"} = "unix";
+ $data_hash{"timeValue"} = $time;
+ $data_hash{"interval"} = $1;
+ $data_hash{"numBytes"} = $2;
+ $data_hash{"numBytesUnits"} = $3;
+ $data_hash{"value"} = $4;
+ $data_hash{"valueUnits"} = $5;
+ push @datalines, \%data_hash;
+
+ }
+ if($#datalines < 0){
+ #no data -> something wrong, write result as error description:
+ $datalines[0]="BWCTL Error:";
+ foreach my $resultline (@result){
+ push @datalines, $resultline;
+ }
+ }
+
+ return @datalines;
+}
+
+
+sub parse_header {
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my %header;
+
+ foreach my $resultline (@result){
+ next if ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+ #print "header: $resultline\n";
+ if ($resultline =~ /TCP/){
+ $header{"proto"} = "TCP";
+ }
+ if ($resultline =~ /UDP/){
+ $header{"proto"} = "UDP";
+ }
+ if ($resultline =~ /TCP window size:\s*(\d+)\s*(\w+)/){
+ $header{"windowsize"} = $1; #$2 is always "Byte"
+ }
+ if ($resultline =~ /-t\s*(\d+)/){
+ $header{"duration"} = $1;
+ }
+ }
+ return %header;
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,277 @@
+package perfSONAR::MP::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::BWCTL;
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0/";
+
+sub new {
+ my $this = shift;
+
+ my $self = perfSONAR::MP->new (@_);
+ push @{$self->{"supportedEventtypes"}},
+
+ ("bwctl",
+ "http://ggf.org/ns/nmwg/tools/bwctl/2.0/",
+ "http://ggf.org/ns/nmwg/tools/iperf/2.0/");
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ interval => 1,
+ duration => 1,
+ windowSize => 1,
+ protocol => 1,
+ bufferSize => 1,
+ bandwidth => 1,
+ login => 1,
+ password => 1,
+ TOS => 1,
+ };
+
+ $self->{"unsupported_parameters"} = {
+
+ advisoryWindowsize => 1,
+ scheduleInterval => 1,
+ numberOfTests => 1,
+ latest => 1,
+ alpha => 1,
+ };
+
+ bless $self, qw(perfSONAR::MP::BWCTL);
+ return $self;
+}
+
+sub parse_key {
+
+ my $self = shift;
+ my %parameters = shift;
+ my %key = split (',', $parameters{"metadatakey"});
+ $parameters{"src"} = $key{"src"}{"value"} if $key{"src"}{"value"};
+ $parameters{"dst"} = $key{"dst"}{"value"} if $key{"dst"}{"value"};
+ $parameters{"interval"} = $key{"int"} if $key{"int"};
+ $parameters{"duration"} = $key{"dur"} if $key{"dur"};
+ $parameters{"windowSize"} = $key{"win"} if $key{"win"};
+ $parameters{"protocol"} = $key{"pro"} if $key{"pro"};
+ $parameters{"bufferSize"} = $key{"buf"} if $key{"buf"};
+ $parameters{"bandwidth"} = $key{"ban"} if $key{"ban"};
+ $parameters{"TOS"} = $key{"tos"} if $key{"tos"};
+}
+
+
+sub selftest {
+ my $self = shift;
+ return {
+ bwctl_command_test => \&bwctl_command_test,
+ bwctl_exec_test => \&bwctl_exec_test,
+ bwctld_running_test => \&bwctld_running_test,
+ ntpd_running_test => \&ntpd_running_test,
+ };
+}
+
+
+sub bwctl_command_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!(-e "$commandpath")){
+ $message = "BWCTL tool $command not found!";
+ #die "BWCTL tool $commandpath not found!\n";
+ } else {
+ $message = "BWCTL tool $command found ";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctl_exec_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!( -x "$commandpath")){
+ $message = "BWCTL tool $command not executable!";
+ #die "No executable $commandpath found!\n";
+ } else {
+ $message = "BWCTL tool $command executable.";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctld_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep bwctld`;
+ my $bwctld = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $bwctld = 1;
+ }
+ if ($bwctld){
+ $message = "bwctld running.";
+ $status = "success";
+ } else {
+ $message = "bwctld not running! ";
+ $self->print_log_id ("warning", "bwctld not running!");
+ }
+ return ($message, $status);
+}
+
+sub ntpd_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep ntpd`;
+ my $ntpd = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $ntpd = 1;
+ }
+ if ($ntpd){
+ $message = "ntpd running.";
+ $status = "success";
+ } else {
+ $message .= "ntpd not running!";
+ $self->print_log_id ("warning", "ntpd not running!");
+ }
+ return ($message, $status);
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+ my $ns = "http://ggf.org/ns/nmwg/tools/iperf/2.0/";
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests
+ my @tests = ("bwctl_command_test",
+ "bwctl_exec_test",
+ "bwctld_running_test",
+ "ntpd_running_test");
+ foreach my $test (@tests){
+ $self->print_log_id("debug", "Perform test: $test");
+ my ($message, $status) = $self->$test;
+ my $et =
"http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/$test/$status/1.0";
+ $msg->return_result_code(
+ $et, $message, $msg->{"dataIDs"}{$dataid}{"metaref"}, $test);
+ }
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ my %data_hash;
+ my $key;
+ $key .= "src,$parameters{src}" if $parameters{"src"};
+ $key .= ",dst,$parameters{dst}" if $parameters{"dst"};
+ $key .= ",int,$parameters{interval}" if $parameters{"interval"};
+ $key .= ",dur,$parameters{duration}" if $parameters{"duration"};
+ $key .= ",win,$parameters{windowSize}" if $parameters{"windowSize"};
+ $key .= ",pro,$parameters{protocol}" if $parameters{"protocol"};
+ $key .= ",buf,$parameters{bufferSize}" if $parameters{"bufferSize"};
+ $key .= ",ban,$parameters{bandwidth}" if $parameters{"bandwidth"};
+ $key .= ",tos,$parameters{TOS}" if $parameters{"TOS"};
+
+ $data_hash{"MetadataKey"} = "$key";
+ push @datalines, \%data_hash;
+ $msg->set_data($dataid, @datalines);
+ return 1;
+ }
+
+ my $unixtime = time;
+ my @commandline = perfSONAR::BWCTL::commandline(%parameters);
+ if ($commandline[0] eq "ERROR") {
+ return $msg->return_result_code("error.mp.bwctl", $commandline[1],
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+ $self->print_log_id("info", "BWCTL commandline: @commandline");
+ my @result = perfSONAR::BWCTL::do_bwctl($self->{"command"},
$parameters{"password"}, @commandline);
+ @datalines = perfSONAR::BWCTL::parse_result($unixtime, @result);
+ if ($datalines[0] eq "BWCTL Error:"){
+ my $errorstring = join(" ", @datalines);
+ $errorstring =~ s/usage.*$//;
+ return $msg->return_result_code("error.mp.bwctl", $errorstring,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ $msg->set_data_ns ($dataid, $ns, @datalines);
+
+=cut
+ my $datanode = $msg->{"dataIDs"}{$dataid}{"node"};
+ my $timenode = $msg->add_attribute(parent => $datanode, nodename =>
"commonTime",
+ type => "unix", value => $unixtime);
+ foreach my $data_hash (@datalines){
+
+ $msg->add_attribute(parent => $timenode, nodename => "datum",
+ namespace => $ns, %{$data_hash});
+ }
+=cut
+
+ if ($self->{"store"} == 1){
+ $self->store($msg);
+ }
+
+
+ return 1;
+
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/README.Debian
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/README.Debian
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/README.Debian
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-bwctl for Debian
+----------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Hakan Calim
<>
Tue, 20 Apr 2010 14:06:49 +0200
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.Debian.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.Debian.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/changelog.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/copyright
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/copyright
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl/usr/share/doc/perfsonar-oppd-mp-bwctl/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl.debhelper.log
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl.debhelper.log
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/perfsonar-oppd-mp-bwctl.debhelper.log
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installinit
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ if [ ! -f /var/run/oppd.pid ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postinst
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postrm
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postrm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/postrm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postrm script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge|remove|upgrade)
+ if [ ! -a /var/run/oppd.pid ] && [ -a /etc/init.d/oppd ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+ failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/preinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/preinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/preinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+
+ install|upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/prerm
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/prerm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/prerm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,46 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/rules
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/rules
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/rules
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,88 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+
+build-stamp:
+ dh_testdir
+
+ # Add here commands to compile the package.
+ #docbook-to-man debian/perfsonar-oppd.sgml > perfsonar-oppd.1
+ $(PERL) Build.PL --install_path etc=$(DESTDIR)/etc --install_path
bin=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
script=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
lib=$(DESTDIR)/usr/lib/perfsonar/services/oppd/lib --install_path
bindoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
libdoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
xmltemplates=$(DESTDIR)/usr/lib/perfsonar/services/oppd/etc/oppd
--install_path oppd_doc=$(DESTDIR)/usr/share/doc/perfsonar-oppd
+ $(PERL) Build
+ #$(PERL) Build test
+
+ touch $@
+
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ dh_clean build-stamp install-stamp
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/perfsonar-oppd.
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs Changes
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+ dh_installinit --restart-after-upgrade
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/etc/bwctl.conf
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/etc/bwctl.conf
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/etc/bwctl.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,45 @@
+#
+# BWCTL MP example configuration
+#
+
+<service MP/BWCTL>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::BWCTL # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "BWCTL Measurement Point"
+ description "Measurement Point for doing on-demand BWCTL tests"
+ keyword "project:mybwctl"
+
+ #
+ # Further parameters
+ #
+ metric "bandwidth"
+ # Measurement metric(s). More than one element definition possible.
+ tool "bwctl" # Tool name
+
+ #
+ # Module parameters
+ #
+ <module_param>
+
+ command "bwctl"
+ # Command to execute e.g. "/usr/bin/bwctl" or "/bin/bwctl".
+ # Omitting path searches $PATH.
+
+ #
+ # Store functionality
+ #
+ store off # Enable/disable store functionality
+ store_url "http://www.mySQL-MA:8090"
+ # URL of a MA service to sent the results of measurements to
+
+ </module_param>
+
+</service MP/BWCTL>
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/install
===================================================================
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/BWCTL.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/BWCTL.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,220 @@
+package perfSONAR::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use strict;
+use warnings;
+
+use IPC::Run qw( run timeout start finish pump);
+use IO::Pty;
+
+use perfSONAR qw( print_log);
+
+#DEBUG
+use Data::Dumper;
+#DEBUG
+
+#TODO Error handling
+#composing of commandline and parsing of results of bwctl
+
+sub commandline {
+ my %parameters = @_;
+ my @commandline;
+ unless ($parameters{"src"} || $parameters{"dst"}) {
+ return "ERROR", "Neither source nor destination ip address specified.";
+ }
+ if (!$parameters{"src"} || !$parameters{"dst"}){ #find out end point
+ #my @result = `/sbin/ifconfig eth0`;
+ #grep(/^\s+\w+\s+\w+\:(\d+\.\d+\.\d+\.\d+)/, @result);
+ my $ip_result = `/sbin/ip addr show dev eth0 scope global primary`;
+ $ip_result =~ /\n\s+inet\s+(\d+\.\d+\.\d+\.\d+)/;
+ my $local_ip = $1;
+ unless ($local_ip) {
+ return "ERROR", "Cannot determine local ip address.";
+ }
+ $parameters{"src"} = $local_ip unless $parameters{"src"};
+ $parameters{"dst"} = $local_ip unless $parameters{"dst"};
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Measurement requested " .
+ "using same local IP address as source and destination.";
+ }
+ }
+ if ($parameters{"src"} eq $parameters{"dst"}) {
+ return "ERROR", "Source ip address equal to destination ip address.";
+ }
+
+ #check parameters to be correct input:
+ foreach my $param (keys %parameters){
+ next if ($param eq "param_ns_prefix" ||
+ $param eq "metaID" ||
+ $param eq "subject_ns_prefix" ||
+ $param eq "parameter_ID" ||
+ $param eq "param_ns_uri" ||
+ $param eq "subject_ns_uri");
+
+ next if ($param eq "src" || $param eq "dst");
+ if ($param eq "login" || $param eq "password"){
+ unless ($parameters{$param} =~ /^\w+$/){
+ return "ERROR", "Invalid login/password string specified.";
+ }
+ next;
+ }
+ if ($param eq "TOS"){
+ unless ($parameters{$param} =~ /^\d+|0x\d+$/){
+ return "ERROR", "Invalid TOS string specified.";
+ }
+ next;
+ }
+ if ($param eq "protocol"){
+ unless ($parameters{$param} =~ /^udp$/i || $parameters{$param} =~
/^tcp$/i){
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+ next;
+ }
+ unless ($parameters{$param} =~ /^\d+$/){
+ return "ERROR", "Invalid value specified for $param.";
+ }
+
+ }
+
+ push @commandline , "-s" , $parameters{"src"};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+ push @commandline , "-c", $parameters{dst};
+ push @commandline , "AE", "AESKEY" if($parameters{"login"});
+ push @commandline , $parameters{login} if($parameters{"login"});
+
+
+ push @commandline , "-i", $parameters{interval}
if($parameters{"interval"});
+ push @commandline , "-t", $parameters{duration}
if($parameters{"duration"});
+ push @commandline , "-w", $parameters{windowSize}
if($parameters{"windowSize"});
+
+=cut obsolete
+ if (! $parameters{"protocol"}) {
+ # We assume default for undef, "" and 0
+ # => Do nothing
+ } elsif ($parameters{"protocol"} =~ /^udp$/i) {
+ push @commandline , "-u";
+ } elsif ($parameters{"protocol"} =~ /^tcp$/i) {
+ # tcp is default
+ } else {
+ return "ERROR", "Unknown protocol: $parameters{protocol}";
+ }
+=cut
+
+ push @commandline , "-u" if ($parameters{"protocol"} &&
$parameters{"protocol"} =~ /^udp$/i);
+ push @commandline , "-l", $parameters{bufferSize}
if($parameters{"bufferSize"});
+ push @commandline , "-b", $parameters{bandwidth}
if($parameters{"bandwidth"});
+ push @commandline , "-S", $parameters{TOS} if($parameters{"TOS"});
+ return @commandline;
+}
+
+sub do_bwctl {
+ my $tool = shift;
+ my $pass = shift;
+ my @bwctl = @_;
+
+ print_log ("info", "do_bwctl called with $tool\n");
+ my ($in, $out, $err);
+ unshift @bwctl, $tool;
+
+ if(!$pass){
+ my $command = join (" ", @bwctl);
+ my $out=`$command 2>&1`;
+ return $out;
+ }
+ my $h = start
(\@bwctl,
'<pty<', \$in, '>pty>', \$out, '2>', \$err);
+ while (1){
+ pump $h;
+ if ($err =~ /passphrase/){
+ $in = "$pass\n" ;
+ $err = "";
+ }
+ elsif ($err ne "\n"){
+ last;
+ }
+ }
+
+ my $out_tmp = $out;
+ my $err_tmp = $err;
+
+ finish $h;
+ if (!$out){
+ return "$err_tmp" . "$err";
+ }
+ return "$out_tmp" . "$out";
+
+}
+sub parse_result {
+ my $time = shift;
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my @datalines;
+
+ foreach my $resultline (@result){
+ next unless ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+
+ my %data_hash;
+ $data_hash{"timeType"} = "unix";
+ $data_hash{"timeValue"} = $time;
+ $data_hash{"interval"} = $1;
+ $data_hash{"numBytes"} = $2;
+ $data_hash{"numBytesUnits"} = $3;
+ $data_hash{"value"} = $4;
+ $data_hash{"valueUnits"} = $5;
+ push @datalines, \%data_hash;
+
+ }
+ if($#datalines < 0){
+ #no data -> something wrong, write result as error description:
+ $datalines[0]="BWCTL Error:";
+ foreach my $resultline (@result){
+ push @datalines, $resultline;
+ }
+ }
+
+ return @datalines;
+}
+
+
+sub parse_header {
+ my $result = shift;
+ my @result = split(/\n/, $result);
+ my %header;
+
+ foreach my $resultline (@result){
+ next if ($resultline =~
+
/(\d+\.\d+\s*\-\s*\d+\.\d+)\s+sec\s+(\d+\.?\d*)\s+(\w+)\s+(\d+\.?\d*)\s+(\w+\/\w+)/);
+ #print "header: $resultline\n";
+ if ($resultline =~ /TCP/){
+ $header{"proto"} = "TCP";
+ }
+ if ($resultline =~ /UDP/){
+ $header{"proto"} = "UDP";
+ }
+ if ($resultline =~ /TCP window size:\s*(\d+)\s*(\w+)/){
+ $header{"windowsize"} = $1; #$2 is always "Byte"
+ }
+ if ($resultline =~ /-t\s*(\d+)/){
+ $header{"duration"} = $1;
+ }
+ }
+ return %header;
+}
+
+1;
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/MP/BWCTL.pm
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/MP/BWCTL.pm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/lib/perfSONAR/MP/BWCTL.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,277 @@
+package perfSONAR::MP::BWCTL;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::BWCTL;
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0/";
+
+sub new {
+ my $this = shift;
+
+ my $self = perfSONAR::MP->new (@_);
+ push @{$self->{"supportedEventtypes"}},
+
+ ("bwctl",
+ "http://ggf.org/ns/nmwg/tools/bwctl/2.0/",
+ "http://ggf.org/ns/nmwg/tools/iperf/2.0/");
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ interval => 1,
+ duration => 1,
+ windowSize => 1,
+ protocol => 1,
+ bufferSize => 1,
+ bandwidth => 1,
+ login => 1,
+ password => 1,
+ TOS => 1,
+ };
+
+ $self->{"unsupported_parameters"} = {
+
+ advisoryWindowsize => 1,
+ scheduleInterval => 1,
+ numberOfTests => 1,
+ latest => 1,
+ alpha => 1,
+ };
+
+ bless $self, qw(perfSONAR::MP::BWCTL);
+ return $self;
+}
+
+sub parse_key {
+
+ my $self = shift;
+ my %parameters = shift;
+ my %key = split (',', $parameters{"metadatakey"});
+ $parameters{"src"} = $key{"src"}{"value"} if $key{"src"}{"value"};
+ $parameters{"dst"} = $key{"dst"}{"value"} if $key{"dst"}{"value"};
+ $parameters{"interval"} = $key{"int"} if $key{"int"};
+ $parameters{"duration"} = $key{"dur"} if $key{"dur"};
+ $parameters{"windowSize"} = $key{"win"} if $key{"win"};
+ $parameters{"protocol"} = $key{"pro"} if $key{"pro"};
+ $parameters{"bufferSize"} = $key{"buf"} if $key{"buf"};
+ $parameters{"bandwidth"} = $key{"ban"} if $key{"ban"};
+ $parameters{"TOS"} = $key{"tos"} if $key{"tos"};
+}
+
+
+sub selftest {
+ my $self = shift;
+ return {
+ bwctl_command_test => \&bwctl_command_test,
+ bwctl_exec_test => \&bwctl_exec_test,
+ bwctld_running_test => \&bwctld_running_test,
+ ntpd_running_test => \&ntpd_running_test,
+ };
+}
+
+
+sub bwctl_command_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!(-e "$commandpath")){
+ $message = "BWCTL tool $command not found!";
+ #die "BWCTL tool $commandpath not found!\n";
+ } else {
+ $message = "BWCTL tool $command found ";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctl_exec_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my $command = $self->{"command"};
+ my $commandpath = `which $command`;
+ chomp ($commandpath);
+ if (!( -x "$commandpath")){
+ $message = "BWCTL tool $command not executable!";
+ #die "No executable $commandpath found!\n";
+ } else {
+ $message = "BWCTL tool $command executable.";
+ $status = "success";
+ }
+ return ($message, $status);
+}
+
+sub bwctld_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep bwctld`;
+ my $bwctld = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $bwctld = 1;
+ }
+ if ($bwctld){
+ $message = "bwctld running.";
+ $status = "success";
+ } else {
+ $message = "bwctld not running! ";
+ $self->print_log_id ("warning", "bwctld not running!");
+ }
+ return ($message, $status);
+}
+
+sub ntpd_running_test{
+ my $self = shift;
+ my $message;
+ my $status = "error";
+ my @ps_output = `ps auxw |grep ntpd`;
+ my $ntpd = undef;
+ while (my $elem = pop @ps_output){
+ next if $elem =~ /grep/;
+ $ntpd = 1;
+ }
+ if ($ntpd){
+ $message = "ntpd running.";
+ $status = "success";
+ } else {
+ $message .= "ntpd not running!";
+ $self->print_log_id ("warning", "ntpd not running!");
+ }
+ return ($message, $status);
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+ my $ns = "http://ggf.org/ns/nmwg/tools/iperf/2.0/";
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests
+ my @tests = ("bwctl_command_test",
+ "bwctl_exec_test",
+ "bwctld_running_test",
+ "ntpd_running_test");
+ foreach my $test (@tests){
+ $self->print_log_id("debug", "Perform test: $test");
+ my ($message, $status) = $self->$test;
+ my $et =
"http://schemas.perfsonar.net/tools/admin/selftest/MP/BWCTL/$test/$status/1.0";
+ $msg->return_result_code(
+ $et, $message, $msg->{"dataIDs"}{$dataid}{"metaref"}, $test);
+ }
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ my %data_hash;
+ my $key;
+ $key .= "src,$parameters{src}" if $parameters{"src"};
+ $key .= ",dst,$parameters{dst}" if $parameters{"dst"};
+ $key .= ",int,$parameters{interval}" if $parameters{"interval"};
+ $key .= ",dur,$parameters{duration}" if $parameters{"duration"};
+ $key .= ",win,$parameters{windowSize}" if $parameters{"windowSize"};
+ $key .= ",pro,$parameters{protocol}" if $parameters{"protocol"};
+ $key .= ",buf,$parameters{bufferSize}" if $parameters{"bufferSize"};
+ $key .= ",ban,$parameters{bandwidth}" if $parameters{"bandwidth"};
+ $key .= ",tos,$parameters{TOS}" if $parameters{"TOS"};
+
+ $data_hash{"MetadataKey"} = "$key";
+ push @datalines, \%data_hash;
+ $msg->set_data($dataid, @datalines);
+ return 1;
+ }
+
+ my $unixtime = time;
+ my @commandline = perfSONAR::BWCTL::commandline(%parameters);
+ if ($commandline[0] eq "ERROR") {
+ return $msg->return_result_code("error.mp.bwctl", $commandline[1],
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+ $self->print_log_id("info", "BWCTL commandline: @commandline");
+ my @result = perfSONAR::BWCTL::do_bwctl($self->{"command"},
$parameters{"password"}, @commandline);
+ @datalines = perfSONAR::BWCTL::parse_result($unixtime, @result);
+ if ($datalines[0] eq "BWCTL Error:"){
+ my $errorstring = join(" ", @datalines);
+ $errorstring =~ s/usage.*$//;
+ return $msg->return_result_code("error.mp.bwctl", $errorstring,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ $msg->set_data_ns ($dataid, $ns, @datalines);
+
+=cut
+ my $datanode = $msg->{"dataIDs"}{$dataid}{"node"};
+ my $timenode = $msg->add_attribute(parent => $datanode, nodename =>
"commonTime",
+ type => "unix", value => $unixtime);
+ foreach my $data_hash (@datalines){
+
+ $msg->add_attribute(parent => $timenode, nodename => "datum",
+ namespace => $ns, %{$data_hash});
+ }
+=cut
+
+ if ($self->{"store"} == 1){
+ $self->store($msg);
+ }
+
+
+ return 1;
+
+}
+
+1;
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/00-load.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/00-load.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/00-load.t 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,12 @@
+#!perl -T
+
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'perfSONAR::MP::BWCTL' );
+}
+
+diag( "Testing perfSONAR::MP::BWCTL $perfSONAR::MP::BWCTL::VERSION, Perl $],
$^X" );
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-BWCTL-001.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-BWCTL-001.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-BWCTL-001.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,119 @@
+use strict;
+use warnings;
+use Test::More tests => 10;
+use Data::Dumper;
+
+#TODO
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+
+#1-4
+BEGIN {
+ # Third party modules:
+ use_ok('IPC::Run');
+ use_ok('IO::Pty');
+ # Additional modules (should be tested before!):
+ use_ok('perfSONAR');
+ # Module to test:
+ use_ok('perfSONAR::BWCTL');
+}
+
+# List of class methods:
+#
+# commandline
+# do_bwctl
+# parse_result
+# parse_header
+
+
+my %parameters;
+$parameters{'duration'} = '5';
+$parameters{'protocol'} = 'tcp';
+$parameters{'src'} = '131.188.81.12';
+$parameters{'interval'} = '2';
+$parameters{'dst'} = '131.188.81.90';
+
+#5
+ok (
+ perfSONAR::BWCTL::commandline (%parameters),
+ "create commandline array."
+);
+
+my $result = <<__EORESULT__;
+RECEIVER START
+3445066714.259160: iperf -B 131.188.81.90 -P 1 -s -f b -m -p 5001 -t 10 -i 2
+------------------------------------------------------------
+Server listening on TCP port 5001
+Binding to local address 131.188.81.90
+TCP window size: 87380 Byte (default)
+------------------------------------------------------------
+[ 12] local 131.188.81.90 port 5001 connected with 131.188.81.12 port 5001
+[ ID] Interval Transfer Bandwidth
+[ 12] 0.0- 2.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 2.0- 4.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 4.0- 6.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 6.0- 8.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 8.0-10.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 0.0-10.1 sec 118636544 Bytes 93743497 bits/sec
+[ 12] MSS size 1448 bytes (MTU 1500 bytes, ethernet)
+RECEIVER END"
+__EORESULT__
+
+#6
+ok (
+ my @lines = perfSONAR::BWCTL::parse_result ("1236078182", $result),
+ "parsing result."
+);
+
+#7
+isa_ok (
+
\@lines,
'ARRAY'
+);
+
+#8
+ok (
+ perfSONAR::BWCTL::parse_header ($result),
+ "parsing header."
+);
+
+my $result_broken = <<__EORESULT__;
+RECEIVER START
+3445066714.259160: ip1.188.81.90 -P 1 -s -f b -m -p 5001 -t 10 -i 2
+------------------------------------------------------------
+Server listening on TCP port 5001
+Bcal address 131.188.81.90
+TCP window size: 87380 Byte (default)
+------------------------------------------------------------
+[ 12] local 131.188.81.90 port 5001 connected with 131.188.81.12 port 5001
+[ ID] Interval Transfer Bandwidth
+[ 12] 0.0- 2.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 2.0- 4.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transfer Bandwidth
+[ 12] 4.0- 6.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Intervafer Bandwidth
+[ 12] 6.0- 8.0 sec 0.00 Bytes 0.00 bits/sec
+[ ID] Interval Transth
+[ 12] 8.0-10.0 sec 0.00 Bytes 0.00 bit[ ID] Interval Transfer
Bandwidth
+[ 12] 0.0-10.1 sec 118636544 Bytes 93743497 bits/sec
+[ 12] MSS size 1448 bytes (MTU 1500 bytes, ethernet)
+RECEIVER END"
+__EORESULT__
+
+#9
+ok (
+ perfSONAR::BWCTL::parse_result ("1236078182", $result_broken),
+ "parsing result."
+);
+
+#10
+ok (
+ perfSONAR::BWCTL::parse_header ($result_broken),
+ "parsing header."
+);
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-001.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-001.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-001.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,113 @@
+use strict;
+use warnings;
+use Test::More tests => 8;
+use Data::Dumper;
+
+#TODO
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+
+#1-5
+BEGIN {
+ # Third party modules:
+ use_ok('Carp');
+ # Additional modules (should be tested before!):
+ use_ok('NMWG');
+ use_ok('NMWG::Message');
+ use_ok('perfSONAR');
+ # Module to test:
+ use_ok('perfSONAR::MP');
+}
+
+# List of class methods:
+#
+# new [x]
+# open_request (empty)
+# close_request (empty)
+# set_command (obsolete)
+# selftest (undef)
+# start_action (empty)
+# store
+# get_parameters
+# check_parameters
+# print_log_id [x]
+
+#6
+ok (
+ my $mp_empty = perfSONAR::MP->new (),
+ "create empty perfSONAR::MP object."
+);
+
+#7
+ok (
+ my $mp_object = perfSONAR::MP->new (
+ command => "bwctl",
+ store => 1,
+ store_url => "http://somewhere",
+ ),
+ "create perfSONAR::MP object with parameters set."
+);
+
+#8
+$mp_object->{"service_id"} = "blub";
+ok (
+ $mp_object->print_log_id ("info", "Test message."),
+ "print log message."
+);
+
+my $content = <<__EOCONTENT__;
+<?xml version="1.0" encoding="UTF-8"?>
+
+<nmwg:message type="SetupDataRequest"
+ id="bwctl-request"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmtm="http://ggf.org/ns/nmwg/time/2.0/"
+ xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/"
+ xmlns:bwctl="http://ggf.org/ns/nmwg/tools/bwctl/2.0/"
+ xmlns:iperf="http://ggf.org/ns/nmwg/tools/iperf/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/">
+
+ <nmwg:metadata id="bwctl-metadata">
+ <bwctl:subject id="bwctl-subject">
+ <nmwgt:endPoint type="ipv4" value="131.188.81.12"/>
+ </bwctl:subject>
+
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/bwctl/2.0</nmwg:eventType>
+ <bwctl:parameters id="bwctl-parameters">
+ <nmwg:parameter name="duration" value="5"/>
+ </bwctl:parameters>
+ </nmwg:metadata>
+
+ <nmwg:metadata id="iperf-metadata">
+ <iperf:subject id="iperf-subject" metadataIdRef="bwctl-metadata">
+ <nmwgt:endPointPair>
+ <nmwgt:src type="ipv4" value="131.188.81.12"/>
+ <nmwgt:dst type="ipv4" value="131.188.81.90"/>
+ </nmwgt:endPointPair>
+ </iperf:subject>
+ <iperf:parameters id="iperf-parameters">
+ <nmwg:parameter name="interval" value="2"/>
+ <nmwg:parameter name="protocol" value="tcp"/>
+ </iperf:parameters>
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/iperf/2.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <!-- triggers to indicate head of chains -->
+ <nmwg:data id="1" metadataIdRef="iperf-metadata"/>
+
+
+</nmwg:message>
+__EOCONTENT__
+
+
+
+
+my $msg = NMWG::Message->new ($content);
+
+#9
+#ok (
+# $mp_object->store($msg),
+# "store message."
+#);
Added:
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-BWCTL-001.t
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-BWCTL-001.t
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-bwctl-0.51/t/perfSONAR-MP-BWCTL-001.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,151 @@
+use strict;
+use warnings;
+use Test::More tests => 11;
+use Data::Dumper;
+
+#TODO
+use FindBin;
+use lib "$FindBin::RealBin/../lib";
+
+
+#1-4
+BEGIN {
+ # Third party modules:
+ use_ok('Carp');
+ # Additional modules (should be tested before!):
+ use_ok('perfSONAR::MP');
+ use_ok('perfSONAR::BWCTL');
+ # Module to test:
+ use_ok('perfSONAR::MP::BWCTL');
+}
+
+# List of class methods:
+#
+# new [x]
+# parse_key
+# selftest [x]
+# bwctl_command_test [x]
+# bwctl_exec_test [x]
+# bwctld_running_test [x]
+# ntpd_running_test [x]
+# start_action
+
+#5
+ok (
+ my $mp_empty = perfSONAR::MP::BWCTL->new (),
+ "create empty perfSONAR::MP::BWCTL object."
+);
+
+#6
+ok (
+ my $mp_object = perfSONAR::MP::BWCTL->new (
+ command => "bwctl",
+ store => 1,
+ store_url => "http://somewhere",
+ ),
+ "create perfSONAR::MP::BWCTL object with parameters set."
+);
+
+
+#7
+ok (
+ $mp_object->bwctl_command_test (),
+ "self test command."
+);
+
+#8
+ok (
+ $mp_object->bwctl_exec_test (),
+ "self test exec."
+);
+
+
+#9
+ok (
+ $mp_object->bwctld_running_test (),
+ "self test bwctld."
+);
+
+
+#10
+ok (
+ $mp_object->ntpd_running_test (),
+ "self test ntpd."
+);
+
+#11
+ok (
+ $mp_object->selftest (),
+ "complete selftest suite."
+);
+
+#foo
+my $content = <<__EOCONTENT__;
+<?xml version="1.0" encoding="UTF-8"?>
+
+<nmwg:message type="SetupDataRequest"
+ id="bwctl-request"
+ xmlns="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/"
+ xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
+ xmlns:nmtm="http://ggf.org/ns/nmwg/time/2.0/"
+ xmlns:select="http://ggf.org/ns/nmwg/ops/select/2.0/"
+ xmlns:bwctl="http://ggf.org/ns/nmwg/tools/bwctl/2.0/"
+ xmlns:iperf="http://ggf.org/ns/nmwg/tools/iperf/2.0/"
+ xmlns:nmwgt="http://ggf.org/ns/nmwg/topology/2.0/">
+
+ <nmwg:metadata id="bwctl-metadata">
+ <bwctl:subject id="bwctl-subject">
+ <nmwgt:endPoint type="ipv4" value="131.188.81.12"/>
+ </bwctl:subject>
+
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/bwctl/2.0</nmwg:eventType>
+ <bwctl:parameters id="bwctl-parameters">
+ <nmwg:parameter name="duration" value="5"/>
+ </bwctl:parameters>
+ </nmwg:metadata>
+
+ <nmwg:metadata id="iperf-metadata">
+ <iperf:subject id="iperf-subject" metadataIdRef="bwctl-metadata">
+ <nmwgt:endPointPair>
+ <nmwgt:src type="ipv4" value="131.188.81.12"/>
+ <nmwgt:dst type="ipv4" value="131.188.81.90"/>
+ </nmwgt:endPointPair>
+ </iperf:subject>
+ <iperf:parameters id="iperf-parameters">
+ <nmwg:parameter name="interval" value="2"/>
+ <nmwg:parameter name="protocol" value="tcp"/>
+ </iperf:parameters>
+ <nmwg:eventType>http://ggf.org/ns/nmwg/tools/iperf/2.0</nmwg:eventType>
+ </nmwg:metadata>
+
+ <!-- triggers to indicate head of chains -->
+ <nmwg:data id="1" metadataIdRef="iperf-metadata"/>
+
+
+</nmwg:message>
+__EOCONTENT__
+
+
+
+
+my $msg = NMWG::Message->new ($content);
+
+my %parameters;
+$parameters{'param_ns_prefix'} = 'bwctl';
+$parameters{'subject_ns_prefix'} = 'bwctl';
+$parameters{'metaID'} = 'bwctl-metadata';
+$parameters{'parameter_ID'} = 'bwctl-parameters';
+$parameters{'param_ns_uri'} = 'http://ggf.org/ns/nmwg/tools/bwctl/2.0/';
+$parameters{'subject_ns_uri'} = 'http://ggf.org/ns/nmwg/tools/bwctl/2.0/';
+$parameters{'duration'} = '5';
+$parameters{'param_ns_prefix'} = 'iperf';
+$parameters{'protocol'} = 'tcp';
+$parameters{'subject_ns_prefix'} = 'iperf';
+$parameters{'metaID'} = 'iperf-metadata';
+$parameters{'parameter_ID'} = 'iperf-parameters';
+$parameters{'param_ns_uri'} = 'http://ggf.org/ns/nmwg/tools/iperf/2.0/';
+$parameters{'src'} = '131.188.81.12';
+$parameters{'subject_ns_uri'} = 'http://ggf.org/ns/nmwg/tools/iperf/2.0/';
+$parameters{'interval'} = '2';
+$parameters{'dst'} = '131.188.81.90';
+
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+Format: 1.0
+Source: perfsonar-oppd-mp-bwctl
+Binary: perfsonar-oppd-mp-bwctl
+Architecture: all
+Version: 0.52-0rc1
+Maintainer: DFN Labor
<>
+Homepage: http://www.win-labor.dfn.de
+Standards-Version: 3.7.3
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Checksums-Sha1:
+ 95d21c2958036a98cdc063700c517677dc69b7a5 11072
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
+Checksums-Sha256:
+ 37bef1225df38d7a95a91384a9544625bf8f7405a09c0b62ff5280f55f9a98c6 11072
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
+Files:
+ db57ba636e4805d1f0c9d3c297aef7d0 11072
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_i386.changes
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_i386.changes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-bwctl_0.52-0rc1_i386.changes
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,28 @@
+Format: 1.8
+Date: Tue, 20 Apr 2010 14:06:49 +0200
+Source: perfsonar-oppd-mp-bwctl
+Binary: perfsonar-oppd-mp-bwctl
+Architecture: source all
+Version: 0.52-0rc1
+Distribution: unstable
+Urgency: low
+Maintainer: DFN Labor
<>
+Changed-By: DFN Labor
<>
+Description:
+ perfsonar-oppd-mp-bwctl - perfSONAR::MP::BWCTL Perl module, plugin for oppd
+Changes:
+ perfsonar-oppd-mp-bwctl (0.52-0rc1) unstable; urgency=low
+ .
+ * Initial release
+Checksums-Sha1:
+ 1f1cad6f8c38e330c1dac539b069376c633c1811 598
perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
+ 95d21c2958036a98cdc063700c517677dc69b7a5 11072
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
+ 65b48b820b6655cc0eb946a9d9737ef3cc55642a 7484
perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
+Checksums-Sha256:
+ f1c550a5d7d3fb08a06180e1406e92880003837c9da30f4c59792ea5b267ec8b 598
perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
+ 37bef1225df38d7a95a91384a9544625bf8f7405a09c0b62ff5280f55f9a98c6 11072
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
+ db16d5fd261180759a7d97721c00e57b5e3ac4c8eab32022d0e62e4aa12469b1 7484
perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
+Files:
+ 367fc26965246f7dde42588bc7be723b 598 net extra
perfsonar-oppd-mp-bwctl_0.52-0rc1.dsc
+ db57ba636e4805d1f0c9d3c297aef7d0 11072 net extra
perfsonar-oppd-mp-bwctl_0.52-0rc1.tar.gz
+ cd9ced76050fb71d1c214ab2cfb12ce9 7484 net extra
perfsonar-oppd-mp-bwctl_0.52-0rc1_all.deb
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,57 @@
+#! /usr/bin/perl
+
+use strict;
+use Cwd;
+use File::Basename;
+use File::Spec;
+
+sub magic_number_matches {
+ return 0 unless -e '_build/magicnum';
+ local *FH;
+ open FH, '_build/magicnum' or return 0;
+ my $filenum = <FH>;
+ close FH;
+ return $filenum == 308035;
+}
+
+my $progname;
+my $orig_dir;
+BEGIN {
+ $^W = 1; # Use warnings
+ $progname = basename($0);
+ $orig_dir = Cwd::cwd();
+ my $base_dir =
'/home/unrz217/oppd/build/debian/perfsonar-oppd-mp-generic-0.51';
+ if (!magic_number_matches()) {
+ unless (chdir($base_dir)) {
+ die ("Couldn't chdir($base_dir), aborting\n");
+ }
+ unless (magic_number_matches()) {
+ die ("Configuration seems to be out of date, please re-run 'perl
Build.PL' again.\n");
+ }
+ }
+ unshift @INC,
+ (
+
+ );
+}
+
+close(*DATA) unless eof(*DATA); # ensure no open handles to this script
+
+use Module::Build;
+
+# Some platforms have problems setting $^X in shebang contexts, fix it up
here
+$^X = Module::Build->find_perl_interpreter;
+
+if (-e 'Build.PL' and not Module::Build->up_to_date('Build.PL', $progname)) {
+ warn "Warning: Build.PL has been altered. You may need to run 'perl
Build.PL' again.\n";
+}
+
+# This should have just enough arguments to be able to bootstrap the rest.
+my $build = Module::Build->resume (
+ properties => {
+ config_dir => '_build',
+ orig_dir => $orig_dir,
+ },
+);
+
+$build->dispatch;
Property changes on: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Build.PL 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+ module_name => 'perfSONAR::MP::Generic',
+ dist_name => 'perfsonar-oppd-mp-generic',
+ license => 'apache',
+ dist_author => 'DFN-Labor
<>',
+ dist_version_from => 'lib/perfSONAR/MP/Generic.pm',
+ dist_abstract => 'Generic MP module for perl-perfSONAR',
+ build_requires => {
+ 'Test::More' => 0,
+ },
+ requires => {
+ #'perfSONAR' => 0.51,
+ },
+ etc_files => {
+ 'etc/generic.conf' => 'etc/oppd.d/oppd-generic.conf',
+ },
+ add_to_cleanup => [ 'perfSONAR-MP-Generic-*' ],
+ create_makefile_pl => 'small',
+);
+
+my $install_base = $builder->install_base();
+if ($install_base){
+ $builder->install_path('etc' => "$install_base/etc");
+}
+$builder->install_path('etc' => 'etc');
+$builder->add_build_element('etc');
+$builder->install_base_relpaths('lib' => 'lib');
+$builder->create_build_script();
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Changes
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Changes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Changes 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,3 @@
+Changelog for release 0.5
+
+ - inital Version of generic MP module for oppd
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/MANIFEST
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/MANIFEST
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/MANIFEST 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,9 @@
+Build.PL
+Changes
+etc/generic.conf
+lib/perfSONAR/MP/Generic.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/00-load.t
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/META.yml
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/META.yml
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/META.yml 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,19 @@
+---
+name: perfsonar-oppd-mp-generic
+version: 0.51
+author:
+ - 'DFN-Labor
<>'
+abstract: Generic MP module for perl-perfSONAR
+license: apache
+resources:
+ license: http://apache.org/licenses/LICENSE-2.0
+build_requires:
+ Test::More: 0
+provides:
+ perfSONAR::MP::Generic:
+ file: lib/perfSONAR/MP/Generic.pm
+ version: 0.51
+generated_by: Module::Build version 0.280801
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Makefile.PL
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Makefile.PL
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/Makefile.PL
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+# Note: this file was auto-generated by Module::Build::Compat version
0.2808_01
+ use Module::Build::Compat 0.02;
+
+ Module::Build::Compat->run_build_pl(args =>
\@ARGV);
+ require Module::Build;
+ Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/README
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/README
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/README 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,69 @@
+oppd-MP-Generic
+---------------
+
+Version 0.51
+
+The oppd Generic MP is a service plugin for oppd (open perl perfSONAR
daemon).
+It's purpose is to provide a generic perfSONAR interface to various tools.
+To use this module you need to install the oppd package first. The Generic
+MP module needs several perl modules (available via e.g. CPAN) in addition.
+
+For more information about perfSONAR, see www.perfsonar.net
+For more information about CPAN, see www.cpan.org
+
+1. Preparation:
+---------------
+
+Please install the oppd package first. Further perl modules needed are listed
+below:
+
+Perl modules dependency list:
+-----------------------------
+perl version 5.8.0 or higher
+perl(IO::Tty) >= 1.02
+perl(IPC::Run)
+perl(perfSONAR) >= 0.51
+
+
+2. Installation:
+----------------
+
+Change to oppd-mp-generic-0.51 directory and type the following commands:
+perl Build.PL --install_base=/usr/lib/perfsonar/services/oppd
+./Build install
+
+
+3. Run Generic MP:
+------------------
+
+To run the Generic MP, you should include the Generic MP service definition
+included in /usr/lib/perfsonar/services/oppd/etc/generic.conf to
/etc/oppd.conf.
+You can either include it by adding an include line to oppd.conf, or by
+attaching the contents of generic.conf to oppd.conf. When you have done
this,
+restart the oppd daemon.
+
+For start options and configuration file format please refer to the manual
+pages.
+
+4. Deinstallation:
+------------------
+
+First make sure that oppd.pl isn't running and stop it, if it is running.
Either
+delete the include line or the definition block for Generic MP from
+/etc/oppd.conf.
+
+You can now restart the oppd service, if you still have other perfSONAR
services
+provided by oppd other than the Generic MP.
+
+To delete BWCTL MP completely, remove the following files from your system:
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/Generic.pm
+
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008, 2009 DFN-Labor
+
+This program is released under the following license: bsd
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/auto_features
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/auto_features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/auto_features
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/build_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/build_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/build_params
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,277 @@
+do{ my $x = [
+ {
+ 'ARGV' => []
+ },
+ {},
+ {
+ 'verbose' => undef,
+ 'PL_files' => undef,
+ 'pollute' => undef,
+ 'bindoc_dirs' => [
+ 'blib/script'
+ ],
+ 'conflicts' => {},
+ 'recommends' => {},
+ 'scripts' => undef,
+ 'dist_version' => bless( {
+ 'original' => '0.51',
+ 'version' => [
+ 0,
+ 510
+ ]
+ }, 'Module::Build::Version' ),
+ 'pod_files' => undef,
+ 'config_dir' => '_build',
+ 'recurse_into' => [],
+ 'build_bat' => 0,
+ 'extra_linker_flags' => [],
+ 'build_class' => 'Module::Build',
+ 'prereq_action_types' => [
+ 'requires',
+ 'build_requires',
+ 'conflicts',
+ 'recommends'
+ ],
+ 'base_dir' =>
'/home/unrz217/oppd/build/debian/perfsonar-oppd-mp-generic-0.51',
+ 'allow_mb_mismatch' => 0,
+ 'xs_files' => undef,
+ 'destdir' => undef,
+ 'metafile' => 'META.yml',
+ 'mb_version' => '0.280801',
+ 'has_config_data' => undef,
+ 'dist_name' => 'perfsonar-oppd-mp-generic',
+ 'install_base' => undef,
+ 'module_name' => 'perfSONAR::MP::Generic',
+ 'recursive_test_files' => undef,
+ 'libdoc_dirs' => [
+ 'blib/lib',
+ 'blib/arch'
+ ],
+ 'perl' => '/usr/bin/perl',
+ 'dist_author' => [
+ 'DFN-Labor
<>'
+ ],
+ 'use_rcfile' => 1,
+ 'configure_requires' => {},
+ 'test_files' => undef,
+ 'dist_abstract' => 'Generic MP module for perl-perfSONAR',
+ 'create_readme' => undef,
+ 'prefix_relpaths' => {
+ 'core' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ },
+ 'site' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ 'site_perl',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5',
+ 'site_perl'
+ ]
+ },
+ 'vendor' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+ '5.10.0',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib',
+ 'perl5'
+ ]
+ }
+ },
+ 'meta_merge' => {},
+ 'get_options' => {},
+ 'dist_version_from' => 'lib/perfSONAR/MP/Generic.pm',
+ 'debugger' => undef,
+ 'html_css' => '',
+ 'build_elements' => [
+ 'PL',
+ 'support',
+ 'pm',
+ 'xs',
+ 'pod',
+ 'script',
+ 'etc'
+ ],
+ 'orig_dir' =>
'/home/unrz217/oppd/build/debian/perfsonar-oppd-mp-generic-0.51',
+ 'include_dirs' => [],
+ 'installdirs' => 'site',
+ 'create_makefile_pl' => 'small',
+ 'magic_number' => undef,
+ 'install_sets' => {
+ 'core' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl/5.10',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl/5.10'
+ },
+ 'site' => {
+ 'libdoc' => '/usr/local/man/man3',
+ 'script' => '/usr/local/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/local/man/man1',
+ 'bin' => '/usr/local/bin',
+ 'arch' =>
'/usr/local/lib/perl/5.10.0',
+ 'binhtml' => undef,
+ 'lib' =>
'/usr/local/share/perl/5.10.0'
+ },
+ 'vendor' => {
+ 'libdoc' => '/usr/share/man/man3',
+ 'script' => '/usr/bin',
+ 'libhtml' => undef,
+ 'bindoc' => '/usr/share/man/man1',
+ 'bin' => '/usr/bin',
+ 'arch' => '/usr/lib/perl5',
+ 'binhtml' => undef,
+ 'lib' => '/usr/share/perl5'
+ }
+ },
+ 'install_base_relpaths' => {
+ 'libdoc' => [
+ 'man',
+ 'man3'
+ ],
+ 'script' => [
+ 'bin'
+ ],
+ 'libhtml' => [
+ 'html'
+ ],
+ 'bindoc' => [
+ 'man',
+ 'man1'
+ ],
+ 'bin' => [
+ 'bin'
+ ],
+ 'arch' => [
+ 'lib',
+ 'perl5',
+
'i486-linux-gnu-thread-multi'
+ ],
+ 'binhtml' => [
+ 'html'
+ ],
+ 'lib' => [
+ 'lib'
+ ]
+ },
+ 'meta_add' => {},
+ 'create_packlist' => 1,
+ 'requires' => {},
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib',
+ 'etc' => 'etc'
+ },
+ 'etc_files' => {
+ 'etc/generic.conf' =>
'etc/oppd.d/oppd-generic.conf'
+ },
+ 'pm_files' => undef,
+ 'quiet' => undef,
+ 'extra_compiler_flags' => [],
+ 'script_files' => undef,
+ 'build_script' => 'Build',
+ 'original_prefix' => {
+ 'core' => '/usr',
+ 'site' => '/usr/local',
+ 'vendor' => '/usr'
+ },
+ 'c_source' => undef,
+ 'license' => 'apache',
+ 'autosplit' => undef,
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'config' => undef,
+ 'blib' => 'blib',
+ 'prefix' => undef
+ }
+ ];
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/cleanup
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/cleanup
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/cleanup
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,5 @@
+do{ my $x = {
+ 'perfSONAR-MP-Generic-*' => 1,
+ 'blib' => 1
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/config_data
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/config_data
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/config_data
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/features
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/features
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/features
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/magicnum
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/magicnum
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/magicnum
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+308035
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/notes
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/notes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/notes
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+do{ my $x = {};
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/prereqs
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/prereqs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/prereqs
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,9 @@
+do{ my $x = {
+ 'build_requires' => {
+ 'Test::More' => 0
+ },
+ 'conflicts' => {},
+ 'requires' => {},
+ 'recommends' => {}
+ };
+$x; }
\ No newline at end of file
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/runtime_params
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/runtime_params
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/_build/runtime_params
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+do{ my $x = {
+ 'create_packlist' => '0',
+ 'destdir' =>
'/home/unrz217/oppd/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic',
+ 'install_path' => {
+ 'script' =>
'/usr/lib/perfsonar/services/oppd/bin',
+ 'libdoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'bin' => '/usr/lib/perfsonar/services/oppd/bin',
+ 'bindoc' =>
'/usr/lib/perfsonar/services/oppd/man',
+ 'xmltemplates' =>
'/usr/lib/perfsonar/services/oppd/etc/oppd',
+ 'oppd_doc' => '/usr/share/doc/perfsonar-oppd',
+ 'lib' => '/usr/lib/perfsonar/services/oppd/lib',
+ 'etc' => '/etc'
+ }
+ };
+$x; }
\ No newline at end of file
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/oppd.d/oppd-generic.conf
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/oppd.d/oppd-generic.conf
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/etc/oppd.d/oppd-generic.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,27 @@
+#
+# Generic MP example configuration
+#
+
+<service MP/GENERIC>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::Generic # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "Generic Measurement Point"
+ description "Measurement Point for doing on-demand generic tests"
+ keyword "project:mygeneric"
+
+ #
+ # Further parameters
+ #
+ metric "none"
+ # Measurement metric(s). More than one element definition possible.
+ tool "all" # Tool name
+
+</service MP/GENERIC>
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/MP/Generic.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/MP/Generic.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/blib/lib/perfSONAR/MP/Generic.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,165 @@
+package perfSONAR::MP::Generic;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0";
+
+sub new {
+
+ my $self = perfSONAR::MP->new;
+ push @{$self->{"supportedEventtypes"}},
+ (
+ "http://ggf.org/ns/nmwg/tools/generic/2.0/",
+ );
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ command => 1,
+ commandline => 1,
+ };
+
+ $self->{"unsupported_parameters"} = undef;
+
+ bless $self, qw(perfSONAR::MP::Generic);
+ return $self;
+}
+
+sub selftest {
+ my $self = shift;
+ my $test = shift;
+ my $message = "perfSONAR Status: ";
+ if ($test eq "basic"){ #perform basic selftest
+ #$message .= `ps auxw |grep bwctld`;
+ $message .= "basic... ";
+ }
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+
+ my $ns = "http://ggf.org/ns/nmwg/tools/generic/2.0/";
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ #TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+
+ my $commandline = $parameters{"commandline"};
+ my $command = $parameters{"command"};
+
+ my $command_path = `which $command`;
+ if(!$command_path){
+
+ my @paths = ( "/bin/", "/usr/bin/", "/sbin/", "/usr/sbin/",
"/usr/local/bin/", "/usr/local/sbin/" );
+
+ foreach my $p (@paths){
+
+ my $c = `which $p$command`;
+ if ($c){
+ $command_path = $c;
+ last;
+ }
+ }
+ }
+ if(!$command_path){
+ return $msg->return_result_code("error.mp.generic", "$command not found
(maybe not in PATH?)", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ chomp ($command_path);
+
+ print "$command_path $commandline | sed 's/^/STDOUT:/'\n";
+
+ open (COMMAND, "($command_path $commandline | sed 's/^/STDOUT:/') 2>&1 |")
||
+ return $msg->return_result_code("error.mp.generic", "Could not perform
$command: $!", $msg->{"dataIDs"}{$dataid}{"metaref"});
+
+ while (<COMMAND>){ #read in output of command
+ my $line = $_;
+ chomp $line;
+ print "$line\n";
+ my %outputhash;
+ if (/^STDOUT:/){
+ $line =~ s/^STDOUT://;
+ $outputhash{"output"} = $line;
+ } else {
+ $outputhash{"error"} = $line;
+ }
+ push @datalines, \%outputhash;
+ }
+
+
+ if ($ns){
+ $msg->set_data_ns($dataid, $ns, @datalines);
+ } else{
+ $msg->set_data($dataid, @datalines);
+ }
+ return 1;
+
+}
+
+1;
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/build-stamp
===================================================================
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/README.Debian
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/README.Debian
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/README.Debian
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-generic for Debian
+------------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Hakan Calim
<>
Tue, 20 Apr 2010 15:06:53 +0200
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/changelog
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/changelog
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/changelog
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-generic (0.52-0rc1) unstable; urgency=low
+
+ * Initial release
+
+ -- DFN Labor
<>
Tue, 20 Apr 2010 15:06:53 +0200
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/compat
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/compat
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/compat
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+7
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/control
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/control
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,18 @@
+Source: perfsonar-oppd-mp-generic
+Section: net
+Priority: extra
+Maintainer: DFN Labor
<>
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Standards-Version: 3.7.3
+Homepage: http://www.win-labor.dfn.de
+
+Package: perfsonar-oppd-mp-generic
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: perfsonar-oppd
+Description: perfSONAR::MP::Generic Perl module, plugin for oppd
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/copyright
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/copyright
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/dirs
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/dirs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/dirs
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/docs
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/docs
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/docs
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+README
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/files
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/files
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/files
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+perfsonar-oppd-mp-generic_0.52-0rc1_all.deb net extra
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/conffiles
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/conffiles
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/conffiles
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1 @@
+/etc/oppd.d/oppd-generic.conf
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/control
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/control
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/control
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,14 @@
+Package: perfsonar-oppd-mp-generic
+Version: 0.52-0rc1
+Architecture: all
+Maintainer: DFN Labor
<>
+Installed-Size: 112
+Pre-Depends: perfsonar-oppd
+Section: net
+Priority: extra
+Homepage: http://www.win-labor.dfn.de
+Description: perfSONAR::MP::Generic Perl module, plugin for oppd
+ The README is used to introduce the module and provide instructions on how
+ to install the module, any machine dependencies it may have (for example C
+ compilers and installed libraries) and any other information that should be
+ provided before the module is installed.
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/md5sums
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/md5sums
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/md5sums
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+f2a2eba69a6e9ec23dec1090dbc4dee4
usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
+f3597d2153d9f28617c3dd12393f1c3d
usr/share/doc/perfsonar-oppd-mp-generic/copyright
+386d6e5194740ebfbfe3e71fe6a70fac
usr/share/doc/perfsonar-oppd-mp-generic/README.Debian
+8f5264faee78b935294e42519ddaf551
usr/share/doc/perfsonar-oppd-mp-generic/changelog.Debian.gz
+d6b18a11d08c39e53777165174525e85
usr/share/doc/perfsonar-oppd-mp-generic/changelog.gz
+19ca0c64f52ea0284c47ff25165ba958
usr/share/doc/perfsonar-oppd-mp-generic/README
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/postinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/postinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/postinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ if [ ! -f /var/run/oppd.pid ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/postinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/preinst
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/preinst
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/preinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+
+ install|upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/preinst
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/prerm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/prerm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/prerm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,46 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+
+
+exit 0
+
+
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/DEBIAN/prerm
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/oppd.d/oppd-generic.conf
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/oppd.d/oppd-generic.conf
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/etc/oppd.d/oppd-generic.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,27 @@
+#
+# Generic MP example configuration
+#
+
+<service MP/GENERIC>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::Generic # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "Generic Measurement Point"
+ description "Measurement Point for doing on-demand generic tests"
+ keyword "project:mygeneric"
+
+ #
+ # Further parameters
+ #
+ metric "none"
+ # Measurement metric(s). More than one element definition possible.
+ tool "all" # Tool name
+
+</service MP/GENERIC>
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,165 @@
+package perfSONAR::MP::Generic;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0";
+
+sub new {
+
+ my $self = perfSONAR::MP->new;
+ push @{$self->{"supportedEventtypes"}},
+ (
+ "http://ggf.org/ns/nmwg/tools/generic/2.0/",
+ );
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ command => 1,
+ commandline => 1,
+ };
+
+ $self->{"unsupported_parameters"} = undef;
+
+ bless $self, qw(perfSONAR::MP::Generic);
+ return $self;
+}
+
+sub selftest {
+ my $self = shift;
+ my $test = shift;
+ my $message = "perfSONAR Status: ";
+ if ($test eq "basic"){ #perform basic selftest
+ #$message .= `ps auxw |grep bwctld`;
+ $message .= "basic... ";
+ }
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+
+ my $ns = "http://ggf.org/ns/nmwg/tools/generic/2.0/";
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ #TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+
+ my $commandline = $parameters{"commandline"};
+ my $command = $parameters{"command"};
+
+ my $command_path = `which $command`;
+ if(!$command_path){
+
+ my @paths = ( "/bin/", "/usr/bin/", "/sbin/", "/usr/sbin/",
"/usr/local/bin/", "/usr/local/sbin/" );
+
+ foreach my $p (@paths){
+
+ my $c = `which $p$command`;
+ if ($c){
+ $command_path = $c;
+ last;
+ }
+ }
+ }
+ if(!$command_path){
+ return $msg->return_result_code("error.mp.generic", "$command not found
(maybe not in PATH?)", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ chomp ($command_path);
+
+ print "$command_path $commandline | sed 's/^/STDOUT:/'\n";
+
+ open (COMMAND, "($command_path $commandline | sed 's/^/STDOUT:/') 2>&1 |")
||
+ return $msg->return_result_code("error.mp.generic", "Could not perform
$command: $!", $msg->{"dataIDs"}{$dataid}{"metaref"});
+
+ while (<COMMAND>){ #read in output of command
+ my $line = $_;
+ chomp $line;
+ print "$line\n";
+ my %outputhash;
+ if (/^STDOUT:/){
+ $line =~ s/^STDOUT://;
+ $outputhash{"output"} = $line;
+ } else {
+ $outputhash{"error"} = $line;
+ }
+ push @datalines, \%outputhash;
+ }
+
+
+ if ($ns){
+ $msg->set_data_ns($dataid, $ns, @datalines);
+ } else{
+ $msg->set_data($dataid, @datalines);
+ }
+ return 1;
+
+}
+
+1;
+
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,69 @@
+oppd-MP-Generic
+---------------
+
+Version 0.51
+
+The oppd Generic MP is a service plugin for oppd (open perl perfSONAR
daemon).
+It's purpose is to provide a generic perfSONAR interface to various tools.
+To use this module you need to install the oppd package first. The Generic
+MP module needs several perl modules (available via e.g. CPAN) in addition.
+
+For more information about perfSONAR, see www.perfsonar.net
+For more information about CPAN, see www.cpan.org
+
+1. Preparation:
+---------------
+
+Please install the oppd package first. Further perl modules needed are listed
+below:
+
+Perl modules dependency list:
+-----------------------------
+perl version 5.8.0 or higher
+perl(IO::Tty) >= 1.02
+perl(IPC::Run)
+perl(perfSONAR) >= 0.51
+
+
+2. Installation:
+----------------
+
+Change to oppd-mp-generic-0.51 directory and type the following commands:
+perl Build.PL --install_base=/usr/lib/perfsonar/services/oppd
+./Build install
+
+
+3. Run Generic MP:
+------------------
+
+To run the Generic MP, you should include the Generic MP service definition
+included in /usr/lib/perfsonar/services/oppd/etc/generic.conf to
/etc/oppd.conf.
+You can either include it by adding an include line to oppd.conf, or by
+attaching the contents of generic.conf to oppd.conf. When you have done
this,
+restart the oppd daemon.
+
+For start options and configuration file format please refer to the manual
+pages.
+
+4. Deinstallation:
+------------------
+
+First make sure that oppd.pl isn't running and stop it, if it is running.
Either
+delete the include line or the definition block for Generic MP from
+/etc/oppd.conf.
+
+You can now restart the oppd service, if you still have other perfSONAR
services
+provided by oppd other than the Generic MP.
+
+To delete BWCTL MP completely, remove the following files from your system:
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/MP/Generic.pm
+rm -f /usr/lib/perfsonar/services/oppd/lib/perfSONAR/Generic.pm
+
+
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008, 2009 DFN-Labor
+
+This program is released under the following license: bsd
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README.Debian
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README.Debian
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/README.Debian
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,6 @@
+perfsonar-oppd-mp-generic for Debian
+------------------------------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Hakan Calim
<>
Tue, 20 Apr 2010 15:06:53 +0200
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.Debian.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.Debian.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.gz
===================================================================
(Binary files differ)
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/changelog.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/copyright
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/copyright
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic/usr/share/doc/perfsonar-oppd-mp-generic/copyright
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,15 @@
+
+ Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e. V.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.debhelper.log
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.debhelper.log
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.debhelper.log
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,16 @@
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_install
+dh_installinit
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.doc-base.EX
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.doc-base.EX
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/perfsonar-oppd-mp-generic.doc-base.EX
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,22 @@
+Document: perfsonar-oppd-mp-generic
+Title: Debian perfsonar-oppd-mp-generic Manual
+Author: <insert document author here>
+Abstract: This manual describes what perfsonar-oppd-mp-generic is
+ and how it can be used to
+ manage online manuals on Debian systems.
+Section: unknown
+
+Format: debiandoc-sgml
+Files:
/usr/share/doc/perfsonar-oppd-mp-generic/perfsonar-oppd-mp-generic.sgml.gz
+
+Format: postscript
+Files:
/usr/share/doc/perfsonar-oppd-mp-generic/perfsonar-oppd-mp-generic.ps.gz
+
+Format: text
+Files:
/usr/share/doc/perfsonar-oppd-mp-generic/perfsonar-oppd-mp-generic.text.gz
+
+Format: HTML
+Index: /usr/share/doc/perfsonar-oppd-mp-generic/html/index.html
+Files: /usr/share/doc/perfsonar-oppd-mp-generic/html/*.html
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/postinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/postinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/postinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# postinst script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ if [ ! -f /var/run/oppd.pid ]; then
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd start
+ else
+ /etc/init.d/oppd start
+ fi
+ fi
+ ;;
+
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/preinst
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/preinst
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/preinst
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# preinst script for perfsonar-oppd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+[ -f "/etc/default/oppd" ] && . /etc/default/oppd
+
+# most of the contents are copied from
+# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html
+
+case "$1" in
+
+ install|upgrade)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/prerm
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/prerm
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/prerm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,46 @@
+#!/bin/sh
+# prerm script for perfsonar-oppd-mp-bwctl
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ if which invoke-rc.d >/dev/null 2>&1; then
+ invoke-rc.d oppd stop
+ else
+ /etc/init.d/oppd stop
+ fi
+
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/rules
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/rules
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/rules
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,88 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+
+build-stamp:
+ dh_testdir
+
+ # Add here commands to compile the package.
+ #docbook-to-man debian/perfsonar-oppd.sgml > perfsonar-oppd.1
+ $(PERL) Build.PL --install_path etc=$(DESTDIR)/etc --install_path
bin=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
script=$(DESTDIR)/usr/lib/perfsonar/services/oppd/bin --install_path
lib=$(DESTDIR)/usr/lib/perfsonar/services/oppd/lib --install_path
bindoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
libdoc=$(DESTDIR)/usr/lib/perfsonar/services/oppd/man --install_path
xmltemplates=$(DESTDIR)/usr/lib/perfsonar/services/oppd/etc/oppd
--install_path oppd_doc=$(DESTDIR)/usr/share/doc/perfsonar-oppd
+ $(PERL) Build
+ #$(PERL) Build test
+
+ touch $@
+
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ dh_clean build-stamp install-stamp
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/perfsonar-oppd.
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs Changes
+ dh_installdocs
+ dh_installexamples
+ dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+ dh_installinit --restart-after-upgrade
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Property changes on:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/etc/generic.conf
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/etc/generic.conf
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/etc/generic.conf
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,27 @@
+#
+# Generic MP example configuration
+#
+
+<service MP/GENERIC>
+
+ #
+ # Necessary parameters for module initialisation
+ #
+ module MP::Generic # Name of module to load
+ servicetype MP # Service type: MP or MA
+
+ #
+ # Name, description, and keyword will be reported to Lookup Server
+ #
+ name "Generic Measurement Point"
+ description "Measurement Point for doing on-demand generic tests"
+ keyword "project:mygeneric"
+
+ #
+ # Further parameters
+ #
+ metric "none"
+ # Measurement metric(s). More than one element definition possible.
+ tool "all" # Tool name
+
+</service MP/GENERIC>
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/install
===================================================================
Added:
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/MP/Generic.pm
===================================================================
---
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/MP/Generic.pm
(rev 0)
+++
trunk/build/debian/perfsonar-oppd-mp-generic-0.51/lib/perfSONAR/MP/Generic.pm
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,165 @@
+package perfSONAR::MP::Generic;
+#
+# Copyright 2010 Verein zur Foerderung eines Deutschen Forschungsnetzes e.
V.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+use vars qw(@ISA);
+@ISA
= qw(perfSONAR::MP);
+
+#DEBUG
+use Data::Dumper;
+#/DEBUG
+
+use strict;
+use warnings;
+
+use Carp;
+
+use perfSONAR::MP;
+
+BEGIN {
+ use vars qw($VERSION);
+ $VERSION = 0.51;
+}
+
+my $ns_store = "http://ggf.org/ns/nmwg/ops/store/2.0";
+
+sub new {
+
+ my $self = perfSONAR::MP->new;
+ push @{$self->{"supportedEventtypes"}},
+ (
+ "http://ggf.org/ns/nmwg/tools/generic/2.0/",
+ );
+
+ $self->{"known_parameters"} = {
+
+ src => 1,
+ dst => 1,
+ command => 1,
+ commandline => 1,
+ };
+
+ $self->{"unsupported_parameters"} = undef;
+
+ bless $self, qw(perfSONAR::MP::Generic);
+ return $self;
+}
+
+sub selftest {
+ my $self = shift;
+ my $test = shift;
+ my $message = "perfSONAR Status: ";
+ if ($test eq "basic"){ #perform basic selftest
+ #$message .= `ps auxw |grep bwctld`;
+ $message .= "basic... ";
+ }
+}
+
+
+sub start_action {
+ my $self = shift;
+ my $msg = shift;
+ my $dataid = shift;
+ my $service_id = shift;
+
+ $self->{"service_id"} = shift;
+
+ my %parameters;
+
+ %parameters = $self->get_parameters($msg->{"dataIDs"}{$dataid});
+
+ my $error = $self->check_parameters(%parameters);
+
+ if ($error){
+ $self->print_log_id ("info", $error);
+ return $msg->return_result_code("error.mp.bwctl", $error,
$msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+
+ my $ns = "http://ggf.org/ns/nmwg/tools/generic/2.0/";
+
+ my @datalines;
+
+ my $messagetype = $msg->get_message_type();
+
+ if ($messagetype =~ /EchoResponse/){
+ #do selftests TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+ if ($messagetype eq "MetadataKeyResponse") {
+ #TODO
+ return $msg->return_result_code("error.mp.generic", "Action not
supported", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ return 1;
+ }
+
+
+ my $commandline = $parameters{"commandline"};
+ my $command = $parameters{"command"};
+
+ my $command_path = `which $command`;
+ if(!$command_path){
+
+ my @paths = ( "/bin/", "/usr/bin/", "/sbin/", "/usr/sbin/",
"/usr/local/bin/", "/usr/local/sbin/" );
+
+ foreach my $p (@paths){
+
+ my $c = `which $p$command`;
+ if ($c){
+ $command_path = $c;
+ last;
+ }
+ }
+ }
+ if(!$command_path){
+ return $msg->return_result_code("error.mp.generic", "$command not found
(maybe not in PATH?)", $msg->{"dataIDs"}{$dataid}{"metaref"});
+ }
+
+ chomp ($command_path);
+
+ print "$command_path $commandline | sed 's/^/STDOUT:/'\n";
+
+ open (COMMAND, "($command_path $commandline | sed 's/^/STDOUT:/') 2>&1 |")
||
+ return $msg->return_result_code("error.mp.generic", "Could not perform
$command: $!", $msg->{"dataIDs"}{$dataid}{"metaref"});
+
+ while (<COMMAND>){ #read in output of command
+ my $line = $_;
+ chomp $line;
+ print "$line\n";
+ my %outputhash;
+ if (/^STDOUT:/){
+ $line =~ s/^STDOUT://;
+ $outputhash{"output"} = $line;
+ } else {
+ $outputhash{"error"} = $line;
+ }
+ push @datalines, \%outputhash;
+ }
+
+
+ if ($ns){
+ $msg->set_data_ns($dataid, $ns, @datalines);
+ } else{
+ $msg->set_data($dataid, @datalines);
+ }
+ return 1;
+
+}
+
+1;
+
Added: trunk/build/debian/perfsonar-oppd-mp-generic-0.51/t/00-load.t
===================================================================
--- trunk/build/debian/perfsonar-oppd-mp-generic-0.51/t/00-load.t
(rev 0)
+++ trunk/build/debian/perfsonar-oppd-mp-generic-0.51/t/00-load.t
2010-07-30 06:18:44 UTC (rev 616)
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'perfSONAR::MP::Generic' );
+}
+
+diag( "Testing perfSONAR::MP::Generic $perfSONAR::MP::Generic::VERSION, Perl
$], $^X" );
Added: trunk/build/debian/perfsonar-oppd_0.52-0rc1.dsc
===================================================================
--- trunk/build/debian/perfsonar-oppd_0.52-0rc1.dsc
(rev 0)
+++ trunk/build/debian/perfsonar-oppd_0.52-0rc1.dsc 2010-07-30 06:18:44
UTC (rev 616)
@@ -0,0 +1,15 @@
+Format: 1.0
+Source: perfsonar-oppd
+Binary: perfsonar-oppd
+Architecture: all
+Version: 0.52-0rc1
+Maintainer: DFN Labor
<>
+Homepage: http://www.win-labor.dfn.de
+Standards-Version: 3.7.3
+Build-Depends: debhelper (>= 7), libmodule-build-perl
+Checksums-Sha1:
+ fde44fdad4dc346df9e549c837c57413d32209e1 95309
perfsonar-oppd_0.52-0rc1.tar.gz
+Checksums-Sha256:
+ c0c5ebd0f7ed1c4b7b07b55cc6ae4b600209810906d829ff926bb9aeb6377a86 95309
perfsonar-oppd_0.52-0rc1.tar.gz
+Files:
+ d8bc65e77ef3000f3737251f1d506cb1 95309 perfsonar-oppd_0.52-0rc1.tar.gz
Added: trunk/build/debian/perfsonar-oppd_0.52-0rc1.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/build/debian/perfsonar-oppd_0.52-0rc1.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/perfsonar-oppd_0.52-0rc1_all.deb
===================================================================
(Binary files differ)
Property changes on: trunk/build/debian/perfsonar-oppd_0.52-0rc1_all.deb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/build/debian/perfsonar-oppd_0.52-0rc1_i386.changes
===================================================================
--- trunk/build/debian/perfsonar-oppd_0.52-0rc1_i386.changes
(rev 0)
+++ trunk/build/debian/perfsonar-oppd_0.52-0rc1_i386.changes 2010-07-30
06:18:44 UTC (rev 616)
@@ -0,0 +1,29 @@
+Format: 1.8
+Date: Wed, 14 Apr 2010 09:23:27 +0200
+Source: perfsonar-oppd
+Binary: perfsonar-oppd
+Architecture: source all
+Version: 0.52-0rc1
+Distribution: unstable
+Urgency: low
+Maintainer: DFN Labor
<>
+Changed-By: DFN Labor
<>
+Description:
+ perfsonar-oppd - open PERL perfSONAR daemon
+Changes:
+ perfsonar-oppd (0.52-0rc1) unstable; urgency=low
+ .
+ * Conflict with old oppd packages resolved
+ * This is the first revision of oppd debian package
+Checksums-Sha1:
+ 22fc26d51217bfe4a221cf46444773e9f8af149b 553 perfsonar-oppd_0.52-0rc1.dsc
+ fde44fdad4dc346df9e549c837c57413d32209e1 95309
perfsonar-oppd_0.52-0rc1.tar.gz
+ 94b4e07ad9f53785194647ad6ba2bc4ffaf55aff 43262
perfsonar-oppd_0.52-0rc1_all.deb
+Checksums-Sha256:
+ 09ac60b4071f5bc745d585064ef0e50bf26009a18dc98905c4612d9af04ffdec 553
perfsonar-oppd_0.52-0rc1.dsc
+ c0c5ebd0f7ed1c4b7b07b55cc6ae4b600209810906d829ff926bb9aeb6377a86 95309
perfsonar-oppd_0.52-0rc1.tar.gz
+ 9ccfd76c4168bc6222a340341b08dc32171b98103e12aa0e34eb0773dac5cdf5 43262
perfsonar-oppd_0.52-0rc1_all.deb
+Files:
+ 5ec428d7e1126fd7f72f9ff6af8d2c2c 553 net extra perfsonar-oppd_0.52-0rc1.dsc
+ d8bc65e77ef3000f3737251f1d506cb1 95309 net extra
perfsonar-oppd_0.52-0rc1.tar.gz
+ 5e03f7e4bb3659d644448aee66e968d4 43262 net extra
perfsonar-oppd_0.52-0rc1_all.deb
- [pS-dev] [GEANT/SA2/SA2T3-OPPD] r616 - in trun k/build: . debian debian/NMWG-0.02 debian/NMWG-0.0 2/_build debian/NMWG-0.02/blib debian/NMWG-0.02/blib /lib debian/NMWG-0.02/blib/lib/NMWG debian/NMWG-0.02/b lib/libdoc debian/NMWG-0.02/debian debian/NMWG-0.02/de bian/libnmwg-perl debian/NMWG-0.02/debian/libnmwg-perl/D EBIAN debian/NMWG-0.02/debian/libnmwg-perl/usr debian/NM WG-0.02/debian/libnmwg-perl/usr/share debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/doc debian/NMWG-0.02/debi an/libnmwg-perl/usr/share/doc/libnmwg-perl debian/NMWG-0 .02/debian/libnmwg-perl/usr/share/man debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/man/man3 debian/NMWG-0.02 /debian/libnmwg-perl/usr/share/perl5 debian/NMWG-0.02/de bian/libnmwg-perl/usr/share/perl5/NMWG debian/NMWG-0.02/ lib debian/NMWG-0.02/lib/NMWG debian/NMWG-0.02/t debia n/perfsonar-oppd-0.51 debian/perfsonar-oppd-0.51/_bu ild debian/perfsonar-oppd-0.51/bin debian/perfsonar-oppd -0.51/blib debian/perfsonar-oppd-0.51/blib/bindoc debi an/perfsonar-oppd-0.51/blib/etc debian/perfsonar-oppd-0 .51/blib/etc/oppd.d debian/perfsonar-oppd-0.51/blib/ init debian/perfsonar-oppd-0.51/blib/init/default debian /perfsonar-oppd-0.51/blib/init/init.d debian/perfsonar -oppd-0.51/blib/lib debian/perfsonar-oppd-0.51/blib/li b/perfSONAR debian/perfsonar-oppd-0.51/blib/lib/perfSONA R/Client debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/S OAP debian/perfsonar-oppd-0.51/blib/lib/perfSONAR/SOAP/H TTP debian/perfsonar-oppd-0.51/blib/script debian/perfso nar-oppd-0.51/debian debian/perfsonar-oppd-0.51/debian /perfsonar-oppd debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/DEBIAN debian/perfsonar-oppd-0.51/debian/perfso nar-oppd/etc debian/perfsonar-oppd-0.51/debian/perfsonar -oppd/etc/default debian/perfsonar-oppd-0.51/debian/perf sonar-oppd/etc/init.d debian/perfsonar-oppd-0.51/debia n/perfsonar-oppd/etc/oppd.d debian/perfsonar-oppd-0.51 /debian/perfsonar-oppd/usr debian/perfsonar-oppd-0.51/de bian/perfsonar-oppd/usr/lib debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar debian/perfsonar-op pd-0.51/debian/p! erfsonar-oppd/usr/lib/perfsonar/servic es debian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/ lib/perfsonar/services/oppd debian/perfsonar-oppd-0.51/d ebian/perfsonar-oppd/usr/lib/perfsonar/services/oppd/bin d ebian/perfsonar-oppd-0.51/debian/perfsonar-oppd/usr/lib/, svn-noreply, 07/30/2010
Archive powered by MHonArc 2.6.16.