You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2013/10/29 17:36:23 UTC

[1/3] git commit: updated refs/heads/network-guru-orchestration to 7c2077f

Updated Branches:
  refs/heads/network-guru-orchestration [created] 7c2077ff9


Move orchestration logic to the NetworkOrchestrator. This puts the decision whicks gurus will create the network in the hands of the orchestrator instead of with each individual guru.

This would also make it easier for new network providers to add themselves to the system. No elaborate canHandle checks, but just a capabilities list.


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

Branch: refs/heads/network-guru-orchestration
Commit: 9f2d940174d1c0427426b6bbac5399af162572c2
Parents: cc4b612
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Oct 29 17:32:38 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Oct 29 17:32:38 2013 +0100

----------------------------------------------------------------------
 api/src/com/cloud/network/PhysicalNetwork.java  |   4 +-
 api/src/com/cloud/network/guru/NetworkGuru.java |  38 ++
 .../orchestration/NetworkOrchestrator.java      | 388 +++++++++++--------
 3 files changed, 274 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f2d9401/api/src/com/cloud/network/PhysicalNetwork.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index 55b18e6..dd90f8e 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -18,10 +18,11 @@ package com.cloud.network;
 
 import java.util.List;
 
-import com.cloud.utils.Pair;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
+import com.cloud.utils.Pair;
+
 /**
  *
  */
@@ -33,6 +34,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
     }
 
     public enum IsolationMethod {
+        NONE,
         VLAN,
         L3,
         GRE,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f2d9401/api/src/com/cloud/network/guru/NetworkGuru.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/guru/NetworkGuru.java b/api/src/com/cloud/network/guru/NetworkGuru.java
index 57ffef8..039142e 100755
--- a/api/src/com/cloud/network/guru/NetworkGuru.java
+++ b/api/src/com/cloud/network/guru/NetworkGuru.java
@@ -16,14 +16,19 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.List;
+
+import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.utils.component.Adapter;
@@ -201,8 +206,41 @@ public interface NetworkGuru extends Adapter {
 
     void updateNetworkProfile(NetworkProfile networkProfile);
 
+    @Deprecated
     TrafficType[] getSupportedTrafficType();
 
+    @Deprecated
     boolean isMyTrafficType(TrafficType type);
 
+    /**
+     * The guru needs to supply the information about what networking types are supported to
+     * the network orchestrator.
+     * @return list of supported NetworkTypes
+     */
+    List<NetworkType> getSupportedNetworkTypes();
+
+    /**
+     * The guru needs to supply the information about what traffic types are
+     * supported to the network orchestrator.
+     * 
+     * @return list of supported TrafficTypes
+     */
+    List<TrafficType> getSupportedTrafficTypes();
+
+    /**
+     * The guru needs to supply the information about what guest networking
+     * types are supported to the network orchestrator.
+     * 
+     * @return list of supported GuestTypes
+     */
+    List<GuestType> getSupportedGuestTypes();
+
+    /**
+     * The guru needs to supply the information about what networking types are
+     * supported to the network orchestrator.
+     * 
+     * @return list of supported IsolationMethods
+     */
+    List<IsolationMethod> getSupportedIsolationMethods();
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9f2d9401/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 5636e07..b447a4d 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -36,7 +36,9 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@@ -106,6 +108,7 @@ import com.cloud.network.NetworkStateListener;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.PhysicalNetworkSetupInfo;
 import com.cloud.network.RemoteAccessVpn;
 import com.cloud.network.addr.PublicIp;
@@ -167,14 +170,14 @@ import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.GlobalLock;
-import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
-import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.TransactionCallback;
+import com.cloud.utils.db.TransactionCallbackNoReturn;
+import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
+import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.fsm.StateMachine2;
@@ -412,76 +415,76 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 //#1 - quick cloud network offering
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
-                        Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true, false, null,
-                false, null, true);
+                            Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true, false, null,
+                            false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#2 - SG enabled network offering
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
-                        TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true,
-                false, null, false, null, true);
+                            TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true,
+                            false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#3 - shared network offering with no SG service
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
-                Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false, null, true);
+                            Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#4 - default isolated offering with Source nat service
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
-                        "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
-                defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true);
-        
+                            "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
+                            defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null, true);
+
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#5 - default vpc offering with LB service
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
-                        "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null, defaultVPCOffProviders, true,
-                Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
+                            "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null, defaultVPCOffProviders, true,
+                            Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#6 - default vpc offering with no LB service
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB) == null) {
                     //remove LB service
                     defaultVPCOffProviders.remove(Service.Lb);
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
-                        "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional, null,
-                defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
+                            "Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional, null,
+                            defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#7 - isolated offering with source nat disabled
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
-                        TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null,
-                true, false, null, false, null, true);
+                            TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null,
+                            true, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 //#8 - network offering with internal lb service
                 Map<Network.Service, Set<Network.Provider>> internalLbOffProviders = new HashMap<Network.Service, Set<Network.Provider>>();
                 Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
                 defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
-        
+
                 Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
                 defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
-        
+
                 internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
                 internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
                 internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
@@ -489,17 +492,17 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
                 internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
                 internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
-        
+
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
-                        "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders, true,
-                Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
+                            "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders, true,
+                            Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     offering.setInternalLb(true);
                     offering.setPublicLb(false);
                     _networkOfferingDao.update(offering.getId(), offering);
                 }
-        
+
                 Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
                 Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
                 vrProvider.add(Provider.VirtualRouter);
@@ -513,7 +516,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 netscalerServiceProviders.put(Service.SecurityGroup, sgProvider);
                 netscalerServiceProviders.put(Service.StaticNat, nsProvider);
                 netscalerServiceProviders.put(Service.Lb, nsProvider);
-        
+
                 Map<Service, Map<Capability, String>> serviceCapabilityMap = new HashMap<Service, Map<Capability, String>>();
                 Map<Capability, String> elb = new HashMap<Capability, String>();
                 elb.put(Capability.ElasticLb, "true");
@@ -521,11 +524,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 eip.put(Capability.ElasticIp, "true");
                 serviceCapabilityMap.put(Service.Lb, elb);
                 serviceCapabilityMap.put(Service.StaticNat, eip);
-        
+
                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
                     offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
-                        "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null, netscalerServiceProviders,
-                true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
+                            "Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null, netscalerServiceProviders,
+                            true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
                     offering.setState(NetworkOffering.State.Enabled);
                     offering.setDedicatedLB(false);
                     _networkOfferingDao.update(offering.getId(), offering);
@@ -555,10 +558,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         SearchBuilder<PodVlanMapVO> podVlanMapSB = _podVlanMapDao.createSearchBuilder();
         podVlanMapSB.and("podId", podVlanMapSB.entity().getPodId(), Op.EQ);
         AssignIpAddressFromPodVlanSearch.join("podVlanMapSB", podVlanMapSB, podVlanMapSB.entity().getVlanDbId(), AssignIpAddressFromPodVlanSearch.entity().getVlanId(),
-            JoinType.INNER);
+                JoinType.INNER);
         AssignIpAddressFromPodVlanSearch.join("vlan", podVlanSearch, podVlanSearch.entity().getId(), AssignIpAddressFromPodVlanSearch.entity().getVlanId(), JoinType.INNER);
-        
-                       
+
+
         AssignIpAddressFromPodVlanSearch.done();
 
         _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Network-Scavenger"));
