mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-10007: Isolation methods (#2193)
Change isolation methods from an enum to a registry based construct to enhance pluggability
This commit is contained in:
parent
98dc4eb96a
commit
597df24b53
@ -16,12 +16,16 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network;
|
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.Identity;
|
||||||
import org.apache.cloudstack.api.InternalIdentity;
|
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;
|
Disabled, Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IsolationMethod {
|
public class IsolationMethod {
|
||||||
VLAN, L3, GRE, STT, BCF_SEGMENT, MIDO, SSP, VXLAN, ODL, L3VPN, VSP, VCS;
|
protected static final String UNKNOWN_PROVIDER = "Unknown";
|
||||||
|
static Set<IsolationMethod> 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 {
|
public enum BroadcastDomainRange {
|
||||||
|
|||||||
89
api/test/com/cloud/network/IsolationMethodTest.java
Normal file
89
api/test/com/cloud/network/IsolationMethodTest.java
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -129,7 +129,7 @@ public class BigSwitchBcfGuestNetworkGuru extends GuestNetworkGuru implements Ne
|
|||||||
|
|
||||||
public BigSwitchBcfGuestNetworkGuru() {
|
public BigSwitchBcfGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.BCF_SEGMENT};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("BCF_SEGMENT")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,11 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.guru;
|
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.AgentManager;
|
||||||
import com.cloud.agent.api.AssociateMacToNetworkAnswer;
|
import com.cloud.agent.api.AssociateMacToNetworkAnswer;
|
||||||
@ -61,6 +56,10 @@ import com.cloud.user.Account;
|
|||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BrocadeVcsGuestNetworkGuru extends GuestNetworkGuru {
|
public class BrocadeVcsGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
private static final Logger s_logger = Logger.getLogger(BrocadeVcsGuestNetworkGuru.class);
|
private static final Logger s_logger = Logger.getLogger(BrocadeVcsGuestNetworkGuru.class);
|
||||||
@ -82,7 +81,7 @@ public class BrocadeVcsGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
public BrocadeVcsGuestNetworkGuru() {
|
public BrocadeVcsGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.VCS};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("VCS")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -19,10 +19,6 @@
|
|||||||
|
|
||||||
package com.cloud.network.guru;
|
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.dc.DataCenter.NetworkType;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
@ -42,6 +38,11 @@ import com.cloud.user.dao.AccountDao;
|
|||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
|
public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
@ -52,7 +53,7 @@ public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
public MidoNetGuestNetworkGuru() {
|
public MidoNetGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new PhysicalNetwork.IsolationMethod[] {PhysicalNetwork.IsolationMethod.MIDO};
|
_isolationMethods = new PhysicalNetwork.IsolationMethod[] {new PhysicalNetwork.IsolationMethod("MIDO")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -113,7 +113,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru implements Netwo
|
|||||||
|
|
||||||
public NiciraNvpGuestNetworkGuru() {
|
public NiciraNvpGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] { IsolationMethod.STT, IsolationMethod.VXLAN };
|
_isolationMethods = new IsolationMethod[] { new IsolationMethod("STT", "NiciraNvp"), new IsolationMethod("VXLAN","NiciraNvp") };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -81,7 +81,6 @@ import com.cloud.network.Network.Provider;
|
|||||||
import com.cloud.network.Network.Service;
|
import com.cloud.network.Network.Service;
|
||||||
import com.cloud.network.NetworkModel;
|
import com.cloud.network.NetworkModel;
|
||||||
import com.cloud.network.Networks;
|
import com.cloud.network.Networks;
|
||||||
import com.cloud.network.PhysicalNetwork;
|
|
||||||
import com.cloud.network.PhysicalNetworkServiceProvider;
|
import com.cloud.network.PhysicalNetworkServiceProvider;
|
||||||
import com.cloud.network.PublicIpAddress;
|
import com.cloud.network.PublicIpAddress;
|
||||||
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
import com.cloud.network.dao.FirewallRulesCidrsDao;
|
||||||
@ -694,7 +693,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
|
|||||||
Long guestPhysicalNetworkId = 0L;
|
Long guestPhysicalNetworkId = 0L;
|
||||||
List<PhysicalNetworkVO> physicalNetworkList = _physicalNetworkDao.listByZone(zoneId);
|
List<PhysicalNetworkVO> physicalNetworkList = _physicalNetworkDao.listByZone(zoneId);
|
||||||
for (PhysicalNetworkVO phyNtwk : physicalNetworkList) {
|
for (PhysicalNetworkVO phyNtwk : physicalNetworkList) {
|
||||||
if (phyNtwk.getIsolationMethods().contains(PhysicalNetwork.IsolationMethod.VSP.name())) {
|
if (phyNtwk.getIsolationMethods().contains("VSP")) {
|
||||||
guestPhysicalNetworkId = phyNtwk.getId();
|
guestPhysicalNetworkId = phyNtwk.getId();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,7 +131,7 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
public NuageVspGuestNetworkGuru() {
|
public NuageVspGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.VSP};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("VSP")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -591,6 +591,4 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
if (defaultNic != null) return defaultNic.getNetworkId();
|
if (defaultNic != null) return defaultNic.getNetworkId();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -822,7 +822,7 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
|
|||||||
PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
|
PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
|
||||||
List<PhysicalNetworkVO> physicalNetworksInZone = _physicalNetworkDao.listByZone(physicalNetwork.getDataCenterId());
|
List<PhysicalNetworkVO> physicalNetworksInZone = _physicalNetworkDao.listByZone(physicalNetwork.getDataCenterId());
|
||||||
for (PhysicalNetworkVO physicalNetworkInZone : physicalNetworksInZone) {
|
for (PhysicalNetworkVO physicalNetworkInZone : physicalNetworksInZone) {
|
||||||
if (physicalNetworkInZone.getIsolationMethods().contains(PhysicalNetwork.IsolationMethod.VSP.name())) {
|
if (physicalNetworkInZone.getIsolationMethods().contains("VSP")) {
|
||||||
nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkInZone.getId());
|
nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkInZone.getId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,6 @@ import com.cloud.network.Network.Service;
|
|||||||
import com.cloud.network.Networks.BroadcastDomainType;
|
import com.cloud.network.Networks.BroadcastDomainType;
|
||||||
import com.cloud.network.Networks.TrafficType;
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.network.NuageVspDeviceVO;
|
import com.cloud.network.NuageVspDeviceVO;
|
||||||
import com.cloud.network.PhysicalNetwork;
|
|
||||||
import com.cloud.network.dao.FirewallRulesDao;
|
import com.cloud.network.dao.FirewallRulesDao;
|
||||||
import com.cloud.network.dao.IPAddressDao;
|
import com.cloud.network.dao.IPAddressDao;
|
||||||
import com.cloud.network.dao.IPAddressVO;
|
import com.cloud.network.dao.IPAddressVO;
|
||||||
@ -332,7 +331,7 @@ public class NuageVspElementTest extends NuageTest {
|
|||||||
when(context.getAccount()).thenReturn(acc);
|
when(context.getAccount()).thenReturn(acc);
|
||||||
|
|
||||||
PhysicalNetworkVO physNet = mock(PhysicalNetworkVO.class);
|
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(physNet.getId()).thenReturn(NETWORK_ID);
|
||||||
when(_physicalNetworkDao.listByZone(NETWORK_ID)).thenReturn(Lists.newArrayList(physNet));
|
when(_physicalNetworkDao.listByZone(NETWORK_ID)).thenReturn(Lists.newArrayList(physNet));
|
||||||
|
|
||||||
|
|||||||
@ -19,26 +19,6 @@
|
|||||||
|
|
||||||
package org.apache.cloudstack.network.opendaylight;
|
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.agent.AgentManager;
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
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.NicProfile;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
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 {
|
public class OpendaylightGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
private static final Logger s_logger = Logger.getLogger(OpendaylightGuestNetworkGuru.class);
|
private static final Logger s_logger = Logger.getLogger(OpendaylightGuestNetworkGuru.class);
|
||||||
@ -86,7 +83,7 @@ public class OpendaylightGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
NetworkDao networkDao;
|
NetworkDao networkDao;
|
||||||
|
|
||||||
public OpendaylightGuestNetworkGuru() {
|
public OpendaylightGuestNetworkGuru() {
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.ODL};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("ODL")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,14 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.guru;
|
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;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
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.NetworkVO;
|
||||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||||
import com.cloud.network.ovs.OvsTunnelManager;
|
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.offering.NetworkOffering;
|
||||||
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
|
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
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
|
@Component
|
||||||
public class OvsGuestNetworkGuru extends GuestNetworkGuru {
|
public class OvsGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
@ -66,8 +65,8 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
OvsGuestNetworkGuru() {
|
OvsGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.GRE,
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("GRE"),
|
||||||
IsolationMethod.L3, IsolationMethod.VLAN};
|
new IsolationMethod("L3"), new IsolationMethod("VLAN")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,13 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.network.guru;
|
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.dc.DataCenter.NetworkType;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
@ -40,6 +33,11 @@ import com.cloud.vm.NicProfile;
|
|||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.ReservationContextImpl;
|
import com.cloud.vm.ReservationContextImpl;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
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
|
* Stratosphere SDN Platform NetworkGuru
|
||||||
@ -56,7 +54,7 @@ public class SspGuestNetworkGuru extends GuestNetworkGuru implements NetworkMigr
|
|||||||
|
|
||||||
public SspGuestNetworkGuru() {
|
public SspGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.SSP};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("SSP")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -17,11 +17,6 @@
|
|||||||
package com.cloud.network.guru;
|
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;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
@ -44,6 +39,9 @@ import com.cloud.user.Account;
|
|||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
|
public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
@ -51,7 +49,7 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
public VxlanGuestNetworkGuru() {
|
public VxlanGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.VXLAN};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("VXLAN")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -16,13 +16,6 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.guru;
|
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;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
@ -63,6 +56,12 @@ import com.cloud.vm.NicProfile;
|
|||||||
import com.cloud.vm.NicVO;
|
import com.cloud.vm.NicVO;
|
||||||
import com.cloud.vm.ReservationContext;
|
import com.cloud.vm.ReservationContext;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
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 {
|
public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||||
private static final Logger s_logger = Logger.getLogger(ExternalGuestNetworkGuru.class);
|
private static final Logger s_logger = Logger.getLogger(ExternalGuestNetworkGuru.class);
|
||||||
@ -85,7 +84,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
|
|
||||||
public ExternalGuestNetworkGuru() {
|
public ExternalGuestNetworkGuru() {
|
||||||
super();
|
super();
|
||||||
_isolationMethods = new IsolationMethod[] {IsolationMethod.GRE, IsolationMethod.L3, IsolationMethod.VLAN};
|
_isolationMethods = new IsolationMethod[] {new IsolationMethod("GRE"), new IsolationMethod("L3"), new IsolationMethod("VLAN")};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user