Examples of NiciraNvpApiException


Examples of com.cloud.network.nicira.NiciraNvpApiException

    @Test
    public void testFindLogicalSwitchPortApiException() throws ConfigurationException, NiciraNvpApiException {
        _resource.configure("NiciraNvpResource", _parameters);

        when(_nvpApi.findLogicalSwitchPortsByUuid("aaaa", "bbbb")).thenThrow(new NiciraNvpApiException());

        FindLogicalSwitchPortAnswer flspa = (FindLogicalSwitchPortAnswer) _resource.executeRequest(new FindLogicalSwitchPortCommand("aaaa", "bbbb"));
        assertFalse(flspa.getResult());
    }
View Full Code Here

Examples of com.cloud.network.nicira.NiciraNvpApiException

    @Test
    public void testCreateLogicalRouterApiException() throws ConfigurationException, NiciraNvpApiException {
        _resource.configure("NiciraNvpResource", _parameters);

        when(_nvpApi.createLogicalRouter((LogicalRouterConfig)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());
    }
View Full Code Here

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
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.