@@ -589,14 +592,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
-        throws ConcurrentOperationException {
+            throws ConcurrentOperationException {
         return setupNetwork(owner, offering, null, plan, name, displayText, false, null, null, null, null, true);
     }
 
     @Override
     @DB
     public List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final Network predefined, final DeploymentPlan plan, final String name, final String displayText,
-        boolean errorIfAlreadySetup, final Long domainId, final ACLType aclType, final Boolean subdomainAccess, final Long vpcId, final Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException {
+            boolean errorIfAlreadySetup, final Long domainId, final ACLType aclType, final Boolean subdomainAccess, final Long vpcId, final Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException {
 
         Account locked = _accountDao.acquireInLockTable(owner.getId());
         if (locked == null) {
@@ -605,10 +608,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
         try {
             if (predefined == null || (offering.getTrafficType() != TrafficType.Guest && predefined.getCidr() == null && predefined.getBroadcastUri() == null &&
-                !(predefined.getBroadcastDomainType() == BroadcastDomainType.Vlan || 
-                predefined.getBroadcastDomainType() == BroadcastDomainType.Lswitch || 
-                predefined.getBroadcastDomainType() == BroadcastDomainType.Vxlan)
-                )) {
+                    !(predefined.getBroadcastDomainType() == BroadcastDomainType.Vlan ||
+                    predefined.getBroadcastDomainType() == BroadcastDomainType.Lswitch ||
+                    predefined.getBroadcastDomainType() == BroadcastDomainType.Vxlan)
+                    )) {
                 List<NetworkVO> configs = _networksDao.listBy(owner.getId(), offering.getId(), plan.getDataCenterId());
                 if (configs.size() > 0) {
                     if (s_logger.isDebugEnabled()) {
@@ -617,7 +620,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
                     if (errorIfAlreadySetup) {
                         InvalidParameterValueException ex = new InvalidParameterValueException(
-                            "Found existing network configuration (with specified id) for offering (with specified id)");
+                                "Found existing network configuration (with specified id) for offering (with specified id)");
                         ex.addProxyObject(offering.getUuid(), "offeringId");
                         ex.addProxyObject(configs.get(0).getUuid(), "networkConfigId");
                         throw ex;
@@ -631,7 +634,43 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
             long related = -1;
 
-            for (final NetworkGuru guru : _networkGurus) {
+            /*
+             * Determine all the important factors for deciding which guru can handle this network.
+             */
+
+            DataCenter dc = _dcDao.findById(plan.getDataCenterId());
+            NetworkType networkType = dc.getNetworkType();
+            TrafficType trafficType = offering.getTrafficType();
+            GuestType guestType = offering.getGuestType();
+            List<IsolationMethod> isolationMethods = new ArrayList<IsolationMethod>();
+
+            PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
+            if (physnet != null) {
+                List<String> physIsolationMethods = physnet.getIsolationMethods();
+                if (physIsolationMethods.isEmpty()) {
+                    s_logger.warn("Empty isolation method on physical network " + physnet.getName() + " setting to NONE");
+                    isolationMethods.add(IsolationMethod.NONE);
+                }
+                for (String isolationMethodName : physIsolationMethods) {
+                    isolationMethods.add(IsolationMethod.valueOf(isolationMethodName));
+                }
+            } else {
+                isolationMethods.add(IsolationMethod.NONE);
+            }
+
+            List<NetworkGuru> gurus = getSupportedNetworkGurus(networkType, trafficType, guestType, isolationMethods);
+            if (gurus.isEmpty()) {
+                CloudRuntimeException ex = new CloudRuntimeException("No gurus support the requested networking types.");
+                ex.addProxyObject(offering.getUuid(), "offeringId");
+            }
+
+            if (gurus.size() > 1) {
+                s_logger.warn("Multiple gurus indicate a willingness to handle the network design for offering" + offering.getName());
+            }
+
+            for (final NetworkGuru guru : gurus) {
+                s_logger.debug("Asking " + guru.getName() + " to design a network of offering " + offering.getName());
+
                 final Network network = guru.design(offering, plan, predefined, owner);
                 if (network == null) {
                     continue;
@@ -656,11 +695,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     @Override
                     public void doInTransactionWithoutResult(TransactionStatus status) {
                         NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(), relatedFile, name, displayText,
-                            predefined.getNetworkDomain(), offering.getGuestType(), plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.getSpecifyIpRanges(), vpcId);
+                                predefined.getNetworkDomain(), offering.getGuestType(), plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.getSpecifyIpRanges(), vpcId);
                         vo.setDisplayNetwork(isDisplayNetworkEnabled == null ? true : isDisplayNetworkEnabled);
                         networks.add(_networksDao.persist(vo, vo.getGuestType() == Network.GuestType.Isolated,
-                            finalizeServicesAndProvidersForNetwork(offering, plan.getPhysicalNetworkId())));
-        
+                                finalizeServicesAndProvidersForNetwork(offering, plan.getPhysicalNetworkId())));
+
                         if (domainId != null && aclType == ACLType.Domain) {
                             _networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null ? true : subdomainAccess);
                         }
@@ -685,41 +724,41 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     @Override
     @DB
     public void allocate(final VirtualMachineProfile vm, final LinkedHashMap<? extends Network, ? extends NicProfile> networks) throws InsufficientCapacityException,
-        ConcurrentOperationException {
+    ConcurrentOperationException {
 
         Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() {
             @Override
             public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException {
                 int deviceId = 0;
-        
+
                 boolean[] deviceIds = new boolean[networks.size()];
                 Arrays.fill(deviceIds, false);
-        
+
                 List<NicProfile> nics = new ArrayList<NicProfile>(networks.size());
                 NicProfile defaultNic = null;
-        
+
                 for (Map.Entry<? extends Network, ? extends NicProfile> network : networks.entrySet()) {
                     Network config = network.getKey();
                     NicProfile requested = network.getValue();
-        
+
                     Boolean isDefaultNic = false;
                     if (vm != null && (requested != null && requested.isDefaultNic())) {
                         isDefaultNic = true;
                     }
-        
+
                     while (deviceIds[deviceId] && deviceId < deviceIds.length) {
                         deviceId++;
                     }
-        
+
                     Pair<NicProfile, Integer> vmNicPair = allocateNic(requested, config, isDefaultNic, deviceId, vm);
-        
+
                     NicProfile vmNic = vmNicPair.first();
                     if (vmNic == null) {
                         continue;
                     }
-        
+
                     deviceId = vmNicPair.second();
-        
+
                     int devId = vmNic.getDeviceId();
                     if (devId > deviceIds.length) {
                         throw new IllegalArgumentException("Device id for nic is too large: " + vmNic);
@@ -727,26 +766,26 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     if (deviceIds[devId]) {
                         throw new IllegalArgumentException("Conflicting device id for two different nics: " + vmNic);
                     }
-        
+
                     deviceIds[devId] = true;
-        
+
                     if (vmNic.isDefaultNic()) {
                         if (defaultNic != null) {
                             throw new IllegalArgumentException("You cannot specify two nics as default nics: nic 1 = " + defaultNic + "; nic 2 = " + vmNic);
                         }
                         defaultNic = vmNic;
                     }
-        
+
                     nics.add(vmNic);
                     vm.addNic(vmNic);
-        
+
                 }
-        
+
                 if (nics.size() != networks.size()) {
                     s_logger.warn("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size());
                     throw new CloudRuntimeException("Number of nics " + nics.size() + " doesn't match number of requested networks " + networks.size());
                 }
-        
+
                 if (nics.size() == 1) {
                     nics.get(0).setDefaultNic(true);
                 }
@@ -757,7 +796,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     @DB
     @Override
     public Pair<NicProfile, Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId, VirtualMachineProfile vm)
-        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
+            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
 
         NetworkVO ntwkVO = _networksDao.findById(network.getId());
         s_logger.debug("Allocating nic for vm " + vm.getVirtualMachine() + " in network " + network + " with requested profile " + requested);
@@ -789,7 +828,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
         Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
         NicProfile vmNic = new NicProfile(vo, network, vo.getBroadcastUri(), vo.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network),
-            _networkModel.getNetworkTag(vm.getHypervisorType(), network));
+                _networkModel.getNetworkTag(vm.getHypervisorType(), network));
 
         return new Pair<NicProfile, Integer>(vmNic, Integer.valueOf(deviceId));
     }
@@ -903,7 +942,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     @Override
     @DB
     public Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException, InsufficientCapacityException {
+    ResourceUnavailableException, InsufficientCapacityException {
         Pair<NetworkGuru, NetworkVO> implemented = new Pair<NetworkGuru, NetworkVO>(null, null);
 
         NetworkVO network = _networksDao.findById(networkId);
@@ -1002,7 +1041,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public void implementNetworkElementsAndResources(DeployDestination dest, ReservationContext context, Network network, NetworkOffering offering)
-        throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException {
+            throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException {
 
         // Associate a source NAT IP (if one isn't already associated with the network) if this is a
         //     1) 'Isolated' or 'Shared' guest virtual network in the advance zone
@@ -1013,7 +1052,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         DataCenter zone = _dcDao.findById(network.getDataCenterId());
 
         if (!sharedSourceNat && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.SourceNat) &&
-            (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
+                (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
 
             List<IPAddressVO> ips = null;
             if (network.getVpcId() != null) {
@@ -1042,7 +1081,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     // network id instead of the physical network id.
                     // So just throw this exception as is. We may need to TBD by changing the serializer.
                     throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                    network.getPhysicalNetworkId());
+                            network.getPhysicalNetworkId());
                 }
 
                 if (s_logger.isDebugEnabled()) {
@@ -1063,7 +1102,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             s_logger.warn("Failed to re-program the network as a part of network " + network + " implement");
             // see DataCenterVO.java
             ResourceUnavailableException ex = new ResourceUnavailableException("Unable to apply network rules as a part of network " + network + " implement", DataCenter.class,
-                network.getDataCenterId());
+                    network.getDataCenterId());
             ex.addProxyObject(_entityMgr.findById(DataCenter.class, network.getDataCenterId()).getUuid());
             throw ex;
         }
@@ -1097,7 +1136,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             //there are no egress rules then apply the default egress rule
             DataCenter zone = _dcDao.findById(network.getDataCenterId());
             if (offering.getEgressDefaultPolicy() && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) &&
-                (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
+                    (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
                 // add default egress rule to accept the traffic
                 _firewallMgr.applyDefaultEgressFirewallRule(network.getId(), true);
             }
@@ -1154,11 +1193,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     }
 
     protected boolean prepareElement(NetworkElement element, Network network, NicProfile profile, VirtualMachineProfile vmProfile, DeployDestination dest,
-        ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
+            ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
         element.prepare(network, profile, vmProfile, dest, context);
         if (vmProfile.getType() == Type.User && element.getProvider() != null) {
             if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp) &&
-                _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dhcp, element.getProvider()) && element instanceof DhcpServiceProvider) {
+                    _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dhcp, element.getProvider()) && element instanceof DhcpServiceProvider) {
                 DhcpServiceProvider sp = (DhcpServiceProvider)element;
                 Map<Capability, String> dhcpCapabilities = element.getCapabilities().get(Service.Dhcp);
                 String supportsMultipleSubnets = dhcpCapabilities.get(Capability.DhcpAccrossMultipleSubnets);
@@ -1170,7 +1209,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 sp.addDhcpEntry(network, profile, vmProfile, dest, context);
             }
             if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.UserData) &&
-                _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.UserData, element.getProvider()) && element instanceof UserDataServiceProvider) {
+                    _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.UserData, element.getProvider()) && element instanceof UserDataServiceProvider) {
                 UserDataServiceProvider sp = (UserDataServiceProvider)element;
                 sp.addPasswordAndUserdata(network, profile, vmProfile, dest, context);
             }
@@ -1184,14 +1223,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             @Override
             public void doInTransactionWithoutResult(TransactionStatus status) {
                 _nicDao.update(nic.getId(), nic);
-        
+
                 if (nic.getVmType() == VirtualMachine.Type.User) {
                     s_logger.debug("Changing active number of nics for network id=" + networkId + " on " + count);
                     _networksDao.changeActiveNicsBy(networkId, count);
                 }
-        
+
                 if (nic.getVmType() == VirtualMachine.Type.User ||
-                    (nic.getVmType() == VirtualMachine.Type.DomainRouter && _networksDao.findById(networkId).getTrafficType() == TrafficType.Guest)) {
+                        (nic.getVmType() == VirtualMachine.Type.DomainRouter && _networksDao.findById(networkId).getTrafficType() == TrafficType.Guest)) {
                     _networksDao.setCheckForGc(networkId);
                 }
             }
@@ -1200,7 +1239,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public void prepare(VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
-        ResourceUnavailableException {
+    ResourceUnavailableException {
         List<NicVO> nics = _nicDao.listByVmId(vmProfile.getId());
 
         // we have to implement default nics first - to ensure that default network elements start up first in multiple
@@ -1232,8 +1271,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest, ReservationContext context, long nicId, Network network)
-        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException,
-        ResourceUnavailableException {
+            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException,
+            ResourceUnavailableException {
 
         Integer networkRate = _networkModel.getNetworkRate(network.getId(), vmProfile.getId());
         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
@@ -1253,7 +1292,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
             profile = new NicProfile(nic, network, broadcastUri, isolationUri,
 
-            networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
+                    networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
             guru.reserve(profile, network, vmProfile, dest, context);
             nic.setIp4Address(profile.getIp4Address());
             nic.setAddressFormat(profile.getFormat());
@@ -1273,7 +1312,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             updateNic(nic, network.getId(), 1);
         } else {
             profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network),
-                _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
+                    _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
             guru.updateNicProfile(profile, network);
             nic.setState(Nic.State.Reserved);
             updateNic(nic, network.getId(), 1);
@@ -1284,7 +1323,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             if (providersToImplement.contains(element.getProvider())) {
                 if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                     throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                    network.getPhysicalNetworkId());
+                            network.getPhysicalNetworkId());
                 }
                 if (s_logger.isDebugEnabled()) {
                     s_logger.debug("Asking " + element.getName() + " to prepare for " + nic);
@@ -1310,7 +1349,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
             NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
             NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate, _networkModel.isSecurityGroupSupportedInNetwork(network),
-                _networkModel.getNetworkTag(vm.getHypervisorType(), network));
+                    _networkModel.getNetworkTag(vm.getHypervisorType(), network));
             if (guru instanceof NetworkMigrationResponder) {
                 if (!((NetworkMigrationResponder)guru).prepareMigration(profile, network, vm, dest, context)) {
                     s_logger.error("NetworkGuru " + guru + " prepareForMigration failed."); // XXX: Transaction error
@@ -1321,7 +1360,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (providersToImplement.contains(element.getProvider())) {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                        network.getPhysicalNetworkId());
+                                network.getPhysicalNetworkId());
                     }
                     if (element instanceof NetworkMigrationResponder) {
                         if (!((NetworkMigrationResponder)element).prepareMigration(profile, network, vm, dest, context)) {
@@ -1361,7 +1400,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (providersToImplement.contains(element.getProvider())) {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                        network.getPhysicalNetworkId());
+                                network.getPhysicalNetworkId());
                     }
                     if (element instanceof NetworkMigrationResponder) {
                         ((NetworkMigrationResponder)element).commitMigration(nicSrc, network, src, src_context, dst_context);
@@ -1392,7 +1431,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (providersToImplement.contains(element.getProvider())) {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                        network.getPhysicalNetworkId());
+                                network.getPhysicalNetworkId());
                     }
                     if (element instanceof NetworkMigrationResponder) {
                         ((NetworkMigrationResponder)element).rollbackMigration(nicDst, network, dst, src_context, dst_context);
@@ -1436,7 +1475,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                         nic.setState(Nic.State.Releasing);
                         _nicDao.update(nic.getId(), nic);
                         NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel.isSecurityGroupSupportedInNetwork(network),
-                            _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
+                                _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
                         if (guru.release(profile, vmProfile, nic.getReservationId())) {
                             applyProfileToNicForRelease(nic, profile);
                             nic.setState(Nic.State.Allocated);
@@ -1466,7 +1505,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (providersToImplement.contains(element.getProvider())) {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         throw new CloudRuntimeException("Service provider " + element.getProvider().getName() +
-                                                        " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());
+                                " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());
                     }
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Asking " + element.getName() + " to release " + profile);
@@ -1501,7 +1540,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         _nicDao.update(nic.getId(), nic);
         NetworkVO network = _networksDao.findById(nic.getNetworkId());
         NicProfile profile = new NicProfile(nic, network, null, null, null, _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(
-            vm.getHypervisorType(), network));
+                vm.getHypervisorType(), network));
 
         /*
          * We need to release the nics with a Create ReservationStrategy here
@@ -1513,7 +1552,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 if (providersToImplement.contains(element.getProvider())) {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " +
-                                                        network.getPhysicalNetworkId());
+                                network.getPhysicalNetworkId());
                     }
                     if (s_logger.isDebugEnabled()) {
                         s_logger.debug("Asking " + element.getName() + " to release " + nic);
@@ -1531,7 +1570,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
         // remove the dhcpservice ip if this is the last nic in subnet.
         if (vm.getType() == Type.User && isDhcpAccrossMultipleSubnetsSupported(network) && isLastNicInSubnet(nic) && network.getTrafficType() == TrafficType.Guest &&
-            network.getGuestType() == GuestType.Shared) {
+                network.getGuestType() == GuestType.Shared) {
             removeDhcpServiceInSubnet(nic);
         }
         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
@@ -1546,9 +1585,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     public boolean isDhcpAccrossMultipleSubnetsSupported(Network network) {
         if (!_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dhcp)) {
-        	return false;
+            return false;
         }
-    	
+
         DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network);
         Map<Network.Capability, String> capabilities = dhcpServiceProvider.getCapabilities().get(Network.Service.Dhcp);
         String supportsMultipleSubnets = capabilities.get(Network.Capability.DhcpAccrossMultipleSubnets);
@@ -1577,9 +1616,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 Transaction.execute(new TransactionCallbackNoReturn() {
                     @Override
                     public void doInTransactionWithoutResult(TransactionStatus status) {
-                    _nicIpAliasDao.update(ipAlias.getId(), ipAlias);
-                    IPAddressVO aliasIpaddressVo = _publicIpAddressDao.findByIpAndSourceNetworkId(ipAlias.getNetworkId(), ipAlias.getIp4Address());
-                    _publicIpAddressDao.unassignIpAddress(aliasIpaddressVo.getId());
+                        _nicIpAliasDao.update(ipAlias.getId(), ipAlias);
+                        IPAddressVO aliasIpaddressVo = _publicIpAddressDao.findByIpAndSourceNetworkId(ipAlias.getNetworkId(), ipAlias.getIp4Address());
+                        _publicIpAddressDao.unassignIpAddress(aliasIpaddressVo.getId());
                     }
                 });
                 if (!dhcpServiceProvider.removeDhcpSupportForSubnet(network)) {
@@ -1604,8 +1643,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     @Override
     @DB
     public Network createGuestNetwork(long networkOfferingId, final String name, final String displayText, final String gateway, final String cidr, String vlanId, String networkDomain, final Account owner,
-        final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType, Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr,
-        final Boolean isDisplayNetworkEnabled, final String isolatedPvlan) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
+            final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType, Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr,
+            final Boolean isDisplayNetworkEnabled, final String isolatedPvlan) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException {
 
         final NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId);
         // this method supports only guest network creation
@@ -1662,7 +1701,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             // if zone is basic, only Shared network offerings w/o source nat service are allowed
             if (!(ntwkOff.getGuestType() == GuestType.Shared && !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) {
                 throw new InvalidParameterValueException("For zone of type " + NetworkType.Basic + " only offerings of " + "guestType " + GuestType.Shared + " with disabled " +
-                                                         Service.SourceNat.getName() + " service are allowed");
+                        Service.SourceNat.getName() + " service are allowed");
             }
 
             if (domainId == null || domainId != Domain.ROOT_DOMAIN) {
@@ -1725,7 +1764,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             //don't allow to specify vlan tag used by physical network for dynamic vlan allocation
             if (_dcDao.findVnet(zoneId, pNtwk.getId(), vlanId).size() > 0) {
                 throw new InvalidParameterValueException("The VLAN tag " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone " +
-                                                         zone.getName());
+                        zone.getName());
             }
             String uri = BroadcastDomainType.fromString(vlanId).toString();
             // For Isolated networks, don't allow to create network with vlan that already exists in the zone
@@ -1753,7 +1792,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                                 int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId());
                                 if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) {
                                     throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" + " to the vlan range dedicated to the owner " +
-                                                                             owner.getAccountName());
+                                            owner.getAccountName());
                                 }
                             }
                         }
@@ -1772,7 +1811,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         // If networkDomain is not specified, take it from the global configuration
         if (_networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.Dns)) {
             Map<Network.Capability, String> dnsCapabilities = _networkModel.getNetworkOfferingServiceCapabilities(_entityMgr.findById(NetworkOffering.class, networkOfferingId),
-                Service.Dns);
+                    Service.Dns);
             String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification);
             if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported)) {
                 if (networkDomain != null) {
@@ -1797,9 +1836,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     // validate network domain
                     if (!NetUtils.verifyDomainName(networkDomain)) {
                         throw new InvalidParameterValueException(
-                            "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain "
-                                    + "label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
-                                    + "and the hyphen ('-'); can't start or end with \"-\"");
+                                "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain "
+                                        + "label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
+                                        + "and the hyphen ('-'); can't start or end with \"-\"");
                     }
                 }
             }
@@ -1809,12 +1848,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         // limitation, remove after we introduce support for multiple ip ranges
         // with different Cidrs for the same Shared network
         boolean cidrRequired = zone.getNetworkType() == NetworkType.Advanced &&
-                               ntwkOff.getTrafficType() == TrafficType.Guest &&
-                               (ntwkOff.getGuestType() == GuestType.Shared || (ntwkOff.getGuestType() == GuestType.Isolated && !_networkModel.areServicesSupportedByNetworkOffering(
-                                   ntwkOff.getId(), Service.SourceNat)));
+                ntwkOff.getTrafficType() == TrafficType.Guest &&
+                (ntwkOff.getGuestType() == GuestType.Shared || (ntwkOff.getGuestType() == GuestType.Isolated && !_networkModel.areServicesSupportedByNetworkOffering(
+                        ntwkOff.getId(), Service.SourceNat)));
         if (cidr == null && ip6Cidr == null && cidrRequired) {
             throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask are required when create network of" + " type " + Network.GuestType.Shared +
-                                                     " and network of type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled");
+                    " and network of type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled");
         }
 
         // No cidr can be specified in Basic zone
@@ -1842,38 +1881,38 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 DataCenterDeployment plan = new DataCenterDeployment(zoneId, null, null, null, null, physicalNetworkId);
                 NetworkVO userNetwork = new NetworkVO();
                 userNetwork.setNetworkDomain(networkDomainFinal);
-        
+
                 if (cidr != null && gateway != null) {
                     userNetwork.setCidr(cidr);
                     userNetwork.setGateway(gateway);
                 }
-        
+
                 if (ip6Cidr != null && ip6Gateway != null) {
                     userNetwork.setIp6Cidr(ip6Cidr);
                     userNetwork.setIp6Gateway(ip6Gateway);
                 }
-        
+
                 if (vlanIdFinal != null) {
-                	if (isolatedPvlan == null) {
+                    if (isolatedPvlan == null) {
                         URI uri = BroadcastDomainType.fromString(vlanIdFinal);
                         userNetwork.setBroadcastUri(uri);
-                		if (!vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) {
-                			userNetwork.setBroadcastDomainType(BroadcastDomainType.Vlan);
-                		} else {
-                			userNetwork.setBroadcastDomainType(BroadcastDomainType.Native);
-                		}
-                	} else {
-                		if (vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) {
-                			throw new InvalidParameterValueException("Cannot support pvlan with untagged primary vlan!");
-                		}
-                		userNetwork.setBroadcastUri(NetUtils.generateUriForPvlan(vlanIdFinal, isolatedPvlan));
-                		userNetwork.setBroadcastDomainType(BroadcastDomainType.Pvlan);
-                	}
-                }
-                
+                        if (!vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) {
+                            userNetwork.setBroadcastDomainType(BroadcastDomainType.Vlan);
+                        } else {
+                            userNetwork.setBroadcastDomainType(BroadcastDomainType.Native);
+                        }
+                    } else {
+                        if (vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) {
+                            throw new InvalidParameterValueException("Cannot support pvlan with untagged primary vlan!");
+                        }
+                        userNetwork.setBroadcastUri(NetUtils.generateUriForPvlan(vlanIdFinal, isolatedPvlan));
+                        userNetwork.setBroadcastDomainType(BroadcastDomainType.Pvlan);
+                    }
+                }
+
                 List<? extends Network> networks = setupNetwork(owner, ntwkOff, userNetwork, plan, name, displayText, true, domainId, aclType, subdomainAccessFinal, vpcId,
-                    isDisplayNetworkEnabled);
-        
+                        isDisplayNetworkEnabled);
+
                 Network network = null;
                 if (networks == null || networks.isEmpty()) {
                     throw new CloudRuntimeException("Fail to create a network");
@@ -1891,11 +1930,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                         network = networks.get(0);
                     }
                 }
-        
+
                 if (updateResourceCount) {
                     _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.network);
                 }
-                
+
                 return network;
             }
         });
@@ -1966,7 +2005,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, networkFinal.getGuruName());
                         NetworkProfile profile = convertNetworkToNetworkProfile(networkFinal.getId());
                         guru.shutdown(profile, _networkOfferingDao.findById(networkFinal.getNetworkOfferingId()));
-        
+
                         applyProfileToNetwork(networkFinal, profile);
                         DataCenterVO zone = _dcDao.findById(networkFinal.getDataCenterId());
                         if (isSharedNetworkOfferingWithServices(networkFinal.getNetworkOfferingId()) && (zone.getNetworkType() == NetworkType.Advanced)) {
@@ -2032,7 +2071,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 try {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         s_logger.warn("Unable to complete shutdown of the network elements due to element: " + element.getName() +
-                                      " either doesn't exist or not enabled in the physical network " + _networkModel.getPhysicalNetworkId(network));
+                                " either doesn't exist or not enabled in the physical network " + _networkModel.getPhysicalNetworkId(network));
                         success = false;
                     }
                     if (s_logger.isDebugEnabled()) {
@@ -2120,7 +2159,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 try {
                     if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
                         s_logger.warn("Unable to complete destroy of the network elements due to element: " + element.getName() +
-                                      " either doesn't exist or not enabled in the physical network " + _networkModel.getPhysicalNetworkId(network));
+                                " either doesn't exist or not enabled in the physical network " + _networkModel.getPhysicalNetworkId(network));
                         success = false;
                     }
 
@@ -2156,9 +2195,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                     @Override
                     public void doInTransactionWithoutResult(TransactionStatus status) {
                         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, networkFinal.getGuruName());
-    
+
                         guru.trash(networkFinal, _networkOfferingDao.findById(networkFinal.getNetworkOfferingId()));
-    
+
                         if (!deleteVlansInNetwork(networkFinal.getId(), context.getCaller().getId(), callerAccount)) {
                             s_logger.warn("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges");
                             throw new CloudRuntimeException("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges");
@@ -2173,12 +2212,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                                 NetworkDomainVO networkDomain = _networkDomainDao.getDomainNetworkMapByNetworkId(networkFinal.getId());
                                 if (networkDomain != null)
                                     _networkDomainDao.remove(networkDomain.getId());
-    
+
                                 NetworkAccountVO networkAccount = _networkAccountDao.getAccountNetworkMapByNetworkId(networkFinal.getId());
                                 if (networkAccount != null)
                                     _networkAccountDao.remove(networkAccount.getId());
                             }
-    
+
                             NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, networkFinal.getNetworkOfferingId());
                             boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, networkFinal.getAclType());
                             if (updateResourceCount) {
@@ -2305,7 +2344,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public boolean startNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
-        InsufficientCapacityException {
+    InsufficientCapacityException {
 
         // Check if network exists
         NetworkVO network = _networksDao.findById(networkId);
@@ -2328,7 +2367,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public boolean restartNetwork(Long networkId, Account callerAccount, User callerUser, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException,
-        InsufficientCapacityException {
+    InsufficientCapacityException {
 
         NetworkVO network = _networksDao.findById(networkId);
 
@@ -2427,7 +2466,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         assert (network != null);
         DataCenter zone = _entityMgr.findById(DataCenter.class, network.getDataCenterId());
         if (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced &&
-            isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+                isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
             return true;
         }
         return false;
@@ -2436,11 +2475,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     protected boolean isSharedNetworkOfferingWithServices(long networkOfferingId) {
         NetworkOfferingVO networkOffering = _networkOfferingDao.findById(networkOfferingId);
         if ((networkOffering.getGuestType() == Network.GuestType.Shared) &&
-            (_networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.SourceNat) ||
-             _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.StaticNat) ||
-             _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.Firewall) ||
-             _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.PortForwarding) || _networkModel.areServicesSupportedByNetworkOffering(
-                networkOfferingId, Service.Lb))) {
+                (_networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.SourceNat) ||
+                        _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.StaticNat) ||
+                        _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.Firewall) ||
+                        _networkModel.areServicesSupportedByNetworkOffering(networkOfferingId, Service.PortForwarding) || _networkModel.areServicesSupportedByNetworkOffering(
+                                networkOfferingId, Service.Lb))) {
             return true;
         }
         return false;
@@ -2872,7 +2911,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             if (checkPhysicalNetwork) {
                 if (!_pNSPDao.isServiceProviderEnabled(physicalNetworkId, provider, service)) {
                     throw new UnsupportedServiceException("Provider " + provider + " is either not enabled or doesn't " + "support service " + service +
-                                                          " in physical network id=" + physicalNetworkId);
+                            " in physical network id=" + physicalNetworkId);
                 }
             }
 
@@ -2928,8 +2967,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare)
-        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException,
-        ResourceUnavailableException {
+            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException,
+            ResourceUnavailableException {
 
         VirtualMachine vm = vmProfile.getVirtualMachine();
         DataCenter dc = _entityMgr.findById(DataCenter.class, network.getDataCenterId());
@@ -2973,7 +3012,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
                 NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
                 NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate,
-                    _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vm.getHypervisorType(), network));
+                        _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vm.getHypervisorType(), network));
                 guru.updateNicProfile(profile, network);
                 profiles.add(profile);
             }
@@ -3115,12 +3154,51 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     }
 
     public static final ConfigKey<Integer> NetworkGcWait = new ConfigKey<Integer>(Integer.class, "network.gc.wait", "Advanced", "600",
-        "Time (in seconds) to wait before shutting down a network that's not in used", false);
+            "Time (in seconds) to wait before shutting down a network that's not in used", false);
     public static final ConfigKey<Integer> NetworkGcInterval = new ConfigKey<Integer>(Integer.class, "network.gc.interval", "Advanced", "600",
-        "Seconds to wait before checking for networks to shutdown", true);
+            "Seconds to wait before checking for networks to shutdown", true);
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
         return new ConfigKey<?>[] {NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, GuestDomainSuffix, NetworkThrottlingRate};
     }
+
+    /*
+     * Returns a list of network gurus that report being able to support a certain combination of networking types.
+     */
+    private List<NetworkGuru> getSupportedNetworkGurus(NetworkType networkType, TrafficType trafficType, GuestType guestType,
+            List<IsolationMethod> isolationMethods) {
+        List<NetworkGuru> gurus = new ArrayList<NetworkGuru>();
+
+        for (NetworkGuru guru : _networkGurus ) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("Considering " + guru.getName() + " for networkType " + networkType.toString() + ", trafficType "
+                        + trafficType.toString() + ", guestType " + ((guestType != null) ? guestType.toString() : "none")
+                        + ", isolationTypes "
+                        + StringUtils.join(isolationMethods.toArray()));
+            }
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("  -- networkType " + networkType.toString() + ":" + guru.getSupportedNetworkTypes().contains(networkType));
+                s_logger.debug("  -- trafficType " + trafficType.toString() + ":" + guru.getSupportedTrafficTypes().contains(trafficType));
+                s_logger.debug("  -- isolationMethod " + StringUtils.join(isolationMethods.toArray()) + ":"
+                        + guru.getSupportedTrafficTypes().contains(trafficType));
+            }
+            if (guru.getSupportedNetworkTypes().contains(networkType) && guru.getSupportedTrafficTypes().contains(trafficType)
+                    && !Collections.disjoint(guru.getSupportedIsolationMethods(), isolationMethods)) {
+                /*
+                 * If it is guest traffic type, we need to check the guest type
+                 * as well
+                 */
+                if (trafficType == TrafficType.Guest) {
+                    if (guru.getSupportedGuestTypes().contains(guestType)) {
+                        gurus.add(guru);
+                    }
+                } else {
+                    gurus.add(guru);
+                }
+            }
+        }
+
+        return gurus;
+    }
 }


[3/3] git commit: updated refs/heads/network-guru-orchestration to 7c2077f

Posted by hu...@apache.org.
Make the changes to the core networks to support the capabilities.


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

Branch: refs/heads/network-guru-orchestration
Commit: 7c2077ff9177f4651ef135cb5ccf454ff6a06ae7
Parents: e1aba6a
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Oct 29 17:35:42 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Oct 29 17:35:42 2013 +0100

----------------------------------------------------------------------
 .../cloud/network/guru/ControlNetworkGuru.java  |  35 +++
 .../cloud/network/guru/DirectNetworkGuru.java   |  76 +++--
 .../network/guru/DirectPodBasedNetworkGuru.java |  49 ++-
 .../network/guru/ExternalGuestNetworkGuru.java  |  39 ++-
 .../cloud/network/guru/PodBasedNetworkGuru.java | 104 ++++---
 .../cloud/network/guru/PrivateNetworkGuru.java  |  37 ++-
 .../cloud/network/guru/PublicNetworkGuru.java   |  41 ++-
 .../cloud/network/guru/StorageNetworkGuru.java  | 303 +++++++++++--------
 8 files changed, 482 insertions(+), 202 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/ControlNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
index 1943e16..0c856d3 100755
--- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java
@@ -16,6 +16,9 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
 import java.util.Map;
 
 import javax.ejb.Local;
@@ -37,12 +40,14 @@ import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.NetworkModel;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.AddressFormat;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
@@ -57,6 +62,16 @@ import com.cloud.vm.VirtualMachineProfile;
 @Local(value={NetworkGuru.class})
 public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGuru {
     private static final Logger s_logger = Logger.getLogger(ControlNetworkGuru.class);
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Basic, NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated, GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN,
+            IsolationMethod.NONE);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Control);
+
     @Inject DataCenterDao _dcDao;
     @Inject ConfigurationDao _configDao;
     @Inject NetworkModel _networkMgr;
@@ -236,4 +251,24 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
         return true;
     }
 
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/DirectNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectNetworkGuru.java b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
index 801d252..460e288 100755
--- a/server/src/com/cloud/network/guru/DirectNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectNetworkGuru.java
@@ -16,12 +16,15 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 
 import com.cloud.dc.DataCenter;
