cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [3/5] CLOUDSTACK-6162: add UI for OVS plugin
Date Sat, 01 Mar 2014 09:32:17 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
index 6ebc070..2641d54 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java
@@ -16,124 +16,635 @@
 // under the License.
 package com.cloud.network.element;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
+import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.StartupOvsCommand;
+import com.cloud.agent.api.to.LoadBalancerTO;
 import com.cloud.deploy.DeployDestination;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
 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.NetworkModel;
 import com.cloud.network.Networks;
+import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PublicIpAddress;
+import com.cloud.network.dao.NetworkServiceMapDao;
+import com.cloud.network.lb.LoadBalancingRule;
+import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
 import com.cloud.network.ovs.OvsTunnelManager;
+import com.cloud.network.router.VirtualRouter.Role;
+import com.cloud.network.router.VpcVirtualNetworkApplianceManager;
+import com.cloud.network.rules.LbStickinessMethod;
+import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
+import com.cloud.network.rules.LoadBalancerContainer;
+import com.cloud.network.rules.PortForwardingRule;
+import com.cloud.network.rules.StaticNat;
 import com.cloud.offering.NetworkOffering;
+import com.cloud.resource.ResourceManager;
+import com.cloud.resource.ResourceStateAdapter;
+import com.cloud.resource.ServerResource;
+import com.cloud.resource.UnableDeleteHostException;
+import com.cloud.utils.Pair;
 import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.dao.DomainRouterDao;
+import com.google.gson.Gson;
 
-@Local(value = {NetworkElement.class})
-public class OvsElement extends AdapterBase implements NetworkElement {
-    @Inject
-    OvsTunnelManager _ovsTunnelMgr;
+@Local(value = { NetworkElement.class, ConnectivityProvider.class,
+		SourceNatServiceProvider.class, StaticNatServiceProvider.class,
+		PortForwardingServiceProvider.class, IpDeployer.class })
+public class OvsElement extends AdapterBase implements NetworkElement,
+		OvsElementService, ConnectivityProvider, ResourceStateAdapter,
+		PortForwardingServiceProvider, LoadBalancingServiceProvider,
+		StaticNatServiceProvider, IpDeployer {
+	@Inject
+	OvsTunnelManager _ovsTunnelMgr;
+	@Inject
+	NetworkModel _networkModel;
+	@Inject
+	NetworkServiceMapDao _ntwkSrvcDao;
+	@Inject
+	ResourceManager _resourceMgr;
+	@Inject
+	DomainRouterDao _routerDao;
+	@Inject
+	VpcVirtualNetworkApplianceManager _routerMgr;
 
-    @Override
-    public boolean destroy(Network network, ReservationContext context)
-            throws ConcurrentOperationException, ResourceUnavailableException {
-        return true;
-    }
+	private static final Logger s_logger = Logger.getLogger(OvsElement.class);
+	private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
 
-    @Override
-    public Map<Service, Map<Capability, String>> getCapabilities() {
-        Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
-        capabilities.put(Service.Connectivity, null);
-        return capabilities;
-    }
+	@Override
+	public Map<Service, Map<Capability, String>> getCapabilities() {
+		return capabilities;
+	}
 
-    @Override
-    public Provider getProvider() {
-        return Network.Provider.Ovs;
-    }
+	@Override
+	public Provider getProvider() {
+		return Provider.Ovs;
+	}
 
-    @Override
-    public boolean implement(Network network, NetworkOffering offering,
-            DeployDestination dest, ReservationContext context)
-            throws ConcurrentOperationException, ResourceUnavailableException,
-            InsufficientCapacityException {
-        //Consider actually implementing the network here
-    	return true;
-    }
+	protected boolean canHandle(Network network, Service service) {
+		s_logger.debug("Checking if OvsElement can handle service "
+				+ service.getName() + " on network " + network.getDisplayText());
+		if (network.getBroadcastDomainType() != BroadcastDomainType.Vswitch) {
+			return false;
+		}
 
-    @Override
-    public boolean prepare(Network network, NicProfile nic,
-            VirtualMachineProfile vm,
-            DeployDestination dest, ReservationContext context)
-            throws ConcurrentOperationException, ResourceUnavailableException,
-            InsufficientCapacityException {
-        if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
-            return true;
-        }
+		if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
+			s_logger.debug("OvsElement is not a provider for network "
+					+ network.getDisplayText());
+			return false;
+		}
 
-        if (nic.getTrafficType() != Networks.TrafficType.Guest) {
-            return true;
-        }
+		if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(),
+				service, Network.Provider.Ovs)) {
+			s_logger.debug("OvsElement can't provide the " + service.getName()
+					+ " service on network " + network.getDisplayText());
+			return false;
+		}
 
-        _ovsTunnelMgr.VmCheckAndCreateTunnel(vm, network, dest);
-        //_ovsTunnelMgr.applyDefaultFlow(vm.getVirtualMachine(), dest);
+		return true;
+	}
 
-        return true;
-    }
+	@Override
+	public boolean configure(String name, Map<String, Object> params)
+			throws ConfigurationException {
+		super.configure(name, params);
+		_resourceMgr.registerResourceStateAdapter(name, this);
+		return true;
+	}
 
