Package com.cloud.agent.api

Examples of com.cloud.agent.api.CreateLogicalSwitchAnswer


        when(acc.getAccountName()).thenReturn("accountname");
        ReservationContext res = mock(ReservationContext.class);
        when(res.getDomain()).thenReturn(dom);
        when(res.getAccount()).thenReturn(acc);

        CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class);
        when(answer.getResult()).thenReturn(true);
        //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa");
        when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer);

        Network implementednetwork = guru.implement(network, offering, dest, res);
        assertTrue(implementednetwork == null);
View Full Code Here


        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);

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

        LogicalSwitch ls = mock(LogicalSwitch.class);
        when(ls.getUuid()).thenReturn("cccc").thenReturn("cccc");
        when(_nvpApi.createLogicalSwitch((LogicalSwitch) any())).thenReturn(ls);

        CreateLogicalSwitchCommand clsc = new CreateLogicalSwitchCommand((String)_parameters.get("guid"), "stt", "loigicalswitch","owner");
        CreateLogicalSwitchAnswer clsa = (CreateLogicalSwitchAnswer) _resource.executeRequest(clsc);
        assertTrue(clsa.getResult());
        assertTrue("cccc".equals(clsa.getLogicalSwitchUuid()));
    }
View Full Code Here

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

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

        tags.add(new NiciraNvpTag("cs_account",cmd.getOwnerName()));
        logicalSwitch.setTags(tags);

        try {
            logicalSwitch = _niciraNvpApi.createLogicalSwitch(logicalSwitch);
            return new CreateLogicalSwitchAnswer(cmd, true, "Logicalswitch " + logicalSwitch.getUuid() + " created", logicalSwitch.getUuid());
        } catch (NiciraNvpApiException e) {
            if (numRetries > 0) {
                return retry(cmd, --numRetries);
            }
            else {
                return new CreateLogicalSwitchAnswer(cmd, e);
            }
        }

    }
View Full Code Here

        String transportzoneuuid = niciraNvpHost.getDetail("transportzoneuuid");
        String transportzoneisotype = niciraNvpHost.getDetail("transportzoneisotype");

        CreateLogicalSwitchCommand cmd = new CreateLogicalSwitchCommand(transportzoneuuid, transportzoneisotype, name,
                context.getDomain().getName() + "-" + context.getAccount().getAccountName());
        CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer)_agentMgr.easySend(niciraNvpHost.getId(), cmd);

        if (answer == null || !answer.getResult()) {
            s_logger.error("CreateLogicalSwitchCommand failed");
            return null;
        }

        try {
            implemented.setBroadcastUri(new URI("lswitch", answer.getLogicalSwitchUuid(), null));
            implemented.setBroadcastDomainType(BroadcastDomainType.Lswitch);
            s_logger.info("Implemented OK, network linked to  = " + implemented.getBroadcastUri().toString());
        } catch (URISyntaxException e) {
            s_logger.error("Unable to store logical switch id in broadcast uri, uuid = " + implemented.getUuid(), e);
            return null;
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.CreateLogicalSwitchAnswer

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.