@@ -46,6 +49,7 @@ import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.IPAddressVO;
 import com.cloud.network.dao.NetworkVO;
@@ -57,7 +61,6 @@ import com.cloud.utils.component.AdapterBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionCallbackWithException;
 import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn;
 import com.cloud.utils.db.TransactionStatus;
 import com.cloud.utils.exception.ExceptionUtil;
@@ -75,6 +78,14 @@ import com.cloud.vm.dao.NicSecondaryIpDao;
 public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     private static final Logger s_logger = Logger.getLogger(DirectNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     DataCenterDao _dcDao;
     @Inject
@@ -99,22 +110,22 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
     IpAddressManager _ipAddrMgr;
 
     private static final TrafficType[] _trafficTypes = {TrafficType.Guest};
-    
+
     @Override
     public boolean isMyTrafficType(TrafficType type) {
-    	for (TrafficType t : _trafficTypes) {
-    		if (t == type) {
-    			return true;
-    		}
-    	}
-    	return false;
+        for (TrafficType t : _trafficTypes) {
+            if (t == type) {
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override
     public TrafficType[] getSupportedTrafficType() {
-    	return _trafficTypes;
+        return _trafficTypes;
     }
-    
+
     protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
         // this guru handles only Guest networks in Advance zone with source nat service disabled
         if (dc.getNetworkType() == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == GuestType.Shared) {
@@ -171,9 +182,9 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
 
         boolean isSecurityGroupEnabled = _networkModel.areServicesSupportedByNetworkOffering(offering.getId(), Service.SecurityGroup);
         if (isSecurityGroupEnabled) {
-        	if (userSpecified.getIp6Cidr() != null) {
+            if (userSpecified.getIp6Cidr() != null) {
                 throw new InvalidParameterValueException("Didn't support security group with IPv6");
-        	}
+            }
             config.setName("SecurityGroupEnabledNetwork");
             config.setDisplayText("SecurityGroupEnabledNetwork");
         }
@@ -198,7 +209,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
 
     @Override
     public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException, ConcurrentOperationException {
+    InsufficientAddressCapacityException, ConcurrentOperationException {
 
         DataCenter dc = _dcDao.findById(network.getDataCenterId());
 
@@ -271,11 +282,11 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
 
     @Override @DB
     public void deallocate(final Network network, final NicProfile nic, VirtualMachineProfile vm) {
-    	if (s_logger.isDebugEnabled()) {
+        if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
         }
-    	
-    	if (nic.getIp4Address() != null) {
+
+        if (nic.getIp4Address() != null) {
             final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIp4Address());
             if (ip != null) {
                 Transaction.execute(new TransactionCallbackNoReturn() {
@@ -289,7 +300,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
                             _ipAddrMgr.markIpAsUnavailable(ip.getId());
                             _ipAddressDao.unassignIpAddress(ip.getId());
                         }
-                       
+
                         //unassign nic secondary ip address
                         s_logger.debug("remove nic " + nic.getId() + " secondary ip ");
                         List<String> nicSecIps = null;
@@ -302,11 +313,11 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
                     }
                 });
             }
-    	}
-    	
-    	if (nic.getIp6Address() != null) {
-    		_ipv6Mgr.revokeDirectIpv6Address(nic.getNetworkId(), nic.getIp6Address());
-    	}
+        }
+
+        if (nic.getIp6Address() != null) {
+            _ipv6Mgr.revokeDirectIpv6Address(nic.getNetworkId(), nic.getIp6Address());
+        }
         nic.deallocate();
     }
 
@@ -344,4 +355,25 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
         networkProfile.setDns1(dc.getDns1());
         networkProfile.setDns2(dc.getDns2());
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
index 053a786..dcfae4a 100755
--- a/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/DirectPodBasedNetworkGuru.java
@@ -17,12 +17,15 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 
 import com.cloud.configuration.ZoneConfig;
@@ -42,9 +45,12 @@ import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.IpAddressManager;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.Networks.AddressFormat;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.IsolationType;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.IPAddressVO;
@@ -67,6 +73,15 @@ import com.cloud.vm.VirtualMachineProfile;
 public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(DirectPodBasedNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Basic);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated, GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN,
+            IsolationMethod.NONE);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     DataCenterDao _dcDao;
     @Inject
@@ -95,7 +110,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
 
     @Override
     public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException, ConcurrentOperationException {
+    InsufficientAddressCapacityException, ConcurrentOperationException {
 
         DataCenterVO dc = _dcDao.findById(network.getDataCenterId());
         ReservationStrategy rsStrategy = ReservationStrategy.Start;
@@ -127,10 +142,10 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
     @Override @DB
     public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
             throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
-        
+
         String oldIp = nic.getIp4Address();
         boolean getNewIp = false;
-        
+
         if (oldIp == null) {
             getNewIp = true;
         } else {
@@ -166,7 +181,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
 
     @DB
     protected void getIp(final NicProfile nic, final Pod pod, final VirtualMachineProfile vm, final Network network) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException, ConcurrentOperationException {
+    InsufficientAddressCapacityException, ConcurrentOperationException {
         final DataCenter dc = _dcDao.findById(pod.getDataCenterId());
         if (nic.getIp4Address() == null) {
             Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientAddressCapacityException>() {
@@ -187,11 +202,11 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
                             s_logger.debug("Nic got an ip address " + placeholderNic.getIp4Address() + " stored in placeholder nic for the network " + network + " and gateway " + podRangeGateway);
                         }
                     }
-                    
+
                     if (ip == null) {
                         ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), null, false);
                     }
-                    
+
                     nic.setIp4Address(ip.getAddress().toString());
                     nic.setFormat(AddressFormat.Ip4);
                     nic.setGateway(ip.getGateway());
@@ -203,7 +218,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
                     }
                     nic.setReservationId(String.valueOf(ip.getVlanTag()));
                     nic.setMacAddress(ip.getMacAddress());
-                    
+
                     //save the placeholder nic if the vm is the Virtual router
                     if (vm.getType() == VirtualMachine.Type.DomainRouter) {
                         Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, pod.getId());
@@ -219,4 +234,24 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
         nic.setDns2(dc.getDns2());
     }
 
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index 7a7da68..322fa01 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.ejb.Local;
@@ -42,6 +44,7 @@ import com.cloud.network.Network;
 import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.State;
 import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.IPAddressDao;
@@ -65,6 +68,16 @@ import com.cloud.vm.VirtualMachineProfile;
 @Local(value = NetworkGuru.class)
 public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(ExternalGuestNetworkGuru.class);
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.GRE, IsolationMethod.L3,
+            IsolationMethod.VLAN);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     NetworkOrchestrationService _networkMgr;
     @Inject
@@ -139,11 +152,11 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
         int vlanTag;
         if (config.getBroadcastUri() == null) {
             String vnet = _dcDao.allocateVnet(zone.getId(), config.getPhysicalNetworkId(), config.getAccountId(), context.getReservationId(),
-                UseSystemGuestVlans.valueIn(config.getAccountId()));
+                    UseSystemGuestVlans.valueIn(config.getAccountId()));
 
             try {
                 // when supporting more types of networks this need to become
-//              int vlantag = Integer.parseInt(BroadcastDomainType.getValue(vnet));
+                //              int vlantag = Integer.parseInt(BroadcastDomainType.getValue(vnet));
                 vlanTag = Integer.parseInt(vnet);
             } catch (NumberFormatException e) {
                 throw new CloudRuntimeException("Obtained an invalid guest vlan tag. Exception: " + e.getMessage());
@@ -219,7 +232,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+    InsufficientAddressCapacityException {
 
         if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIpv4() != null) {
             throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
@@ -318,4 +331,24 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
         return NetUtils.ip2Long(ipAddress) & ~(0xffffffffffffffffl << (32 - cidrSize));
     }
 
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
index ab64f8e..c1a670b 100755
--- a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
@@ -16,6 +16,9 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
 import java.util.Random;
 
 import javax.ejb.Local;
@@ -23,6 +26,7 @@ import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 
+import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.Pod;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.deploy.DeployDestination;
@@ -30,13 +34,15 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.AddressFormat;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
-import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.StorageNetworkManager;
+import com.cloud.network.dao.NetworkVO;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.utils.Pair;
@@ -46,45 +52,54 @@ import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.Nic.ReservationStrategy;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value={NetworkGuru.class})
 public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     private static final Logger s_logger = Logger.getLogger(PodBasedNetworkGuru.class);
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Basic, NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated, GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN,
+            IsolationMethod.NONE);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Management);
+
     @Inject DataCenterDao _dcDao;
     @Inject StorageNetworkManager _sNwMgr;
     Random _rand = new Random(System.currentTimeMillis());
-    
+
     private static final TrafficType[] _trafficTypes = {TrafficType.Management};
-    
+
     @Override
     public boolean isMyTrafficType(TrafficType type) {
-    	for (TrafficType t : _trafficTypes) {
-    		if (t == type) {
-    			return true;
-    		}
-    	}
-    	return false;
+        for (TrafficType t : _trafficTypes) {
+            if (t == type) {
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override
     public TrafficType[] getSupportedTrafficType() {
-    	return _trafficTypes;
+        return _trafficTypes;
     }
-    
+
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
         TrafficType type = offering.getTrafficType();
-        
+
         if (!isMyTrafficType(type)) {
             return null;
         }
-                        
+
         NetworkVO config = new NetworkVO(type, Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId());
         return config;
     }
-    
+
     protected PodBasedNetworkGuru() {
         super();
     }
@@ -92,13 +107,13 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     @Override
     public void deallocate(Network config, NicProfile nic, VirtualMachineProfile vm) {
     }
-    
+
     @Override
     public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+    InsufficientAddressCapacityException {
         TrafficType trafficType = config.getTrafficType();
-        assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage: "Well, I can't take care of this config now can I? " + config; 
-        
+        assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage: "Well, I can't take care of this config now can I? " + config;
+
         if (nic != null) {
             if (nic.getRequestedIpv4() != null) {
                 throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
@@ -106,21 +121,21 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
             nic.setStrategy(nic.getIp4Address() != null ? ReservationStrategy.Create : ReservationStrategy.Start);
         } else {
             nic  = new NicProfile(ReservationStrategy.Start, null, null, null, null);
-        } 
-        
+        }
+
         return nic;
     }
 
     @Override
     public void reserve(NicProfile nic, Network config, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+    InsufficientAddressCapacityException {
         Pod pod = dest.getPod();
-        
+
         Pair<String, Long> ip = _dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());
         if (ip == null) {
             throw new InsufficientAddressCapacityException("Unable to get a management ip address", Pod.class, pod.getId());
         }
-        
+
         nic.setIp4Address(ip.first());
         nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.second())));
         nic.setGateway(pod.getGateway());
@@ -130,29 +145,29 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
         nic.setBroadcastType(BroadcastDomainType.Native);
         nic.setBroadcastUri(null);
         nic.setIsolationUri(null);
-        
+
         s_logger.debug("Allocated a nic " + nic + " for " + vm);
     }
-    
-    
+
+
     @Override
     public void updateNicProfile(NicProfile profile, Network network) {
     }
-    
+
     @Override
     public void updateNetworkProfile(NetworkProfile networkProfile) {
     }
-    
+
     @Override
     public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
         _dcDao.releasePrivateIpAddress(nic.getId(), nic.getReservationId());
-        
+
         nic.deallocate();
-        
+
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Released nic: " + nic);
         }
-        
+
         return true;
     }
 
@@ -160,13 +175,34 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
     public Network implement(Network config, NetworkOffering offering, DeployDestination destination, ReservationContext context) throws InsufficientVirtualNetworkCapcityException {
         return config;
     }
-    
+
     @Override
     public void shutdown(NetworkProfile config, NetworkOffering offering) {
     }
-    
+
     @Override
     public boolean trash(Network config, NetworkOffering offering) {
         return true;
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
index 11e2c05..092b1e3 100644
--- a/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PrivateNetworkGuru.java
@@ -16,6 +16,10 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 import javax.inject.Inject;
 
@@ -39,6 +43,7 @@ import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.IsolationType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.vpc.PrivateIpAddress;
 import com.cloud.network.vpc.PrivateIpVO;
@@ -57,6 +62,15 @@ import com.cloud.vm.VirtualMachineProfile;
 @Local(value = NetworkGuru.class)
 public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     private static final Logger s_logger = Logger.getLogger(PrivateNetworkGuru.class);
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     protected ConfigurationManager _configMgr;
     @Inject
@@ -222,7 +236,7 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
     @Override
     public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
+                    throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
         if (nic.getIp4Address() == null) {
             getIp(nic, _entityMgr.findById(DataCenter.class, network.getDataCenterId()), network);
             nic.setStrategy(ReservationStrategy.Create);
@@ -250,4 +264,25 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
         networkProfile.setDns1(dc.getDns1());
         networkProfile.setDns2(dc.getDns2());
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/PublicNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/PublicNetworkGuru.java b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
index 6fed1a6..5476896 100755
--- a/server/src/com/cloud/network/guru/PublicNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PublicNetworkGuru.java
@@ -16,13 +16,19 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 
 import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.Vlan.VlanType;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.dc.dao.VlanDao;
@@ -33,6 +39,7 @@ import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.IpAddressManager;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.State;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.AddressFormat;
@@ -40,6 +47,7 @@ import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.IsolationType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.addr.PublicIp;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.IPAddressVO;
@@ -62,6 +70,15 @@ import com.cloud.vm.VirtualMachineProfile;
 public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     private static final Logger s_logger = Logger.getLogger(PublicNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Basic, NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated, GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN,
+            IsolationMethod.NONE);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Public);
+
     @Inject
     DataCenterDao _dcDao;
     @Inject
@@ -143,7 +160,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
     @Override
     public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
             throws InsufficientVirtualNetworkCapcityException,
-    InsufficientAddressCapacityException, ConcurrentOperationException {
+            InsufficientAddressCapacityException, ConcurrentOperationException {
 
         DataCenter dc = _dcDao.findById(network.getDataCenterId());
 
@@ -204,7 +221,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
             });
         }
         nic.deallocate();
