incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [4/61] [abbrv] git commit: VPC: CS-15850 - don't unplug the nic for public network when there are existing ips in the same vlan having network rules
Date Tue, 07 Aug 2012 18:39:57 GMT
VPC: CS-15850 - don't unplug the nic for public network when there are existing ips in the
same vlan having network rules

Conflicts:

	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/d38e9eeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d38e9eeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d38e9eeb

Branch: refs/heads/vpc
Commit: d38e9eebed19e11a97a88e987e089ed29316db8d
Parents: a83c753
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Mon Aug 6 16:25:37 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Tue Aug 7 11:25:02 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |    1 +
 server/test/com/cloud/vpc/VpcApiUnitTest.java      |   44 ++-
 .../test/com/cloud/vpc/dao/MockNetworkDaoImpl.java |  339 +++++++++++++++
 .../cloud/vpc/dao/MockNetworkOfferingDaoImpl.java  |   40 ++-
 .../dao/MockNetworkOfferingServiceMapDaoImpl.java  |   22 +-
 .../com/cloud/vpc/dao/MockNetworkOfferingVO.java   |   23 -
 .../vpc/dao/MockNetworkServiceMapDaoImpl.java      |   16 -
 .../vpc/dao/MockVpcOfferingServiceMapDao.java      |   17 +
 utils/test/resources/log4j.xml                     |    2 +-
 9 files changed, 424 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/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 f253ee3..1de5dbc 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -963,6 +963,7 @@ public class VpcManagerImpl implements VpcManager, Manager{
             
             throw new InvalidParameterValueException("Only networks of type " + GuestType.Isolated
+ " with service "
             + Service.SourceNat + " can be added as a part of VPC");
+
         }
         
         //3) No redundant router support

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/VpcApiUnitTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/VpcApiUnitTest.java b/server/test/com/cloud/vpc/VpcApiUnitTest.java
index 8563b46..a7500bc 100644
--- a/server/test/com/cloud/vpc/VpcApiUnitTest.java
+++ b/server/test/com/cloud/vpc/VpcApiUnitTest.java
@@ -49,7 +49,6 @@ public class VpcApiUnitTest extends TestCase{
     MockComponentLocator _locator;
     VpcManager _vpcService;
 
-    
     @Override
     @Before
     public void setUp() throws Exception {
@@ -94,53 +93,76 @@ public class VpcApiUnitTest extends TestCase{
         try {
             _vpcService.validateNtkwOffForVpc(1, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1),
2L, "10.1.1.1");
             result = true;
-            s_logger.debug("Test1 passed, the offering is valid for vpc creation");
+            s_logger.debug("Test passed: the offering is valid for vpc creation");
         } catch (Exception ex) {
-            s_logger.warn("Test1 failed due to exc ", ex);
+            s_logger.warn("TEST FAILED due to exc ", ex);
         }
         
         
         //2) invalid offering - source nat is not included
         result = false;
+        String msg = null;
         try {
             _vpcService.validateNtkwOffForVpc(2, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1),
2L, "10.1.1.1");
             result = true;
         } catch (InvalidParameterValueException ex) {
+            msg = ex.getMessage();
         } finally {
             if (!result) {
-                s_logger.debug("Test2 passed, can't use network offering without SourceNat
service");
+                s_logger.debug("Test passed: "  + msg);
             } else {
-                s_logger.warn("Test2 failed, can't use network offering without SourceNat
service");
+                s_logger.warn("TEST FAILED, can't use network offering without SourceNat
service");
             }
         }
         
         //3) invalid offering - conserve mode is off
         result = false;
+        msg = null;
         try {
             _vpcService.validateNtkwOffForVpc(3, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1),
2L, "10.1.1.1");
             result = true;
         } catch (InvalidParameterValueException ex) {
+            msg = ex.getMessage();
         } finally {
             if (!result) {
-                s_logger.debug("Test3 passed, can't use network offering without conserve
mode = true");
+                s_logger.debug("Test passed: " + msg);
             } else {
-                s_logger.warn("Test3 failed, can't use network offering without conserve
mode = true");
+                s_logger.warn("TEST FAILED, can't use network offering without conserve mode
= true");
             }
         }
         
-       //3) invalid offering - guest type shared
+        //4) invalid offering - guest type shared
         result = false;
         try {
             _vpcService.validateNtkwOffForVpc(4, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1),
2L, "10.1.1.1");
             result = true;
-        } catch (InvalidParameterValueException ex) { 
+        } catch (InvalidParameterValueException ex) {
+            msg = ex.getMessage();
         } finally {
             if (!result) {
-                s_logger.debug("Test4 passed, can't use network offering with guest type
= Shared");
+                s_logger.debug("Test passed: " + msg);
             } else {
-                s_logger.warn("Test4 failed, can't use network offering with guest type =
Shared");
+                s_logger.warn("TEST FAILED, can't use network offering with guest type =
Shared");
             }
         }
+        
+        //5) Invalid offering - no redundant router supportresult = false;
+        try {
+            _vpcService.validateNtkwOffForVpc(5, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1),
2L, "10.1.1.1");
+            result = true;
+        } catch (InvalidParameterValueException ex) {
+            msg = ex.getMessage();
+        } finally {
+            if (!result) {
+                s_logger.debug("Test passed: " + msg);
+            } else {
+                s_logger.warn("TEST FAILED, can't use network offering with guest type =
Shared");
+            }
+        }
+        
+        //6) Only one network in the VPC can support LB service - positive scenario
+        
+        //7) Only one netowrk in the VPC can support LB service - negative scenario
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java b/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
new file mode 100644
index 0000000..0038403
--- /dev/null
+++ b/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
@@ -0,0 +1,339 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+// 
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.vpc.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.NetworkAccountVO;
+import com.cloud.network.NetworkVO;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+
+@Local(value = NetworkDao.class)
+@DB(txn = false)
+public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements
NetworkDao{
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByOwner(long)
+     */
+    @Override
+    public List<NetworkVO> listByOwner(long ownerId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listBy(long, long, long)
+     */
+    @Override
+    public List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listBy(long, long, java.lang.String, boolean)
+     */
+    @Override
+    public List<NetworkVO> listBy(long accountId, long dataCenterId, String cidr, boolean
skipVpc) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByZoneAndGuestType(long, long, com.cloud.network.Network.GuestType,
java.lang.Boolean)
+     */
+    @Override
+    public List<NetworkVO> listByZoneAndGuestType(long accountId, long dataCenterId,
GuestType type, Boolean isSystem) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#persist(com.cloud.network.NetworkVO, boolean,
java.util.Map)
+     */
+    @Override
+    public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#createSearchBuilderForAccount()
+     */
+    @Override
+    public SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getNetworksForOffering(long, long, long)
+     */
+    @Override
+    public List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId,
long accountId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getNextAvailableMacAddress(long)
+     */
+    @Override
+    public String getNextAvailableMacAddress(long networkConfigId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listBy(long, long)
+     */
+    @Override
+    public List<NetworkVO> listBy(long accountId, long networkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#countByZoneAndUri(long, java.lang.String)
+     */
+    @Override
+    public long countByZoneAndUri(long zoneId, String broadcastUri) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#countByZoneUriAndGuestType(long, java.lang.String,
com.cloud.network.Network.GuestType)
+     */
+    @Override
+    public long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType)
{
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByZone(long)
+     */
+    @Override
+    public List<NetworkVO> listByZone(long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#changeActiveNicsBy(long, int)
+     */
+    @Override
+    public void changeActiveNicsBy(long networkId, int nicsCount) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getActiveNicsIn(long)
+     */
+    @Override
+    public int getActiveNicsIn(long networkId) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#findNetworksToGarbageCollect()
+     */
+    @Override
+    public List<Long> findNetworksToGarbageCollect() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#clearCheckForGc(long)
+     */
+    @Override
+    public void clearCheckForGc(long networkId) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByZoneSecurityGroup(java.lang.Long)
+     */
+    @Override
+    public List<NetworkVO> listByZoneSecurityGroup(Long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#addDomainToNetwork(long, long, java.lang.Boolean)
+     */
+    @Override
+    public void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess)
{
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetwork(long)
+     */
+    @Override
+    public List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listSecurityGroupEnabledNetworks()
+     */
+    @Override
+    public List<NetworkVO> listSecurityGroupEnabledNetworks() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkTrafficType(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public List<NetworkVO> listByPhysicalNetworkTrafficType(long physicalNetworkId,
TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listBy(long, long, com.cloud.network.Network.GuestType,
com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public List<NetworkVO> listBy(long accountId, long dataCenterId, GuestType type,
TrafficType trafficType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkAndProvider(long, java.lang.String)
+     */
+    @Override
+    public List<NetworkVO> listByPhysicalNetworkAndProvider(long physicalNetworkId,
String providerName) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#persistNetworkServiceProviders(long, java.util.Map)
+     */
+    @Override
+    public void persistNetworkServiceProviders(long networkId, Map<String, String>
serviceProviderMap) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#update(java.lang.Long, com.cloud.network.NetworkVO,
java.util.Map)
+     */
+    @Override
+    public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap)
{
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
+     */
+    @Override
+    public List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#setCheckForGc(long)
+     */
+    @Override
+    public void setCheckForGc(long networkId) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getNetworkCountByNetworkOffId(long)
+     */
+    @Override
+    public int getNetworkCountByNetworkOffId(long networkOfferingId) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#countNetworksUserCanCreate(long)
+     */
+    @Override
+    public long countNetworksUserCanCreate(long ownerId) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listSourceNATEnabledNetworks(long, long, com.cloud.network.Network.GuestType)
+     */
+    @Override
+    public List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId,
GuestType type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getNetworkCountByVpcId(long)
+     */
+    @Override
+    public int getNetworkCountByVpcId(long vpcId) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#listByVpc(long)
+     */
+    @Override
+    public List<NetworkVO> listByVpc(long vpcId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#getPrivateNetwork(java.lang.String, java.lang.String,
long, long)
+     */
+    @Override
+    public NetworkVO getPrivateNetwork(String broadcastUri, String cidr, long accountId,
long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see com.cloud.network.dao.NetworkDao#countVpcNetworks(long)
+     */
+    @Override
+    public long countVpcNetworks(long vpcId) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java b/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
index 0595dcb..833bbd9 100644
--- a/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockNetworkOfferingDaoImpl.java
@@ -98,19 +98,6 @@ public class MockNetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO
             //network offering valid for vpc
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null,
null, false,
                     Availability.Optional, null, Network.GuestType.Isolated, false, false);
-            Class<?> c = vo.getClass();
-
-            try {
-                Field f = c.getDeclaredField("id");
-                f.setAccessible(true);
-                f.setLong(vo, 1L);
-            } catch (NoSuchFieldException ex) {
-               s_logger.warn(ex);
-               return null;
-            } catch (IllegalAccessException ex) {
-                s_logger.warn(ex);
-                return null;
-            }            
         } else if (id.longValue() == 2) {
             //invalid offering - source nat is not included
             vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null,
null, false,
@@ -123,9 +110,36 @@ public class MockNetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO
             //network offering invalid for vpc (Shared)
             vo = new NetworkOfferingVO("non vpc", "non vpc", TrafficType.Guest, false, true,
null, null, false,
                     Availability.Optional, null, Network.GuestType.Shared, false, false);
+        } else if (id.longValue() == 5) {
+            //network offering invalid for vpc (Shared)
+            vo = new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null,
null, false,
+                    Availability.Optional, null, Network.GuestType.Isolated, false, false);
+            vo.setRedundantRouter(true);
+        }
+        
+        if (vo != null) {
+            vo = setId(vo, id);
         }
         
         return vo;
     }
+    
+    private NetworkOfferingVO setId(NetworkOfferingVO vo, long id) {
+        NetworkOfferingVO voToReturn = vo;
+        Class<?> c = voToReturn.getClass();
+        try {
+            Field f = c.getDeclaredField("id");
+            f.setAccessible(true);
+            f.setLong(voToReturn, id);
+        } catch (NoSuchFieldException ex) {
+           s_logger.warn(ex);
+           return null;
+        } catch (IllegalAccessException ex) {
+            s_logger.warn(ex);
+            return null;
+        }
+        
+        return voToReturn;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockNetworkOfferingServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkOfferingServiceMapDaoImpl.java b/server/test/com/cloud/vpc/dao/MockNetworkOfferingServiceMapDaoImpl.java
index 292b913..ac91359 100644
--- a/server/test/com/cloud/vpc/dao/MockNetworkOfferingServiceMapDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockNetworkOfferingServiceMapDaoImpl.java
@@ -14,9 +14,7 @@ package com.cloud.vpc.dao;
 
 import javax.ejb.Local;
 
-import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
-import com.cloud.offerings.NetworkOfferingServiceMapVO;
 import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.offerings.dao.NetworkOfferingServiceMapDaoImpl;
 import com.cloud.utils.db.DB;
@@ -26,20 +24,12 @@ import com.cloud.utils.db.DB;
 public class MockNetworkOfferingServiceMapDaoImpl extends NetworkOfferingServiceMapDaoImpl{
     
     @Override
-    public NetworkOfferingServiceMapVO findById(Long id) {
-        NetworkOfferingServiceMapVO vo = null;
-        System.out.println("hello alena");
-        if (id.longValue() == 0) {
-            vo = new NetworkOfferingServiceMapVO(1, Service.SourceNat, Provider.VPCVirtualRouter);
-        } else if (id.longValue() == 2) {
-            vo = new NetworkOfferingServiceMapVO(2, Service.Firewall, Provider.VirtualRouter);
-        } else if (id.longValue() == 3) {
-            vo = new NetworkOfferingServiceMapVO(3, Service.SourceNat, Provider.VPCVirtualRouter);
-        } else if (id.longValue() == 4) {
-            vo = new NetworkOfferingServiceMapVO(4, Service.SourceNat, Provider.VPCVirtualRouter);
+    public boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service...
services) {
+        if (services.length > 0 && services[0] == Service.SourceNat &&
networkOfferingId != 2) {
+            return true;
+        } else if (services.length > 0 && services[0] == Service.Lb &&
networkOfferingId != 2) {
+            return true;
         }
-        
-        return vo;
+        return false;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockNetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkOfferingVO.java b/server/test/com/cloud/vpc/dao/MockNetworkOfferingVO.java
deleted file mode 100644
index cfb9a5b..0000000
--- a/server/test/com/cloud/vpc/dao/MockNetworkOfferingVO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 Citrix Systems, Inc. Licensed under the
-// Apache License, Version 2.0 (the "License"); you may not use this
-// file except in compliance with the License.  Citrix Systems, Inc.
-// reserves all rights not expressly granted by 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.
-// 
-// Automatically generated by addcopyright.py at 04/03/2012
-package com.cloud.vpc.dao;
-
-import com.cloud.offerings.NetworkOfferingVO;
-
-public class MockNetworkOfferingVO extends NetworkOfferingVO{
-    private long id;
-    
-    public void setId(long id) {
-        this.id = id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockNetworkServiceMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkServiceMapDaoImpl.java b/server/test/com/cloud/vpc/dao/MockNetworkServiceMapDaoImpl.java
index 6b6d9fb..c4ac17d 100644
--- a/server/test/com/cloud/vpc/dao/MockNetworkServiceMapDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockNetworkServiceMapDaoImpl.java
@@ -89,20 +89,4 @@ public class MockNetworkServiceMapDaoImpl extends GenericDaoBase<NetworkServiceM
         // TODO Auto-generated method stub
         return null;
     }
-
-    @Override
-    public NetworkServiceMapVO findById(Long id) {
-        NetworkServiceMapVO vo = null;
-        if (id.longValue() == 1) {
-            vo = new NetworkServiceMapVO(1, Service.SourceNat, Provider.VPCVirtualRouter);
-        } else if (id.longValue() == 2) {
-            vo = new NetworkServiceMapVO(2, Service.Firewall, Provider.VirtualRouter);
-        } else if (id.longValue() == 3) {
-            vo = new NetworkServiceMapVO(3, Service.SourceNat, Provider.VPCVirtualRouter);
-        } else if (id.longValue() == 4) {
-            vo = new NetworkServiceMapVO(4, Service.SourceNat, Provider.VPCVirtualRouter);
-        }
-        
-        return vo;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/server/test/com/cloud/vpc/dao/MockVpcOfferingServiceMapDao.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockVpcOfferingServiceMapDao.java b/server/test/com/cloud/vpc/dao/MockVpcOfferingServiceMapDao.java
new file mode 100644
index 0000000..a06c4db
--- /dev/null
+++ b/server/test/com/cloud/vpc/dao/MockVpcOfferingServiceMapDao.java
@@ -0,0 +1,17 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+// 
+// Automatically generated by addcopyright.py at 04/03/2012
+package com.cloud.vpc.dao;
+
+public class MockVpcOfferingServiceMapDao {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d38e9eeb/utils/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/utils/test/resources/log4j.xml b/utils/test/resources/log4j.xml
index e1b0af5..fbb8939 100755
--- a/utils/test/resources/log4j.xml
+++ b/utils/test/resources/log4j.xml
@@ -84,7 +84,7 @@ under the License.
    <!-- ================ -->
 
    <category name="com.cloud">
-     <priority value="TRACE"/>
+     <priority value="DEBUG"/>
    </category>
    
    <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->


Mime
View raw message