Examples of NeutronNetworksNorthboundAction


Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    private Answer executeRequest(final MaintainCommand cmd) {
        return new MaintainAnswer(cmd);
    }

    private Answer executeRequest(ConfigureNetworkCommand cmd) {
        NeutronNetworksNorthboundAction configureNetwork = new NeutronNetworksNorthboundAction(controllerUrl, controllerUsername, controllerPassword);

        // Find free gre key
        int gre_key = -1;
        Random keyGenerator = new Random(System.currentTimeMillis());
        try {
            NeutronNetworksList<NeutronNetwork> networks = configureNetwork.listAllNetworks();
            while (true) {
                int i = keyGenerator.nextInt();
                for (NeutronNetwork network : networks.getNetworks()) {
                    if (network.getSegmentationId() == i) {
                        continue;
                    }
                }
                gre_key = i;
                break;
            }
        } catch (NeutronRestApiException e) {
            s_logger.error("Failed to list existing networks on the ODL Controller", e);
            return new ConfigureNetworkAnswer(cmd, e);
        }

        NeutronNetwork newNetwork = new NeutronNetwork();

        // Configuration from the command
        newNetwork.setName(cmd.getName());
        newNetwork.setTenantId(cmd.getTenantId());

        // Static configuation
        newNetwork.setNetworkType("gre");
        newNetwork.setShared(false);
        newNetwork.setSegmentationId(gre_key);
        newNetwork.setId(UUID.randomUUID());

        NeutronNetworkWrapper wrapper = new NeutronNetworkWrapper();
        wrapper.setNetwork(newNetwork);
        try {
            wrapper = configureNetwork.createNeutronNetwork(wrapper);
        } catch (NeutronRestApiException e) {
            s_logger.error("createNeutronNetwork failed", e);
            return new ConfigureNetworkAnswer(cmd, e);
        }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

        return new ConfigureNetworkAnswer(cmd, true, null, wrapper.getNetwork().getId().toString());
    }

    private Answer executeRequest(DestroyNetworkCommand cmd) {
        NeutronNetworksNorthboundAction configureNetwork = new NeutronNetworksNorthboundAction(controllerUrl, controllerUsername, controllerPassword);
        try {
            configureNetwork.deleteNeutronNetwork(cmd.getNetworkUuid());
        } catch (NeutronRestApiException e) {
            s_logger.error("deleteNeutronNetwork failed", e);
            return new DestroyNetworkAnswer(cmd, e);
        }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    public void neutronNetworksFail() throws NeutronRestApiException {
        URL url;
        try {
            url = new URL("http://localhost:8080");

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.listAllNetworks();
        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    public void neutronFindNetworkByIdFail() throws NeutronRestApiException {
        URL url;
        try {
            url = new URL("http://localhost:8080");

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.findNetworkById("0AACEED5-A688-429A-92FC-E1C9E4EEEE98");
        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    public void neutronHTTPDeleteMethod() throws NeutronRestApiException {
        URL url;
        try {
            url = new URL("http://127.0.0.1:8080");

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.deleteNeutronNetwork("0AACEED5-A688-429A-92FC-E1C9E4EEEE98");
        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    public void neutronHTTPGetMethod() throws NeutronRestApiException {
        URL url;
        try {
            url = new URL("http://localhost:8080");

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.listAllNetworks();
        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

            network.setTenantId("wilder");

            NeutronNetworkWrapper networkWrapper = new NeutronNetworkWrapper();
            networkWrapper.setNetwork(network);

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.createNeutronNetwork(networkWrapper);

        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

            network.setTenantId("wilder");

            NeutronNetworkWrapper networkWrapper = new NeutronNetworkWrapper();
            networkWrapper.setNetwork(network);

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            neutron.updateNeutronNetwork("ca31aa7f-84c7-416d-bc00-1f84927367e0", networkWrapper);

        } catch (MalformedURLException e) {
            Assert.fail("Should not fail here.");
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.network.opendaylight.api.resources.NeutronNetworksNorthboundAction

    public void neutronListAllNetworks() throws NeutronRestApiException {
        URL url;
        try {
            url = new URL("http://178.237.34.233:8080");

            NeutronNetworksNorthboundAction neutron = new NeutronNetworksNorthboundAction(url, "admin", "admin");
            NeutronNetworksList<NeutronNetworkWrapper> results = neutron.listAllNetworks();

            Assert.assertNotNull(results);

            List<NeutronNetworkWrapper> networks = results.getNetworks();
            Assert.assertNotNull(networks);
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.