cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [10/50] [abbrv] git commit: updated refs/heads/kvm-vnc-listen to 3890860
Date Wed, 03 Apr 2013 10:33:18 GMT
Fixes/improvements for VPC feature:

1) Added comments to VPC/VPCService/VPCManager interfaces
2) Moved VPC offering related methods from VpcService to the new interface - VpcProvisioningService
3) Fixed static nat creation in the VPC - used to result in NPE due to invalid method referencing while obtaining VPC VR information


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

Branch: refs/heads/kvm-vnc-listen
Commit: cf72aa32747a44ef876b9566d5c85db2f189b84e
Parents: f8471e5
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Fri Mar 29 16:24:24 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Fri Mar 29 16:56:01 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkModel.java        |    2 +
 api/src/com/cloud/network/vpc/Vpc.java             |   43 +++++-
 api/src/com/cloud/network/vpc/VpcOffering.java     |   21 +++-
 .../cloud/network/vpc/VpcProvisioningService.java  |   46 +++++++
 api/src/com/cloud/network/vpc/VpcService.java      |   95 +++++++++----
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    2 +
 .../command/admin/vpc/CreateVPCOfferingCmd.java    |    4 +-
 .../command/admin/vpc/DeleteVPCOfferingCmd.java    |    2 +-
 .../command/admin/vpc/UpdateVPCOfferingCmd.java    |    2 +-
 .../api/command/user/network/UpdateNetworkCmd.java |    9 +-
 .../api/command/user/vpc/ListVPCOfferingsCmd.java  |    2 +-
 server/src/com/cloud/api/ApiDBUtils.java           |   77 +++++++++--
 server/src/com/cloud/network/NetworkManager.java   |    4 +-
 .../src/com/cloud/network/NetworkManagerImpl.java  |    1 -
 server/src/com/cloud/network/NetworkModelImpl.java |   13 ++
 .../src/com/cloud/network/NetworkServiceImpl.java  |    7 +
 .../network/element/VpcVirtualRouterElement.java   |   21 ++--
 .../router/VpcVirtualNetworkApplianceManager.java  |    6 +
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   15 ++-
 server/src/com/cloud/network/vpc/VpcManager.java   |   84 +++++++-----
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |   77 +++--------
 .../src/com/cloud/network/vpc/VpcOfferingVO.java   |    1 -
 server/src/com/cloud/network/vpc/VpcVO.java        |    7 -
 .../com/cloud/network/MockNetworkModelImpl.java    |    6 +
 .../test/com/cloud/vpc/MockNetworkModelImpl.java   |    6 +
 server/test/com/cloud/vpc/MockVpcManagerImpl.java  |  106 ++-------------
 .../vpc/MockVpcVirtualNetworkApplianceManager.java |    6 +
 server/test/com/cloud/vpc/VpcApiUnitTest.java      |   37 +-----
 28 files changed, 395 insertions(+), 307 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/com/cloud/network/NetworkModel.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index 916f28a..c1f1674 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -261,4 +261,6 @@ public interface NetworkModel {
 	String getStartIpv6Address(long id);
 
     Nic getPlaceholderNic(Network network, Long podId);
+
+    boolean isProviderEnabledInZone(long zoneId, String provider);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/com/cloud/network/vpc/Vpc.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java
index c07077f..249e80f 100644
--- a/api/src/com/cloud/network/vpc/Vpc.java
+++ b/api/src/com/cloud/network/vpc/Vpc.java
@@ -20,32 +20,63 @@ import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
-import com.cloud.network.Network;
-
 public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
+    
     public enum State {
         Enabled,
         Inactive
     }
 
-   public static final String _supportedProviders = Network.Provider.VPCVirtualRouter.getName();
-
-   boolean readyToUse();
-
+    /**
+     * 
+     * @return VPC name
+     */
    String getName();
 
+   
+   /**
+    * @return the id of the zone the VPC belongs to
+    */
    long getZoneId();
 
+   
+   /**
+    * @return super CIDR of the VPC. All the networks participating in VPC, should have CIDRs that are the part of the super cidr
+    */
    String getCidr();
 
+   /**
+    * 
+    * @return VPC state
+    */
    State getState();
 
+   
+   /**
+    * 
+    * @return VPC offering id - the offering that VPC is created from
+    */
    long getVpcOfferingId();
 
+   
+   /**
+    * 
+    * @return VPC display text
+    */
    String getDisplayText();
 
+   
+   /**
+    * 
+    * @return VPC network domain. All networks participating in the VPC, become the part of the same network domain
+    */
    String getNetworkDomain();
 
+   
+   /**
+    * 
+    * @return true if restart is required for the VPC; false otherwise
+    */
    boolean isRestartRequired();
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/com/cloud/network/vpc/VpcOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/com/cloud/network/vpc/VpcOffering.java
index 1acfcd2..3961d0a 100644
--- a/api/src/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/com/cloud/network/vpc/VpcOffering.java
@@ -27,18 +27,33 @@ public interface VpcOffering extends InternalIdentity, Identity {
 
     public static final String defaultVPCOfferingName = "Default VPC offering";
 
+    /**
+     * 
+     * @return VPC offering name
+     */
     String getName();
 
-    String getUniqueName();
-
+    
+    /**
+     * @return VPC offering display text
+     */
     String getDisplayText();
+    
 
+    /**
+     * 
+     * @return VPC offering state
+     */
     State getState();
 
+    /**
+     * 
+     * @return true if offering is default - came with the cloudStack fresh install; false otherwise
+     */
     boolean isDefault();
 
     /**
-     * @return
+     * @return service offering id used by VPC virutal router
      */
     Long getServiceOfferingId();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/com/cloud/network/vpc/VpcProvisioningService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
new file mode 100644
index 0000000..70676ce
--- /dev/null
+++ b/api/src/com/cloud/network/vpc/VpcProvisioningService.java
@@ -0,0 +1,46 @@
+// 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 com.cloud.network.vpc;
+
+import java.util.List;
+import java.util.Map;
+
+public interface VpcProvisioningService {
+    
+    public VpcOffering getVpcOffering(long vpcOfferingId);
+    
+    public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders);
+    
+    List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
+            Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
+    
+    /**
+     * @param offId
+     * @return
+     */
+    public boolean deleteVpcOffering(long offId);
+    
+    /**
+     * @param vpcOffId
+     * @param vpcOfferingName
+     * @param displayText
+     * @param state
+     * @return
+     */
+    public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 9bf1bee..07ce89b 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -18,7 +18,6 @@ package com.cloud.network.vpc;
 
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
 import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
@@ -31,45 +30,29 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.IpAddress;
 import com.cloud.network.Network;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.user.Account;
-import com.cloud.user.User;
 import com.cloud.utils.Pair;
 
 public interface VpcService {
 
-    public VpcOffering getVpcOffering(long vpcOfferingId);
-
-    public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders);
-
-    public Vpc getVpc(long vpcId);
-
-    public Vpc getActiveVpc(long vpcId);
-
-    public List<? extends Network> getVpcNetworks(long vpcId);
-
-    Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId);
-
-    List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
-            Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
-
-    /**
-     * @param offId
+    /**Returns existing VPC found by id
+     * 
+     * @param vpcId
      * @return
      */
-    public boolean deleteVpcOffering(long offId);
+    public Vpc getVpc(long vpcId);
 
+    
     /**
-     * @param vpcOffId
-     * @param vpcOfferingName
-     * @param displayText
-     * @param state
+     * Returns all the Guest networks that are part of VPC
+     * 
+     * @param vpcId
      * @return
      */
-    public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
+    public List<? extends Network> getVpcNetworks(long vpcId);
 
     /**
+     * Persists VPC record in the database
+     * 
      * @param zoneId
      * @param vpcOffId
      * @param vpcOwnerId
@@ -83,7 +66,10 @@ public interface VpcService {
     public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr,
             String networkDomain) throws ResourceAllocationException;
 
+    
     /**
+     * Deletes a VPC
+     * 
      * @param vpcId
      * @return
      * @throws InsufficientCapacityException
@@ -92,7 +78,10 @@ public interface VpcService {
      */
     public boolean deleteVpc(long vpcId) throws ConcurrentOperationException, ResourceUnavailableException;
 
+    
     /**
+     * Updates VPC with new name/displayText
+     * 
      * @param vpcId
      * @param vpcName
      * @param displayText
@@ -100,7 +89,10 @@ public interface VpcService {
      */
     public Vpc updateVpc(long vpcId, String vpcName, String displayText);
 
+    
     /**
+     * Lists VPC(s) based on the parameters passed to the method call
+     * 
      * @param id
      * @param vpcName
      * @param displayText
@@ -127,6 +119,8 @@ public interface VpcService {
             Boolean restartRequired, Map<String, String> tags, Long projectId);
 
     /**
+     * Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend
+     * 
      * @param vpcId
      * @param destroyOnFailure TODO
      * @return
@@ -138,6 +132,8 @@ public interface VpcService {
                                                         ResourceUnavailableException, InsufficientCapacityException;
 
     /**
+     * Shuts down the VPC which includes shutting down all VPC provider and rules cleanup on the backend
+     * 
      * @param vpcId
      * @return
      * @throws ConcurrentOperationException
@@ -145,16 +141,28 @@ public interface VpcService {
      */
     boolean shutdownVpc(long vpcId) throws ConcurrentOperationException, ResourceUnavailableException;
 
+    
     /**
+     * Restarts the VPC. VPC gets shutdown and started as a part of it
+     * 
      * @param id
      * @return
      * @throws InsufficientCapacityException
      */
     boolean restartVpc(long id) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 
+    /**
+     * Returns a Private gateway found in the VPC by id
+     * 
+     * @param id
+     * @return
+     */
     PrivateGateway getVpcPrivateGateway(long id);
 
+    
     /**
+     * Persists VPC private gateway in the Database.
+     * 
      * @param vpcId TODO
      * @param physicalNetworkId
      * @param vlan
@@ -172,6 +180,8 @@ public interface VpcService {
             ConcurrentOperationException, InsufficientCapacityException;
 
     /**
+     * Applies VPC private gateway on the backend, so it becomes functional
+     * 
      * @param gatewayId
      * @param destroyOnFailure TODO
      * @return
@@ -180,7 +190,10 @@ public interface VpcService {
      */
     public PrivateGateway applyVpcPrivateGateway(long gatewayId, boolean destroyOnFailure) throws ConcurrentOperationException, ResourceUnavailableException;
 
+    
     /**
+     * Deletes VPC private gateway
+     * 
      * @param id
      * @return
      * @throws ResourceUnavailableException
@@ -188,52 +201,76 @@ public interface VpcService {
      */
     boolean deleteVpcPrivateGateway(long gatewayId) throws ConcurrentOperationException, ResourceUnavailableException;
 
+    
     /**
+     * Returns the list of Private gateways existing in the VPC
+     * 
      * @param listPrivateGatewaysCmd
      * @return
      */
     public Pair<List<PrivateGateway>, Integer> listPrivateGateway(ListPrivateGatewaysCmd listPrivateGatewaysCmd);
 
+    
     /**
+     * Returns Static Route found by Id
+     * 
      * @param routeId
      * @return
      */
     StaticRoute getStaticRoute(long routeId);
 
+    
     /**
+     * Applies existing Static Routes to the VPC elements
+     * 
      * @param vpcId
      * @return
      * @throws ResourceUnavailableException
      */
     public boolean applyStaticRoutes(long vpcId) throws ResourceUnavailableException;
 
+    
     /**
+     * Deletes static route from the backend and the database
+     * 
      * @param routeId
      * @return TODO
      * @throws ResourceUnavailableException
      */
     public boolean revokeStaticRoute(long routeId) throws ResourceUnavailableException;
 
+    
     /**
+     * Persists static route entry in the Database
+     * 
      * @param gatewayId
      * @param cidr
      * @return
      */
     public StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException;
 
+    
     /**
+     * Lists static routes based on parameters passed to the call
+     * 
      * @param listStaticRoutesCmd
      * @return
      */
     public Pair<List<? extends StaticRoute>, Integer> listStaticRoutes(ListStaticRoutesCmd cmd);
 
+    
     /**
+     * Returns gateway (VPN or Public) existign in the VPC 
+     * 
      * @param id
      * @return
      */
     VpcGateway getVpcGateway(long id);
 
+    
     /**
+     * Associates IP address from the Public network, to the VPC
+     * 
      * @param ipId
      * @param vpcId
      * @return
@@ -245,6 +282,4 @@ public interface VpcService {
     IpAddress associateIPToVpc(long ipId, long vpcId) throws ResourceAllocationException, ResourceUnavailableException,
         InsufficientAddressCapacityException, ConcurrentOperationException;
 
-    public Network updateVpcGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
-            User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr, String guestVmCidr);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 7ccb72e..78a2af3 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -52,6 +52,7 @@ import com.cloud.network.firewall.NetworkACLService;
 import com.cloud.network.lb.LoadBalancingRulesService;
 import com.cloud.network.rules.RulesService;
 import com.cloud.network.security.SecurityGroupService;
+import com.cloud.network.vpc.VpcProvisioningService;
 import com.cloud.network.vpc.VpcService;
 import com.cloud.network.vpn.RemoteAccessVpnService;
 import com.cloud.network.vpn.Site2SiteVpnService;
@@ -132,6 +133,7 @@ public abstract class BaseCmd {
     @Inject public NetworkUsageService _networkUsageService;
     @Inject public VMSnapshotService _vmSnapshotService;
     @Inject public DataStoreProviderApiService dataStoreProviderApiService;
+    @Inject public VpcProvisioningService _vpcProvSvc;
 
     public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index 3c7956b..4a3a92a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
@@ -98,7 +98,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
 
     @Override
     public void create() throws ResourceAllocationException {
-        VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders());
+        VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders());
         if (vpcOff != null) {
             this.setEntityId(vpcOff.getId());
             this.setEntityUuid(vpcOff.getUuid());
@@ -109,7 +109,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
 
     @Override
     public void execute() {
-        VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
+        VpcOffering vpc = _vpcProvSvc.getVpcOffering(this.getEntityId());
         if (vpc != null) {
             VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(vpc);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
index 9e2968e..4b16fa5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
@@ -66,7 +66,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
 
     @Override
     public void execute(){
-        boolean result = _vpcService.deleteVpcOffering(getId());
+        boolean result = _vpcProvSvc.deleteVpcOffering(getId());
         if (result) {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
index de61ee7..9bbae06 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
@@ -88,7 +88,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
 
     @Override
     public void execute(){
-        VpcOffering result = _vpcService.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
+        VpcOffering result = _vpcProvSvc.updateVpcOffering(getId(), getVpcOfferingName(), getDisplayText(), getState());
         if (result != null) {
             VpcOfferingResponse response = _responseGenerator.createVpcOfferingResponse(result);
             response.setResponseName(getCommandName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 41aaaaa..a61474e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -129,14 +129,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
             throw new InvalidParameterValueException("Couldn't find network by id");
         }
 
-        Network result = null;
-        if (network.getVpcId() != null) {
-            result = _vpcService.updateVpcGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
+        Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
                     callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
-        } else {
-            result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
-                    callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
-        }
+        
 
         if (result != null) {
             NetworkResponse response = _responseGenerator.createNetworkResponse(result);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
index 9aef26f..ddae799 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
@@ -92,7 +92,7 @@ public class ListVPCOfferingsCmd extends BaseListCmd{
 
     @Override
     public void execute(){
-        List<? extends VpcOffering> offerings = _vpcService.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(),
+        List<? extends VpcOffering> offerings = _vpcProvSvc.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(),
                 getSupportedServices(), isDefault, this.getKeyword(), getState(), this.getStartIndex(), this.getPageSizeVal());
         ListResponse<VpcOfferingResponse> response = new ListResponse<VpcOfferingResponse>();
         List<VpcOfferingResponse> offeringResponses = new ArrayList<VpcOfferingResponse>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 8e6f806..7b44190 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -95,8 +95,20 @@ import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationService;
 import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.*;
-import com.cloud.dc.dao.*;
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.Vlan;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.AccountVlanMapDao;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.dc.dao.VlanDao;
 import com.cloud.domain.DomainVO;
 import com.cloud.domain.dao.DomainDao;
 import com.cloud.event.Event;
@@ -162,7 +174,12 @@ import com.cloud.network.security.SecurityGroup;
 import com.cloud.network.security.SecurityGroupManager;
 import com.cloud.network.security.SecurityGroupVO;
 import com.cloud.network.security.dao.SecurityGroupDao;
-import com.cloud.network.vpc.*;
+import com.cloud.network.vpc.StaticRouteVO;
+import com.cloud.network.vpc.VpcGatewayVO;
+import com.cloud.network.vpc.VpcManager;
+import com.cloud.network.vpc.VpcOffering;
+import com.cloud.network.vpc.VpcProvisioningService;
+import com.cloud.network.vpc.VpcVO;
 import com.cloud.network.vpc.dao.StaticRouteDao;
 import com.cloud.network.vpc.dao.VpcDao;
 import com.cloud.network.vpc.dao.VpcGatewayDao;
@@ -177,19 +194,57 @@ import com.cloud.projects.ProjectAccount;
 import com.cloud.projects.ProjectInvitation;
 import com.cloud.projects.ProjectService;
 import com.cloud.resource.ResourceManager;
-import com.cloud.server.*;
+import com.cloud.server.Criteria;
+import com.cloud.server.ManagementServer;
+import com.cloud.server.ResourceTag;
 import com.cloud.server.ResourceTag.TaggedResourceType;
+import com.cloud.server.StatsCollector;
+import com.cloud.server.TaggedResourceService;
 import com.cloud.service.ServiceOfferingVO;
 import com.cloud.service.dao.ServiceOfferingDao;
-import com.cloud.storage.*;
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.storage.GuestOS;
+import com.cloud.storage.GuestOSCategoryVO;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.SnapshotVO;
 import com.cloud.storage.Storage.ImageFormat;
-
+import com.cloud.storage.StorageManager;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.StorageStats;
+import com.cloud.storage.UploadVO;
+import com.cloud.storage.VMTemplateHostVO;
+import com.cloud.storage.VMTemplateS3VO;
+import com.cloud.storage.VMTemplateSwiftVO;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.Volume;
 import com.cloud.storage.Volume.Type;
-import com.cloud.storage.dao.*;
+import com.cloud.storage.VolumeHostVO;
+import com.cloud.storage.VolumeManager;
+import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.GuestOSCategoryDao;
+import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.SnapshotDao;
+import com.cloud.storage.dao.SnapshotPolicyDao;
+import com.cloud.storage.dao.UploadDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VMTemplateDetailsDao;
+import com.cloud.storage.dao.VMTemplateHostDao;
+import com.cloud.storage.dao.VMTemplateS3Dao;
+import com.cloud.storage.dao.VMTemplateSwiftDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.storage.dao.VolumeHostDao;
 import com.cloud.storage.snapshot.SnapshotPolicy;
 import com.cloud.template.TemplateManager;
-import com.cloud.user.*;
-
+import com.cloud.user.Account;
+import com.cloud.user.AccountDetailsDao;
+import com.cloud.user.AccountVO;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.SSHKeyPairVO;
+import com.cloud.user.User;
+import com.cloud.user.UserAccount;
+import com.cloud.user.UserStatisticsVO;
+import com.cloud.user.UserVO;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.SSHKeyPairDao;
 import com.cloud.user.dao.UserDao;
@@ -202,7 +257,6 @@ import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.InstanceGroup;
 import com.cloud.vm.InstanceGroupVO;
 import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicSecondaryIp;
 import com.cloud.vm.UserVmDetailVO;
 import com.cloud.vm.UserVmManager;
 import com.cloud.vm.UserVmVO;
@@ -324,6 +378,7 @@ public class ApiDBUtils {
     static VMSnapshotDao _vmSnapshotDao;
     static ClusterDetailsDao _clusterDetailsDao;
     static NicSecondaryIpDao _nicSecondaryIpDao;
+    static VpcProvisioningService _vpcProvSvc;
 
     @Inject private ManagementServer ms;
     @Inject public AsyncJobManager asyncMgr;
@@ -427,6 +482,7 @@ public class ApiDBUtils {
     @Inject private ClusterDetailsDao clusterDetailsDao;
     @Inject private VMSnapshotDao vmSnapshotDao;
     @Inject private NicSecondaryIpDao nicSecondaryIpDao;
+    @Inject private VpcProvisioningService vpcProvSvc;
     @PostConstruct
     void init() {
         _ms = ms;
@@ -528,6 +584,7 @@ public class ApiDBUtils {
         _clusterDetailsDao = clusterDetailsDao;
         _vmSnapshotDao = vmSnapshotDao;
         _nicSecondaryIpDao = nicSecondaryIpDao;
+        _vpcProvSvc = vpcProvSvc;
         // Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
         _statsCollector = StatsCollector.getInstance();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java
index e961f04..851f7f5 100755
--- a/server/src/com/cloud/network/NetworkManager.java
+++ b/server/src/com/cloud/network/NetworkManager.java
@@ -20,8 +20,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+
 import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.Pod;
 import com.cloud.dc.Vlan.VlanType;
 import com.cloud.deploy.DataCenterDeployment;
@@ -51,13 +51,11 @@ import com.cloud.user.User;
 import com.cloud.utils.Pair;
 import com.cloud.vm.Nic;
 import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicSecondaryIp;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
 
 /**
  * NetworkManager manages the network for the different end users.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 42544ae..c0685ba 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1528,7 +1528,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
         // associate a source NAT IP (if one isn't already associated with the network)
 
         boolean sharedSourceNat = offering.getSharedSourceNat();
-        DataCenter zone = _dcDao.findById(network.getDataCenterId());
         if (network.getGuestType() == Network.GuestType.Isolated
                && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat)
                && !sharedSourceNat) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index e7bdbca..d967f33 100644
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -1212,6 +1212,19 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
         }
         return isProviderEnabled(ntwkSvcProvider);
     }
+    
+    @Override
+    public boolean isProviderEnabledInZone(long zoneId, String provider)
+    {
+        //the provider has to be enabled at least in one network in the zone
+        for (PhysicalNetwork pNtwk : _physicalNetworkDao.listByZone(zoneId)) {
+            if (isProviderEnabledInPhysicalNetwork(pNtwk.getId(), provider)) {
+                return true;
+            }
+        }
+        
+        return false;
+    }
 
     @Override
     public String getNetworkTag(HypervisorType hType, Network network) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 846d79e..d503459 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -94,6 +94,7 @@ import com.cloud.network.rules.FirewallRuleVO;
 import com.cloud.network.rules.PortForwardingRuleVO;
 import com.cloud.network.rules.RulesManager;
 import com.cloud.network.vpc.PrivateIpVO;
+import com.cloud.network.vpc.Vpc;
 import com.cloud.network.vpc.VpcManager;
 import com.cloud.network.vpc.dao.PrivateIpDao;
 import com.cloud.offering.NetworkOffering;
@@ -1715,6 +1716,12 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             ex.addProxyObject("networks", networkId, "networkId");
             throw ex;
         }
+        
+        //perform below validation if the network is vpc network
+        if (network.getVpcId() != null && networkOfferingId != null) {
+            Vpc vpc = _vpcMgr.getVpc(network.getVpcId());
+            _vpcMgr.validateNtwkOffForNtwkInVpc(networkId, networkOfferingId, null, null, vpc, null, _accountMgr.getAccount(network.getAccountId()));
+        }
 
         // don't allow to update network in Destroy state
         if (network.getState() == Network.State.Destroy) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index c7d4aed..0844369 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -37,6 +37,7 @@ import com.cloud.network.Network;
 import com.cloud.network.Network.Capability;
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
+import com.cloud.network.NetworkModel;
 import com.cloud.network.PublicIpAddress;
 import com.cloud.network.Site2SiteVpnConnection;
 import com.cloud.network.Site2SiteVpnGateway;
@@ -76,6 +77,8 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
     Site2SiteVpnGatewayDao _vpnGatewayDao;
     @Inject
     IPAddressDao _ipAddressDao;
+    @Inject
+    NetworkModel _ntwkModel;
 
     private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
 
@@ -322,7 +325,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
             return false;
         }
 
-        List<DomainRouterVO> routers = _vpcMgr.getVpcRouters(gateway.getVpcId());
+        List<DomainRouterVO> routers = _vpcRouterMgr.getVpcRouters(gateway.getVpcId());
         if (routers == null || routers.isEmpty()) {
             s_logger.debug(this.getName() + " element doesn't need to create Private gateway on the backend; VPC virtual " +
                     "router doesn't exist in the vpc id=" + gateway.getVpcId());
@@ -345,7 +348,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
             return false;
         }
 
-        List<DomainRouterVO> routers = _vpcMgr.getVpcRouters(gateway.getVpcId());
+        List<DomainRouterVO> routers = _vpcRouterMgr.getVpcRouters(gateway.getVpcId());
         if (routers == null || routers.isEmpty()) {
             s_logger.debug(this.getName() + " element doesn't need to delete Private gateway on the backend; VPC virtual " +
                     "router doesn't exist in the vpc id=" + gateway.getVpcId());
@@ -361,10 +364,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
         return _vpcRouterMgr.destroyPrivateGateway(gateway, router);
     }
 
-    @Override
-    protected List<DomainRouterVO> getRouters(Network network, DeployDestination dest) {
-        return  _vpcMgr.getVpcRouters(network.getVpcId());
-    }
 
     @Override
     public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> services) 
@@ -377,7 +376,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
             }
         }
         if (canHandle) {
-            List<DomainRouterVO> routers = getRouters(network, null);
+            List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
             if (routers == null || routers.isEmpty()) {
                 s_logger.debug(this.getName() + " element doesn't need to associate ip addresses on the backend; VPC virtual " +
                         "router doesn't exist in the network " + network.getId());
@@ -446,12 +445,12 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
         Long vpcId = ip.getVpcId();
         Vpc vpc = _vpcMgr.getVpc(vpcId);
 
-        if (!_vpcMgr.vpcProviderEnabledInZone(vpc.getZoneId(), Provider.VPCVirtualRouter.getName())) {
+        if (!_ntwkModel.isProviderEnabledInZone(vpc.getZoneId(), Provider.VPCVirtualRouter.getName())) {
             throw new ResourceUnavailableException("VPC provider is not enabled in zone " + vpc.getZoneId(),
                     DataCenter.class, vpc.getZoneId());
         }
 
-        List<DomainRouterVO> routers = _vpcMgr.getVpcRouters(ip.getVpcId());
+        List<DomainRouterVO> routers = _vpcRouterMgr.getVpcRouters(ip.getVpcId());
         if (routers == null || routers.size() != 1) {
             throw new ResourceUnavailableException("Cannot enable site-to-site VPN on the backend; virtual router doesn't exist in the vpc " + ip.getVpcId(),
                     DataCenter.class, vpc.getZoneId());
@@ -474,12 +473,12 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
         Long vpcId = ip.getVpcId();
         Vpc vpc = _vpcMgr.getVpc(vpcId);
 
-        if (!_vpcMgr.vpcProviderEnabledInZone(vpc.getZoneId(), Provider.VPCVirtualRouter.getName())) {
+        if (!_ntwkModel.isProviderEnabledInZone(vpc.getZoneId(), Provider.VPCVirtualRouter.getName())) {
             throw new ResourceUnavailableException("VPC provider is not enabled in zone " + vpc.getZoneId(),
                     DataCenter.class, vpc.getZoneId());
         }
 
-        List<DomainRouterVO> routers = _vpcMgr.getVpcRouters(ip.getVpcId());
+        List<DomainRouterVO> routers = _vpcRouterMgr.getVpcRouters(ip.getVpcId());
         if (routers == null || routers.size() != 1) {
             throw new ResourceUnavailableException("Cannot enable site-to-site VPN on the backend; virtual router doesn't exist in the vpc " + ip.getVpcId(),
                     DataCenter.class, vpc.getZoneId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 297ae9b..76c8aa8 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
@@ -101,4 +101,10 @@ public interface VpcVirtualNetworkApplianceManager extends VirtualNetworkApplian
      * @throws ResourceUnavailableException
      */
     boolean stopSite2SiteVpn(Site2SiteVpnConnection conn, VirtualRouter router) throws ResourceUnavailableException;
+    
+    /**
+     * @param vpcId
+     * @return
+     */
+    List<DomainRouterVO> getVpcRouters(long vpcId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 22d823f..bdfac06 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -234,7 +234,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         long dcId = dest.getDataCenter().getId();
         
         DeploymentPlan plan = new DataCenterDeployment(dcId);
-        List<DomainRouterVO> routers = _routerDao.listByVpcId(vpcId);
+        List<DomainRouterVO> routers = getVpcRouters(vpcId);
         
         return new Pair<DeploymentPlan, List<DomainRouterVO>>(plan, routers);
     }
@@ -1212,7 +1212,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         networks = super.createRouterNetworks(owner, isRedundant, plan, null, sourceNatIp);
 
         //2) allocate nic for private gateway if needed
-        VpcGateway privateGateway = _vpcMgr.getPrivateGatewayForVpc(vpcId);
+        PrivateGateway privateGateway = _vpcMgr.getVpcPrivateGateway(vpcId);
         if (privateGateway != null) {
             NicProfile privateNic = createPrivateNicProfileForGateway(privateGateway);
             Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId());
@@ -1233,7 +1233,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         for (IPAddressVO ip : ips) {
             PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId()));
             if ((ip.getState() == IpAddress.State.Allocated || ip.getState() == IpAddress.State.Allocating) 
-                    && _vpcMgr.ipUsedInVpc(ip)&& !publicVlans.contains(publicIp.getVlanTag())) {
+                    && _vpcMgr.isIpAllocatedToVpc(ip)&& !publicVlans.contains(publicIp.getVlanTag())) {
                 s_logger.debug("Allocating nic for router in vlan " + publicIp.getVlanTag());
                 NicProfile publicNic = new NicProfile();
                 publicNic.setDefaultNic(false);
@@ -1314,7 +1314,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             long publicNtwkId = ip.getNetworkId();
             
             //if ip is not associated to any network, and there are no firewall rules, release it on the backend
-            if (!_vpcMgr.ipUsedInVpc(ip)) {
+            if (!_vpcMgr.isIpAllocatedToVpc(ip)) {
                 ip.setState(IpAddress.State.Releasing);
             }
                          
@@ -1334,7 +1334,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             long publicNtwkId = ip.getNetworkId();
             
             //if ip is not associated to any network, and there are no firewall rules, release it on the backend
-            if (!_vpcMgr.ipUsedInVpc(ip)) {
+            if (!_vpcMgr.isIpAllocatedToVpc(ip)) {
                 ip.setState(IpAddress.State.Releasing);
             }
                          
@@ -1376,4 +1376,9 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         }
     }
     
+    @Override
+    public List<DomainRouterVO> getVpcRouters(long vpcId) {
+        return _routerDao.listByVpcId(vpcId);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 714330d..84ab8ef 100644
--- a/server/src/com/cloud/network/vpc/VpcManager.java
+++ b/server/src/com/cloud/network/vpc/VpcManager.java
@@ -17,8 +17,11 @@
 package com.cloud.network.vpc;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientCapacityException;
@@ -27,33 +30,27 @@ import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.network.IpAddress;
 import com.cloud.network.Network;
+import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.addr.PublicIp;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
-import com.cloud.vm.DomainRouterVO;
 
 
 public interface VpcManager extends VpcService{
 
     /**
-     * @param ntwkOffId
-     * @param cidr
-     * @param networkDomain
-     * @param networkOwner
-     * @param vpc TODO
-     * @param networkId TODO
-     * @param gateway TODO
+     * Returns all existing VPCs for a given account
+     * @param accountId
      * @return
      */
-    void validateNtkwOffForVpc(long ntwkOffId, String cidr, String networkDomain, Account networkOwner, 
-            Vpc vpc, Long networkId, String gateway);
-
-    
     List<? extends Vpc> getVpcsForAccount(long accountId);
 
+    
     /**
+     * Destroys the VPC
+     * 
      * @param vpc
      * @param caller TODO
      * @param callerUserId TODO
@@ -63,34 +60,19 @@ public interface VpcManager extends VpcService{
      */
     boolean destroyVpc(Vpc vpc, Account caller, Long callerUserId) throws ConcurrentOperationException, ResourceUnavailableException;
 
-    /**
-     * @param vpcId
-     * @return
-     */
-    List<DomainRouterVO> getVpcRouters(long vpcId);
-
-    /**
-     * @param zoneId
-     * @param provider
-     * @return
-     */
-    boolean vpcProviderEnabledInZone(long zoneId, String provider);
-
-    /**
-     * @param vpcId
-     * @return
-     */
-    VpcGateway getPrivateGatewayForVpc(long vpcId);
-
 
     /**
+     * Returns true if the IP is allocated to the VPC; false otherwise
+     * 
      * @param ip
      * @return
      */
-    boolean ipUsedInVpc(IpAddress ip);
+    boolean isIpAllocatedToVpc(IpAddress ip);
 
 
     /**
+     * Disassociates the public IP address from VPC
+     * 
      * @param ipId
      * @param networkId
      */
@@ -98,6 +80,8 @@ public interface VpcManager extends VpcService{
 
 
     /**
+     * Creates guest network in the VPC
+     * 
      * @param ntwkOffId
      * @param name
      * @param displayText
@@ -125,9 +109,11 @@ public interface VpcManager extends VpcService{
 
 
     /**
+     * Assigns source nat public IP address to VPC
+     * 
      * @param owner
      * @param vpc
-     * @return
+     * @return public IP address object
      * @throws InsufficientAddressCapacityException
      * @throws ConcurrentOperationException
      */
@@ -135,6 +121,8 @@ public interface VpcManager extends VpcService{
 
 
     /**
+     * Validates network offering to find if it can be used for network creation in VPC
+     * 
      * @param guestNtwkOff
      * @param supportedSvcs TODO
      */
@@ -142,8 +130,36 @@ public interface VpcManager extends VpcService{
 
 
     /**
-     * @return
+     * @return list of hypervisors that are supported by VPC
      */
     List<HypervisorType> getSupportedVpcHypervisors();
+    
+    
+    /**
+     * Lists all the services and providers that the current VPC suppots
+     * @param vpcOffId
+     * @return map of Service to Provider(s) map 
+     */
+    Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId);
+    
+    
+    /**
+     * Returns VPC that is ready to be used
+     * @param vpcId
+     * @return VPC object
+     */
+    public Vpc getActiveVpc(long vpcId);
 
+
+    /**
+     * Performs network offering validation to determine if it can be used for network upgrade inside the VPC 
+     * @param networkId
+     * @param newNtwkOffId
+     * @param newCidr
+     * @param newNetworkDomain
+     * @param vpc
+     * @param gateway
+     * @param networkOwner TODO
+     */
+    void validateNtwkOffForNtwkInVpc(Long networkId, long newNtwkOffId, String newCidr, String newNetworkDomain, Vpc vpc, String gateway, Account networkOwner);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 fee4ef3..3948f2e 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -31,13 +31,12 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.network.element.StaticNatServiceProvider;
+import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
 import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.Resource.ResourceType;
@@ -77,6 +76,7 @@ import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.dao.PhysicalNetworkDao;
 import com.cloud.network.dao.Site2SiteVpnGatewayDao;
+import com.cloud.network.element.StaticNatServiceProvider;
 import com.cloud.network.element.VpcProvider;
 import com.cloud.network.vpc.VpcOffering.State;
 import com.cloud.network.vpc.dao.PrivateIpDao;
@@ -103,8 +103,6 @@ import com.cloud.user.UserContext;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
-
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -124,8 +122,8 @@ import com.cloud.vm.dao.DomainRouterDao;
 
 
 @Component
-@Local(value = { VpcManager.class, VpcService.class })
-public class VpcManagerImpl extends ManagerBase implements VpcManager{
+@Local(value = { VpcManager.class, VpcService.class, VpcProvisioningService.class })
+public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvisioningService{
     private static final Logger s_logger = Logger.getLogger(VpcManagerImpl.class);
     @Inject
     VpcOfferingDao _vpcOffDao;
@@ -584,19 +582,6 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
         
         return createVpc(zoneId, vpcOffId, owner, vpcName, displayText, cidr, networkDomain);
     }
-    
-    @Override
-    public boolean vpcProviderEnabledInZone(long zoneId, String provider)
-    {
-        //the provider has to be enabled at least in one network in the zone
-        for (PhysicalNetwork pNtwk : _pNtwkDao.listByZone(zoneId)) {
-            if (_ntwkModel.isProviderEnabledInPhysicalNetwork(pNtwk.getId(), provider)) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
 
     
     @DB
@@ -656,7 +641,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
             }
 
 
-            if (!vpcProviderEnabledInZone(zoneId, provider)) {
+            if (!_ntwkModel.isProviderEnabledInZone(zoneId, provider)) {
                 throw new InvalidParameterValueException("Provider " + provider +
                         " should be enabled in at least one physical network of the zone specified");
             }
@@ -1015,20 +1000,20 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
         return success;
     }
     
-    @Override
     @DB
-    public void validateNtkwOffForVpc(long ntwkOffId, String cidr, String networkDomain, 
-            Account networkOwner, Vpc vpc, Long networkId, String gateway) {
+    @Override
+    public void validateNtwkOffForNtwkInVpc(Long networkId, long newNtwkOffId, String newCidr, 
+            String newNetworkDomain, Vpc vpc, String gateway, Account networkOwner) {
         
-        NetworkOffering guestNtwkOff = _configMgr.getNetworkOffering(ntwkOffId);
+        NetworkOffering guestNtwkOff = _configMgr.getNetworkOffering(newNtwkOffId);
         
         if (guestNtwkOff == null) {
             throw new InvalidParameterValueException("Can't find network offering by id specified");
         }
-
+        
         if (networkId == null) {
             //1) Validate attributes that has to be passed in when create new guest network
-            validateNewVpcGuestNetwork(cidr, gateway, networkOwner, vpc, networkDomain); 
+            validateNewVpcGuestNetwork(newCidr, gateway, networkOwner, vpc, newNetworkDomain); 
         }
 
         //2) validate network offering attributes
@@ -1213,7 +1198,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
         }
 
         //4) Delete private gateway
-        VpcGateway gateway = getPrivateGatewayForVpc(vpcId);
+        PrivateGateway gateway = getVpcPrivateGateway(vpcId);
         if (gateway != null) {
             s_logger.debug("Deleting private gateway " + gateway + " as a part of vpc " + vpcId + " resources cleanup");
             if (!deleteVpcPrivateGateway(gateway.getId())) {
@@ -1270,11 +1255,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
         }  
     }
     
-    @Override
-    public List<DomainRouterVO> getVpcRouters(long vpcId) {
-        return _routerDao.listByVpcId(vpcId);
-    }
-
+    
     @Override
     public PrivateGateway getVpcPrivateGateway(long id) {
         VpcGateway gateway = _vpcGatewayDao.findById(id);
@@ -1835,11 +1816,6 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
             }
         }
     }
-    
-    @Override
-    public VpcGateway getPrivateGatewayForVpc(long vpcId) {
-        return _vpcGatewayDao.getPrivateGatewayForVpc(vpcId);
-    }
 
     
     @DB
@@ -1895,7 +1871,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
     @Override
     public void unassignIPFromVpcNetwork(long ipId, long networkId) {
         IPAddressVO ip = _ipAddressDao.findById(ipId);
-        if (ipUsedInVpc(ip)) {
+        if (isIpAllocatedToVpc(ip)) {
             return;
         }
 
@@ -1927,7 +1903,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
     }
     
     @Override
-    public boolean ipUsedInVpc(IpAddress ip) {
+    public boolean isIpAllocatedToVpc(IpAddress ip) {
         return (ip != null && ip.getVpcId() != null && 
                 (ip.isOneToOneNat() || !_firewallDao.listByIp(ip.getId()).isEmpty()));
     }
@@ -1957,7 +1933,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
         }
         
         //1) Validate if network can be created for VPC
-        validateNtkwOffForVpc(ntwkOffId, cidr, networkDomain, owner, vpc, null, gateway);
+        validateNtwkOffForNtwkInVpc(null, ntwkOffId, cidr, networkDomain, vpc, gateway, owner);
 
         //2) Create network
         Network guestNetwork = _ntwkMgr.createGuestNetwork(ntwkOffId, name, displayText, gateway, cidr, vlanId, 
@@ -2020,24 +1996,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager{
 
         return ipToReturn;
     }
-
-
-    @Override
-    public Network updateVpcGuestNetwork(long networkId, String name, String displayText, Account callerAccount, 
-            User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr, String guestVmCidr) {
-        NetworkVO network = _ntwkDao.findById(networkId);
-        if (network == null) {
-            throw new InvalidParameterValueException("Couldn't find network by id");
-        }
-        //perform below validation if the network is vpc network
-        if (network.getVpcId() != null && ntwkOffId != null) {
-            Vpc vpc = getVpc(network.getVpcId());
-            validateNtkwOffForVpc(ntwkOffId, null, null, null, vpc, networkId, null);
-        }
-        
-        return _ntwkSvc.updateGuestNetwork(networkId, name, displayText, callerAccount, callerUser, domainSuffix,
-                ntwkOffId, changeCidr, guestVmCidr);
-    }
+    
 
     @Override
     public List<HypervisorType> getSupportedVpcHypervisors() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/vpc/VpcOfferingVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcOfferingVO.java b/server/src/com/cloud/network/vpc/VpcOfferingVO.java
index dce7a81..9d5becf 100644
--- a/server/src/com/cloud/network/vpc/VpcOfferingVO.java
+++ b/server/src/com/cloud/network/vpc/VpcOfferingVO.java
@@ -102,7 +102,6 @@ public class VpcOfferingVO implements VpcOffering {
         return name;
     }
 
-    @Override
     public String getUniqueName() {
         return uniqueName;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/src/com/cloud/network/vpc/VpcVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcVO.java b/server/src/com/cloud/network/vpc/VpcVO.java
index 634df05..7b784eb 100644
--- a/server/src/com/cloud/network/vpc/VpcVO.java
+++ b/server/src/com/cloud/network/vpc/VpcVO.java
@@ -26,9 +26,7 @@ import javax.persistence.Enumerated;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import org.apache.cloudstack.api.Identity;
 import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
 
 @Entity
 @Table(name="vpc")
@@ -94,11 +92,6 @@ public class VpcVO implements Vpc {
         this.networkDomain = networkDomain;
         this.vpcOfferingId = vpcOffId;
     }
-    
-    @Override
-    public boolean readyToUse() {
-        return state == State.Enabled;
-    }
 
     @Override
     public long getId() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/test/com/cloud/network/MockNetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkModelImpl.java b/server/test/com/cloud/network/MockNetworkModelImpl.java
index b926519..c578965 100644
--- a/server/test/com/cloud/network/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/network/MockNetworkModelImpl.java
@@ -844,4 +844,10 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
         // TODO Auto-generated method stub
         return null;
     }
+
+    @Override
+    public boolean isProviderEnabledInZone(long zoneId, String provider) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/test/com/cloud/vpc/MockNetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkModelImpl.java b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
index b05e8ea..e1534cb 100644
--- a/server/test/com/cloud/vpc/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
@@ -857,4 +857,10 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
         return null;
     }
 
+    @Override
+    public boolean isProviderEnabledInZone(long zoneId, String provider) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/test/com/cloud/vpc/MockVpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcManagerImpl.java b/server/test/com/cloud/vpc/MockVpcManagerImpl.java
index e6c6520..0f26928 100644
--- a/server/test/com/cloud/vpc/MockVpcManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockVpcManagerImpl.java
@@ -47,15 +47,11 @@ import com.cloud.network.vpc.StaticRoute;
 import com.cloud.network.vpc.Vpc;
 import com.cloud.network.vpc.VpcGateway;
 import com.cloud.network.vpc.VpcManager;
-import com.cloud.network.vpc.VpcOffering;
 import com.cloud.network.vpc.VpcService;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
-import com.cloud.user.User;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
-import com.cloud.vm.DomainRouterVO;
 import com.cloud.vpc.dao.MockVpcDaoImpl;
 
 @Component
@@ -63,19 +59,6 @@ import com.cloud.vpc.dao.MockVpcDaoImpl;
 public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
     @Inject MockVpcDaoImpl _vpcDao;
 
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#getVpcOffering(long)
-     */
-    @Override
-    public VpcOffering getVpcOffering(long vpcOfferingId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders) {
-        return null;
-    }
 
     /* (non-Javadoc)
      * @see com.cloud.network.vpc.VpcService#getVpc(long)
@@ -105,42 +88,6 @@ public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
     }
 
     /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#getVpcOffSvcProvidersMap(long)
-     */
-    @Override
-    public Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#listVpcOfferings(java.lang.Long, java.lang.String, java.lang.String, java.util.List, java.lang.Boolean, java.lang.String, java.lang.String, java.lang.Long, java.lang.Long)
-     */
-    @Override
-    public List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#deleteVpcOffering(long)
-     */
-    @Override
-    public boolean deleteVpcOffering(long offId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#updateVpcOffering(long, java.lang.String, java.lang.String, java.lang.String)
-     */
-    @Override
-    public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
      * @see com.cloud.network.vpc.VpcService#createVpc(long, long, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
      */
     @Override
@@ -314,19 +261,6 @@ public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
     }
 
     /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcService#updateVpcGuestNetwork(long, java.lang.String, java.lang.String, com.cloud.user.Account, com.cloud.user.User, java.lang.String, java.lang.Long, java.lang.Boolean)
-     */
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcManager#validateNtkwOffForVpc(long, java.lang.String, java.lang.String, com.cloud.user.Account, com.cloud.network.vpc.Vpc, java.lang.Long, java.lang.String)
-     */
-    @Override
-    public void validateNtkwOffForVpc(long ntwkOffId, String cidr, String networkDomain, Account networkOwner, Vpc vpc, Long networkId, String gateway) {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
      * @see com.cloud.network.vpc.VpcManager#getVpcsForAccount(long)
      */
     @Override
@@ -344,34 +278,13 @@ public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
         return false;
     }
 
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcManager#getVpcRouters(long)
-     */
-    @Override
-    public List<DomainRouterVO> getVpcRouters(long vpcId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
 
-    @Override
-    public boolean vpcProviderEnabledInZone(long zoneId, String provider) {
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see com.cloud.network.vpc.VpcManager#getPrivateGatewayForVpc(long)
-     */
-    @Override
-    public VpcGateway getPrivateGatewayForVpc(long vpcId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
 
     /* (non-Javadoc)
      * @see com.cloud.network.vpc.VpcManager#ipUsedInVpc(com.cloud.network.IpAddress)
      */
     @Override
-    public boolean ipUsedInVpc(IpAddress ip) {
+    public boolean isIpAllocatedToVpc(IpAddress ip) {
         // TODO Auto-generated method stub
         return false;
     }
@@ -458,11 +371,16 @@ public class MockVpcManagerImpl extends ManagerBase implements VpcManager {
         return null;
     }
 
-	@Override
-	public Network updateVpcGuestNetwork(long networkId, String name,  String displayText, Account callerAccount, User callerUser,
-			String domainSuffix, Long ntwkOffId, Boolean changeCidr,	String guestVmCidr) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Override
+    public Map<Service, Set<Provider>> getVpcOffSvcProvidersMap(long vpcOffId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void validateNtwkOffForNtwkInVpc(Long networkId, long newNtwkOffId, String newCidr, String newNetworkDomain, Vpc vpc, String gateway, Account networkOwner) {
+        // TODO Auto-generated method stub
+        
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
index 0b47d1d..ef5478b 100644
--- a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
+++ b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
@@ -396,4 +396,10 @@ VpcVirtualNetworkApplianceService {
         return false;
     }
 
+    @Override
+    public List<DomainRouterVO> getVpcRouters(long vpcId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf72aa32/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 8e64ab1..d4d5b29 100644
--- a/server/test/com/cloud/vpc/VpcApiUnitTest.java
+++ b/server/test/com/cloud/vpc/VpcApiUnitTest.java
@@ -30,38 +30,13 @@ import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import com.cloud.configuration.dao.ConfigurationDaoImpl;
-import com.cloud.configuration.dao.ResourceCountDaoImpl;
-import com.cloud.dc.dao.VlanDaoImpl;
 import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.network.Network.Service;
-import com.cloud.network.dao.FirewallRulesDaoImpl;
-import com.cloud.network.dao.IPAddressDaoImpl;
-import com.cloud.network.dao.PhysicalNetworkDaoImpl;
-import com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl;
 import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcManager;
 import com.cloud.network.vpc.VpcManagerImpl;
-import com.cloud.network.vpc.dao.PrivateIpDaoImpl;
-import com.cloud.network.vpc.dao.StaticRouteDaoImpl;
-import com.cloud.network.vpc.dao.VpcGatewayDaoImpl;
-import com.cloud.network.vpc.dao.VpcOfferingDaoImpl;
-import com.cloud.server.ManagementService;
-import com.cloud.tags.dao.ResourceTagsDaoImpl;
 import com.cloud.user.AccountVO;
-import com.cloud.user.MockAccountManagerImpl;
-import com.cloud.user.dao.AccountDaoImpl;
 import com.cloud.utils.component.ComponentContext;
 
-import com.cloud.vm.dao.DomainRouterDaoImpl;
-import com.cloud.vpc.dao.MockNetworkDaoImpl;
-import com.cloud.vpc.dao.MockNetworkOfferingDaoImpl;
-import com.cloud.vpc.dao.MockNetworkOfferingServiceMapDaoImpl;
-import com.cloud.vpc.dao.MockNetworkServiceMapDaoImpl;
-import com.cloud.vpc.dao.MockVpcDaoImpl;
-import com.cloud.vpc.dao.MockVpcOfferingDaoImpl;
-import com.cloud.vpc.dao.MockVpcOfferingServiceMapDaoImpl;
-
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = "classpath:/VpcTestContext.xml")
 public class VpcApiUnitTest extends TestCase{
@@ -180,7 +155,7 @@ public class VpcApiUnitTest extends TestCase{
         //1) correct network offering
         boolean result = false;
         try {
-            _vpcService.validateNtkwOffForVpc(1, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 1, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
             s_logger.debug("Validate network offering: Test passed: the offering is valid for vpc creation");
         } catch (Exception ex) {
@@ -191,7 +166,7 @@ public class VpcApiUnitTest extends TestCase{
         result = false;
         String msg = null;
         try {
-            _vpcService.validateNtkwOffForVpc(2, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 2, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
         } catch (InvalidParameterValueException ex) {
             msg = ex.getMessage();
@@ -207,7 +182,7 @@ public class VpcApiUnitTest extends TestCase{
         result = false;
         msg = null;
         try {
-            _vpcService.validateNtkwOffForVpc(3, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 3, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
         } catch (InvalidParameterValueException ex) {
             msg = ex.getMessage();
@@ -222,7 +197,7 @@ public class VpcApiUnitTest extends TestCase{
         //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");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 4, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
         } catch (InvalidParameterValueException ex) {
             msg = ex.getMessage();
@@ -237,7 +212,7 @@ public class VpcApiUnitTest extends TestCase{
         //5) Invalid offering - no redundant router support
         result = false;
         try {
-            _vpcService.validateNtkwOffForVpc(5, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 5, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
         } catch (InvalidParameterValueException ex) {
             msg = ex.getMessage();
@@ -252,7 +227,7 @@ public class VpcApiUnitTest extends TestCase{
         //6) Only one network in the VPC can support LB service - negative scenario
         result = false;
         try {
-            _vpcService.validateNtkwOffForVpc(6, "0.0.0.0", "111-", new AccountVO(), _vpcService.getVpc(1), 2L, "10.1.1.1");
+            _vpcService.validateNtwkOffForNtwkInVpc(2L, 6, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO());
             result = true;
             s_logger.debug("Validate network offering: Test passed: the offering is valid for vpc creation");
         } catch (InvalidParameterValueException ex) {


Mime
View raw message