-        
+
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deallocated nic: " + nic);
         }
@@ -226,4 +243,24 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
         networkProfile.setDns2(dc.getDns2());
     }
 
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c2077ff/server/src/com/cloud/network/guru/StorageNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/StorageNetworkGuru.java b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
index 6d82dc5..e7a70a7 100755
--- a/server/src/com/cloud/network/guru/StorageNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
@@ -16,11 +16,16 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 
+import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.dc.Pod;
 import com.cloud.dc.StorageNetworkIpAddressVO;
 import com.cloud.deploy.DeployDestination;
@@ -28,164 +33,196 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.AddressFormat;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.StorageNetworkManager;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.Nic.ReservationStrategy;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.Nic.ReservationStrategy;
 
 @Local(value = NetworkGuru.class)
 public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGuru {
-	private static final Logger s_logger = Logger.getLogger(StorageNetworkGuru.class);
-	@Inject StorageNetworkManager _sNwMgr;
-	@Inject NetworkDao _nwDao;
-	
-	protected StorageNetworkGuru() {
-		super();
-	}
-	
+    private static final Logger s_logger = Logger.getLogger(StorageNetworkGuru.class);
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Basic, NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated, GuestType.Shared);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VLAN,
+            IsolationMethod.NONE);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Storage);
+
+    @Inject
+    StorageNetworkManager _sNwMgr;
+    @Inject NetworkDao _nwDao;
+
+    protected StorageNetworkGuru() {
+        super();
+    }
+
     private static final TrafficType[] _trafficTypes = {TrafficType.Storage};
-    
+
     @Override
     public boolean isMyTrafficType(TrafficType type) {
-    	for (TrafficType t : _trafficTypes) {
-    		if (t == type) {
-    			return true;
-    		}
-    	}
-    	return false;
+        for (TrafficType t : _trafficTypes) {
+            if (t == type) {
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override
     public TrafficType[] getSupportedTrafficType() {
-    	return _trafficTypes;
-    }
-    
-	protected boolean canHandle(NetworkOffering offering) {
-		if (isMyTrafficType(offering.getTrafficType()) && offering.isSystemOnly()) {
-			return true;
-		} else {
-			s_logger.trace("It's not storage network offering, skip it.");
-			return false;
-		}
-	}
-	
-	@Override
-	public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
-		if (!canHandle(offering)) {
-			return null;
-		}
-				
-		NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup,
-		        plan.getDataCenterId(), plan.getPhysicalNetworkId());
-		return config;
-	}
-
-	@Override
-	public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
-	        throws InsufficientVirtualNetworkCapcityException {
-		assert network.getTrafficType() == TrafficType.Storage : "Why are you sending this configuration to me " + network;
-		if (!_sNwMgr.isStorageIpRangeAvailable(destination.getDataCenter().getId())) {
-			return super.implement(network, offering, destination, context);
-		}
-		return network;
-	}
-
-	@Override
-	public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
-	        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
-		assert network.getTrafficType() == TrafficType.Storage : "Well, I can't take care of this config now can I? " + network; 
-		if (!_sNwMgr.isStorageIpRangeAvailable(network.getDataCenterId())) {
-			return super.allocate(network, nic, vm);
-		}
-		
-		return new NicProfile(ReservationStrategy.Start, null, null, null, null);
-	}
-
-	@Override
-	public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-	        throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
-		if (!_sNwMgr.isStorageIpRangeAvailable(dest.getDataCenter().getId())) {
-			super.reserve(nic, network, vm, dest, context);
-			return;
-		}
-		
-		Pod pod = dest.getPod();
-		Integer vlan = null;
-		
-		StorageNetworkIpAddressVO ip = _sNwMgr.acquireIpAddress(pod.getId());
-		if (ip == null) {
-			throw new InsufficientAddressCapacityException("Unable to get a storage network ip address", Pod.class, pod.getId());
-		}
-	
-		vlan = ip.getVlan();	
-		nic.setIp4Address(ip.getIpAddress());
-		nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.getMac())));
-		nic.setFormat(AddressFormat.Ip4);
-		nic.setNetmask(ip.getNetmask());
-		nic.setBroadcastType(BroadcastDomainType.Storage);
-		nic.setGateway(ip.getGateway());
-		if (vlan != null) {
-			nic.setBroadcastUri(BroadcastDomainType.Storage.toUri(vlan));
-		} else {
-			nic.setBroadcastUri(null);
-		}
+        return _trafficTypes;
+    }
+
+    protected boolean canHandle(NetworkOffering offering) {
+        if (isMyTrafficType(offering.getTrafficType()) && offering.isSystemOnly()) {
+            return true;
+        } else {
+            s_logger.trace("It's not storage network offering, skip it.");
+            return false;
+        }
+    }
+
+    @Override
+    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
+        if (!canHandle(offering)) {
+            return null;
+        }
+
+        NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup,
+                plan.getDataCenterId(), plan.getPhysicalNetworkId());
+        return config;
+    }
+
+    @Override
+    public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
+            throws InsufficientVirtualNetworkCapcityException {
+        assert network.getTrafficType() == TrafficType.Storage : "Why are you sending this configuration to me " + network;
+        if (!_sNwMgr.isStorageIpRangeAvailable(destination.getDataCenter().getId())) {
+            return super.implement(network, offering, destination, context);
+        }
+        return network;
+    }
+
+    @Override
+    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm)
+            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
+        assert network.getTrafficType() == TrafficType.Storage : "Well, I can't take care of this config now can I? " + network;
+        if (!_sNwMgr.isStorageIpRangeAvailable(network.getDataCenterId())) {
+            return super.allocate(network, nic, vm);
+        }
+
+        return new NicProfile(ReservationStrategy.Start, null, null, null, null);
+    }
+
+    @Override
+    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
+            throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
+        if (!_sNwMgr.isStorageIpRangeAvailable(dest.getDataCenter().getId())) {
+            super.reserve(nic, network, vm, dest, context);
+            return;
+        }
+
+        Pod pod = dest.getPod();
+        Integer vlan = null;
+
+        StorageNetworkIpAddressVO ip = _sNwMgr.acquireIpAddress(pod.getId());
+        if (ip == null) {
+            throw new InsufficientAddressCapacityException("Unable to get a storage network ip address", Pod.class, pod.getId());
+        }
+
+        vlan = ip.getVlan();
+        nic.setIp4Address(ip.getIpAddress());
+        nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.getMac())));
+        nic.setFormat(AddressFormat.Ip4);
+        nic.setNetmask(ip.getNetmask());
+        nic.setBroadcastType(BroadcastDomainType.Storage);
+        nic.setGateway(ip.getGateway());
+        if (vlan != null) {
+            nic.setBroadcastUri(BroadcastDomainType.Storage.toUri(vlan));
+        } else {
+            nic.setBroadcastUri(null);
+        }
         nic.setIsolationUri(null);
         s_logger.debug("Allocated a storage nic " + nic + " for " + vm);
