diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java index bdf098f3abb..48e416c4b46 100644 --- a/api/src/com/cloud/network/PhysicalNetwork.java +++ b/api/src/com/cloud/network/PhysicalNetwork.java @@ -16,12 +16,16 @@ // under the License. package com.cloud.network; -import java.util.List; - +import com.cloud.exception.CloudException; +import com.cloud.utils.Pair; +import com.cloud.utils.StringUtils; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import com.cloud.utils.Pair; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; /** * @@ -32,8 +36,101 @@ public interface PhysicalNetwork extends Identity, InternalIdentity { 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"; + static Set registeredIsolationMethods = new HashSet<>(); + + String methodPrefix; + String provider; + + public IsolationMethod(String prfx) { + this(prfx, UNKNOWN_PROVIDER); + } + + public IsolationMethod(String prfx, String prvdr) { + methodPrefix = prfx; + provider = StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER; + registeredIsolationMethods.add(this); + } + + /** + * 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) throws IsolationMethodNotRegistered { + IsolationMethod rc = null; + for (IsolationMethod method: registeredIsolationMethods) { + if (method.methodPrefix.equals(prfx)) { + rc = method; + if(! rc.getProvider().equals(UNKNOWN_PROVIDER)) { + break; + } + } + } + if (rc == null) { + throw new IsolationMethodNotRegistered("No registration of prefix '" + prfx + "' found."); + } + return rc; + } + + public static IsolationMethod getIsolationMethod(String prfx, String provider) throws IsolationMethodNotRegistered { + for (IsolationMethod method: registeredIsolationMethods) { + if (method.methodPrefix.equals(prfx) && method.provider.equals(provider)) { + return method; + } + } + throw new IsolationMethodNotRegistered("No registration of prefix '" + prfx + "' for provider '" + provider + "' found."); + } + + static class IsolationMethodNotRegistered extends CloudException { + IsolationMethodNotRegistered (String message) { + super(message); + } + } + + public String getMethodPrefix() { + return methodPrefix; + } + + public String getProvider() { + return provider; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + IsolationMethod that = (IsolationMethod)o; + return Objects.equals(methodPrefix, that.methodPrefix) && Objects.equals(provider, that.provider); + } + + @Override + public int hashCode() { + return Objects.hash(methodPrefix, provider); + } + + @Override + public String toString() { + return methodPrefix; + } + + public static boolean remove(String prfx, String prvdr) { + prvdr = StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER; + + try { + return remove(getIsolationMethod(prfx, prvdr)); + } catch (IsolationMethodNotRegistered isolationMethodNotRegistered) { + return false; + } + } + public static boolean remove(IsolationMethod method) { + return registeredIsolationMethods.remove(method); + } } public enum BroadcastDomainRange { diff --git a/api/test/com/cloud/network/IsolationMethodTest.java b/api/test/com/cloud/network/IsolationMethodTest.java new file mode 100644 index 00000000000..2db3ec55db2 --- /dev/null +++ b/api/test/com/cloud/network/IsolationMethodTest.java @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network; + +import org.junit.After; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class IsolationMethodTest { + @After + public void cleanTheRegistry() { + PhysicalNetwork.IsolationMethod.registeredIsolationMethods.removeAll(PhysicalNetwork.IsolationMethod.registeredIsolationMethods); + } + + @Test + public void equalsTest() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla"); + assertEquals(PhysicalNetwork.IsolationMethod.UNKNOWN_PROVIDER, method.provider); + assertEquals(new PhysicalNetwork.IsolationMethod("bla", PhysicalNetwork.IsolationMethod.UNKNOWN_PROVIDER), method); + } + + @Test + public void toStringTest() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla", "blob"); + assertEquals("bla", method.toString()); + + } + + @Test + public void getGeneric() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla", "blob"); + method = new PhysicalNetwork.IsolationMethod("bla"); + + assertEquals("blob",PhysicalNetwork.IsolationMethod.getIsolationMethod("bla").getProvider()); + } + + @Test + public void removeUnregistered() throws Exception { + assertFalse(PhysicalNetwork.IsolationMethod.remove("bla", "blob")); + } + + @Test + public void removeSuccesfulGeneric() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla", "blob"); + method = new PhysicalNetwork.IsolationMethod("bla"); + + PhysicalNetwork.IsolationMethod.remove("bla", "blob"); + assertEquals(PhysicalNetwork.IsolationMethod.UNKNOWN_PROVIDER,PhysicalNetwork.IsolationMethod.getIsolationMethod("bla").getProvider()); + } + + @Test(expected= PhysicalNetwork.IsolationMethod.IsolationMethodNotRegistered.class) + public void removeSuccesfulSpecificByString() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla", "blob"); + + PhysicalNetwork.IsolationMethod.remove("bla", "blob"); + PhysicalNetwork.IsolationMethod.getIsolationMethod("bla"); + } + + @Test(expected= PhysicalNetwork.IsolationMethod.IsolationMethodNotRegistered.class) + public void removeSuccesfulSpecificObject() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla"); + + PhysicalNetwork.IsolationMethod.remove(method); + PhysicalNetwork.IsolationMethod.getIsolationMethod("bla"); + } + + @Test + public void getIsolationMethodTest() throws Exception { + PhysicalNetwork.IsolationMethod method = new PhysicalNetwork.IsolationMethod("bla"); + final PhysicalNetwork.IsolationMethod isolationMethod = PhysicalNetwork.IsolationMethod.getIsolationMethod("bla"); + assertEquals(method, isolationMethod); + } +} diff --git a/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java b/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java index f27a4295590..29a29a46bf8 100644 --- a/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java +++ b/plugins/network-elements/bigswitch/src/com/cloud/network/guru/BigSwitchBcfGuestNetworkGuru.java @@ -129,7 +129,7 @@ public class BigSwitchBcfGuestNetworkGuru extends GuestNetworkGuru implements Ne public BigSwitchBcfGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.BCF_SEGMENT}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("BCF_SEGMENT")}; } @Override diff --git a/plugins/network-elements/brocade-vcs/src/com/cloud/network/guru/BrocadeVcsGuestNetworkGuru.java b/plugins/network-elements/brocade-vcs/src/com/cloud/network/guru/BrocadeVcsGuestNetworkGuru.java index ba06d14a4c0..6a201cf988b 100644 --- a/plugins/network-elements/brocade-vcs/src/com/cloud/network/guru/BrocadeVcsGuestNetworkGuru.java +++ b/plugins/network-elements/brocade-vcs/src/com/cloud/network/guru/BrocadeVcsGuestNetworkGuru.java @@ -16,11 +16,6 @@ // under the License. package com.cloud.network.guru; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.AssociateMacToNetworkAnswer; @@ -61,6 +56,10 @@ import com.cloud.user.Account; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.log4j.Logger; + +import javax.inject.Inject; +import java.util.List; public class BrocadeVcsGuestNetworkGuru extends GuestNetworkGuru { private static final Logger s_logger = Logger.getLogger(BrocadeVcsGuestNetworkGuru.class); @@ -82,7 +81,7 @@ public class BrocadeVcsGuestNetworkGuru extends GuestNetworkGuru { public BrocadeVcsGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.VCS}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("VCS")}; } @Override 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 54480e9ddb2..86ebd02469c 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,10 +19,6 @@ package com.cloud.network.guru; -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; @@ -42,6 +38,11 @@ import com.cloud.user.dao.AccountDao; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import javax.ejb.Local; +import javax.inject.Inject; @Component public class MidoNetGuestNetworkGuru extends GuestNetworkGuru { @@ -52,7 +53,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru { public MidoNetGuestNetworkGuru() { super(); - _isolationMethods = new PhysicalNetwork.IsolationMethod[] {PhysicalNetwork.IsolationMethod.MIDO}; + _isolationMethods = new PhysicalNetwork.IsolationMethod[] {new PhysicalNetwork.IsolationMethod("MIDO")}; } @Override diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 551269cc84c..548884e492f 100644 --- a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -113,7 +113,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru implements Netwo public NiciraNvpGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] { IsolationMethod.STT, IsolationMethod.VXLAN }; + _isolationMethods = new IsolationMethod[] { new IsolationMethod("STT", "NiciraNvp"), new IsolationMethod("VXLAN","NiciraNvp") }; } @Override diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java index f2c13054f28..79cdcfbae5e 100644 --- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java +++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java @@ -81,7 +81,6 @@ import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.NetworkModel; import com.cloud.network.Networks; -import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.PublicIpAddress; import com.cloud.network.dao.FirewallRulesCidrsDao; @@ -694,7 +693,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider Long guestPhysicalNetworkId = 0L; List physicalNetworkList = _physicalNetworkDao.listByZone(zoneId); for (PhysicalNetworkVO phyNtwk : physicalNetworkList) { - if (phyNtwk.getIsolationMethods().contains(PhysicalNetwork.IsolationMethod.VSP.name())) { + if (phyNtwk.getIsolationMethods().contains("VSP")) { guestPhysicalNetworkId = phyNtwk.getId(); break; } diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java index 735356a71df..9966a381981 100644 --- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java +++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java @@ -131,7 +131,7 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru { public NuageVspGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.VSP}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("VSP")}; } @Override @@ -591,6 +591,4 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru { if (defaultNic != null) return defaultNic.getNetworkId(); return null; } - - } diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java index 3a90163893e..7932555cc3d 100644 --- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java +++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java @@ -822,7 +822,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager, PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId); List physicalNetworksInZone = _physicalNetworkDao.listByZone(physicalNetwork.getDataCenterId()); for (PhysicalNetworkVO physicalNetworkInZone : physicalNetworksInZone) { - if (physicalNetworkInZone.getIsolationMethods().contains(PhysicalNetwork.IsolationMethod.VSP.name())) { + if (physicalNetworkInZone.getIsolationMethods().contains("VSP")) { nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkInZone.getId()); break; } diff --git a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java index 1916271db69..3805b13e528 100644 --- a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java +++ b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java @@ -56,7 +56,6 @@ import com.cloud.network.Network.Service; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.NuageVspDeviceVO; -import com.cloud.network.PhysicalNetwork; import com.cloud.network.dao.FirewallRulesDao; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.IPAddressVO; @@ -332,7 +331,7 @@ public class NuageVspElementTest extends NuageTest { when(context.getAccount()).thenReturn(acc); PhysicalNetworkVO physNet = mock(PhysicalNetworkVO.class); - when(physNet.getIsolationMethods()).thenReturn(Lists.newArrayList(PhysicalNetwork.IsolationMethod.VSP.name())); + when(physNet.getIsolationMethods()).thenReturn(Lists.newArrayList("VSP")); when(physNet.getId()).thenReturn(NETWORK_ID); when(_physicalNetworkDao.listByZone(NETWORK_ID)).thenReturn(Lists.newArrayList(physNet)); diff --git a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java index cbaa4d024b3..4e2bf892dd2 100644 --- a/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java +++ b/plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/OpendaylightGuestNetworkGuru.java @@ -19,26 +19,6 @@ package org.apache.cloudstack.network.opendaylight; -import java.util.List; -import java.util.UUID; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.network.opendaylight.agent.commands.AddHypervisorCommand; -import org.apache.cloudstack.network.opendaylight.agent.commands.ConfigureNetworkCommand; -import org.apache.cloudstack.network.opendaylight.agent.commands.ConfigurePortCommand; -import org.apache.cloudstack.network.opendaylight.agent.commands.DestroyNetworkCommand; -import org.apache.cloudstack.network.opendaylight.agent.commands.DestroyPortCommand; -import org.apache.cloudstack.network.opendaylight.agent.responses.AddHypervisorAnswer; -import org.apache.cloudstack.network.opendaylight.agent.responses.ConfigureNetworkAnswer; -import org.apache.cloudstack.network.opendaylight.agent.responses.ConfigurePortAnswer; -import org.apache.cloudstack.network.opendaylight.agent.responses.DestroyNetworkAnswer; -import org.apache.cloudstack.network.opendaylight.agent.responses.DestroyPortAnswer; -import org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerMappingDao; -import org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO; - import com.cloud.agent.AgentManager; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -68,6 +48,23 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.network.opendaylight.agent.commands.AddHypervisorCommand; +import org.apache.cloudstack.network.opendaylight.agent.commands.ConfigureNetworkCommand; +import org.apache.cloudstack.network.opendaylight.agent.commands.ConfigurePortCommand; +import org.apache.cloudstack.network.opendaylight.agent.commands.DestroyNetworkCommand; +import org.apache.cloudstack.network.opendaylight.agent.commands.DestroyPortCommand; +import org.apache.cloudstack.network.opendaylight.agent.responses.AddHypervisorAnswer; +import org.apache.cloudstack.network.opendaylight.agent.responses.ConfigureNetworkAnswer; +import org.apache.cloudstack.network.opendaylight.agent.responses.ConfigurePortAnswer; +import org.apache.cloudstack.network.opendaylight.agent.responses.DestroyNetworkAnswer; +import org.apache.cloudstack.network.opendaylight.agent.responses.DestroyPortAnswer; +import org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerMappingDao; +import org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO; +import org.apache.log4j.Logger; + +import javax.inject.Inject; +import java.util.List; +import java.util.UUID; public class OpendaylightGuestNetworkGuru extends GuestNetworkGuru { private static final Logger s_logger = Logger.getLogger(OpendaylightGuestNetworkGuru.class); @@ -86,7 +83,7 @@ public class OpendaylightGuestNetworkGuru extends GuestNetworkGuru { NetworkDao networkDao; public OpendaylightGuestNetworkGuru() { - _isolationMethods = new IsolationMethod[] {IsolationMethod.ODL}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("ODL")}; } @Override 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 f3f8ea052bd..50b98579aef 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,14 +16,6 @@ // under the License. package com.cloud.network.guru; -import com.cloud.network.vpc.VpcVO; -import com.cloud.network.vpc.dao.VpcDao; -import javax.inject.Inject; - -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; @@ -45,12 +37,19 @@ import com.cloud.network.PhysicalNetwork.IsolationMethod; import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.network.ovs.OvsTunnelManager; +import com.cloud.network.vpc.VpcVO; +import com.cloud.network.vpc.dao.VpcDao; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; import com.cloud.user.Account; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import javax.inject.Inject; @Component public class OvsGuestNetworkGuru extends GuestNetworkGuru { @@ -66,8 +65,8 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru { OvsGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.GRE, - IsolationMethod.L3, IsolationMethod.VLAN}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("GRE"), + new IsolationMethod("L3"), new IsolationMethod("VLAN")}; } @Override 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 be73e14060f..9ede8cc5a3e 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,13 +16,6 @@ // under the License. package org.apache.cloudstack.network.guru; -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.network.element.SspElement; -import org.apache.cloudstack.network.element.SspManager; - import com.cloud.dc.DataCenter.NetworkType; import com.cloud.deploy.DeployDestination; import com.cloud.exception.InsufficientAddressCapacityException; @@ -40,6 +33,11 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.ReservationContextImpl; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.network.element.SspElement; +import org.apache.cloudstack.network.element.SspManager; +import org.apache.log4j.Logger; + +import javax.inject.Inject; /** * Stratosphere SDN Platform NetworkGuru @@ -56,7 +54,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr public SspGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.SSP}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("SSP")}; } @Override 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 8d2015584da..c065bd191d0 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 @@ -17,11 +17,6 @@ package com.cloud.network.guru; -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; @@ -44,6 +39,9 @@ import com.cloud.user.Account; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; @Component public class VxlanGuestNetworkGuru extends GuestNetworkGuru { @@ -51,7 +49,7 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru { public VxlanGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.VXLAN}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("VXLAN")}; } @Override diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java index a5838ecb392..a6bc4f0d97e 100644 --- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java @@ -16,13 +16,6 @@ // under the License. package com.cloud.network.guru; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; -import org.apache.log4j.Logger; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -63,6 +56,12 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.context.CallContext; +import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; +import org.apache.log4j.Logger; + +import javax.inject.Inject; +import java.util.List; public class ExternalGuestNetworkGuru extends GuestNetworkGuru { private static final Logger s_logger = Logger.getLogger(ExternalGuestNetworkGuru.class); @@ -85,7 +84,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru { public ExternalGuestNetworkGuru() { super(); - _isolationMethods = new IsolationMethod[] {IsolationMethod.GRE, IsolationMethod.L3, IsolationMethod.VLAN}; + _isolationMethods = new IsolationMethod[] {new IsolationMethod("GRE"), new IsolationMethod("L3"), new IsolationMethod("VLAN")}; } @Override