mirror of https://github.com/apache/cloudstack.git
add method to all classes
This commit is contained in:
parent
cc55bd08b5
commit
a83f6e3011
|
|
@ -138,6 +138,11 @@ public class ContrailGuru extends AdapterBase implements NetworkGuru {
|
|||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapacityException {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ import com.cloud.domain.dao.DomainDao;
|
|||
import com.cloud.network.Network;
|
||||
import com.cloud.network.NetworkModel;
|
||||
import com.cloud.network.Networks;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.dao.NetworkVO;
|
||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||
import com.cloud.network.vpc.VpcVO;
|
||||
|
|
@ -80,8 +82,6 @@ public class NsxGuestNetworkGuruTest {
|
|||
@Mock
|
||||
NsxControllerUtils nsxControllerUtils;
|
||||
@Mock
|
||||
DataCenterDao zoneDao;
|
||||
@Mock
|
||||
AccountDao accountDao;
|
||||
@Mock
|
||||
PhysicalNetworkVO physicalNetwork;
|
||||
|
|
@ -101,6 +101,8 @@ public class NsxGuestNetworkGuruTest {
|
|||
NetworkModel networkModel;
|
||||
@Mock
|
||||
DomainDao domainDao;
|
||||
@Mock
|
||||
NetworkDao networkDao;
|
||||
|
||||
NsxGuestNetworkGuru guru;
|
||||
AutoCloseable closeable;
|
||||
|
|
@ -111,6 +113,7 @@ public class NsxGuestNetworkGuruTest {
|
|||
guru = new NsxGuestNetworkGuru();
|
||||
ReflectionTestUtils.setField(guru, "_physicalNetworkDao", physicalNetworkDao);
|
||||
ReflectionTestUtils.setField(guru, "_dcDao", dcDao);
|
||||
ReflectionTestUtils.setField(guru, "_networkDao", networkDao);
|
||||
ReflectionTestUtils.setField(guru, "_networkModel", networkModel);
|
||||
ReflectionTestUtils.setField(guru, "_vpcDao", vpcDao);
|
||||
|
||||
|
|
@ -161,16 +164,24 @@ public class NsxGuestNetworkGuruTest {
|
|||
public void testNsxNetworkDesign() {
|
||||
when(physicalNetworkDao.findById(ArgumentMatchers.anyLong())).thenReturn(physicalNetwork);
|
||||
when(dcDao.findById(ArgumentMatchers.anyLong())).thenReturn(dataCenterVO);
|
||||
when(nsxControllerUtils.sendNsxCommand(any(CreateNsxSegmentCommand.class), anyLong())).thenReturn(
|
||||
new NsxAnswer(new NsxCommand(), true, ""));
|
||||
|
||||
Network designedNetwork = guru.design(offering, plan, network, "", 1L, account);
|
||||
verify(nsxControllerUtils, times(1)).sendNsxCommand(any(CreateNsxSegmentCommand.class), anyLong());
|
||||
assertNotNull(designedNetwork);
|
||||
assertSame(Networks.BroadcastDomainType.NSX, designedNetwork.getBroadcastDomainType());
|
||||
assertSame(Network.State.Allocated, designedNetwork.getState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNsxNetworkSetup() {
|
||||
when(dcDao.findById(ArgumentMatchers.anyLong())).thenReturn(dataCenterVO);
|
||||
when(networkDao.findById(ArgumentMatchers.anyLong())).thenReturn(mock(NetworkVO.class));
|
||||
when(nsxControllerUtils.sendNsxCommand(any(CreateNsxSegmentCommand.class), anyLong())).thenReturn(
|
||||
new NsxAnswer(new NsxCommand(), true, ""));
|
||||
|
||||
guru.setup(network, 1L);
|
||||
verify(nsxControllerUtils, times(1)).sendNsxCommand(any(CreateNsxSegmentCommand.class), anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNsxNetworkImplementation() {
|
||||
final DeployDestination deployDestination = mock(DeployDestination.class);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
|
|||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected ControlNetworkGuru() {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,6 +251,11 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected DirectNetworkGuru() {
|
||||
super();
|
||||
_isolationMethods = new IsolationMethod[] { new IsolationMethod("VLAN"), new IsolationMethod("VXLAN") };
|
||||
|
|
|
|||
|
|
@ -148,6 +148,11 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
|||
_isolationMethods = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
private void updateNicIpv6(Network network, NicProfile nic, VirtualMachineProfile vm, DataCenter dc, boolean isGateway) throws InsufficientAddressCapacityException {
|
||||
boolean isIpv6Supported = networkOfferingDao.isIpv6Supported(network.getNetworkOfferingId());
|
||||
if (!isIpv6Supported || nic.getIPv6Address() != null || network.getIp6Cidr() == null || network.getIp6Gateway() == null) {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected PodBasedNetworkGuru() {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,11 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
|
|||
|
|
@ -115,6 +115,11 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(Network network, long networkId) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected PublicNetworkGuru() {
|
||||
super();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue