External UUID control support for 
PublicIpAddress/RemoteAccessVpn/PortForwardingRule/S2SVpnGateway/S2SVpnConnection


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4305d817
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4305d817
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4305d817

Branch: refs/heads/rbac
Commit: 4305d817ba035a15208b859280147a37b07b1c52
Parents: 75757e9
Author: Alena Prokharchyk <alena.prokharc...@citrix.com>
Authored: Wed Feb 5 14:17:33 2014 -0800
Committer: Alena Prokharchyk <alena.prokharc...@citrix.com>
Committed: Wed Feb 5 15:56:40 2014 -0800

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java         |   4 +
 api/src/com/cloud/network/NetworkService.java   |   2 +
 .../com/cloud/network/rules/RulesService.java   |   2 +
 .../network/vpn/RemoteAccessVpnService.java     |   5 +
 .../cloud/network/vpn/Site2SiteVpnService.java  |   4 +
 .../command/user/address/UpdateIPAddrCmd.java   | 122 +++++++++++++++++++
 .../firewall/UpdatePortForwardingRuleCmd.java   |  32 +++--
 .../UpdateApplicationLoadBalancerCmd.java       |   3 +-
 .../loadbalancer/UpdateLoadBalancerRuleCmd.java |   3 +-
 .../user/vpn/UpdateRemoteAccessVpnCmd.java      | 102 ++++++++++++++++
 .../user/vpn/UpdateVpnConnectionCmd.java        |  90 ++++++++++++++
 .../command/user/vpn/UpdateVpnGatewayCmd.java   |  89 ++++++++++++++
 .../Site2SiteVpnConnectionResponse.java         |   5 +-
 client/tomcatconf/commands.properties.in        |   5 +
 .../cloud/network/dao/RemoteAccessVpnVO.java    |   4 +
 .../network/dao/Site2SiteVpnConnectionVO.java   |   4 +
 .../network/dao/Site2SiteVpnGatewayVO.java      |   4 +
 .../com/cloud/network/NetworkServiceImpl.java   |  23 ++++
 .../cloud/network/rules/RulesManagerImpl.java   |  20 ++-
 .../network/vpn/RemoteAccessVpnManagerImpl.java |  26 +++-
 .../network/vpn/Site2SiteVpnManagerImpl.java    |  42 ++++++-
 .../com/cloud/server/ManagementServerImpl.java  |  13 +-
 .../com/cloud/vpc/MockNetworkManagerImpl.java   |  10 +-
 .../cloud/vpc/MockSite2SiteVpnManagerImpl.java  |  15 ++-
 24 files changed, 602 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java 
