Package com.cloud.network.bigswitch

Examples of com.cloud.network.bigswitch.Network


    @Override
    public void setAgentControl(IAgentControl agentControl) {
    }

    private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) {
        Network network = new Network();
        network.setTenant_id(cmd.getTenantUuid());
        network.setUuid(cmd.getNetworkUuid());
        network.setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
        network.setVlan(cmd.getVlan());

        try {
            _bigswitchVnsApi.createNetwork(network);
            return new CreateVnsNetworkAnswer(cmd, true, "VNS " + network.getUuid() + " created");
        } catch (BigSwitchVnsApiException e) {
                if (numRetries > 0) {
                        return retry(cmd, --numRetries);
                }
                else {
View Full Code Here


    @Test
    public void testRetries() throws ConfigurationException, BigSwitchVnsApiException {
        _resource.configure("BigSwitchVnsResource", _parameters);

        Network network = mock(Network.class);
        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");

        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
        assertTrue(cntka.getResult());
    }
View Full Code Here

    @Test
    public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException {
        _resource.configure("BigSwitchVnsResource", _parameters);

        Network network = mock(Network.class);
        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");

        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
        assertTrue(cntka.getResult());
    }
View Full Code Here

    @Test
    public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
        _resource.configure("BigSwitchVnsResource", _parameters);

        Network network = mock(Network.class);
        when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
        doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createNetwork((Network)any());

        CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
        CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
        assertFalse(cntka.getResult());
View Full Code Here

TOP

Related Classes of com.cloud.network.bigswitch.Network

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.