Examples of NiciraNvpApiException


Examples of com.cloud.network.nicira.NiciraNvpApiException

    _resource.configure("NiciraNvpResource", _parameters);
   
    LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
    when(lrc.getUuid()).thenReturn("ccccc");
    when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
    when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenThrow(new NiciraNvpApiException());
    CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
    CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
   
    assertFalse(clra.getResult());
    verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
    when(lsp.getUuid()).thenReturn("fffff");
    when(_nvpApi.createLogicalRouter((LogicalRouterConfig)any())).thenReturn(lrc);
    when(_nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
    when(_nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
    when(_nvpApi.createLogicalRouterNatRule((String) any(), (NatRule)any())).thenThrow(new NiciraNvpApiException());
    CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
    CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
   
    assertFalse(clra.getResult());
    verify(_nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

 
  @Test
  public void testDeleteLogicalRouterApiException() throws ConfigurationException,NiciraNvpApiException {
    _resource.configure("NiciraNvpResource", _parameters);
   
    doThrow(new NiciraNvpApiException()).when(_nvpApi).deleteLogicalRouter(eq("aaaaa"));
    DeleteLogicalRouterAnswer dlspa = (DeleteLogicalRouterAnswer) _resource.executeRequest(new DeleteLogicalRouterCommand("aaaaa"));
    assertFalse(dlspa.getResult());   
  }
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    @SuppressWarnings("unchecked")
    NiciraNvpList<LogicalRouterPort> list = mock(NiciraNvpList.class);
   
    when(cmd.getLogicalRouterUuid()).thenReturn("aaaaa");
    when(cmd.getL3GatewayServiceUuid()).thenReturn("bbbbb");
    doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalRouterPort((String) any(), (LogicalRouterPort) any());
    when(_nvpApi.findLogicalRouterPortByGatewayServiceUuid("aaaaa","bbbbb")).thenReturn(list);
   
    ConfigurePublicIpsOnLogicalRouterAnswer answer =
        (ConfigurePublicIpsOnLogicalRouterAnswer) _resource.executeRequest(cmd);
    assertFalse(answer.getResult());
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

   
    // Mock the api create calls
    NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
    rulepair[0].setUuid(UUID.randomUUID());
    rulepair[1].setUuid(UUID.randomUUID());
    when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());

    // Mock the api find call
    @SuppressWarnings("unchecked")
    NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
    when(storedRules.getResultCount()).thenReturn(0);
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

   
    // Mock the api create calls
    NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
    rulepair[0].setUuid(UUID.randomUUID());
    rulepair[1].setUuid(UUID.randomUUID());
    when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());

    // Mock the api find call
    @SuppressWarnings("unchecked")
    NiciraNvpList<NatRule> storedRules = mock(NiciraNvpList.class);
    when(storedRules.getResultCount()).thenReturn(0);
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    public void testPingCommandStatusApiException() throws ConfigurationException, NiciraNvpApiException {
        resource.configure("NiciraNvpResource", parameters);

        final ControlClusterStatus ccs = mock(ControlClusterStatus.class);
        when(ccs.getClusterStatus()).thenReturn("unstable");
        when(nvpApi.getControlClusterStatus()).thenThrow(new NiciraNvpApiException());

        final PingCommand ping = resource.getCurrentStatus(42);
        assertTrue(ping == null);
    }
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    public void testRetries() throws ConfigurationException, NiciraNvpApiException {
        resource.configure("NiciraNvpResource", parameters);

        final LogicalSwitch ls = mock(LogicalSwitch.class);
        when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
        when(nvpApi.createLogicalSwitch((LogicalSwitch)any())).thenThrow(new NiciraNvpApiException()).thenThrow(new NiciraNvpApiException()).thenReturn(ls);

        final CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner");
        final CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc);
        assertTrue(clsa.getResult());
    }
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    public void testCreateLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException {
        resource.configure("NiciraNvpResource", parameters);

        final LogicalSwitch ls = mock(LogicalSwitch.class);
        when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
        when(nvpApi.createLogicalSwitch((LogicalSwitch)any())).thenThrow(new NiciraNvpApiException());

        final CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)parameters.get("guid"), "stt", "loigicalswitch", "owner");
        final CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer)resource.executeRequest(clsc);
        assertFalse(clsa.getResult());
    }
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    @Test
    public void testDeleteLogicalSwitchApiException() throws ConfigurationException, NiciraNvpApiException {
        resource.configure("NiciraNvpResource", parameters);

        doThrow(new NiciraNvpApiException()).when(nvpApi).deleteLogicalSwitch((String)any());

        final DeleteLogicalSwitchCommand dlsc = new DeleteLogicalSwitchCommand("cccc");
        final DeleteLogicalSwitchAnswer dlsa = (DeleteLogicalSwitchAnswer)resource.executeRequest(dlsc);
        assertFalse(dlsa.getResult());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.