-	}
-
-	@Override
-	public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
-	    Network nw = _nwDao.findById(nic.getNetworkId());
-		if (!_sNwMgr.isStorageIpRangeAvailable(nw.getDataCenterId())) {
-			return super.release(nic, vm, reservationId);
-		}
-		
-		_sNwMgr.releaseIpAddress(nic.getIp4Address());
-		s_logger.debug("Release an storage ip " + nic.getIp4Address());
-		nic.deallocate();
-		return true;
-	}
-
-	@Override
-	public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void updateNicProfile(NicProfile profile, Network network) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void shutdown(NetworkProfile network, NetworkOffering offering) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public boolean trash(Network network, NetworkOffering offering) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public void updateNetworkProfile(NetworkProfile networkProfile) {
-		// TODO Auto-generated method stub
-
-	}
+    }
+
+    @Override
+    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
+        Network nw = _nwDao.findById(nic.getNetworkId());
+        if (!_sNwMgr.isStorageIpRangeAvailable(nw.getDataCenterId())) {
+            return super.release(nic, vm, reservationId);
+        }
+
+        _sNwMgr.releaseIpAddress(nic.getIp4Address());
+        s_logger.debug("Release an storage ip " + nic.getIp4Address());
+        nic.deallocate();
+        return true;
+    }
+
+    @Override
+    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNicProfile(NicProfile profile, Network network) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void shutdown(NetworkProfile network, NetworkOffering offering) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean trash(Network network, NetworkOffering offering) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void updateNetworkProfile(NetworkProfile networkProfile) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
 
 }


[2/3] git commit: updated refs/heads/network-guru-orchestration to 7c2077f

Posted by hu...@apache.org.
Make the changes for the new capabilities check to the plugins.


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

Branch: refs/heads/network-guru-orchestration
Commit: e1aba6aea3dcdb2150dfc2a62d2018d5fe7f77a6
Parents: 9f2d940
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Oct 29 17:35:03 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Oct 29 17:35:03 2013 +0100

----------------------------------------------------------------------
 .../guru/BigSwitchVnsGuestNetworkGuru.java      | 61 ++++++++++----
 .../network/guru/MidoNetGuestNetworkGuru.java   | 80 +++++++++++++-----
 .../network/guru/NiciraNvpGuestNetworkGuru.java | 39 ++++++++-
 .../cloud/network/guru/OvsGuestNetworkGuru.java | 38 +++++++++
 .../network/guru/SspGuestNetworkGuru.java       | 38 ++++++++-
 .../network/guru/VxlanGuestNetworkGuru.java     | 87 +++++++++++++-------
 6 files changed, 272 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
index 9e9dfca..204f11b 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
@@ -21,6 +21,8 @@ package com.cloud.network.guru;
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.ejb.Local;
@@ -48,6 +50,7 @@ import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.State;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.BigSwitchVnsDao;
@@ -67,6 +70,14 @@ import com.cloud.vm.VirtualMachineProfile;
 public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(BigSwitchVnsGuestNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VNS);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     DataCenterDao _zoneDao;
     @Inject
@@ -91,7 +102,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     protected boolean canHandle(NetworkOffering offering, NetworkType networkType,
-                                PhysicalNetwork physicalNetwork) {
+            PhysicalNetwork physicalNetwork) {
         if (networkType == NetworkType.Advanced
                 && isMyTrafficType(offering.getTrafficType())
                 && offering.getGuestType() == Network.GuestType.Isolated
@@ -99,7 +110,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
             return true;
         } else {
             s_logger.trace("We only take care of Guest networks of type   " + GuestType.Isolated +
-                        " in zone of type " + NetworkType.Advanced);
+                    " in zone of type " + NetworkType.Advanced);
             return false;
         }
     }
@@ -107,11 +118,11 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan,
             Network userSpecified, Account owner) {
-         // Check of the isolation type of the related physical network is VNS
+        // Check of the isolation type of the related physical network is VNS
         PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
         if (physnet == null ||
-                        physnet.getIsolationMethods() == null ||
-                        !physnet.getIsolationMethods().contains("VNS")) {
+                physnet.getIsolationMethods() == null ||
+                !physnet.getIsolationMethods().contains("VNS")) {
             s_logger.debug("Refusing to design this network, the physical isolation type is not VNS");
             return null;
         }
@@ -122,7 +133,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
             return null;
         }
         s_logger.debug("BigSwitch Controller " + devices.get(0).getUuid() +
-                        " found on physical network " + physnet.getId());
+                " found on physical network " + physnet.getId());
 
         s_logger.debug("Physical isolation type is VNS, asking GuestNetworkGuru to design this network");
         NetworkVO networkObject = (NetworkVO) super.design(offering, plan, userSpecified, owner);
@@ -138,18 +149,18 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     public Network implement(Network network, NetworkOffering offering,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException {
+                    throws InsufficientVirtualNetworkCapcityException {
         assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
 
         long dcId = dest.getDataCenter().getId();
 
         //get physical network id
         long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId,
-                                                        offering.getTags(),
-                                                        offering.getTrafficType());
+                offering.getTags(),
+                offering.getTrafficType());
 
         NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(),
-                        network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
+                network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
                 network.getDataCenterId(), physicalNetworkId);
 
         if (network.getGateway() != null) {
@@ -163,10 +174,10 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
         String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), context.getReservationId(), UseSystemGuestVlans.valueIn(network.getAccountId()));
         if (vnet == null) {
             throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a " +
-                        "part of network " + network + " implement ", DataCenter.class, dcId);
+                    "part of network " + network + " implement ", DataCenter.class, dcId);
         }
         // when supporting more types of networks this need to become
-//        int vlan = Integer.parseInt(BroadcastDomainType.getValue(vnet));
+        //        int vlan = Integer.parseInt(BroadcastDomainType.getValue(vnet));
         int vlan = Integer.parseInt(vnet);
 
         // Name is either the given name or the uuid
@@ -201,7 +212,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
             implemented.setBroadcastUri(new URI("vns", cmd.getNetworkUuid(), null));
             implemented.setBroadcastDomainType(BroadcastDomainType.Lswitch);
             s_logger.info("Implemented OK, network " + networkUuid + " in tenant " +
-                        tenantId + " linked to " + implemented.getBroadcastUri().toString());
+                    tenantId + " linked to " + implemented.getBroadcastUri().toString());
         } catch (URISyntaxException e) {
             s_logger.error("Unable to store network id in broadcast uri, uuid = " + implemented.getUuid(), e);
         }
