use of com.cloud.network.NuageVspDeviceVO in project cloudstack by apache.
the class NuageVspElementTest method testApplyFWRules.
@Test
public void testApplyFWRules() throws Exception {
final Network network = mock(Network.class);
when(network.getUuid()).thenReturn("aaaaaa");
when(network.getVpcId()).thenReturn(null);
when(network.getNetworkOfferingId()).thenReturn(NETWORK_ID);
when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
when(network.getDomainId()).thenReturn(NETWORK_ID);
final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
when(ntwkoffer.getEgressDefaultPolicy()).thenReturn(true);
when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
final HostVO host = mock(HostVO.class);
when(host.getId()).thenReturn(NETWORK_ID);
final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NuageVspDeviceVO[] { nuageVspDevice }));
when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
when(_nuageVspManager.getNuageVspHost(NETWORK_ID)).thenReturn(host);
when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
final Answer answer = mock(Answer.class);
when(answer.getResult()).thenReturn(true);
when(_agentManager.easySend(eq(NETWORK_ID), (Command) any())).thenReturn(answer);
assertTrue(_nuageVspElement.applyFWRules(network, new ArrayList<FirewallRule>()));
}
use of com.cloud.network.NuageVspDeviceVO in project cloudstack by apache.
the class NuageVspGuestNetworkGuruTest method testTrash.
@Test
public void testTrash() throws Exception {
final NetworkVO network = mock(NetworkVO.class);
when(network.getId()).thenReturn(NETWORK_ID);
when(network.getUuid()).thenReturn("aaaaaa");
when(network.getName()).thenReturn("trash");
when(network.getDomainId()).thenReturn(NETWORK_ID);
when(network.getNetworkOfferingId()).thenReturn(NETWORK_ID);
when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
when(network.getDataCenterId()).thenReturn(NETWORK_ID);
when(network.getVpcId()).thenReturn(null);
when(_networkDao.acquireInLockTable(NETWORK_ID, 1200)).thenReturn(network);
final NetworkOfferingVO offering = mock(NetworkOfferingVO.class);
when(offering.getId()).thenReturn(NETWORK_ID);
when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(offering);
final DomainVO domain = mock(DomainVO.class);
when(domain.getUuid()).thenReturn("aaaaaa");
when(_domainDao.findById(NETWORK_ID)).thenReturn(domain);
final HostVO host = mock(HostVO.class);
when(host.getId()).thenReturn(NETWORK_ID);
final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new NuageVspDeviceVO[] { nuageVspDevice }));
when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
when(_nuageVspManager.getDnsDetails(network.getDataCenterId())).thenReturn(new ArrayList<String>());
when(_nuageVspManager.getGatewaySystemIds()).thenReturn(new ArrayList<String>());
assertTrue(_nuageVspGuestNetworkGuru.trash(network, offering));
}
use of com.cloud.network.NuageVspDeviceVO in project cloudstack by apache.
the class NuageVspGuestNetworkGuruTest method setUp.
@Before
public void setUp() throws Exception {
_nuageVspGuestNetworkGuru = new NuageVspGuestNetworkGuru();
super.setUp();
_nuageVspGuestNetworkGuru._nuageVspEntityBuilder = _nuageVspEntityBuilder;
final DataCenterVO dc = mock(DataCenterVO.class);
when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24");
when(_dataCenterDao.findById((Long) any())).thenReturn(dc);
when(_configurationDao.getValue(NuageVspIsolatedNetworkDomainTemplateName.key())).thenReturn("IsolatedDomainTemplate");
when(_configurationDao.getValue(NuageVspVpcDomainTemplateName.key())).thenReturn("VpcDomainTemplate");
when(_configurationDao.getValue(NuageVspSharedNetworkDomainTemplateName.key())).thenReturn("SharedDomainTemplate");
when(_physicalNetworkDao.findById(any(Long.class))).thenReturn(physnet);
when(physnet.getIsolationMethods()).thenReturn(Arrays.asList("VSP"));
when(physnet.getId()).thenReturn(NETWORK_ID);
final HostVO host = mock(HostVO.class);
when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
when(host.getId()).thenReturn(NETWORK_ID);
when(_agentManager.easySend(eq(NETWORK_ID), any(Command.class))).thenReturn(new Answer(null));
when(_nuageVspManager.getNuageVspHost(NETWORK_ID)).thenReturn(host);
final NuageVspDeviceVO device = mock(NuageVspDeviceVO.class);
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(device));
when(device.getId()).thenReturn(1L);
when(device.getHostId()).thenReturn(NETWORK_ID);
}
Aggregations