From ce12d0d70d96e342ffa3c43ed2f2b8d664add29a Mon Sep 17 00:00:00 2001 From: "tomoe@midokura.jp" Date: Mon, 13 Aug 2012 18:51:23 +0530 Subject: [PATCH] Submit Midokura SDN controller stubs --- api/src/com/cloud/network/Network.java | 1 + .../midokura-midonet/build.xml | 0 .../element/MidokuraMidonetElement.java | 133 ++++++++++++++++++ .../guru/MidokuraMidonetGuestNetworkGuru.java | 46 ++++++ .../network/ExternalNetworkDeviceManager.java | 4 +- 5 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 plugins/network-elements/midokura-midonet/build.xml create mode 100644 plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java create mode 100644 plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java index b3461b5c5e6..75d94ee163f 100644 --- a/api/src/com/cloud/network/Network.java +++ b/api/src/com/cloud/network/Network.java @@ -121,6 +121,7 @@ public interface Network extends ControlledEntity { public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false); public static final Provider None = new Provider("None", false); public static final Provider NiciraNvp = new Provider("NiciraNvp", true); + public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", true); private String name; private boolean isExternal; diff --git a/plugins/network-elements/midokura-midonet/build.xml b/plugins/network-elements/midokura-midonet/build.xml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java new file mode 100644 index 00000000000..56734669020 --- /dev/null +++ b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.network.element; + +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.offering.NetworkOffering; +import com.cloud.utils.component.AdapterBase; +import com.cloud.utils.component.PluggableService; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import java.util.Map; +import java.util.Set; + +/** + * User: tomoe + * Date: 8/8/12 + * Time: 1:38 PM + */ + +@Local(value = NetworkElement.class) +public class MidokuraMidonetElement extends AdapterBase implements ConnectivityProvider, PluggableService { + private static final Logger s_logger = Logger.getLogger(MidokuraMidonetElement.class); + + @Override + public Map> getCapabilities() { + // TODO: implement this. + return null; + } + + @Override + public Provider getProvider() { + // TODO: implement this. + return null; + } + + @Override + public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, + ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + // TODO: implement this. + return false; + } + + @Override + public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + // TODO: implement this. + return false; + } + + @Override + public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, + ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + // TODO: implement this. + return false; + } + + @Override + public boolean shutdown(Network network, ReservationContext context, boolean cleanup) + throws ConcurrentOperationException, ResourceUnavailableException { + // TODO: implement this. + return false; + } + + @Override + public boolean destroy(Network network) throws ConcurrentOperationException, ResourceUnavailableException { + // TODO: implement this. + return false; + } + + @Override + public boolean isReady(PhysicalNetworkServiceProvider provider) { + // TODO: implement this. + return false; + } + + @Override + public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + // TODO: implement this. + return false; + } + + @Override + public boolean canEnableIndividualServices() { + // TODO: implement this. + return false; + } + + @Override + public boolean verifyServicesCombination(Set services) { + // TODO: implement this. + return false; + } + + @Override + public String getPropertiesFile() { + // TODO: implement this. + return null; + } +} diff --git a/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java b/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java new file mode 100644 index 00000000000..0526b45ada9 --- /dev/null +++ b/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.network.guru; + +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.network.PhysicalNetwork; +import com.cloud.offering.NetworkOffering; +import org.apache.log4j.Logger; + +import javax.ejb.Local; + +/** + * User: tomoe + * Date: 8/8/12 + * Time: 10:46 AM + */ + +@Local(value = NetworkGuru.class) +public class MidokuraMidonetGuestNetworkGuru extends GuestNetworkGuru { + private static final Logger s_logger = Logger.getLogger(MidokuraMidonetGuestNetworkGuru.class); + + + @Override + protected boolean canHandle(NetworkOffering offering, NetworkType networkType, + PhysicalNetwork physicalNetwork) { + // TODO: implement this. + return false; + } +} \ No newline at end of file diff --git a/server/src/com/cloud/network/ExternalNetworkDeviceManager.java b/server/src/com/cloud/network/ExternalNetworkDeviceManager.java index dec0608c8df..b1de86f70f2 100644 --- a/server/src/com/cloud/network/ExternalNetworkDeviceManager.java +++ b/server/src/com/cloud/network/ExternalNetworkDeviceManager.java @@ -40,8 +40,8 @@ public interface ExternalNetworkDeviceManager extends Manager { public static final NetworkDevice F5BigIpLoadBalancer = new NetworkDevice("F5BigIpLoadBalancer", Network.Provider.F5BigIp.getName()); public static final NetworkDevice JuniperSRXFirewall = new NetworkDevice("JuniperSRXFirewall", Network.Provider.JuniperSRX.getName()); public static final NetworkDevice NiciraNvp = new NetworkDevice("NiciraNvp", Network.Provider.NiciraNvp.getName()); - - + public static final NetworkDevice MidokuraMidonet = new NetworkDevice("MidokuraMidonet", Network.Provider.MidokuraMidonet.getName()); + public NetworkDevice(String deviceName, String ntwkServiceprovider) { _name = deviceName; _provider = ntwkServiceprovider;