Add access IPs in Server

This commit is contained in:
Christophe Hamerling 2012-01-20 12:28:14 +01:00
parent 02353b93d5
commit 5c0ca0b7c1
2 changed files with 55 additions and 6 deletions

View File

@ -39,6 +39,8 @@ public class Server extends Resource {
private Map<String, String> metadata = Maps.newHashMap();
private Addresses addresses;
private String accessIPv4;
private String accessIPv6;
private String adminPass;
private String flavorRef;
private String hostId;
@ -221,6 +223,36 @@ public class Server extends Resource {
this.securityGroups = securityGroups;
}
/**
* @return the accessIPv4
*/
public String getAccessIPv4() {
return accessIPv4;
}
/**
* @param accessIPv4
* the accessIPv4 to set
*/
public void setAccessIPv4(String accessIPv4) {
this.accessIPv4 = accessIPv4;
}
/**
* @return the accessIPv6
*/
public String getAccessIPv6() {
return accessIPv6;
}
/**
* @param accessIPv6
* the accessIPv6 to set
*/
public void setAccessIPv6(String accessIPv6) {
this.accessIPv6 = accessIPv6;
}
@Override
public int hashCode() {
final int prime = 31;
@ -237,6 +269,8 @@ public class Server extends Resource {
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((flavor == null) ? 0 : flavor.hashCode());
result = prime * result + ((image == null) ? 0 : image.hashCode());
result = prime * result + ((accessIPv4 == null) ? 0 : accessIPv4.hashCode());
result = prime * result + ((accessIPv6 == null) ? 0 : accessIPv6.hashCode());
return result;
}
@ -311,6 +345,16 @@ public class Server extends Resource {
return false;
} else if (!image.equals(other.image))
return false;
if (accessIPv4 == null) {
if (other.accessIPv4 != null)
return false;
} else if (!accessIPv4.equals(other.accessIPv4))
return false;
if (accessIPv6 == null) {
if (other.accessIPv6 != null)
return false;
} else if (!accessIPv6.equals(other.accessIPv6))
return false;
return true;
}
@ -320,9 +364,12 @@ public class Server extends Resource {
@Override
public String toString() {
return "Server [addresses=" + addresses + ", adminPass=" + adminPass + ", flavorRef="
+ flavorRef + ", hostId=" + hostId + ", id=" + id + ", imageRef=" + imageRef
+ ", metadata=" + metadata + ", uuid=" + uuid + ", name=" + name + ", keyName=" + keyName + " , securityGroups=" + securityGroups + "]";
return "Server [addresses=" + addresses + ", accessIPv4=" + accessIPv4
+ ", accessIPv6=" + accessIPv6 + ", adminPass=" + adminPass
+ ", flavorRef=" + flavorRef + ", hostId=" + hostId + ", id="
+ id + ", imageRef=" + imageRef + ", metadata=" + metadata
+ ", uuid=" + uuid + ", name=" + name + ", keyName=" + keyName
+ " , securityGroups=" + securityGroups + "]";
}
}

View File

@ -83,6 +83,8 @@ public class ParseServerFromJsonResponseDiabloTest {
assertEquals(response.getAddresses(), addresses1);
assertEquals(response.getMetadata(), ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1"));
assertEquals(response.getAddresses(), addresses1);
assertEquals(response.getAccessIPv4(), "67.23.10.132");
assertEquals(response.getAccessIPv6(), "::babe:67.23.10.132");
}