Merge pull request #265 from jsonking/695-Terremark

Issue 695: Small fixes and javadoc
This commit is contained in:
Jason King 2011-12-19 13:21:47 -08:00
commit 9cc786b130
4 changed files with 25 additions and 8 deletions

View File

@ -153,6 +153,6 @@ public class Entity<T extends Entity<T>> extends Resource<T> {
@Override
public String string() {
return super.string()+", name="+name+", tasks="+tasks;
return super.string()+", tasks="+tasks;
}
}

View File

@ -125,7 +125,7 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
/**
* @see NetworkReference#getIpAddresses
*/
public Builder gatewayAddress(IpAddresses ipAddresses) {
public Builder ipAddresses(IpAddresses ipAddresses) {
this.ipAddresses = ipAddresses;
return this;
}
@ -136,7 +136,12 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
}
public Builder fromNetworkReference(NetworkReference in) {
return fromNamedResource(in).networkType(in.getNetworkType());
return fromNamedResource(in).address(in.getAddress())
.networkType(in.getNetworkType())
.broadcastAddress(in.getBroadcastAddress())
.gatewayAddress(in.getGatewayAddress())
.rnatAddress(in.getRnatAddress())
.ipAddresses(in.getIpAddresses());
}
/**

View File

@ -86,6 +86,12 @@ public class NetworkSettings {
return networkAdapterSettings;
}
/**
* DnsSettings is optional.
* If not included, defaults to DNS for the data center.
* PrimaryDns is required if DnsSettings is included.
* @return
*/
public DnsSettings getDnsSettings() {
return dnsSettings;
}

View File

@ -108,7 +108,7 @@ public class VirtualMachineClientLiveTest extends BaseTerremarkEnterpriseCloudCl
public void testCreateVirtualMachineFromTemplate() throws Exception {
CreateVirtualMachine.Builder builder = CreateVirtualMachine.builder();
builder.name("VirtualMachine2")
builder.name("vmDMZ1")
.processorCount(2)
.memory(ResourceCapacity.builder().value(1024).unit("MB").build());
@ -119,18 +119,21 @@ public class VirtualMachineClientLiveTest extends BaseTerremarkEnterpriseCloudCl
AnonymousResource sshKey = AnonymousResource.builder().href(URI.create("/cloudapi/ecloud/admin/sshkeys/77")).type("application/vnd.tmrk.cloud.admin.sshKey").build();
NamedResource network = NamedResource.builder()
.href(URI.create("/cloudapi/ecloud/networks/3936"))
.name("10.146.204.64/28")
.href(URI.create("/cloudapi/ecloud/networks/3933"))
.name("10.146.205.128/27")
.type("application/vnd.tmrk.cloud.network")
.build();
NetworkAdapterSetting adapterSetting = NetworkAdapterSetting.builder()
.network(network)
.ipAddress("10.146.204.68")
.ipAddress("10.146.205.131")
.build();
NetworkAdapterSettings adapterSettings = NetworkAdapterSettings.builder()
.addNetworkAdapterSetting(adapterSetting).build();
//DNS Settings are optional - and default to the data center dns settings if custom values are not provided.
//DnsSettings dnsSettings = DnsSettings.builder().primaryDns("10.1.1.1").secondaryDns("10.1.1.2").build();
NetworkSettings networkSettings = NetworkSettings.builder().networkAdapterSettings(adapterSettings).build();
LinuxCustomization linuxCustomization = LinuxCustomization.builder()
@ -145,8 +148,11 @@ public class VirtualMachineClientLiveTest extends BaseTerremarkEnterpriseCloudCl
VirtualMachine vm = client.createVirtualMachineFromTemplate(URI.create("/cloudapi/ecloud/virtualMachines/computePools/89/action/createVirtualMachine"), builder.build());
assertNotNull(vm);
// For ssh login - next steps are:
// - Create an internet service for ssh (TCP port 22) on a public ip address
// - Create a node service to bind the port to the vm itself
// TODO: Check that the VM is created OK.
// TODO: DNSSettings are missing
System.out.println(vm);
//client.remove(vm.getHref()); //remove once verified - there needs to be no running tasks.
}
}