git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@31276 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
18271f631c
commit
cda4d2f4c0
59
build.xml
59
build.xml
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Version 0.5
|
Version 0.5
|
||||||
|
|
||||||
REQUIRED INPUT PROPERTIES
|
INPUT PROPERTIES
|
||||||
|
|
||||||
This buildfile assumes that the following properties have or may have been defined in a "build.properties" file
|
This buildfile assumes that the following properties have or may have been defined in a "build.properties" file
|
||||||
in the configuration directory of the service (or else using the -D flag on the command line).
|
in the configuration directory of the service (or else using the -D flag on the command line).
|
||||||
|
@ -24,6 +24,9 @@ package.<n>: (optional) The package name of the stubs generated from WSDL and/
|
||||||
etics.build: (optional) Set to 'true', it indicates that build structures and procedures
|
etics.build: (optional) Set to 'true', it indicates that build structures and procedures
|
||||||
should be optimised for remote builds in ETICS. If it is omitted, this buildfile will optimise build structures and procedures
|
should be optimised for remote builds in ETICS. If it is omitted, this buildfile will optimise build structures and procedures
|
||||||
for local builds.
|
for local builds.
|
||||||
|
full.stubs: (optional) Set to 'false', it excludes auxiliary stub code placed under ${package}/stubs when building the stub distribution.
|
||||||
|
It is intended to simplify realignment of auxiliary and standard stub in IDE environments in case the latter change in non backwards-compatible ways.
|
||||||
|
After re-alignment, the property is typically left to its default of 'true' to restore a joint build of all stub code.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@ -83,9 +86,10 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
<property name="full.stubs" value="true"/>
|
||||||
<property name="stubs.package" value="${package}.${stubs.dir.name}"/>
|
<property name="stubs.package" value="${package}.${stubs.dir.name}"/>
|
||||||
<property name="stubs.dir.name" value="stubs" /> <!-- auxiliary stub classes -->
|
<property name="stubs.dir.name" value="stubs" /> <!-- auxiliary stub classes -->
|
||||||
<property name="stubs.dir" value="${source.dir}/${package.dir}${stubs.dir.name}" />
|
<property name="stubs.dir" value="${source.dir}/${package.dir}/${stubs.dir.name}" />
|
||||||
<available file="${stubs.dir}" property="stubs.dir.present"/>
|
<available file="${stubs.dir}" property="stubs.dir.present"/>
|
||||||
|
|
||||||
<!-- temporary build locations -->
|
<!-- temporary build locations -->
|
||||||
|
@ -153,6 +157,12 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
<fileset dir="${schema.dir}"/>
|
<fileset dir="${schema.dir}"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
|
<!-- Populates library folder -->
|
||||||
|
<copy toDir="${build.lib.dir}">
|
||||||
|
<fileset dir="${lib.location}">
|
||||||
|
<exclude name="${jarfile.stubs}" />
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -373,6 +383,13 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</if>
|
</if>
|
||||||
<var name="mappings" value="${mappings} -N${namespace.6}=${package.6} -N${namespace.6}/service=${package.6}.service -N${namespace.6}/bindings=${package.6}.bindings"/>
|
<var name="mappings" value="${mappings} -N${namespace.6}=${package.6} -N${namespace.6}/service=${package.6}.service -N${namespace.6}/bindings=${package.6}.bindings"/>
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
<var name="mappings" value="${mappings} -Nhttp://gcube-system.org/namespaces/common=org.gcube.common"/>
|
||||||
|
<!-- ADD LATER TO
|
||||||
|
<var name="mappings" value="${mappings} -x http://gcube-system.org/namespaces/common"/>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,7 +402,8 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="buildService" depends="processWSDLs" description="compiles service implementation">
|
<target name="buildService" depends="processWSDLs" description="compiles service implementation">
|
||||||
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}">
|
<javac srcdir="${source.dir}" destdir="${build.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}"> <exclude name="${package.dir}/${stubs.dir.name}/**"/>
|
||||||
|
<exclude name="${stubs.dir}/**"/>
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="${lib.location}">
|
<fileset dir="${lib.location}">
|
||||||
<include name="**/*.jar" />
|
<include name="**/*.jar" />
|
||||||
|
@ -401,8 +419,9 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
<target name="jarService" depends="buildService" description="jars service implementation">
|
<target name="jarService" depends="buildService" description="jars service implementation">
|
||||||
<copy todir="${build.class.dir}">
|
<copy todir="${build.class.dir}">
|
||||||
<fileset dir="${source.dir}">
|
<fileset dir="${source.dir}">
|
||||||
<include name="org/**/*.xsl"/>
|
|
||||||
<include name="org/**/*.xsd"/>
|
<include name="org/**/*.xsd"/>
|
||||||
|
<include name="org/**/*.xml"/>
|
||||||
|
<include name="org/**/*.properties"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<jar jarfile="${build.lib.dir}/${jarfile}" basedir="${build.class.dir}">
|
<jar jarfile="${build.lib.dir}/${jarfile}" basedir="${build.class.dir}">
|
||||||
|
@ -429,6 +448,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
<!-- Stub Build tasks -->
|
<!-- Stub Build tasks -->
|
||||||
|
|
||||||
<target name="buildStubs" depends="processWSDLs,generateStubs" description="build service stubs">
|
<target name="buildStubs" depends="processWSDLs,generateStubs" description="build service stubs">
|
||||||
|
<if name="full.stubs" value="true">
|
||||||
<if name="stubs.dir.present">
|
<if name="stubs.dir.present">
|
||||||
<copy toDir="${build.stubs.src.dir}/${package.dir}/${stubs.dir.name}" overwrite="true">
|
<copy toDir="${build.stubs.src.dir}/${package.dir}/${stubs.dir.name}" overwrite="true">
|
||||||
<fileset dir="${stubs.dir}" casesensitive="yes">
|
<fileset dir="${stubs.dir}" casesensitive="yes">
|
||||||
|
@ -436,6 +456,7 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</if>
|
</if>
|
||||||
|
</if>
|
||||||
<javac srcdir="${build.stubs.src.dir}" destdir="${build.stubs.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile stub classes">
|
<javac srcdir="${build.stubs.src.dir}" destdir="${build.stubs.class.dir}" debug="${java.debug}" deprecation="${java.deprecation}" description="compile stub classes">
|
||||||
<include name="**/*.java" />
|
<include name="**/*.java" />
|
||||||
<classpath>
|
<classpath>
|
||||||
|
@ -451,12 +472,18 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</fileset>
|
</fileset>
|
||||||
</classpath>
|
</classpath>
|
||||||
</javac>
|
</javac>
|
||||||
<copy toDir="${build.stubs.class.dir}/META-INF" overwrite="false"><!-- copy configuration info as well -->
|
|
||||||
<fileset dir="${etc.dir}" casesensitive="yes" />
|
|
||||||
</copy>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
|
<target name="jarStubs" depends="buildStubs" description="jar stub classes">
|
||||||
|
<copy toDir="${build.stubs.class.dir}/META-INF">
|
||||||
|
<fileset dir="${etc.dir}" casesensitive="yes" />
|
||||||
|
</copy>
|
||||||
|
<copy todir="${build.stubs.class.dir}">
|
||||||
|
<fileset dir="${source.dir}">
|
||||||
|
<include name="org/**/*.xsd"/>
|
||||||
|
<include name="org/**/*.properties"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
<jar destfile="${build.lib.dir}/${jarfile.stubs}" basedir="${build.stubs.class.dir}" />
|
<jar destfile="${build.lib.dir}/${jarfile.stubs}" basedir="${build.stubs.class.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -519,6 +546,24 @@ etics.build: (optional) Set to 'true', it indicates that build structures a
|
||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="doctests">
|
||||||
|
<javadoc access="public" author="true" destdir="doc/api" nodeprecated="false"
|
||||||
|
packagenames="${package}.${stubs.dir.name}.test/*"
|
||||||
|
nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false"
|
||||||
|
source="1.5" sourcepath="${build.stubs.src.dir}"
|
||||||
|
splitindex="true" use="true" version="true"
|
||||||
|
failonerror="false">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir="${lib.location}">
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
<exclude name="**/${jarfile.stubs}" />
|
||||||
|
</fileset>
|
||||||
|
<fileset dir="${container.dir}/lib">
|
||||||
|
<include name="*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</classpath>
|
||||||
|
</javadoc>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete dir="${build.dir}" quiet="true"/>
|
<delete dir="${build.dir}" quiet="true"/>
|
||||||
|
|
|
@ -142,6 +142,10 @@
|
||||||
|
|
||||||
<xsd:element name="setCloudVMsRequestMessage" type="xsd:int"/>
|
<xsd:element name="setCloudVMsRequestMessage" type="xsd:int"/>
|
||||||
|
|
||||||
|
<xsd:element name="getCloudVMsResponseMessage" type="xsd:int"/>
|
||||||
|
|
||||||
|
<xsd:element name="getCloudVMsRequestMessage" type="coretypes:VOID"/>
|
||||||
|
|
||||||
<xsd:element name="isUseCloudResponseMessage" type="xsd:boolean"/>
|
<xsd:element name="isUseCloudResponseMessage" type="xsd:boolean"/>
|
||||||
|
|
||||||
<xsd:element name="isUseCloudRequestMessage" type="coretypes:VOID"/>
|
<xsd:element name="isUseCloudRequestMessage" type="coretypes:VOID"/>
|
||||||
|
@ -240,6 +244,13 @@
|
||||||
<part name="response" element="tns:setCloudVMsResponseMessage"/>
|
<part name="response" element="tns:setCloudVMsResponseMessage"/>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
|
<message name="GetCloudVMsInputMessage">
|
||||||
|
<part name="request" element="tns:getCloudVMsRequestMessage"/>
|
||||||
|
</message>
|
||||||
|
<message name="GetCloudVMsOutputMessage">
|
||||||
|
<part name="response" element="tns:getCloudVMsResponseMessage"/>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="IsUseCloudInputMessage">
|
<message name="IsUseCloudInputMessage">
|
||||||
<part name="request" element="tns:isUseCloudRequestMessage"/>
|
<part name="request" element="tns:isUseCloudRequestMessage"/>
|
||||||
</message>
|
</message>
|
||||||
|
@ -355,6 +366,11 @@
|
||||||
<output message="tns:SetCloudVMsOutputMessage"/>
|
<output message="tns:SetCloudVMsOutputMessage"/>
|
||||||
</operation>
|
</operation>
|
||||||
|
|
||||||
|
<operation name="getCloudVMs">
|
||||||
|
<input message="tns:GetCloudVMsInputMessage"/>
|
||||||
|
<output message="tns:GetCloudVMsOutputMessage"/>
|
||||||
|
</operation>
|
||||||
|
|
||||||
<operation name="isUseCloud">
|
<operation name="isUseCloud">
|
||||||
<input message="tns:IsUseCloudInputMessage"/>
|
<input message="tns:IsUseCloudInputMessage"/>
|
||||||
<output message="tns:IsUseCloudOutputMessage"/>
|
<output message="tns:IsUseCloudOutputMessage"/>
|
||||||
|
|
|
@ -38,7 +38,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||||
|
|
||||||
logger.info("notification received for genericResource "+id+" and operation "+operation);
|
logger.info("notification received for genericResource "+id+" and operation "+operation);
|
||||||
|
|
||||||
if (id.compareTo(this.functionalityResourceId)==0 && (operation.compareTo("update")==0)){
|
if ((operation.compareTo("update")==0) && id.compareTo(this.functionalityResourceId)==0){
|
||||||
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
|
logger.trace("notification received for functionalityResource with id "+id+" in scope "+scope.toString());
|
||||||
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
|
KGCUBEGenericFunctionalityResource resource= new KGCUBEGenericFunctionalityResource();
|
||||||
resource.load(new StringReader(profile));
|
resource.load(new StringReader(profile));
|
||||||
|
@ -54,6 +54,7 @@ private GCUBELog logger= new GCUBELog(GHNConsumer.class);
|
||||||
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
|
FunctionalityHandler functionalityHandler= new FunctionalityHandler();
|
||||||
KGCUBEGenericFunctionalityResource functResource=new KGCUBEGenericFunctionalityResource();
|
KGCUBEGenericFunctionalityResource functResource=new KGCUBEGenericFunctionalityResource();
|
||||||
functResource.load(new StringReader(profile));
|
functResource.load(new StringReader(profile));
|
||||||
|
this.functionalityResourceId=functResource.getID();
|
||||||
functionalityHandler.add(functResource);
|
functionalityHandler.add(functResource);
|
||||||
} else
|
} else
|
||||||
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(genericResource.getSecondaryType()))
|
if (ServiceContext.getContext().getSecondaryTypeGenericResourceRequired().contains(genericResource.getSecondaryType()))
|
||||||
|
|
|
@ -10,18 +10,20 @@ import org.gcube.vremanagement.vremodeler.stubs.deployreport.DeployReport;
|
||||||
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
|
public class ModelerPersistenceDelegate extends GCUBEWSFilePersistenceDelegate<ModelerResource>{
|
||||||
|
|
||||||
|
|
||||||
protected void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
|
protected synchronized void onLoad(ModelerResource resource, ObjectInputStream ois) throws Exception {
|
||||||
super.onLoad(resource, ois);
|
super.onLoad(resource, ois);
|
||||||
resource.setId((String)ois.readObject());
|
resource.setId((String)ois.readObject());
|
||||||
resource.setDeployReport((DeployReport)ois.readObject());
|
resource.setDeployReport((DeployReport)ois.readObject());
|
||||||
resource.setUseCloud(ois.readBoolean());
|
resource.setUseCloud(ois.readBoolean());
|
||||||
|
if (resource.isUseCloud())resource.setNumberOfVMsForCloud(ois.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
|
protected synchronized void onStore(ModelerResource resource,ObjectOutputStream oos) throws Exception {
|
||||||
super.onStore(resource, oos);
|
super.onStore(resource, oos);
|
||||||
oos.writeObject(resource.getId());
|
oos.writeObject(resource.getId());
|
||||||
oos.writeObject(resource.getDeployReport());
|
oos.writeObject(resource.getDeployReport());
|
||||||
oos.writeBoolean(resource.isUseCloud());
|
oos.writeBoolean(resource.isUseCloud());
|
||||||
|
if (resource.isUseCloud())oos.writeInt(resource.getNumberOfVMsForCloud());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class ModelerResource extends GCUBEWSResource {
|
||||||
this.setId((String) args[0]);
|
this.setId((String) args[0]);
|
||||||
this.deployReport=null;
|
this.deployReport=null;
|
||||||
this.isUseCloud=false;
|
this.isUseCloud=false;
|
||||||
|
this.numberOfVMsForCloud=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,6 @@ public class ModelerService {
|
||||||
*/
|
*/
|
||||||
public GHNList getGHNs(VOID var) throws GCUBEFault{
|
public GHNList getGHNs(VOID var) throws GCUBEFault{
|
||||||
logger.trace("getGHNs method");
|
logger.trace("getGHNs method");
|
||||||
try {
|
|
||||||
if (getResource().isUseCloud()) throw new GCUBEFault("deply on cloud is selected, the ghns cannot be returned");
|
|
||||||
} catch (ResourceException e1) {
|
|
||||||
throw new GCUBEFault(e1);
|
|
||||||
}
|
|
||||||
ResultSet res;
|
ResultSet res;
|
||||||
ArrayList<String> relatedGHN=new ArrayList<String>();
|
ArrayList<String> relatedGHN=new ArrayList<String>();
|
||||||
try{
|
try{
|
||||||
|
@ -511,10 +506,21 @@ public class ModelerService {
|
||||||
getResource().store();
|
getResource().store();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseCloud() throws Exception{
|
/**
|
||||||
|
*
|
||||||
|
* @param r VOID
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public boolean isUseCloud(VOID r) throws Exception{
|
||||||
return getResource().isUseCloud();
|
return getResource().isUseCloud();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param numberOfVMs
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public void setCloudVMs(int numberOfVMs) throws Exception{
|
public void setCloudVMs(int numberOfVMs) throws Exception{
|
||||||
ModelerResource resource = getResource();
|
ModelerResource resource = getResource();
|
||||||
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be set, you are not using cloud deployement");
|
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be set, you are not using cloud deployement");
|
||||||
|
@ -522,4 +528,16 @@ public class ModelerService {
|
||||||
resource.store();
|
resource.store();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param r VOID
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public int getCloudVMs(VOID r) throws Exception{
|
||||||
|
ModelerResource resource = getResource();
|
||||||
|
if (!resource.isUseCloud()) throw new Exception("the number of VMs cannot be returned, you are not using cloud deployement");
|
||||||
|
return resource.getNumberOfVMsForCloud();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class ServiceContext extends GCUBEServiceContext{
|
||||||
|
|
||||||
ISNotifier notifier= GHNContext.getImplementation(ISNotifier.class);
|
ISNotifier notifier= GHNContext.getImplementation(ISNotifier.class);
|
||||||
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
|
for (GCUBEScope scope : ServiceContext.getContext().getInstance().getScopes().values()){
|
||||||
|
if (scope.isInfrastructure()) continue;
|
||||||
ServiceContext.getContext().setScope(scope);
|
ServiceContext.getContext().setScope(scope);
|
||||||
|
|
||||||
ArrayList<String> genResList= new ArrayList<String>();
|
ArrayList<String> genResList= new ArrayList<String>();
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.vremanagement.vremodeler.impl.deploy;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.java.dev.jaxb.array.StringArray;
|
import net.java.dev.jaxb.array.StringArray;
|
||||||
import org.apache.axis.client.Call;
|
import org.apache.axis.client.Call;
|
||||||
|
@ -15,6 +14,7 @@ import org.gcube.vremanagement.vremodeler.stubs.deployreport.GHNonCloudReport;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.deployreport.State;
|
import org.gcube.vremanagement.vremodeler.stubs.deployreport.State;
|
||||||
import org.uoa.eolus.Eolus;
|
import org.uoa.eolus.Eolus;
|
||||||
import org.uoa.eolus.EolusServiceLocator;
|
import org.uoa.eolus.EolusServiceLocator;
|
||||||
|
import org.uoa.eolus.startContainer;
|
||||||
|
|
||||||
|
|
||||||
public class DeployGHNsOnCloud{
|
public class DeployGHNsOnCloud{
|
||||||
|
@ -54,9 +54,8 @@ public class DeployGHNsOnCloud{
|
||||||
((Stub) eolus)._setProperty(Call.PASSWORD_PROPERTY, password);
|
((Stub) eolus)._setProperty(Call.PASSWORD_PROPERTY, password);
|
||||||
|
|
||||||
//filling the report
|
//filling the report
|
||||||
List<State> ghnsStates=new ArrayList<State>(numberOfVMs);
|
report.setDeployingState(new State[numberOfVMs]);
|
||||||
Collections.fill(ghnsStates, State.Running);
|
Arrays.fill(report.getDeployingState(), State.Waiting);
|
||||||
this.report.setDeployingState(ghnsStates);
|
|
||||||
|
|
||||||
VM[] hostnames=createVMs(eolus);
|
VM[] hostnames=createVMs(eolus);
|
||||||
configureAndStartContainers(eolus, hostnames);
|
configureAndStartContainers(eolus, hostnames);
|
||||||
|
@ -81,38 +80,51 @@ public class DeployGHNsOnCloud{
|
||||||
StringArray vnets = new StringArray();
|
StringArray vnets = new StringArray();
|
||||||
vnets.setItem(nets);
|
vnets.setItem(nets);
|
||||||
|
|
||||||
//TODO: change this code
|
//TODO: change this code to support more VMs templates
|
||||||
String template=eolus.getTemplates().getItem()[0];
|
String template=eolus.getTemplates().getItem()[0];
|
||||||
|
logger.trace("got the template: "+template);
|
||||||
VM[] vmsNames= new VM[numberOfVMs];
|
VM[] vmsNames= new VM[numberOfVMs];
|
||||||
//the first VM will be set with limited resource (1Gb of ram) for the RM
|
//the first VM will be set with limited resource (1Gb of ram) for the RM
|
||||||
eolus.createVM(template, vreName+"ResourceManager", 2, 1024, vnets);
|
eolus.createVM(template, vreName+"ResourceManager", 2, 1024, vnets);
|
||||||
vmsNames[0]= new VM(vreName+"ResourceManager");
|
vmsNames[0]= new VM(vreName+"ResourceManager");
|
||||||
|
logger.trace("creating the first VM for ResourceManager "+vreName+"ResourceManager");
|
||||||
|
report.getDeployingState()[0]=State.Running;
|
||||||
//the others VMs will be created with 2 GB of ram
|
//the others VMs will be created with 2 GB of ram
|
||||||
for (int i=1; i<numberOfVMs; i++){
|
for (int i=1; i<numberOfVMs; i++){
|
||||||
eolus.createVM(template, vreName+i, 2, 2048, vnets);
|
eolus.createVM(template, vreName+i, 2, 2048, vnets);
|
||||||
vmsNames[i]= new VM(vreName+"ResourceManager");
|
vmsNames[i]= new VM(vreName+i);
|
||||||
|
report.getDeployingState()[i]=State.Running;
|
||||||
|
logger.trace("creating the VM"+i+" "+ vreName+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.trace("checking the VMs Availability");
|
||||||
|
|
||||||
//waiting few seconds
|
//waiting few seconds
|
||||||
Thread.sleep(10000);
|
Thread.sleep(30000);
|
||||||
|
|
||||||
//check if the VMs are ready
|
//check if the VMs are ready
|
||||||
boolean[] arrayCheck= new boolean[numberOfVMs];
|
boolean[] arrayCheck= new boolean[numberOfVMs];
|
||||||
Arrays.fill(arrayCheck, false);
|
Arrays.fill(arrayCheck, false);
|
||||||
while (!and(arrayCheck)){
|
while (!and(arrayCheck)){
|
||||||
|
//waiting few seconds
|
||||||
|
Thread.sleep(30000);
|
||||||
|
|
||||||
//TODO: this cycle cannot continue forever
|
//TODO: this cycle cannot continue forever
|
||||||
for (int i=0; i<numberOfVMs; i++){
|
for (int i=0; i<numberOfVMs; i++){
|
||||||
try{
|
try{
|
||||||
if (arrayCheck[i]) continue;
|
if (arrayCheck[i]) continue;
|
||||||
if(eolus.getVMStatus(vmsNames[i].getName()).equalsIgnoreCase("running")){
|
String vmState= eolus.getVMStatus(vmsNames[i].getName());
|
||||||
|
if(vmState.equalsIgnoreCase("running")){
|
||||||
arrayCheck[i]=true;
|
arrayCheck[i]=true;
|
||||||
vmsNames[i].setIp(eolus.getVMIP(vmsNames[i].getName()));
|
vmsNames[i].setIp(eolus.getVMIP(vmsNames[i].getName()));
|
||||||
|
//report.getDeployingState().set(i, State.Finished);
|
||||||
|
logger.trace("the VM "+vmsNames[i].getName()+" is RUNNING with ip "+vmsNames[i].getIp());
|
||||||
}
|
}
|
||||||
|
//else if(!vmState.equalsIgnoreCase("staging"));
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
//if one fails i cannot continue
|
//if one fails i cannot continue
|
||||||
logger.error("error deploying "+vmsNames[i].getName());
|
logger.error("error deploying "+vmsNames[i].getName(),e);
|
||||||
report.getDeployingState().set(i, State.Failed);
|
report.getDeployingState()[i]=State.Failed;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,26 +136,44 @@ public class DeployGHNsOnCloud{
|
||||||
private void configureAndStartContainers(Eolus eolus, VM[] hostnames) throws Exception {
|
private void configureAndStartContainers(Eolus eolus, VM[] hostnames) throws Exception {
|
||||||
String[] scopes=ServiceContext.getContext().getScope().toString().split("/");
|
String[] scopes=ServiceContext.getContext().getScope().toString().split("/");
|
||||||
String cmdtorun = "configureGHN.sh "+scopes[1]+" "+scopes[2];
|
String cmdtorun = "configureGHN.sh "+scopes[1]+" "+scopes[2];
|
||||||
|
logger.trace("configuring ghns with command "+cmdtorun);
|
||||||
String[] res;
|
String[] res;
|
||||||
for (int i=1; i<hostnames.length; i++){
|
for (int i=0; i<hostnames.length; i++){
|
||||||
res = eolus.execCMD(cmdtorun, hostnames[i].getName()).getItem();
|
res = eolus.execCMD(cmdtorun, hostnames[i].getName()).getItem();
|
||||||
if (res.length > 2)
|
logger.trace("configuring the GHN on host for VM "+hostnames[i].getName()+" got the following report:");
|
||||||
this.report.getDeployingState().set(i, State.Failed);
|
logger.trace("std output "+res[0]);
|
||||||
|
//terrible... waiting for enhancement
|
||||||
|
if (res.length > 2) {
|
||||||
|
this.report.getDeployingState()[i]= State.Failed;
|
||||||
|
logger.trace("std error "+res[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//waiting few seconds before start the container
|
||||||
|
Thread.sleep(60000);
|
||||||
|
//starting the containers
|
||||||
|
for (int i=0; i<hostnames.length; i++){
|
||||||
|
Thread startcontainerthread = new startContainer(eolus,hostnames[i].getName());
|
||||||
|
startcontainerthread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void checkGHNAvailability(VM[] hostnames) throws Exception{
|
private void checkGHNAvailability(VM[] hostnames) throws Exception{
|
||||||
boolean[] arrayCheck= new boolean[hostnames.length];
|
boolean[] arrayCheck= new boolean[hostnames.length];
|
||||||
Arrays.fill(arrayCheck, false);
|
Arrays.fill(arrayCheck, false);
|
||||||
while (!and(arrayCheck)){
|
while (!and(arrayCheck)){
|
||||||
|
logger.trace("checking published GHNs");
|
||||||
|
Thread.sleep(40000);
|
||||||
ResultSet queryRes;
|
ResultSet queryRes;
|
||||||
for (int i=0; i<hostnames.length; i++){
|
for (int i=0; i<hostnames.length; i++){
|
||||||
if (arrayCheck[i]) continue;
|
if (arrayCheck[i]) continue;
|
||||||
queryRes= DBInterface.queryDB("select id from ghn where host='"+hostnames[i].getIp()+"'");
|
queryRes= DBInterface.queryDB("select id from ghn where host LIKE '"+hostnames[i].getIp()+"%'");
|
||||||
if (queryRes.next()) {
|
if (queryRes.next()) {
|
||||||
hostnames[i].setGhnId(queryRes.getString(1));
|
hostnames[i].setGhnId(queryRes.getString(1));
|
||||||
|
logger.trace("the host "+hostnames[i].getName()+" has been retrieved with ghn id "+hostnames[i].getGhnId());
|
||||||
arrayCheck[i]=true;
|
arrayCheck[i]=true;
|
||||||
this.report.getDeployingState().set(i, State.Finished);
|
this.report.getDeployingState()[i]= State.Finished;
|
||||||
DBInterface.ExecuteUpdate("update GHN set isoncloud='true' where id='"+hostnames[i].getGhnId()+"'");
|
DBInterface.ExecuteUpdate("update GHN set isoncloud='true' where id='"+hostnames[i].getGhnId()+"'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,33 +196,64 @@ public class DeployGHNsOnCloud{
|
||||||
private String name;
|
private String name;
|
||||||
private String ghnId;
|
private String ghnId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
public VM(String name) {
|
public VM(String name) {
|
||||||
super();
|
super();
|
||||||
this.ip=null;
|
this.ip=null;
|
||||||
this.ghnId=null;
|
this.ghnId=null;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the ip
|
||||||
|
*/
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ip the VM's ip
|
||||||
|
*/
|
||||||
public void setIp(String ip) {
|
public void setIp(String ip) {
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the VM name
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name the VM name
|
||||||
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the ghn ID
|
||||||
|
*/
|
||||||
public String getGhnId() {
|
public String getGhnId() {
|
||||||
return ghnId;
|
return ghnId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ghnId
|
||||||
|
*/
|
||||||
public void setGhnId(String ghnId) {
|
public void setGhnId(String ghnId) {
|
||||||
this.ghnId = ghnId;
|
this.ghnId = ghnId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,19 +62,18 @@ public class DeployVRE extends Thread{
|
||||||
private GCUBEScope startingScope;
|
private GCUBEScope startingScope;
|
||||||
private String vreName=null;
|
private String vreName=null;
|
||||||
private CollectionResourceCreation collectionResourceCreation;
|
private CollectionResourceCreation collectionResourceCreation;
|
||||||
private DeployReport report;
|
|
||||||
|
|
||||||
|
|
||||||
public DeployVRE(String resourceId, GCUBEScope scope) throws GCUBEFault, Exception{
|
public DeployVRE(String resourceId, GCUBEScope scope) throws GCUBEFault, Exception{
|
||||||
this.resourceId=resourceId;
|
this.resourceId=resourceId;
|
||||||
this.startingScope= scope;
|
this.startingScope= scope;
|
||||||
this.report= new DeployReport();
|
|
||||||
try{
|
try{
|
||||||
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name from VRE where VRE.id='"+this.resourceId+"'; ");
|
ResultSet resGenericInfo = DBInterface.queryDB("select VRE.name from VRE where VRE.id='"+this.resourceId+"'; ");
|
||||||
if (!resGenericInfo.next()) {
|
if (!resGenericInfo.next()) {
|
||||||
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
|
throw new GCUBEFault("The VRE with ID "+this.resourceId+" cannot be retrieved on the DB");
|
||||||
}
|
}
|
||||||
vreName= resGenericInfo.getString(1);
|
vreName= resGenericInfo.getString(1);
|
||||||
|
System.out.println(vreName);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("error retrieving the VRE Name",e);
|
logger.error("error retrieving the VRE Name",e);
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -91,6 +90,8 @@ public class DeployVRE extends Thread{
|
||||||
*/
|
*/
|
||||||
public void run(){
|
public void run(){
|
||||||
try {
|
try {
|
||||||
|
getResource().setDeployReport(new DeployReport());
|
||||||
|
|
||||||
//reports initialization
|
//reports initialization
|
||||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Running);
|
||||||
|
|
||||||
|
@ -98,15 +99,16 @@ public class DeployVRE extends Thread{
|
||||||
GHNstoUse ghnsToUse=null;
|
GHNstoUse ghnsToUse=null;
|
||||||
if (getResource().isUseCloud()){
|
if (getResource().isUseCloud()){
|
||||||
DeployGHNsOnCloud ghnOnCloud = new DeployGHNsOnCloud(getResource().getNumberOfVMsForCloud(), vreName);
|
DeployGHNsOnCloud ghnOnCloud = new DeployGHNsOnCloud(getResource().getNumberOfVMsForCloud(), vreName);
|
||||||
this.report.setCloudDeployingReport(ghnOnCloud.getReport());
|
getResource().getDeployReport().setCloudDeployingReport(ghnOnCloud.getReport());
|
||||||
try{
|
try{
|
||||||
ghnsToUse = ghnOnCloud.run();
|
ghnsToUse = ghnOnCloud.run();
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("error creating VMs on cloud",e);
|
logger.error("error creating VMs on cloud",e);
|
||||||
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Failed);
|
||||||
|
throw new Exception("error creating VMs on cloud",e);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
this.report.getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
|
getResource().getDeployReport().getCloudDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Skipped);
|
||||||
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain, VRERELATEDGHN.ISCANDIDATE from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"' ORDER BY GHN.host; ");
|
ResultSet resRelatedGHN=DBInterface.queryDB("select VRERELATEDGHN.ghnid, GHN.domain, VRERELATEDGHN.ISCANDIDATE from VRERELATEDGHN, GHN where GHN.id=VRERELATEDGHN.ghnid and VRERELATEDGHN.vreid='"+this.resourceId+"' ORDER BY GHN.host; ");
|
||||||
ghnsToUse = new GHNstoUse();
|
ghnsToUse = new GHNstoUse();
|
||||||
while (resRelatedGHN.next()) {
|
while (resRelatedGHN.next()) {
|
||||||
|
@ -116,9 +118,9 @@ public class DeployVRE extends Thread{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deployManagerOnVRE(ghnsToUse.candidateForRM)){
|
if (deployManagerOnVRE(ghnsToUse.candidateForRM)){
|
||||||
|
|
||||||
if (!createVRE(ghnsToUse.getGhns())){
|
if (createVRE(ghnsToUse.getGhns())){
|
||||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished+"' WHERE VRE.id='"+this.resourceId+"';");
|
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='"+org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished+"' WHERE VRE.id='"+this.resourceId+"';");
|
||||||
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
|
getResource().getDeployReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
|
||||||
getResource().store();
|
getResource().store();
|
||||||
|
@ -151,7 +153,6 @@ public class DeployVRE extends Thread{
|
||||||
|
|
||||||
|
|
||||||
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
|
private boolean deployManagerOnVRE(String candidateGhnId) throws GCUBEFault, ResourceException{
|
||||||
String vreName= null;
|
|
||||||
try {
|
try {
|
||||||
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
|
DBInterface.ExecuteUpdate("UPDATE VRE SET STATUS='Deploying' WHERE VRE.id='"+this.resourceId+"';");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -188,7 +189,9 @@ public class DeployVRE extends Thread{
|
||||||
arp.setServices(services);
|
arp.setServices(services);
|
||||||
arp.setTargetScope(this.scope+"/"+vreName);
|
arp.setTargetScope(this.scope+"/"+vreName);
|
||||||
String reportId=resourceManagerPT.addResources(arp);
|
String reportId=resourceManagerPT.addResources(arp);
|
||||||
|
logger.trace("the report id for Rm is "+reportId);
|
||||||
|
//waiting few seconds
|
||||||
|
Thread.currentThread().sleep(60000);
|
||||||
int attempt=0;
|
int attempt=0;
|
||||||
do{
|
do{
|
||||||
Thread.currentThread().sleep(20000);
|
Thread.currentThread().sleep(20000);
|
||||||
|
@ -198,10 +201,10 @@ public class DeployVRE extends Thread{
|
||||||
getResource().store();
|
getResource().store();
|
||||||
}while (!isDeploymentStatusFinished(report) && attempt<10);
|
}while (!isDeploymentStatusFinished(report) && attempt<10);
|
||||||
|
|
||||||
}catch(Exception e){e.printStackTrace(); throw e;}
|
}catch(Exception e){logger.error("error deploying RM on VRE",e); throw e;}
|
||||||
logger.trace("report step 1: "+report);
|
logger.trace("report step 1: "+report);
|
||||||
logger.info("is something failed in the first step?"+isSomethingFailed(report));
|
logger.info("is something failed in the first step?"+isSomethingFailed(report));
|
||||||
return isSomethingFailed(report);
|
return !isSomethingFailed(report);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -218,7 +221,6 @@ public class DeployVRE extends Thread{
|
||||||
logger.error("DeployingVRE step 1 -- failed "+e);
|
logger.error("DeployingVRE step 1 -- failed "+e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.vreName= vreName;
|
|
||||||
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
|
collectionResourceCreation= new CollectionResourceCreation(this.resourceId, this.vreName);
|
||||||
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
|
getResource().getDeployReport().getResourceManagerDeployingReport().setState(org.gcube.vremanagement.vremodeler.stubs.deployreport.State.Finished);
|
||||||
getResource().store();
|
getResource().store();
|
||||||
|
@ -294,6 +296,8 @@ public class DeployVRE extends Thread{
|
||||||
String report=null;
|
String report=null;
|
||||||
String reportId=rmPortType.createScope(scopeParameter);
|
String reportId=rmPortType.createScope(scopeParameter);
|
||||||
|
|
||||||
|
logger.trace("the report id for Rm is "+reportId);
|
||||||
|
|
||||||
int reportAttempt=0;
|
int reportAttempt=0;
|
||||||
do{
|
do{
|
||||||
try{
|
try{
|
||||||
|
@ -309,7 +313,7 @@ public class DeployVRE extends Thread{
|
||||||
|
|
||||||
logger.info("is something failed in the second step?"+isSomethingFailed(report));
|
logger.info("is something failed in the second step?"+isSomethingFailed(report));
|
||||||
logger.trace("report step 2: "+report);
|
logger.trace("report step 2: "+report);
|
||||||
return isSomethingFailed(report);
|
return !isSomethingFailed(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class GHNHandler implements ResourceHandler<GCUBEHostingNode> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insert(GCUBEHostingNode ghn) throws Exception {
|
private void insert(GCUBEHostingNode ghn) throws Exception {
|
||||||
|
|
||||||
|
//GHN(ID VARCHAR NOT NULL PRIMARY KEY,HOST VARCHAR,SECURITY VARCHAR,UPTIME VARCHAR,MAINMEMORYVA VARCHAR,MAINMEMORYVS VARCHAR,LOCALAS VARCHAR,LOCATION VARCHAR,COUNTRY VARCHAR,DOMAIN VARCHAR, ISONCLOUD BOOLEAN)
|
||||||
ArrayList<String> row= new ArrayList<String>(10);
|
ArrayList<String> row= new ArrayList<String>(10);
|
||||||
String id= ghn.getID();
|
String id= ghn.getID();
|
||||||
row.add(id);
|
row.add(id);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
package org.gcube.vremanagement.vremodeler.stubs.deployreport;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GHNonCloudReport implements Serializable {
|
public class GHNonCloudReport implements Serializable {
|
||||||
/**
|
/**
|
||||||
|
@ -13,11 +10,10 @@ public class GHNonCloudReport implements Serializable {
|
||||||
|
|
||||||
private State state;
|
private State state;
|
||||||
|
|
||||||
private List<State> deployingState= new ArrayList<State>();
|
private State[] deployingState;
|
||||||
|
|
||||||
public GHNonCloudReport() {
|
public GHNonCloudReport() {
|
||||||
this.state= State.Waiting;
|
this.state= State.Waiting;
|
||||||
Collections.fill(this.deployingState, State.Waiting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,11 +25,11 @@ public class GHNonCloudReport implements Serializable {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<State> getDeployingState() {
|
public State[] getDeployingState() {
|
||||||
return deployingState;
|
return deployingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeployingState(List<State> deployingState) {
|
public void setDeployingState(State[] deployingState) {
|
||||||
this.deployingState = deployingState;
|
this.deployingState = deployingState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,17 @@
|
||||||
package org.gcube.vremanagement.vremodeler.test;
|
package org.gcube.vremanagement.vremodeler.test;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||||
|
import org.apache.axis.types.URI;
|
||||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
|
||||||
import org.gcube.common.core.informationsystem.client.AtomicCondition;
|
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
|
||||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
|
||||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.types.VOID;
|
import org.gcube.common.core.types.VOID;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
|
import org.gcube.vremanagement.vremodeler.stubs.CollectionArray;
|
||||||
|
import org.gcube.vremanagement.vremodeler.stubs.CollectionList;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
|
import org.gcube.vremanagement.vremodeler.stubs.FunctionalityIDArray;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.GHNArray;
|
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType;
|
import org.gcube.vremanagement.vremodeler.stubs.ModelerFactoryPortType;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType;
|
import org.gcube.vremanagement.vremodeler.stubs.ModelerServicePortType;
|
||||||
|
import org.gcube.vremanagement.vremodeler.stubs.VREDescription;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerFactoryServiceAddressingLocator;
|
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerFactoryServiceAddressingLocator;
|
||||||
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressingLocator;
|
import org.gcube.vremanagement.vremodeler.stubs.service.ModelerServiceAddressingLocator;
|
||||||
|
|
||||||
|
@ -31,10 +26,11 @@ public class ModelerTest {
|
||||||
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
|
GCUBERIQuery riquery= client.getQuery(GCUBERIQuery.class);
|
||||||
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
|
riquery.addAtomicConditions(new AtomicCondition("//ServiceName", "VREModeler"));
|
||||||
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope(args[0]));
|
List<GCUBERunningInstance> results=client.execute(riquery, GCUBEScope.getScope(args[0]));
|
||||||
|
*/
|
||||||
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
|
ModelerFactoryServiceAddressingLocator mfal =new ModelerFactoryServiceAddressingLocator();
|
||||||
EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
|
/*EndpointReferenceType epr= results.get(0).getAccessPoint().getEndpoint("gcube/vremanagement/vremodeler/ModelerFactoryService");
|
||||||
System.out.println(epr);
|
System.out.println(epr);*/
|
||||||
|
EndpointReferenceType epr= new EndpointReferenceType(new URI("http://nb-lelii.isti.cnr.it:8080/wsrf/services/gcube/vremanagement/vremodeler/ModelerFactoryService"));
|
||||||
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
|
ModelerFactoryPortType mfptp= mfal.getModelerFactoryPortTypePort(epr);
|
||||||
|
|
||||||
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
|
mfptp = GCUBERemotePortTypeContext.getProxy(mfptp, GCUBEScope.getScope(args[0]));
|
||||||
|
@ -43,40 +39,57 @@ public class ModelerTest {
|
||||||
|
|
||||||
ModelerServiceAddressingLocator msal= new ModelerServiceAddressingLocator();
|
ModelerServiceAddressingLocator msal= new ModelerServiceAddressingLocator();
|
||||||
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(eprModelerRes);
|
ModelerServicePortType msptp=msal.getModelerServicePortTypePort(eprModelerRes);
|
||||||
|
|
||||||
|
|
||||||
msptp = GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope(args[0]));
|
msptp = GCUBERemotePortTypeContext.getProxy(msptp, GCUBEScope.getScope(args[0]));
|
||||||
|
|
||||||
|
|
||||||
System.out.println("creation requested");
|
System.out.println("creation requested");
|
||||||
VRERequest vreReq= new VRERequest();
|
|
||||||
vreReq.setStartTime(new Date().getTime());
|
|
||||||
vreReq.setEndTime(new Date().getTime());
|
|
||||||
vreReq.setVREDescription("desc");
|
|
||||||
vreReq.setVREDesigner("Lucio");
|
|
||||||
vreReq.setVREManager("Lucio");
|
|
||||||
vreReq.setVREName("test");
|
|
||||||
msptp.setVREModel(vreReq);
|
|
||||||
|
|
||||||
System.out.println("first call done");
|
|
||||||
System.out.println(msptp.getGHNs(new VOID()));
|
|
||||||
|
|
||||||
/*
|
|
||||||
CollectionArray ca= new CollectionArray();
|
VREDescription vreReq= new VREDescription();
|
||||||
ca.setCollectionElement(new String[]{"e60f6340-e970-11dd-bb52-d1724dda0823"});
|
Calendar cal= Calendar.getInstance();
|
||||||
msptp.setCollection(ca);
|
vreReq.setStartTime(Calendar.getInstance());
|
||||||
|
cal.add(Calendar.MONTH, 1);
|
||||||
|
vreReq.setEndTime(cal);
|
||||||
|
vreReq.setDescription("desc");
|
||||||
|
vreReq.setDesigner("Lucio");
|
||||||
|
vreReq.setManager("Lucio");
|
||||||
|
vreReq.setName("testCloud");
|
||||||
|
msptp.setDescription(vreReq);
|
||||||
|
System.out.println("description set");
|
||||||
|
|
||||||
|
CollectionList cl=msptp.getCollection(new VOID());
|
||||||
|
|
||||||
|
System.out.println("collection list is null?"+(cl.getList()==null));
|
||||||
|
|
||||||
|
for(int i=0; i< cl.getList().length; i++)
|
||||||
|
System.out.println(i+" - "+cl.getList(i));
|
||||||
|
|
||||||
|
msptp.setCollection(new CollectionArray(new String[]{cl.getList(0).getId()}));
|
||||||
|
|
||||||
|
System.out.println("collection set");
|
||||||
|
|
||||||
FunctionalityIDArray fida= new FunctionalityIDArray();
|
FunctionalityIDArray fida= new FunctionalityIDArray();
|
||||||
fida.setFunctionalityIDElement(new String[]{"0"});
|
fida.setFunctionalityIDElement(new String[]{"0"});
|
||||||
msptp.setFunctionality(fida);
|
msptp.setFunctionality(fida);
|
||||||
|
|
||||||
GHNArray ghnArray= new GHNArray();
|
System.out.println("functionality set");
|
||||||
ghnArray.setGHNElement(new String[]{"64033f00-ea3a-11dd-af49-d0586efd3870","29b7ff70-ea3a-11dd-810a-d18bf0285315"});
|
|
||||||
msptp.setGHNs(ghnArray);
|
|
||||||
|
|
||||||
System.out.println("-"+msptp.checkStatus(new VOID()).getReports(0)+"-");
|
msptp.setUseCloud(true);
|
||||||
|
msptp.setCloudVMs(2);
|
||||||
|
|
||||||
|
|
||||||
|
//msptp.setUseCloud(false);
|
||||||
|
//msptp.setGHNs(new GHNArray(new String[]{"af63ccc0-d6a7-11df-b524-ba33a5c87470","73ceb130-e844-11df-a7f0-e529e2191760"},"af63ccc0-d6a7-11df-b524-ba33a5c87470"));
|
||||||
|
|
||||||
msptp.deployVRE(new VOID());
|
msptp.deployVRE(new VOID());
|
||||||
*/
|
|
||||||
|
for (int i=0; i<200; i++){
|
||||||
|
Thread.sleep(30000);
|
||||||
|
System.out.println("report is:");
|
||||||
|
System.out.println(msptp.checkStatus(new VOID()));
|
||||||
|
}
|
||||||
|
|
||||||
}catch(Exception e){e.printStackTrace();}
|
}catch(Exception e){e.printStackTrace();}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue