VPC: reduced visability for some vpc related methods

Conflicts:

        
server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
        server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
        server/src/com/cloud/network/vpc/VpcManagerImpl.java


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

Branch: refs/heads/vpc
Commit: ebe53a91d79ddc8371e808b3380d985ca7fb0e00
Parents: 7071304
Author: Alena Prokharchyk <[email protected]>
Authored: Tue Jul 31 14:12:09 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Wed Aug 1 18:33:12 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/network/vpc/VpcService.java      |    6 +-
 .../router/VirtualNetworkApplianceManagerImpl.java |    2 -
 .../router/VpcVirtualNetworkApplianceManager.java  |    1 -
 .../VpcVirtualNetworkApplianceManagerImpl.java     |    8 +-
 .../cloud/network/vpc/NetworkACLManagerImpl.java   |   26 ++++--
 server/src/com/cloud/network/vpc/VpcManager.java   |   46 ----------
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |   65 ++++++--------
 7 files changed, 54 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/api/src/com/cloud/network/vpc/VpcService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcService.java 
b/api/src/com/cloud/network/vpc/VpcService.java
index 287748e..2a33822 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -30,7 +30,6 @@ import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.Network;
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
-import com.cloud.network.Site2SiteVpnGateway;
 
 public interface VpcService {
     
@@ -125,8 +124,9 @@ public interface VpcService {
      * @throws ResourceUnavailableException 
      * @throws ConcurrentOperationException 
      */
-    boolean startVpc(long vpcId, boolean destroyOnFailure) throws 
ConcurrentOperationException, ResourceUnavailableException, 
InsufficientCapacityException;
-
+    boolean startVpc(long vpcId, boolean destroyOnFailure) throws 
ConcurrentOperationException, 
+                                                        
ResourceUnavailableException, InsufficientCapacityException;
+    
     /**
      * @param vpcId
      * @return

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java 
b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index da6cc7c..cb55578 100755
--- 
a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ 
b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -135,10 +135,8 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
 import com.cloud.network.PublicIpAddress;
 import com.cloud.network.RemoteAccessVpn;
 import com.cloud.network.Site2SiteCustomerGateway;
-import com.cloud.network.Site2SiteCustomerGatewayVO;
 import com.cloud.network.Site2SiteVpnConnection;
 import com.cloud.network.Site2SiteVpnConnectionVO;
-import com.cloud.network.Site2SiteVpnGatewayVO;
 import com.cloud.network.SshKeysDistriMonitor;
 import com.cloud.network.VirtualNetworkApplianceService;
 import com.cloud.network.VirtualRouterProvider;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git 
a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java 
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
index dbeed6a..297ae9b 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
@@ -29,7 +29,6 @@ import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.vpc.PrivateGateway;
 import com.cloud.network.vpc.StaticRouteProfile;
 import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcGateway;
 import com.cloud.user.Account;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.VirtualMachineProfile.Param;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
 
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index d070a0a..24b0f32 100644
--- 
a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ 
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -694,7 +694,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends 
VirtualNetworkApplian
         return sendCommandsToRouter(router, cmds);
     }
     
-    private void createNetworkACLsCommands(List<? extends FirewallRule> rules, 
VirtualRouter router, Commands cmds, long guestNetworkId) {
+    private void createNetworkACLsCommands(List<? extends FirewallRule> rules, 
VirtualRouter router, Commands cmds, 
+            long guestNetworkId) {
         List<NetworkACLTO> rulesTO = null;
         String guestVlan = null;
         Network guestNtwk = _networkDao.findById(guestNetworkId);
@@ -721,7 +722,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends 
VirtualNetworkApplian
         cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, 
dcVo.getNetworkType().toString());
         cmds.addCommand(cmd);
     }
-    
+
     @Override
     public boolean finalizeCommandsOnStart(Commands cmds, 
VirtualMachineProfile<DomainRouterVO> profile) {
         DomainRouterVO router = profile.getVirtualMachine();
@@ -783,7 +784,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends 
VirtualNetworkApplian
                     }
                 }
                 
-                PlugNicCommand plugNicCmd = new 
PlugNicCommand(getNicTO(router, publicNic.getNetworkId(), 
publicNic.getBroadcastUri().toString()), router.getInstanceName());
+                PlugNicCommand plugNicCmd = new 
PlugNicCommand(getNicTO(router, publicNic.getNetworkId(), 
+                        publicNic.getBroadcastUri().toString()), 
router.getInstanceName());
                 cmds.addCommand(plugNicCmd); 
             }
             

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java 
b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
index 5425403..f886f1d 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
@@ -244,8 +244,9 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
                     }
                 }
             }
-            
-            if (newRule.getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO) && 
newRule.getProtocol().equalsIgnoreCase(rule.getProtocol())) {
+
+            if (newRule.getProtocol().equalsIgnoreCase(NetUtils.ICMP_PROTO) 
+                    && 
newRule.getProtocol().equalsIgnoreCase(rule.getProtocol())) {
                 if (newRule.getIcmpCode().longValue() == 
rule.getIcmpCode().longValue() 
                         && newRule.getIcmpType().longValue() == 
rule.getIcmpType().longValue()
                         && 
newRule.getProtocol().equalsIgnoreCase(rule.getProtocol()) && duplicatedCidrs) {
@@ -258,10 +259,14 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
             if (!notNullPorts) {
                 continue;
             } else if (duplicatedCidrs
-                    && ((rule.getSourcePortStart().intValue() <= 
newRule.getSourcePortStart().intValue() && rule.getSourcePortEnd().intValue() 
>= newRule.getSourcePortStart().intValue())
-                            || (rule.getSourcePortStart().intValue() <= 
newRule.getSourcePortEnd().intValue() && rule.getSourcePortEnd().intValue() >= 
newRule.getSourcePortEnd().intValue())
-                            || (newRule.getSourcePortStart().intValue() <= 
rule.getSourcePortStart().intValue() && newRule.getSourcePortEnd().intValue() 
>= rule.getSourcePortStart().intValue())
-                            || (newRule.getSourcePortStart().intValue() <= 
rule.getSourcePortEnd().intValue() && newRule.getSourcePortEnd().intValue() >= 
rule.getSourcePortEnd().intValue()))) {
+                    && ((rule.getSourcePortStart().intValue() <= 
newRule.getSourcePortStart().intValue() 
+                    && rule.getSourcePortEnd().intValue() >= 
newRule.getSourcePortStart().intValue())
+                            || (rule.getSourcePortStart().intValue() <= 
newRule.getSourcePortEnd().intValue() 
+                            && rule.getSourcePortEnd().intValue() >= 
newRule.getSourcePortEnd().intValue())
+                            || (newRule.getSourcePortStart().intValue() <= 
rule.getSourcePortStart().intValue() 
+                            && newRule.getSourcePortEnd().intValue() >= 
rule.getSourcePortStart().intValue())
+                            || (newRule.getSourcePortStart().intValue() <= 
rule.getSourcePortEnd().intValue() 
+                            && newRule.getSourcePortEnd().intValue() >= 
rule.getSourcePortEnd().intValue()))) {
 
                 throw new NetworkRuleConflictException("The range specified, " 
+ newRule.getSourcePortStart() + "-" 
                             + newRule.getSourcePortEnd() + ", conflicts with 
rule " + rule.getId()
@@ -271,7 +276,8 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
         }
 
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("No network rule conflicts detected for " + newRule 
+ " against " + (rules.size() - 1) + " existing network ACLs");
+            s_logger.debug("No network rule conflicts detected for " + newRule 
+ " against " + (rules.size() - 1) 
+                    + " existing network ACLs");
         }
     }
     
@@ -305,6 +311,7 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
 
         return success;
     }
+
     
     @Override
     public FirewallRule getNetworkACL(long ACLId) {
@@ -315,6 +322,7 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
         return null;
     }
 
+    
     @Override
     public List<? extends FirewallRule> listNetworkACLs(ListNetworkACLsCmd 
cmd) {
         Long networkId = cmd.getNetworkId();
@@ -366,6 +374,7 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
     public List<? extends FirewallRule> listNetworkACLs(long guestNtwkId) {
         return _firewallDao.listByNetworkAndPurpose(guestNtwkId, 
Purpose.NetworkACL);
     }
+
     
     @Override
     public boolean revokeAllNetworkACLsForNetwork(long networkId, long userId, 
Account caller) throws ResourceUnavailableException {
@@ -393,7 +402,8 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
         boolean success = _firewallMgr.applyFirewallRules(ACLsToRevoke, false, 
caller);
 
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Successfully released Network ACLs for network 
id=" + networkId + " and # of rules now = " + ACLs.size());
+            s_logger.debug("Successfully released Network ACLs for network 
id=" + networkId + " and # of rules now = " 
+                                + ACLs.size());
         }
 
         return success;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/vpc/VpcManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManager.java 
b/server/src/com/cloud/network/vpc/VpcManager.java
index b6724b0..25dc5f0 100644
--- a/server/src/com/cloud/network/vpc/VpcManager.java
+++ b/server/src/com/cloud/network/vpc/VpcManager.java
@@ -17,15 +17,9 @@
 package com.cloud.network.vpc;
 
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.network.element.VpcProvider;
-import com.cloud.network.vpc.VpcOffering.State;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.vm.DomainRouterVO;
@@ -34,38 +28,6 @@ import com.cloud.vm.DomainRouterVO;
 public interface VpcManager extends VpcService{
 
     /**
-     * @param name
-     * @param displayText
-     * @param svcProviderMap
-     * @param isDefault
-     * @param state TODO
-     * @return
-     */
-    VpcOffering createVpcOffering(String name, String displayText, 
Map<Service, Set<Provider>> svcProviderMap, 
-            boolean isDefault, State state);
-
-    /**
-     * @param vpcOffId
-     * @param services
-     * @return
-     */
-    boolean areServicesSupportedByVpcOffering(long vpcOffId, Service[] 
services);
-
-    /**
-     * @param zoneId
-     * @param vpcOffId
-     * @param vpcOwner
-     * @param vpcName
-     * @param displayText
-     * @param cidr
-     * @param networkDomain TODO
-     * @return
-     */
-    Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String 
vpcName, String displayText, String cidr, String networkDomain);
-    
-    List<Service> getSupportedServices();
-
-    /**
      * @param guestNtwkOff
      * @param cidr
      * @param networkDomain
@@ -78,10 +40,6 @@ public interface VpcManager extends VpcService{
     void validateGuestNtkwForVpc(NetworkOffering guestNtwkOff, String cidr, 
String networkDomain, Account networkOwner, 
             Vpc vpc, Long networkId, String gateway);
 
-    /**
-     * @return
-     */
-    VpcProvider getVpcElement();
     
     List<? extends Vpc> getVpcsForAccount(long accountId);
 
@@ -111,8 +69,4 @@ public interface VpcManager extends VpcService{
      */
     VpcGateway getPrivateGatewayForVpc(long vpcId);
 
-    /**
-     * @return
-     */
-    int getMaxNetworksPerVpc();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ebe53a91/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java 
b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 7ee87b0..cd279d5 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -59,12 +59,9 @@ import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.dao.FirewallRulesDao;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.PhysicalNetworkDao;
-import com.cloud.network.dao.Site2SiteVpnConnectionDao;
 import com.cloud.network.dao.Site2SiteVpnGatewayDao;
 import com.cloud.network.element.VpcProvider;
 import com.cloud.network.vpc.VpcOffering.State;
@@ -271,11 +268,10 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
                
         return createVpcOffering(name, displayText, svcProviderMap, false, 
null);
     }
+
     
-    
-    @Override
     @DB
-    public VpcOffering createVpcOffering(String name, String displayText, 
Map<Network.Service, 
+    protected VpcOffering createVpcOffering(String name, String displayText, 
Map<Network.Service, 
             Set<Network.Provider>> svcProviderMap, boolean isDefault, State 
state) {
         Transaction txn = Transaction.currentTxn();
         txn.start();
@@ -407,12 +403,12 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
             return offerings;
         }
     }
-    
-    @Override
-    public boolean areServicesSupportedByVpcOffering(long vpcOffId, Service... 
services) {
+
+
+    protected boolean areServicesSupportedByVpcOffering(long vpcOffId, 
Service... services) {
         return 
(_vpcOffSvcMapDao.areServicesSupportedByNetworkOffering(vpcOffId, services));
     }
-
+    
     
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_DELETE, 
eventDescription = "deleting vpc offering")
@@ -539,9 +535,9 @@ public class VpcManagerImpl implements VpcManager, Manager{
         
         return false;
     }
-    
-    @Override
-    public Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, String 
vpcName, String displayText, String cidr, 
+
+
+    protected Vpc createVpc(long zoneId, long vpcOffId, Account vpcOwner, 
String vpcName, String displayText, String cidr, 
             String networkDomain) {
         
         if (!vpcProviderEnabledInZone(zoneId)) {
@@ -778,21 +774,21 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
             return vpcs;
         }
     }
+
     
-    @Override
-    public List<Service> getSupportedServices() {
-       List<Service> services = new ArrayList<Service>();
-       services.add(Network.Service.Dhcp);
-       services.add(Network.Service.Dns);
-       services.add(Network.Service.UserData);
-       services.add(Network.Service.NetworkACL);
-       services.add(Network.Service.PortForwarding);
-       services.add(Network.Service.Lb);
-       services.add(Network.Service.SourceNat);
-       services.add(Network.Service.StaticNat);
-       services.add(Network.Service.Gateway);
-       services.add(Network.Service.Vpn);
-       return services;
+    protected List<Service> getSupportedServices() {
+        List<Service> services = new ArrayList<Service>();
+        services.add(Network.Service.Dhcp);
+        services.add(Network.Service.Dns);
+        services.add(Network.Service.UserData);
+        services.add(Network.Service.NetworkACL);
+        services.add(Network.Service.PortForwarding);
+        services.add(Network.Service.Lb);
+        services.add(Network.Service.SourceNat);
+        services.add(Network.Service.StaticNat);
+        services.add(Network.Service.Gateway);
+        services.add(Network.Service.Vpn);
+        return services;
     }
     
     @Override
@@ -870,8 +866,8 @@ public class VpcManagerImpl implements VpcManager, Manager{
 
         //shutdown provider
         boolean success = getVpcElement().shutdownVpc(vpc);
-        
-        //FIXME - once more features are added to vpc (gateway/firewall rules, 
etc - cleanup them here)
+
+        //TODO - cleanup all vpc resources here (ACLs, gateways, etc)
         if (success) {
             s_logger.debug("Vpc " + vpc + " has been shutdown succesfully");
         } else {
@@ -996,9 +992,9 @@ public class VpcManagerImpl implements VpcManager, Manager{
             _vpcDao.releaseFromLockTable(locked.getId());
         }
     }
-     
-    @Override
-    public VpcProvider getVpcElement() {
+
+
+    protected VpcProvider getVpcElement() {
         if (vpcElement == null) {
             vpcElement = 
((VpcProvider)_ntwkMgr.getElementImplementingProvider(Provider.VPCVirtualRouter.getName()));
         }
@@ -1618,9 +1614,4 @@ public class VpcManagerImpl implements VpcManager, 
Manager{
     public VpcGateway getPrivateGatewayForVpc(long vpcId) {
         return _vpcGatewayDao.getPrivateGatewayForVpc(vpcId);
     }
-    
-    public int getMaxNetworksPerVpc() {
-        return _maxNetworks;
-    }
-    
 }

Reply via email to