cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [10/50] [abbrv] git commit: updated refs/heads/rbac to 929fbab
Date Fri, 17 Jan 2014 22:40:12 GMT
Add L3VPN isolation method for contrail plugin

Signed-off-by: Sheng Yang <sheng.yang@citrix.com>


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

Branch: refs/heads/rbac
Commit: 0bff7056218cda564acfd1ae2080e50f37742deb
Parents: 3ed605d
Author: Sachchidanand Vaidya <vaidyasd@juniper.net>
Authored: Mon Jan 13 17:27:16 2014 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Tue Jan 14 13:55:35 2014 -0800

----------------------------------------------------------------------
 api/src/com/cloud/network/PhysicalNetwork.java  |  2 +-
 .../contrail/management/ContrailGuru.java       | 26 +++++++++++++++++---
 .../management/ManagementServerMock.java        |  2 +-
 ui/scripts/ui-custom/zoneWizard.js              |  5 +++-
 4 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bff7056/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 5c348c2..8cc214e 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -33,7 +33,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
     }
 
     public enum IsolationMethod {
-        VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN, ODL;
+        VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN, ODL, L3VPN;
     }
 
     public enum BroadcastDomainRange {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bff7056/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailGuru.java
b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailGuru.java
index 079035b..3bc66d1 100644
--- a/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailGuru.java
+++ b/plugins/network-elements/juniper-contrail/src/org/apache/cloudstack/network/contrail/management/ContrailGuru.java
@@ -37,6 +37,9 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.network.Network;
 import com.cloud.network.Network.State;
 import com.cloud.network.NetworkProfile;
@@ -47,6 +50,9 @@ import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.guru.NetworkGuru;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkVO;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.user.Account;
 import com.cloud.utils.component.AdapterBase;
@@ -68,12 +74,22 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
     ContrailManager _manager;
     @Inject
     NicDao _nicDao;
+    @Inject
+    PhysicalNetworkDao _physicalNetworkDao;
+    @Inject
+    DataCenterDao _dcDao;
 
     private static final Logger s_logger = Logger.getLogger(ContrailGuru.class);
     private static final TrafficType[] TrafficTypes = {TrafficType.Guest};
 
-    private boolean canHandle(NetworkOffering offering) {
-        return (offering.getName().equals(ContrailManager.offeringName));
+    private boolean canHandle(NetworkOffering offering, NetworkType networkType, PhysicalNetwork
physicalNetwork) {
+        if (networkType == NetworkType.Advanced
+                && isMyTrafficType(offering.getTrafficType())
+                && offering.getGuestType() == Network.GuestType.Isolated
+                && physicalNetwork.getIsolationMethods().contains("L3VPN"))
+            return true;
+
+        return false;
     }
 
     @Override
@@ -83,7 +99,11 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
 
     @Override
     public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified,
Account owner) {
-        if (!canHandle(offering)) {
+        // Check of the isolation type of the related physical network is L3VPN
+        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
+        DataCenter dc = _dcDao.findById(plan.getDataCenterId());
+        if (!canHandle(offering, dc.getNetworkType(),physnet)) {
+            s_logger.debug("Refusing to design this network");
             return null;
         }
         NetworkVO network =

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bff7056/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
index 806dd21..cd7ac35 100644
--- a/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
+++ b/plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/ManagementServerMock.java
@@ -331,7 +331,7 @@ public class ManagementServerMock {
             }
         } catch (InvalidParameterValueException e) {
             List<String> isolationMethods = new ArrayList<String>();
-            isolationMethods.add("GRE");
+            isolationMethods.add("L3VPN");
             _znet =
                 _networkService.createPhysicalNetwork(_zone.getId(), null, null, isolationMethods,
BroadcastDomainRange.ZONE.toString(), _zone.getDomainId(), null,
                     "znet");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bff7056/ui/scripts/ui-custom/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js
index 99aa3b9..4091c03 100644
--- a/ui/scripts/ui-custom/zoneWizard.js
+++ b/ui/scripts/ui-custom/zoneWizard.js
@@ -723,7 +723,10 @@
                             }).html('VXLAN'),
                             $('<option>').attr({
                                 value: 'ODL'
-                            }).html('ODL')
+                            }).html('ODL'),
+                            $('<option>').attr({
+                                value: 'L3VPN'
+                            }).html('L3VPN')
                         )
                     )
                 );


Mime
View raw message