You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/10/10 04:38:28 UTC

[cloudstack] branch master updated: CLOUDSTACK-9859: Retirement of midonet plugin (final removal) (#2285)

This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new b044f1b  CLOUDSTACK-9859: Retirement of midonet plugin (final removal) (#2285)
b044f1b is described below

commit b044f1bc969955e5a9833922509ddf1823635eee
Author: Rafael Weingärtner <ra...@gmail.com>
AuthorDate: Tue Oct 10 01:38:23 2017 -0300

    CLOUDSTACK-9859: Retirement of midonet plugin (final removal) (#2285)
    
    Following the component retirement process defined in [1], a vote thread was started in [2]. The community decided to retire this Midonet plugin. This task represents the final step of the retirement, which is the removal of the plugin from CloudStacks code base.
    
    [1] https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68720798
    [2] http://markmail.org/message/qigrtfirwnmct4hr
---
 client/pom.xml                                     |   15 -
 .../core/spring-core-registry-core-context.xml     |    2 -
 plugins/network-elements/midonet/pom.xml           |   60 -
 .../META-INF/cloudstack/midonet/module.properties  |   18 -
 .../cloudstack/midonet/spring-midonet-context.xml  |   37 -
 .../com/cloud/network/element/MidoNetElement.java  | 1635 --------------------
 .../cloud/network/element/SimpleFirewallRule.java  |  219 ---
 .../network/guru/MidoNetGuestNetworkGuru.java      |  160 --
 .../network/guru/MidoNetPublicNetworkGuru.java     |  252 ---
 .../cloud/network/resource/MidoNetVifDriver.java   |  169 --
 .../cloud/network/element/MidoNetElementTest.java  |  199 ---
 plugins/pom.xml                                    |    6 -
 scripts/installer/windows/client.wxs               |    6 -
 server/src/com/cloud/configuration/Config.java     |   35 +-
 setup/db/db/schema-41000to41100.sql                |    3 +
 tools/eclipse/eclipse.epf                          |    2 +-
 ui/scripts/system.js                               |  130 --
 17 files changed, 13 insertions(+), 2935 deletions(-)

diff --git a/client/pom.xml b/client/pom.xml
index 90b9e97..3a0c5a5 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -1019,21 +1019,6 @@
       </dependencies>
     </profile>
     <profile>
-      <id>midonet</id>
-      <activation>
-        <property>
-          <name>midonet</name>
-        </property>
-      </activation>
-      <dependencies>
-        <dependency>
-          <groupId>org.apache.cloudstack</groupId>
-          <artifactId>cloud-plugin-network-midonet</artifactId>
-          <version>${project.version}</version>
-        </dependency>
-      </dependencies>
-    </profile>
-    <profile>
       <id>srx</id>
       <activation>
         <property>
diff --git a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
index 9020cae..feca134 100644
--- a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
+++ b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
@@ -134,7 +134,6 @@
     <bean id="ipDeployersRegistry"
         class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
         <property name="excludeKey" value="ip.deployers.exclude" />
-        <property name="excludeDefault" value="MidoNetElement" />
         <property name="preRegistered">
             <list>
                 <ref bean="VpcVirtualRouter" />
@@ -145,7 +144,6 @@
     <bean id="dhcpProvidersRegistry"
         class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
         <property name="excludeKey" value="dhcp.providers.exclude" />
-        <property name="excludeDefault" value="MidoNetElement" />
         <property name="preRegistered">
             <list>
                 <ref bean="VpcVirtualRouter" />
diff --git a/plugins/network-elements/midonet/pom.xml b/plugins/network-elements/midonet/pom.xml
deleted file mode 100644
index 63a0af5..0000000
--- a/plugins/network-elements/midonet/pom.xml
+++ /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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>cloud-plugin-network-midonet</artifactId>
-  <name>Apache CloudStack Plugin - Midokura Midonet</name>
-  <parent>
-    <groupId>org.apache.cloudstack</groupId>
-    <artifactId>cloudstack-plugins</artifactId>
-    <version>4.11.0.0-SNAPSHOT</version>
-    <relativePath>../../pom.xml</relativePath>
-  </parent>
-<repositories>
-    <repository>
-        <id>mido-maven-public-releases</id>
-        <name>mido-maven-public-releases</name>
-        <url>http://cs-maven.midokura.com/releases</url>
-    </repository>
-</repositories>
-  <dependencies>
-    <dependency>
-      <groupId>org.midonet</groupId>
-      <artifactId>midonet-client</artifactId>
-      <version>1.1.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-plugin-hypervisor-kvm</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-core-asl</artifactId>
-        <version>1.9.11</version>
-        <scope>runtime</scope>
-    </dependency>
-    <dependency>
-        <groupId>org.codehaus.jackson</groupId>
-        <artifactId>jackson-mapper-asl</artifactId>
-        <version>1.9.11</version>
-        <scope>runtime</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/module.properties b/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/module.properties
deleted file mode 100644
index 786ccc8..0000000
--- a/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/module.properties
+++ /dev/null
@@ -1,18 +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.
-name=midonet
-parent=network
\ No newline at end of file
diff --git a/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/spring-midonet-context.xml b/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/spring-midonet-context.xml
deleted file mode 100644
index 957f079..0000000
--- a/plugins/network-elements/midonet/resources/META-INF/cloudstack/midonet/spring-midonet-context.xml
+++ /dev/null
@@ -1,37 +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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-                      http://www.springframework.org/schema/beans/spring-beans.xsd
-                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
-                      http://www.springframework.org/schema/context
-                      http://www.springframework.org/schema/context/spring-context.xsd"
-                      >
-
-    <bean id="MidoNetGuestNetworkGuru" class="com.cloud.network.guru.MidoNetGuestNetworkGuru">
-        <property name="name" value="MidoNetGuestNetworkGuru" />
-    </bean>
-    <bean id="MidoNetElement" class="com.cloud.network.element.MidoNetElement">
-        <property name="name" value="MidoNetElement" />
-    </bean>
-    
-</beans>
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java b/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
deleted file mode 100644
index c85cb38..0000000
--- a/plugins/network-elements/midonet/src/com/cloud/network/element/MidoNetElement.java
+++ /dev/null
@@ -1,1635 +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.element;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import javax.ws.rs.core.MultivaluedMap;
-
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.log4j.Logger;
-import org.midonet.client.MidonetApi;
-import org.midonet.client.dto.DtoRule;
-import org.midonet.client.dto.DtoRule.DtoRange;
-import org.midonet.client.exception.HttpInternalServerError;
-import org.midonet.client.resource.Bridge;
-import org.midonet.client.resource.BridgePort;
-import org.midonet.client.resource.DhcpHost;
-import org.midonet.client.resource.DhcpSubnet;
-import org.midonet.client.resource.Port;
-import org.midonet.client.resource.ResourceCollection;
-import org.midonet.client.resource.Route;
-import org.midonet.client.resource.Router;
-import org.midonet.client.resource.RouterPort;
-import org.midonet.client.resource.Rule;
-import org.midonet.client.resource.RuleChain;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.to.FirewallRuleTO;
-import com.cloud.agent.api.to.PortForwardingRuleTO;
-import com.cloud.configuration.Config;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.IpAddress;
-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.PhysicalNetworkServiceProvider;
-import com.cloud.network.PublicIpAddress;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.PortForwardingRule;
-import com.cloud.network.rules.StaticNat;
-import com.cloud.network.vpc.VpcManager;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.utils.Pair;
-import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.component.PluggableService;
-import com.cloud.utils.net.NetUtils;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.dao.NicDao;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-
-@Component
-public class MidoNetElement extends AdapterBase implements ConnectivityProvider, DhcpServiceProvider, SourceNatServiceProvider, StaticNatServiceProvider, IpDeployer,
-        PortForwardingServiceProvider, FirewallServiceProvider, PluggableService {
-
-    private static final Logger s_logger = Logger.getLogger(MidoNetElement.class);
-
-    private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
-
-    protected UUID _providerRouterId = null;
-
-    protected MidonetApi api;
-
-    private static final Provider MidoNet = new Provider("MidoNet", false);
-
-    public enum RuleChainCode {
-        TR_PRE, TR_PRENAT, TR_PREFILTER, TR_POST, ACL_INGRESS, ACL_EGRESS
-    }
-
-    @Inject
-    ConfigurationDao _configDao;
-    @Inject
-    protected NicDao _nicDao;
-    @Inject
-    NetworkModel _networkModel;
-    @Inject
-    VpcManager _vpcMgr;
-    @Inject
-    AccountManager _accountMgr;
-    @Inject
-    AccountDao _accountDao;
-
-    public void setMidonetApi(MidonetApi api) {
-        this.api = api;
-    }
-
-    public void setAccountDao(AccountDao aDao) {
-        this._accountDao = aDao;
-    }
-
-    @Override
-    public Map<Service, Map<Capability, String>> getCapabilities() {
-        return capabilities;
-    }
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        super.configure(name, params);
-
-        String routerIdValue = _configDao.getValue(Config.MidoNetProviderRouterId.key());
-        if (routerIdValue != null)
-            _providerRouterId = UUID.fromString(routerIdValue);
-
-        String value = _configDao.getValue(Config.MidoNetAPIServerAddress.key());
-
-        if (value == null) {
-            throw new ConfigurationException("Could not find midonet API location in config");
-        }
-
-        if (this.api == null) {
-            s_logger.info("midonet API server address is  " + value);
-            setMidonetApi(new MidonetApi(value));
-            this.api.enableLogging();
-        }
-
-        return true;
-    }
-
-    public boolean midoInNetwork(Network network) {
-        if ((network.getTrafficType() == Networks.TrafficType.Public) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
-            return true;
-        }
-        if ((network.getTrafficType() == Networks.TrafficType.Guest) && (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Mido)) {
-            return true;
-        }
-        return false;
-    }
-
-    protected boolean canHandle(Network network, Service service) {
-        Long physicalNetworkId = _networkModel.getPhysicalNetworkId(network);
-        if (physicalNetworkId == null) {
-            return false;
-        }
-
-        if (!_networkModel.isProviderEnabledInPhysicalNetwork(physicalNetworkId, getProvider().getName())) {
-            return false;
-        }
-
-        if (service == null) {
-            if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
-                s_logger.trace("Element " + getProvider().getName() + " is not a provider for the network " + network);
-                return false;
-            }
-        } else {
-            if (!_networkModel.isProviderSupportServiceInNetwork(network.getId(), service, getProvider())) {
-                s_logger.trace("Element " + getProvider().getName() + " doesn't support service " + service.getName() + " in the network " + network);
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    public void applySourceNat(Router tenantRouter, Router providerRouter, RouterPort tenantUplink, RouterPort providerDownlink, RuleChain pre, RuleChain post,
-        PublicIpAddress addr) {
-
-        boolean needAdd = true;
-        String SNtag = "/SourceNat";
-        String SNkey = "CS_nat";
-
-        String snatIp = addr.getAddress().addr();
-
-        String CsDesc = snatIp + SNtag;
-
-        //determine, by use of the properties, if we already
-        //added this rule. If we did, then we can skip it
-        //by setting needAdd = false
-        for (Rule rule : pre.getRules()) {
-            Map<String, String> props = rule.getProperties();
-            if (props == null) {
-                continue;
-            }
-            String snatTag = props.get(SNkey);
-            if (snatTag == null) {
-                continue;
-            }
-
-            if (!snatTag.equals(CsDesc)) {
-                continue;
-            } else {
-                needAdd = false;
-                break;
-            }
-        }
-
-        if (needAdd == false) {
-            //we found that this rule exists already,
-            // so lets skip adding it
-            return;
-        }
-
-        Map<String, String> ruleProps = new HashMap<String, String>();
-        ruleProps.put(SNkey, CsDesc);
-
-        DtoRule.DtoNatTarget[] targets = new DtoRule.DtoNatTarget[] {new DtoRule.DtoNatTarget(snatIp, snatIp, 1, 65535)};
-
-        // Set inbound (reverse SNAT) rule
-        pre.addRule()
-            .type(DtoRule.RevSNAT)
-            .flowAction(DtoRule.Accept)
-            .nwDstAddress(snatIp)
-            .nwDstLength(32)
-            .inPorts(new UUID[] {tenantUplink.getId()})
-            .position(1)
-            .properties(ruleProps)
-            .create();
-
-        // Set outbound (SNAT) rule
-        post.addRule()
-            .type(DtoRule.SNAT)
-            .flowAction(DtoRule.Accept)
-            .outPorts(new UUID[] {tenantUplink.getId()})
-            .natTargets(targets)
-            .position(1)
-            .properties(ruleProps)
-            .create();
-
-        // Set up default route from tenant router to provider router
-        tenantRouter.addRoute()
-            .type("Normal")
-            .weight(100)
-            .srcNetworkAddr("0.0.0.0")
-            .srcNetworkLength(0)
-            .dstNetworkAddr("0.0.0.0")
-            .dstNetworkLength(0)
-            .nextHopPort(tenantUplink.getId())
-            .create();
-
-        // Set routes for traffic to the SNAT IP to come back from provider router
-        providerRouter.addRoute()
-            .type("Normal")
-            .weight(100)
-            .srcNetworkAddr("0.0.0.0")
-            .srcNetworkLength(0)
-            .dstNetworkAddr(snatIp)
-            .dstNetworkLength(32)
-            .nextHopPort(providerDownlink.getId())
-            .create();
-
-        // Default rule to accept traffic that has been DNATed
-        post.addRule().type(DtoRule.RevDNAT).flowAction(DtoRule.Accept).create();
-    }
-
-    public String getAccountUuid(Network network) {
-        AccountVO acc = _accountDao.findById(network.getAccountId());
-        return acc.getUuid();
-    }
-
-    public boolean associatePublicIP(Network network, final List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
-
-        s_logger.debug("associatePublicIP called with network: " + network.toString());
-        /*
-         * Get Mido Router for this network and set source rules
-         * These should only be allocated inside the for loop, because
-         * this function could be called as a part of network cleanup. In
-         * that case, we do not want to recreate the guest network or
-         * any ports.
-         */
-        boolean resources = false;
-        Router tenantRouter = null;
-        Router providerRouter = null;
-        RouterPort[] ports = null;
-
-        RouterPort tenantUplink = null;
-        RouterPort providerDownlink = null;
-
-        RuleChain preNat = null;
-        RuleChain post = null;
-        String accountIdStr = null;
-        String routerName = null;
-
-        // Set Source NAT rules on router
-        for (PublicIpAddress ip : ipAddress) {
-            // ip is the external one we sourcenat to
-            if (ip.isSourceNat()) {
-                if (resources == false) {
-                    tenantRouter = getOrCreateGuestNetworkRouter(network);
-                    providerRouter = api.getRouter(_providerRouterId);
-                    ports = getOrCreateProviderRouterPorts(tenantRouter, providerRouter);
-
-                    tenantUplink = ports[0];
-                    providerDownlink = ports[1];
-
-                    accountIdStr = getAccountUuid(network);
-                    boolean isVpc = getIsVpc(network);
-                    long id = getRouterId(network, isVpc);
-                    routerName = getRouterName(isVpc, id);
-
-                    preNat = getChain(accountIdStr, routerName, RuleChainCode.TR_PRENAT);
-                    post = api.getChain(tenantRouter.getOutboundFilterId());
-                    resources = true;
-                }
-
-                applySourceNat(tenantRouter, providerRouter,    // Routers
-                    tenantUplink, providerDownlink,  // Ports
-                    preNat, post,                       // Chains
-                    ip);                             // The IP
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * From interface IpDeployer
-     *
-     * @param network
-     * @param ipAddress
-     * @param services
-     * @return
-     * @throws ResourceUnavailableException
-     */
-    @Override
-    public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> services) throws ResourceUnavailableException {
-
-        s_logger.debug("applyIps called with network: " + network.toString());
-        if (!this.midoInNetwork(network)) {
-            return false;
-        }
-
-        boolean canHandle = true;
-        for (Service service : services) {
-            if (!canHandle(network, service)) {
-                canHandle = false;
-                break;
-            }
-        }
-        if (canHandle) {
-            return associatePublicIP(network, ipAddress);
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * From interface SourceNatServiceProvider
-     */
-    @Override
-    public IpDeployer getIpDeployer(Network network) {
-        s_logger.debug("getIpDeployer called with network " + network.toString());
-        return this;
-    }
-
-    /**
-     * From interface DHCPServiceProvider
-     */
-    @Override
-    public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
-
-        s_logger.debug("addDhcpEntry called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
-        if (!this.midoInNetwork(network)) {
-            return false;
-        }
-        if (vm.getType() != VirtualMachine.Type.User) {
-            return false;
-        }
-
-        // Get MidoNet bridge
-        Bridge netBridge = getOrCreateNetworkBridge(network);
-
-        // On bridge, get DHCP subnet (ensure it exists)
-        ResourceCollection res = netBridge.getDhcpSubnets();
-
-        DhcpSubnet sub = null;
-
-        if (!res.isEmpty()) {
-            sub = (DhcpSubnet)res.get(0);
-        } else {
-            Pair<String, Integer> cidrInfo = NetUtils.getCidr(network.getCidr());
-            sub = netBridge.addDhcpSubnet();
-
-            sub.subnetLength(cidrInfo.second());
-            sub.subnetPrefix(cidrInfo.first());
-            sub.defaultGateway(network.getGateway());
-            List<String> dcs = new ArrayList<String>();
-            dcs.add(dest.getDataCenter().getDns1());
-            sub.dnsServerAddrs(dcs);
-
-            sub.create();
-        }
-
-        // On DHCP subnet, add host using host details
-        if (sub == null) {
-            s_logger.error("Failed to create DHCP subnet on Midonet bridge");
-            return false;
-        } else {
-            // Check if the host already exists - we may just be restarting an existing VM
-            boolean isNewDhcpHost = true;
-
-            for (DhcpHost dhcpHost : sub.getDhcpHosts()) {
-                if (dhcpHost.getIpAddr().equals(nic.getIPv4Address())) {
-                    isNewDhcpHost = false;
-                    break;
-                }
-            }
-
-            if (isNewDhcpHost) {
-                DhcpHost host = sub.addDhcpHost();
-                host.ipAddr(nic.getIPv4Address());
-                host.macAddr(nic.getMacAddress());
-                // This only sets the cloudstack internal name
-                host.name(vm.getHostName());
-
-                host.create();
-            }
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public boolean removeDhcpSupportForSubnet(Network network) {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    private void removeMidonetStaticNAT(RuleChain preFilter, RuleChain preNat, RuleChain postNat, String floatingIp, String fixedIp, Router providerRouter) {
-
-        // Delete filter (firewall) rules for this IP
-        for (Rule rule : preFilter.getRules()) {
-            String destAddr = rule.getNwDstAddress();
-            if (destAddr != null && destAddr.equals(floatingIp)) {
-                rule.delete();
-            }
-        }
-
-        // Delete DNAT rules for this IP
-        for (Rule rule : preNat.getRules()) {
-            String destAddr = rule.getNwDstAddress();
-            if (destAddr != null && destAddr.equals(floatingIp)) {
-                rule.delete();
-            }
-        }
-        // Delete SNAT rules for this IP
-        for (Rule rule : postNat.getRules()) {
-            String srcAddr = rule.getNwSrcAddress();
-            if (srcAddr != null && srcAddr.equals(fixedIp)) {
-                rule.delete();
-            }
-        }
-
-        //we also created a route to go with this rule. That needs to be
-        //deleted as well.
-        for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
-            String routeDstAddr = route.getDstNetworkAddr();
-            if (routeDstAddr != null && routeDstAddr.equals(floatingIp)) {
-                route.delete();
-            }
-        }
-    }
-
-    private void addMidonetStaticNAT(RuleChain preFilter, RuleChain preNat, RuleChain postNat, String floatingIp, String fixedIp, RouterPort tenantUplink,
-        RouterPort providerDownlink, Router providerRouter, Network network) {
-
-        DtoRule.DtoNatTarget[] preTargets = new DtoRule.DtoNatTarget[] {new DtoRule.DtoNatTarget(fixedIp, fixedIp, 0, 0)};
-
-        // Set inbound filter rule (allow return traffic to this IP)
-        //     Implemented as "jump to NAT chain" instead of ACCEPT;
-        //     this is to enforce that filter / firewall rules are evaluated
-        //     before NAT rules.
-        preFilter.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).nwDstAddress(floatingIp).nwDstLength(32).matchReturnFlow(true).position(1).create();
-
-        // Allow ICMP replies (ICMP type 0, code 0 is ICMP reply)
-        preFilter.addRule()
-            .type(DtoRule.Jump)
-            .jumpChainId(preNat.getId())
-            .nwDstAddress(floatingIp)
-            .nwDstLength(32)
-            .nwProto(SimpleFirewallRule.stringToProtocolNumber("icmp"))
-            .tpSrc(new DtoRange<Integer>(0, 0))
-            .tpDst(new DtoRange<Integer>(0, 0))
-            .position(2)
-            .create();
-
-        // We only want to set the default DROP rule for static NAT if
-        // Firewall is handled by the Midonet plugin.
-        // Set inbound filter rule (drop all traffic to this IP)
-        if (canHandle(network, Service.Firewall)) {
-            preFilter.addRule().type(DtoRule.Drop).nwDstAddress(floatingIp).nwDstLength(32).position(3).create();
-        }
-
-        // Set inbound (DNAT) rule
-        preNat.addRule()
-            .type(DtoRule.DNAT)
-            .flowAction(DtoRule.Accept)
-            .nwDstAddress(floatingIp)
-            .nwDstLength(32)
-            .inPorts(new UUID[] {tenantUplink.getId()})
-            .natTargets(preTargets)
-            .position(1)
-            .create();
-
-        DtoRule.DtoNatTarget[] postTargets = new DtoRule.DtoNatTarget[] {new DtoRule.DtoNatTarget(floatingIp, floatingIp, 0, 0)};
-
-        // Set outbound (SNAT) rule
-        //    Match forward flow so that return traffic will be recognized
-        postNat.addRule()
-            .type(DtoRule.SNAT)
-            .flowAction(DtoRule.Accept)
-            .matchForwardFlow(true)
-            .nwSrcAddress(fixedIp)
-            .nwSrcLength(32)
-            .outPorts(new UUID[] {tenantUplink.getId()})
-            .natTargets(postTargets)
-            .position(1)
-            .create();
-
-        // Set outbound (SNAT) rule
-        //    Match return flow to also allow out traffic which was marked as forward flow on way in
-        postNat.addRule()
-            .type(DtoRule.SNAT)
-            .flowAction(DtoRule.Accept)
-            .matchReturnFlow(true)
-            .nwSrcAddress(fixedIp)
-            .nwSrcLength(32)
-            .outPorts(new UUID[] {tenantUplink.getId()})
-            .natTargets(postTargets)
-            .position(2)
-            .create();
-
-        // Set routes for traffic to the SNAT IP to come back from provider router
-        providerRouter.addRoute()
-            .type("Normal")
-            .weight(100)
-            .srcNetworkAddr("0.0.0.0")
-            .srcNetworkLength(0)
-            .dstNetworkAddr(floatingIp)
-            .dstNetworkLength(32)
-            .nextHopPort(providerDownlink.getId())
-            .create();
-    }
-
-    /**
-     * From interface StaticNatServiceProvider
-     */
-    @Override
-    public boolean applyStaticNats(Network network, List<? extends StaticNat> rules) throws ResourceUnavailableException {
-        s_logger.debug("applyStaticNats called with network: " + network.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-        if (!canHandle(network, Service.StaticNat)) {
-            return false;
-        }
-
-        boolean resources = false;
-        Router tenantRouter = null;
-        Router providerRouter = null;
-
-        RouterPort[] ports = null;
-
-        RouterPort tenantUplink = null;
-        RouterPort providerDownlink = null;
-
-        RuleChain preFilter = null;
-        RuleChain preNat = null;
-        RuleChain post = null;
-
-        String accountIdStr = getAccountUuid(network);
-        String networkUUIDStr = String.valueOf(network.getId());
-
-        for (StaticNat rule : rules) {
-            IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId());
-            String sourceIpAddr = sourceIp.getAddress().addr();
-
-            if (resources == false) {
-                tenantRouter = getOrCreateGuestNetworkRouter(network);
-                providerRouter = api.getRouter(_providerRouterId);
-
-                ports = getOrCreateProviderRouterPorts(tenantRouter, providerRouter);
-
-                tenantUplink = ports[0];
-                providerDownlink = ports[1];
-
-                boolean isVpc = getIsVpc(network);
-                long id = getRouterId(network, isVpc);
-                String routerName = getRouterName(isVpc, id);
-
-                preFilter = getChain(accountIdStr, routerName, RuleChainCode.TR_PREFILTER);
-                preNat = getChain(accountIdStr, routerName, RuleChainCode.TR_PRENAT);
-                post = api.getChain(tenantRouter.getOutboundFilterId());
-                resources = true;
-            }
-
-            if (rule.isForRevoke()) {
-                removeMidonetStaticNAT(preFilter, preNat, post, sourceIpAddr, rule.getDestIpAddress(), providerRouter);
-            } else {
-                addMidonetStaticNAT(preFilter, preNat, post, sourceIpAddr, rule.getDestIpAddress(), tenantUplink, providerDownlink, providerRouter, network);
-            }
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean applyFWRules(Network config, List<? extends FirewallRule> rulesToApply) throws ResourceUnavailableException {
-        if (!midoInNetwork(config)) {
-            return false;
-        }
-        if (canHandle(config, Service.Firewall)) {
-            String accountIdStr = getAccountUuid(config);
-            String networkUUIDStr = String.valueOf(config.getId());
-            RuleChain preFilter = getChain(accountIdStr, networkUUIDStr, RuleChainCode.TR_PREFILTER);
-            RuleChain preNat = getChain(accountIdStr, networkUUIDStr, RuleChainCode.TR_PRENAT);
-
-            // Create a map of Rule description -> Rule for quicker lookups
-            Map<String, Rule> existingRules = new HashMap<String, Rule>();
-
-            for (Rule existingRule : preFilter.getRules()) {
-                // The "whitelist" rules we're interested in are the Jump rules where src address is specified
-                if (existingRule.getType().equals(DtoRule.Jump) && existingRule.getNwSrcAddress() != null) {
-                    String ruleString = new SimpleFirewallRule(existingRule).toStringArray()[0];
-                    existingRules.put(ruleString, existingRule);
-                }
-            }
-
-            for (FirewallRule rule : rulesToApply) {
-                if (rule.getState() == FirewallRule.State.Revoke || rule.getState() == FirewallRule.State.Add) {
-                    IpAddress dstIp = _networkModel.getIp(rule.getSourceIpAddressId());
-                    FirewallRuleTO ruleTO = new FirewallRuleTO(rule, null, dstIp.getAddress().addr());
-
-                    // Convert to string representation
-                    SimpleFirewallRule fwRule = new SimpleFirewallRule(ruleTO);
-                    String[] ruleStrings = fwRule.toStringArray();
-
-                    if (rule.getState() == FirewallRule.State.Revoke) {
-                        // Lookup in existingRules, delete if present
-                        for (String revokeRuleString : ruleStrings) {
-                            Rule foundRule = existingRules.get(revokeRuleString);
-                            if (foundRule != null) {
-                                foundRule.delete();
-                            }
-                        }
-                    } else if (rule.getState() == FirewallRule.State.Add) {
-                        // Lookup in existingRules, add if not present
-                        for (int i = 0; i < ruleStrings.length; i++) {
-                            String ruleString = ruleStrings[i];
-                            Rule foundRule = existingRules.get(ruleString);
-                            if (foundRule == null) {
-                                // Get the cidr for the related entry in the Source Cidrs list
-                                String relatedCidr = fwRule.sourceCidrs.get(i);
-                                Pair<String, Integer> cidrParts = NetUtils.getCidr(relatedCidr);
-
-                                // Create rule with correct proto, cidr, ACCEPT, dst IP
-                                Rule toApply =
-                                    preFilter.addRule()
-                                        .type(DtoRule.Jump)
-                                        .jumpChainId(preNat.getId())
-                                        .position(1)
-                                        .nwSrcAddress(cidrParts.first())
-                                        .nwSrcLength(cidrParts.second())
-                                        .nwDstAddress(ruleTO.getSrcIp())
-                                        .nwDstLength(32)
-                                        .nwProto(SimpleFirewallRule.stringToProtocolNumber(rule.getProtocol()));
-
-                                if (rule.getProtocol().equals("icmp")) {
-                                    // ICMP rules - reuse port fields
-                                    // (-1, -1) means "allow all ICMP", so we don't set tpSrc / tpDst
-                                    if (fwRule.icmpType != -1 | fwRule.icmpCode != -1) {
-                                        toApply.tpSrc(new DtoRange(fwRule.icmpType, fwRule.icmpType)).tpDst(new DtoRange(fwRule.icmpCode, fwRule.icmpCode));
-                                    }
-                                } else {
-                                    toApply.tpDst(new DtoRange(fwRule.dstPortStart, fwRule.dstPortEnd));
-                                }
-
-                                toApply.create();
-                            }
-                        }
-                    }
-                }
-            }
-            return true;
-        } else {
-            return true;
-        }
-    }
-
-    @Override
-    public Provider getProvider() {
-        return MidoNet;
-    }
-
-    @Override
-    public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException, InsufficientCapacityException {
-        s_logger.debug("implement called with network: " + network.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-
-        if (network.getTrafficType() == Networks.TrafficType.Guest) {
-            // Create the Midonet bridge for this network
-            Bridge netBridge = getOrCreateNetworkBridge(network);
-            Router tenantRouter = getOrCreateGuestNetworkRouter(network);
-
-            // connect router and bridge
-            ensureBridgeConnectedToRouter(network, netBridge, tenantRouter);
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
-        s_logger.debug("prepare called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-
-        if (nic.getTrafficType() == Networks.TrafficType.Guest && !canHandle(network, Service.StaticNat)) {
-            return false;
-        }
-
-        if (nic.getTrafficType() == Networks.TrafficType.Guest || nic.getTrafficType() == Networks.TrafficType.Public &&
-            nic.getBroadcastType() == Networks.BroadcastDomainType.Mido) {
-            Bridge netBridge = getOrCreateNetworkBridge(network);
-            if (nic.getTrafficType() == Networks.TrafficType.Public && vm.getVirtualMachine().getType() != VirtualMachine.Type.DomainRouter) {
-                // Get provider router
-                Router providerRouter = api.getRouter(_providerRouterId);
-
-                Port[] ports = getOrCreatePublicBridgePorts(nic, netBridge, providerRouter);
-
-                RouterPort providerDownlink = (RouterPort)ports[1];
-
-                // Set route from router to bridge for this particular IP. Prepare
-                // is called in both starting a new VM and restarting a VM, so the
-                // NIC may
-                boolean routeExists = false;
-                for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
-                    String ip4 = route.getDstNetworkAddr();
-                    if (ip4 != null && ip4.equals(nic.getIPv4Address())) {
-                        routeExists = true;
-                        break;
-                    }
-                }
-
-                if (!routeExists) {
-                    providerRouter.addRoute()
-                        .type("Normal")
-                        .weight(100)
-                        .srcNetworkAddr("0.0.0.0")
-                        .srcNetworkLength(0)
-                        .dstNetworkAddr(nic.getIPv4Address())
-                        .dstNetworkLength(32)
-                        .nextHopPort(providerDownlink.getId())
-                        .nextHopGateway(null)
-                        .create();
-                }
-            }
-
-            // Add port on bridge
-            BridgePort newPort = netBridge.addExteriorPort().create(); // returns wrapper resource of port
-
-            // Set MidoNet port VIF ID to UUID of nic
-            UUID nicUUID = getNicUUID(nic);
-            newPort.vifId(nicUUID).update();
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException {
-        s_logger.debug("release called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-
-        UUID nicUUID = getNicUUID(nic);
-        if (nic.getTrafficType() == Networks.TrafficType.Guest ||
-            (nic.getTrafficType() == Networks.TrafficType.Public && nic.getBroadcastType() == Networks.BroadcastDomainType.Mido)) {
-            // Seems like a good place to remove the port in midonet
-            Bridge netBridge = getOrCreateNetworkBridge(network);
-
-            Router providerRouter = api.getRouter(_providerRouterId);
-
-            //remove the routes associated with this IP address
-            for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
-                String routeDstAddr = route.getDstNetworkAddr();
-                if (routeDstAddr != null && routeDstAddr.equals(nic.getIPv4Address())) {
-                    route.delete();
-                }
-            }
-
-            for (BridgePort p : netBridge.getPorts()) {
-                UUID vifID = p.getVifId();
-                if (vifID != null && vifID.equals(nicUUID)) {
-                    // This is the MidoNet port which corresponds to the NIC we are releasing
-
-                    // Set VIF ID to null
-                    p.vifId(null).update();
-
-                    // Delete port
-                    p.delete();
-                }
-            }
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
-        s_logger.debug("shutdown called with network: " + network.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-
-        // Find Mido API server, remove ports from this network's bridge, remove bridge itself
-        deleteNetworkBridges(network);
-        if (network.getVpcId() == null) {
-            deleteGuestNetworkRouters(network);
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
-        s_logger.debug("destroy called with network: " + network.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-
-        deleteNetworkBridges(network);
-        // if This is part of a VPC, then we do not want to delete the router.
-        // we only delete the router when the VPC is destroyed
-        if (network.getVpcId() == null) {
-            deleteGuestNetworkRouters(network);
-        }
-
-        return true;
-    }
-
-    @Override
-    public boolean isReady(PhysicalNetworkServiceProvider provider) {
-        // We are always ready.
-        return true;
-    }
-
-    @Override
-    public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException,
-        ResourceUnavailableException {
-        // Nothing to do here because the cleanup of the networks themselves clean up the resources.
-        return true;
-    }
-
-    @Override
-    public boolean canEnableIndividualServices() {
-        // We can enable individual services, though this is still subject to
-        // "VerifyServicesCombination
-        return true;
-    }
-
-    @Override
-    public boolean verifyServicesCombination(Set<Service> services) {
-        if (services.contains(Service.Vpn) || services.contains(Service.Dns) || services.contains(Service.Lb) || services.contains(Service.UserData) ||
-            services.contains(Service.SecurityGroup) || services.contains(Service.NetworkACL)) {
-            // We don't implement any of these services, and we don't
-            // want anyone else to do it for us. So if these services
-            // exist, we can't handle it.
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public boolean applyPFRules(Network network, List<PortForwardingRule> rules) throws ResourceUnavailableException {
-        s_logger.debug("applyPFRules called with network " + network.toString());
-        if (!midoInNetwork(network)) {
-            return false;
-        }
-        if (!canHandle(network, Service.PortForwarding)) {
-            return false;
-        }
-
-        String accountIdStr = getAccountUuid(network);
-        String networkUUIDStr = String.valueOf(network.getId());
-        RuleChain preNat = getChain(accountIdStr, networkUUIDStr, RuleChainCode.TR_PRENAT);
-        RuleChain postNat = getChain(accountIdStr, networkUUIDStr, RuleChainCode.TR_POST);
-        RuleChain preFilter = getChain(accountIdStr, networkUUIDStr, RuleChainCode.TR_PREFILTER);
-        Router providerRouter = api.getRouter(_providerRouterId);
-        Router tenantRouter = getOrCreateGuestNetworkRouter(network);
-        RouterPort[] ports = getOrCreateProviderRouterPorts(tenantRouter, providerRouter);
-        RouterPort providerDownlink = ports[1];
-
-        // Rules in the preNat table
-        Map<String, Rule> existingPreNatRules = new HashMap<String, Rule>();
-        for (Rule existingRule : preNat.getRules()) {
-            // The "port forwarding" rules we're interested in are dnat rules where src / dst ports are specified
-            if (existingRule.getType().equals(DtoRule.DNAT) && existingRule.getTpDst() != null) {
-                String ruleString = new SimpleFirewallRule(existingRule).toStringArray()[0];
-                existingPreNatRules.put(ruleString, existingRule);
-            }
-        }
-
-        /*
-         * Counts of rules associated with an IP address. Use this to check
-         * how many rules we have of a given IP address. When it reaches 0,
-         * we can delete the route associated with it.
-         */
-        Map<String, Integer> ipRuleCounts = new HashMap<String, Integer>();
-        for (Rule rule : preNat.getRules()) {
-            String ip = rule.getNwDstAddress();
-            if (ip != null && rule.getNwDstLength() == 32) {
-                if (ipRuleCounts.containsKey(ip)) {
-                    ipRuleCounts.put(ip, new Integer(ipRuleCounts.get(ip).intValue() + 1));
-                } else {
-                    ipRuleCounts.put(ip, new Integer(1));
-                }
-            }
-        }
-
-        /*
-         * Routes associated with IP. When we delete all the rules associated
-         * with a given IP, we can delete the route associated with it.
-         */
-        Map<String, Route> routes = new HashMap<String, Route>();
-        for (Route route : providerRouter.getRoutes(new MultivaluedMapImpl())) {
-            String ip = route.getDstNetworkAddr();
-            if (ip != null && route.getDstNetworkLength() == 32) {
-                routes.put(ip, route);
-            }
-        }
-
-        for (PortForwardingRule rule : rules) {
-            IpAddress dstIp = _networkModel.getIp(rule.getSourceIpAddressId());
-            PortForwardingRuleTO ruleTO = new PortForwardingRuleTO(rule, null, dstIp.getAddress().addr());
-            SimpleFirewallRule fwRule = new SimpleFirewallRule(ruleTO);
-            String[] ruleStrings = fwRule.toStringArray();
-
-            if (rule.getState() == FirewallRule.State.Revoke) {
-                /*
-                 * Lookup in existingRules, delete if present
-                 * We need to delete from both the preNat table and the
-                 * postNat table.
-                 */
-                for (String revokeRuleString : ruleStrings) {
-                    Rule foundPreNatRule = existingPreNatRules.get(revokeRuleString);
-                    if (foundPreNatRule != null) {
-                        String ip = foundPreNatRule.getNwDstAddress();
-                        // is this the last rule associated with this IP?
-                        Integer cnt = ipRuleCounts.get(ip);
-                        if (cnt != null) {
-                            if (cnt == 1) {
-                                ipRuleCounts.remove(ip);
-                                // no more rules for this IP. delete the route.
-                                Route route = routes.remove(ip);
-                                route.delete();
-                            } else {
-                                ipRuleCounts.put(ip, new Integer(ipRuleCounts.get(ip).intValue() - 1));
-                            }
-                        }
-                        foundPreNatRule.delete();
-                    }
-                }
-            } else if (rule.getState() == FirewallRule.State.Add) {
-                for (int i = 0; i < ruleStrings.length; i++) {
-                    String ruleString = ruleStrings[i];
-                    Rule foundRule = existingPreNatRules.get(ruleString);
-                    if (foundRule == null) {
-
-                        String vmIp = ruleTO.getDstIp();
-                        String publicIp = dstIp.getAddress().addr();
-                        int privPortStart = ruleTO.getDstPortRange()[0];
-                        int privPortEnd = ruleTO.getDstPortRange()[1];
-                        int pubPortStart = ruleTO.getSrcPortRange()[0];
-                        int pubPortEnd = ruleTO.getSrcPortRange()[1];
-
-                        DtoRule.DtoNatTarget[] preTargets = new DtoRule.DtoNatTarget[] {new DtoRule.DtoNatTarget(vmIp, vmIp, privPortStart, privPortEnd)};
-
-                        Rule preNatRule =
-                            preNat.addRule()
-                                .type(DtoRule.DNAT)
-                                .flowAction(DtoRule.Accept)
-                                .nwDstAddress(publicIp)
-                                .nwDstLength(32)
-                                .tpDst(new DtoRange(pubPortStart, pubPortEnd))
-                                .natTargets(preTargets)
-                                .nwProto(SimpleFirewallRule.stringToProtocolNumber(rule.getProtocol()))
-                                .position(1);
-
-                        Integer cnt = ipRuleCounts.get(publicIp);
-                        if (cnt != null) {
-                            ipRuleCounts.put(publicIp, new Integer(cnt.intValue() + 1));
-                        } else {
-                            ipRuleCounts.put(publicIp, new Integer(1));
-                        }
-                        String preNatRuleStr = new SimpleFirewallRule(preNatRule).toStringArray()[0];
-                        existingPreNatRules.put(preNatRuleStr, preNatRule);
-                        preNatRule.create();
-
-                        if (routes.get(publicIp) == null) {
-                            Route route =
-                                providerRouter.addRoute()
-                                    .type("Normal")
-                                    .weight(100)
-                                    .srcNetworkAddr("0.0.0.0")
-                                    .srcNetworkLength(0)
-                                    .dstNetworkAddr(publicIp)
-                                    .dstNetworkLength(32)
-                                    .nextHopPort(providerDownlink.getId());
-                            route.create();
-                            routes.put(publicIp, route);
-                        }
-
-                        // If Firewall is in our service offering, set up the
-                        // default firewall rule
-                        if (canHandle(network, Service.Firewall)) {
-                            boolean defaultBlock = false;
-                            for (Rule filterRule : preFilter.getRules()) {
-                                String pfDstIp = filterRule.getNwDstAddress();
-                                if (pfDstIp != null && filterRule.getNwDstAddress().equals(publicIp)) {
-                                    defaultBlock = true;
-                                    break;
-                                }
-                            }
-                            if (!defaultBlock) {
-                                preFilter.addRule().type(DtoRule.Drop).nwDstAddress(publicIp).nwDstLength(32).create();
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        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 : Generic?
-        capabilities.put(Service.Gateway, null);
-
-        // L3 Support : DHCP
-        Map<Capability, String> dhcpCapabilities = new HashMap<Capability, String>();
-        capabilities.put(Service.Dhcp, dhcpCapabilities);
-
-        // L3 Support : SourceNat
-        Map<Capability, String> sourceNatCapabilities = new HashMap<Capability, String>();
-        //sourceNatCapabilities.putAll(capabilities.get(Service.SourceNat));
-        sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, "peraccount");
-        //sourceNatCapabilities.putAll(capabilities.get(Service.SourceNat));
-        sourceNatCapabilities.put(Capability.RedundantRouter, "false");
-        capabilities.put(Service.SourceNat, sourceNatCapabilities);
-
-        // L3 Support : Port Forwarding
-        capabilities.put(Service.PortForwarding, null);
-
-        // L3 support : StaticNat
-        capabilities.put(Service.StaticNat, null);
-
-        // Set capabilities for Firewall service
-        Map<Capability, String> firewallCapabilities = new HashMap<Capability, String>();
-        firewallCapabilities.put(Capability.TrafficStatistics, "per public ip");
-        firewallCapabilities.put(Capability.SupportedProtocols, "tcp,udp,icmp");
-        firewallCapabilities.put(Capability.SupportedTrafficDirection, "ingress");
-        firewallCapabilities.put(Capability.MultipleIps, "true");
-        capabilities.put(Service.Firewall, firewallCapabilities);
-
-        return capabilities;
-    }
-
-    private String getChainName(String routerName, RuleChainCode chainCode) {
-        return getChainName("", routerName, chainCode);
-    }
-
-    private String getChainName(String networkId, String routerName, RuleChainCode chainCode) {
-
-        String chain = "";
-
-        switch (chainCode) {
-            case TR_PRE:
-                chain = "pre-routing";
-                break;
-            case TR_PREFILTER:
-                chain = "pre-filter";
-                break;
-            case TR_PRENAT:
-                chain = "pre-nat";
-                break;
-            case TR_POST:
-                chain = "post-routing";
-                break;
-            case ACL_INGRESS:
-                chain = "ACL-ingress-" + networkId;
-                break;
-            case ACL_EGRESS:
-                chain = "ACL-egress-" + networkId;
-                break;
-        }
-
-        return routerName + "-tenantrouter-" + chain;
-    }
-
-    protected RuleChain getChain(String accountUuid, String routerName, RuleChainCode chainCode) {
-        return getChain("", accountUuid, routerName, chainCode);
-    }
-
-    protected RuleChain getChain(String networkId, String accountUuid, String routerName, RuleChainCode chainCode) {
-        String chainName = getChainName(networkId, routerName, chainCode);
-
-        MultivaluedMap findChain = new MultivaluedMapImpl();
-        findChain.add("tenant_id", accountUuid);
-
-        ResourceCollection<RuleChain> ruleChains = api.getChains(findChain);
-
-        for (RuleChain chain : ruleChains) {
-            if (chain.getName().equals(chainName)) {
-                return chain;
-            }
-        }
-
-        return null;
-    }
-
-    protected RouterPort[] getOrCreateProviderRouterPorts(Router tenantRouter, Router providerRouter) {
-        RouterPort[] ports = new RouterPort[2];
-
-        RouterPort tenantUplink = null;
-        RouterPort providerDownlink = null;
-
-        // Check if the ports and connection already exist
-        for (Port peerPort : tenantRouter.getPeerPorts((new MultivaluedMapImpl()))) {
-            if (peerPort != null && peerPort instanceof RouterPort) {
-                RouterPort checkPort = (RouterPort)peerPort;
-                if (checkPort.getDeviceId().compareTo(providerRouter.getId()) == 0) {
-                    providerDownlink = checkPort;
-                    tenantUplink = (RouterPort)api.getPort(checkPort.getPeerId());
-                    break;
-                }
-            }
-        }
-
-        // Create the ports and connection if they don't exist
-        if (providerDownlink == null) {
-            // Add interior port on router side, with network details
-            providerDownlink = providerRouter.addInteriorRouterPort().networkAddress("169.254.255.0").networkLength(32).portAddress("169.254.255.1").create();
-            tenantUplink = tenantRouter.addInteriorRouterPort().networkAddress("169.254.255.0").networkLength(32).portAddress("169.254.255.2").create();
-
-            // Link them up
-            providerDownlink.link(tenantUplink.getId()).update();
-        }
-
-        ports[0] = tenantUplink;
-        ports[1] = providerDownlink;
-
-        return ports;
-    }
-
-    private Port[] getOrCreatePublicBridgePorts(NicProfile nic, Bridge publicBridge, Router providerRouter) {
-        Port[] ports = new Port[2];
-
-        BridgePort bridgeUplink = null;
-        RouterPort providerDownlink = null;
-
-        // Check if the ports and connection already exist
-        for (Port peerPort : publicBridge.getPeerPorts()) {
-            if (peerPort != null && peerPort instanceof RouterPort) {
-                RouterPort checkPort = (RouterPort)peerPort;
-                // Check it's a port on the providerRouter with the right gateway address
-                if (checkPort.getDeviceId().compareTo(providerRouter.getId()) == 0 && checkPort.getPortAddress().equals(nic.getIPv4Gateway())) {
-                    providerDownlink = checkPort;
-                    bridgeUplink = (BridgePort)api.getPort(checkPort.getPeerId());
-                    break;
-                }
-            }
-        }
-
-        // Create the ports and connection if they don't exist
-        if (providerDownlink == null) {
-            String cidr = NetUtils.ipAndNetMaskToCidr(nic.getIPv4Gateway(), nic.getIPv4Netmask());
-            String cidrSubnet = NetUtils.getCidrSubNet(cidr);
-            int cidrSize = (int)NetUtils.getCidrSize(NetUtils.cidr2Netmask(cidr));
-            String gateway = nic.getIPv4Gateway();
-
-            // Add interior port on router side, with network details
-            providerDownlink = providerRouter.addInteriorRouterPort().networkAddress(cidrSubnet).networkLength(cidrSize).portAddress(gateway).create();
-            bridgeUplink = publicBridge.addInteriorPort().create();
-
-            // Link them up
-            providerDownlink.link(bridgeUplink.getId()).update();
-
-        }
-
-        ports[0] = bridgeUplink;
-        ports[1] = providerDownlink;
-
-        return ports;
-    }
-
-    private void ensureBridgeConnectedToRouter(Network network, Bridge netBridge, Router netRouter) {
-        if (getBridgeToRouterPort(network, netBridge, netRouter) == null) {
-            connectBridgeToRouter(network, netBridge, netRouter);
-        }
-    }
-
-    private BridgePort getBridgeToRouterPort(Network network, Bridge netBridge, Router netRouter) {
-        for (Port p : netBridge.getPeerPorts()) {
-            if (p.getClass().equals(BridgePort.class)) {
-                BridgePort bp = (BridgePort)p;
-                if (bp.getPeerId().compareTo(netRouter.getId()) == 0) {
-                    return bp;
-                }
-            }
-        }
-        return null;
-    }
-
-    /*
-     * resetEgressACLFilter sets the Egress ACL Filter back to its initial
-     * state - drop everything. This needs to be called when all Egress
-     * ACL rules are deleted, so we can start allowing all Egress traffic
-     * again
-     */
-    protected void resetEgressACLFilter(Network network) {
-        boolean isVpc = getIsVpc(network);
-        long id = getRouterId(network, isVpc);
-        String routerName = getRouterName(isVpc, id);
-
-        RuleChain egressChain = getChain(String.valueOf(network.getId()), getAccountUuid(network), routerName, RuleChainCode.ACL_EGRESS);
-
-        // Clear all the rules out
-        for (Rule rule : egressChain.getRules()) {
-            rule.delete();
-        }
-
-        // Add a matchForwardFlow rule so that we can accept all return traffic
-        egressChain.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
-    }
-
-    protected RuleChain getOrInitEgressACLFilter(Network network) {
-        boolean isVpc = getIsVpc(network);
-        long id = getRouterId(network, isVpc);
-        String routerName = getRouterName(isVpc, id);
-
-        RuleChain egressChain = getChain(String.valueOf(network.getId()), getAccountUuid(network), routerName, RuleChainCode.ACL_EGRESS);
-
-        // Rules set by the user will have a protocol, so we count the ACL
-        // rules by counting how much have the nwProto field set.
-        int totalRules = 0;
-        for (Rule rule : egressChain.getRules()) {
-            if (rule.getNwProto() != 0) {
-                totalRules++;
-            }
-        }
-
-        if (totalRules > 0) {
-            // There are already rules present, no need to init.
-            return egressChain;
-        } else {
-            // We need to delete any placeholder rules
-            for (Rule rule : egressChain.getRules()) {
-                rule.delete();
-            }
-        }
-
-        int pos = 1;
-        // If it is ARP, accept it
-        egressChain.addRule().type(DtoRule.Accept).dlType(0x0806).position(pos++).create();
-
-        // If it is ICMP to the router, accept that
-        egressChain.addRule()
-            .type(DtoRule.Accept)
-            .nwProto(SimpleFirewallRule.stringToProtocolNumber("icmp"))
-            .nwDstAddress(network.getGateway())
-            .nwDstLength(32)
-            .position(pos++)
-            .create();
-
-        // Everything else gets dropped
-        egressChain.addRule().type(DtoRule.Drop).position(pos).create();
-
-        return egressChain;
-    }
-
-    private void connectBridgeToRouter(Network network, Bridge netBridge, Router netRouter) {
-
-        boolean isVpc = getIsVpc(network);
-        long id = getRouterId(network, isVpc);
-        String routerName = getRouterName(isVpc, id);
-        String accountIdStr = getAccountUuid(network);
-
-        // Add interior port on bridge side
-        BridgePort bridgePort = netBridge.addInteriorPort().create();
-
-        // Add interior port on router side, with network details
-        RouterPort routerPort = netRouter.addInteriorRouterPort();
-        String cidr = network.getCidr();
-        String cidrSubnet = NetUtils.getCidrSubNet(cidr);
-        int cidrSize = (int)NetUtils.getCidrSize(NetUtils.cidr2Netmask(cidr));
-
-        routerPort.networkAddress(cidrSubnet);
-        routerPort.networkLength(cidrSize);
-        routerPort.portAddress(network.getGateway());
-
-        // If this is a VPC, then we will be using NetworkACLs, which is
-        // implemented via chains on the router port to that network.
-        if (getIsVpc(network)) {
-            // Create ACL filter chain for traffic coming INTO the network
-            // (outbound from the port
-            int pos = 1;
-
-            RuleChain inc = api.addChain().name(getChainName(String.valueOf(network.getId()), routerName, RuleChainCode.ACL_INGRESS)).tenantId(accountIdStr).create();
-
-            // If it is ARP, accept it
-            inc.addRule().type(DtoRule.Accept).dlType(0x0806).position(pos++).create();
-
-            // If it is ICMP to the router, accept that
-            inc.addRule()
-                .type(DtoRule.Accept)
-                .nwProto(SimpleFirewallRule.stringToProtocolNumber("icmp"))
-                .nwDstAddress(network.getGateway())
-                .nwDstLength(32)
-                .position(pos++)
-                .create();
-
-            // If it is connection tracked, accept that as well
-            inc.addRule().type(DtoRule.Accept).matchReturnFlow(true).position(pos++).create();
-
-            inc.addRule().type(DtoRule.Drop).position(pos).create();
-
-            //
-            RuleChain out = api.addChain().name(getChainName(String.valueOf(network.getId()), routerName, RuleChainCode.ACL_EGRESS)).tenantId(accountIdStr).create();
-
-            // Creating the first default rule here that does nothing
-            // but start connection tracking.
-            out.addRule().type(DtoRule.Accept).matchForwardFlow(true).position(1).create();
-
-            routerPort.outboundFilterId(inc.getId());
-            routerPort.inboundFilterId(out.getId());
-        }
-
-        routerPort.create();
-
-        // Link them up
-        bridgePort.link(routerPort.getId()).update();
-
-        // Set up default route from router to subnet
-        netRouter.addRoute()
-            .type("Normal")
-            .weight(100)
-            .srcNetworkAddr("0.0.0.0")
-            .srcNetworkLength(0)
-            .dstNetworkAddr(cidrSubnet)
-            .dstNetworkLength(cidrSize)
-            .nextHopPort(routerPort.getId())
-            .nextHopGateway(null)
-            .create();
-    }
-
-    private Bridge getOrCreateNetworkBridge(Network network) {
-        // Find the single bridge for this network, create if doesn't exist
-        return getOrCreateNetworkBridge(network.getId(), getAccountUuid(network));
-    }
-
-    private Bridge getOrCreateNetworkBridge(long networkID, String accountUuid) {
-        Bridge netBridge = getNetworkBridge(networkID, accountUuid);
-        if (netBridge == null) {
-
-            String networkUUIDStr = String.valueOf(networkID);
-
-            s_logger.debug("Attempting to create guest network bridge");
-            try {
-                netBridge = api.addBridge().tenantId(accountUuid).name(networkUUIDStr).create();
-            } catch (HttpInternalServerError ex) {
-                s_logger.warn("Bridge creation failed, retrying bridge get in case it now exists.", ex);
-                netBridge = getNetworkBridge(networkID, accountUuid);
-            }
-        }
-        return netBridge;
-    }
-
-    private Bridge getNetworkBridge(long networkID, String accountUuid) {
-
-        MultivaluedMap qNetBridge = new MultivaluedMapImpl();
-        String networkUUIDStr = String.valueOf(networkID);
-        qNetBridge.add("tenant_id", accountUuid);
-
-        for (Bridge b : this.api.getBridges(qNetBridge)) {
-            if (b.getName().equals(networkUUIDStr)) {
-                return b;
-            }
-        }
-
-        return null;
-    }
-
-    protected boolean getIsVpc(Network network) {
-        return (network.getVpcId() != null);
-    }
-
-    protected long getRouterId(Network network, boolean isVpc) {
-        if (isVpc) {
-            return network.getVpcId();
-        } else {
-            return network.getId();
-        }
-    }
-
-    private Router getOrCreateGuestNetworkRouter(Network network) {
-        // Find the single bridge for this (isolated) guest network, create if doesn't exist
-        boolean isVpc = getIsVpc(network);
-        long id = getRouterId(network, isVpc);
-
-        return getOrCreateGuestNetworkRouter(id, getAccountUuid(network), isVpc);
-
-    }
-
-    protected String getRouterName(boolean isVpc, long id) {
-        if (isVpc) {
-            return "VPC" + String.valueOf(id);
-        } else {
-            return String.valueOf(id);
-        }
-    }
-
-    protected Router createRouter(long id, String accountUuid, boolean isVpc) {
-
-        String routerName = getRouterName(isVpc, id);
-
-        //Set up rule chains
-        RuleChain pre = api.addChain().name(getChainName(routerName, RuleChainCode.TR_PRE)).tenantId(accountUuid).create();
-        RuleChain post = api.addChain().name(getChainName(routerName, RuleChainCode.TR_POST)).tenantId(accountUuid).create();
-
-        // Set up NAT and filter chains for pre-routing
-        RuleChain preFilter = api.addChain().name(getChainName(routerName, RuleChainCode.TR_PREFILTER)).tenantId(accountUuid).create();
-        RuleChain preNat = api.addChain().name(getChainName(routerName, RuleChainCode.TR_PRENAT)).tenantId(accountUuid).create();
-
-        // Hook the chains in - first jump to Filter chain, then jump to Nat chain
-        pre.addRule().type(DtoRule.Jump).jumpChainId(preFilter.getId()).position(1).create();
-        pre.addRule().type(DtoRule.Jump).jumpChainId(preNat.getId()).position(2).create();
-
-        return api.addRouter().tenantId(accountUuid).name(routerName).inboundFilterId(pre.getId()).outboundFilterId(post.getId()).create();
-    }
-
-    private Router getOrCreateGuestNetworkRouter(long id, String accountUuid, boolean isVpc) {
-        Router tenantRouter = getGuestNetworkRouter(id, accountUuid, isVpc);
-        if (tenantRouter == null) {
-            tenantRouter = createRouter(id, accountUuid, isVpc);
-        }
-        return tenantRouter;
-    }
-
-    private Router getGuestNetworkRouter(long id, String accountUuid, boolean isVpc) {
-
-        MultivaluedMap qNetRouter = new MultivaluedMapImpl();
-        String routerName = getRouterName(isVpc, id);
-
-        qNetRouter.add("tenant_id", accountUuid);
-
-        for (Router router : api.getRouters(qNetRouter)) {
-            if (router.getName().equals(routerName)) {
-                return router;
-            }
-        }
-
-        return null;
-    }
-
-    private UUID getNicUUID(NicProfile nic) {
-        NicVO nicvo = _nicDao.findById(nic.getId());
-        return UUID.fromString(nicvo.getUuid());
-    }
-
-    private void cleanBridge(Bridge br) {
-
-        for (Port peerPort : br.getPeerPorts()) {
-            if (peerPort != null && peerPort instanceof RouterPort) {
-                RouterPort checkPort = (RouterPort)peerPort;
-                if (checkPort.getType().equals("ExteriorRouter")) {
-                    checkPort.vifId(null).update();
-                } else if (checkPort.getType().equals("InteriorRouter")) {
-                    checkPort.unlink();
-                }
-                checkPort.delete();
-            }
-        }
-
-        for (BridgePort p : br.getPorts()) {
-
-            if (p.getType().equals("ExteriorBridge")) {
-                // Set VIF ID to null
-                p.vifId(null).update();
-            }
-
-            if (p.getType().equals("InteriorBridge")) {
-                p.unlink();
-            }
-
-            // Delete port
-            p.delete();
-        }
-    }
-
-    private void deleteNetworkBridges(Network network) {
-        String accountUuid = getAccountUuid(network);
-        long networkID = network.getId();
-
-        Bridge netBridge = getNetworkBridge(networkID, accountUuid);
-        if (netBridge != null) {
-
-            cleanBridge(netBridge);
-
-            // Delete DHCP subnets
-            for (Object dhcpSubnet : netBridge.getDhcpSubnets()) {
-                DhcpSubnet sub = (DhcpSubnet)dhcpSubnet;
-                sub.delete();
-            }
-
-            netBridge.delete();
-        }
-    }
-
-    private void deleteGuestNetworkRouters(Network network) {
-        String accountUuid = getAccountUuid(network);
-        boolean isVpc = getIsVpc(network);
-        long id = getRouterId(network, isVpc);
-
-        Router tenantRouter = getGuestNetworkRouter(id, accountUuid, isVpc);
-
-        // Delete any peer ports corresponding to this router
-        for (Port peerPort : tenantRouter.getPeerPorts((new MultivaluedMapImpl()))) {
-            if (peerPort != null && peerPort instanceof RouterPort) {
-                RouterPort checkPort = (RouterPort)peerPort;
-                if (checkPort.getType().equals("ExteriorRouter")) {
-                    checkPort.vifId(null).update();
-                } else if (checkPort.getType().equals("InteriorRouter")) {
-                    checkPort.unlink();
-                }
-                checkPort.delete();
-            } else if (peerPort != null && peerPort instanceof BridgePort) {
-                BridgePort checkPort = (BridgePort)peerPort;
-                if (checkPort.getType().equals("ExteriorBridge")) {
-                    checkPort.vifId(null).update();
-                } else if (checkPort.getType().equals("InteriorBridge")) {
-                    checkPort.unlink();
-                }
-                checkPort.delete();
-            }
-        }
-
-        if (tenantRouter != null) {
-            // Remove all peer ports if any exist
-            for (RouterPort p : tenantRouter.getPorts(new MultivaluedMapImpl())) {
-                if (p.getType().equals("ExteriorRouter")) {
-                    // Set VIF ID to null
-                    p.vifId(null).update();
-                    // the port might have some chains associated with it
-                }
-
-                if (p.getType().equals("InteriorRouter")) {
-                    p.unlink();
-                }
-
-                // Delete port
-                p.delete();
-            }
-
-            // Remove inbound and outbound filter chains
-            String accountIdStr = String.valueOf(accountUuid);
-            String routerName = getRouterName(isVpc, id);
-
-            RuleChain pre = api.getChain(tenantRouter.getInboundFilterId());
-            RuleChain preFilter = getChain(accountIdStr, routerName, RuleChainCode.TR_PREFILTER);
-            RuleChain preNat = getChain(accountIdStr, routerName, RuleChainCode.TR_PRENAT);
-            RuleChain post = api.getChain(tenantRouter.getOutboundFilterId());
-
-            pre.delete();
-            preFilter.delete();
-            preNat.delete();
-            post.delete();
-
-            // Remove routes
-            for (Route r : tenantRouter.getRoutes(new MultivaluedMapImpl())) {
-                r.delete();
-            }
-
-            tenantRouter.delete();
-        }
-    }
-
-    @Override
-    public List<Class<?>> getCommands() {
-        // MidoNet does not implement any commands, so we return an empty list.
-        return new ArrayList<Class<?>>();
-    }
-}
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/element/SimpleFirewallRule.java b/plugins/network-elements/midonet/src/com/cloud/network/element/SimpleFirewallRule.java
deleted file mode 100644
index 664132f..0000000
--- a/plugins/network-elements/midonet/src/com/cloud/network/element/SimpleFirewallRule.java
+++ /dev/null
@@ -1,219 +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.element;
-
-import java.util.ArrayList;
-import java.util.List;
-// Used for translation between MidoNet firewall rules and
-// CloudStack firewall rules
-
-import org.midonet.client.dto.DtoRule;
-import org.midonet.client.resource.Rule;
-
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-
-import com.cloud.agent.api.to.FirewallRuleTO;
-import com.cloud.agent.api.to.NetworkACLTO;
-import com.cloud.agent.api.to.PortForwardingRuleTO;
-
-public class SimpleFirewallRule {
-
-    public List<String> sourceCidrs;
-    public String protocol;
-    public String dstIp;
-    public int dstPortStart = 0;
-    public int dstPortEnd = 0;
-    public int icmpType = 0;
-    public int icmpCode = 0;
-
-    private static BiMap<Integer, String> protocolNumberToString;
-    static {
-        protocolNumberToString = HashBiMap.create();
-        protocolNumberToString.put(1, "icmp");
-        protocolNumberToString.put(6, "tcp");
-        protocolNumberToString.put(17, "udp");
-        protocolNumberToString.put(0, "none");
-    }
-
-    public SimpleFirewallRule(FirewallRuleTO rule) {
-        // Destination IP (confusingly called SourceIP in FirewallRule attributes)
-        dstIp = rule.getSrcIp();
-        protocol = rule.getProtocol();
-
-        if ("icmp".equals(protocol)) {
-            icmpType = rule.getIcmpType();
-            icmpCode = rule.getIcmpCode();
-        } else {
-            int[] portNumbers = rule.getSrcPortRange();
-
-            // if port start and end are not set, they
-            // should be 0,0, and that's already the case
-            if (portNumbers != null && portNumbers.length == 2) {
-                dstPortStart = portNumbers[0];
-                dstPortEnd = portNumbers[1];
-            }
-        }
-
-        sourceCidrs = rule.getSourceCidrList();
-
-        // If no CIDRs specified, it is an "all sources" rule
-        if (sourceCidrs == null || sourceCidrs.isEmpty()) {
-            sourceCidrs = new ArrayList<String>();
-            sourceCidrs.add("0.0.0.0/0");
-        }
-    }
-
-    public SimpleFirewallRule(NetworkACLTO rule) {
-        dstIp = "null";
-        protocol = rule.getProtocol();
-
-        if ("icmp".equals(protocol)) {
-            icmpType = rule.getIcmpType();
-            icmpCode = rule.getIcmpCode();
-        } else {
-            int[] portNumbers = rule.getSrcPortRange();
-
-            // if port start and end are not set, they
-            // should be 0,0, and that's already the case
-            if (portNumbers != null && portNumbers.length == 2) {
-                dstPortStart = portNumbers[0];
-                dstPortEnd = portNumbers[1];
-            }
-        }
-
-        sourceCidrs = rule.getSourceCidrList();
-
-        // If no CIDRs specified, it is an "all sources" rule
-        if (sourceCidrs == null || sourceCidrs.isEmpty()) {
-            sourceCidrs = new ArrayList<String>();
-            sourceCidrs.add("0.0.0.0/0");
-        }
-    }
-
-    public SimpleFirewallRule(PortForwardingRuleTO rule) {
-        dstIp = rule.getSrcIp();
-        protocol = rule.getProtocol();
-
-        int[] srcPortNumbers = rule.getSrcPortRange();
-        int[] dstPortNumbers = rule.getDstPortRange();
-
-        // if port start and end are not set, they
-        // should be 0,0, and that's already the case
-        if (srcPortNumbers != null && srcPortNumbers.length == 2 && dstPortNumbers != null && dstPortNumbers.length == 2) {
-            dstPortStart = dstPortNumbers[0];
-            dstPortEnd = srcPortNumbers[0];
-        }
-
-        sourceCidrs = new ArrayList<String>();
-        sourceCidrs.add(rule.getDstIp());
-    }
-
-    public SimpleFirewallRule(Rule rule) {
-
-        String sourceIP = rule.getNwSrcAddress();
-        int sourceLength = rule.getNwSrcLength();
-
-        sourceCidrs = new ArrayList<String>();
-        /*
-         * Only one IP in the CIDR list
-         * Port Forwarding Rules don't have sourceCidrs, but they do have
-         * targets. Use those instead if they exist.
-         */
-        DtoRule.DtoNatTarget[] targets = rule.getNatTargets();
-        if (targets != null) {
-            sourceCidrs.add(targets[0].addressFrom);
-        } else {
-            sourceCidrs.add(String.format("%s/%d", sourceIP, sourceLength));
-        }
-
-        int protoNum = rule.getNwProto();
-        protocol = SimpleFirewallRule.protocolNumberToString(protoNum);
-
-        dstIp = rule.getNwDstAddress();
-
-        if ("icmp".equals(protocol)) {
-            if (rule.getTpSrc() != null && rule.getTpDst() != null) {
-                icmpType = rule.getTpSrc().start;
-                icmpCode = rule.getTpDst().start;
-            } else {
-                icmpType = -1;
-                icmpCode = -1;
-            }
-
-        } else {
-            /*
-             * If this is port forwarding, we want to take the start
-             * port for the public port range, and the start port for
-             * the private port range to uniquely identify this rule.
-             */
-            if (targets != null) {
-                dstPortStart = targets[0].portFrom;
-            } else {
-                dstPortStart = rule.getTpDst().start;
-            }
-            dstPortEnd = rule.getTpDst().end;
-        }
-
-        // cidr, protocol, dstIp, dstPortStart, dstPortEnd, icmpType, icmpCode);
-    }
-
-    public static String protocolNumberToString(int protocolNumber) {
-        return protocolNumberToString.get(protocolNumber);
-    }
-
-    public static int stringToProtocolNumber(String protoString) {
-        return protocolNumberToString.inverse().get(protoString);
-    }
-
-    public int getFieldOne() {
-        if (protocol.equals("icmp")) {
-            return icmpType;
-
-        } else {
-            return dstPortStart;
-        }
-    }
-
-    public int getFieldTwo() {
-        if (protocol.equals("icmp")) {
-            return icmpCode;
-        } else {
-            return dstPortEnd;
-        }
-    }
-
-    public String[] toStringArray() {
-        List<String> stringRules = new ArrayList<String>();
-
-        // Create a rule string per source CIDR, since each MidoNet
-        // rule is for one CIDR
-        for (String sourceCidr : sourceCidrs) {
-
-            // Follows the rule String format defined in SetFirewallRulesCommand.java::generateFirewallRules()
-            int field1 = getFieldOne();
-            int field2 = getFieldTwo();
-
-            String stringRule = String.format("%s:%s:%d:%d:%s:", dstIp, protocol, field1, field2, sourceCidr);
-            stringRules.add(stringRule);
-        }
-        String[] stringArray = new String[stringRules.size()];
-        return stringRules.toArray(stringArray);
-    }
-}
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
deleted file mode 100644
index 86ebd02..0000000
--- a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetGuestNetworkGuru.java
+++ /dev/null
@@ -1,160 +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.guru;
-
-
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.network.Network;
-import com.cloud.network.NetworkProfile;
-import com.cloud.network.Networks;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.user.Account;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachineProfile;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-@Component
-public class MidoNetGuestNetworkGuru extends GuestNetworkGuru {
-    private static final Logger s_logger = Logger.getLogger(MidoNetGuestNetworkGuru.class);
-
-    @Inject
-    AccountDao _accountDao;
-
-    public MidoNetGuestNetworkGuru() {
-        super();
-        _isolationMethods = new PhysicalNetwork.IsolationMethod[] {new PhysicalNetwork.IsolationMethod("MIDO")};
-    }
-
-    @Override
-    protected boolean canHandle(NetworkOffering offering, NetworkType networkType, 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   " + Network.GuestType.Isolated + " in zone of type " + NetworkType.Advanced +
-                " using isolation method MIDO.");
-            return false;
-        }
-    }
-
-    @Override
-    public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
-        s_logger.debug("design called");
-        // Check if the isolation type of the related physical network is MIDO
-        PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
-        if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("MIDO")) {
-            s_logger.debug("Refusing to design this network, the physical isolation type is not MIDO");
-            return null;
-        }
-
-        s_logger.debug("Physical isolation type is MIDO, asking GuestNetworkGuru to design this network");
-        NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner);
-        if (networkObject == null) {
-            return null;
-        }
-        // Override the broadcast domain type - do we need to do this?
-        networkObject.setBroadcastDomainType(Networks.BroadcastDomainType.Mido);
-
-        return networkObject;
-    }
-
-    @Override
-    public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException {
-        assert (network.getState() == Network.State.Implementing) : "Why are we implementing " + network;
-        s_logger.debug("implement called network: " + network.toString());
-
-        long dcId = dest.getDataCenter().getId();
-
-        //get physical network id
-        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
-
-        NetworkVO implemented =
-            new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), Network.State.Allocated,
-                network.getDataCenterId(), physicalNetworkId, offering.getRedundantRouter());
-
-        if (network.getGateway() != null) {
-            implemented.setGateway(network.getGateway());
-        }
-
-        if (network.getCidr() != null) {
-            implemented.setCidr(network.getCidr());
-        }
-
-        AccountVO acc = _accountDao.findById(network.getAccountId());
-        String accountUUIDStr = acc.getUuid();
-        String routerName = "";
-        if (network.getVpcId() != null) {
-            routerName = "VPC" + String.valueOf(network.getVpcId());
-        } else {
-            routerName = String.valueOf(network.getId());
-        }
-
-        String broadcastUriStr = accountUUIDStr + "." + String.valueOf(network.getId()) + ":" + routerName;
-
-        implemented.setBroadcastUri(Networks.BroadcastDomainType.Mido.toUri(broadcastUriStr));
-        s_logger.debug("Broadcast URI set to " + broadcastUriStr);
-
-        return implemented;
-    }
-
-    @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
-        s_logger.debug("reserve called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
-
-        super.reserve(nic, network, vm, dest, context);
-    }
-
-    @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
-        s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
-        return super.release(nic, vm, reservationId);
-    }
-
-    @Override
-    public void shutdown(NetworkProfile profile, NetworkOffering offering) {
-        s_logger.debug("shutdown called");
-
-        super.shutdown(profile, offering);
-    }
-
-    @Override
-    public boolean trash(Network network, NetworkOffering offering) {
-        s_logger.debug("trash called with network: " + network.toString());
-
-        return super.trash(network, offering);
-    }
-}
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java b/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
deleted file mode 100644
index 43093a4..0000000
--- a/plugins/network-elements/midonet/src/com/cloud/network/guru/MidoNetPublicNetworkGuru.java
+++ /dev/null
@@ -1,252 +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.guru;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.Vlan;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.network.IpAddressManager;
-import com.cloud.network.Network;
-import com.cloud.network.NetworkModel;
-import com.cloud.network.NetworkProfile;
-import com.cloud.network.Networks;
-import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.user.Account;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionStatus;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-
-public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
-    private static final Logger s_logger = Logger.getLogger(MidoNetPublicNetworkGuru.class);
-
-    // Inject any stuff we need to use (DAOs etc)
-    @Inject
-    NetworkModel _networkModel;
-    @Inject
-    AccountDao _accountDao;
-    @Inject
-    IpAddressManager _ipAddrMgr;
-
-    // Don't need to change traffic type stuff, public is fine
-
-    // Only change is to make broadcast domain type Mido
-    @Override
-    public Network design(NetworkOffering offering, DeploymentPlan plan, Network network, Account owner) {
-        s_logger.debug("design called with network: " + network);
-        if (!canHandle(offering)) {
-            return null;
-        }
-
-        if (offering.getTrafficType() == Networks.TrafficType.Public) {
-            NetworkVO ntwk =
-                new NetworkVO(offering.getTrafficType(), Networks.Mode.Static, Networks.BroadcastDomainType.Mido, offering.getId(), Network.State.Allocated,
-                    plan.getDataCenterId(), plan.getPhysicalNetworkId(), offering.getRedundantRouter());
-            return ntwk;
-        } else {
-            return null;
-        }
-    }
-
-    protected MidoNetPublicNetworkGuru() {
-        super();
-    }
-
-    @Override
-    protected void getIp(NicProfile nic, DataCenter dc, VirtualMachineProfile vm, Network network) throws InsufficientVirtualNetworkCapacityException,
-        InsufficientAddressCapacityException, ConcurrentOperationException {
-        if (nic.getIPv4Address() == null) {
-            PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), Vlan.VlanType.VirtualNetwork, null, null, false);
-            nic.setIPv4Address(ip.getAddress().addr());
-
-            nic.setIPv4Gateway(ip.getGateway());
-
-            // Set netmask to /24 for now
-            // TDO make it /32 and go via router for anything else on the subnet
-            nic.setIPv4Netmask("255.255.255.0");
-
-            // Make it the default nic so that a default route is set up.
-            nic.setDefaultNic(true);
-
-            //nic.setIsolationUri(Networks.IsolationType..Mido.toUri(ip.getVlanTag()));
-            nic.setBroadcastUri(network.getBroadcastUri());
-            //nic.setBroadcastType(Networks.BroadcastDomainType.Vlan);
-            nic.setFormat(Networks.AddressFormat.Ip4);
-            nic.setReservationId(String.valueOf(ip.getVlanTag()));
-            nic.setMacAddress(ip.getMacAddress());
-        }
-
-        nic.setIPv4Dns1(dc.getDns1());
-        nic.setIPv4Dns2(dc.getDns2());
-    }
-
-    @Override
-    public void updateNicProfile(NicProfile profile, Network network) {
-        s_logger.debug("updateNicProfile called with network: " + network + " profile: " + profile);
-
-        DataCenter dc = _dcDao.findById(network.getDataCenterId());
-        if (profile != null) {
-            profile.setIPv4Dns1(dc.getDns1());
-            profile.setIPv4Dns2(dc.getDns2());
-        }
-    }
-
-    @Override
-    public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException,
-        InsufficientAddressCapacityException, ConcurrentOperationException {
-
-        if (nic == null) {
-            nic = new NicProfile(Nic.ReservationStrategy.Create, null, null, null, null);
-        }
-        s_logger.debug("allocate called with network: " + network + " nic: " + nic + " vm: " + vm);
-        DataCenter dc = _dcDao.findById(network.getDataCenterId());
-
-        if (nic.getRequestedIPv4() != null) {
-            throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
-        }
-
-        getIp(nic, dc, vm, network);
-
-        if (nic.getIPv4Address() == null) {
-            nic.setReservationStrategy(Nic.ReservationStrategy.Start);
-        } else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
-            nic.setReservationStrategy(Nic.ReservationStrategy.Managed);
-        } else {
-            nic.setReservationStrategy(Nic.ReservationStrategy.Create);
-        }
-
-        nic.setBroadcastUri(generateBroadcastUri(network));
-
-        return nic;
-    }
-
-    @Override
-    public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException {
-        s_logger.debug("reserve called with network: " + network + " nic: " + nic + " vm: " + vm);
-        if (nic.getIPv4Address() == null) {
-            getIp(nic, dest.getDataCenter(), vm, network);
-        }
-    }
-
-    @Override
-    public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
-        s_logger.debug("release called with nic: " + nic + " vm: " + vm);
-        return true;
-    }
-
-    @Override
-    public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
-        throws InsufficientVirtualNetworkCapacityException {
-        s_logger.debug("implement called with network: " + network);
-        long dcId = destination.getDataCenter().getId();
-
-        //get physical network id
-        long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
-
-        NetworkVO implemented =
-            new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), Network.State.Allocated,
-                network.getDataCenterId(), physicalNetworkId, offering.getRedundantRouter());
-
-        if (network.getGateway() != null) {
-            implemented.setGateway(network.getGateway());
-        }
-
-        if (network.getCidr() != null) {
-            implemented.setCidr(network.getCidr());
-        }
-
-        implemented.setBroadcastUri(generateBroadcastUri(network));
-
-        return implemented;
-
-    }
-
-    @Override
-    @DB
-    public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
-        s_logger.debug("deallocate called with network: " + network + " nic: " + nic + " vm: " + vm);
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIPv4Address());
-        }
-
-        final IPAddressVO ip = _ipAddressDao.findByIpAndSourceNetworkId(nic.getNetworkId(), nic.getIPv4Address());
-        if (ip != null && nic.getReservationStrategy() != Nic.ReservationStrategy.Managed) {
-            Transaction.execute(new TransactionCallbackNoReturn() {
-                @Override
-                public void doInTransactionWithoutResult(TransactionStatus status) {
-                    _ipAddrMgr.markIpAsUnavailable(ip.getId());
-                    _ipAddressDao.unassignIpAddress(ip.getId());
-                }
-            });
-        }
-        nic.deallocate();
-
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Deallocated nic: " + nic);
-        }
-    }
-
-    @Override
-    public void shutdown(NetworkProfile network, NetworkOffering offering) {
-        s_logger.debug("shutdown called with network: " + network);
-    }
-
-    @Override
-    public boolean trash(Network network, NetworkOffering offering) {
-        s_logger.debug("trash called with network: " + network);
-        return true;
-    }
-
-    @Override
-    public void updateNetworkProfile(NetworkProfile networkProfile) {
-        DataCenter dc = _dcDao.findById(networkProfile.getDataCenterId());
-        networkProfile.setDns1(dc.getDns1());
-        networkProfile.setDns2(dc.getDns2());
-    }
-
-    private URI generateBroadcastUri(Network network) {
-        AccountVO acc = _accountDao.findById(network.getAccountId());
-        String accountUUIDStr = acc.getUuid();
-        String networkUUIDStr = String.valueOf(network.getId());
-        return Networks.BroadcastDomainType.Mido.toUri(accountUUIDStr + "." + networkUUIDStr + ":" + networkUUIDStr);
-    }
-
-}
diff --git a/plugins/network-elements/midonet/src/com/cloud/network/resource/MidoNetVifDriver.java b/plugins/network-elements/midonet/src/com/cloud/network/resource/MidoNetVifDriver.java
deleted file mode 100644
index c3185f5..0000000
--- a/plugins/network-elements/midonet/src/com/cloud/network/resource/MidoNetVifDriver.java
+++ /dev/null
@@ -1,169 +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.resource;
-
-import java.util.Map;
-import java.util.UUID;
-
-import javax.naming.ConfigurationException;
-import javax.ws.rs.core.MultivaluedMap;
-
-import org.apache.log4j.Logger;
-import org.libvirt.LibvirtException;
-import org.midonet.client.MidonetApi;
-import org.midonet.client.resource.Bridge;
-import org.midonet.client.resource.BridgePort;
-import org.midonet.client.resource.Host;
-
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-
-import com.cloud.agent.api.to.NicTO;
-import com.cloud.exception.InternalErrorException;
-import com.cloud.hypervisor.kvm.resource.LibvirtVMDef;
-import com.cloud.hypervisor.kvm.resource.VifDriverBase;
-import com.cloud.network.Networks;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.script.OutputInterpreter;
-import com.cloud.utils.script.Script;
-
-public class MidoNetVifDriver extends VifDriverBase {
-
-    private static final Logger s_logger = Logger.getLogger(MidoNetVifDriver.class);
-    private int _timeout;
-    private String _midoApiLocation = "http://localhost:8081/";
-    private static final String midoPostfix = "mnet";
-
-    @Override
-    public void configure(Map<String, Object> params) throws ConfigurationException {
-
-        super.configure(params);
-
-        String value = (String)params.get("scripts.timeout");
-        _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
-
-        // Load Midonet API server location
-        String midoLoc = (String)params.get("midonet.apiserver.address");
-        if (midoLoc != null) {
-            _midoApiLocation = midoLoc;
-        }
-    }
-
-    /*
-     * Grab our host id in a file written by Midonet, then
-     * return a Host.
-     */
-    private Host getMyHost(MidonetApi api) {
-        Script command = new Script("/bin/bash", _timeout);
-        command.add("-c");
-        command.add("awk -F'=' '{if ($1~/host/) print $2}' /etc/midolman/host_uuid.properties");
-
-        OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
-        command.execute(parser);
-        String host_uuid = parser.getLines().split("\\n")[0];
-        for (Host host : api.getHosts()) {
-            if (host.getId().toString().equals(host_uuid)) {
-                return host;
-            }
-        }
-        return null;
-    }
-
-    /*
-     * simple script to add the tap to the host and bring it up.
-     */
-    private String addTap() {
-        OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
-        Script command = new Script("/bin/bash", _timeout);
-        command.add("-c");
-        command.add("ip tuntap add mode tap dev '%d" + midoPostfix + "' && ip link | grep " + midoPostfix + " | sort -n | tail -1 | awk -F': ' '{print $2}'");
-        command.execute(parser);
-        String tapName = parser.getLines().split("\\n")[0];
-        command = new Script("/bin/bash", _timeout);
-        command.add("-c");
-        command.add("ip link set " + tapName + " up");
-        command.execute();
-        return tapName;
-    }
-
-    @Override
-    public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType, String nicAdapter) throws InternalErrorException, LibvirtException {
-
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("nic=" + nic);
-        }
-
-        LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef();
-
-        String trafficLabel = nic.getName();
-
-        if (nic.getBroadcastType() == Networks.BroadcastDomainType.Mido && (nic.getType() == Networks.TrafficType.Guest || nic.getType() == Networks.TrafficType.Public)) {
-            /*
-            * create the tap.
-            */
-            String tapName = addTap();
-
-            /*
-            * grab the tenant id and the network id from the Broadcast URI.
-            * We need to pluck the values out of the String. The string
-            * should look like "mido://[tenant_id].[bridge_name]"
-            */
-            MultivaluedMap qNet = new MultivaluedMapImpl();
-            String nicAuthority = nic.getBroadcastUri().getAuthority();
-            String tenantId = nicAuthority.split("\\.")[0];
-            qNet.add("tenant_id", tenantId);
-            String url = nicAuthority.split("\\.")[1];
-            String netName = url.split(":")[0];
-
-            MidonetApi api = new MidonetApi(_midoApiLocation);
-            api.enableLogging();
-
-            for (Bridge b : api.getBridges(qNet)) {
-                if (b.getName().equals(netName)) {
-                    for (BridgePort p : b.getPorts()) {
-                        UUID pvif = p.getVifId();
-                        if (pvif != null && p.getVifId().toString().equals(nic.getUuid())) {
-                            getMyHost(api).addHostInterfacePort().interfaceName(tapName).portId(p.getId()).create();
-                            break;
-                        }
-                    }
-                }
-            }
-
-            intf.defEthernet(tapName, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), "");
-
-        } else {
-            throw new InternalErrorException("Only NICs of BroadcastDomain type Mido are supported by the MidoNetVifDriver");
-        }
-
-        return intf;
-    }
-
-    @Override
-    public void unplug(LibvirtVMDef.InterfaceDef iface) {
-        String netName = iface.getBrName();
-
-        if (netName != null && netName.contains(midoPostfix)) {
-            Script command = new Script("/bin/bash", _timeout);
-            command.add("-c");
-            command.add("ip tuntap del " + iface.getBrName() + " mode tap");
-            command.execute();
-        }
-    }
-}
diff --git a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
deleted file mode 100644
index 51e2b1b..0000000
--- a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
+++ /dev/null
@@ -1,199 +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.element;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.UUID;
-
-import org.midonet.client.MidonetApi;
-import org.midonet.client.resource.Bridge;
-import org.midonet.client.resource.BridgePort;
-import org.midonet.client.resource.DhcpHost;
-import org.midonet.client.resource.DhcpSubnet;
-import org.midonet.client.resource.Port;
-import org.midonet.client.resource.ResourceCollection;
-import org.midonet.client.resource.Router;
-import org.midonet.client.resource.RouterPort;
-
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network;
-import com.cloud.network.Networks;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-
-import junit.framework.TestCase;
-
-public class MidoNetElementTest extends TestCase {
-
-    /*
-     * Test the standard case of addDhcpEntry with no errors.
-     */
-    public void testAddDhcpEntry() {
-
-        //mockMgmt
-        MidonetApi api = mock(MidonetApi.class, RETURNS_DEEP_STUBS);
-
-        //mockDhcpHost
-        DhcpHost mockDhcpHost = mock(DhcpHost.class);
-
-        //mockHostCollection
-        ResourceCollection<DhcpHost> hosts = new ResourceCollection<DhcpHost>(new ArrayList<DhcpHost>());
-
-        //mockDhcpSubnet
-        DhcpSubnet mockSub = mock(DhcpSubnet.class);
-        when(mockSub.addDhcpHost()).thenReturn(mockDhcpHost);
-        when(mockSub.getDhcpHosts()).thenReturn(hosts);
-
-        //mockSubnetCollection
-        ResourceCollection mockSubnetCollection = mock(ResourceCollection.class);
-        when(mockSubnetCollection.get(anyInt())).thenReturn(mockSub);
-
-        //mockBridge
-        Bridge mockBridge = mock(Bridge.class);
-        when(api.addBridge().tenantId(anyString()).name(anyString()).create()).thenReturn(mockBridge);
-        when(mockBridge.getDhcpSubnets()).thenReturn(mockSubnetCollection);
-
-        //mockRouter
-        Router mockRouter = mock(Router.class);
-        when(api.addRouter().tenantId(anyString()).name(anyString()).create()).thenReturn(mockRouter);
-
-        //mockNetwork
-        Network mockNetwork = mock(Network.class);
-        when(mockNetwork.getAccountId()).thenReturn((long)1);
-        when(mockNetwork.getGateway()).thenReturn("1.2.3.4");
-        when(mockNetwork.getCidr()).thenReturn("1.2.3.0/24");
-        when(mockNetwork.getId()).thenReturn((long)2);
-        when(mockNetwork.getBroadcastDomainType()).thenReturn(Networks.BroadcastDomainType.Mido);
-        when(mockNetwork.getTrafficType()).thenReturn(Networks.TrafficType.Guest);
-
-        //mockAccountDao
-        AccountDao mockAccountDao = mock(AccountDao.class);
-        AccountVO mockAccountVO = mock(AccountVO.class);
-        when(mockAccountDao.findById(anyLong())).thenReturn(mockAccountVO);
-        when(mockAccountVO.getUuid()).thenReturn("1");
-
-        //mockNic
-        NicProfile mockNic = mock(NicProfile.class);
-        when(mockNic.getIPv4Address()).thenReturn("10.10.10.170");
-        when(mockNic.getMacAddress()).thenReturn("02:00:73:3e:00:01");
-        when(mockNic.getName()).thenReturn("Fake Name");
-
-        //mockVm
-        @SuppressWarnings("unchecked")
-        VirtualMachineProfile mockVm = mock(VirtualMachineProfile.class);
-        when(mockVm.getType()).thenReturn(VirtualMachine.Type.User);
-
-        MidoNetElement elem = new MidoNetElement();
-        elem.setMidonetApi(api);
-        elem.setAccountDao(mockAccountDao);
-
-        boolean result = false;
-        try {
-            result = elem.addDhcpEntry(mockNetwork, mockNic, mockVm, null, null);
-        } catch (ConcurrentOperationException e) {
-            fail(e.getMessage());
-        } catch (InsufficientCapacityException e) {
-            fail(e.getMessage());
-        } catch (ResourceUnavailableException e) {
-            fail(e.getMessage());
-        }
-
-        assertEquals(result, true);
-    }
-
-    /*
-     * Test the standard case of implement with no errors.
-     */
-    public void testImplement() {
-        //mock
-        MidonetApi api = mock(MidonetApi.class, RETURNS_DEEP_STUBS);
-
-        //mockAccountDao
-        AccountDao mockAccountDao = mock(AccountDao.class);
-        AccountVO mockAccountVO = mock(AccountVO.class);
-        when(mockAccountDao.findById(anyLong())).thenReturn(mockAccountVO);
-        when(mockAccountVO.getUuid()).thenReturn("1");
-        MidoNetElement elem = new MidoNetElement();
-
-        elem.setMidonetApi(api);
-        elem.setAccountDao(mockAccountDao);
-
-        //mockRPort
-        RouterPort mockRPort = mock(RouterPort.class);
-        when(mockRPort.getId()).thenReturn(UUID.fromString("550e8400-e29b-41d4-a716-446655440000"));
-
-        //mockBPort
-        BridgePort mockBPort = mock(BridgePort.class);
-        when(mockBPort.link(any(UUID.class))).thenReturn(mockBPort);
-
-        //mockPort
-        Port mockPort = mock(Port.class);
-
-        ResourceCollection<Port> peerPorts = new ResourceCollection<Port>(new ArrayList<Port>());
-
-        peerPorts.add(mockPort);
-
-        //mockBridge
-        Bridge mockBridge = mock(Bridge.class, RETURNS_DEEP_STUBS);
-        when(api.addBridge().tenantId(anyString()).name(anyString()).create()).thenReturn(mockBridge);
-        when(mockBridge.addInteriorPort().create()).thenReturn(mockBPort);
-        when(mockBridge.getPeerPorts()).thenReturn(peerPorts);
-
-        //mockRouter
-        Router mockRouter = mock(Router.class, RETURNS_DEEP_STUBS);
-        when(api.addRouter().tenantId(anyString()).name(anyString()).create()).thenReturn(mockRouter);
-        when(mockRouter.addInteriorRouterPort().create()).thenReturn(mockRPort);
-
-        //mockNetwork
-        Network mockNetwork = mock(Network.class);
-        when(mockNetwork.getAccountId()).thenReturn((long)1);
-        when(mockNetwork.getGateway()).thenReturn("1.2.3.4");
-        when(mockNetwork.getCidr()).thenReturn("1.2.3.0/24");
-        when(mockNetwork.getId()).thenReturn((long)2);
-        when(mockNetwork.getBroadcastDomainType()).thenReturn(Networks.BroadcastDomainType.Mido);
-        when(mockNetwork.getTrafficType()).thenReturn(Networks.TrafficType.Public);
-
-        boolean result = false;
-        try {
-            result = elem.implement(mockNetwork, null, null, null);
-        } catch (ConcurrentOperationException e) {
-            fail(e.getMessage());
-        } catch (InsufficientCapacityException e) {
-            fail(e.getMessage());
-        } catch (ResourceUnavailableException e) {
-            fail(e.getMessage());
-        }
-
-        assertEquals(result, true);
-    }
-}
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 2973d43..28104b4 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -207,11 +207,5 @@
         <module>hypervisors/simulator</module>
       </modules>
     </profile>
-    <profile>
-      <id>midonet</id>
-      <modules>
-        <module>network-elements/midonet</module>
-      </modules>
-    </profile>
   </profiles>
 </project>
diff --git a/scripts/installer/windows/client.wxs b/scripts/installer/windows/client.wxs
index 4468ae8..8c5cdc7 100644
--- a/scripts/installer/windows/client.wxs
+++ b/scripts/installer/windows/client.wxs
@@ -1449,9 +1449,6 @@
                         <Component Id="cmpE79D8DE0A3F5641D63029C9C5BB84D0D" Guid="{71A421D6-EC6B-4410-BEB8-D8A13CBF2F76}">
                             <File Id="fil26BE9842DE6416E8946A2295439E129D" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\cloud-plugin-network-internallb-4.4.0-SNAPSHOT.jar" />
                         </Component>
-                        <Component Id="cmpA6C72B638E002C5141944F120B6B9711" Guid="{02C8CA2E-826F-452D-AC54-2E8787451C2B}">
-                            <File Id="filB57FEF496D3CF0EDD6B9DC7FA5E08D31" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\cloud-plugin-network-midonet-4.4.0-SNAPSHOT.jar" />
-                        </Component>
                         <Component Id="cmpBA53547354F4749AB6DB53E652729729" Guid="{0026D30B-04AA-45D9-9582-743650497E99}">
                             <File Id="filC6F3205D9E0721B202FECAD231D0E72B" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\cloud-plugin-network-netscaler-4.4.0-SNAPSHOT.jar" />
                         </Component>
@@ -1704,9 +1701,6 @@
                         <Component Id="cmp6114379A976905B2F2770C6E5934AC79" Guid="{8CCECB3F-062A-439E-863E-950BA2B0062F}">
                             <File Id="fil6A0D7E786C6E6FD2FF2C2D52A4A7FB3E" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\mail-1.4.jar" />
                         </Component>
-                        <Component Id="cmpCF3E965E2D26D7E48F44F280084D6836" Guid="{7A9845D3-BF3E-495C-9CFB-BA1D37199DAB}">
-                            <File Id="fil7B2A7C3FF6D92CABA0F6015F9D1FCB7E" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\midonet-client-1.1.0.jar" />
-                        </Component>
                         <Component Id="cmp2210FF2D22610D7C6B5B50F74A6CCFF6" Guid="{8B4D96E1-E8D0-415D-BC1E-0D6B9C2896EB}">
                             <File Id="fil79A9A35E5D30D89644135E92F334EBC6" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\lib\nekohtml-1.9.12.jar" />
                         </Component>
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index fbf97b2..50be5c2 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -16,6 +16,15 @@
 // under the License.
 package com.cloud.configuration;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.framework.config.ConfigKey;
+
 import com.cloud.agent.AgentManager;
 import com.cloud.consoleproxy.ConsoleProxyManager;
 import com.cloud.ha.HighAvailabilityManager;
@@ -29,14 +38,6 @@ import com.cloud.storage.snapshot.SnapshotManager;
 import com.cloud.template.TemplateManager;
 import com.cloud.vm.UserVmManager;
 import com.cloud.vm.snapshot.VMSnapshotManager;
-import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
-import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.framework.config.ConfigKey;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
 
 public enum Config {
 
@@ -1209,24 +1210,6 @@ public enum Config {
     VmwareHungWorkerTimeout("Advanced", ManagementServer.class, Long.class, "vmware.hung.wokervm.timeout", "7200", "Worker VM timeout in seconds", null),
     VmwareVcenterSessionTimeout("Advanced", ManagementServer.class, Long.class, "vmware.vcenter.session.timeout", "1200", "VMware client timeout in seconds", null),
 
-    // Midonet
-    MidoNetAPIServerAddress(
-            "Network",
-            ManagementServer.class,
-            String.class,
-            "midonet.apiserver.address",
-            "http://localhost:8081",
-            "Specify the address at which the Midonet API server can be contacted (if using Midonet)",
-            null),
-    MidoNetProviderRouterId(
-            "Network",
-            ManagementServer.class,
-            String.class,
-            "midonet.providerrouter.id",
-            "d7c5e6a3-e2f4-426b-b728-b7ce6a0448e5",
-            "Specifies the UUID of the Midonet provider router (if using Midonet)",
-            null),
-
     // KVM
     KvmPublicNetwork("Hidden", ManagementServer.class, String.class, "kvm.public.network.device", null, "Specify the public bridge on host for public network", null),
     KvmPrivateNetwork("Hidden", ManagementServer.class, String.class, "kvm.private.network.device", null, "Specify the private bridge on host for private network", null),
diff --git a/setup/db/db/schema-41000to41100.sql b/setup/db/db/schema-41000to41100.sql
index 886b3d4..14a48d7 100644
--- a/setup/db/db/schema-41000to41100.sql
+++ b/setup/db/db/schema-41000to41100.sql
@@ -248,3 +248,6 @@ ALTER TABLE `cloud`.`oobm` MODIFY COLUMN port VARCHAR(255);
 
 -- CLOUDSTACK-9902: Console proxy SSL toggle
 INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`, `default_value`, `is_dynamic`) VALUES ('Console Proxy', 'DEFAULT', 'AgentManager', 'consoleproxy.sslEnabled', 'false', 'Enable SSL for console proxy', 'false', 0);
+
+-- CLOUDSTACK-9859: Retirement of midonet plugin (final removal) 
+delete from `cloud`.`configuration` where name in ('midonet.apiserver.address', 'midonet.providerrouter.id');
\ No newline at end of file
diff --git a/tools/eclipse/eclipse.epf b/tools/eclipse/eclipse.epf
index b25d555..6b42098 100644
--- a/tools/eclipse/eclipse.epf
+++ b/tools/eclipse/eclipse.epf
@@ -428,7 +428,7 @@
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-/instance/org.eclipse.wst.sse.core/task-tag-projects-already-scanned=cloud-agent,cloud-api,cloud-apidoc,cloud-cli,cloud-client-ui,cloud-console-proxy,cloud-core,cloud-devcloud,cloud-devcloud-kvm,cloud-developer,cloud-engine,cloud-engine-api,cloud-engine-components-api,cloud-engine-compute,cloud-engine-network,cloud-engine-orchestration,cloud-engine-schema,cloud-engine-service,cloud-engine-storage,cloud-engine-storage-backup,cloud-engine-storage-image,cloud-engine-storage-imagemotion,clou [...]
+/instance/org.eclipse.wst.sse.core/task-tag-projects-already-scanned=cloud-agent,cloud-api,cloud-apidoc,cloud-cli,cloud-client-ui,cloud-console-proxy,cloud-core,cloud-devcloud,cloud-devcloud-kvm,cloud-developer,cloud-engine,cloud-engine-api,cloud-engine-components-api,cloud-engine-compute,cloud-engine-network,cloud-engine-orchestration,cloud-engine-schema,cloud-engine-service,cloud-engine-storage,cloud-engine-storage-backup,cloud-engine-storage-image,cloud-engine-storage-imagemotion,clou [...]
 /instance/org.eclipse.jdt.debug.ui/org.eclipse.debug.ui.ExpressionView.org.eclipse.jdt.debug.ui.show_null_entries=true
 /instance/org.eclipse.jdt.ui/sp_cleanup.correct_indentation=false
 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.format_source_code=true
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index d13e35f..aa71364 100755
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -6150,127 +6150,6 @@
                         }
                     },
 
-
-                    // MidoNet provider detailView
-                    midoNet: {
-                        id: 'midoNet',
-                        label: 'label.midoNet',
-                        isMaximized: true,
-                        type: 'detailView',
-                        fields: {
-                            name: {
-                                label: 'label.name'
-                            },
-                            //ipaddress: { label: 'label.ip.address' },
-                            state: {
-                                label: 'label.status',
-                                indicator: {
-                                    'Enabled': 'on'
-                                }
-                            }
-                        },
-                        tabs: {
-                            details: {
-                                title: 'label.network',
-                                fields:[ {
-                                    name: {
-                                        label: 'label.name'
-                                    }
-                                },
-                                {
-                                    id: {
-                                        label: 'label.id'
-                                    },
-                                    state: {
-                                        label: 'label.state'
-                                    },
-                                    physicalnetworkid: {
-                                        label: 'label.physical.network.ID'
-                                    },
-                                    destinationphysicalnetworkid: {
-                                        label: 'label.destination.physical.network.id'
-                                    },
-                                    supportedServices: {
-                                        label: 'label.supported.services'
-                                    }
-                                }],
-                                dataProvider: function (args) {
-                                    refreshNspData("MidoNet");
-                                    args.response.success({
-                                        actionFilter: virtualRouterProviderActionFilter,
-                                        data: $.extend(nspMap[ "midoNet"], {
-                                            supportedServices: nspMap[ "midoNet"].servicelist.join(', ')
-                                        })
-                                    });
-                                }
-                            }
-                        },
-                        actions: {
-                            enable: {
-                                label: 'label.enable.provider',
-                                action: function (args) {
-                                    $.ajax({
-                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "midoNet"].id + "&state=Enabled"),
-                                        dataType: "json",
-                                        success: function (json) {
-                                            var jid = json.updatenetworkserviceproviderresponse.jobid;
-                                            args.response.success({
-                                                _custom: {
-                                                    jobId: jid,
-                                                    getUpdatedItem: function (json) {
-                                                        $(window).trigger('cloudStack.fullRefresh');
-                                                    }
-                                                }
-                                            });
-                                        }
-                                    });
-                                },
-                                messages: {
-                                    confirm: function (args) {
-                                        return 'message.confirm.enable.provider';
-                                    },
-                                    notification: function () {
-                                        return 'label.enable.provider';
-                                    }
-                                },
-                                notification: {
-                                    poll: pollAsyncJobResult
-                                }
-                            },
-                            disable: {
-                                label: 'label.disable.provider',
-                                action: function (args) {
-                                    $.ajax({
-                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "midoNet"].id + "&state=Disabled"),
-                                        dataType: "json",
-                                        success: function (json) {
-                                            var jid = json.updatenetworkserviceproviderresponse.jobid;
-                                            args.response.success({
-                                                _custom: {
-                                                    jobId: jid,
-                                                    getUpdatedItem: function (json) {
-                                                        $(window).trigger('cloudStack.fullRefresh');
-                                                    }
-                                                }
-                                            });
-                                        }
-                                    });
-                                },
-                                messages: {
-                                    confirm: function (args) {
-                                        return 'message.confirm.disable.provider';
-                                    },
-                                    notification: function () {
-                                        return 'label.disable.provider';
-                                    }
-                                },
-                                notification: {
-                                    poll: pollAsyncJobResult
-                                }
-                            }
-                        }
-                    },
-
                     //ovs
                     Ovs: {
                         id: 'ovsProviders',
@@ -22001,9 +21880,6 @@
                             case "Netscaler":
                             nspMap[ "netscaler"] = items[i];
                             break;
-                            case "MidoNet":
-                            nspMap[ "midoNet"] = items[i];
-                            break;
                             case "BaremetalDhcpProvider":
                             nspMap[ "BaremetalDhcpProvider"] = items[i];
                             break;
@@ -22104,12 +21980,6 @@
             });
         } else if (selectedZoneObj.networktype == "Advanced") {
             nspHardcodingArray.push({
-                id: 'midoNet',
-                name: 'MidoNet',
-                state: nspMap.midoNet ? nspMap.midoNet.state: 'Disabled'
-            });
-
-            nspHardcodingArray.push({
                 id: 'nuageVsp',
                 name: 'Nuage Vsp',
                 state: nspMap.nuageVsp ? nspMap.nuageVsp.state : 'Disabled'

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].