mirror of https://github.com/apache/jclouds.git
Issue 231:scrape vapptemplate description for password, and provide password for windows instances
This commit is contained in:
parent
25c7345177
commit
1714051272
|
@ -18,17 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.ec2.compute.strategy;
|
package org.jclouds.aws.ec2.compute.strategy;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.domain.Image;
|
import org.jclouds.aws.ec2.domain.Image;
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
*/
|
*/
|
||||||
public class EC2PopulateDefaultLoginCredentialsForImageStrategy implements PopulateDefaultLoginCredentialsForImageStrategy {
|
@Singleton
|
||||||
|
public class EC2PopulateDefaultLoginCredentialsForImageStrategy implements
|
||||||
|
PopulateDefaultLoginCredentialsForImageStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Credentials execute(Object resourceToAuthenticate) {
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
|
@ -41,7 +45,8 @@ public class EC2PopulateDefaultLoginCredentialsForImageStrategy implements Popul
|
||||||
// canonical/alestic images use the ubuntu user to login
|
// canonical/alestic images use the ubuntu user to login
|
||||||
if (image.getImageOwnerId().matches("063491364108|099720109477"))
|
if (image.getImageOwnerId().matches("063491364108|099720109477"))
|
||||||
credentials = new Credentials("ubuntu", null);
|
credentials = new Credentials("ubuntu", null);
|
||||||
else credentials = new Credentials("root", null);
|
else
|
||||||
|
credentials = new Credentials("root", null);
|
||||||
|
|
||||||
return credentials;
|
return credentials;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,17 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.gogrid.config.internal;
|
package org.jclouds.gogrid.config.internal;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.config.ResolvesImages;
|
import org.jclouds.compute.config.ResolvesImages;
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.gogrid.GoGridClient;
|
|
||||||
import org.jclouds.gogrid.domain.ServerImage;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import com.google.inject.AbstractModule;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
|
@ -37,18 +33,13 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
public class GoGridResolveImagesModule extends AbstractModule {
|
public class GoGridResolveImagesModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).
|
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
|
||||||
to(GoGridPopulateDefaultLoginCredentialsForImageStrategy.class);
|
GoGridPopulateDefaultLoginCredentialsForImageStrategy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GoGridPopulateDefaultLoginCredentialsForImageStrategy
|
@Singleton
|
||||||
implements PopulateDefaultLoginCredentialsForImageStrategy {
|
public static class GoGridPopulateDefaultLoginCredentialsForImageStrategy implements
|
||||||
private final GoGridClient client;
|
PopulateDefaultLoginCredentialsForImageStrategy {
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected GoGridPopulateDefaultLoginCredentialsForImageStrategy(GoGridClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Credentials execute(Object resourceToAuthenticate) {
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class BlueLockVCloudComputeClient extends BaseVCloudComputeClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> parseResponse(VApp vAppResponse) {
|
protected Map<String, String> parseResponse(String templateId, VApp vAppResponse) {
|
||||||
// https://forums.bluelock.com/faq.php?faq=vcloudexpressfaq
|
// https://forums.bluelock.com/faq.php?faq=vcloudexpressfaq
|
||||||
return ImmutableMap.<String, String> of("id", vAppResponse.getId(), "username", (vAppResponse
|
return ImmutableMap.<String, String> of("id", vAppResponse.getId(), "username", (vAppResponse
|
||||||
.getOperatingSystemDescription().indexOf("buntu") != -1) ? "express" : "root",
|
.getOperatingSystemDescription().indexOf("buntu") != -1) ? "express" : "root",
|
||||||
|
|
|
@ -31,7 +31,6 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
|
@ -86,28 +85,19 @@ public class BaseVCloudComputeClient implements VCloudComputeClient {
|
||||||
if (!taskTester.apply(task.getId())) {
|
if (!taskTester.apply(task.getId())) {
|
||||||
throw new TaskException("deploy", vAppResponse, task);
|
throw new TaskException("deploy", vAppResponse, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("<< deployed vApp(%s)", vAppResponse.getId());
|
logger.debug("<< deployed vApp(%s)", vAppResponse.getId());
|
||||||
|
|
||||||
logger.debug(">> powering vApp(%s)", vAppResponse.getId());
|
logger.debug(">> powering vApp(%s)", vAppResponse.getId());
|
||||||
try {
|
|
||||||
task = client.powerOnVApp(vAppResponse.getId());
|
task = client.powerOnVApp(vAppResponse.getId());
|
||||||
if (!taskTester.apply(task.getId())) {
|
if (!taskTester.apply(task.getId())) {
|
||||||
throw new TaskException("powerOn", vAppResponse, task);
|
throw new TaskException("powerOn", vAppResponse, task);
|
||||||
}
|
}
|
||||||
} catch (HttpResponseException e) {
|
|
||||||
if (e.getResponse().getStatusCode() == 400
|
|
||||||
&& client.getVApp(vAppResponse.getId()).getStatus() == VAppStatus.ON) {
|
|
||||||
// TODO temporary hack because some vcloud implementations automatically transition to
|
|
||||||
// powerOn from deploy
|
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
logger.debug("<< on vApp(%s)", vAppResponse.getId());
|
logger.debug("<< on vApp(%s)", vAppResponse.getId());
|
||||||
|
return parseAndValidateResponse(templateId, vAppResponse);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, String> response = parseResponse(vAppResponse);
|
protected Map<String, String> parseAndValidateResponse(String templateId, VApp vAppResponse) {
|
||||||
|
Map<String, String> response = parseResponse(templateId, vAppResponse);
|
||||||
checkState(response.containsKey("id"), "bad configuration: [id] should be in response");
|
checkState(response.containsKey("id"), "bad configuration: [id] should be in response");
|
||||||
checkState(response.containsKey("username"),
|
checkState(response.containsKey("username"),
|
||||||
"bad configuration: [username] should be in response");
|
"bad configuration: [username] should be in response");
|
||||||
|
@ -116,7 +106,7 @@ public class BaseVCloudComputeClient implements VCloudComputeClient {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String, String> parseResponse(VApp vAppResponse) {
|
protected Map<String, String> parseResponse(String templateId, VApp vAppResponse) {
|
||||||
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls
|
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls
|
||||||
config.put("id", vAppResponse.getId());
|
config.put("id", vAppResponse.getId());
|
||||||
config.put("username", null);
|
config.put("username", null);
|
||||||
|
|
|
@ -63,6 +63,7 @@ import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
||||||
import org.jclouds.concurrent.ConcurrentUtils;
|
import org.jclouds.concurrent.ConcurrentUtils;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
@ -185,7 +186,6 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
|
||||||
@Inject
|
@Inject
|
||||||
protected VCloudAddNodeWithTagStrategy(VCloudClient client,
|
protected VCloudAddNodeWithTagStrategy(VCloudClient client,
|
||||||
VCloudComputeClient computeClient, Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
VCloudComputeClient computeClient, Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
||||||
super();
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.computeClient = computeClient;
|
this.computeClient = computeClient;
|
||||||
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
this.vAppStatusToNodeState = vAppStatusToNodeState;
|
||||||
|
@ -198,8 +198,6 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
|
||||||
Double.valueOf(template.getSize().getCores()).intValue()).memory(
|
Double.valueOf(template.getSize().getCores()).intValue()).memory(
|
||||||
template.getSize().getRam()).disk(template.getSize().getDisk() * 1024 * 1024l);
|
template.getSize().getRam()).disk(template.getSize().getDisk() * 1024 * 1024l);
|
||||||
|
|
||||||
options.networkName("templateId=" + template.getImage().getId());
|
|
||||||
|
|
||||||
Map<String, String> metaMap = computeClient.start(template.getLocation().getId(), name,
|
Map<String, String> metaMap = computeClient.start(template.getLocation().getId(), name,
|
||||||
template.getImage().getId(), options, template.getOptions().getInboundPorts());
|
template.getImage().getId(), options, template.getOptions().getInboundPorts());
|
||||||
VApp vApp = client.getVApp(metaMap.get("id"));
|
VApp vApp = client.getVApp(metaMap.get("id"));
|
||||||
|
@ -348,6 +346,7 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Map<String, ? extends Image> provideImages(final VCloudClient client,
|
protected Map<String, ? extends Image> provideImages(final VCloudClient client,
|
||||||
|
final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
||||||
LogHolder holder, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
LogHolder holder, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
||||||
Function<ComputeMetadata, String> indexer) throws InterruptedException,
|
Function<ComputeMetadata, String> indexer) throws InterruptedException,
|
||||||
ExecutionException, TimeoutException {
|
ExecutionException, TimeoutException {
|
||||||
|
|
|
@ -39,10 +39,10 @@ public class InstantiateVAppTemplateOptions {
|
||||||
private String memorySizeMegabytes;
|
private String memorySizeMegabytes;
|
||||||
private String diskSizeKilobytes;
|
private String diskSizeKilobytes;
|
||||||
private String network;
|
private String network;
|
||||||
private Map<String, String> properties = Maps.newTreeMap();
|
|
||||||
private String fenceMode;
|
private String fenceMode;
|
||||||
private String dhcpEnabled;
|
private String dhcpEnabled;
|
||||||
private String networkName;
|
private String networkName;
|
||||||
|
private Map<String, String> properties = Maps.newTreeMap();
|
||||||
|
|
||||||
public InstantiateVAppTemplateOptions productProperty(String key, String value) {
|
public InstantiateVAppTemplateOptions productProperty(String key, String value) {
|
||||||
properties.put(checkNotNull(key, "key"), checkNotNull(value, "value"));
|
properties.put(checkNotNull(key, "key"), checkNotNull(value, "value"));
|
||||||
|
@ -207,4 +207,72 @@ public class InstantiateVAppTemplateOptions {
|
||||||
+ ", dhcpEnabled=" + dhcpEnabled + ", properties=" + properties + "]";
|
+ ", dhcpEnabled=" + dhcpEnabled + ", properties=" + properties + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((cpuCount == null) ? 0 : cpuCount.hashCode());
|
||||||
|
result = prime * result + ((dhcpEnabled == null) ? 0 : dhcpEnabled.hashCode());
|
||||||
|
result = prime * result + ((diskSizeKilobytes == null) ? 0 : diskSizeKilobytes.hashCode());
|
||||||
|
result = prime * result + ((fenceMode == null) ? 0 : fenceMode.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((memorySizeMegabytes == null) ? 0 : memorySizeMegabytes.hashCode());
|
||||||
|
result = prime * result + ((network == null) ? 0 : network.hashCode());
|
||||||
|
result = prime * result + ((networkName == null) ? 0 : networkName.hashCode());
|
||||||
|
result = prime * result + ((properties == null) ? 0 : properties.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
InstantiateVAppTemplateOptions other = (InstantiateVAppTemplateOptions) obj;
|
||||||
|
if (cpuCount == null) {
|
||||||
|
if (other.cpuCount != null)
|
||||||
|
return false;
|
||||||
|
} else if (!cpuCount.equals(other.cpuCount))
|
||||||
|
return false;
|
||||||
|
if (dhcpEnabled == null) {
|
||||||
|
if (other.dhcpEnabled != null)
|
||||||
|
return false;
|
||||||
|
} else if (!dhcpEnabled.equals(other.dhcpEnabled))
|
||||||
|
return false;
|
||||||
|
if (diskSizeKilobytes == null) {
|
||||||
|
if (other.diskSizeKilobytes != null)
|
||||||
|
return false;
|
||||||
|
} else if (!diskSizeKilobytes.equals(other.diskSizeKilobytes))
|
||||||
|
return false;
|
||||||
|
if (fenceMode == null) {
|
||||||
|
if (other.fenceMode != null)
|
||||||
|
return false;
|
||||||
|
} else if (!fenceMode.equals(other.fenceMode))
|
||||||
|
return false;
|
||||||
|
if (memorySizeMegabytes == null) {
|
||||||
|
if (other.memorySizeMegabytes != null)
|
||||||
|
return false;
|
||||||
|
} else if (!memorySizeMegabytes.equals(other.memorySizeMegabytes))
|
||||||
|
return false;
|
||||||
|
if (network == null) {
|
||||||
|
if (other.network != null)
|
||||||
|
return false;
|
||||||
|
} else if (!network.equals(other.network))
|
||||||
|
return false;
|
||||||
|
if (networkName == null) {
|
||||||
|
if (other.networkName != null)
|
||||||
|
return false;
|
||||||
|
} else if (!networkName.equals(other.networkName))
|
||||||
|
return false;
|
||||||
|
if (properties == null) {
|
||||||
|
if (other.properties != null)
|
||||||
|
return false;
|
||||||
|
} else if (!properties.equals(other.properties))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.jclouds.vcloud.hostingdotcom.compute;
|
package org.jclouds.vcloud.hostingdotcom.compute;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -25,17 +23,14 @@ import com.google.common.collect.ImmutableMap;
|
||||||
public class HostingDotComVCloudComputeClient extends BaseVCloudComputeClient {
|
public class HostingDotComVCloudComputeClient extends BaseVCloudComputeClient {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected HostingDotComVCloudComputeClient(VCloudClient client,
|
protected HostingDotComVCloudComputeClient(VCloudClient client, Predicate<String> successTester,
|
||||||
Predicate<String> successTester, @Named("NOT_FOUND") Predicate<VApp> notFoundTester,
|
@Named("NOT_FOUND") Predicate<VApp> notFoundTester,
|
||||||
Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
||||||
super(client, successTester, notFoundTester, vAppStatusToNodeState);
|
super(client, successTester, notFoundTester, vAppStatusToNodeState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> parseResponse(VApp vAppResponse) {
|
protected Map<String, String> parseResponse(String templateId, VApp vAppResponse) {
|
||||||
checkState(vAppResponse instanceof HostingDotComVApp,
|
|
||||||
"bad configuration, vApp should be an instance of "
|
|
||||||
+ HostingDotComVApp.class.getName());
|
|
||||||
HostingDotComVApp hVApp = HostingDotComVApp.class.cast(vAppResponse);
|
HostingDotComVApp hVApp = HostingDotComVApp.class.cast(vAppResponse);
|
||||||
return ImmutableMap.<String, String> of("id", vAppResponse.getId(), "username", hVApp
|
return ImmutableMap.<String, String> of("id", vAppResponse.getId(), "username", hVApp
|
||||||
.getUsername(), "password", hVApp.getPassword());
|
.getUsername(), "password", hVApp.getPassword());
|
||||||
|
|
|
@ -21,15 +21,19 @@ package org.jclouds.vcloud.terremark.compute;
|
||||||
import static org.jclouds.vcloud.terremark.options.AddInternetServiceOptions.Builder.withDescription;
|
import static org.jclouds.vcloud.terremark.options.AddInternetServiceOptions.Builder.withDescription;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.vcloud.compute.BaseVCloudComputeClient;
|
import org.jclouds.vcloud.compute.BaseVCloudComputeClient;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
@ -42,7 +46,6 @@ import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
@ -53,19 +56,28 @@ import com.google.common.collect.Sets;
|
||||||
public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient {
|
public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient {
|
||||||
|
|
||||||
private final TerremarkVCloudClient client;
|
private final TerremarkVCloudClient client;
|
||||||
|
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
||||||
|
private Provider<String> passwordGenerator;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
|
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
|
||||||
Predicate<String> successTester, @Named("NOT_FOUND") Predicate<VApp> notFoundTester,
|
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
||||||
|
@Named("PASSWORD") Provider<String> passwordGenerator, Predicate<String> successTester,
|
||||||
|
@Named("NOT_FOUND") Predicate<VApp> notFoundTester,
|
||||||
Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
Map<VAppStatus, NodeState> vAppStatusToNodeState) {
|
||||||
super(client, successTester, notFoundTester, vAppStatusToNodeState);
|
super(client, successTester, notFoundTester, vAppStatusToNodeState);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
this.credentialsProvider = credentialsProvider;
|
||||||
|
this.passwordGenerator = passwordGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> parseResponse(VApp vAppResponse) {
|
protected Map<String, String> parseAndValidateResponse(String templateId, VApp vAppResponse) {
|
||||||
return ImmutableMap.<String, String> of("id", vAppResponse.getId(), "username", "vcloud",
|
Credentials credentials = credentialsProvider.execute(client.getVAppTemplate(templateId));
|
||||||
"password", "p4ssw0rd");
|
Map<String, String> toReturn = super.parseResponse(templateId, vAppResponse);
|
||||||
|
toReturn.put("username", credentials.account);
|
||||||
|
toReturn.put("password", credentials.key);
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,7 +86,16 @@ public class TerremarkVCloudComputeClient extends BaseVCloudComputeClient {
|
||||||
if (options.getDiskSizeKilobytes() != null) {
|
if (options.getDiskSizeKilobytes() != null) {
|
||||||
logger.warn("trmk does not support resizing the primary disk; unsetting disk size");
|
logger.warn("trmk does not support resizing the primary disk; unsetting disk size");
|
||||||
}
|
}
|
||||||
|
String password = null;
|
||||||
|
if (client.getVAppTemplate(templateId).getDescription().indexOf("Windows") != -1) {
|
||||||
|
password = passwordGenerator.get();
|
||||||
|
options.getProperties().put("password", password);
|
||||||
|
}
|
||||||
Map<String, String> response = super.start(vDCId, name, templateId, options, portsToOpen);
|
Map<String, String> response = super.start(vDCId, name, templateId, options, portsToOpen);
|
||||||
|
if (password != null) {
|
||||||
|
response = new LinkedHashMap<String, String>(response);
|
||||||
|
response.put("password", password);
|
||||||
|
}
|
||||||
if (portsToOpen.length > 0)
|
if (portsToOpen.length > 0)
|
||||||
createPublicAddressMappedToPorts(response.get("id"), portsToOpen);
|
createPublicAddressMappedToPorts(response.get("id"), portsToOpen);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.terremark.compute.config;
|
package org.jclouds.vcloud.terremark.compute.config;
|
||||||
|
|
||||||
|
import java.security.SecureRandom;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
@ -38,8 +39,8 @@ import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
import org.jclouds.compute.domain.internal.ImageImpl;
|
import org.jclouds.compute.domain.internal.ImageImpl;
|
||||||
import org.jclouds.compute.domain.internal.SizeImpl;
|
import org.jclouds.compute.domain.internal.SizeImpl;
|
||||||
import org.jclouds.compute.internal.TemplateBuilderImpl;
|
import org.jclouds.compute.internal.TemplateBuilderImpl;
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.concurrent.ConcurrentUtils;
|
import org.jclouds.concurrent.ConcurrentUtils;
|
||||||
import org.jclouds.domain.Credentials;
|
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.VCloudMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
import org.jclouds.vcloud.compute.VCloudComputeClient;
|
||||||
|
@ -51,6 +52,7 @@ import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient;
|
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient;
|
||||||
|
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
||||||
import org.jclouds.vcloud.terremark.domain.ComputeOptions;
|
import org.jclouds.vcloud.terremark.domain.ComputeOptions;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -60,6 +62,7 @@ import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the {@link TerremarkVCloudComputeServiceContext}; requires
|
* Configures the {@link TerremarkVCloudComputeServiceContext}; requires
|
||||||
|
@ -73,6 +76,15 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
bind(VCloudComputeClient.class).to(TerremarkVCloudComputeClient.class);
|
bind(VCloudComputeClient.class).to(TerremarkVCloudComputeClient.class);
|
||||||
|
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
|
||||||
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Named("PASSWORD")
|
||||||
|
@Provides
|
||||||
|
String providePassword() {
|
||||||
|
return new SecureRandom().nextLong() + "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,6 +109,7 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, ? extends Image> provideImages(final VCloudClient client,
|
protected Map<String, ? extends Image> provideImages(final VCloudClient client,
|
||||||
|
final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
||||||
LogHolder holder, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
LogHolder holder, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
||||||
Function<ComputeMetadata, String> indexer) throws InterruptedException,
|
Function<ComputeMetadata, String> indexer) throws InterruptedException,
|
||||||
ExecutionException, TimeoutException {
|
ExecutionException, TimeoutException {
|
||||||
|
@ -129,7 +142,8 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
|
||||||
images.add(new ImageImpl(resource.getId(), template.getName(), vDC
|
images.add(new ImageImpl(resource.getId(), template.getName(), vDC
|
||||||
.getId(), template.getLocation(), ImmutableMap
|
.getId(), template.getLocation(), ImmutableMap
|
||||||
.<String, String> of(), template.getDescription(), "", myOs,
|
.<String, String> of(), template.getDescription(), "", myOs,
|
||||||
template.getName(), arch, new Credentials("root", null)));
|
template.getName(), arch, credentialsProvider
|
||||||
|
.execute(template)));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}), executor));
|
}), executor));
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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 org.jclouds.vcloud.terremark.compute.strategy;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseVAppTemplateDescriptionToGetDefaultLoginCredentials implements
|
||||||
|
PopulateDefaultLoginCredentialsForImageStrategy {
|
||||||
|
|
||||||
|
public static final Pattern USER_PASSWORD_PATTERN = Pattern
|
||||||
|
.compile(".*[Uu]sername: ([a-z]+) ?.*\n[Pp]assword: ([^ ]+) ?\n.*");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
|
checkNotNull(resourceToAuthenticate);
|
||||||
|
checkArgument(resourceToAuthenticate instanceof VAppTemplate,
|
||||||
|
"Resource must be an VAppTemplate (for Terremark)");
|
||||||
|
VAppTemplate template = (VAppTemplate) resourceToAuthenticate;
|
||||||
|
if (template.getDescription().indexOf("Windows") >= 0) {
|
||||||
|
return new Credentials("Administrator", null);
|
||||||
|
} else {
|
||||||
|
Matcher matcher = USER_PASSWORD_PATTERN.matcher(template.getDescription());
|
||||||
|
if (matcher.find()) {
|
||||||
|
return new Credentials(matcher.group(1), matcher.group(2));
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("could not parse username/password for image: "
|
||||||
|
+ template.getId() + "\n" + template.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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 org.jclouds.vcloud.terremark.compute;
|
||||||
|
|
||||||
|
import static org.easymock.EasyMock.expect;
|
||||||
|
import static org.easymock.classextension.EasyMock.createMock;
|
||||||
|
import static org.easymock.classextension.EasyMock.replay;
|
||||||
|
import static org.easymock.classextension.EasyMock.verify;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Provider;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.NodeState;
|
||||||
|
import org.jclouds.vcloud.domain.Task;
|
||||||
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.domain.VAppStatus;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
|
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
||||||
|
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "terremark.TerremarkVCloudComputeClientTest")
|
||||||
|
public class TerremarkVCloudComputeClientTest {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Test
|
||||||
|
public void testStartWindows() throws IOException {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
||||||
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
|
VAppTemplate template = createMock(VAppTemplate.class);
|
||||||
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
|
TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
|
||||||
|
expect(client.getVAppTemplate("templateId")).andReturn(template);
|
||||||
|
VApp vApp = createMock(VApp.class);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
client.instantiateVAppTemplateInVDC("vDCId", "name", "templateId",
|
||||||
|
new TerremarkInstantiateVAppTemplateOptions().productProperty("password",
|
||||||
|
"password"))).andReturn(vApp);
|
||||||
|
Task task = createMock(Task.class);
|
||||||
|
|
||||||
|
expect(vApp.getId()).andReturn("1").atLeastOnce();
|
||||||
|
expect(client.getVAppTemplate("templateId")).andReturn(template);
|
||||||
|
expect(client.deployVApp("1")).andReturn(task);
|
||||||
|
expect(task.getId()).andReturn("1").atLeastOnce();
|
||||||
|
Predicate<String> successTester = createMock(Predicate.class);
|
||||||
|
expect(successTester.apply("1")).andReturn(true).atLeastOnce();
|
||||||
|
expect(client.powerOnVApp("1")).andReturn(task);
|
||||||
|
|
||||||
|
Predicate<VApp> notFoundTester = createMock(Predicate.class);
|
||||||
|
Map<VAppStatus, NodeState> vAppStatusToNodeState = createMock(Map.class);
|
||||||
|
|
||||||
|
TerremarkVCloudComputeClient computeClient = new TerremarkVCloudComputeClient(client,
|
||||||
|
new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(),
|
||||||
|
new Provider<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String get() {
|
||||||
|
return "password";
|
||||||
|
}
|
||||||
|
|
||||||
|
}, successTester, notFoundTester, vAppStatusToNodeState);
|
||||||
|
|
||||||
|
replay(template);
|
||||||
|
replay(vApp);
|
||||||
|
replay(task);
|
||||||
|
replay(client);
|
||||||
|
replay(successTester);
|
||||||
|
replay(notFoundTester);
|
||||||
|
replay(vAppStatusToNodeState);
|
||||||
|
|
||||||
|
Map<String, String> response = computeClient.start("vDCId", "name", "templateId",
|
||||||
|
new TerremarkInstantiateVAppTemplateOptions());
|
||||||
|
|
||||||
|
assertEquals(response.get("id"), "1");
|
||||||
|
assertEquals(response.get("username"), "Administrator");
|
||||||
|
assertEquals(response.get("password"), "password");
|
||||||
|
|
||||||
|
verify(template);
|
||||||
|
verify(vApp);
|
||||||
|
verify(task);
|
||||||
|
verify(client);
|
||||||
|
verify(successTester);
|
||||||
|
verify(notFoundTester);
|
||||||
|
verify(vAppStatusToNodeState);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,10 +21,15 @@ package org.jclouds.vcloud.terremark.compute;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||||
import org.jclouds.compute.domain.Architecture;
|
import org.jclouds.compute.domain.Architecture;
|
||||||
|
import org.jclouds.compute.domain.ComputeType;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
|
||||||
|
@ -61,4 +66,25 @@ public class TerremarkVCloudComputeServiceLiveTest extends VCloudComputeServiceL
|
||||||
.createContext(service, user, password).getProviderSpecificContext();
|
.createContext(service, user, password).getProviderSpecificContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
||||||
|
Template template = super.buildTemplate(templateBuilder);
|
||||||
|
Image image = template.getImage();
|
||||||
|
assert image.getDefaultCredentials().account != null : image;
|
||||||
|
assert image.getDefaultCredentials().key != null : image;
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testListImages() throws Exception {
|
||||||
|
for (Entry<String, ? extends Image> image : client.getImages().entrySet()) {
|
||||||
|
assertEquals(image.getKey(), image.getValue().getId());
|
||||||
|
assert image.getValue().getId() != null : image;
|
||||||
|
// image.getValue().getLocationId() can be null, if it is a location-free image
|
||||||
|
assertEquals(image.getValue().getType(), ComputeType.IMAGE);
|
||||||
|
assert image.getValue().getDefaultCredentials().account != null : image;
|
||||||
|
assert image.getValue().getDefaultCredentials().key != null : image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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 org.jclouds.vcloud.terremark.compute.strategy;
|
||||||
|
|
||||||
|
import static org.easymock.EasyMock.expect;
|
||||||
|
import static org.easymock.classextension.EasyMock.createMock;
|
||||||
|
import static org.easymock.classextension.EasyMock.replay;
|
||||||
|
import static org.easymock.classextension.EasyMock.verify;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "terremark.PopulateDefaultLoginCredentialsForVAppTemplateTest")
|
||||||
|
public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRhel() throws IOException {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/terremark/rhel_description.txt");
|
||||||
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
|
VAppTemplate template = createMock(VAppTemplate.class);
|
||||||
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
|
replay(template);
|
||||||
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
Credentials creds = converter.execute(template);
|
||||||
|
assertEquals(creds.account, "vcloud");
|
||||||
|
assertEquals(creds.key, "$Ep455l0ud!2");
|
||||||
|
verify(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFt() throws IOException {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/terremark/ft_description.txt");
|
||||||
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
|
VAppTemplate template = createMock(VAppTemplate.class);
|
||||||
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
|
replay(template);
|
||||||
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
Credentials creds = converter.execute(template);
|
||||||
|
assertEquals(creds.account, "vpncubed");
|
||||||
|
assertEquals(creds.key, "vpncubed");
|
||||||
|
verify(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWindows() throws IOException {
|
||||||
|
InputStream is = getClass().getResourceAsStream("/terremark/windows_description.txt");
|
||||||
|
String description = new String(ByteStreams.toByteArray(is));
|
||||||
|
VAppTemplate template = createMock(VAppTemplate.class);
|
||||||
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
|
replay(template);
|
||||||
|
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||||
|
Credentials creds = converter.execute(template);
|
||||||
|
assertEquals(creds.account, "Administrator");
|
||||||
|
assertEquals(creds.key, null);
|
||||||
|
verify(template);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
Manager UI URL: https://<Public Manager IP>:8000
|
||||||
|
Username: vpncubed
|
||||||
|
Password: vpncubed
|
||||||
|
Documentation Download Link: http://www.cohesiveft.com/dnld/VPN-Cubed_IPsec-to-Terremark_Free-Edition_2010218.pdf
|
||||||
|
|
||||||
|
For more information: http://www.cohesiveft.com/Cube/VPN/VPN-Cubed_IPsec_to_Cloud/
|
||||||
|
|
||||||
|
VPN-Cubed IPsec to Terremark vCloud Express (Free Edition) is a free development/test-only version of the VPN-Cubed overlay network that allows you control of addressing, topology, pro
|
||||||
|
tocols, and encrypted communications for your devices deployed to Terremark’s vCloud Express. This template is packaged to work between a data center using IPsec extranet connectivity
|
||||||
|
and Terremark. Your IPsec device connects to an IPsec gateway at Terremark running as a virtual appliance which routes to your VPN-Cubed overlay network subnet in Terremark. An overla
|
||||||
|
y network that you completely control. Other Terremark resident cloud machine instances "plug into" the overlay network through the use of the OpenVPN software package.
|
||||||
|
|
||||||
|
VPN-Cubed IPsec to Terremark Free Edition creates an overlay network that uses the 172.31.1.x subnet, allows up to 5 client servers connections, and one IPsec tunnel connection.
|
||||||
|
|
||||||
|
Please contact CohesiveFT at Sales@CohesiveFT.com to discuss more robust VPN-Cubed Deployments.
|
|
@ -0,0 +1,5 @@
|
||||||
|
username: vcloud (SSH) or (Console)
|
||||||
|
password: $Ep455l0ud!2
|
||||||
|
This template consists of a basic Red Hat 5 (32-bit) installation without an entitlement. Additional software and updates are available via the Redhat Network once the server is regist
|
||||||
|
ered with the Redhat Network. The hostname and base IP will be set as part of the server creation process based on user input. Once deployment is complete, please connect via the cons
|
||||||
|
ole and change the vcloud password.
|
|
@ -0,0 +1,4 @@
|
||||||
|
This template consists of a base Windows Server 2008 R2, Enterprise Edition build. Additional features and roles can be added using the Windows Server Manager. The hostname, Administr
|
||||||
|
ator password, and base IP will be set as part of the server creation process based on user input. Once deployment is complete, the server should be accessible via a Remote Desktop Cli
|
||||||
|
ent. This customization can take 10 minutes after the base operating system has been deployed. The operating system license is provided through the SPLA program and is done assuming th
|
||||||
|
at no application management is being done by the managed services provider.
|
Loading…
Reference in New Issue