S2S VPN: Allow name to be modified in updateCustomerGateway

This commit is contained in:
Sheng Yang 2012-08-02 16:18:11 -07:00
parent 0f603daff6
commit d4ce07779f
2 changed files with 12 additions and 0 deletions

View File

@ -40,6 +40,9 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of customer gateway")
private Long id;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=false, description="name of this customer gateway")
private String name;
@Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="public ip address id of the customer gateway")
private String gatewayIp;
@ -84,6 +87,10 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
return id;
}
public String getName() {
return name;
}
public String getIpsecPsk() {
return ipsecPsk;
}

View File

@ -363,10 +363,14 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
}
}
}
String name = cmd.getName();
String gatewayIp = cmd.getGatewayIp();
if (!NetUtils.isValidIp(gatewayIp)) {
throw new InvalidParameterValueException("The customer gateway ip " + gatewayIp + " is invalid!", null);
}
if (name == null) {
name = "VPN-" + gatewayIp;
}
String guestCidrList = cmd.getGuestCidrList();
if (!NetUtils.validateGuestCidrList(guestCidrList)) {
throw new InvalidParameterValueException("The customer gateway guest cidr list " + guestCidrList + " contains invalid guest cidr!", null);
@ -403,6 +407,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
dpd = false;
}
gw.setName(name);
gw.setGatewayIp(gatewayIp);
gw.setGuestCidrList(guestCidrList);
gw.setIkePolicy(ikePolicy);