b/api/src/com/cloud/event/EventTypes.java
index 51f8f1b..7dd8772 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -102,6 +102,7 @@ public class EventTypes {
     // Network Events
     public static final String EVENT_NET_IP_ASSIGN = "NET.IPASSIGN";
     public static final String EVENT_NET_IP_RELEASE = "NET.IPRELEASE";
+    public static final String EVENT_NET_IP_UPDATE = "NET.IPUPDATE";
     public static final String EVENT_PORTABLE_IP_ASSIGN = "PORTABLE.IPASSIGN";
     public static final String EVENT_PORTABLE_IP_RELEASE = 
"PORTABLE.IPRELEASE";
     public static final String EVENT_NET_RULE_ADD = "NET.RULEADD";
@@ -286,16 +287,19 @@ public class EventTypes {
     // VPN
     public static final String EVENT_REMOTE_ACCESS_VPN_CREATE = 
"VPN.REMOTE.ACCESS.CREATE";
     public static final String EVENT_REMOTE_ACCESS_VPN_DESTROY = 
"VPN.REMOTE.ACCESS.DESTROY";
+    public static final String EVENT_REMOTE_ACCESS_VPN_UPDATE = 
"VPN.REMOTE.ACCESS.UPDATE";
     public static final String EVENT_VPN_USER_ADD = "VPN.USER.ADD";
     public static final String EVENT_VPN_USER_REMOVE = "VPN.USER.REMOVE";
     public static final String EVENT_S2S_VPN_GATEWAY_CREATE = 
"VPN.S2S.VPN.GATEWAY.CREATE";
     public static final String EVENT_S2S_VPN_GATEWAY_DELETE = 
"VPN.S2S.VPN.GATEWAY.DELETE";
+    public static final String EVENT_S2S_VPN_GATEWAY_UPDATE = 
"VPN.S2S.VPN.GATEWAY.UPDATE";
     public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE = 
"VPN.S2S.CUSTOMER.GATEWAY.CREATE";
     public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE = 
"VPN.S2S.CUSTOMER.GATEWAY.DELETE";
     public static final String EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE = 
"VPN.S2S.CUSTOMER.GATEWAY.UPDATE";
     public static final String EVENT_S2S_VPN_CONNECTION_CREATE = 
"VPN.S2S.CONNECTION.CREATE";
     public static final String EVENT_S2S_VPN_CONNECTION_DELETE = 
"VPN.S2S.CONNECTION.DELETE";
     public static final String EVENT_S2S_VPN_CONNECTION_RESET = 
"VPN.S2S.CONNECTION.RESET";
+    public static final String EVENT_S2S_VPN_CONNECTION_UPDATE = 
"VPN.S2S.CONNECTION.UPDATE";
 
     // Network
     public static final String EVENT_NETWORK_RESTART = "NETWORK.RESTART";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java 
b/api/src/com/cloud/network/NetworkService.java
index d7d8546..072a27d 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -176,4 +176,6 @@ public interface NetworkService {
     List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
 
     Map<Network.Capability, String> 
getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service 
service);
+
+    IpAddress updateIP(Long id, String customId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/com/cloud/network/rules/RulesService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/rules/RulesService.java 
b/api/src/com/cloud/network/rules/RulesService.java
index 39329d5..1bd9cfe 100644
--- a/api/src/com/cloud/network/rules/RulesService.java
+++ b/api/src/com/cloud/network/rules/RulesService.java
@@ -80,4 +80,6 @@ public interface RulesService {
 
     boolean disableStaticNat(long ipId) throws ResourceUnavailableException, 
NetworkRuleConflictException, InsufficientAddressCapacityException;
 
+    PortForwardingRule updatePortForwardingRule(long id, String customId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java 
b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index ac9649b..1183211 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -52,4 +52,9 @@ public interface RemoteAccessVpnService {
     List<? extends RemoteAccessVpn> listRemoteAccessVpns(long networkId);
 
     RemoteAccessVpn getRemoteAccessVpn(long vpnAddrId);
+
+    RemoteAccessVpn getRemoteAccessVpnById(long vpnId);
+
+    RemoteAccessVpn updateRemoteAccessVpn(long id, String customId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java 
b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
index bfc5e25..7b76b3a 100644
--- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
+++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
@@ -63,4 +63,8 @@ public interface Site2SiteVpnService {
     Pair<List<? extends Site2SiteVpnConnection>, Integer> 
searchForVpnConnections(ListVpnConnectionsCmd listVpnConnectionsCmd);
 
     Site2SiteCustomerGateway updateCustomerGateway(UpdateVpnCustomerGatewayCmd 
updateVpnCustomerGatewayCmd);
+
+    Site2SiteVpnConnection updateVpnConnection(long id, String customId);
+
+    Site2SiteVpnGateway updateVpnGateway(Long id, String customId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
new file mode 100644
index 0000000..b45bf94
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/command/user/address/UpdateIPAddrCmd.java
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.address;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.IpAddress;
+import com.cloud.user.Account;
+
+@APICommand(name = "updatePublicIpAddress", description = "Updates an ip 
address", responseObject = IPAddressResponse.class)
+public class UpdateIPAddrCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = 
Logger.getLogger(UpdateIPAddrCmd.class.getName());
+    private static final String s_name = "updateipaddressresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
IPAddressResponse.class, required = true, description = "the id of the public 
ip address"
+            + " to update")
+    private Long id;
+    // unexposed parameter needed for events logging
+    @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, expose = false)
+    private Long ownerId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_NET_IP_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return ("Updating ip address with id=" + id);
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        if (ownerId == null) {
+            IpAddress ip = getIpAddress(id);
+            if (ip == null) {
+                throw new InvalidParameterValueException("Unable to find ip 
address by id=" + id);
+            }
+            ownerId = ip.getAccountId();
+        }
+
+        if (ownerId == null) {
+            return Account.ACCOUNT_ID_SYSTEM;
+        }
+        return ownerId;
+    }
+
+    private IpAddress getIpAddress(long id) {
+        IpAddress ip = _entityMgr.findById(IpAddress.class, id);
+
+        if (ip == null) {
+            throw new InvalidParameterValueException("Unable to find ip 
address by id=" + id);
+        } else {
+            return ip;
+        }
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), IpAddress.class);
+        }
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, 
InsufficientCapacityException, ServerApiException, 
ConcurrentOperationException, ResourceAllocationException,
+            NetworkRuleConflictException {
+
+        IpAddress result = _networkService.updateIP(getId(), 
this.getCustomId());
+        IPAddressResponse ipResponse = 
_responseGenerator.createIPAddressResponse(result);
+        ipResponse.setResponseName(getCommandName());
+        setResponseObject(ipResponse);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
index d7e380f..a7bb7e3 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
@@ -16,52 +16,54 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.firewall;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.response.FirewallRuleResponse;
 import org.apache.cloudstack.api.response.IPAddressResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.network.IpAddress;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.PortForwardingRule;
 import com.cloud.user.Account;
 
 @APICommand(name = "updatePortForwardingRule",
             responseObject = FirewallRuleResponse.class,
-            description = "Updates a port forwarding rule.  Only the private 
port and the virtual machine can be updated.")
-public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
+ description = "Updates a port forwarding rule")
+public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd {
     public static final Logger s_logger = 
Logger.getLogger(UpdatePortForwardingRuleCmd.class.getName());
     private static final String s_name = "updateportforwardingruleresponse";
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
FirewallRuleResponse.class, required = true, description = "the ID of the port 
forwarding rule")
+    private Long id;
 
     @Parameter(name = ApiConstants.PRIVATE_IP, type = CommandType.STRING, 
description = "the private IP address of the port forwarding rule")
     private String privateIp;
 
-    @Parameter(name = ApiConstants.PRIVATE_PORT, type = CommandType.STRING, 
required = true, description = "the private port of the port forwarding rule")
+    @Parameter(name = ApiConstants.PRIVATE_PORT, type = CommandType.STRING, 
description = "the private port of the port forwarding rule")
     private String privatePort;
 
     @Parameter(name = ApiConstants.PROTOCOL,
                type = CommandType.STRING,
-               required = true,
                description = "the protocol for the port fowarding rule. Valid 
values are TCP or UDP.")
     private String protocol;
 
     @Parameter(name = ApiConstants.IP_ADDRESS_ID,
                type = CommandType.UUID,
                entityType = IPAddressResponse.class,
-               required = true,
                description = "the IP address id of the port forwarding rule")
     private Long publicIpId;
 
-    @Parameter(name = ApiConstants.PUBLIC_PORT, type = CommandType.STRING, 
required = true, description = "the public port of the port forwarding rule")
+    @Parameter(name = ApiConstants.PUBLIC_PORT, type = CommandType.STRING, 
description = "the public port of the port forwarding rule")
     private String publicPort;
 
     @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
@@ -129,7 +131,21 @@ public class UpdatePortForwardingRuleCmd extends 
BaseAsyncCmd {
     }
 
     @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
+        }
+    }
+
+    @Override
     public void execute() {
+        PortForwardingRule rule = _rulesService.updatePortForwardingRule(id, 
this.getCustomId());
+        FirewallRuleResponse fwResponse = new FirewallRuleResponse();
+        if (rule != null) {
+            fwResponse = 
_responseGenerator.createPortForwardingRuleResponse(rule);
+            setResponseObject(fwResponse);
+        }
+        fwResponse.setResponseName(getCommandName());
 //FIXME:        PortForwardingRule result = 
_mgr.updatePortForwardingRule(this);
 //        if (result != null) {
 //            FirewallRuleResponse response = 
_responseGenerator.createFirewallRuleResponse(result);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
index 5f89692..4a82ce1 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateApplicationLoadBalancerCmd.java
@@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.FirewallRule;
 
 @APICommand(name = "updateLoadBalancer", description = "Updates a Load 
Balancer", responseObject = ApplicationLoadBalancerResponse.class, since = 
"4.4.0")
 public class UpdateApplicationLoadBalancerCmd extends BaseAsyncCustomIdCmd {
@@ -89,7 +90,7 @@ public class UpdateApplicationLoadBalancerCmd extends 
BaseAsyncCustomIdCmd {
     @Override
     public void checkUuid() {
         if (this.getCustomId() != null) {
-            _uuidMgr.checkUuid(this.getCustomId(), 
ApplicationLoadBalancerRule.class);
+            _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
index f408756..3a9a03c 100644
--- 
a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
@@ -30,6 +30,7 @@ import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
 import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.LoadBalancer;
 import com.cloud.user.Account;
 
@@ -136,7 +137,7 @@ public class UpdateLoadBalancerRuleCmd extends 
BaseAsyncCustomIdCmd {
     @Override
     public void checkUuid() {
         if (this.getCustomId() != null) {
-            _uuidMgr.checkUuid(this.getCustomId(), LoadBalancer.class);
+            _uuidMgr.checkUuid(this.getCustomId(), FirewallRule.class);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
new file mode 100644
index 0000000..e275faf
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateRemoteAccessVpnCmd.java
@@ -0,0 +1,102 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vpn;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.RemoteAccessVpn;
+
+@APICommand(name = "updateRemoteAccessVpn", description = "Updates remote 
access vpn", responseObject = RemoteAccessVpnResponse.class, since = "4.4")
+public class UpdateRemoteAccessVpnCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = 
Logger.getLogger(UpdateRemoteAccessVpnCmd.class.getName());
+
+    private static final String s_name = "updateremoteaccessvpnresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = 
true, entityType = RemoteAccessVpnResponse.class, description = "id of the 
remote access vpn")
+    private Long id;
+
+    // unexposed parameter needed for events logging
+    @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, expose = false)
+    private Long ownerId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        if (ownerId == null) {
+            RemoteAccessVpn vpnEntity = _ravService.getRemoteAccessVpnById(id);
+            if (vpnEntity != null)
+                return vpnEntity.getAccountId();
+
+            throw new InvalidParameterValueException("The specified id is 
invalid");
+        }
+        return ownerId;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Updating remote access vpn id=" + id;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_REMOTE_ACCESS_VPN_UPDATE;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() {
+        RemoteAccessVpn result = _ravService.updateRemoteAccessVpn(id, 
this.getCustomId());
+        RemoteAccessVpnResponse response = 
_responseGenerator.createRemoteAccessVpnResponse(result);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), RemoteAccessVpn.class);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
new file mode 100644
index 0000000..5fee7a2
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnConnectionCmd.java
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vpn;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.network.Site2SiteVpnConnection;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateVpnConnection", description = "Updates site to site 
vpn connection", responseObject = Site2SiteVpnConnectionResponse.class, since = 
"4.4")
+public class UpdateVpnConnectionCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = 
Logger.getLogger(UpdateVpnConnectionCmd.class.getName());
+
+    private static final String s_name = "updatevpnconnectionresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
Site2SiteVpnConnectionResponse.class, required = true, description = "id of vpn 
connection")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+    public Long getId() {
+        return id;
+    }
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Site2SiteVpnConnection conn = 
_entityMgr.findById(Site2SiteVpnConnection.class, getId());
+        if (conn != null) {
+            return conn.getAccountId();
+        }
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Updating site-to-site VPN connection id= " + id;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_S2S_VPN_CONNECTION_UPDATE;
+    }
+
+    @Override
+    public void execute() {
+        Site2SiteVpnConnection result = _s2sVpnService.updateVpnConnection(id, 
this.getCustomId());
+        Site2SiteVpnConnectionResponse response = 
_responseGenerator.createSite2SiteVpnConnectionResponse(result);
+        response.setResponseName(getCommandName());
+        setResponseObject(response);
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), 
Site2SiteVpnConnection.class);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
new file mode 100644
index 0000000..30c56b4
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnGatewayCmd.java
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vpn;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCustomIdCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.network.Site2SiteVpnGateway;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateVpnGateway", description = "Updates site to site vpn 
local gateway", responseObject = Site2SiteVpnGatewayResponse.class, since = 
"4.4")
+public class UpdateVpnGatewayCmd extends BaseAsyncCustomIdCmd {
+    public static final Logger s_logger = 
Logger.getLogger(UpdateVpnGatewayCmd.class.getName());
+
+    private static final String s_name = "updatevpngatewayresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
Site2SiteVpnGatewayResponse.class, required = true, description = "id of 
customer gateway")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Site2SiteVpnGateway gw = 
_entityMgr.findById(Site2SiteVpnGateway.class, getId());
+        if (gw != null) {
+            return gw.getAccountId();
+        }
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Update site-to-site VPN gateway id= " + id;
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_S2S_VPN_GATEWAY_UPDATE;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public void execute() {
+        Site2SiteVpnGateway result = _s2sVpnService.updateVpnGateway(id, 
this.getCustomId());
+        Site2SiteVpnGatewayResponse response = 
_responseGenerator.createSite2SiteVpnGatewayResponse(result);
+        response.setResponseName(getCommandName());
+    }
+
+    @Override
+    public void checkUuid() {
+        if (this.getCustomId() != null) {
+            _uuidMgr.checkUuid(this.getCustomId(), Site2SiteVpnGateway.class);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java
 
b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java
index 423b6cd..f025b52 100644
--- 
a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java
+++ 
b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java
@@ -18,20 +18,19 @@ package org.apache.cloudstack.api.response;
 
 import java.util.Date;
 
-import com.google.gson.annotations.SerializedName;
-
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseResponse;
 import org.apache.cloudstack.api.EntityReference;
 
 import com.cloud.network.Site2SiteVpnConnection;
 import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
 
 @EntityReference(value = Site2SiteVpnConnection.class)
 @SuppressWarnings("unused")
 public class Site2SiteVpnConnectionResponse extends BaseResponse implements 
ControlledEntityResponse {
     @SerializedName(ApiConstants.ID)
-    @Param(description = "the vpn gateway ID")
+    @Param(description = "the connection ID")
     private String id;
 
     @SerializedName(ApiConstants.S2S_VPN_GATEWAY_ID)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in 
b/client/tomcatconf/commands.properties.in
index 2992eea..879c58d 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -137,6 +137,7 @@ listDedicatedGuestVlanRanges=1
 associateIpAddress=15
 disassociateIpAddress=15
 listPublicIpAddresses=15
+updatePublicIpAddress=15
 
 #### firewall commands
 listPortForwardingRules=15
@@ -349,6 +350,8 @@ listHypervisors=15
 createRemoteAccessVpn=15
 deleteRemoteAccessVpn=15
 listRemoteAccessVpns=15
+updateRemoteAccessVpn=15
+
 
 addVpnUser=15
 removeVpnUser=15
@@ -501,6 +504,8 @@ resetVpnConnection=15
 listVpnCustomerGateways=15
 listVpnGateways=15
 listVpnConnections=15
+updateVpnConnection=15
+updateVpnGateway=15
 
 #### router commands
 createVirtualRouterElement=7

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java 
b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
index 54ae9b2..c892949 100644
--- a/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
+++ b/engine/schema/src/com/cloud/network/dao/RemoteAccessVpnVO.java
@@ -148,4 +148,8 @@ public class RemoteAccessVpnVO implements RemoteAccessVpn {
     public Long getVpcId() {
         return vpcId;
     }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
----------------------------------------------------------------------
diff --git 
a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java 
b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
index 96a4c2d..7f1d0aa 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java
@@ -155,4 +155,8 @@ public class Site2SiteVpnConnectionVO implements 
Site2SiteVpnConnection, Interna
     public void setPassive(boolean passive) {
         this.passive = passive;
     }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java 
b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
index 3a16bcd..5e8c6b6 100644
--- a/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
+++ b/engine/schema/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java
@@ -112,4 +112,8 @@ public class Site2SiteVpnGatewayVO implements 
Site2SiteVpnGateway {
     public long getAccountId() {
         return accountId;
     }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java 
b/server/src/com/cloud/network/NetworkServiceImpl.java
index c786426..bcadd69 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -4034,4 +4034,27 @@ public class NetworkServiceImpl extends ManagerBase 
implements NetworkService {
         this._networkGurus = networkGurus;
     }
 
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_NET_IP_UPDATE, eventDescription 
= "updating public ip address", async = true)
+    public IpAddress updateIP(Long id, String customId) {
+        Account caller = CallContext.current().getCallingAccount();
+        IPAddressVO ipVO = _ipAddressDao.findById(id);
+        if (ipVO == null) {
+            throw new InvalidParameterValueException("Unable to find ip 
address by id");
+        }
+
+        // verify permissions
+        if (ipVO.getAllocatedToAccountId() != null) {
+            _accountMgr.checkAccess(caller, null, true, ipVO);
+        } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+            throw new PermissionDeniedException("Only Root admin can update 
non-allocated ip addresses");
+        }
+
+        if (customId != null) {
+            ipVO.setUuid(customId);
+        }
+        _ipAddressDao.update(id, ipVO);
+        return _ipAddressDao.findById(id);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java 
b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 69be58f..2fa72a7 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -25,11 +25,10 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
-import org.apache.log4j.Logger;
-
 import 
org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
 import org.apache.cloudstack.context.CallContext;
 import 
org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
 
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.domain.dao.DomainDao;
@@ -1484,4 +1483,21 @@ public class RulesManagerImpl extends ManagerBase 
implements RulesManager, Rules
         }
         return result;
     }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_NET_RULE_MODIFY, 
eventDescription = "updating forwarding rule", async = true)
+    public PortForwardingRule updatePortForwardingRule(long id, String 
customId) {
+        Account caller = CallContext.current().getCallingAccount();
+        PortForwardingRuleVO rule = _portForwardingDao.findById(id);
+        if (rule == null) {
+            throw new InvalidParameterValueException("Unable to find " + id);
+        }
+        _accountMgr.checkAccess(caller, null, true, rule);
+
+        if (customId != null) {
+            rule.setUuid(customId);
+        }
+        _portForwardingDao.update(id, rule);
+        return _portForwardingDao.findById(id);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java 
b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index ef4cccd..0b33ae3 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -25,18 +25,18 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
 import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
 
 import com.cloud.configuration.Config;
 import com.cloud.domain.DomainVO;
 import com.cloud.domain.dao.DomainDao;
+import com.cloud.event.ActionEvent;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
 import com.cloud.event.dao.UsageEventDao;
@@ -696,6 +696,11 @@ public class RemoteAccessVpnManagerImpl extends 
ManagerBase implements RemoteAcc
         return _remoteAccessVpnDao.findByPublicIpAddress(vpnAddrId);
     }
 
+    @Override
+    public RemoteAccessVpn getRemoteAccessVpnById(long vpnId) {
+        return _remoteAccessVpnDao.findById(vpnId);
+    }
+
     public List<RemoteAccessVPNServiceProvider> 
getRemoteAccessVPNServiceProviders() {
         List<RemoteAccessVPNServiceProvider> result = new 
ArrayList<RemoteAccessVPNServiceProvider>();
         for (Iterator<RemoteAccessVPNServiceProvider> e = 
_vpnServiceProviders.iterator(); e.hasNext();) {
@@ -723,4 +728,21 @@ public class RemoteAccessVpnManagerImpl extends 
ManagerBase implements RemoteAcc
         this._vpnServiceProviders = vpnServiceProviders;
     }
 
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_REMOTE_ACCESS_VPN_UPDATE, 
eventDescription = "updating remote access vpn", async = true)
+    public RemoteAccessVpn updateRemoteAccessVpn(long id, String customId) {
+        final RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findById(id);
+        if (vpn == null) {
+            throw new InvalidParameterValueException("Can't find remote access 
vpn by id " + id);
+        }
+
+        _accountMgr.checkAccess(CallContext.current().getCallingAccount(), 
null, true, vpn);
+        if (customId != null) {
+            vpn.setUuid(customId);
+        }
+
+        _remoteAccessVpnDao.update(vpn.getId(), vpn);
+        return _remoteAccessVpnDao.findById(id);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java 
b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
index d068ca0..2f6ad6c 100644
--- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
@@ -24,9 +24,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd;
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd;
@@ -40,6 +37,8 @@ import 
org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.configuration.Config;
 import com.cloud.event.ActionEvent;
@@ -783,4 +782,41 @@ public class Site2SiteVpnManagerImpl extends ManagerBase 
implements Site2SiteVpn
     public void setS2sProviders(List<Site2SiteVpnServiceProvider> 
s2sProviders) {
         this._s2sProviders = s2sProviders;
     }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_S2S_VPN_CONNECTION_UPDATE, 
eventDescription = "creating s2s vpn gateway", async = true)
+    public Site2SiteVpnConnection updateVpnConnection(long id, String 
customId) {
+        Account caller = CallContext.current().getCallingAccount();
+        Site2SiteVpnConnectionVO conn = _vpnConnectionDao.findById(id);
+        if (conn == null) {
+            throw new InvalidParameterValueException("Fail to find site to 
site VPN connection " + id);
+        }
+
+        _accountMgr.checkAccess(caller, null, false, conn);
+        if (customId != null) {
+            conn.setUuid(customId);
+        }
+
+        _vpnConnectionDao.update(id, conn);
+        return _vpnConnectionDao.findById(id);
+    }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_S2S_VPN_GATEWAY_UPDATE, 
eventDescription = "updating s2s vpn gateway", async = true)
+    public Site2SiteVpnGateway updateVpnGateway(Long id, String customId) {
+        Account caller = CallContext.current().getCallingAccount();
+
+        Site2SiteVpnGatewayVO vpnGateway = _vpnGatewayDao.findById(id);
+        if (vpnGateway == null) {
+            throw new InvalidParameterValueException("Fail to find vpn gateway 
with " + id);
+        }
+
+        _accountMgr.checkAccess(caller, null, false, vpnGateway);
+        if (customId != null) {
+            vpnGateway.setUuid(customId);
+        }
+        _vpnGatewayDao.update(id, vpnGateway);
+        return _vpnGatewayDao.findById(id);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java 
b/server/src/com/cloud/server/ManagementServerImpl.java
index ad4e760..2a08ddc4 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -40,9 +40,6 @@ import javax.crypto.spec.SecretKeySpec;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.affinity.AffinityGroupProcessor;
@@ -221,6 +218,7 @@ import 
org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
 import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
 import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
 import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
+import org.apache.cloudstack.api.command.user.address.UpdateIPAddrCmd;
 import 
org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd;
 import 
org.apache.cloudstack.api.command.user.affinitygroup.DeleteAffinityGroupCmd;
 import 
org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupTypesCmd;
@@ -436,7 +434,10 @@ import 
org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd;
 import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
 import org.apache.cloudstack.api.command.user.vpn.RemoveVpnUserCmd;
 import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
+import org.apache.cloudstack.api.command.user.vpn.UpdateRemoteAccessVpnCmd;
+import org.apache.cloudstack.api.command.user.vpn.UpdateVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
+import org.apache.cloudstack.api.command.user.vpn.UpdateVpnGatewayCmd;
 import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
 import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.context.CallContext;
@@ -454,6 +455,8 @@ import 
org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.GetVncPortAnswer;
@@ -2857,6 +2860,10 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
         cmdList.add(UpdateFirewallRuleCmd.class);
         cmdList.add(UpdateNetworkACLListCmd.class);
         cmdList.add(UpdateApplicationLoadBalancerCmd.class);
+        cmdList.add(UpdateIPAddrCmd.class);
+        cmdList.add(UpdateRemoteAccessVpnCmd.class);
+        cmdList.add(UpdateVpnConnectionCmd.class);
+        cmdList.add(UpdateVpnGatewayCmd.class);
         return cmdList;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java 
b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 32beb0b..68390f8 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -25,8 +25,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import 
org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
 import 
org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
@@ -36,6 +34,8 @@ import 
org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
 import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
 import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
 import 
org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeployDestination;
@@ -857,4 +857,10 @@ public class MockNetworkManagerImpl extends ManagerBase 
implements NetworkOrches
 
     }
 
+    @Override
+    public IpAddress updateIP(Long id, String customId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4305d817/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java 
b/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java
index b02e1a4..3815ed1 100644
--- a/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockSite2SiteVpnManagerImpl.java
@@ -22,8 +22,6 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd;
 import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd;
@@ -35,6 +33,7 @@ import 
org.apache.cloudstack.api.command.user.vpn.ListVpnCustomerGatewaysCmd;
 import org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd;
 import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
 import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
+import org.springframework.stereotype.Component;
 
 import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceUnavailableException;
@@ -259,4 +258,16 @@ public class MockSite2SiteVpnManagerImpl extends 
ManagerBase implements Site2Sit
 
     }
 
+    @Override
+    public Site2SiteVpnConnection updateVpnConnection(long id, String 
customId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Site2SiteVpnGateway updateVpnGateway(Long id, String customId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Reply via email to