cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject [2/3] git commit: updated refs/heads/distributedrouter to e41fe92
Date Tue, 04 Mar 2014 12:52:40 GMT
-add check to ensure 'Connectivity' service provider specified in
createVpcOffering actually supports 'DistributedRouter' capability

- enable OVS to support 'DistributedRouter' capability


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

Branch: refs/heads/distributedrouter
Commit: 04a2b0f545f39e0bd47908f7fdabe8df563766f2
Parents: 9b0a1fb
Author: Murali Reddy <muralimmreddy@gmail.com>
Authored: Tue Mar 4 17:17:18 2014 +0530
Committer: Murali Reddy <muralimmreddy@gmail.com>
Committed: Tue Mar 4 17:17:18 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/network/element/OvsElement.java   |  5 +-
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 52 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/04a2b0f5/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
index 03eeedd..05e81a1 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
@@ -246,7 +246,10 @@ StaticNatServiceProvider, IpDeployer {
         Map<Service, Map<Capability, String>> capabilities = new HashMap<Service,
Map<Capability, String>>();
 
         // L2 Support : SDN provisioning
-        capabilities.put(Service.Connectivity, null);
+        Map<Capability, String> connectivityCapabilities = new HashMap<Capability,
String>();
+        connectivityCapabilities.put(Capability.DistributedRouter, null);
+        capabilities.put(Service.Connectivity, connectivityCapabilities);
+
 
         // L3 Support : Port Forwarding
         capabilities.put(Service.PortForwarding, null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/04a2b0f5/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index 0a04356..636cea0 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -65,6 +65,7 @@ import com.cloud.exception.PermissionDeniedException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.element.NetworkElement;
 import com.cloud.network.IpAddress;
 import com.cloud.network.IpAddressManager;
 import com.cloud.network.Network;
@@ -376,6 +377,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
             }
         }
 
+        validateConnectivtyServiceCapablitlies(svcProviderMap.get(Service.Connectivity),
serviceCapabilitystList);
         boolean supportsDistributedRouter = isVpcOfferingSupportsDistributedRouter(serviceCapabilitystList);
 
         VpcOffering offering = createVpcOffering(name, displayText, svcProviderMap, false,
null,
@@ -460,6 +462,56 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
         return supportsDistributedRouter;
     }
 
+    private void validateConnectivtyServiceCapablitlies(Set<Provider> providers, Map
serviceCapabilitystList) {
+
+        if (serviceCapabilitystList != null && !serviceCapabilitystList.isEmpty())
{
+            Collection serviceCapabilityCollection = serviceCapabilitystList.values();
+            Iterator iter = serviceCapabilityCollection.iterator();
+            Map<Network.Capability, String> capabilityMap = null;
+
+            while (iter.hasNext()) {
+                HashMap<String, String> svcCapabilityMap = (HashMap<String, String>)iter.next();
+                Network.Capability capability = null;
+                String svc = svcCapabilityMap.get("service");
+                String capabilityName = svcCapabilityMap.get("capabilitytype");
+                String capabilityValue = svcCapabilityMap.get("capabilityvalue");
+                if (capabilityName != null) {
+                    capability = Network.Capability.getCapability(capabilityName);
+                }
+
+                if ((capability == null) || (capabilityName == null) || (capabilityValue
== null)) {
+                    throw new InvalidParameterValueException("Invalid capability:" + capabilityName
+ " capability value:" + capabilityValue);
+                }
+
+                if (!svc.equalsIgnoreCase(Service.Connectivity.getName())) {
+                    throw new InvalidParameterValueException("Invalid Service:" + svc + "
specified. Only for 'Connectivity' service capabilities can be specified");
+                }
+
+                if (!capabilityName.equalsIgnoreCase("DistributedRouter")) {
+                    throw new InvalidParameterValueException("Invalid Capability:" + capabilityName
+ " specified. Only 'DistributedRouter' capability can be specified.");
+                }
+
+                if (!capabilityValue.equalsIgnoreCase("true") && capabilityValue.equalsIgnoreCase("false"))
{
+                    throw new InvalidParameterValueException("Invalid Capability value:"
+ capabilityValue + " specified.");
+                }
+            }
+
+            if (providers != null && !providers.isEmpty()) {
+                for (Provider provider: providers) {
+                    NetworkElement element = _ntwkModel.getElementImplementingProvider(provider.getName());
+                    Map<Service, Map<Network.Capability, String>> capabilities
= element.getCapabilities();
+                    if (capabilities != null && !capabilities.isEmpty()) {
+                        Map<Network.Capability, String> connectivityCapabilities =
 capabilities.get(Service.Connectivity);
+                        if (connectivityCapabilities == null || (connectivityCapabilities
!= null && !connectivityCapabilities.keySet().contains(Network.Capability.DistributedRouter)))
{
+                            throw new InvalidParameterValueException("Provider: " + provider.getName()
+ " does not support "
+                                    + Network.Capability.DistributedRouter.getName() + "
capability.");
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     @Override
     public Vpc getActiveVpc(long vpcId) {
         return _vpcDao.getActiveVpcById(vpcId);


Mime
View raw message