mirror of https://github.com/apache/cloudstack.git
IPv6: Make the IPv6 input all lowercase
To make them consistent.
This commit is contained in:
parent
0b62fc4c17
commit
85d0546fe8
|
|
@ -38,7 +38,7 @@ public class ApiConstants {
|
|||
public static final String DOMAIN_SUFFIX = "domainsuffix";
|
||||
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
|
||||
public static final String CIDR = "cidr";
|
||||
public static final String IP6CIDR = "ip6cidr";
|
||||
public static final String IP6_CIDR = "ip6cidr";
|
||||
public static final String CIDR_LIST = "cidrlist";
|
||||
public static final String CLEANUP = "cleanup";
|
||||
public static final String CLUSTER_ID = "clusterid";
|
||||
|
|
@ -75,7 +75,7 @@ public class ApiConstants {
|
|||
public static final String FORMAT = "format";
|
||||
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
|
||||
public static final String GATEWAY = "gateway";
|
||||
public static final String IP6GATEWAY = "ip6gateway";
|
||||
public static final String IP6_GATEWAY = "ip6gateway";
|
||||
public static final String GROUP = "group";
|
||||
public static final String GROUP_ID = "groupid";
|
||||
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
|
||||
|
|
|
|||
|
|
@ -119,11 +119,11 @@ public class CreateNetworkCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range")
|
||||
private String endIpv6;
|
||||
|
||||
@Parameter(name=ApiConstants.IP6GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
|
||||
@Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
|
||||
"for Shared networks and Isolated networks when it belongs to VPC")
|
||||
private String ip6Gateway;
|
||||
|
||||
@Parameter(name=ApiConstants.IP6CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
|
||||
@Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
|
||||
private String ip6Cidr;
|
||||
|
||||
@Parameter(name=ApiConstants.DUAL_STACK, type=CommandType.BOOLEAN, description="The network is dual-stack(IPv6 and IPv4) or not")
|
||||
|
|
@ -223,35 +223,31 @@ public class CreateNetworkCmd extends BaseCmd {
|
|||
}
|
||||
|
||||
public String getStartIpv6() {
|
||||
return startIpv6;
|
||||
}
|
||||
|
||||
public void setStartIpv6(String startIpv6) {
|
||||
this.startIpv6 = startIpv6;
|
||||
if (startIpv6 == null) {
|
||||
return null;
|
||||
}
|
||||
return startIpv6.toLowerCase();
|
||||
}
|
||||
|
||||
public String getEndIpv6() {
|
||||
return endIpv6;
|
||||
}
|
||||
|
||||
public void setEndIpv6(String endIpv6) {
|
||||
this.endIpv6 = endIpv6;
|
||||
if (endIpv6 == null) {
|
||||
return null;
|
||||
}
|
||||
return endIpv6.toLowerCase();
|
||||
}
|
||||
|
||||
public String getIp6Gateway() {
|
||||
return ip6Gateway;
|
||||
}
|
||||
|
||||
public void setIp6Gateway(String ip6Gateway) {
|
||||
this.ip6Gateway = ip6Gateway;
|
||||
if (ip6Gateway == null) {
|
||||
return null;
|
||||
}
|
||||
return ip6Gateway.toLowerCase();
|
||||
}
|
||||
|
||||
public String getIp6Cidr() {
|
||||
return ip6Cidr;
|
||||
}
|
||||
|
||||
public void setIp6Cidr(String ip6Cidr) {
|
||||
this.ip6Cidr = ip6Cidr;
|
||||
if (ip6Cidr == null) {
|
||||
return null;
|
||||
}
|
||||
return ip6Cidr.toLowerCase();
|
||||
}
|
||||
|
||||
public Boolean isDualStack() {
|
||||
|
|
@ -261,10 +257,6 @@ public class CreateNetworkCmd extends BaseCmd {
|
|||
return dualStack;
|
||||
}
|
||||
|
||||
public void setDualStack(Boolean dualStack) {
|
||||
this.dualStack = dualStack;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
public List<Long> getNetworkIds() {
|
||||
if (ipToNetworkList != null) {
|
||||
if (networkIds != null || ipAddress != null || ip6Address != null) {
|
||||
if (networkIds != null || ipAddress != null || getIp6Address() != null) {
|
||||
throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress");
|
||||
} else {
|
||||
List<Long> networks = new ArrayList<Long>();
|
||||
|
|
@ -276,7 +276,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
private Map<Long, IpAddresses> getIpToNetworkMap() {
|
||||
if ((networkIds != null || ipAddress != null || ip6Address != null) && ipToNetworkList != null) {
|
||||
if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) {
|
||||
throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter");
|
||||
}
|
||||
LinkedHashMap<Long, IpAddresses> ipToNetworkMap = null;
|
||||
|
|
@ -299,6 +299,9 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
String requestedIp = (String) ips.get("ip");
|
||||
String requestedIpv6 = (String) ips.get("ipv6");
|
||||
if (requestedIpv6 != null) {
|
||||
requestedIpv6 = requestedIpv6.toLowerCase();
|
||||
}
|
||||
IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6);
|
||||
ipToNetworkMap.put(networkId, addrs);
|
||||
}
|
||||
|
|
@ -306,6 +309,13 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
return ipToNetworkMap;
|
||||
}
|
||||
|
||||
public String getIp6Address() {
|
||||
if (ip6Address == null) {
|
||||
return null;
|
||||
}
|
||||
return ip6Address.toLowerCase();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
@ -434,7 +444,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
if (getHypervisor() == HypervisorType.BareMetal) {
|
||||
vm = _bareMetalVmService.createVirtualMachine(this);
|
||||
} else {
|
||||
IpAddresses addrs = new IpAddresses(ipAddress, ip6Address);
|
||||
IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address());
|
||||
if (zone.getNetworkType() == NetworkType.Basic) {
|
||||
if (getNetworkIds() != null) {
|
||||
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
|
||||
|
|
@ -474,4 +484,5 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
|
|||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue