Search in sources :

Example 6 with FindLogicalSwitchPortCommand

use of com.cloud.agent.api.FindLogicalSwitchPortCommand in project cloudstack by apache.

the class NiciraNvpResourceTest method testFindLogicalSwitchPortApiException.

@Test
public void testFindLogicalSwitchPortApiException() throws ConfigurationException, NiciraNvpApiException {
    resource.configure("NiciraNvpResource", parameters);
    when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());
    final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
    assertFalse(flspa.getResult());
}
Also used : FindLogicalSwitchPortAnswer(com.cloud.agent.api.FindLogicalSwitchPortAnswer) FindLogicalSwitchPortCommand(com.cloud.agent.api.FindLogicalSwitchPortCommand) NiciraNvpApiException(com.cloud.network.nicira.NiciraNvpApiException) Test(org.junit.Test)

Example 7 with FindLogicalSwitchPortCommand

use of com.cloud.agent.api.FindLogicalSwitchPortCommand in project cloudstack by apache.

the class NiciraNvpResourceTest method testFindLogicalSwitchPort.

@Test
public void testFindLogicalSwitchPort() throws ConfigurationException, NiciraNvpApiException {
    resource.configure("NiciraNvpResource", parameters);
    final List<LogicalSwitchPort> lspl = Arrays.asList(new LogicalSwitchPort());
    when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
    final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
    assertTrue(flspa.getResult());
}
Also used : FindLogicalSwitchPortAnswer(com.cloud.agent.api.FindLogicalSwitchPortAnswer) FindLogicalSwitchPortCommand(com.cloud.agent.api.FindLogicalSwitchPortCommand) LogicalSwitchPort(com.cloud.network.nicira.LogicalSwitchPort) Test(org.junit.Test)

Example 8 with FindLogicalSwitchPortCommand

use of com.cloud.agent.api.FindLogicalSwitchPortCommand in project cloudstack by apache.

the class NiciraNvpResourceTest method testFindLogicalSwitchPortNotFound.

@Test
public void testFindLogicalSwitchPortNotFound() throws ConfigurationException, NiciraNvpApiException {
    resource.configure("NiciraNvpResource", parameters);
    @SuppressWarnings("unchecked") final List<LogicalSwitchPort> lspl = Collections.EMPTY_LIST;
    when(nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenReturn(lspl);
    final FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
    assertFalse(flspa.getResult());
}
Also used : FindLogicalSwitchPortAnswer(com.cloud.agent.api.FindLogicalSwitchPortAnswer) FindLogicalSwitchPortCommand(com.cloud.agent.api.FindLogicalSwitchPortCommand) LogicalSwitchPort(com.cloud.network.nicira.LogicalSwitchPort) Test(org.junit.Test)

Aggregations

FindLogicalSwitchPortAnswer (com.cloud.agent.api.FindLogicalSwitchPortAnswer)8 FindLogicalSwitchPortCommand (com.cloud.agent.api.FindLogicalSwitchPortCommand)8 Test (org.junit.Test)6 LogicalSwitchPort (com.cloud.network.nicira.LogicalSwitchPort)4 CreateLogicalSwitchPortAnswer (com.cloud.agent.api.CreateLogicalSwitchPortAnswer)2 CreateLogicalSwitchPortCommand (com.cloud.agent.api.CreateLogicalSwitchPortCommand)2 UpdateLogicalSwitchPortCommand (com.cloud.agent.api.UpdateLogicalSwitchPortCommand)2 HostVO (com.cloud.host.HostVO)2 NiciraNvpDeviceVO (com.cloud.network.NiciraNvpDeviceVO)2 NiciraNvpNicMappingVO (com.cloud.network.NiciraNvpNicMappingVO)2 NiciraNvpApiException (com.cloud.network.nicira.NiciraNvpApiException)2 NicVO (com.cloud.vm.NicVO)2 NicPreparationException (com.cloud.exception.NicPreparationException)1 VirtualMachine (com.cloud.vm.VirtualMachine)1