You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@git.apache.org on 2017/07/24 14:10:17 UTC

[GitHub] fmaximus commented on a change in pull request #2193: CLOUDSTACK-10007 Isolation methods

fmaximus commented on a change in pull request #2193: CLOUDSTACK-10007 Isolation methods
URL: https://github.com/apache/cloudstack/pull/2193#discussion_r129040157
 
 

 ##########
 File path: api/src/com/cloud/network/PhysicalNetwork.java
 ##########
 @@ -32,8 +35,82 @@
         Disabled, Enabled;
     }
 
-    public enum IsolationMethod {
-        VLAN, L3, GRE, STT, BCF_SEGMENT, MIDO, SSP, VXLAN, ODL, L3VPN, VSP, VCS;
+    public class IsolationMethod {
+        protected static final String UNKNOWN_PROVIDER = "Unknown";
+        private static Set<IsolationMethod> registeredIsolationMethods = new HashSet<>();
+
+        /**
+         * gets a IsolationMethod object that defines this prefix and if any it returns the first one found that has a known provider. If none has a known provider
+         * it will return the one with the unknown provider. if none is found it return null.
+         *
+         * @param prfx
+         * @return
+         */
+        public static IsolationMethod getIsolationMethod(String prfx) {
+            IsolationMethod rc = null;
+            for (IsolationMethod method: registeredIsolationMethods) {
+                if (method.provider.equals(prfx)) {
 
 Review comment:
   This should be `method.methodPrefix.equals(prfx)`
   
   Test Scenario:
   ```
       @Test
       public void getIsolationMethodTest() throws Exception {
           PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla");
           final PhysicalNetwork.IsolationMethod isolationMethod = PhysicalNetwork.IsolationMethod.getIsolationMethod("bla");
           assertEquals(method, isolationMethod);
       }
   ```
   
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services