Updated Branches:
  refs/heads/master dad27aaf4 -> c3df34826

Remove Network Parameter for VPN service provider

It's unnecessary since RemoteAccessVpnVO already have network ID binding with 
it.


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

Branch: refs/heads/master
Commit: ab124a17fa3391f570f1fcf504525e76af4d31eb
Parents: dad27aa
Author: Sheng Yang <sheng.y...@citrix.com>
Authored: Thu Oct 17 11:35:21 2013 -0700
Committer: Sheng Yang <sheng.y...@citrix.com>
Committed: Thu Oct 17 17:55:47 2013 -0700

----------------------------------------------------------------------
 .../element/RemoteAccessVPNServiceProvider.java |  5 ++-
 .../JuniperSRXExternalFirewallElement.java      | 38 +-------------------
 .../network/element/VirtualRouterElement.java   |  8 +++--
 .../network/vpn/RemoteAccessVpnManagerImpl.java |  4 +--
 .../vpn/MockRemoteAccessVPNServiceProvider.java |  5 ++-
 5 files changed, 13 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab124a17/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
----------------------------------------------------------------------
diff --git 
a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java 
b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
index 4950ed9..b923375 100644
--- a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
+++ b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
@@ -19,7 +19,6 @@ package com.cloud.network.element;
 import java.util.List;
 
 import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network;
 import com.cloud.network.RemoteAccessVpn;
 import com.cloud.network.VpnUser;
 import com.cloud.utils.component.Adapter;
@@ -27,7 +26,7 @@ import com.cloud.utils.component.Adapter;
 public interface RemoteAccessVPNServiceProvider extends Adapter {
     String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users) 
throws ResourceUnavailableException;
 
-    boolean startVpn(Network network, RemoteAccessVpn vpn) throws 
ResourceUnavailableException;
+    boolean startVpn(RemoteAccessVpn vpn) throws ResourceUnavailableException;
 
-    boolean stopVpn(Network network, RemoteAccessVpn vpn) throws 
ResourceUnavailableException;
+    boolean stopVpn(RemoteAccessVpn vpn) throws ResourceUnavailableException;
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab124a17/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
 
b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
index af67b02..8521037 100644
--- 
a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
+++ 
b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
@@ -95,7 +95,7 @@ import com.cloud.vm.VirtualMachineProfile;
         PortForwardingServiceProvider.class, IpDeployer.class,
         SourceNatServiceProvider.class, RemoteAccessVPNServiceProvider.class})
 public class JuniperSRXExternalFirewallElement extends 
ExternalFirewallDeviceManagerImpl implements SourceNatServiceProvider, 
FirewallServiceProvider,
-PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, 
JuniperSRXFirewallElementService, StaticNatServiceProvider {
+PortForwardingServiceProvider, IpDeployer, JuniperSRXFirewallElementService, 
StaticNatServiceProvider {
 
     private static final Logger s_logger = 
Logger.getLogger(JuniperSRXExternalFirewallElement.class);
 
@@ -226,42 +226,6 @@ PortForwardingServiceProvider, 
RemoteAccessVPNServiceProvider, IpDeployer, Junip
     }
 
     @Override
-    public boolean startVpn(Network config, RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
-        if (!canHandle(config, Service.Vpn)) {
-            return false;
-        }
-
-        return manageRemoteAccessVpn(true, config, vpn);
-
-    }
-
-    @Override
-    public boolean stopVpn(Network config, RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
-        if (!canHandle(config, Service.Vpn)) {
-            return false;
-        }
-
-        return manageRemoteAccessVpn(false, config, vpn);
-    }
-
-    @Override
-    public String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> 
users) throws ResourceUnavailableException {
-        Network config = _networksDao.findById(vpn.getNetworkId());
-
-        if (!canHandle(config, Service.Vpn)) {
-            return null;
-        }
-
-        boolean result = manageRemoteAccessVpnUsers(config, vpn, users);
-        String[] results = new String[users.size()];
-        for (int i = 0; i < results.length; i++) {
-            results[i] = String.valueOf(result);
-        }
-
-        return results;
-    }
-
-    @Override
     public Provider getProvider() {
         return Provider.JuniperSRX;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab124a17/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java 
b/server/src/com/cloud/network/element/VirtualRouterElement.java
index eb53db6..503ce74 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -404,7 +404,9 @@ public class VirtualRouterElement extends AdapterBase 
implements VirtualRouterEl
     }
 
     @Override
-    public boolean startVpn(Network network, RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
+    public boolean startVpn(RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
+        Network network = _networksDao.findById(vpn.getNetworkId());
+
         if (canHandle(network, Service.Vpn)) {
             List<DomainRouterVO> routers = 
_routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
             if (routers == null || routers.isEmpty()) {
@@ -420,7 +422,9 @@ public class VirtualRouterElement extends AdapterBase 
implements VirtualRouterEl
     }
 
     @Override
-    public boolean stopVpn(Network network, RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
+    public boolean stopVpn(RemoteAccessVpn vpn) throws 
ResourceUnavailableException {
+        Network network = _networksDao.findById(vpn.getNetworkId());
+
         if (canHandle(network, Service.Vpn)) {
             List<DomainRouterVO> routers = 
_routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
             if (routers == null || routers.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab124a17/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 6cd164d..25c64e4 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -247,7 +247,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase 
implements RemoteAcc
         boolean success = false;
         try {
             for (RemoteAccessVPNServiceProvider element : 
_vpnServiceProviders) {
-                if (element.stopVpn(network, vpn)) {
+                if (element.stopVpn(vpn)) {
                     success = true;
                     break;
                 }
@@ -397,7 +397,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase 
implements RemoteAcc
 
             if (firewallOpened) {
                 for (RemoteAccessVPNServiceProvider element : 
_vpnServiceProviders) {
-                    if (element.startVpn(network, vpn)) {
+                    if (element.startVpn(vpn)) {
                         started = true;
                         break;
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab124a17/server/test/com/cloud/network/vpn/MockRemoteAccessVPNServiceProvider.java
----------------------------------------------------------------------
diff --git 
a/server/test/com/cloud/network/vpn/MockRemoteAccessVPNServiceProvider.java 
b/server/test/com/cloud/network/vpn/MockRemoteAccessVPNServiceProvider.java
index 1dde4a8..6e8cd69 100644
--- a/server/test/com/cloud/network/vpn/MockRemoteAccessVPNServiceProvider.java
+++ b/server/test/com/cloud/network/vpn/MockRemoteAccessVPNServiceProvider.java
@@ -23,7 +23,6 @@ import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
 import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network;
 import com.cloud.network.RemoteAccessVpn;
 import com.cloud.network.VpnUser;
 import com.cloud.network.element.RemoteAccessVPNServiceProvider;
@@ -63,14 +62,14 @@ public class MockRemoteAccessVPNServiceProvider extends 
ManagerBase implements
        }
 
        @Override
-       public boolean startVpn(Network network, RemoteAccessVpn vpn)
+       public boolean startVpn(RemoteAccessVpn vpn)
                        throws ResourceUnavailableException {
                // TODO Auto-generated method stub
                return false;
        }
 
        @Override
-       public boolean stopVpn(Network network, RemoteAccessVpn vpn)
+       public boolean stopVpn(RemoteAccessVpn vpn)
                        throws ResourceUnavailableException {
                // TODO Auto-generated method stub
                return false;

Reply via email to