-    @Override
-    public boolean release(Network network, NicProfile nic,
-            VirtualMachineProfile vm,
-            ReservationContext context) throws ConcurrentOperationException,
-            ResourceUnavailableException {
-        if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
-            return true;
-        }
-
-        if (nic.getTrafficType() != Networks.TrafficType.Guest) {
-            return true;
-        }
-
-        _ovsTunnelMgr.CheckAndDestroyTunnel(vm.getVirtualMachine(), network);
-        return true;
-    }
+	@Override
+	public boolean implement(Network network, NetworkOffering offering,
+			DeployDestination dest, ReservationContext context)
+			throws ConcurrentOperationException, ResourceUnavailableException,
+			InsufficientCapacityException {
+		s_logger.debug("entering OvsElement implement function for network "
+				+ network.getDisplayText() + " (state " + network.getState()
+				+ ")");
 
-    @Override
-    public boolean shutdown(Network network, ReservationContext context, boolean cleanup)
-            throws ConcurrentOperationException, ResourceUnavailableException {
-        return true;
-    }
+		if (!canHandle(network, Service.Connectivity)) {
+			return false;
+		}
+		return true;
+	}
 
-    @Override
-    public boolean isReady(PhysicalNetworkServiceProvider provider) {
-    	return true;
-    }
+	@Override
+	public boolean prepare(Network network, NicProfile nic,
+			VirtualMachineProfile vm,
+			DeployDestination dest, ReservationContext context)
+			throws ConcurrentOperationException, ResourceUnavailableException,
+			InsufficientCapacityException {
+		if (!canHandle(network, Service.Connectivity)) {
+			return false;
+		}
 
-    @Override
-    public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context)
-            throws ConcurrentOperationException, ResourceUnavailableException {
-        return true;
-    }
+		if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
+			return false;
+		}
 
