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 @Override
public String string() { 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 * @see NetworkReference#getIpAddresses
*/ */
public Builder gatewayAddress(IpAddresses ipAddresses) { public Builder ipAddresses(IpAddresses ipAddresses) {
this.ipAddresses = ipAddresses; this.ipAddresses = ipAddresses;
return this; return this;
} }
@ -136,7 +136,12 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
} }
public Builder fromNetworkReference(NetworkReference in) { 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; 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() { public DnsSettings getDnsSettings() {
return dnsSettings; return dnsSettings;
} }

View File

@ -108,7 +108,7 @@ public class VirtualMachineClientLiveTest extends BaseTerremarkEnterpriseCloudCl
public void testCreateVirtualMachineFromTemplate() throws Exception { public void testCreateVirtualMachineFromTemplate() throws Exception {
CreateVirtualMachine.Builder builder = CreateVirtualMachine.builder(); CreateVirtualMachine.Builder builder = CreateVirtualMachine.builder();
builder.name("VirtualMachine2") builder.name("vmDMZ1")
.processorCount(2) .processorCount(2)
.memory(ResourceCapacity.builder().value(1024).unit("MB").build()); .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(); AnonymousResource sshKey = AnonymousResource.builder().href(URI.create("/cloudapi/ecloud/admin/sshkeys/77")).type("application/vnd.tmrk.cloud.admin.sshKey").build();
NamedResource network = NamedResource.builder() NamedResource network = NamedResource.builder()
.href(URI.create("/cloudapi/ecloud/networks/3936")) .href(URI.create("/cloudapi/ecloud/networks/3933"))
.name("10.146.204.64/28") .name("10.146.205.128/27")
.type("application/vnd.tmrk.cloud.network") .type("application/vnd.tmrk.cloud.network")
.build(); .build();
NetworkAdapterSetting adapterSetting = NetworkAdapterSetting.builder() NetworkAdapterSetting adapterSetting = NetworkAdapterSetting.builder()
.network(network) .network(network)
.ipAddress("10.146.204.68") .ipAddress("10.146.205.131")
.build(); .build();
NetworkAdapterSettings adapterSettings = NetworkAdapterSettings.builder() NetworkAdapterSettings adapterSettings = NetworkAdapterSettings.builder()
.addNetworkAdapterSetting(adapterSetting).build(); .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(); NetworkSettings networkSettings = NetworkSettings.builder().networkAdapterSettings(adapterSettings).build();
LinuxCustomization linuxCustomization = LinuxCustomization.builder() 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()); VirtualMachine vm = client.createVirtualMachineFromTemplate(URI.create("/cloudapi/ecloud/virtualMachines/computePools/89/action/createVirtualMachine"), builder.build());
assertNotNull(vm); 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: 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. //client.remove(vm.getHref()); //remove once verified - there needs to be no running tasks.
} }
} }