@@ -213,8 +224,8 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
     public void reserve(NicProfile nic, Network network,
             VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+                    throws InsufficientVirtualNetworkCapcityException,
+                    InsufficientAddressCapacityException {
         // TODO Auto-generated method stub
         super.reserve(nic, network, vm, dest, context);
     }
@@ -257,4 +268,24 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
     public boolean trash(Network network, NetworkOffering offering) {
         return super.trash(network, offering);
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
index 2b7f4c9..0395864 100644
--- a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
+++ b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
@@ -19,31 +19,48 @@
 
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
-import com.cloud.network.*;
+import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.NetworkProfile;
+import com.cloud.network.Networks;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetwork.IsolationMethod;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.PhysicalNetworkVO;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.user.AccountVO;
 import com.cloud.user.dao.AccountDao;
-import com.cloud.vm.*;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.PhysicalNetworkVO;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachineProfile;
 
 @Component
 @Local(value = NetworkGuru.class)
 public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(MidoNetGuestNetworkGuru.class);
 
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.MIDO);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     AccountDao _accountDao;
 
@@ -54,7 +71,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     protected boolean canHandle(NetworkOffering offering, NetworkType networkType,
-                                PhysicalNetwork physicalNetwork) {
+            PhysicalNetwork physicalNetwork) {
         // This guru handles only Guest Isolated network that supports Source nat service
         if (networkType == NetworkType.Advanced
                 && isMyTrafficType(offering.getTrafficType())
@@ -70,7 +87,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan,
-                          Network userSpecified, Account owner) {
+            Network userSpecified, Account owner) {
         s_logger.debug("design called");
         // Check if the isolation type of the related physical network is MIDO
         PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
@@ -92,8 +109,8 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public Network implement(Network network, NetworkOffering offering,
-                             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException {
+            DeployDestination dest, ReservationContext context)
+                    throws InsufficientVirtualNetworkCapcityException {
         assert (network.getState() == Network.State.Implementing) : "Why are we implementing " + network;
         s_logger.debug("implement called network: " + network.toString());
 
@@ -123,8 +140,8 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
         }
 
         String broadcastUriStr = accountUUIDStr + "."
-                                 + String.valueOf(network.getId())
-                                 + ":" + routerName;
+                + String.valueOf(network.getId())
+                + ":" + routerName;
 
         implemented.setBroadcastUri(Networks.BroadcastDomainType.Mido.toUri(broadcastUriStr));
         s_logger.debug("Broadcast URI set to " + broadcastUriStr);
@@ -134,10 +151,10 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public void reserve(NicProfile nic, Network network,
-                        VirtualMachineProfile vm,
-                        DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+            VirtualMachineProfile vm,
+            DeployDestination dest, ReservationContext context)
+                    throws InsufficientVirtualNetworkCapcityException,
+                    InsufficientAddressCapacityException {
         s_logger.debug("reserve called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
 
         super.reserve(nic, network, vm, dest, context);
@@ -145,8 +162,8 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
     @Override
     public boolean release(NicProfile nic,
-                           VirtualMachineProfile vm,
-                           String reservationId) {
+            VirtualMachineProfile vm,
+            String reservationId) {
         s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
         return super.release(nic, vm, reservationId);
     }
@@ -164,4 +181,25 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
 
         return super.trash(network, offering);
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
index 51c59bf..a9f894d 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java
@@ -18,6 +18,8 @@ package com.cloud.network.guru;
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.ejb.Local;
@@ -47,6 +49,7 @@ import com.cloud.network.Network.State;
 import com.cloud.network.NetworkModel;
 import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.NiciraNvpDeviceVO;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
@@ -62,13 +65,20 @@ import com.cloud.user.Account;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = NetworkGuru.class)
 public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(NiciraNvpGuestNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.STT);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     NetworkModel _networkModel;
     @Inject
@@ -144,7 +154,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     public Network implement(Network network, NetworkOffering offering,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException {
+                    throws InsufficientVirtualNetworkCapcityException {
         assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
 
         long dcId = dest.getDataCenter().getId();
@@ -213,8 +223,8 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
     public void reserve(NicProfile nic, Network network,
             VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+                    throws InsufficientVirtualNetworkCapcityException,
+                    InsufficientAddressCapacityException {
         // TODO Auto-generated method stub
         super.reserve(nic, network, vm, dest, context);
     }
@@ -259,4 +269,25 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru {
         return super.trash(network, offering);
     }
 
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
+
 }
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
index e74a69f..bb84bce 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
@@ -16,6 +16,10 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 import javax.inject.Inject;
 
@@ -35,6 +39,7 @@ import com.cloud.network.Network;
 import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.State;
 import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkVO;
@@ -47,6 +52,15 @@ import com.cloud.vm.ReservationContext;
 public class OvsGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(OvsGuestNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.GRE, IsolationMethod.L3,
+            IsolationMethod.VLAN);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject OvsTunnelManager _ovsTunnelMgr;
 
     OvsGuestNetworkGuru() {
@@ -114,4 +128,28 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru {
         return implemented;
     }
 
+    @Override
+    public boolean trash(Network network, NetworkOffering offering) {
+        return super.trash(network, offering);
+    }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
index 3deded9..d689889 100644
--- a/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
+++ b/plugins/network-elements/stratosphere-ssp/src/org/apache/cloudstack/network/guru/SspGuestNetworkGuru.java
@@ -16,20 +16,27 @@
 // under the License.
 package org.apache.cloudstack.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
+
 import org.apache.cloudstack.network.element.SspElement;
 import org.apache.cloudstack.network.element.SspManager;
-import org.apache.log4j.Logger;
 
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
+import com.cloud.network.Network.GuestType;
 import com.cloud.network.NetworkMigrationResponder;
 import com.cloud.network.NetworkProfile;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkDao;
@@ -40,7 +47,6 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.ReservationContextImpl;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 /**
@@ -50,6 +56,14 @@ import com.cloud.vm.VirtualMachineProfile;
 public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigrationResponder {
     private static final Logger s_logger = Logger.getLogger(SspGuestNetworkGuru.class);
 
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.SSP);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     @Inject
     SspManager _sspMgr;
     @Inject
@@ -170,4 +184,24 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
             ReservationContext src, ReservationContext dst) {
         release(nic, vm, src.getReservationId());
     }
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1aba6ae/plugins/network-elements/vxlan/src/com/cloud/network/guru/VxlanGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/vxlan/src/com/cloud/network/guru/VxlanGuestNetworkGuru.java b/plugins/network-elements/vxlan/src/com/cloud/network/guru/VxlanGuestNetworkGuru.java
index e2ba868..4ffc86d 100644
--- a/plugins/network-elements/vxlan/src/com/cloud/network/guru/VxlanGuestNetworkGuru.java
+++ b/plugins/network-elements/vxlan/src/com/cloud/network/guru/VxlanGuestNetworkGuru.java
@@ -16,12 +16,17 @@
 // under the License.
 package com.cloud.network.guru;
 
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
 import javax.ejb.Local;
 
-import org.apache.cloudstack.context.CallContext;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import org.apache.cloudstack.context.CallContext;
+
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.deploy.DeployDestination;
@@ -32,10 +37,11 @@ import com.cloud.event.EventVO;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
-import com.cloud.network.NetworkProfile;
 import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.State;
+import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkVO;
@@ -43,14 +49,21 @@ import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 @Component
 @Local(value=NetworkGuru.class)
 public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
     private static final Logger s_logger = Logger.getLogger(VxlanGuestNetworkGuru.class);
-    
+
+    /**
+     * The supported networking configs
+     */
+    private static final EnumSet<NetworkType> _supportedNetworkTypes = EnumSet.of(NetworkType.Advanced);
+    private static final EnumSet<GuestType> _supportedGuestTypes = EnumSet.of(GuestType.Isolated);
+    private static final EnumSet<IsolationMethod> _supportedIsolationMethods = EnumSet.of(IsolationMethod.VXLAN);
+    private static final EnumSet<TrafficType> _supportedTrafficTypes = EnumSet.of(TrafficType.Guest);
+
     public VxlanGuestNetworkGuru() {
         super();
         _isolationMethods = new IsolationMethod[] { IsolationMethod.VXLAN };
@@ -59,8 +72,8 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
     @Override
     protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
         // This guru handles only Guest Isolated network that supports Source nat service
-        if (networkType == NetworkType.Advanced 
-                && isMyTrafficType(offering.getTrafficType()) 
+        if (networkType == NetworkType.Advanced
+                && isMyTrafficType(offering.getTrafficType())
                 && offering.getGuestType() == Network.GuestType.Isolated
                 && isMyIsolationMethod(physicalNetwork)) {
             return true;
@@ -69,11 +82,11 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
             return false;
         }
     }
-    
+
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
-        
-        NetworkVO network = (NetworkVO) super.design(offering, plan, userSpecified, owner); 
+
+        NetworkVO network = (NetworkVO) super.design(offering, plan, userSpecified, owner);
         if (network == null) {
             return null;
         }
@@ -82,15 +95,16 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
 
         return network;
     }
-    
+
+    @Override
     protected void allocateVnet(Network network, NetworkVO implemented, long dcId,
             long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException {
         if (network.getBroadcastUri() == null) {
             String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId,
-            		UseSystemGuestVlans.valueIn(network.getAccountId()));
+                    UseSystemGuestVlans.valueIn(network.getAccountId()));
             if (vnet == null) {
                 throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a " +
-                		"part of network " + network + " implement ", DataCenter.class, dcId);
+                        "part of network " + network + " implement ", DataCenter.class, dcId);
             }
             implemented.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(vnet));
             allocateVnetComplete(network, implemented, dcId, physicalNetworkId, reservationId, vnet);
@@ -98,7 +112,7 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
             implemented.setBroadcastUri(network.getBroadcastUri());
         }
     }
-    
+
     // For Test: Mockit cannot mock static method, wrap it
     protected void allocateVnetComplete(Network network, NetworkVO implemented, long dcId,
             long physicalNetworkId, String reservationId, String vnet) {
@@ -106,28 +120,28 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
         ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), network.getAccountId(),
                 EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone vNet: " + vnet + " Network Id: " + network.getId(), 0);
     }
-    
+
     @Override
     public Network implement(Network network, NetworkOffering offering,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException {
+                    throws InsufficientVirtualNetworkCapcityException {
         assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
 
         long dcId = dest.getDataCenter().getId();
 
         //get physical network id
         Long physicalNetworkId = network.getPhysicalNetworkId();
-        
+
         // physical network id can be null in Guest Network in Basic zone, so locate the physical network
-        if (physicalNetworkId == null) {        
+        if (physicalNetworkId == null) {
             physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
         }
 
         NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
                 network.getDataCenterId(), physicalNetworkId);
-        
+
         allocateVnet(network, implemented, dcId, physicalNetworkId, context.getReservationId());
-        
+
         if (network.getGateway() != null) {
             implemented.setGateway(network.getGateway());
         }
@@ -135,7 +149,7 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
         if (network.getCidr() != null) {
             implemented.setCidr(network.getCidr());
         }
-        
+
         return implemented;
     }
 
@@ -143,8 +157,8 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
     public void reserve(NicProfile nic, Network network,
             VirtualMachineProfile vm,
             DeployDestination dest, ReservationContext context)
-            throws InsufficientVirtualNetworkCapcityException,
-            InsufficientAddressCapacityException {
+                    throws InsufficientVirtualNetworkCapcityException,
+                    InsufficientAddressCapacityException {
         super.reserve(nic, network, vm, dest, context);
     }
 
@@ -156,14 +170,14 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
     }
 
     @Override
-    public void shutdown(NetworkProfile profile, NetworkOffering offering) {    
+    public void shutdown(NetworkProfile profile, NetworkOffering offering) {
         NetworkVO networkObject = _networkDao.findById(profile.getId());
         if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vxlan ||
                 networkObject.getBroadcastUri() == null) {
             s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText());
             return;
         }
-        
+
         super.shutdown(profile, offering);
     }
 
@@ -171,9 +185,24 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
     public boolean trash(Network network, NetworkOffering offering) {
         return super.trash(network, offering);
     }
-    
-    
-    
-    
-    
+
+    @Override
+    public List<NetworkType> getSupportedNetworkTypes() {
+        return new ArrayList<NetworkType>(_supportedNetworkTypes);
+    }
+
+    @Override
+    public List<TrafficType> getSupportedTrafficTypes() {
+        return new ArrayList<TrafficType>(_supportedTrafficTypes);
+    }
+
+    @Override
+    public List<GuestType> getSupportedGuestTypes() {
+        return new ArrayList<GuestType>(_supportedGuestTypes);
+    }
+
+    @Override
+    public List<IsolationMethod> getSupportedIsolationMethods() {
+        return new ArrayList<IsolationMethod>(_supportedIsolationMethods);
+    }
 }