-    @Override
-    public boolean canEnableIndividualServices() {
-        return false;
-    }
+		if (nic.getTrafficType() != Networks.TrafficType.Guest) {
+			return false;
+		}
+
+		_ovsTunnelMgr.VmCheckAndCreateTunnel(vm, network, dest);
+
+		return true;
+	}
+
+	@Override
+	public boolean release(Network network, NicProfile nic,
+			VirtualMachineProfile vm,
+			ReservationContext context) throws ConcurrentOperationException,
+			ResourceUnavailableException {
+		if (!canHandle(network, Service.Connectivity)) {
+			return false;
+		}
+		if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
+			return false;
+		}
+
+		if (nic.getTrafficType() != Networks.TrafficType.Guest) {
+			return false;
+		}
+
+		_ovsTunnelMgr.CheckAndDestroyTunnel(vm.getVirtualMachine(), network);
+		return true;
+	}
+
+	@Override
+	public boolean shutdown(Network network, ReservationContext context,
+			boolean cleanup) throws ConcurrentOperationException,
+			ResourceUnavailableException {
+		if (!canHandle(network, Service.Connectivity)) {
+			return false;
+		}
+		return true;
+	}
+
+	@Override
+	public boolean destroy(Network network, ReservationContext context)
+			throws ConcurrentOperationException, ResourceUnavailableException {
+		if (!canHandle(network, Service.Connectivity)) {
+			return false;
+		}
+		return true;
+	}
+
+	@Override
+	public boolean isReady(PhysicalNetworkServiceProvider provider) {
+		return true;
+	}
+
+	@Override
+	public boolean shutdownProviderInstances(
+			PhysicalNetworkServiceProvider provider, ReservationContext context)
+			throws ConcurrentOperationException, ResourceUnavailableException {
+		return true;
+	}
+
+	@Override
+	public boolean canEnableIndividualServices() {
+		return true;
+	}
+
+	@Override
+	public boolean verifyServicesCombination(Set<Service> services) {
+		if (!services.contains(Service.Connectivity)) {
+			s_logger.warn("Unable to provide services without Connectivity service enabled for this element");
+			return false;
+		}
+
+		return true;
+	}
+
+	private static Map<Service, Map<Capability, String>> setCapabilities() {
+		Map<Service, Map<Capability, String>> capabilities = new HashMap<Service, Map<Capability, String>>();
+
+		// L2 Support : SDN provisioning
+		capabilities.put(Service.Connectivity, null);
+
+		// L3 Support : Port Forwarding
+		 capabilities.put(Service.PortForwarding, null);
+
+		// L3 support : StaticNat
+		capabilities.put(Service.StaticNat, null);
+
+		// L3 support : Load Balancer
+        // Set capabilities for LB service
+        Map<Capability, String> lbCapabilities = new HashMap<Capability, String>();
+        lbCapabilities.put(Capability.SupportedLBAlgorithms, "roundrobin,leastconn,source");
+        lbCapabilities.put(Capability.SupportedLBIsolation, "dedicated");
+        lbCapabilities.put(Capability.SupportedProtocols, "tcp, udp");
+        lbCapabilities.put(Capability.SupportedStickinessMethods, getHAProxyStickinessCapability());
+        lbCapabilities.put(Capability.LbSchemes, LoadBalancerContainer.Scheme.Public.toString());
+
+        capabilities.put(Service.Lb, lbCapabilities);
+
+		return capabilities;
+	}
+	
+    public static String getHAProxyStickinessCapability() {
+        LbStickinessMethod method;
+        List<LbStickinessMethod> methodList = new ArrayList<LbStickinessMethod>(1);
 
-    @Override
-    public boolean verifyServicesCombination(Set<Service> services) {
-        return true;
+        method = new LbStickinessMethod(StickinessMethodType.LBCookieBased, "This is loadbalancer cookie based stickiness method.");
+        method.addParam("cookie-name", false, "Cookie name passed in http header by the LB to the client.", false);
+        method.addParam("mode", false,
+                "Valid values: insert, rewrite, prefix. Default value: insert.  In the insert mode cookie will be created" +
+                " by the LB. In other modes, cookie will be created by the server and LB modifies it.", false);
+        method.addParam(
+                "nocache",
+                false,
+                "This option is recommended in conjunction with the insert mode when there is a cache between the client" +
+                " and HAProxy, as it ensures that a cacheable response will be tagged non-cacheable if  a cookie needs " +
+                "to be inserted. This is important because if all persistence cookies are added on a cacheable home page" +
+                " for instance, then all customers will then fetch the page from an outer cache and will all share the " +
+                "same persistence cookie, leading to one server receiving much more traffic than others. See also the " +
+                "insert and postonly options. ",
+                true);
+        method.addParam(
+                "indirect",
+                false,
+                "When this option is specified in insert mode, cookies will only be added when the server was not reached" +
+                " after a direct access, which means that only when a server is elected after applying a load-balancing algorithm," +
+                " or after a redispatch, then the cookie  will be inserted. If the client has all the required information" +
+                " to connect to the same server next time, no further cookie will be inserted. In all cases, when the " +
+                "indirect option is used in insert mode, the cookie is always removed from the requests transmitted to " +
+                "the server. The persistence mechanism then becomes totally transparent from the application point of view.",
+                true);
+        method.addParam(
+                "postonly",
+                false,
+                "This option ensures that cookie insertion will only be performed on responses to POST requests. It is an" +
+                " alternative to the nocache option, because POST responses are not cacheable, so this ensures that the " +
+                "persistence cookie will never get cached.Since most sites do not need any sort of persistence before the" +
+                " first POST which generally is a login request, this is a very efficient method to optimize caching " +
+                "without risking to find a persistence cookie in the cache. See also the insert and nocache options.",
+                true);
+        method.addParam(
+                "domain",
+                false,
+                "This option allows to specify the domain at which a cookie is inserted. It requires exactly one parameter:" +
+                " a valid domain name. If the domain begins with a dot, the browser is allowed to use it for any host " +
+                "ending with that name. It is also possible to specify several domain names by invoking this option multiple" +
+                " times. Some browsers might have small limits on the number of domains, so be careful when doing that. " +
+                "For the record, sending 10 domains to MSIE 6 or Firefox 2 works as expected.",
+                false);
+        methodList.add(method);
+
+        method = new LbStickinessMethod(StickinessMethodType.AppCookieBased,
+                "This is App session based sticky method. Define session stickiness on an existing application cookie. " +
+                "It can be used only for a specific http traffic");
+        method.addParam("cookie-name", false, "This is the name of the cookie used by the application and which LB will " +
+        		"have to learn for each new session. Default value: Auto geneared based on ip", false);
+        method.addParam("length", false, "This is the max number of characters that will be memorized and checked in " +
+        		"each cookie value. Default value:52", false);
+        method.addParam(
+                "holdtime",
+                false,
+                "This is the time after which the cookie will be removed from memory if unused. The value should be in " +
+                "the format Example : 20s or 30m  or 4h or 5d . only seconds(s), minutes(m) hours(h) and days(d) are valid," +
+                " cannot use th combinations like 20h30m. Default value:3h ",
+                false);
+        method.addParam(
+                "request-learn",
+                false,
+                "If this option is specified, then haproxy will be able to learn the cookie found in the request in case the server does not specify any in response. This is typically what happens with PHPSESSID cookies, or when haproxy's session expires before the application's session and the correct server is selected. It is recommended to specify this option to improve reliability",
+                true);
+        method.addParam(
+                "prefix",
+                false,
+                "When this option is specified, haproxy will match on the cookie prefix (or URL parameter prefix). " +
+                "The appsession value is the data following this prefix. Example : appsession ASPSESSIONID len 64 timeout 3h prefix  This will match the cookie ASPSESSIONIDXXXX=XXXXX, the appsession value will be XXXX=XXXXX.",
+                true);
+        method.addParam(
+                "mode",
+                false,
+                "This option allows to change the URL parser mode. 2 modes are currently supported : - path-parameters " +
+                ": The parser looks for the appsession in the path parameters part (each parameter is separated by a semi-colon), " +
+                "which is convenient for JSESSIONID for example.This is the default mode if the option is not set. - query-string :" +
+                " In this mode, the parser will look for the appsession in the query string.",
+                false);
+        methodList.add(method);
+
+        method = new LbStickinessMethod(StickinessMethodType.SourceBased, "This is source based Stickiness method, " +
+        		"it can be used for any type of protocol.");
+        method.addParam("tablesize", false, "Size of table to store source ip addresses. example: tablesize=200k or 300m" +
+        		" or 400g. Default value:200k", false);
+        method.addParam("expire", false, "Entry in source ip table will expire after expire duration. units can be s,m,h,d ." +
+        		" example: expire=30m 20s 50h 4d. Default value:3h", false);
+        methodList.add(method);
+
+        Gson gson = new Gson();
+        String capability = gson.toJson(methodList);
+        return capability;
     }
+
+	@Override
+	public List<Class<?>> getCommands() {
+		List<Class<?>> cmdList = new ArrayList<Class<?>>();
+		return cmdList;
+	}
+
+	@Override
+	public HostVO createHostVOForConnectedAgent(HostVO host,
+			StartupCommand[] cmd) {
+		return null;
+	}
+
+	@Override
+	public HostVO createHostVOForDirectConnectAgent(HostVO host,
+			StartupCommand[] startup, ServerResource resource,
+			Map<String, String> details, List<String> hostTags) {
+		if (!(startup[0] instanceof StartupOvsCommand)) {
+			return null;
+		}
+		host.setType(Host.Type.L2Networking);
+		return host;
+	}
+
+	@Override
+	public DeleteHostAnswer deleteHost(HostVO host, boolean isForced,
+			boolean isForceDeleteStorage) throws UnableDeleteHostException {
+		if (!(host.getType() == Host.Type.L2Networking)) {
+			return null;
+		}
+		return new DeleteHostAnswer(true);
+	}
+
+	@Override
+	public IpDeployer getIpDeployer(Network network) {
+		return this;
+	}
+
+	@Override
+	public boolean applyIps(Network network,
+			List<? extends PublicIpAddress> ipAddress, Set<Service> services)
+			throws ResourceUnavailableException {
+		boolean canHandle = true;
+		for (Service service : services) {
+			// check if Ovs can handle services except SourceNat & Firewall
+			if (!canHandle(network, service) && service != Service.SourceNat && service != Service.Firewall) {
+				canHandle = false;
+				break;
+			}
+		}
+		if (canHandle) {
+			List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
+					network.getId(), Role.VIRTUAL_ROUTER);
+			if (routers == null || routers.isEmpty()) {
+				s_logger.debug("Virtual router element doesn't need to associate ip addresses on the backend; virtual "
+						+ "router doesn't exist in the network "
+						+ network.getId());
+				return true;
+			}
+
+			return _routerMgr.associatePublicIP(network, ipAddress, routers);
+		} else {
+			return false;
+		}
+	}
+
+	@Override
+	public boolean applyStaticNats(Network network, List<? extends StaticNat> rules)
+			throws ResourceUnavailableException {
+		if (!canHandle(network, Service.StaticNat)) {
+			return false;
+		}
+		List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
+				network.getId(), Role.VIRTUAL_ROUTER);
+		if (routers == null || routers.isEmpty()) {
+			s_logger.debug("Ovs element doesn't need to apply static nat on the backend; virtual "
+					+ "router doesn't exist in the network " + network.getId());
+			return true;
+		}
+
+		return _routerMgr.applyStaticNats(network, rules, routers);
+	}
+
+	@Override
+	public boolean applyPFRules(Network network, List<PortForwardingRule> rules)
+			throws ResourceUnavailableException {
+		if (!canHandle(network, Service.PortForwarding)) {
+			return false;
+		}
+		List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
+				network.getId(), Role.VIRTUAL_ROUTER);
+		if (routers == null || routers.isEmpty()) {
+			s_logger.debug("Ovs element doesn't need to apply firewall rules on the backend; virtual "
+					+ "router doesn't exist in the network " + network.getId());
+			return true;
+		}
+
+		return _routerMgr.applyFirewallRules(network, rules, routers);
+	}
+
+	@Override
+	public boolean applyLBRules(Network network, List<LoadBalancingRule> rules)
+			throws ResourceUnavailableException {
+		if (canHandle(network, Service.Lb)) {
+			if (!canHandleLbRules(rules)) {
+				return false;
+			}
+
+			List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
+					network.getId(), Role.VIRTUAL_ROUTER);
+			if (routers == null || routers.isEmpty()) {
+				s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual "
+						+ "router doesn't exist in the network "
+						+ network.getId());
+				return true;
+			}
+
+			if (!_routerMgr.applyLoadBalancingRules(network, rules, routers)) {
+				throw new CloudRuntimeException(
+						"Failed to apply load balancing rules in network "
+								+ network.getId());
+			} else {
+				return true;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	@Override
+	public boolean validateLBRule(Network network, LoadBalancingRule rule) {
+		List<LoadBalancingRule> rules = new ArrayList<LoadBalancingRule>();
+		rules.add(rule);
+		if (canHandle(network, Service.Lb) && canHandleLbRules(rules)) {
+			List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(
+					network.getId(), Role.VIRTUAL_ROUTER);
+			if (routers == null || routers.isEmpty()) {
+				return true;
+			}
+			return validateHAProxyLBRule(rule);
+		}
+		return true;
+	}
+
+	@Override
+	public List<LoadBalancerTO> updateHealthChecks(Network network,
+			List<LoadBalancingRule> lbrules) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	private boolean canHandleLbRules(List<LoadBalancingRule> rules) {
+		Map<Capability, String> lbCaps = this.getCapabilities().get(Service.Lb);
+		if (!lbCaps.isEmpty()) {
+			String schemeCaps = lbCaps.get(Capability.LbSchemes);
+			if (schemeCaps != null) {
+				for (LoadBalancingRule rule : rules) {
+					if (!schemeCaps.contains(rule.getScheme().toString())) {
+						s_logger.debug("Scheme " + rules.get(0).getScheme()
+								+ " is not supported by the provider "
+								+ this.getName());
+						return false;
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+	public static boolean validateHAProxyLBRule(LoadBalancingRule rule) {
+		String timeEndChar = "dhms";
+
+		for (LbStickinessPolicy stickinessPolicy : rule.getStickinessPolicies()) {
+			List<Pair<String, String>> paramsList = stickinessPolicy
+					.getParams();
+
+			if (StickinessMethodType.LBCookieBased.getName().equalsIgnoreCase(
+					stickinessPolicy.getMethodName())) {
+
+			} else if (StickinessMethodType.SourceBased.getName()
+					.equalsIgnoreCase(stickinessPolicy.getMethodName())) {
+				String tablesize = "200k"; // optional
+				String expire = "30m"; // optional
+
+				/* overwrite default values with the stick parameters */
+				for (Pair<String, String> paramKV : paramsList) {
+					String key = paramKV.first();
+					String value = paramKV.second();
+					if ("tablesize".equalsIgnoreCase(key))
+						tablesize = value;
+					if ("expire".equalsIgnoreCase(key))
+						expire = value;
+				}
+				if ((expire != null)
+						&& !containsOnlyNumbers(expire, timeEndChar)) {
+					throw new InvalidParameterValueException(
+							"Failed LB in validation rule id: " + rule.getId()
+									+ " Cause: expire is not in timeformat: "
+									+ expire);
+				}
+				if ((tablesize != null)
+						&& !containsOnlyNumbers(tablesize, "kmg")) {
+					throw new InvalidParameterValueException(
+							"Failed LB in validation rule id: "
+									+ rule.getId()
+									+ " Cause: tablesize is not in size format: "
+									+ tablesize);
+
+				}
+			} else if (StickinessMethodType.AppCookieBased.getName()
+					.equalsIgnoreCase(stickinessPolicy.getMethodName())) {
+				/*
+				 * FORMAT : appsession <cookie> len <length> timeout <holdtime>
+				 * [request-learn] [prefix] [mode
+				 * <path-parameters|query-string>]
+				 */
+				/* example: appsession JSESSIONID len 52 timeout 3h */
+				String cookieName = null; // optional
+				String length = null; // optional
+				String holdTime = null; // optional
+
+				for (Pair<String, String> paramKV : paramsList) {
+					String key = paramKV.first();
+					String value = paramKV.second();
+					if ("cookie-name".equalsIgnoreCase(key))
+						cookieName = value;
+					if ("length".equalsIgnoreCase(key))
+						length = value;
+					if ("holdtime".equalsIgnoreCase(key))
+						holdTime = value;
+				}
+
+				if ((length != null) && (!containsOnlyNumbers(length, null))) {
+					throw new InvalidParameterValueException(
+							"Failed LB in validation rule id: " + rule.getId()
+									+ " Cause: length is not a number: "
+									+ length);
+				}
+				if ((holdTime != null)
+						&& (!containsOnlyNumbers(holdTime, timeEndChar) && !containsOnlyNumbers(
+								holdTime, null))) {
+					throw new InvalidParameterValueException(
+							"Failed LB in validation rule id: " + rule.getId()
+									+ " Cause: holdtime is not in timeformat: "
+									+ holdTime);
+				}
+			}
+		}
+		return true;
+	}
+
+	/*
+	 * This function detects numbers like 12 ,32h ,42m .. etc,. 1) plain number
+	 * like 12 2) time or tablesize like 12h, 34m, 45k, 54m , here last
+	 * character is non-digit but from known characters .
+	 */
+	private static boolean containsOnlyNumbers(String str, String endChar) {
+		if (str == null)
+			return false;
+
+		String number = str;
+		if (endChar != null) {
+			boolean matchedEndChar = false;
+			if (str.length() < 2)
+				return false; // atleast one numeric and one char. example:
+								// 3h
+			char strEnd = str.toCharArray()[str.length() - 1];
+			for (char c : endChar.toCharArray()) {
+				if (strEnd == c) {
+					number = str.substring(0, str.length() - 1);
+					matchedEndChar = true;
+					break;
+				}
+			}
+			if (!matchedEndChar)
+				return false;
+		}
+		try {
+			int i = Integer.parseInt(number);
+		} catch (NumberFormatException e) {
+			return false;
+		}
+		return true;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElementService.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElementService.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElementService.java
new file mode 100644
index 0000000..7ed7702
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElementService.java
@@ -0,0 +1,23 @@
+// 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.utils.component.PluggableService;
+
+public interface OvsElementService extends PluggableService {
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
index e74a69f..363e8d2 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
@@ -30,88 +30,194 @@ import com.cloud.deploy.DeploymentPlan;
 import com.cloud.event.ActionEventUtils;
 import com.cloud.event.EventTypes;
 import com.cloud.event.EventVO;
+import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 import com.cloud.network.Network;
 import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.Service;
 import com.cloud.network.Network.State;
+import com.cloud.network.NetworkProfile;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.PhysicalNetwork;
 import com.cloud.network.PhysicalNetwork.IsolationMethod;
 import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.PhysicalNetworkVO;
 import com.cloud.network.ovs.OvsTunnelManager;
 import com.cloud.offering.NetworkOffering;
+import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.NicProfile;
 import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
 
-@Local(value=NetworkGuru.class)
+@Component
+@Local(value = NetworkGuru.class)
 public class OvsGuestNetworkGuru extends GuestNetworkGuru {
-    private static final Logger s_logger = Logger.getLogger(OvsGuestNetworkGuru.class);
-
-    @Inject OvsTunnelManager _ovsTunnelMgr;
-
-    OvsGuestNetworkGuru() {
-        super();
-        _isolationMethods = new IsolationMethod[] { IsolationMethod.GRE, IsolationMethod.L3, IsolationMethod.VLAN };
-    }
-
-    @Override
-    protected boolean canHandle(NetworkOffering offering,
-            final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
-        // This guru handles only Guest Isolated network that supports Source
-        // nat service
-        if (networkType == NetworkType.Advanced
-                && isMyTrafficType(offering.getTrafficType())
-                && offering.getGuestType() == Network.GuestType.Isolated
-                && isMyIsolationMethod(physicalNetwork)) {
-            return true;
-        } else {
-            s_logger.trace("We only take care of Guest networks of type   "
-                    + GuestType.Isolated + " in zone of type "
-                    + NetworkType.Advanced);
-            return false;
-        }
-    }
-
-    @Override
-    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
-
-        if (!_ovsTunnelMgr.isOvsTunnelEnabled()) {
-            return null;
-        }
-
-        NetworkVO config = (NetworkVO) super.design(offering, plan, userSpecified, owner);
-        if (config == null) {
-            return null;
-        }
-
-        config.setBroadcastDomainType(BroadcastDomainType.Vswitch);
-
-        return config;
-    }
-
-    @Override
-    protected void allocateVnet(Network network, NetworkVO implemented, long dcId,
-            long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException {
-        if (network.getBroadcastUri() == null) {
-            String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId, UseSystemGuestVlans.valueIn(network.getAccountId()));
-            if (vnet == null) {
-                throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a part of network " + network + " implement ", DataCenter.class, dcId);
-            }
-            implemented.setBroadcastUri(BroadcastDomainType.Vswitch.toUri(vnet));
-            ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), network.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone Vlan: " + vnet + " Network Id: " + network.getId(), 0);
-        } else {
-            implemented.setBroadcastUri(network.getBroadcastUri());
-        }
-    }
-
-    @Override
-    public Network implement(Network config, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException {
-        assert (config.getState() == State.Implementing) : "Why are we implementing " + config;
-        if (!_ovsTunnelMgr.isOvsTunnelEnabled()) {
-            return null;
-        }
-        NetworkVO implemented = (NetworkVO)super.implement(config, offering, dest, context);
-        return implemented;
-    }
-
+	private static final Logger s_logger = Logger
+			.getLogger(OvsGuestNetworkGuru.class);
+
+	@Inject
+	OvsTunnelManager _ovsTunnelMgr;
+	@Inject
+	NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
+
+	OvsGuestNetworkGuru() {
+		super();
+		_isolationMethods = new IsolationMethod[] { IsolationMethod.GRE,
+				IsolationMethod.L3, IsolationMethod.VLAN };
+	}
+
+	@Override
+	protected boolean canHandle(NetworkOffering offering,
+			final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
+		// This guru handles only Guest Isolated network that supports Source
+		// nat service
+		if (networkType == NetworkType.Advanced
+				&& isMyTrafficType(offering.getTrafficType())
+				&& offering.getGuestType() == Network.GuestType.Isolated
+				&& isMyIsolationMethod(physicalNetwork)
+				&& _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(
+						offering.getId(), Service.Connectivity)) {
+			return true;
+		} else {
+			s_logger.trace("We only take care of Guest networks of type   "
+					+ GuestType.Isolated + " in zone of type "
+					+ NetworkType.Advanced);
+			return false;
+		}
+	}
+
+	@Override
+	public Network design(NetworkOffering offering, DeploymentPlan plan,
+			Network userSpecified, Account owner) {
+
+		PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan
+				.getPhysicalNetworkId());
+		DataCenter dc = _dcDao.findById(plan.getDataCenterId());
+		if (!canHandle(offering, dc.getNetworkType(), physnet)) {
+			s_logger.debug("Refusing to design this network");
+			return null;
+		}
+		NetworkVO config = (NetworkVO) super.design(offering, plan,
+				userSpecified, owner);
+		if (config == null) {
+			return null;
+		}
+
+		config.setBroadcastDomainType(BroadcastDomainType.Vswitch);
+
+		return config;
+	}
+
+	@Override
+	public Network implement(Network network, NetworkOffering offering,
+			DeployDestination dest, ReservationContext context)
+			throws InsufficientVirtualNetworkCapcityException {
+		assert (network.getState() == State.Implementing) : "Why are we implementing "
+				+ network;
+
+		long dcId = dest.getDataCenter().getId();
+		NetworkType nwType = dest.getDataCenter().getNetworkType();
+		// get physical network id
+		Long physicalNetworkId = network.getPhysicalNetworkId();
+		// physical network id can be null in Guest Network in Basic zone, so
+		// locate the physical network
+		if (physicalNetworkId == null) {
+			physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId,
+					offering.getTags(), offering.getTrafficType());
+		}
+		PhysicalNetworkVO physnet = _physicalNetworkDao
+				.findById(physicalNetworkId);
+
+		if (!canHandle(offering, nwType, physnet)) {
+			s_logger.debug("Refusing to design this network");
+			return null;
+		}
+		NetworkVO implemented = (NetworkVO) super.implement(network, offering,
+				dest, context);
+
+		if (network.getGateway() != null) {
+			implemented.setGateway(network.getGateway());
+		}
+
+		if (network.getCidr() != null) {
+			implemented.setCidr(network.getCidr());
+		}
+		String name = network.getName();
+		if (name == null || name.isEmpty()) {
+			name = ((NetworkVO) network).getUuid();
+		}
+
+		// do we need to create switch right now?
+
+		implemented.setBroadcastDomainType(BroadcastDomainType.Vswitch);
+
+		return implemented;
+	}
+
+	@Override
+	public void reserve(NicProfile nic, Network network,
+			VirtualMachineProfile vm,
+			DeployDestination dest, ReservationContext context)
+			throws InsufficientVirtualNetworkCapcityException,
+			InsufficientAddressCapacityException {
+		// TODO Auto-generated method stub
+		super.reserve(nic, network, vm, dest, context);
+	}
+
+	@Override
+	public boolean release(NicProfile nic,
+			VirtualMachineProfile vm,
+			String reservationId) {
+		// TODO Auto-generated method stub
+		return super.release(nic, vm, reservationId);
+	}
+
+	@Override
+	public void shutdown(NetworkProfile profile, NetworkOffering offering) {
+		NetworkVO networkObject = _networkDao.findById(profile.getId());
+		if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Vswitch
+				|| networkObject.getBroadcastUri() == null) {
+			s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork "
+					+ networkObject.getDisplayText());
+			return;
+		}
+
+		super.shutdown(profile, offering);
+	}
+
+	@Override
+	public boolean trash(Network network, NetworkOffering offering, Account owner) {
+		return super.trash(network, offering, owner);
+	}
+
+	@Override
+	protected void allocateVnet(Network network, NetworkVO implemented,
+			long dcId, long physicalNetworkId, String reservationId)
+			throws InsufficientVirtualNetworkCapcityException {
+		if (network.getBroadcastUri() == null) {
+			String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId,
+					network.getAccountId(), reservationId,
+					canUseSystemGuestVlan(network.getAccountId()));
+			if (vnet == null) {
+				throw new InsufficientVirtualNetworkCapcityException(
+						"Unable to allocate vnet as a part of network "
+								+ network + " implement ", DataCenter.class,
+						dcId);
+			}
+			implemented
+					.setBroadcastUri(BroadcastDomainType.Vswitch.toUri(vnet));
+			ActionEventUtils.onCompletedActionEvent(
+					UserContext.current().getCallerUserId(),
+					network.getAccountId(),
+					EventVO.LEVEL_INFO,
+					EventTypes.EVENT_ZONE_VLAN_ASSIGN,
+					"Assigned Zone Vlan: " + vnet + " Network Id: "
+							+ network.getId(), 0);
+		} else {
+			implemented.setBroadcastUri(network.getBroadcastUri());
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/GreTunnelException.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/GreTunnelException.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/GreTunnelException.java
index c508747..61a5cf2 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/GreTunnelException.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/GreTunnelException.java
@@ -17,7 +17,7 @@
 package com.cloud.network.ovs;
 
 public class GreTunnelException extends Exception {
-	public GreTunnelException(String msg) {
-		super(msg);
-	}
+    public GreTunnelException(String msg) {
+        super(msg);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelAnswer.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelAnswer.java
deleted file mode 100644
index 5f0f8c1..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelAnswer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class OvsCreateGreTunnelAnswer extends Answer {
-    String hostIp;
-    String remoteIp;
-    String bridge;
-    String key;
-    long from;
-    long to;
-    int port;
-
-    public OvsCreateGreTunnelAnswer(Command cmd, boolean success, String details) {
-        super(cmd, success, details);
-    }
-
-    public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
-            String details, String hostIp, String bridge) {
-        super(cmd, success, details);
-        OvsCreateGreTunnelCommand c = (OvsCreateGreTunnelCommand) cmd;
-        this.hostIp = hostIp;
-        this.bridge = bridge;
-        this.remoteIp = c.getRemoteIp();
-        this.key = c.getKey();
-        this.port = -1;
-        this.from = c.getFrom();
-        this.to = c.getTo();
-    }
-
-    public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
-            String details, String hostIp, String bridge, int port) {
-        this(cmd, success, details, hostIp, bridge);
-        this.port = port;
-    }
-
-    public String getHostIp() {
-        return hostIp;
-    }
-
-    public String getRemoteIp() {
-        return remoteIp;
-    }
-
-    public String getBridge() {
-        return bridge;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public long getFrom() {
-        return from;
-    }
-
-    public long getTo() {
-        return to;
-    }
-
-    public int getPort() {
-        return port;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelCommand.java
deleted file mode 100644
index e2cd2d8..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateGreTunnelCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsCreateGreTunnelCommand extends Command {
-    String remoteIp;
-    String key;
-    long from;
-    long to;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public OvsCreateGreTunnelCommand(String remoteIp, String key, long from, long to) {
-        this.remoteIp = remoteIp;
-        this.key = key;
-        this.from = from;
-        this.to = to;
-    }
-
-    public String getRemoteIp() {
-        return remoteIp;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public long getFrom() {
-        return from;
-    }
-
-    public long getTo() {
-        return to;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelAnswer.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelAnswer.java
deleted file mode 100644
index fc2eb8a..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelAnswer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class OvsCreateTunnelAnswer extends Answer {
-    Long from;
-    Long to;
-    long networkId;
-    String inPortName;
-    
-    //for debug info
-    String fromIp;
-    String toIp;
-    int key;
-    String bridge;
-    
-    public OvsCreateTunnelAnswer(Command cmd, boolean success, String details, String bridge) {
-        super(cmd, success, details);
-        OvsCreateTunnelCommand c = (OvsCreateTunnelCommand)cmd;
-        from = c.getFrom();
-        to = c.getTo();
-        networkId = c.getNetworkId();
-        inPortName = "[]";
-        fromIp = c.getFromIp();
-        toIp = c.getRemoteIp();
-        key = c.getKey();
-        this.bridge = bridge;
-    }
-    
-    public OvsCreateTunnelAnswer(Command cmd, boolean success, String details, String inPortName, String bridge) {
-        this(cmd, success, details, bridge);
-        this.inPortName = inPortName;
-    }
-    
-    
-    public Long getFrom() {
-        return from;
-    }
-    
-    public Long getTo() {
-        return to;
-    }
-    
-    public long getNetworkId() {
-        return networkId;
-    }
-    
-    public String getInPortName() {
-        return inPortName;
-    }
-    
-    public String getFromIp() {
-        return fromIp;
-    }
-    
-    public String getToIp() {
-        return toIp;
-    }
-    
-    public int getKey() {
-        return key;
-    }
-    
-    public String getBridge() {
-        return bridge;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelCommand.java
deleted file mode 100644
index 1ececa0..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsCreateTunnelCommand.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsCreateTunnelCommand extends Command {
-    Integer key;
-    String remoteIp;
-    Long from;
-    Long to;
-    long networkId;
-
-    // for debug info
-    String fromIp;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public OvsCreateTunnelCommand(String remoteIp, Integer key, Long from, Long to, long networkId, String fromIp) {
-        this.remoteIp = remoteIp;
-        this.key = key;
-        this.from = from;
-        this.to = to;
-        this.networkId = networkId;
-        this.fromIp = fromIp;
-    }
-
-    public Integer getKey() {
-        return key;
-    }
-
-    public String getRemoteIp() {
-        return remoteIp;
-    }
-
-    public Long getFrom() {
-        return from;
-    }
-
-    public Long getTo() {
-        return to;
-    }
-
-    public long getNetworkId() {
-        return networkId;
-    }
-
-    public String getFromIp() {
-        return fromIp;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDeleteFlowCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDeleteFlowCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDeleteFlowCommand.java
deleted file mode 100644
index 2a6d5d7..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDeleteFlowCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsDeleteFlowCommand extends Command {
-    String vmName;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public OvsDeleteFlowCommand(String vmName) {
-        this.vmName = vmName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyBridgeCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyBridgeCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyBridgeCommand.java
deleted file mode 100644
index 8be5586..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyBridgeCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsDestroyBridgeCommand extends Command {
-
-    Long networkId;
-    Integer key;
-    
-    public OvsDestroyBridgeCommand(Long networkId, Integer key) {
-        this.networkId = networkId;
-        this.key = key;
-    }
-    
-    public Long getNetworkId() {
-        return networkId;
-    }
-    
-    public Integer getKey() {
-    	return key;
-    }
-    
-	@Override
-	public boolean executeInSequence() {
-		return true;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyTunnelCommand.java
deleted file mode 100644
index 4594d99..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsDestroyTunnelCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsDestroyTunnelCommand extends Command {
-    
-	Long networkId;
-	Integer key;
-    String inPortName;
-    
-    public OvsDestroyTunnelCommand(Long networkId, Integer key, String inPortName) {
-        this.networkId = networkId;
-        this.inPortName = inPortName;
-        this.key = key;
-    }
-    
-    public Long getNetworkId() {
-        return networkId;
-    }
-    
-    public String getInPortName() {
-        return inPortName;
-    }
-    
-    public Integer getKey() {
-    	return key;
-    }
-    
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceAnswer.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceAnswer.java
deleted file mode 100644
index 1ee6606..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceAnswer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class OvsFetchInterfaceAnswer extends Answer {
-	String ip;
-    String netmask;
-    String mac;
-    String label;
-
-    public OvsFetchInterfaceAnswer(Command cmd, boolean success, String details) {
-        super(cmd, success, details);
-        this.label = ((OvsFetchInterfaceCommand)cmd).getLabel();
-    }
-
-    public OvsFetchInterfaceAnswer(Command cmd, boolean success,
-            String details, String ip, String netmask, String mac) {
-        super(cmd, success, details);
-        this.ip = ip;
-        this.netmask = netmask;
-        this.mac = mac;
-        this.label = ((OvsFetchInterfaceCommand)cmd).getLabel();
-    }
-
-    public String getIp() {
-        return ip;
-    }
-
-    public String getNetmask() {
-        return netmask;
-    }
-
-    public String getMac() {
-        return mac;
-    }
-
-    public String getLabel() {
-    	return label;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceCommand.java
deleted file mode 100644
index c27daf0..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsFetchInterfaceCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsFetchInterfaceCommand extends Command {
-    String label;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public OvsFetchInterfaceCommand(String label) {
-        this.label = label;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowAnswer.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowAnswer.java
deleted file mode 100644
index ba16839..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowAnswer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class OvsSetTagAndFlowAnswer extends Answer {
-    Long vmId;
-    Long seqno;
-
-    public OvsSetTagAndFlowAnswer(Command cmd, boolean success, String details) {
-        super(cmd, success, details);
-        OvsSetTagAndFlowCommand c = (OvsSetTagAndFlowCommand) cmd;
-        this.vmId = c.getVmId();
-        this.seqno = Long.parseLong(c.getSeqNo());
-    }
-
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public Long getSeqNo() {
-        return seqno;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowCommand.java
deleted file mode 100644
index 17121a0..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetTagAndFlowCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsSetTagAndFlowCommand extends Command {
-    String vlans;
-    String vmName;
-    String seqno;
-    String tag;
-    Long vmId;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public String getSeqNo() {
-        return seqno;
-    }
-
-    public String getVlans() {
-        return vlans;
-    }
-
-    public String getVmName() {
-        return vmName;
-    }
-
-    public Long getVmId() {
-        return vmId;
-    }
-
-    public String getTag() {
-        return tag;
-    }
-
-    public OvsSetTagAndFlowCommand(String vmName, String tag, String vlans, String seqno, Long vmId) {
-        this.vmName = vmName;
-        this.tag = tag;
-        this.vlans = vlans;
-        this.seqno = seqno;
-        this.vmId = vmId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetupBridgeCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetupBridgeCommand.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetupBridgeCommand.java
deleted file mode 100644
index 29cce15..0000000
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsSetupBridgeCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.ovs;
-
-import com.cloud.agent.api.Command;
-
-public class OvsSetupBridgeCommand extends Command {
-    Integer key;
-    Long hostId;
-    Long networkId;
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-    public OvsSetupBridgeCommand(Integer key, Long hostId, Long networkId) {
-        this.key = key;
-        this.hostId = hostId;
-        this.networkId = networkId;
-    }
-
-    public Integer getKey() {
-        return key;
-    }
-
-    public Long getHostId() {
-        return hostId;
-    }
-
-    public Long getNetworkId() {
-    	return networkId;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
index 36fd25f..eaf2d66 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManager.java
@@ -23,12 +23,11 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 
 public interface OvsTunnelManager extends Manager {
-	
-	boolean isOvsTunnelEnabled();
 
-    public void VmCheckAndCreateTunnel(VirtualMachineProfile vm,
-    		Network nw, DeployDestination dest);
-    
+    boolean isOvsTunnelEnabled();
+
+    public void VmCheckAndCreateTunnel(VirtualMachineProfile vm, Network nw, DeployDestination dest);
+
     public void CheckAndDestroyTunnel(VirtualMachine vm, Network nw);
 
 }


Mime
View raw message