Package com.cloud.network.nicira

Examples of com.cloud.network.nicira.LogicalSwitchPort


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

        final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lsp.getUuid()).thenReturn("eeee");
        when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort)any())).thenThrow(new NiciraNvpApiException());

        final CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
        final CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc);
        assertFalse(clspa.getResult());
View Full Code Here


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

        final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lsp.getUuid()).thenReturn("eeee");
        when(nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort)any())).thenReturn(lsp);
        doThrow(new NiciraNvpApiException()).when(nvpApi).updateLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any());

        final CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
        final CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer)resource.executeRequest(clspc);
View Full Code Here

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

        final LogicalRouter lrc = mock(LogicalRouter.class);
        final LogicalRouterPort lrp = mock(LogicalRouterPort.class);
        final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lrc.getUuid()).thenReturn("ccccc");
        when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
        when(lsp.getUuid()).thenReturn("fffff");
        when(nvpApi.createLogicalRouter((LogicalRouter)any())).thenReturn(lrc);
        when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort)any())).thenReturn(lrp);
        when(nvpApi.createLogicalSwitchPort(eq("bbbbb"), (LogicalSwitchPort)any())).thenReturn(lsp);
        final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
        final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer)resource.executeRequest(clrc);
View Full Code Here

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

        final LogicalRouter lrc = mock(LogicalRouter.class);
        final LogicalRouterPort lrp = mock(LogicalRouterPort.class);
        final LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lrc.getUuid()).thenReturn("ccccc");
        when(lrp.getUuid()).thenReturn("ddddd").thenReturn("eeeee");
        when(lsp.getUuid()).thenReturn("fffff");
        when(nvpApi.createLogicalRouter((LogicalRouter)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());
        final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
View Full Code Here

        try {
            // Tags set to scope cs_account and account name
            List<NiciraNvpTag> tags = new ArrayList<NiciraNvpTag>();
            tags.add(new NiciraNvpTag("cs_account",cmd.getOwnerName()));

            LogicalSwitchPort logicalSwitchPort = new LogicalSwitchPort(attachmentUuid, tags, true);
            LogicalSwitchPort newPort = _niciraNvpApi.createLogicalSwitchPort(logicalSwitchUuid, logicalSwitchPort);
            _niciraNvpApi.modifyLogicalSwitchPortAttachment(cmd.getLogicalSwitchUuid(), newPort.getUuid(), new VifAttachment(attachmentUuid));
            return new CreateLogicalSwitchPortAnswer(cmd, true, "Logical switch port " + newPort.getUuid() + " created", newPort.getUuid());
        } catch (NiciraNvpApiException e) {
          if (numRetries > 0) {
            return retry(cmd, --numRetries);
          }
          else {
View Full Code Here

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

        LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lsp.getUuid()).thenReturn("eeee");
        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);

        CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
        assertTrue(clspa.getResult());
View Full Code Here

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

        LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lsp.getUuid()).thenReturn("eeee");
        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenThrow(new NiciraNvpApiException());

        CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
        CreateLogicalSwitchPortAnswer clspa = (CreateLogicalSwitchPortAnswer) _resource.executeRequest(clspc);
        assertFalse(clspa.getResult());
View Full Code Here

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

        LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lsp.getUuid()).thenReturn("eeee");
        when(_nvpApi.createLogicalSwitchPort(eq("cccc"), (LogicalSwitchPort) any())).thenReturn(lsp);
        doThrow(new NiciraNvpApiException()).when(_nvpApi).modifyLogicalSwitchPortAttachment((String)any(), (String)any(), (Attachment)any());


        CreateLogicalSwitchPortCommand clspc = new CreateLogicalSwitchPortCommand("cccc", "dddd", "owner", "nicname");
View Full Code Here

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

        LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
        LogicalRouterPort lrp = mock(LogicalRouterPort.class);
        LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lrc.getUuid()).thenReturn("ccccc");
        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);
        CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
        CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) _resource.executeRequest(clrc);
View Full Code Here

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

        LogicalRouterConfig lrc = mock(LogicalRouterConfig.class);
        LogicalRouterPort lrp = mock(LogicalRouterPort.class);
        LogicalSwitchPort lsp = mock(LogicalSwitchPort.class);
        when(lrc.getUuid()).thenReturn("ccccc");
        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");
View Full Code Here

TOP

Related Classes of com.cloud.network.nicira.LogicalSwitchPort

Copyright © 2018 www.massapicom. 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.