diff --git a/api/src/com/cloud/api/commands/CreateVpnCustomerGatewayCmd.java b/api/src/com/cloud/api/commands/CreateVpnCustomerGatewayCmd.java index d17054b910d..b4d68f930ea 100644 --- a/api/src/com/cloud/api/commands/CreateVpnCustomerGatewayCmd.java +++ b/api/src/com/cloud/api/commands/CreateVpnCustomerGatewayCmd.java @@ -32,7 +32,7 @@ import com.cloud.user.UserContext; public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateVpnCustomerGatewayCmd.class.getName()); - private static final String s_name = "createcustomergatewayresponse"; + private static final String s_name = "createvpncustomergatewayresponse"; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -52,7 +52,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.ESP_POLICY, type=CommandType.STRING, required=true, description="ESP policy of the customer gateway") private String espPolicy; - @Parameter(name=ApiConstants.LIFETIME, type=CommandType.STRING, required=false, description="Lifetime of vpn connection to the customer gateway, in seconds") + @Parameter(name=ApiConstants.LIFETIME, type=CommandType.LONG, required=false, description="Lifetime of vpn connection to the customer gateway, in seconds") private Long lifetime; ///////////////////////////////////////////////////// diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 7339894e467..23b13ef6fca 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -3305,8 +3305,7 @@ } } }, - action: function(args) { - var s2svpngatewayid; + action: function(args) { $.ajax({ url: createURL('createVpnGateway'), data: { @@ -3328,7 +3327,51 @@ clearInterval(createvpngatewayIntervalID); if (result.jobstatus == 1) { var obj = result.jobresult.vpngateway; - s2svpngatewayid = obj.id; + var vpngatewayid = obj.id; + //??? + $.ajax({ + url: createURL('createVpnCustomerGateway'), + data: { + gateway: args.data.gateway, + cidrlist: args.data.cidrlist, + ipsecpsk: args.data.ipsecpsk, + ikepolicy: args.data.ikepolicy, + esppolicy: args.data.esppolicy, + lifetime: args.data.lifetime + }, + dataType: 'json', + success: function(json) { + var jid = json.createvpncustomergatewayresponse.jobid; + var createvpncustomergatewayIntervalID = setInterval(function() { + $.ajax({ + url: createURL("queryAsyncJobResult&jobid=" + jid), + dataType: "json", + success: function(json) { + var result = json.queryasyncjobresultresponse; + debugger; + if (result.jobstatus == 0) { + return; //Job has not completed + } + else { + clearInterval(createvpncustomergatewayIntervalID); + if (result.jobstatus == 1) { + var obj = result.jobresult.vpncustomergateway; + var vpncustomergatewayid = obj.id; + } + else if (result.jobstatus == 2) { + alert("Failed to create VPN customer gateway. Error: " + _s(result.jobresult.errortext)); + } + } + }, + error: function(XMLHttpResponse) { + var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + alert("Failed to create VPN customer gateway. Error: " + errorMsg); + } + }); + }, 3000); + } + }); + //??? } else if (result.jobstatus == 2) { alert("Failed to create VPN gateway. Error: " + _s(result.jobresult.errortext));