perfsonar-dev - perfsonar: r3078 - in trunk/geant2_java-sshtelnet-mp: ant conf conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters src/main/java/org/perfsonar/service/measurementPoint/remote/ssh src/main/java/org/perfsonar/service/measurementPoint/remote/telnet
Subject: perfsonar development work
List archive
perfsonar: r3078 - in trunk/geant2_java-sshtelnet-mp: ant conf conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters src/main/java/org/perfsonar/service/measurementPoint/remote/ssh src/main/java/org/perfsonar/service/measurementPoint/remote/telnet
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3078 - in trunk/geant2_java-sshtelnet-mp: ant conf conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters src/main/java/org/perfsonar/service/measurementPoint/remote/ssh src/main/java/org/perfsonar/service/measurementPoint/remote/telnet
- Date: Wed, 28 Nov 2007 05:15:49 -0500
Author: melis
Date: 2007-11-28 05:15:48 -0500 (Wed, 28 Nov 2007)
New Revision: 3078
Modified:
trunk/geant2_java-sshtelnet-mp/ant/configure-targets.xml
trunk/geant2_java-sshtelnet-mp/conf/components.properties
trunk/geant2_java-sshtelnet-mp/conf/juniperipcommands.txt
trunk/geant2_java-sshtelnet-mp/conf/log4j.properties
trunk/geant2_java-sshtelnet-mp/conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.class
trunk/geant2_java-sshtelnet-mp/conf/service.properties
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoKeyBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoSshBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperKeyBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperSshBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/QuaggaBgpAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption/PasswordEncryptor.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoSshStatusAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoStatusAdapter.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshKeyManager.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshManager.java
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/telnet/TelnetManager.java
Log:
Updating ongoing development
Modified: trunk/geant2_java-sshtelnet-mp/ant/configure-targets.xml
===================================================================
--- trunk/geant2_java-sshtelnet-mp/ant/configure-targets.xml 2007-11-27
11:51:18 UTC (rev 3077)
+++ trunk/geant2_java-sshtelnet-mp/ant/configure-targets.xml 2007-11-28
10:15:48 UTC (rev 3078)
@@ -61,6 +61,9 @@
<classpath>
<pathelement location="conf"/>
<pathelement path="${java.class.path}"/>
+ <fileset dir="./build">
+ <include name="*.jar"/>
+ </fileset>
</classpath>
<arg value="../conf/service.properties"/>
</java>
Modified: trunk/geant2_java-sshtelnet-mp/conf/components.properties
===================================================================
--- trunk/geant2_java-sshtelnet-mp/conf/components.properties 2007-11-27
11:51:18 UTC (rev 3077)
+++ trunk/geant2_java-sshtelnet-mp/conf/components.properties 2007-11-28
10:15:48 UTC (rev 3078)
@@ -3,16 +3,16 @@
#Configuration component - must be the first one!
-config=org.perfsonar.commons.auxiliary.components.configuration.properties.PropertiesConfigurationComponent
+config=org.perfsonar.base.auxiliary.components.configuration.properties.PropertiesConfigurationComponent
#Logger component - must be the second one!
-logger=org.perfsonar.commons.auxiliary.components.logger.log4j.Log4jLoggerComponent
+logger=org.perfsonar.base.auxiliary.components.logger.log4j.Log4jLoggerComponent
# Simple scheduler
-scheduler=org.perfsonar.commons.auxiliary.components.simplescheduler.Scheduler
+#scheduler=org.perfsonar.base.auxiliary.components.simplescheduler.Scheduler
# Registration in LS
-registrator=org.perfsonar.service.commons.registration.LSRegistrationComponent
+#registrator=org.perfsonar.service.measurementArchive.register.LSRegistrationComponent
# Authentication
authn=org.perfsonar.base.auxiliary.components.authn.wssec.WSSecAuthNComponent
Modified: trunk/geant2_java-sshtelnet-mp/conf/juniperipcommands.txt
===================================================================
--- trunk/geant2_java-sshtelnet-mp/conf/juniperipcommands.txt 2007-11-27
11:51:18 UTC (rev 3077)
+++ trunk/geant2_java-sshtelnet-mp/conf/juniperipcommands.txt 2007-11-28
10:15:48 UTC (rev 3078)
@@ -9,7 +9,7 @@
IP_RPF@@@show multicast rpf@@@1@@@1@@@cache@@@display RPF information for
<ip address>@@@<ip
address>@@@^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(\/[0-9]{1,2})?$
IP_SAP@@@show multicast sessions@@@0@@@0@@@cache@@@display the SAP
cache@@@---@@@---
IP_SAP_DETAIL@@@show multicast sessions detail@@@0@@@0@@@cache@@@displays
the SAP cache details@@@---@@@---
-IP_PING@@@ping@@@4@@@4@@@cache@@@ping an <ip address>@@@<ip address> count 5
rapid@@@^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(\/[0-9]{1,2})?
count 5 rapid$
+IP_PING@@@ping rapid count 5@@@4@@@4@@@cache@@@ping an <ip address>@@@<ip
address>@@@^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(\/[0-9]{1,2})?$
IP_TRACEROUTE@@@traceroute@@@1@@@1@@@cache@@@trace the IPv4 path to <ip
address>@@@<ip
address>@@@^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(\/[0-9]{1,2})?$
IP_TRACEROUTE_MULTICAST@@@mtrace@@@1@@@1@@@cache@@@trace the path of a
packet from the specified source interface to the receivers of the multicast
traffic@@@<ip
address>@@@^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(\/[0-9]{1,2})?$
IP_SHOW_VRF@@@show configuration routing-instance@@@1@@@1@@@cache@@@display
VPN Routing/Forwarding instance information@@@<routing-instance name>@@@---
Modified: trunk/geant2_java-sshtelnet-mp/conf/log4j.properties
===================================================================
--- trunk/geant2_java-sshtelnet-mp/conf/log4j.properties 2007-11-27
11:51:18 UTC (rev 3077)
+++ trunk/geant2_java-sshtelnet-mp/conf/log4j.properties 2007-11-28
10:15:48 UTC (rev 3078)
@@ -4,12 +4,12 @@
## author: romradz
-logDir=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs
+logDir=${service.home}/${deploy.root}/WEB-INF/logs
#ROOT
#log4j.appender.rootAppender.MaxBackupIndex=11
-#log4j.appender.rootAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar.log
+#log4j.appender.rootAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar.log
#log4j.appender.rootAppender.layout=org.apache.log4j.PatternLayout
#log4j.appender.rootAppender.layout.ConversionPattern=%d %5p - %m%n
#log4j.rootLogger=DEBUG, rootAppender
@@ -18,7 +18,7 @@
#DEBUG
log4j.appender.debugAppender.MaxBackupIndex=11
-log4j.appender.debugAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar_debug.log
+log4j.appender.debugAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar_debug.log
log4j.appender.debugAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.debugAppender.layout.ConversionPattern=%d %5p - %m%n
log4j.logger.sonar-debug=DEBUG, debugAppender
@@ -27,7 +27,7 @@
#INFO
log4j.appender.infoAppender.MaxBackupIndex=11
-log4j.appender.infoAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar_info.log
+log4j.appender.infoAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar_info.log
log4j.appender.infoAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.infoAppender.layout.ConversionPattern=%d %5p - %m%n
log4j.logger.sonar-info=INFO, infoAppender
@@ -36,7 +36,7 @@
#WARN
log4j.appender.warnAppender.MaxBackupIndex=11
-log4j.appender.warnAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar_warn.log
+log4j.appender.warnAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar_warn.log
log4j.appender.warnAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.warnAppender.layout.ConversionPattern=%d %5p - %m%n
log4j.logger.sonar-warn=WARN, warnAppender
@@ -45,7 +45,7 @@
#ERROR
log4j.appender.errorAppender.MaxBackupIndex=11
-log4j.appender.errorAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar_error.log
+log4j.appender.errorAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar_error.log
log4j.appender.errorAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.errorAppender.layout.ConversionPattern=%d %5p - %m%n
log4j.logger.sonar-error=ERROR, errorAppender
@@ -54,7 +54,7 @@
#FATAL
log4j.appender.fatalAppender.MaxBackupIndex=11
-log4j.appender.fatalAppender.File=/20070904_NEW/20070904_NEW/webapps/JAVA-SSHTELNET-MP-1.2-1.2-dev/WEB-INF/logs/perfsonar_fatal.log
+log4j.appender.fatalAppender.File=${service.home}/${deploy.root}/WEB-INF/logs/perfsonar_fatal.log
log4j.appender.fatalAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.fatalAppender.layout.ConversionPattern=%d %5p - %m%n
log4j.logger.sonar-fatal=FATAL, fatalAppender
Modified:
trunk/geant2_java-sshtelnet-mp/conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.class
===================================================================
(Binary files differ)
Modified: trunk/geant2_java-sshtelnet-mp/conf/service.properties
===================================================================
--- trunk/geant2_java-sshtelnet-mp/conf/service.properties 2007-11-27
11:51:18 UTC (rev 3077)
+++ trunk/geant2_java-sshtelnet-mp/conf/service.properties 2007-11-28
10:15:48 UTC (rev 3078)
@@ -1,15 +1,128 @@
-#This file was created by the ant script.
-#Thu Feb 01 10:28:02 CET 2007
-service.r.type=mp
+#Tue Nov 27 15:45:39 CET 2007
component.registrator.interval=30000
-service.r.service_name=Java SSH Telnet MP
-service.r.access_point=http\://localhost\:8080/TelnetSSHMP/services/TelnetSSH
+service.mp.cisco.commands.IPv6_TRACEROUTE.caching=0
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF.description=display the IP
routing table associated with a Virtual Private Network (VPN)
routing/forwarding instance (VRF)
+service.mp.cisco.commands.IP_PING.caching=0
+service.mp.cisco.commands.IPv6_PING.description=ping an <ipv6 address>
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION=show running
interface
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.mp.cisco.commands.IPv6_TRACEROUTE.regex=^([A-Fa-f0-9]{1,4}\:){7}[A-Fa-f0-9](/[0-9]{1,3})?$
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.minParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_ENVIRONMENT=show environment
+service.mp.cisco.commands.IP_PING_VRF=ping vrf
+service.r.mp.cisco.username=cisco
+service.r.mp.cisco.port=23
+service.r.mp.cisco.url=10.10.14.4
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.regex=^([A-Fa-f0-9]{1,4}\:){7}[A-Fa-f0-9](/[0-9]{1,3})?$
+service.mp.cisco.commands.BGP_ROUTE_IPv4.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.maxParamCount=1
+service.mp.cisco.commands.IP_PING_VRF.description=pings an <ip address> that
has a specific VRF
+service.r.organization_name=
+service.mp.cisco.commands.IP_PING_VRF.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.mp.cisco.commands.IPv6_TRACEROUTE=trace ipv6
+service.r.ls_url=
+service.mp.cisco.commands.IPv6_BGP_TABLE.syntax=<IPv6 prefix network/length>
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.description=display IPv6 routing
table entry for <ipv6 address>
service.ls.registration_file=
-service.log.log4j.config=D\:\\temp\\20070201/conf/log4j.properties
+service.mp.cisco.commands.IPv6_PING.caching=0
+service.r.mp.cisco.prompt=Cisco2811_1\#
+service.mp.cisco.commands.IPv6_TRACEROUTE.minParamCount=1
+service.mp.cisco.commands.STATUS_INTERFACE_STATS.syntax=<interface>
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.syntax=<ipv6 address>
+service.mp.cisco.commands.IPv6_BGP_TABLE.maxParamCount=1
+service.as.point=http\://homer.rediris.es\:8080/perfSONAR-AS/services/AuthService
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.description=display
the interface configuration for <interface>
+service.r.service_description=perfSONAR service
service.mp.message_types=SetupDataRequest,MetadataKeyRequest,EchoRequest
+service.mp.cisco.commands.IPv6_TRACEROUTE.maxParamCount=1
+service.mp.cisco.commands.BGP_ROUTE_IPv4=show ip bgp
+service.r.service_type=mp
+service.mp.cisco.commands.IPv6_BGP_TABLE.minParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_ENVIRONMENT.minParamCount=0
+service.mp.cisco.commands.STATUS_INTERFACE_STATS.minParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_ENVIRONMENT.caching=0
+component.registrator.scheduler_component=scheduler
+service.mp.cisco.commands.BGP_ROUTE_IPv4.minParamCount=1
+service.mp.cisco.commands.IP_PING_VRF.minParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.syntax=<ip
address>
+service.mp.cisco.commands.IPv6_PING=ping ipv6
+service.mp.cisco.commands.IP_PING=ping
+service.r.mp.cisco.rate=100
+service.mp.cisco.commands.IP_SHOW_ROUTE.caching=0
+service.mp.cisco.commands.STATUS_SHOW_ENVIRONMENT.maxParamCount=0
+service.mp.cisco.commands.STATUS_INTERFACE_STATS.maxParamCount=1
+service.r.service_name=JAVA-SSHTELNET-MP
+service.mp.cisco.commands.BGP_ROUTE_IPv4.maxParamCount=1
+service.mp.cisco.commands.IP_PING_VRF.maxParamCount=1
+service.mp.cisco.commands.IP_PING.minParamCount=1
+service.mp.cisco.commands.IP_TRACEROUTE.minParamCount=1
+service.mp.cisco.commands.IPv6_TRACEROUTE.description=trace the ipv6 path to
<ipv6 address>
+service.mp.cisco.commands.IP_SHOW_ROUTE.description=show the current IP
routing table for <ip address>
+service.mp.cisco.commands.IPv6_BGP_TABLE.description=display current BGP
table routing entry for <IPv6 prefix>
+service.mp.cisco.commands.IP_PING.maxParamCount=1
+service.mp.cisco.commands.IP_TRACEROUTE.maxParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_ENVIRONMENT.description=show chassis
environment
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF.syntax=<VPN name>
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF.caching=0
+service.mp.cisco.commands.STATUS_INTERFACE_STATS.description=show interface
statistics
+service.as.authn_for_msg_types=SetupDataRequest,MetadataKeyRequest
+service.mp.cisco.commands.STATUS_SHOW_MPLS_L2_VC_DETAIL.caching=0
+service.mp.cisco.commands.IP_SHOW_ROUTE=show ip route
+service.mp.cisco.commands.IPv6_PING.regex=^([A-Fa-f0-9]{1,4}\:){7}[A-Fa-f0-9](/[0-9]{1,3})?$
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.caching=0
+service.log.log4j.config=${service.home}/${deploy.root}/WEB-INF/classes/perfsonar/conf/log4j.properties
+service.mp.cisco.commands.IP_PING.syntax=<ip address>
+service.mp.cisco.commands.IP_PING_VRF.syntax=<ip address>
+service.r.access_point=http\://localhost\:8080/TelnetSSHMP/services/TelnetSSH
+service.mp.cisco.class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter
+service.mp.cisco.commands.BGP_ROUTE_IPv4.caching=0
+service.mp.cisco.commands.IP_TRACEROUTE.description=trace the IPv4 path to
<ip address>
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.minParamCount=1
+service.mp.cisco.commands.STATUS_INTERFACE_STATS=show interface
+service.mp.cisco.commands.IPv6_PING.syntax=<ipv6 address>
+service.mp.cisco.commands.IPv6_BGP_TABLE=show bgp ipv6
+service.mp.cisco.commands.IP_TRACEROUTE=trace
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.syntax=<ip address>
+service.mp.cisco.commands.IP_TRACEROUTE.syntax=<ip address>
+service.mp.cisco.commands.IP_TRACEROUTE.caching=0
+service.r.mp.cisco.cache=0
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.maxParamCount=1
+service.mp.devices=cisco
+service.mp.cisco.commands.STATUS_SHOW_MPLS_L2_VC_DETAIL.description=display
detailed information about Any Transport over MPLS (AToM) virtual circuits
(VCs)
+service.r.contact_email=
+service.mp.cisco.commands.STATUS_INTERFACE_STATS.caching=0
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.caching=0
+service.mp.cisco.commands.STATUS_SHOW_MPLS_L2_VC_DETAIL=show mpls
l2transport vc detail
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.minParamCount=1
+service.r.service_version=1.2.1
+service.mp.cisco.commands.IP_TRACEROUTE_VRF.description=displays the path to
<ip address> that has a specific VRF
+service.mp.cisco.commands.IP_PING.description=ping an <ip address>
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.maxParamCount=1
service.mp.class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.WebserviceEngineAdapter
-service.r.service_type=SSH/Telnet MP
-service.r.ls_url=
-service.sax_parser.config=D\:\\temp\\20070201/src/objects.config
-service.r.service_description=Java SSH/Telnet MP, perfSONAR project
-component.registrator.scheduler_component=scheduler
+service.mp.cisco.commands.IP_TRACEROUTE.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.mp.cisco.commands.IP_TRACEROUTE_VRF=trace vrf
+service.mp.cisco.commands.IP_SHOW_ROUTE.minParamCount=1
+service.mp.cisco.commands.IPv6_SHOW_ROUTE.caching=0
+service.r.type=mp
+service.mp.cisco.commands.IP_SHOW_ROUTE.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.sax_parser.config=${service.home}/${deploy.root}/WEB-INF/classes/perfsonar/conf/objects.config
+service.mp.cisco.commands=STATUS_SHOW_ENVIRONMENT,STATUS_INTERFACE_STATS,BGP_ROUTE_IPv4,IP_SHOW_ROUTE,STATUS_SHOW_INTERFACE_CONFIGURATION,IP_PING,IP_TRACEROUTE,IPv6_SHOW_ROUTE,IPv6_BGP_TABLE,IPv6_PING,IPv6_TRACEROUTE,STATUS_SHOW_MPLS_L2_VC_DETAIL,IP_SHOW_ROUTE_VRF,IP_PING_VRF,IP_TRACEROUTE_VRF
+service.mp.cisco.commands.IPv6_PING.minParamCount=1
+service.mp.cisco.commands.BGP_ROUTE_IPv4.syntax=<ip address>
+service.mp.cisco.commands.IP_PING_VRF.caching=0
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF=show ip route vrf
+service.mp.cisco.commands.IPv6_SHOW_ROUTE=show ipv6 route
+service.mp.cisco.commands.IP_SHOW_ROUTE.maxParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_MPLS_L2_VC_DETAIL.minParamCount=0
+service.mp.cisco.commands.STATUS_SHOW_INTERFACE_CONFIGURATION.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
+service.mp.cisco.commands.IP_SHOW_ROUTE.syntax=<ip address>
+service.r.mp.cisco.password=cisco
+service.mp.cisco.commands.IPv6_BGP_TABLE.caching=0
+service.mp.cisco.commands.IPv6_PING.maxParamCount=1
+service.mp.cisco.commands.STATUS_SHOW_MPLS_L2_VC_DETAIL.maxParamCount=0
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF.minParamCount=1
+service.mp.cisco.commands.IPv6_TRACEROUTE.syntax=<ipv6 address>
+service.as.authn_active=on
+service.mp.cisco.commands.BGP_ROUTE_IPv4.description=show bgp routing table
+service.mp.cisco.commands.IP_SHOW_ROUTE_VRF.maxParamCount=1
+service.mp.cisco.commands.IP_PING.regex=^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(/[0-9]{1,2})?$
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.telnet.TelnetManager;
@@ -237,7 +238,7 @@
logger.info("[CiscoBgpAdapter] Trying to connect");
- manager.connect(username, "Username:", password,
"Password:");
+ manager.connect(username, "Username:",
PasswordEncryptor.decryptPassword(password), "Password:");
logger.info("[CiscoBgpAdapter Login");
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoKeyBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoKeyBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoKeyBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.ssh.SshKeyManager;
@@ -237,7 +238,7 @@
if (passphrase == null || passphrase.equals(""))
manager.connect(username, keyUrl);
- else manager.connect(username, keyUrl, passphrase);
+ else manager.connect(username, keyUrl,
PasswordEncryptor.decryptPassword(passphrase));
logger.info("[CiscoKeyBgpAdapter] Login");
} catch (Exception e) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoSshBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoSshBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/CiscoSshBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.ssh.SshManager;
@@ -225,13 +226,13 @@
//System.out.println(username);
//System.out.println(password);
- manager = new SshManager(url, username,
password, false);
+ manager = new SshManager(url, username,
PasswordEncryptor.decryptPassword(password), false);
}
logger.info("[CiscoSshBgpAdapter] Trying to connect");
- manager.connect(username, "Username:", password,
"Password:");
+ manager.connect(username, "Username:",
PasswordEncryptor.decryptPassword(password), "Password:");
logger.info("[CiscoSshBgpAdapter Login");
@@ -436,7 +437,7 @@
caching =
Integer.parseInt(properties.getProperty("service.r.mp." + subject
+ ".cache"));
- manager = new SshManager(url, username, password,
false);
+ manager = new SshManager(url, username,
PasswordEncryptor.decryptPassword(password), false);
} catch (NumberFormatException e1) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.telnet.TelnetManager;
@@ -235,7 +236,7 @@
((TelnetManager) manager).setPrompt(properties
.getProperty("service.r.mp." +
subject + ".prompt"));
- manager.connect(username, "login:", password,
"Password:");
+ manager.connect(username, "login:",
PasswordEncryptor.decryptPassword(password), "Password:");
logger.info("[JuniperBgpAdapter] Login");
} catch (Exception e) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperKeyBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperKeyBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperKeyBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.ssh.SshKeyManager;
@@ -237,7 +238,7 @@
if (passphrase == null || passphrase.equals(""))
manager.connect(username, keyUrl);
- else manager.connect(username, keyUrl, passphrase);
+ else manager.connect(username, keyUrl,
PasswordEncryptor.decryptPassword(passphrase));
logger.info("[JuniperKeyBgpAdapter] Login");
} catch (Exception e) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperSshBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperSshBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/JuniperSshBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.ssh.SshManager;
@@ -225,13 +226,13 @@
//System.out.println(username);
//System.out.println(password);
- manager = new SshManager(url, username,
password, false);
+ manager = new SshManager(url, username,
PasswordEncryptor.decryptPassword(password), false);
}
logger.info("[JuniperSshBgpAdapter] Trying to
connect");
- manager.connect(username, "Username:", password,
"Password:");
+ manager.connect(username, "Username:",
PasswordEncryptor.decryptPassword(password), "Password:");
logger.info("[JuniperSshBgpAdapter Login");
@@ -450,7 +451,7 @@
caching =
Integer.parseInt(properties.getProperty("service.r.mp." + subject
+ ".cache"));
- manager = new SshManager(url, username, password,
false);
+ manager = new SshManager(url, username,
PasswordEncryptor.decryptPassword(password), false);
} catch (NumberFormatException e1) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/QuaggaBgpAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/QuaggaBgpAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters/QuaggaBgpAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -28,6 +28,7 @@
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.BgpAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommand;
import
org.perfsonar.service.measurementPoint.lookingGlassType.bgp.commands.BgpCommandInterface;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import org.perfsonar.service.measurementPoint.remote.common.RemoteManager;
import org.perfsonar.service.measurementPoint.remote.telnet.TelnetManager;
@@ -230,7 +231,7 @@
logger.debug("[QuaggaBgpAdapter] Login");
- manager.executeCommand(password);
+
manager.executeCommand(PasswordEncryptor.decryptPassword(password));
} catch (Exception e) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption/PasswordEncryptor.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption/PasswordEncryptor.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption/PasswordEncryptor.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -1,11 +1,13 @@
package org.perfsonar.service.measurementPoint.lookingGlassType.encryption;
-import java.io.File;
import java.io.FileInputStream;
-import java.security.InvalidAlgorithmParameterException;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
+import java.util.Properties;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@@ -13,40 +15,44 @@
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESedeKeySpec;
-import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.DESKeySpec;
public class PasswordEncryptor {
- public static String KEY = "This is a test DESede key";
-
public static String encryptPassword (String pass) {
String result = "";
+ // Encrypt the cleartext
+ byte[] ciphertext;
+
try {
// Create an array to hold the key
- byte[] encryptKey = KEY.getBytes();
+ byte[] encryptKey = "This is a test DESede
key".getBytes();
// Create a DESede key spec from the key
- DESedeKeySpec spec = new DESedeKeySpec(encryptKey);
+ DESKeySpec spec = new DESKeySpec(encryptKey);
- // Get the secret key factor for generating DESede
keys
- SecretKeyFactory keyFactory =
SecretKeyFactory.getInstance("DESede");
+ SecretKeyFactory keyfact =
SecretKeyFactory.getInstance("DES");
- // Generate a DESede SecretKey object
- SecretKey theKey = keyFactory.generateSecret(spec);
+ SecretKey desKey = keyfact.generateSecret(spec);
- // Create a DESede Cipher
- Cipher cipher = Cipher.getInstance("DESede");
+ Cipher desCipher;
- // Initialize the cipher and put it into encrypt mode
- cipher.init(Cipher.ENCRYPT_MODE, theKey);
+ // Create the cipher
+ desCipher = Cipher.getInstance("DES");
- // Encrypt the data
- byte[] encrypted = cipher.doFinal(pass.getBytes());
+ // Initialize the cipher for encryption
+ desCipher.init(Cipher.ENCRYPT_MODE, desKey);
- return new String (encrypted);
+ // Our cleartext
+ byte[] cleartext = pass.getBytes();
+
+ ciphertext = desCipher.doFinal(cleartext);
+
+ System.out.println("encrypted text: " + new
String(ciphertext));
+
+ result = new String (ciphertext);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
@@ -59,8 +65,10 @@
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
- }
+ }
+
+
return result;
}
@@ -73,26 +81,24 @@
byte[] encryptKey = "This is a test DESede
key".getBytes();
// Create a DESede key spec from the key
- DESedeKeySpec spec = new DESedeKeySpec(encryptKey);
+ DESKeySpec spec = new DESKeySpec(encryptKey);
- // Get the secret key factor for generating DESede
keys
- SecretKeyFactory keyFactory =
SecretKeyFactory.getInstance("DESede");
+ SecretKeyFactory keyfact =
SecretKeyFactory.getInstance("DES");
- // Generate a DESede SecretKey object
- SecretKey theKey = keyFactory.generateSecret(spec);
+ SecretKey desKey = keyfact.generateSecret(spec);
- // Create a DESede Cipher
- Cipher cipher = Cipher.getInstance("DESede");
+ Cipher desCipher;
- // Initialize the cipher and put it in decrypt mode
- cipher.init(Cipher.DECRYPT_MODE, theKey);
+ // Create the cipher
+ desCipher = Cipher.getInstance("DES");
- // Decrypt the data
- byte[] plaintext = cipher.doFinal(pass.getBytes());
+ // Initialize the same cipher for decryption
+ desCipher.init(Cipher.DECRYPT_MODE, desKey);
- String plaintextStr = new String(plaintext);
+ // Decrypt the ciphertext
+ byte[] cleartext1 =
desCipher.doFinal(pass.getBytes());
- return new String(plaintext);
+ result = new String (cleartext1);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
@@ -111,10 +117,79 @@
}
public static void main (String[] args) {
+ Properties pr = new Properties();
String encrypted = encryptPassword("cisco");
- System.out.println(encrypted);
- String decrypted = decryptPassword(encrypted);
- System.out.println(decrypted);
+ System.out.println("Te stockeren: " + encrypted);
+ pr.setProperty("password", encrypted);
+
+ try {
+ pr.store(new FileOutputStream("test.properties"), "");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("File written");
+
+ pr = new Properties();
+ try {
+ pr.setProperty("test", "testje");
+ pr.load(new FileInputStream("test.properties"));
+ pr.setProperty("test2", "testje");
+ pr.store(new FileOutputStream("test.properties"), "");
+
+ pr.load(new FileInputStream("test.properties"));
+
+ pr.store(System.out, "");
+ System.out.println("encrypted gedoe: " +
pr.getProperty("password"));
+ System.out.println("lengte van het encrypted gedoe: "
+ pr.getProperty("password").length());
+ String decrypted =
decryptPassword(pr.getProperty("password"));
+ System.out.print("decrypted password: " + decrypted);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ /*
+ try {
+ KeyGenerator keygen = KeyGenerator.getInstance("DES");
+ SecretKey desKey = keygen.generateKey();
+
+ Cipher desCipher;
+
+ // Create the cipher
+ desCipher =
Cipher.getInstance("DES/ECB/PKCS5Padding");
+
+ // Initialize the cipher for encryption
+ desCipher.init(Cipher.ENCRYPT_MODE, desKey);
+
+ // Our cleartext
+ byte[] cleartext = "This is just an
example".getBytes();
+
+ // Encrypt the cleartext
+ byte[] ciphertext = desCipher.doFinal(cleartext);
+
+ System.out.println("encrypted text: " + new
String(ciphertext));
+
+ // Initialize the same cipher for decryption
+ desCipher.init(Cipher.DECRYPT_MODE, desKey);
+
+ // Decrypt the ciphertext
+ byte[] cleartext1 = desCipher.doFinal(ciphertext);
+
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (NoSuchPaddingException e) {
+ e.printStackTrace();
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ }
+ */
}
-
}
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -1,22 +1,18 @@
package
org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import java.util.StringTokenizer;
import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
@@ -27,10 +23,13 @@
String previousDevices;
+ private Properties prop;
+
private static String MINIMUM_PACKAGE = "minimumpackage.txt";
public ServicePropertiesConfigurator() {
lines = new String[3];
+ prop = new Properties();
}
public void doStuff(String outputFile) {
@@ -39,9 +38,10 @@
BufferedReader br = new BufferedReader(new
InputStreamReader(
System.in));
- BufferedWriter out = null;
- out = new BufferedWriter(new FileWriter(outputFile,
true));
-
+ //BufferedWriter out = null;
+ //out = new BufferedWriter(new FileWriter(outputFile,
true));
+ //FileOutputStream out = new FileOutputStream
(outputFile, true);
+
//List devices = new ArrayList();
previousDevices = new String(); // devices defined
in given service.properties file
@@ -54,7 +54,17 @@
//List allCommands = new ArrayList();
- out.write("service.ls.registration_file=\n");
+ File outpFile = new File (outputFile);
+
+ System.out.println("outputFile object created");
+
+ if (outpFile.exists()) {
+ System.out.println("Loading existing
properties...");
+ prop.load(new FileInputStream(outputFile));
+ System.out.println("Properties loaded");
+ }
+ System.out.println("Starting configuration...");
+ prop.setProperty("service.ls.registration_file", "");
System.out.println();
System.out
@@ -80,7 +90,7 @@
System.out
.println("Please enter the path to this
configuration file");
String file = br.readLine();
- BufferedReader previousIn = null;
+ /*BufferedReader previousIn = null;
previousIn = new BufferedReader(new
FileReader(file));
String line = "";
line = previousIn.readLine();
@@ -91,20 +101,23 @@
||
line.startsWith("service.r.mp")){
if(line.startsWith("service.mp.devices")){
previousDevices=line.substring(line.indexOf("=")+1);
- out.write(line +
"\n");
+ out.write((line +
"\n").getBytes());
}else
if(line.contains("commands=")){
previousCommands.add(line);
- out.write(line +
"\n");
+ out.write((line +
"\n").getBytes());
}else{
System.out.println(line);
- out.write(line +
"\n");
+ out.write((line +
"\n").getBytes());
}
}
line = previousIn.readLine();
}
- out.close();
+ out.close();*/
+
+ prop.load(new FileInputStream(new
File(file)));
+
} else { // answer == no
System.out
.println("Do you have a CSV file which
defines the configuration? (yes/no)");
@@ -130,7 +143,10 @@
askManually(outputFile); // manually
provide configuration information
}
}
-
+
+ prop.store(new FileOutputStream(outputFile),
"Service.properties");
+ //prop.store(System.out, "Service.properties");
+
} catch (IOException e) {
e.printStackTrace();
}
@@ -138,9 +154,10 @@
private void parseCSVFile(String file, String outputFile) {
try {
- BufferedWriter out = null;
- out = new BufferedWriter(new FileWriter(outputFile,
true));
-
+ //BufferedWriter out = null;
+ //out = new BufferedWriter(new FileWriter(outputFile,
true));
+ //FileOutputStream out = new
FileOutputStream(outputFile, true);
+
// Read all lines from txt file
lines = readLinesFromFile(file);
@@ -163,81 +180,81 @@
devicesArray[i] = device;
deviceType = deviceTok.nextToken();
if
(deviceType.equalsIgnoreCase("quaggatelnet")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".password=" + PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +
"\n");
- out.write("service.r.mp." + device +
".bgp.port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".bgp.prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".bgp.password=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".password", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".bgp.port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".bgp.prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".bgp.password", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("ciscotelnet")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".password=" + PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +
"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".password", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("ciscossh")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".password=" + PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +
"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".password", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("ciscokey")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".keyUrl=" + deviceTok.nextToken() + "\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".keyUrl", "" + deviceTok.nextToken());
if (deviceTok.hasMoreTokens())
- out.write("service.r.mp." +
device + ".passphrase=" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+
prop.setProperty("service.r.mp." + device + ".passphrase", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("junipertelnet")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".password=" + PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +
"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".password", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("juniperssh")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".password=" + PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +
"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".password", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else if
(deviceType.equalsIgnoreCase("juniperkey")) {
- out.write("service.mp."+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter\n");
- out.write("service.r.mp." + device +
".url=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".port=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".prompt=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".rate=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".username=" + deviceTok.nextToken() + "\n");
- out.write("service.r.mp." + device +
".keyUrl=" + deviceTok.nextToken() + "\n");
+ prop.setProperty("service.mp."+ device
+ + ".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter");
+ prop.setProperty("service.r.mp." +
device + ".url", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".port", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".prompt", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".rate", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".username", "" + deviceTok.nextToken());
+ prop.setProperty("service.r.mp." +
device + ".keyUrl", "" + deviceTok.nextToken() + "\n");
if (deviceTok.hasMoreTokens())
- out.write("service.r.mp." +
device + ".passphrase=" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()) +"\n");
- out.write("service.r.mp." + device +
".cache=0\n");
+
prop.setProperty("service.r.mp." + device + ".passphrase", "" +
PasswordEncryptor.encryptPassword(deviceTok.nextToken()));
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
} else {
System.out.println("There was an
unknown device type in the csv file: "+deviceType);
@@ -249,7 +266,6 @@
while (tok.hasMoreTokens()) {
//Then write all command info to a
temporary file
-
dos.writeBytes(tok.nextToken()+"\n");
dos.flush();
}
@@ -259,13 +275,14 @@
addSelectedCommandsToConfig(device,
outputFile, tempFile.toString());
}
- out.write("service.mp.devices=");
+ //out.write("service.mp.devices=".getBytes());
String tmp = "";
for (int i=0; i<devicesArray.length &&
devicesArray[i] != null ; i++){
tmp += devicesArray[i]+",";
}
- out.write(tmp.substring(0,tmp.length()-1));
- out.close();
+ //out.write((tmp.substring(0,tmp.length()-1));
+ prop.setProperty("service.mp.devices",
tmp.substring(0, tmp.length()-1));
+ //out.close();
} catch (IOException e) {
e.printStackTrace();
}
@@ -298,9 +315,10 @@
BufferedReader br = new BufferedReader(new
InputStreamReader(
System.in));
- BufferedWriter out = null;
- out = new BufferedWriter(new FileWriter(outputFile,
true));
-
+ //BufferedWriter out = null;
+ //out = new BufferedWriter(new FileWriter(outputFile,
true));
+ //FileOutputStream out = new
FileOutputStream(outputFile, true);
+
List devices = new ArrayList();
List types = new ArrayList();
@@ -368,44 +386,37 @@
types.add(input);
if (input.equalsIgnoreCase("1"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter");
else if (input.equalsIgnoreCase("2"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter");
else if (input.equalsIgnoreCase("3"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter");
else if (input.equalsIgnoreCase("4"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter");
else if (input.equalsIgnoreCase("5"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter");
else if (input.equalsIgnoreCase("6"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter");
else if (input.equalsIgnoreCase("7"))
- out
- .write("service.mp."
+ prop.setProperty("service.mp."
+ device
- +
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter\n");
+ +
".class_name",
"org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter");
}
System.out.println();
@@ -430,7 +441,7 @@
devicesString +=device + ",";
//System.out.println("devicesString:
"+devicesString);
//if (previousDevices.equals(""))
- //
out.write("service.mp.devices=" +
devicesString.substring(0,devicesString.length()-1) + "\n");
+ //
prop.setProperty("service.mp.devices=" +
devicesString.substring(0,devicesString.length()-1));
//else
out.write("service.mp.devices=" + previousDevices +"," + devicesString +
"\n");
System.out.println(device);
@@ -441,25 +452,20 @@
System.out.println("Please
give the url for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".url", input );
System.out.println("Please
give the port for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".port", input);
System.out
- .println("Please give the
prompt for device: "
- + device + ":
");
+ .println("Please give the
prompt for device: " + device + ": ");
input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".prompt", input);
System.out
.println("Please give the
access rate for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".rate", input);
System.out
.println("Please give the
password for device: "
+ device + ":
");
@@ -471,26 +477,22 @@
+
device + ": ");
input = br.readLine();
}
- out.write("service.r.mp." +
device + ".password="
- +
PasswordEncryptor.encryptPassword(input) + "\n");
+
prop.setProperty("service.r.mp." + device + ".password",
PasswordEncryptor.encryptPassword(input));
System.out
.println("Please give the
bgp-daemon port for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.port="
- + input +
"\n");
+
prop.setProperty("service.r.mp." + device + "bgp.port", input);
System.out
.println("Please give the
bgp-daemon prompt for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.prompt="
- + input +
"\n");
+
prop.setProperty("service.r.mp." + device + "bgp.prompt", input);
System.out
.println("Please give the
bgp-daemon password for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.password="
- +
PasswordEncryptor.encryptPassword(input) + "\n");
+
prop.setProperty("service.r.mp." + device + "bgp.password",
PasswordEncryptor.encryptPassword(input));
} else if (type.equalsIgnoreCase("2")
||
type.equalsIgnoreCase("3")
||
type.equalsIgnoreCase("5")
@@ -498,25 +500,21 @@
System.out.println("Please
give the url for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".url", input);
System.out.println("Please
give the port for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".port", input);
System.out
.println("Please give the
prompt for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".prompt", input);
System.out
.println("Please give the
access rate for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".rate", input);
System.out
.println("Please give the
username for device: "
+ device + ":
");
@@ -528,8 +526,7 @@
+
device + ": ");
input = br.readLine();
}
- out.write("service.r.mp." +
device + ".username="
- + input +
"\n");
+
prop.setProperty("service.r.mp." + device + ".username", input);
System.out
.println("Please give the
password for device: "
+ device + ":
");
@@ -541,32 +538,28 @@
+
device + ": ");
input = br.readLine();
}
- out.write("service.r.mp." +
device + ".password="
- +
PasswordEncryptor.encryptPassword(input) + "\n");
+
prop.setProperty("service.r.mp." + device + ".password",
PasswordEncryptor.encryptPassword(input));
+ System.out.println("Encrypted
password: " + PasswordEncryptor.encryptPassword(input));
} else if (type.equalsIgnoreCase("4")
||
type.equalsIgnoreCase("7")) {
System.out.println("Please
give the url for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".url", input);
System.out.println("Please
give the port for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".port", input);
System.out
.println("Please give the
prompt for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".prompt", input);
System.out
.println("Please give the
access rate for device: "
+ device + ":
");
input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".rate", input);
System.out
.println("Please give the
username for device: "
+ device + ":
");
@@ -578,8 +571,7 @@
+
device + ": ");
input = br.readLine();
}
- out.write("service.r.mp." +
device + ".username="
- + input +
"\n");
+
prop.setProperty("service.r.mp." + device + ".username", input);
System.out
.println("Please give the
path to the public ssh key for device: "
+ device + ":
");
@@ -591,18 +583,17 @@
+
device + ": ");
input = br.readLine();
}
- out.write("service.r.mp." +
device + ".keyUrl=" + input
- + "\n");
+
prop.setProperty("service.r.mp." + device + ".keyUrl", input);
System.out
.println("Please provide the
passphrase for the public ssh key. " +
"Leave this blank if you
don't have to enter a passphrase.");
input = br.readLine();
if (input != null &&
!input.equals("")){
-
out.write("service.r.mp." + device + ".passphrase=" +
PasswordEncryptor.encryptPassword(input) + "\n");
+
prop.setProperty("service.r.mp." + device + ".passphrase",
PasswordEncryptor.encryptPassword(input));
}
}
- out.write("service.r.mp." + device +
".cache=0\n");
+ prop.setProperty("service.r.mp." +
device + ".cache", "0");
System.out.println();
@@ -716,10 +707,10 @@
}
}
if (previousDevices.equals(""))
- out.write("service.mp.devices=" +
devicesString.substring(0,devicesString.length()-1) + "\n");
- else out.write("service.mp.devices=" +
previousDevices +"," + devicesString + "\n");
+
prop.setProperty("service.mp.devices",
devicesString.substring(0,devicesString.length()-1));
+ else prop.setProperty("service.mp.devices",
previousDevices +"," + devicesString);
}
- out.close();
+ //out.close();
} catch (IOException e) {
e.printStackTrace();
}
@@ -861,8 +852,9 @@
try {
//add selected commands to the configuration
File outputfile = new File(outputFile);
- DataOutputStream out = new DataOutputStream(new
FileOutputStream(outputfile, true));
-
+ //DataOutputStream out = new DataOutputStream(new
FileOutputStream(outputfile, true));
+ FileOutputStream out = new
FileOutputStream(outputfile, true);
+
BufferedReader br = new BufferedReader(new
FileReader(inputfile));
input = br.readLine();
@@ -894,54 +886,49 @@
commandList += command + ",";
- out.writeBytes("service.mp." + device +
".commands."
- + command + "=" + realCommand
+ "\n");
- out.flush();
+ prop.setProperty("service.mp." + device +
".commands." + command + "", realCommand);
+ //out.flush();
if (!minParamCount.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command +
".minParamCount=" + minParamCount
- + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command +
".minParamCount", minParamCount);
+ //out.flush();
}
if (!maxParamCount.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command +
".maxParamCount=" + maxParamCount
- + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command +
".maxParamCount", maxParamCount);
+ //out.flush();
}
if (!cache.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command +
".caching=" + cache + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command +
".caching", cache);
+ //out.flush();
}
if (!description.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command +
".description=" + description
- + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command +
".description", description);
+ //out.flush();
}
if (!syntax.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command +
".syntax=" + syntax + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command +
".syntax", syntax);
+ //out.flush();
}
if (!regExp.equalsIgnoreCase("---")) {
- out.writeBytes("service.mp." + device
+ ".commands."
- + command + ".regex="
+ regExp + "\n");
- out.flush();
+ prop.setProperty("service.mp." +
device + ".commands."
+ + command + ".regex",
regExp);
+ //out.flush();
}
input = br.readLine();
}
commandList = commandList.substring(0,
commandList.length()-1);
- out.writeBytes("service.mp." + device + ".commands="
- + commandList + "\n");
- out.flush();
+ prop.setProperty("service.mp." + device +
".commands", commandList);
+ //out.flush();
out.close();
@@ -953,22 +940,33 @@
inputfile.delete();
}
-public static void main(String[] args) {
-
- try {
- if (args.length != 1) {
- System.err.println("Wrong number of arguments!");
- System.exit(0);
- } else {
- //System.out.println(args[0]);
- ServicePropertiesConfigurator stitcher = new
ServicePropertiesConfigurator();
- stitcher.doStuff(args[0]);
- //createServiceStorageXML(args[0], args[0] +
"XML.xml");
-
+ public static void main(String[] args) {
+ try {
+ if (args.length != 1 && args.length != 2) {
+ System.err.println("Wrong number of
arguments!");
+ System.exit(0);
+ } else {
+ //System.out.println(args[0]);
+ ServicePropertiesConfigurator stitcher = new
ServicePropertiesConfigurator();
+ stitcher.doStuff(args[0]);
+ //createServiceStorageXML(args[0], args[0] +
"XML.xml");
+ }
+
+ if (args.length == 2) {
+ //PropertiesConfigurationComponent pr =
(PropertiesConfigurationComponent) AuxiliaryComponentManager
+ //
.getInstance().getComponent(ComponentNames.CONFIG);
+
+ Properties pr = new Properties();
+ pr.load(new FileInputStream(args[0]));
+
+ String password =
pr.getProperty("service.r.mp." + args[1] + ".password");
+ System.out.println("encrypted password from
properties file: " + password);
+ String pass =
PasswordEncryptor.decryptPassword(password);
+ System.out.println("decrypted password from
properties file: " + pass);
+ }
+ } catch (RuntimeException e) {
+ } catch (Exception e){
+ e.printStackTrace();
}
- } catch (RuntimeException e) {
-
}
-
}
-}
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoSshStatusAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoSshStatusAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoSshStatusAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -5,6 +5,9 @@
*/
package
org.perfsonar.service.measurementPoint.lookingGlassType.status.adapters;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -25,6 +28,7 @@
import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.service.base.engine.ServiceEngine;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import
org.perfsonar.service.measurementPoint.lookingGlassType.status.StatusAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.status.commands.StatusCommand;
@@ -88,6 +92,14 @@
properties = (PropertiesConfigurationComponent)
AuxiliaryComponentManager
.getInstance().getComponent(ComponentNames.CONFIG);
+ try {
+ properties.getProperties().store(new
FileOutputStream("eend.properties"), "");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
this.serviceEngineType =
"service.MeasurementPoint.TELNETSSHType";
//FOR LOCAL TESTING
@@ -221,7 +233,7 @@
+ ".password");
caching =
Integer.parseInt(properties.getProperty("service.r.mp." + subject
+ ".cache"));
-
+
//System.out.println(username);
//System.out.println(password);
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoStatusAdapter.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoStatusAdapter.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters/CiscoStatusAdapter.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -25,6 +25,7 @@
import org.perfsonar.base.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.service.base.engine.ServiceEngine;
+import
org.perfsonar.service.measurementPoint.lookingGlassType.encryption.PasswordEncryptor;
import
org.perfsonar.service.measurementPoint.lookingGlassType.engine.commands.ParameterChecker;
import
org.perfsonar.service.measurementPoint.lookingGlassType.status.StatusAdapterInterface;
import
org.perfsonar.service.measurementPoint.lookingGlassType.status.commands.StatusCommand;
@@ -215,16 +216,23 @@
url = properties
.getProperty("service.r.mp."
+ subject + ".url");
+ logger.debug("[CiscoStatusAdapter] url: "+
url);
port =
Integer.parseInt(properties.getProperty("service.r.mp."
+ subject + ".port"));
+ logger.debug("[CiscoStatusAdapter] port: "+
port);
prompt =
properties.getProperty("service.r.mp." + subject
+ ".prompt");
+ logger.debug("[CiscoStatusAdapter] prompt: "+
prompt);
username =
properties.getProperty("service.r.mp." + subject
+ ".username");
+ logger.debug("[CiscoStatusAdapter] username:
"+ username);
password =
properties.getProperty("service.r.mp." + subject
+ ".password");
+ logger.debug("[CiscoStatusAdapter] encrypted
password: "+ password);
+ logger.debug("[CiscoStatusAdapter] decrypted
password: "+ PasswordEncryptor.decryptPassword(password));
caching =
Integer.parseInt(properties.getProperty("service.r.mp." + subject
+ ".cache"));
+ logger.debug("[CiscoStatusAdapter] cache: "+
caching);
manager = new TelnetManager(url, port, false);
((TelnetManager) manager).setPrompt(properties
@@ -234,7 +242,7 @@
logger.debug("[CiscoStatusAdapter] Trying to
connect");
- manager.connect(username, "Username:", password,
"Password:");
+ manager.connect(username, "Username:",
PasswordEncryptor.decryptPassword(password), "Password:");
logger.debug("[CiscoStatusAdapter] Login");
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshKeyManager.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshKeyManager.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshKeyManager.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -172,7 +172,7 @@
jsch = new JSch();
//Set key identity file
- jsch.addIdentity(keyUrl,
PasswordEncryptor.decryptPassword(passphrase));
+ jsch.addIdentity(keyUrl, passphrase);
//Create session
session = jsch.getSession(userName, url, 22);
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshManager.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshManager.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/ssh/SshManager.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -249,7 +249,7 @@
public void connect(String userName, String passwd)
throws PerfSONARException {
- connect(userName, "Username:",
PasswordEncryptor.decryptPassword(passwd), "Password:");
+ connect(userName, "Username:", passwd, "Password:");
}
@@ -265,7 +265,7 @@
}
public String getPassword() {
- return PasswordEncryptor.decryptPassword(passwd);
+ return passwd;
}
public boolean promptYesNo(String str) {
Modified:
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/telnet/TelnetManager.java
===================================================================
---
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/telnet/TelnetManager.java
2007-11-27 11:51:18 UTC (rev 3077)
+++
trunk/geant2_java-sshtelnet-mp/src/main/java/org/perfsonar/service/measurementPoint/remote/telnet/TelnetManager.java
2007-11-28 10:15:48 UTC (rev 3078)
@@ -127,7 +127,7 @@
//System.out.println("---------------------------------------------");
telnet.connect(url, port);
//System.out.println("Logging in ...");
- telnet.login(userName, loginPrompt,
PasswordEncryptor.decryptPassword(passwd), passwdPrompt);
+ telnet.login(userName, loginPrompt, passwd,
passwdPrompt);
//System.out.println("logged in !!");
} catch (IOException e) {
@@ -231,7 +231,7 @@
public void connect(String userName, String passwd) throws
PerfSONARException {
- connect(userName, "Username:",
PasswordEncryptor.decryptPassword(passwd), "Password:");
+ connect(userName, "Username:", passwd, "Password:");
}
}
- perfsonar: r3078 - in trunk/geant2_java-sshtelnet-mp: ant conf conf/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/bgp/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/encryption src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters src/main/java/org/perfsonar/service/measurementPoint/lookingGlassType/status/adapters src/main/java/org/perfsonar/service/measurementPoint/remote/ssh src/main/java/org/perfsonar/service/measurementPoint/remote/telnet, svnlog, 11/28/2007
Archive powered by MHonArc 2.6.16.