Commit 03b20b8c authored by Spiros Koulouzis's avatar Spiros Koulouzis

clean up v0

parent a9cb2403
......@@ -24,7 +24,7 @@ topology_template:
relationship: tosca.relationships.DependsOn
- vm:
capability: tosca.capabilities.ARTICONF.VM
node: nancy_compute
node: charles_compute
relationship: tosca.relationships.DependsOn
type: tosca.nodes.ARTICONF.VM.topology
charles_compute:
......
......@@ -105,10 +105,7 @@ node_types:
- greater_or_equal: 0 MB
os:
type: string
required: true
ssh_key:
type: string
required: false
required: true
interfaces:
Standard:
create: dumy.yaml
......@@ -140,7 +137,7 @@ node_types:
required: true
credential:
type: tosca.datatypes.Credential
required: false
required: false
interfaces:
Standard:
create: dumy.yaml
......
......@@ -8,13 +8,10 @@
<api-classes>
<include pattern="nl.uva.sne.drip.api.v1.rest.*" />
<include pattern="nl.uva.sne.drip.api.v0.rest.*" />
</api-classes>
<api-import pattern="nl.uva.sne.drip.drip.commons.data.v1.external.*"/>
<api-import pattern="nl.uva.sne.drip.drip.commons.data.v1.external.ansible.*"/>
<api-import pattern="nl.uva.sne.drip.drip.commons.data.v0.external.*"/>
<api-import pattern="nl.uva.sne.drip.drip.commons.data.v1.external.ansible.*"/>
<modules>
<swagger disabled="true" />
......
......@@ -201,12 +201,6 @@ public class PlannerService {
if (plan == null) {
throw new NotFoundException();
}
Set<String> lowIds = plan.getLoweLevelPlanIDs();
if (lowIds != null) {
for (String lId : lowIds) {
planDao.delete(lId);
}
}
planDao.delete(plan);
return plan;
}
......
......@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -38,7 +37,6 @@ import nl.uva.sne.drip.api.exception.ExceptionHandler;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.exception.PlanNotFoundException;
import nl.uva.sne.drip.api.rpc.DRIPCaller;
import nl.uva.sne.drip.api.rpc.ProvisionerCaller0;
import nl.uva.sne.drip.api.v1.rest.ProvisionController;
import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.drip.commons.data.v1.external.CloudCredentials;
......@@ -48,9 +46,7 @@ import nl.uva.sne.drip.drip.commons.data.internal.MessageParameter;
import nl.uva.sne.drip.drip.commons.data.v1.external.PlanResponse;
import nl.uva.sne.drip.drip.commons.data.v1.external.ProvisionRequest;
import nl.uva.sne.drip.drip.commons.data.v1.external.ProvisionResponse;
import nl.uva.sne.drip.drip.commons.data.v1.external.Script;
import nl.uva.sne.drip.drip.commons.data.v1.external.User;
import org.apache.commons.io.FilenameUtils;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PostAuthorize;
......@@ -192,32 +188,6 @@ public class ProvisionService {
}
// private List<MessageParameter> buildCertificatesParam(CloudCredentials cred) {
//// List<String> loginKeysIDs = cred.getkeyPairIDs();
// List<KeyPair> loginKeys = new ArrayList<>();
//// for (String keyID : loginKeysIDs) {
//// KeyPair key = keyDao.findOne(keyID);
//// loginKeys.add(key);
//// }
// if (loginKeys.isEmpty()) {
// throw new BadRequestException("Log in keys can't be empty");
// }
// List<MessageParameter> parameters = new ArrayList<>();
// for (KeyPair lk : loginKeys) {
// String domainName = lk.getPrivateKey().getAttributes().get("domain_name");
// if (domainName == null) {
// domainName = lk.getPrivateKey().getAttributes().get("domain_name ");
// }
// MessageParameter cert = new MessageParameter();
// cert.setName("certificate");
// cert.setValue(lk.getPrivateKey().getKey());
// Map<String, String> attributes = new HashMap<>();
// attributes.put("filename", domainName);
// cert.setAttributes(attributes);
// parameters.add(cert);
// }
// return parameters;
// }
private List<MessageParameter> buildTopologyParams(String planID) throws JSONException, FileNotFoundException {
PlanResponse plan = simplePlanService.getDao().findOne(planID);
......@@ -232,27 +202,8 @@ public class ProvisionService {
String encodedValue = new String(Base64.encodeBase64(val.getBytes()));
topology.setValue(encodedValue);
Map<String, String> attributes = new HashMap<>();
// attributes.put("level", String.valueOf(plan.getLevel()));
// attributes.put("filename", FilenameUtils.removeExtension(plan.getName()));
topology.setAttributes(attributes);
parameters.add(topology);
// Set<String> ids = plan.getLoweLevelPlanIDs();
// if (ids != null) {
// for (String lowID : ids) {
// PlanResponse lowPlan = simplePlanService.getDao().findOne(lowID);
// topology = new MessageParameter();
// topology.setName("topology");
// String value = Converter.map2YmlString(lowPlan.getKeyValue());
// value = value.replaceAll("\\uff0E", ".");
// topology.setValue(value);
// attributes = new HashMap<>();
//// attributes.put("level", String.valueOf(lowPlan.getLevel()));
//// attributes.put("filename", FilenameUtils.removeExtension(lowPlan.getName()));
// topology.setAttributes(attributes);
// parameters.add(topology);
// }
// }
return parameters;
}
......@@ -280,63 +231,63 @@ public class ProvisionService {
private List<MessageParameter> buildClusterKeyParams(ProvisionResponse provisionInfo) {
List<MessageParameter> parameters = new ArrayList();
List<String> ids = provisionInfo.getDeployerKeyPairIDs();
for (String id : ids) {
KeyPair pair = keyPairService.findOne(id);
MessageParameter param = new MessageParameter();
param.setName("private_deployer_key");
param.setValue(pair.getPrivateKey().getKey());
HashMap<String, String> attributes = new HashMap<>();
if (pair.getPrivateKey() != null && pair.getPrivateKey().getAttributes() != null) {
attributes.putAll(pair.getPrivateKey().getAttributes());
}
attributes.put("name", pair.getPrivateKey().getName());
param.setAttributes(attributes);
parameters.add(param);
param = new MessageParameter();
param.setName("public_deployer_key");
param.setValue(pair.getPublicKey().getKey());
attributes = new HashMap<>();
if (pair.getPublicKey() != null && pair.getPublicKey().getAttributes() != null) {
attributes.putAll(pair.getPublicKey().getAttributes());
}
param.setAttributes(attributes);
attributes.put("name", pair.getPublicKey().getName());
parameters.add(param);
}
// List<String> ids = provisionInfo.getDeployerKeyPairIDs();
// for (String id : ids) {
// KeyPair pair = keyPairService.findOne(id);
//
// MessageParameter param = new MessageParameter();
// param.setName("private_deployer_key");
// param.setValue(pair.getPrivateKey().getKey());
// HashMap<String, String> attributes = new HashMap<>();
// if (pair.getPrivateKey() != null && pair.getPrivateKey().getAttributes() != null) {
// attributes.putAll(pair.getPrivateKey().getAttributes());
// }
// attributes.put("name", pair.getPrivateKey().getName());
// param.setAttributes(attributes);
// parameters.add(param);
//
// param = new MessageParameter();
// param.setName("public_deployer_key");
// param.setValue(pair.getPublicKey().getKey());
// attributes = new HashMap<>();
// if (pair.getPublicKey() != null && pair.getPublicKey().getAttributes() != null) {
// attributes.putAll(pair.getPublicKey().getAttributes());
// }
// param.setAttributes(attributes);
// attributes.put("name", pair.getPublicKey().getName());
// parameters.add(param);
// }
return parameters;
}
private List<MessageParameter> buildUserKeyParams(ProvisionResponse provisionInfo) {
List<MessageParameter> parameters = new ArrayList();
List<String> ids = provisionInfo.getUserKeyPairIDs();
for (String id : ids) {
KeyPair pair = keyPairService.findOne(id);
MessageParameter param = new MessageParameter();
param.setName("private_user_key");
param.setValue(pair.getPrivateKey().getKey());
HashMap<String, String> attributes = new HashMap<>();
if (pair.getPrivateKey().getAttributes() != null) {
attributes.putAll(pair.getPrivateKey().getAttributes());
}
attributes.put("name", pair.getPrivateKey().getName());
param.setAttributes(attributes);
parameters.add(param);
param = new MessageParameter();
param.setName("public_user_key");
param.setValue(pair.getPublicKey().getKey());
if (pair.getPublicKey().getAttributes() != null) {
attributes.putAll(pair.getPublicKey().getAttributes());
}
attributes.put("name", pair.getPublicKey().getName());
param.setAttributes(attributes);
parameters.add(param);
}
// List<String> ids = provisionInfo.getUserKeyPairIDs();
// for (String id : ids) {
// KeyPair pair = keyPairService.findOne(id);
//
// MessageParameter param = new MessageParameter();
// param.setName("private_user_key");
// param.setValue(pair.getPrivateKey().getKey());
// HashMap<String, String> attributes = new HashMap<>();
// if (pair.getPrivateKey().getAttributes() != null) {
// attributes.putAll(pair.getPrivateKey().getAttributes());
// }
// attributes.put("name", pair.getPrivateKey().getName());
// param.setAttributes(attributes);
// parameters.add(param);
//
// param = new MessageParameter();
// param.setName("public_user_key");
// param.setValue(pair.getPublicKey().getKey());
// if (pair.getPublicKey().getAttributes() != null) {
// attributes.putAll(pair.getPublicKey().getAttributes());
// }
// attributes.put("name", pair.getPublicKey().getName());
// param.setAttributes(attributes);
// parameters.add(param);
// }
return parameters;
}
......
......@@ -64,10 +64,10 @@ public class SimplePlannerService {
Message plannerReturnedMessage = (planner.call(plannerInvokationMessage));
List<MessageParameter> planFiles = plannerReturnedMessage.getParameters();
topLevel = new PlanResponse();
Set<String> ids = topLevel.getLoweLevelPlanIDs();
if (ids == null) {
ids = new HashSet<>();
}
// Set<String> ids = topLevel.getLoweLevelPlanIDs();
// if (ids == null) {
// ids = new HashSet<>();
// }
PlanResponse lowerLevelPlan = null;
for (MessageParameter p : planFiles) {
//Should have levels in attributes
......@@ -87,10 +87,10 @@ public class SimplePlannerService {
lowerLevelPlan.setKvMap(Converter.ymlString2Map(p.getValue()));
// lowerLevelPlan.setLevel(1);
planDao.save(lowerLevelPlan);
ids.add(lowerLevelPlan.getId());
// ids.add(lowerLevelPlan.getId());
}
}
topLevel.setLoweLevelPlansIDs(ids);
// topLevel.setLoweLevelPlansIDs(ids);
}
topLevel.setToscaID(toscaId);
planDao.save(topLevel);
......@@ -135,11 +135,11 @@ public class SimplePlannerService {
}
Map<String, Object> map = plan.getKeyValue();
Set<String> ids = plan.getLoweLevelPlanIDs();
for (String lowID : ids) {
Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKeyValue();
map.putAll(lowLevelMap);
}
// Set<String> ids = plan.getLoweLevelPlanIDs();
// for (String lowID : ids) {
// Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKeyValue();
// map.putAll(lowLevelMap);
// }
if (fromat != null && fromat.equals("yml")) {
String ymlStr = Converter.map2YmlString(map);
......
......@@ -197,25 +197,25 @@ public class PlannerController {
return plannerService.saveStringContents(toscaContents, 0, name);
}
@RequestMapping(value = "/post/{level}/{name}/{id}", method = RequestMethod.POST)
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
String postLow(@RequestBody String toscaContents, @PathVariable("level") String level, @PathVariable("name") String name, @PathVariable("id") String id) {
int intLevel = Integer.valueOf(level);
if (intLevel == 0) {
return plannerService.saveStringContents(toscaContents, 0, name);
}
PlanResponse topPlan = plannerService.findOne(id);
Set<String> lowIDs = topPlan.getLoweLevelPlanIDs();
if (lowIDs == null) {
lowIDs = new HashSet<>();
}
String lowPlanID = plannerService.saveStringContents(toscaContents, intLevel, name);
lowIDs.add(lowPlanID);
topPlan.setLoweLevelPlansIDs(lowIDs);
topPlan = plannerService.save(topPlan);
return topPlan.getId();
}
// @RequestMapping(value = "/post/{level}/{name}/{id}", method = RequestMethod.POST)
// @RolesAllowed({UserService.USER, UserService.ADMIN})
// public @ResponseBody
// String postLow(@RequestBody String toscaContents, @PathVariable("level") String level, @PathVariable("name") String name, @PathVariable("id") String id) {
// int intLevel = Integer.valueOf(level);
// if (intLevel == 0) {
// return plannerService.saveStringContents(toscaContents, 0, name);
// }
//
// PlanResponse topPlan = plannerService.findOne(id);
// Set<String> lowIDs = topPlan.getLoweLevelPlanIDs();
// if (lowIDs == null) {
// lowIDs = new HashSet<>();
// }
// String lowPlanID = plannerService.saveStringContents(toscaContents, intLevel, name);
// lowIDs.add(lowPlanID);
// topPlan.setLoweLevelPlansIDs(lowIDs);
// topPlan = plannerService.save(topPlan);
// return topPlan.getId();
// }
}
......@@ -36,7 +36,6 @@ import org.yaml.snakeyaml.Yaml;
import nl.uva.sne.drip.drip.commons.data.internal.Message;
import nl.uva.sne.drip.drip.commons.data.internal.MessageParameter;
import nl.uva.sne.drip.drip.commons.data.v0.external.Attribute;
import nl.uva.sne.drip.drip.commons.data.v1.external.PlanResponse;
/**
......@@ -209,31 +208,6 @@ public class Converter {
return mess;
}
public static Attribute plan1toFile(PlanResponse plan1) throws JSONException {
Attribute e = new Attribute();
// e.level = String.valueOf(plan1.getLevel());
// String p1Name = FilenameUtils.getBaseName(plan1.getName());
// if (p1Name == null) {
// p1Name = "Planned_tosca_file_" + plan1.getLevel();
// plan1.setName(p1Name);
// }
// e.name = p1Name;
String ymlString = Converter.map2YmlString(plan1.getKeyValue());
e.content = ymlString.replaceAll("\n", "\\\\n");
return e;
}
public static PlanResponse File2Plan1(Attribute p0) {
PlanResponse p1 = new PlanResponse();
// p1.setLevel(Integer.valueOf(p0.level));
// p1.setName(p0.name);
String yaml = p0.content.replaceAll("\\\\n", "\n");
p1.setKvMap(ymlString2Map(yaml));
return p1;
}
public static Map<String, Object> cleanStringContents(String ymlContents, boolean removeNewLine) {
if (removeNewLine) {
//Remove '\' and 'n' if they are together and replace them with '\n'
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
/**
*
* @author S. Koulouzis
*/
public class Attribute {
/**
* Name of the file/public key.
*/
@DocumentationExample("planner_output_all")
@XmlAttribute
public String name;
/**
* There are two levels of description files for topologies designed by users.
* If the level attribute for the element file is 1, then this file is the top-level description,
* which defines how the sub-topologies are connected to each other.
* If the level attribute is 0, then the file is the low-level description,
* which describes the topology in one data center in detail.
* On the other hand, the name of low-level description file must be the
* sub-topology name appeared in the high-level description file. (For example, here should be zh_a and zh_b.)
*/
@DocumentationExample("0")
@XmlAttribute
public String level;
@XmlValue
public String content;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class ConfScript extends Execute {
/**
* The script contents with new lines replace by '\n'
*/
@DocumentationExample("#!/bin/bash\\n\\nlogstashScript=/root/runLogstash.sh\\nscreen -S logstash -dm /bin/bash \"$logstashScript\"\\n\\n\\nlogLevelPath=/root/\\nlogLevelFile=$logLevelPath/logstash_loglevel.csv\\nremotePath=/media/lobcder/skoulouz/\\nremoteLogPath=$remotePath/logs\\nlocalLogPath=/root/logs\\n\\nmkdir $localLogPath\\n\\n\\nfor logArchPath in $remoteLogPath/*.gz; do\\n echo \"File -> $logArchPath\"\\n if [ ! -f $logArchPath.lock ]; then\\n touch $logArchPath.lock\\n cp $logArchPath $localLogPath\\n logArchName=$(basename $logArchPath)\\n tar -xvf $localLogPath/$logArchName -C $localLogPath\\n sleep 120\\n modTime=-100\\n while [ ! -f $logLevelFile ]\\n do\\n sleep 5\\n done\\n while [ $modTime -lt 120 ]\\n do\\n moddate=$(stat -c %Y $logLevelFile)\\n moddate=${moddate%% *}\\n now=$(date +%s)\\n modTime=\"$(( $now - $moddate))\"\\n echo $modTime\\n sleep 5\\n done\\n rm $localLogPath/*.tar.gz\\n rm $localLogPath/*.log\\n modTime=-100\\n fi\\ndone\\n \\n\\nscreen -X -S logstash quit\\nsleep 5\\n\\nuid=`ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g'`\\n\\nfor csvFiles in $logLevelPath/*.csv; do\\n echo $csvFiles $csvFiles$uid.csv\\n mv $csvFiles $csvFiles$uid.csv\\n cp $csvFiles$uid.csv $remotePath\\ndone\\n\\nkillall java \\n")
public String script;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class ConfUserKey extends Execute {
@XmlElement(name = "userKey")
public List<Attribute> file;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Configure {
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("user")
public String user;
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("123")
public String pwd;
/**
* The key id for the cloud provider.
*
*/
@DocumentationExample("AKIAITY3K5ZUQ6M7YBSQ")
public String keyid;
/**
* The key for the cloud provider.
*/
@DocumentationExample("6J7uo99ifrff45126Gsy5vgb3bmrtwY6hBxtYt9y")
public String key;
@XmlElement(name = "loginKey")
public List<LoginKey0> loginKey;
/**
* The binary keystore (user.jks) for the cloud provider encoded in base64
*/
@DocumentationExample("/u3+7QAAAAIAAAABAWuf2AAACvDCCArgwDgYKKwYBBEBAQUABIIC\\npKlNUfpKLNCy0h8P4L5XeECwwIN/tezeaOVsjvzLsXeiBsB/luYv9gttoeKFbcJb/IDpZr\\nfpL1tjF8Sed6g38kNoWwnVVoNZ1ILpITjESL6FkZW+gGAPS+XHp8l52/2DjeECQlx+38GlFUftWP\\nn3QH9bDYD+7sRtm4P0YWnekX67ltQHMV+Cyrg0HAFm+GUzJJoxu64MccURLBMw0If9gCmTOuVoRj\\nprPukU+cMY8torQ3+WmzC0S6U10HjQ2AkJ80HwM6CcS82qflHIBfQ/o7ep76rCDN22widcLGOihU\\nbJiNQtNdF6KRCJk0emVIvRHDHctsmmt2ao2Qx6ub2mA/eUZtlphHMVN5VQtSxdd87tKrH9FvaOe3\\nGX/irmBBopS2mfFee4LPn3FT/F5bl9YunygX3sWLGNsCl8G15hzgSSVn4As37czUulj8hks/Qpvu\\nqoVpegs2+m5mXbSMmif+cUPqyJZ8UL5slIGZMKQ7MJG1XVG6vFIHk3cS+L+NpDd2j8DZqBP5FXIO\\nCt/IxZxR2ZfPHHmIbOhwdnaznOoyAEGDzFTXnyTClGTDTW/6zxOe/ynNPlnBQaNqVJYqPtFG4AVs\\nhrSNuvYjm1xsVDROQI5LYF/nryU4VvqMTo2sjVP2g6Qw7E5ENWiYUAl2W+bk4H6WGDTdQgLm2J65\\ngdZpQTQtubzWi8Fxrptqul5eq96l0xH15XQ9lBKV0J8PEMa1jKOW/9s2U++hAtKTixssVntaNyUY\\n9dnXNYHnQRKXDrQr/izerNEhvlVcz6foWDurtjAIjxafyEBbXJ5TAyT4rxmkPxDg88LPXKCzpf1x\\n3WwD8MBUNBC9nfB37rHxEl7StvnK3IXBHmEksg7X6xhmUsrsQo8mfP05XDmqt+lsiYoAAAACAAVY\\nLjUwOQAAAz8wggM7MIICpKADAgECAgJFBDANBgkqhkiG9w0BAQUFADCBiTEUMBIGA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6HQCZCl1XuAEZQPse3/x\\nT2smC3LzAH4UUj3gEBq27VvxbqzazdBQCSeBEl2RUd+KoDzmhG5vBbAyHt8UE6s3P7Yx\\ngoNYTld0JHB5wq3XFRaaGbeVgo2AuK9S/Q3whzMTRW21a58tLP5zwKGzX3oyQQUT5J\\ncwv0z5NmJdAfk8Y=")
public String geniKey;
/**
* Key alias in key store
*/
@DocumentationExample("exogeni")
public String geniKeyAlias;
@XmlElement(name = "loginPubKey")
public List<LoginKey0> loginPubKey;
public String geniKeyPass;
@XmlElement(name = "loginPriKey")
public List<LoginKey0> loginPriKey;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Deploy extends Execute {
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Execute {
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("user")
public String user;
/**
* Not used. It's there for backwards compatibility.
*/
@DocumentationExample("123")
public String pwd;
/**
* A referance id used from the servcie to do the provisioning
*/
@DocumentationExample("58c2c2f3a8d4b56889878d03")
public String action;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
/**
*
* @author S. Koulouzis
*/
public class LoginKey0 {
@XmlAttribute(name="domain_name")
public String domain_name;
@XmlValue
public String content;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* This class represents a plan to be provided to the planner.
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Plan implements Serializable {
/**
* Not used. It's only there for backwords compatibility
*/
@DocumentationExample("user")
public String user;
/**
* Not used. It's only there for backwords compatibility
*/
@DocumentationExample("123")
public String pwd;
/**
* The contents of the TOSCA description
*/
@DocumentationExample("tosca_definitions_version: tosca_simple_yaml_1_0\\n\\n\\ndescription: example file for infrastructure planner\\n\\n\\nrepositories:\\n MOG_docker_hub: \\n description: MOG project’s code repository in GitHub\\n url: https://github.com/switch-project/mog\\n credential:\\n protocol: xauth\\n token_type: X-Auth-Token\\n # token encoded in Base64\\n token: 604bbe45ac7143a79e14f3158df67091\\n\\n\\nartifact_types:\\n tosca.artifacts.Deployment.Image.Container.Docker:\\n derived_from: tosca.artifacts.Deployment.Image\\n\\n\\ndata_types:\\n Switch.datatypes.QoS.AppComponent:\\n derived_from: tosca.datatypes.Root\\n properties:\\n response_time:\\n type: string\\n\\n Switch.datatypes.Application.Connection.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n component_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Application.Connection.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n Switch.datatypes.Network.EndPoint:\\n derived_from: tosca.datatypes.Root\\n properties:\\n address:\\n type: string\\n host_name:\\n type: string\\n netmask:\\n type: string\\n port_name:\\n type: string\\n\\n Switch.datatypes.Network.Multicast:\\n derived_from: tosca.datatypes.Root\\n properties:\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n\\n\\nnode_types:\\n\\n Switch.nodes.Application.Container.Docker:\\n derived_from: tosca.nodes.Container.Application\\n properties:\\n QoS:\\n type: Switch.datatypes.QoS.AppComponent\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n interfaces:\\n Standard:\\n create:\\n inputs:\\n command:\\n type: string\\n exported_ports:\\n type: list\\n entry_schema:\\n type: string\\n port_bindings:\\n type: list\\n entry_schema:\\n type: string\\n\\n Switch.nodes.Application.Container.Docker.MOG.InputDistributor:\\n derived_from: Switch.nodes.Application.Container.Docker\\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/InputDistributor:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n inPort: \\n type: integer\\n waitingTime:\\n type: integer\\n multicastAddrIP:\\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder:\\n derived_from: Switch.nodes.Application.Container.Docker \\n artifacts:\\n docker_image:\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n repository: MOG_docker_hub\\n properties:\\n multicastAddrIP: \\n type: string\\n multicastAddrPort:\\n type: integer\\n videoWidth:\\n type: integer\\n videoHeight:\\n type: integer\\n\\n Switch.nodes.Application.Connection:\\n derived_from: tosca.nodes.Root \\n properties:\\n source:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n target:\\n type: Switch.datatypes.Application.Connection.EndPoint\\n bandwidth:\\n type: string\\n latency: \\n type: string\\n jitter: \\n type: string\\n multicast:\\n type: Switch.datatypes.Application.Connection.Multicast\\n\\n Switch.nodes.Compute:\\n derived_from: tosca.nodes.Compute\\n properties:\\n OStype:\\n type: string\\n nodetype:\\n type: string\\n domain:\\n type: string\\n public_address:\\n type: string\\n \n"
+ " ethernet_port:\\n type: list\\n entry_schema:\\n type: tosca.datatypes.network.NetworkInfo\\n script:\\n type: string\\n installation:\\n type: string\\n ssh_credential:\\n type: tosca.datatypes.Credential\\n\\n Switch.nodes.Network:\\n derived_from: tosca.nodes.network.Network\\n properties:\\n bandwidth:\\n type: string\\n latency:\\n type: string\\n jitter:\\n type: string\\n source:\\n type: Switch.datatypes.Network.EndPoint\\n target:\\n type: Switch.datatypes.Network.EndPoint\\n multicast:\\n type: Switch.datatypes.Network.Multicast\\n\\n\\ntopology_template:\\n \\n node_templates:\\n 2d13d708e3a9441ab8336ce874e08dd1:\\n type: Switch.nodes.Application.Container.Docker.MOG.InputDistributor\\n artifacts:\\n docker_image:\\n file: \"mogswitch/InputDistributor:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n inPort: 2000\\n waitingTime: 5\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: InputDistributor\\n exported_ports:\\n - 2000\\n port_bindings:\\n - \"2000:2000\"\\n - \"3000:3000\"\\n\\n 8fcc1788d9ee462c826572c79fdb2a6a:\\n type: Switch.nodes.Application.Container.Docker.MOG.ProxyTranscoder\\n artifacts:\\n docker_image:\\n file: \"mogswitch/ProxyTranscoder:1.0\"\\n type: tosca.artifacts.Deployment.Image.Container.Docker\\n repository: MOG_docker_hub\\n properties:\\n QoS:\\n response_time: 30ms\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n videoWidth: 176\\n videoHeight: 100\\n interfaces:\\n Standard:\\n create:\\n implementation: docker_image\\n inputs:\\n command: ProxyTranscoder\\n exported_ports:\\n - 80\\n port_bindings:\\n - \"8080:80\"\\n\\n 5e0add703c8a43938a39301f572e46c0:\\n type: Switch.nodes.Application.Connection\\n properties:\\n source:\\n address: 192.168.21.11\\n component_name: 2d13d708e3a9441ab8336ce874e08dd1\\n netmask: 255.255.255.0\\n port_name: \"inputDistributor_out\"\\n target:\\n address: 192.168.21.12\\n component_name: 8fcc1788d9ee462c826572c79fdb2a6a\\n netmask: 255.255.255.0\\n port_name: \"proxyTranscoder_in\"\\n latency: 30ms\\n bandwidth: 130MB/s\\n jitter: 500ms\\n multicast:\\n multicastAddrIP: 255.2.2.0\\n multicastAddrPort: 3000\\n")
public String file;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Register {
/**
* The user name
*/
@DocumentationExample("user")
public String user;
/**
* The user password
*/
@DocumentationExample("123abc")
public String pwd;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Result {
/**
* The status of the response
*/
@DocumentationExample("Success")
public String status;
/**
* Not used. Not used. It's there for backwards compatibility.
*/
@DocumentationExample("INFO")
public String info;
public List<Attribute> file;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.data.v0.external;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author S. Koulouzis
*/
@XmlRootElement
public class Upload {
public String user;
public String pwd;
public List<Attribute> file;
}
......@@ -31,12 +31,8 @@ import org.springframework.data.mongodb.core.mapping.Document;
public class PlanResponse extends KeyValueHolder {
private String toscaID;
private String name;
private Integer level;
private Set<String> loweLevelPlansIDs;
// private Set<String> loweLevelPlansIDs;
/**
* The id of the TOSCA <code>PlaybookRepresentation</code> description from
......@@ -64,12 +60,12 @@ public class PlanResponse extends KeyValueHolder {
*
* @return the loweLevelPlansIDs
*/
@DocumentationExample("ew44Ae3946e0sdds4f562d84baA")
public Set<String> getLoweLevelPlanIDs() {
return loweLevelPlansIDs;
}
public void setLoweLevelPlansIDs(Set<String> loweLevelPlansIDs) {
this.loweLevelPlansIDs = loweLevelPlansIDs;
}
// @DocumentationExample("ew44Ae3946e0sdds4f562d84baA")
// public Set<String> getLoweLevelPlanIDs() {
// return loweLevelPlansIDs;
// }
//
// public void setLoweLevelPlansIDs(Set<String> loweLevelPlansIDs) {
// this.loweLevelPlansIDs = loweLevelPlansIDs;
// }
}
......@@ -45,7 +45,6 @@ import nl.uva.sne.drip.drip.provisioner.utils.MessageParsing;
import nl.uva.sne.drip.drip.provisioner.utils.PropertyValues;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
//import org.globus.myproxy.MyProxyException;
import org.ietf.jgss.GSSException;
import org.json.JSONArray;
import org.json.JSONException;
......@@ -130,7 +129,7 @@ public class Consumer extends DefaultConsumer {
+ ex.getClass().getName() + "\",\"attributes\": null}]}";
}
} finally {
logger.fine("Sending Response: {0}" + response);
logger.info("Sending Response: {0}" + response);
// Logger.getLogger(Consumer.class.getName()).log(Level.INFO, "Sending Response: {0}", response);
//We send the response back. No need to change anything here
channel.basicPublish("", properties.getReplyTo(), replyProps, response.getBytes("UTF-8"));
......@@ -180,11 +179,6 @@ public class Consumer extends DefaultConsumer {
FileUtils.moveFile(topologyFile, mainTopologyFile);
String topTopologyLoadingPath = mainTopologyFile.getAbsolutePath();
List<File> topologyFiles = MessageParsing.getTopologies(parameters, tempInputDirPath, 1);
// for (File lowLevelTopologyFile : topologyFiles) {
// File secondaryTopologyFile = new File(tempInputDirPath + File.separator + lowLevelTopologyFile.getName() + ".yml");
// FileUtils.moveFile(lowLevelTopologyFile, secondaryTopologyFile);
// }
// Logger.getLogger(Consumer.class.getName()).log(Level.INFO, "Saved topology file");
logger.info("Saved topology file");
Map<String, Object> map = Converter.ymlStream2Map(new FileInputStream(topTopologyLoadingPath));
String userPublicKeyName = ((String) map.get("publicKeyPath"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment