Merge remote-tracking branch 'origin/master' into dev/murrelet

Change-Id: I812d93758f6022d4a0e8eec2bb9c3789c3e4e274
diff --git a/apps/config/src/main/java/org/onosproject/config/FailedException.java b/apps/config/src/main/java/org/onosproject/config/FailedException.java
index fcd2847..0115c33 100644
--- a/apps/config/src/main/java/org/onosproject/config/FailedException.java
+++ b/apps/config/src/main/java/org/onosproject/config/FailedException.java
@@ -38,4 +38,14 @@
     public FailedException(String message) {
         super(message);
     }
+
+    /**
+     * Constructs a new runtime exception with the given error message.
+     *
+     * @param message error message
+     * @param cause cause
+     */
+    public FailedException(String message, Throwable cause) {
+        super(message, cause);
+    }
 }
\ No newline at end of file
diff --git a/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java b/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
index 8a84f06..7c73922 100644
--- a/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
+++ b/apps/config/src/main/java/org/onosproject/config/impl/DistributedDynamicConfigStore.java
@@ -125,19 +125,18 @@
     @Override
     public CompletableFuture<Boolean>
     addNode(ResourceId complete, DataNode node) {
-        CompletableFuture<Boolean> eventFuture = CompletableFuture.completedFuture(true);
         String spath = ResourceIdParser.parseResId(complete);
         if (spath == null) {
             throw new FailedException("Invalid RsourceId, cannot create Node");
         }
-        if (spath.compareTo(ResourceIdParser.ROOT) != 0) {
+        if (!spath.equals(ResourceIdParser.ROOT)) {
             if (completeVersioned(keystore.get(DocumentPath.from(spath))) == null) {
-                throw new FailedException("Node or parent doesnot exist");
+                throw new FailedException("Node or parent does not exist for " + spath);
             }
         }
         spath = ResourceIdParser.appendNodeKey(spath, node.key());
         parseNode(spath, node);
-        return eventFuture;
+        return CompletableFuture.completedFuture(true);
     }
 
     private void parseNode(String path, DataNode node) {
@@ -215,8 +214,9 @@
         CompletableFuture<Versioned<DataNode.Type>> ret = keystore.get(dpath);
         type = completeVersioned(ret);
         if (type == null) {
-            throw new FailedException("Requested node or some of the parents" +
-                                              "are not present in the requested path");
+            throw new FailedException("Requested node or some of the parents " +
+                                      "are not present in the requested path: " +
+                                      spath);
         }
         DataNode retVal = null;
         if (type == DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE) {
@@ -486,20 +486,15 @@
             return future.get();
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
-            if (e == null) {
-                throw new FailedException("Unknown Exception");
-            } else {
-                throw new FailedException(e.getCause().getMessage());
-            }
+            throw new FailedException(e.getCause().getMessage());
         } catch (ExecutionException e) {
-            if (e == null) {
-                throw new FailedException("Unknown Exception");
-            } else if (e.getCause() instanceof IllegalDocumentModificationException) {
-                throw new FailedException("Node or parent doesnot exist or is root or is not a Leaf Node");
+            if (e.getCause() instanceof IllegalDocumentModificationException) {
+                throw new FailedException("Node or parent doesnot exist or is root or is not a Leaf Node",
+                                          e.getCause());
             } else if (e.getCause() instanceof NoSuchDocumentPathException) {
-                throw new FailedException("Resource id does not exist");
+                throw new FailedException("Resource id does not exist", e.getCause());
             } else {
-                throw new FailedException("Datastore operation failed");
+                throw new FailedException("Datastore operation failed", e.getCause());
             }
         }
     }
diff --git a/apps/config/src/main/java/org/onosproject/d/config/DeviceResourceIds.java b/apps/config/src/main/java/org/onosproject/d/config/DeviceResourceIds.java
index a49c6fc..605ae63 100644
--- a/apps/config/src/main/java/org/onosproject/d/config/DeviceResourceIds.java
+++ b/apps/config/src/main/java/org/onosproject/d/config/DeviceResourceIds.java
@@ -68,6 +68,12 @@
             .addBranchPointSchema(ROOT_NAME, DCS_NAMESPACE)
             .build();
 
+    public static final ResourceId DEVICES_ID = ResourceId.builder()
+            .addBranchPointSchema(ROOT_NAME, DCS_NAMESPACE)
+            .addBranchPointSchema(DEVICES_NAME, DCS_NAMESPACE)
+            .build();
+
+
     static final NodeKey<?> ROOT_NODE =
             NodeKey.builder().schemaId(ROOT_NAME, DCS_NAMESPACE).build();
 
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
index 0df73e4..f3835c0 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
@@ -196,10 +196,14 @@
         // TODO: currently we pick up first DHCP server config.
         // Will use other server configs in the future for HA.
         DhcpServerConfig serverConfig = configs.iterator().next();
-        checkState(serverConfig.getDhcpServerConnectPoint().isPresent(),
-                   "Connect point not exists");
-        checkState(serverConfig.getDhcpServerIp4().isPresent(),
-                   "IP of DHCP server not exists");
+        if (!serverConfig.getDhcpServerConnectPoint().isPresent()) {
+            log.warn("Connect point from server config not exists");
+            return;
+        }
+        if (!serverConfig.getDhcpServerIp4().isPresent()) {
+            log.warn("IP from DHCP server config not exists");
+            return;
+        }
         Ip4Address oldServerIp = this.dhcpServerIp;
         Ip4Address oldGatewayIp = this.dhcpGatewayIp;
 
diff --git a/apps/openstacknetworkingui/BUCK b/apps/openstacknetworkingui/BUCK
new file mode 100644
index 0000000..d077328
--- /dev/null
+++ b/apps/openstacknetworkingui/BUCK
@@ -0,0 +1,34 @@
+COMPILE_DEPS = [
+  '//lib:CORE_DEPS',
+  '//lib:JACKSON',
+  '//core/store/serializers:onos-core-serializers',
+  '//lib:javax.ws.rs-api',
+  '//utils/rest:onlab-rest',
+  '//lib:jersey-client',
+  '//cli:onos-cli',
+  '//lib:org.apache.karaf.shell.console',
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+    '//core/common:onos-core-common-tests',
+]
+
+osgi_jar_with_tests (
+  deps = COMPILE_DEPS,
+  test_deps = TEST_DEPS,
+  web_context = '/onos/openstacknetworkingui',
+  api_title = 'OpenStack Networking UI REST API',
+  api_version = '0.9',
+  api_description = 'OpenStack Networking UI REST API',
+  api_package = 'org.onosproject.openstacknetworkingui.web',
+)
+
+onos_app (
+  app_name = 'org.onosproject.openstacknetworkingui',
+  title = 'Openstack Networking UI',
+  category = 'Utility',
+  url = 'http://onosproject.org',
+  description = 'Openstack Networking UI Service',
+)
diff --git a/apps/openstacknetworkingui/pom.xml b/apps/openstacknetworkingui/pom.xml
new file mode 100644
index 0000000..de9d24b
--- /dev/null
+++ b/apps/openstacknetworkingui/pom.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2017 Open Networking Laboratory
+  ~
+  ~ Licensed 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>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-apps</artifactId>
+        <version>1.12.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-apps-openstacknetworkingui</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>OpenStack Networking UI Service</description>
+    <url>http://onosproject.org</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <onos.app.name>org.onosproject.openstacknetworkingui</onos.app.name>
+        <onos.app.title>OpenStack Networking UI Service</onos.app.title>
+        <onos.app.category>UI</onos.app.category>
+        <onos.app.url>http://onosproject.org</onos.app.url>
+        <onos.app.readme>OpenStack Networking UI Application</onos.app.readme>
+        <web.context>/onos/openstacknetworkingui</web.context>
+        <api.version>1.0.0</api.version>
+        <api.title>OpenStack Networking UI REST API</api.title>
+        <api.description>
+            APIs for interacting with OpenStack Networking Monitoring server.
+        </api.description>
+        <api.package>org.onosproject.openstacknetworkingui.web</api.package>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-osgi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-cli</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.9.12</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.containers</groupId>
+            <artifactId>jersey-container-servlet</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-client</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-common</artifactId>
+            <version>2.25</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp/</_wab>
+                        <Include-Resource>
+                            WEB-INF/classes/apidoc/swagger.json=target/swagger.json,
+                            {maven-resources}
+                        </Include-Resource>
+                        <Bundle-SymbolicName>
+                            ${project.groupId}.${project.artifactId}
+                        </Bundle-SymbolicName>
+                        <Import-Package>
+                            *,org.glassfish.jersey.servlet
+                        </Import-Package>
+                        <Web-ContextPath>${web.context}</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+
+
+</project>
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLink.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLink.java
new file mode 100644
index 0000000..7da4402
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLink.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
+
+import org.onosproject.ui.topo.BiLink;
+import org.onosproject.ui.topo.LinkHighlight;
+import org.onosproject.ui.topo.Mod;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.onosproject.ui.topo.LinkHighlight.Flavor.SECONDARY_HIGHLIGHT;
+
+/**
+ * Link for OpenStack Networking UI service.
+ */
+public class OpenstackLink extends BiLink {
+
+    private static final Mod PORT_TRAFFIC_GREEN = new Mod("port-traffic-green");
+    private static final Mod PORT_TRAFFIC_ORANGE = new Mod("port-traffic-orange");
+
+    public OpenstackLink(LinkKey key, Link link) {
+        super(key, link);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof OpenstackLink) {
+            OpenstackLink that = (OpenstackLink) obj;
+            if (Objects.equals(linkId(), that.linkId())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(linkId());
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("linkId", linkId())
+                .add("link src", one().src().deviceId())
+                .add("link dst", one().dst().deviceId())
+                .toString();
+    }
+
+    @Override
+    public LinkHighlight highlight(Enum<?> type) {
+        RequestType requestType = (RequestType) type;
+
+        Mod m = null;
+
+        switch (requestType) {
+            case HOST_SELECTED:
+                m = PORT_TRAFFIC_GREEN;
+                break;
+            case DEVICE_SELECTED:
+                m = PORT_TRAFFIC_ORANGE;
+                break;
+            default:
+                break;
+        }
+        LinkHighlight hlite = new LinkHighlight(linkId(), SECONDARY_HIGHLIGHT);
+        if (m != null) {
+            hlite.addMod(m);
+        }
+
+        return hlite;
+    }
+
+    /**
+     * Designates requested type.
+     */
+    public enum RequestType {
+        HOST_SELECTED,
+        DEVICE_SELECTED,
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLinkMap.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLinkMap.java
new file mode 100644
index 0000000..7086b4c
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackLinkMap.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import org.onosproject.net.Link;
+import org.onosproject.net.LinkKey;
+import org.onosproject.ui.topo.BiLinkMap;
+
+/**
+ * Link for OpenStack Networking UI service.
+ */
+public class OpenstackLinkMap extends BiLinkMap<OpenstackLink> {
+    @Override
+    protected OpenstackLink create(LinkKey linkKey, Link link) {
+        return new OpenstackLink(linkKey, link);
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiManager.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiManager.java
new file mode 100644
index 0000000..daeebec
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiManager.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Streams;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.driver.DriverService;
+import org.onosproject.net.link.DefaultLinkDescription;
+import org.onosproject.net.link.LinkDescription;
+import org.onosproject.net.link.LinkStore;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.ui.UiExtension;
+import org.onosproject.ui.UiExtensionService;
+import org.onosproject.ui.UiMessageHandlerFactory;
+import org.onosproject.ui.UiTopoOverlayFactory;
+import org.onosproject.ui.UiView;
+import org.onosproject.ui.UiViewHidden;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onosproject.net.Link.Type;
+
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Implementation of OpenStack Networking UI service.
+ */
+@Service
+@Component(immediate = true)
+public class OpenstackNetworkingUiManager implements OpenstackNetworkingUiService {
+
+    private static final ClassLoader CL = OpenstackNetworkingUiManager.class.getClassLoader();
+    private static final String VIEW_ID = "sonaTopov";
+    private static final String PORT_NAME = "portName";
+    private static final String VXLAN = "vxlan";
+    private static final String OVS = "ovs";
+    private static final String APP_ID = "org.onosproject.openstacknetworkingui";
+    private static final String SONA_GUI = "sonagui";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected UiExtensionService uiExtensionService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DriverService driverService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkStore linkStore;
+    Set<Device> vDevices;
+
+    private OpenstackNetworkingUiMessageHandler messageHandler = new OpenstackNetworkingUiMessageHandler();
+
+    private final List<UiView> uiViews = ImmutableList.of(
+            new UiViewHidden(VIEW_ID)
+    );
+
+
+    private final UiMessageHandlerFactory messageHandlerFactory =
+            () -> ImmutableList.of(messageHandler);
+
+    private final UiTopoOverlayFactory topoOverlayFactory =
+            () -> ImmutableList.of(new OpenstackNetworkingUiOverlay());
+
+    protected UiExtension extension =
+            new UiExtension.Builder(CL, uiViews)
+                    .resourcePath(VIEW_ID)
+                    .messageHandlerFactory(messageHandlerFactory)
+                    .topoOverlayFactory(topoOverlayFactory)
+                    .build();
+
+    @Activate
+    protected void activate() {
+        uiExtensionService.register(extension);
+
+        vDevices = Streams.stream(deviceService.getAvailableDevices())
+                .filter(this::isVirtualDevice)
+                .collect(Collectors.toSet());
+
+        vDevices.forEach(this::createLinksConnectedToTargetvDevice);
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        uiExtensionService.unregister(extension);
+        log.info("Stopped");
+    }
+
+    @Override
+    public void sendMessage(String type, ObjectNode payload) {
+        messageHandler.sendMessagetoUi(type, payload);
+    }
+
+    @Override
+    public void setRestServerIp(String ipAddress) {
+        messageHandler.setRestUrl(ipAddress);
+    }
+
+    @Override
+    public String restServerUrl() {
+        return messageHandler.restUrl();
+    }
+
+    @Override
+    public void setRestServerAuthInfo(String id, String password) {
+        messageHandler.setRestAuthInfo(id, password);
+    }
+
+    @Override
+    public String restServerAuthInfo() {
+        return messageHandler.restAuthInfo();
+    }
+
+
+    private Optional<Port> vxlanPort(DeviceId deviceId) {
+        return deviceService.getPorts(deviceId)
+                .stream()
+                .filter(port -> port.annotations().value(PORT_NAME).equals(VXLAN))
+                .findAny();
+    }
+    private boolean isVirtualDevice(Device device) {
+        return driverService.getDriver(device.id()).name().equals(OVS);
+    }
+
+    private void createLinksConnectedToTargetvDevice(Device targetvDevice) {
+        vDevices.stream().filter(d -> !d.equals(targetvDevice))
+                .forEach(device -> {
+                    if (vxlanPort(targetvDevice.id()).isPresent() && vxlanPort(device.id()).isPresent()) {
+                        ConnectPoint srcConnectPoint = createConnectPoint(targetvDevice.id());
+
+                        ConnectPoint dstConnectPoint = createConnectPoint(device.id());
+
+                        LinkDescription linkDescription = createLinkDescription(srcConnectPoint, dstConnectPoint);
+
+                        linkStore.createOrUpdateLink(new ProviderId(SONA_GUI, APP_ID),
+                                linkDescription);
+                    }
+                });
+    }
+
+    private ConnectPoint createConnectPoint(DeviceId deviceId) {
+        try {
+            return new ConnectPoint(deviceId, vxlanPort(deviceId).get().number());
+        } catch (NoSuchElementException exception) {
+            log.warn("Exception occured because of {}", exception.toString());
+            return null;
+        }
+    }
+
+    private LinkDescription createLinkDescription(ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
+        return new DefaultLinkDescription(srcConnectPoint, dstConnectPoint, Type.DIRECT, true);
+    }
+
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiMessageHandler.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiMessageHandler.java
new file mode 100644
index 0000000..0e8b781
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiMessageHandler.java
@@ -0,0 +1,452 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.common.collect.Streams;
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Element;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.Path;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.host.HostService;
+import org.onosproject.net.topology.PathService;
+import org.onosproject.ui.JsonUtils;
+import org.onosproject.ui.RequestHandler;
+import org.onosproject.ui.UiConnection;
+import org.onosproject.ui.UiMessageHandler;
+import org.apache.commons.io.IOUtils;
+
+import org.onosproject.ui.topo.Highlights;
+import org.onosproject.ui.topo.HostHighlight;
+import org.onosproject.ui.topo.NodeBadge;
+import org.onosproject.ui.topo.NodeBadge.Status;
+import org.onosproject.ui.topo.TopoJson;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+
+import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
+
+/**
+ * OpenStack Networking UI message handler.
+ */
+public class OpenstackNetworkingUiMessageHandler extends UiMessageHandler {
+
+    private static final String OPENSTACK_NETWORKING_UI_START = "openstackNetworkingUiStart";
+    private static final String OPENSTACK_NETWORKING_UI_UPDATE = "openstackNetworkingUiUpdate";
+    private static final String OPENSTACK_NETWORKING_UI_STOP = "openstackNetworkingUiStop";
+    private static final String ANNOTATION_NETWORK_ID = "networkId";
+    private static final String FLOW_TRACE_REQUEST = "flowTraceRequest";
+    private static final String SRC_IP = "srcIp";
+    private static final String DST_IP = "dstIp";
+    private static final String ANNOTATION_SEGMENT_ID = "segId";
+    private static final String AUTHORIZATION = "Authorization";
+    private static final String COMMAND = "command";
+    private static final String FLOW_TRACE = "flowtrace";
+    private static final String REVERSE = "reverse";
+    private static final String TRANSACTION_ID = "transaction_id";
+    private static final String TRANSACTION_VALUE = "sona";
+    private static final String APP_REST_URL = "app_rest_url";
+    private static final String MATCHING_FIELDS = "matchingfields";
+    private static final String SOURCE_IP = "source_ip";
+    private static final String DESTINATION_IP = "destination_ip";
+    private static final String TO_GATEWAY = "to_gateway";
+    private static final String IP_PROTOCOL = "ip_protocol";
+    private static final String HTTP = "http://";
+    private static final String OPENSTACK_NETWORKING_UI_RESULT = ":8181/onos/openstacknetworkingui/result";
+
+    private static final String ID = "id";
+    private static final String MODE = "mode";
+    private static final String MOUSE = "mouse";
+
+    private enum Mode { IDLE, MOUSE }
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private DeviceService deviceService;
+    private HostService hostService;
+    private PathService pathService;
+    private ClusterService clusterService;
+    private String restUrl;
+    private String restAuthInfo;
+    private Mode currentMode = Mode.IDLE;
+    private Element elementOfNote;
+    private final Client client = ClientBuilder.newClient();
+
+
+    // ===============-=-=-=-=-=-======================-=-=-=-=-=-=-================================
+
+
+    @Override
+    public void init(UiConnection connection, ServiceDirectory directory) {
+        super.init(connection, directory);
+        deviceService = directory.get(DeviceService.class);
+        hostService = directory.get(HostService.class);
+        pathService = directory.get(PathService.class);
+        clusterService = directory.get(ClusterService.class);
+    }
+
+    @Override
+    protected Collection<RequestHandler> createRequestHandlers() {
+        return ImmutableSet.of(
+                new DisplayStartHandler(),
+                new DisplayUpdateHandler(),
+                new DisplayStopHandler(),
+                new FlowTraceRequestHandler()
+        );
+    }
+
+    public void setRestUrl(String ipAddress) {
+        restUrl = "http://" + ipAddress + ":8000/trace_request";
+    }
+
+    public String restUrl() {
+        return restUrl;
+    }
+
+    public void setRestAuthInfo(String id, String password) {
+        restAuthInfo = Base64.getEncoder().encodeToString(id.concat(":").concat(password).getBytes());
+    }
+
+    public String restAuthInfo() {
+        return restAuthInfo;
+    }
+
+    private final class DisplayStartHandler extends RequestHandler {
+
+        public DisplayStartHandler() {
+            super(OPENSTACK_NETWORKING_UI_START);
+        }
+
+        @Override
+        public void process(ObjectNode payload) {
+            String mode = string(payload, MODE);
+
+            log.debug("Start Display: mode [{}]", mode);
+            clearState();
+            clearForMode();
+
+            switch (mode) {
+                case MOUSE:
+                    currentMode = Mode.MOUSE;
+                    sendMouseData();
+                    break;
+
+                default:
+                    currentMode = Mode.IDLE;
+                    break;
+            }
+        }
+    }
+
+    private final class FlowTraceRequestHandler extends RequestHandler {
+        public FlowTraceRequestHandler() {
+            super(FLOW_TRACE_REQUEST);
+        }
+
+        @Override
+        public void process(ObjectNode payload) {
+            String srcIp = string(payload, SRC_IP);
+            String dstIp = string(payload, DST_IP);
+            log.debug("SendEvent called with src IP: {}, dst IP: {}", srcIp, dstIp);
+
+            ObjectNode objectNode = getFlowTraceRequestAsJson(srcIp, dstIp);
+            InputStream byteArrayInputStream
+                    = new ByteArrayInputStream(objectNode.toString().getBytes());
+
+            Invocation.Builder builder = getClientBuilder(restUrl);
+
+            if (builder == null) {
+                log.error("Fail to get the client builder for the trace from {} to {}", srcIp, dstIp);
+                return;
+            }
+
+            try {
+                Response response = builder.header(AUTHORIZATION, restAuthInfo.toString())
+                        .post(Entity.entity(IOUtils.toString(byteArrayInputStream, StandardCharsets.UTF_8),
+                                MediaType.APPLICATION_JSON_TYPE));
+
+                log.debug("Response from server: {}", response);
+
+                if (response.getStatus() != 200) {
+                    log.error("FlowTraceRequest failed because of {}", response);
+                }
+
+            } catch (IOException e) {
+                log.error("Exception occured because of {}", e.toString());
+            }
+
+        }
+    }
+
+    private ObjectNode getFlowTraceRequestAsJson(String srcIp, String dstIp) {
+        ObjectMapper mapper = new ObjectMapper();
+        String controllerUrl = HTTP + clusterService.getLocalNode().ip()
+                + OPENSTACK_NETWORKING_UI_RESULT;
+
+        ObjectNode objectNode = mapper.createObjectNode();
+
+        objectNode.put(COMMAND, FLOW_TRACE)
+                .put(REVERSE, false)
+                .put(TRANSACTION_ID, TRANSACTION_VALUE)
+                .put(APP_REST_URL, controllerUrl);
+
+        if (srcIp.equals(dstIp)) {
+            objectNode.putObject(MATCHING_FIELDS)
+                    .put(SOURCE_IP, srcIp)
+                    .put(DESTINATION_IP, dstIp)
+                    .put(TO_GATEWAY, true)
+                    .put(IP_PROTOCOL, 1);
+
+        } else {
+            objectNode.putObject(MATCHING_FIELDS)
+                    .put(SOURCE_IP, srcIp)
+                    .put(DESTINATION_IP, dstIp);
+        }
+        return  objectNode;
+    }
+
+    private Invocation.Builder getClientBuilder(String url) {
+        if (Strings.isNullOrEmpty(url)) {
+            log.warn("URL in not set");
+            return null;
+        }
+
+        WebTarget wt = client.target(url);
+
+        return wt.request(MediaType.APPLICATION_JSON_TYPE);
+    }
+
+    private final class DisplayUpdateHandler extends RequestHandler {
+        public DisplayUpdateHandler() {
+            super(OPENSTACK_NETWORKING_UI_UPDATE);
+        }
+
+        @Override
+        public void process(ObjectNode payload) {
+            String id = string(payload, ID);
+            log.debug("Update Display: id [{}]", id);
+            if (!Strings.isNullOrEmpty(id)) {
+                updateForMode(id);
+            } else {
+                clearForMode();
+            }
+        }
+    }
+
+    private final class DisplayStopHandler extends RequestHandler {
+        public DisplayStopHandler() {
+            super(OPENSTACK_NETWORKING_UI_STOP);
+        }
+
+        @Override
+        public void process(ObjectNode payload) {
+            log.debug("Stop Display");
+            clearState();
+            clearForMode();
+        }
+    }
+
+    // === ------------
+
+    private void clearState() {
+        currentMode = Mode.IDLE;
+        elementOfNote = null;
+    }
+
+    private void updateForMode(String id) {
+
+        try {
+            HostId hid = HostId.hostId(id);
+            elementOfNote = hostService.getHost(hid);
+
+        } catch (Exception e) {
+            try {
+                DeviceId did = DeviceId.deviceId(id);
+                elementOfNote = deviceService.getDevice(did);
+
+            } catch (Exception e2) {
+                log.debug("Unable to process ID [{}]", id);
+                elementOfNote = null;
+            }
+        }
+
+        switch (currentMode) {
+            case MOUSE:
+                sendMouseData();
+                break;
+
+            default:
+                break;
+        }
+
+    }
+
+    private void clearForMode() {
+        sendHighlights(new Highlights());
+    }
+
+    private void sendHighlights(Highlights highlights) {
+        sendMessage(TopoJson.highlightsMessage(highlights));
+    }
+
+    public void sendMessagetoUi(String type, ObjectNode payload) {
+        sendMessage(JsonUtils.envelope(type, payload));
+    }
+
+    private int getVni(Host host) {
+        String vni = host.annotations().value(ANNOTATION_SEGMENT_ID);
+
+        return vni == null ? 0 : Integer.valueOf(vni).intValue();
+    }
+
+    private void sendMouseData() {
+        Highlights highlights = new Highlights();
+
+        if (elementOfNote != null && elementOfNote instanceof Device) {
+            DeviceId deviceId = (DeviceId) elementOfNote.id();
+
+            List<OpenstackLink> edgeLinks = edgeLinks(deviceId);
+
+            edgeLinks.forEach(edgeLink -> {
+                highlights.add(edgeLink.highlight(OpenstackLink.RequestType.DEVICE_SELECTED));
+            });
+
+            hostService.getConnectedHosts(deviceId).forEach(host -> {
+                HostHighlight hostHighlight = new HostHighlight(host.id().toString());
+                hostHighlight.setBadge(createBadge(getVni(host)));
+                highlights.add(hostHighlight);
+            });
+
+            sendHighlights(highlights);
+
+        } else if (elementOfNote != null && elementOfNote instanceof Host) {
+
+            HostId hostId = HostId.hostId(elementOfNote.id().toString());
+            if (!hostMadeFromOpenstack(hostId)) {
+                return;
+            }
+
+            List<OpenstackLink> openstackLinks = linksInSameNetwork(hostId);
+
+            openstackLinks.forEach(openstackLink -> {
+                highlights.add(openstackLink.highlight(OpenstackLink.RequestType.HOST_SELECTED));
+            });
+
+            hostHighlightsInSameNetwork(hostId).forEach(highlights::add);
+
+            sendHighlights(highlights);
+
+        }
+    }
+
+    private boolean hostMadeFromOpenstack(HostId hostId) {
+        return hostService.getHost(hostId).annotations()
+                .value(ANNOTATION_NETWORK_ID) == null ? false : true;
+    }
+
+    private String networkId(HostId hostId) {
+        return hostService.getHost(hostId).annotations().value(ANNOTATION_NETWORK_ID);
+    }
+
+    private Set<HostHighlight> hostHighlightsInSameNetwork(HostId hostId) {
+
+        Set<HostHighlight> hostHighlights = Sets.newHashSet();
+        Streams.stream(hostService.getHosts())
+                .filter(host -> isHostInSameNetwork(host, networkId(hostId)))
+                .forEach(host -> {
+                    HostHighlight hostHighlight = new HostHighlight(host.id().toString());
+                    hostHighlight.setBadge(createBadge(getVni(host)));
+                    hostHighlights.add(hostHighlight);
+                });
+
+        return hostHighlights;
+    }
+
+    private List<OpenstackLink> edgeLinks(DeviceId deviceId) {
+        OpenstackLinkMap openstackLinkMap = new OpenstackLinkMap();
+
+        hostService.getConnectedHosts(deviceId).forEach(host -> {
+            openstackLinkMap.add(createEdgeLink(host, true));
+            openstackLinkMap.add(createEdgeLink(host, false));
+        });
+
+        List<OpenstackLink> edgeLinks = Lists.newArrayList();
+
+        openstackLinkMap.biLinks().forEach(edgeLinks::add);
+
+        return edgeLinks;
+    }
+
+    private List<OpenstackLink> linksInSameNetwork(HostId hostId) {
+        OpenstackLinkMap linkMap = new OpenstackLinkMap();
+
+        Streams.stream(hostService.getHosts())
+                .filter(host -> isHostInSameNetwork(host, networkId(hostId)))
+                .forEach(host -> {
+                    linkMap.add(createEdgeLink(host, true));
+                    linkMap.add(createEdgeLink(host, false));
+
+                    Set<Path> paths = pathService.getPaths(hostId,
+                            host.id());
+
+                    if (!paths.isEmpty()) {
+                        paths.forEach(path -> path.links().forEach(linkMap::add));
+                    }
+                });
+
+        List<OpenstackLink> openstackLinks = Lists.newArrayList();
+
+        linkMap.biLinks().forEach(openstackLinks::add);
+
+        return openstackLinks;
+    }
+
+    private boolean isHostInSameNetwork(Host host, String networkId) {
+        return hostService.getHost(host.id()).annotations()
+                .value(ANNOTATION_NETWORK_ID).equals(networkId);
+    }
+
+    private NodeBadge createBadge(int n) {
+        return NodeBadge.number(Status.INFO, n, "Openstack Node");
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiOverlay.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiOverlay.java
new file mode 100644
index 0000000..8ad477c
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiOverlay.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import org.onlab.osgi.DefaultServiceDirectory;
+import org.onosproject.net.HostId;
+import org.onosproject.net.host.HostService;
+import org.onosproject.ui.UiTopoOverlay;
+import org.onosproject.ui.topo.ButtonId;
+import org.onosproject.ui.topo.PropertyPanel;
+
+import static org.onosproject.ui.topo.TopoConstants.Properties.INTENTS;
+import static org.onosproject.ui.topo.TopoConstants.Properties.TOPOLOGY_SSCS;
+import static org.onosproject.ui.topo.TopoConstants.Properties.TUNNELS;
+import static org.onosproject.ui.topo.TopoConstants.Properties.VERSION;
+import static org.onosproject.ui.topo.TopoConstants.Properties.VLAN;
+
+/**
+ * Topology overlay for OpenStack Networking UI.
+ */
+public class OpenstackNetworkingUiOverlay extends UiTopoOverlay {
+    private static final String OVERLAY_ID = "sona-overlay";
+    private static final String SONA = "SONA";
+    private static final String SUMMARY_TITLE = "OpenStack Networking UI";
+    private static final String SUMMARY_VERSION = "0.9";
+    private static final String VNI = "VNI";
+    private static final String ANNOTATION_SEGMENT_ID = "segId";
+
+    private static final String NOT_AVAILABLE = "N/A";
+
+    private static final ButtonId FLOW_TRACE_BUTTON = new ButtonId("flowtrace");
+    private static final ButtonId RESET_BUTTON = new ButtonId("reset");
+    private static final ButtonId TO_GATEWAY_BUTTON = new ButtonId("toGateway");
+    private static final ButtonId TO_EXTERNAL_BUTTON = new ButtonId("toExternal");
+
+    private final HostService hostService = DefaultServiceDirectory.getService(HostService.class);
+
+    public OpenstackNetworkingUiOverlay() {
+        super(OVERLAY_ID);
+    }
+
+
+    @Override
+    public void modifySummary(PropertyPanel pp) {
+        pp.title(SUMMARY_TITLE)
+                .removeProps(
+                        TOPOLOGY_SSCS,
+                        INTENTS,
+                        TUNNELS,
+                        VERSION
+                )
+                .addProp(SONA, VERSION, SUMMARY_VERSION);
+    }
+
+    @Override
+    public void modifyHostDetails(PropertyPanel pp, HostId hostId) {
+        String vni = hostService.getHost(hostId).annotations().value(ANNOTATION_SEGMENT_ID);
+
+        pp.removeProps(VLAN);
+        pp.addProp(SONA, VNI, vni == null ? NOT_AVAILABLE : vni)
+                .addButton(FLOW_TRACE_BUTTON)
+                .addButton(RESET_BUTTON)
+                .addButton(TO_GATEWAY_BUTTON)
+                .addButton(TO_EXTERNAL_BUTTON);
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiService.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiService.java
new file mode 100644
index 0000000..aea9763
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/OpenstackNetworkingUiService.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Service for OpenStack Networking UI.
+ */
+public interface OpenstackNetworkingUiService {
+
+    /**
+     * Sends message to OpenStack Networking UI.
+     *
+     * @param type event type
+     * @param payload payload
+     */
+    void sendMessage(String type, ObjectNode payload);
+
+    /**
+     * Sets the REST server ip address.
+     *
+     * @param ipAddress rest server ip address
+     */
+    void setRestServerIp(String ipAddress);
+
+    /**
+     * Gets the REST server url.
+     *
+     * @return REST server url
+     */
+    String restServerUrl();
+
+    /**
+     * Sets the REST server authorization information.
+     *
+     * @param id id
+     * @param password password
+     */
+    void setRestServerAuthInfo(String id, String password);
+
+    /**
+     * Gets the REST server authorization information.
+     *
+     * @return REST server authorization information as String
+     */
+    String restServerAuthInfo();
+
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerAuthInfoCommand.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerAuthInfoCommand.java
new file mode 100644
index 0000000..fdaf23d
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerAuthInfoCommand.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.openstacknetworkingui.OpenstackNetworkingUiService;
+
+/**
+ * Gets the REST server authorization information.
+ */
+@Command(scope = "onos", name = "openstacknetworking-ui-get-restserver-auth",
+        description = "Gets the REST server authorization information")
+public class GetRestServerAuthInfoCommand extends AbstractShellCommand {
+
+    @Override
+    protected void execute() {
+        OpenstackNetworkingUiService service = AbstractShellCommand.get(OpenstackNetworkingUiService.class);
+        print("Encoded information for the REST server authorization: %s", service.restServerAuthInfo());
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerCommand.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerCommand.java
new file mode 100644
index 0000000..6cccfa1
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/GetRestServerCommand.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.openstacknetworkingui.OpenstackNetworkingUiService;
+
+/**
+ * Gets the REST server url.
+ */
+
+@Command(scope = "onos", name = "openstacknetworking-ui-get-restserver-url",
+        description = "Gets the REST server url")
+public class GetRestServerCommand extends AbstractShellCommand {
+
+    @Override
+    protected void execute() {
+        OpenstackNetworkingUiService service = AbstractShellCommand.get(OpenstackNetworkingUiService.class);
+        print("REST server url : %s", service.restServerUrl());
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerAuthInfoCommand.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerAuthInfoCommand.java
new file mode 100644
index 0000000..148818c
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerAuthInfoCommand.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.openstacknetworkingui.OpenstackNetworkingUiService;
+
+/**
+ * Sets the REST server authorization information.
+ */
+@Command(scope = "onos", name = "openstacknetworking-ui-set-restserver-auth",
+        description = "Sets the REST server authorization information")
+public class SetRestServerAuthInfoCommand extends AbstractShellCommand {
+
+    @Argument(index = 0, name = "restServerAuthId", description = "REST server authorization id",
+            required = true, multiValued = false)
+    private String restServerAuthId = null;
+
+    @Argument(index = 1, name = "restServerAuthPass", description = "REST server authorization password",
+            required = true, multiValued = false)
+    private String restServerAuthPass = null;
+
+    @Override
+    protected void execute() {
+        OpenstackNetworkingUiService service = AbstractShellCommand.get(OpenstackNetworkingUiService.class);
+        service.setRestServerAuthInfo(restServerAuthId, restServerAuthPass);
+        print("Id and password for the REST server authorization are %s and %s.", restServerAuthId, restServerAuthPass);
+        print("Encoded result as based 64 format: %s", service.restServerAuthInfo());
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerCommand.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerCommand.java
new file mode 100644
index 0000000..f9cef4d
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/SetRestServerCommand.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.openstacknetworkingui.OpenstackNetworkingUiService;
+
+/**
+ * Sets the REST server ip address.
+ */
+@Command(scope = "onos", name = "openstacknetworking-ui-set-restserver-ip",
+        description = "Sets the REST server ip address")
+public class SetRestServerCommand extends AbstractShellCommand {
+
+    @Argument(index = 0, name = "restServerIp", description = "REST server ip address",
+            required = true, multiValued = false)
+    private String restServerIp = null;
+
+    @Override
+    protected void execute() {
+        OpenstackNetworkingUiService service = AbstractShellCommand.get(OpenstackNetworkingUiService.class);
+        service.setRestServerIp(restServerIp);
+        print("The REST server url is set to %s", service.restServerUrl());
+    }
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/package-info.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/package-info.java
new file mode 100644
index 0000000..2a69dda
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/**
+ *  CLI handlers of OpenStack Networking UI service.
+ */
+package org.onosproject.openstacknetworkingui.cli;
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/package-info.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/package-info.java
new file mode 100644
index 0000000..3e08d0b
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/**
+ * OpenStack Networking UI package.
+ */
+package org.onosproject.openstacknetworkingui;
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/FlowTraceWebResource.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/FlowTraceWebResource.java
new file mode 100644
index 0000000..d4fbf28
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/FlowTraceWebResource.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.openstacknetworkingui.web;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.osgi.DefaultServiceDirectory;
+import org.onosproject.openstacknetworkingui.OpenstackNetworkingUiService;
+import org.onosproject.rest.AbstractWebResource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static javax.ws.rs.core.Response.status;
+
+/**
+ * Handles REST API from monitoring server.
+ */
+
+@Path("result")
+public class FlowTraceWebResource extends AbstractWebResource {
+    protected final Logger log = LoggerFactory.getLogger(getClass());
+    private final OpenstackNetworkingUiService uiService =
+            DefaultServiceDirectory.getService(OpenstackNetworkingUiService.class);
+
+    private static final String FLOW_TRACE_RESULT = "flowTraceResult";
+
+    @Context
+    private UriInfo uriInfo;
+
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response flowTraceResponse(InputStream inputStream) throws IOException {
+        try {
+            JsonNode jsonNode = mapper().enable(SerializationFeature.INDENT_OUTPUT).readTree(inputStream);
+            ObjectNode objectNode = jsonNode.deepCopy();
+
+            log.debug("FlowTraceResponse: {}", jsonNode.toString());
+
+            uiService.sendMessage(FLOW_TRACE_RESULT, objectNode);
+
+        } catch (IOException e) {
+            log.error("Exception occured because of {}", e.toString());
+        }
+
+        return status(Response.Status.OK).build();
+    }
+
+}
diff --git a/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/package-info.java b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/package-info.java
new file mode 100644
index 0000000..570f9cf
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/java/org/onosproject/openstacknetworkingui/web/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/**
+ *  Web implementation of OpenStack Networking UI service.
+ */
+package org.onosproject.openstacknetworkingui.web;
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/openstacknetworkingui/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..9e78f63
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,31 @@
+<!--
+~ Copyright 2017-present Open Networking Foundation
+~
+~ Licensed 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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.onosproject.openstacknetworkingui.cli.SetRestServerCommand"/>
+        </command>
+        <command>
+            <action class="org.onosproject.openstacknetworkingui.cli.GetRestServerCommand"/>
+        </command>
+        <command>
+            <action class="org.onosproject.openstacknetworkingui.cli.GetRestServerAuthInfoCommand"/>
+        </command>
+        <command>
+            <action class="org.onosproject.openstacknetworkingui.cli.SetRestServerAuthInfoCommand"/>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.css b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.css
new file mode 100644
index 0000000..11523e1
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.css
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/* css for OpenStack Networking UI.  */
+
+#traceInfoDialogId h2 {
+    text-align: center;
+    width: 200px;
+    margin: 0;
+    font-weight: lighter;
+    word-wrap: break-word;
+    display: inline-block;
+    vertical-align: middle;
+    font-size: 14pt;
+}
+
+div.traceInfo table {
+    border-collapse: collapse;
+    table-layout: fixed;
+    empty-cells: show;
+    margin: 0;
+    width: 200px;
+}
+
+div.traceInfo td {
+    cursor: pointer;
+    font-variant: small-caps;
+
+    font-size: 10pt;
+    padding-top: 14px;
+    padding-bottom: 14px;
+
+    letter-spacing: 0.02em;
+    cursor: pointer;
+
+    color: #3c3a3a;
+    width: 100px;
+}
+
+div.traceInfo td.label {
+    font-weight: bold;
+}
+
+#flowTraceResultDialogId h2 {
+    text-align: center;
+    width: 600px;
+
+    padding: 0 0 0 10px;
+    margin: 0;
+    font-weight: lighter;
+    word-wrap: break-word;
+    display: inline-block;
+    vertical-align: middle;
+}
+
+div.flowTraceResult table {
+    border-collapse: collapse;
+    table-layout: fixed;
+    empty-cells: show;
+    margin: 0;
+    width: 600px;
+}
+
+div.flowTraceResult td {
+    padding: 4px;
+    text-align: center;
+    word-wrap: break-word;
+    font-size: 12pt;
+}
+
+div.flowTraceResult .table-header td {
+    font-weight: bold;
+    font-variant: small-caps;
+    text-transform: uppercase;
+    font-size: 11pt;
+    padding-top: 14px;
+    padding-bottom: 14px;
+
+    letter-spacing: 0.02em;
+    cursor: pointer;
+
+    background-color: #e5e5e6;
+    color: #3c3a3a;
+    width: 120px;
+
+}
+
+div.flowTraceResult .table-body tr:nth-child(even) {
+    background-color: #f4f4f4;
+}
+
+div.flowTraceResult .table-body tr:nth-child(odd) {
+    background-color: #fbfbfb;
+}
+
+div.flowTraceResult .table-body td {
+    cursor: pointer;
+    font-variant: small-caps;
+
+    font-size: 10pt;
+    padding-top: 14px;
+    padding-bottom: 14px;
+
+    letter-spacing: 0.02em;
+    cursor: pointer;
+
+    color: #3c3a3a;
+    width: 120px;
+}
+
+div.flowTraceResult .table-body tr.drop {
+    background-color: #e28d8d;
+}
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.html b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.html
new file mode 100644
index 0000000..8d31977
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopov.html
@@ -0,0 +1,4 @@
+<!-- partial HTML -->
+<div id="ov-sona-topov">
+    <p>This is a hidden view .. just a placeholder to house the javascript</p>
+</div>
diff --git a/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovOverlay.js b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovOverlay.js
new file mode 100644
index 0000000..39517b6
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovOverlay.js
@@ -0,0 +1,220 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/* OpenStack Networking UI Overlay description */
+(function () {
+    'use strict';
+
+    // injected refs
+    var $log, tov, sts, flash, ds, wss;
+    var traceSrc = null;
+    var traceDst = null;
+
+    var traceInfoDialogId = 'traceInfoDialogId',
+        traceInfoDialogOpt = {
+            width: 200,
+            edge: 'left',
+            margin: 20,
+            hideMargin: -20
+        }
+
+       var overlay = {
+        // NOTE: this must match the ID defined in AppUiTopovOverlay
+        overlayId: 'sona-overlay',
+        glyphId: '*star4',
+        tooltip: 'OpenstackNetworking UI',
+
+        glyphs: {
+            star4: {
+                vb: '0 0 8 8',
+                d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
+            },
+            banner: {
+                vb: '0 0 6 6',
+                d: 'M1,1v4l2,-2l2,2v-4z'
+            }
+        },
+
+        activate: function () {
+            $log.debug("OpenstackNetworking UI ACTIVATED");
+        },
+        deactivate: function () {
+            sts.stopDisplay();
+            $log.debug("OpenstackNetworking UI DEACTIVATED");
+        },
+
+        // detail panel button definitions
+        buttons: {
+            flowtrace: {
+                gid: 'checkMark',
+                tt: 'Flow Trace',
+                cb: function (data) {
+
+                    if (traceSrc == null && data.navPath == 'host') {
+                        traceSrc = data.title;
+
+                        flash.flash('Src ' + traceSrc + ' selected. Please select the dst');
+                    } else if (traceDst == null && data.title != traceSrc && data.navPath == 'host') {
+                        traceDst = data.title;
+                        openTraceInfoDialog();
+                        flash.flash('Dst ' + traceDst + ' selected. Press Request button');
+                    }
+
+                    $log.debug('Perform flow trace test between VMs:', data);
+                }
+            },
+
+            reset: {
+                gid: 'xMark',
+                tt: 'Reset',
+                cb: function (data) {
+                    flash.flash('Reset flow trace');
+                    traceSrc = null;
+                    traceDst = null;
+                    ds.closeDialog();
+                    $log.debug('BAR action invoked with data:', data);
+                }
+            },
+            toGateway: {
+                gid: 'm_switch',
+                tt: 'Trace to Gateway',
+                cb: function (data) {
+                    if (traceSrc != null && data.title == traceSrc && data.navPath == 'host') {
+                        //Set traceSrc to traceDst in case trace to gateway
+                        traceDst = traceSrc;
+                        openTraceInfoDialog();
+                        flash.flash('Trace to Gateway');
+                    }
+                }
+            },
+            toExternal: {
+                gid: 'm_cloud',
+                tt: 'Trace to External',
+                cb: function (data) {
+                    if (traceSrc != null && data.title == traceSrc && data.navPath == 'host') {
+                        //Set traceDst to 8.8.8.8 to check external connection
+                        traceDst = '8.8.8.8';
+                        openTraceInfoDialog();
+                        flash.flash('Trace to External')
+                    }
+               }
+            }
+        },
+
+        keyBindings: {
+                    0: {
+                        cb: function () { sts.stopDisplay(); },
+                        tt: 'Cancel OpenstackNetworking UI Overlay Mode',
+                        gid: 'xMark'
+                    },
+                    V: {
+                        cb: function () {
+                            wss.bindHandlers({
+                                flowTraceResult: sts,
+                            });
+                            sts.startDisplay('mouse');
+                        },
+                        tt: 'Start OpenstackNetworking UI Overlay Mode',
+                        gid: 'crown'
+                    },
+
+                    _keyOrder: [
+                        '0', 'V'
+                    ]
+                },
+
+        hooks: {
+            // hook for handling escape key
+            // Must return true to consume ESC, false otherwise.
+            escape: function () {
+                // Must return true to consume ESC, false otherwise.
+                return sts.stopDisplay();
+            },
+            mouseover: function (m) {
+                // m has id, class, and type properties
+                $log.debug('mouseover:', m);
+                sts.updateDisplay(m);
+            },
+            mouseout: function () {
+                $log.debug('mouseout');
+                sts.updateDisplay();
+            }
+        }
+    };
+
+    function openTraceInfoDialog() {
+        ds.openDialog(traceInfoDialogId, traceInfoDialogOpt)
+            .setTitle('Flow Trace Information')
+            .addContent(createTraceInfoDiv(traceSrc, traceDst))
+            .addOk(flowTraceResultBtn, 'Request')
+            .bindKeys();
+    }
+
+    function createTraceInfoDiv(src, dst) {
+        var texts = ds.createDiv('traceInfo');
+        texts.append('hr');
+        texts.append('table').append('tbody').append('tr');
+
+        var tBodySelection = texts.select('table').select('tbody').select('tr');
+
+        tBodySelection.append('td').text('Source IP:').attr("class", "label");
+        tBodySelection.append('td').text(src).attr("class", "value");
+
+        texts.select('table').select('tbody').append('tr');
+
+        tBodySelection = texts.select('table').select('tbody').select('tr:nth-child(2)');
+
+        tBodySelection.append('td').text('Destination IP:').attr("class", "label");
+        if (dst == src) {
+            tBodySelection.append('td').text('toGateway').attr("class", "value");
+        } else {
+            tBodySelection.append('td').text(dst).attr("class", "value");
+        }
+
+        texts.append('hr');
+
+        return texts;
+
+    }
+
+    function flowTraceResultBtn() {
+        sts.sendFlowTraceRequest(traceSrc, traceDst);
+        ds.closeDialog();
+        traceSrc = null;
+        traceDst = null;
+        flash.flash('Send Flow Trace Request');
+    }
+
+    function buttonCallback(x) {
+        $log.debug('Toolbar-button callback', x);
+    }
+
+    // invoke code to register with the overlay service
+    angular.module('ovSonaTopov')
+        .run(['$log', 'TopoOverlayService', 'SonaTopovService',
+                'FlashService', 'DialogService', 'WebSocketService',
+
+        function (_$log_, _tov_, _sts_, _flash_, _ds_, _wss_) {
+            $log = _$log_;
+            tov = _tov_;
+            sts = _sts_;
+            flash = _flash_;
+            ds = _ds_;
+            wss = _wss_;
+            tov.register(overlay);
+        }]);
+
+}());
diff --git a/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovService.js b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovService.js
new file mode 100644
index 0000000..a9bbf69
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/app/view/sonaTopov/sonaTopovService.js
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ */
+
+/*
+ OpenStack Networking UI Service
+
+  Provides a mechanism to highlight hosts, devices and links according to
+  a virtual network. Also provides trace functionality to prove that
+  flow rules for the specific vm are installed appropriately.
+ */
+
+(function () {
+    'use strict';
+
+    // injected refs
+    var $log, fs, flash, wss, ds;
+
+    // constants
+    var displayStart = 'openstackNetworkingUiStart',
+        displayUpdate = 'openstackNetworkingUiUpdate',
+        displayStop = 'openstackNetworkingUiStop',
+        flowTraceRequest = 'flowTraceRequest';
+
+    // internal state
+    var currentMode = null;
+
+    // === ---------------------------
+    // === Helper functions
+
+    function sendDisplayStart(mode) {
+        wss.sendEvent(displayStart, {
+            mode: mode
+        });
+    }
+
+    function sendDisplayUpdate(what) {
+        wss.sendEvent(displayUpdate, {
+            id: what ? what.id : ''
+        });
+    }
+
+    function sendDisplayStop() {
+        wss.sendEvent(displayStop);
+    }
+
+    function sendFlowTraceRequest(src, dst) {
+        wss.sendEvent(flowTraceRequest, {
+            srcIp: src,
+            dstIp: dst
+        });
+        flash.flash('sendFlowTraceRequest called');
+    }
+
+    // === ---------------------------
+    // === Main API functions
+
+    function startDisplay(mode) {
+        if (currentMode === mode) {
+            $log.debug('(in mode', mode, 'already)');
+        } else {
+            currentMode = mode;
+            sendDisplayStart(mode);
+
+            flash.flash('Starting Openstack Networking UI mode');
+        }
+    }
+
+    function updateDisplay(m) {
+        if (currentMode) {
+            sendDisplayUpdate(m);
+        }
+    }
+
+    function stopDisplay() {
+        if (currentMode) {
+            currentMode = null;
+            sendDisplayStop();
+            flash.flash('Canceling Openstack Networking UI Overlay mode');
+            return true;
+        }
+        return false;
+    }
+
+
+    function dOk() {
+        ds.closeDialog();
+    }
+    function openFlowTraceResultDialog(data) {
+        var flowTraceResultDialogId = 'flowTraceResultDialogId',
+            flowTraceResultDialogOpt = {
+                width: 650,
+                edge: 'left',
+                margin: 20,
+                hideMargin: -20
+            }
+        var traceSuccess = data.trace_success == true ? "SUCCESS" : "FALSE";
+        ds.openDialog(flowTraceResultDialogId, flowTraceResultDialogOpt)
+                    .setTitle('Flow Trace Result: ' + traceSuccess)
+                    .addContent(createTraceResultInfoDiv(data))
+                    .addOk(dOk, 'Close')
+                    .bindKeys();
+    }
+
+    function createTraceResultInfoDiv(data) {
+        var texts = ds.createDiv('flowTraceResult');
+
+        texts.append('div').attr("class", "table-header");
+        texts.append('div').attr("class", "table-body");
+
+        texts.select('.table-header').append('table').append('tbody').append('tr');
+        texts.select('.table-body').append('table').append('tbody');
+
+
+        var theaderSelection = texts.select('.table-header')
+            .select('table').select('tbody').select('tr');
+
+        theaderSelection.append('td').text('Node');
+        theaderSelection.append('td').text('Table Id');
+        theaderSelection.append('td').text('Priority');
+        theaderSelection.append('td').text('Selector');
+        theaderSelection.append('td').text('Action');
+
+        var tbodySelection = texts.select('.table-body').select('table').select('tbody');
+        var rowNum = 1;
+
+        data.trace_result.forEach(function(result) {
+            result.flow_rules.forEach(function(flowRule) {
+                tbodySelection.append('tr');
+                var tbodyTrSelection = tbodySelection.select('tr:nth-child(' + rowNum + ')');
+                tbodyTrSelection.append('td').text(result.trace_node_name);
+                tbodyTrSelection.append('td').text(flowRule.table);
+                tbodyTrSelection.append('td').text(flowRule.priority);
+                tbodyTrSelection.append('td').text(jsonToSring(flowRule.selector));
+                tbodyTrSelection.append('td').text(jsonToSring(flowRule.actions));
+                if (jsonToSring(flowRule.actions).includes("drop")) {
+                    tbodyTrSelection.attr("class", "drop");
+                }
+                rowNum++;
+            });
+
+        });
+
+        return texts;
+    }
+
+    function jsonToSring(jsonData) {
+        var result = [];
+        for (var key in jsonData) {
+            result.push(key + ':' + jsonData[key]);
+        }
+
+        return result.join('/');
+
+    }
+
+    function flowTraceResult(data) {
+        flash.flash('flowTraceResult called');
+        $log.debug(data);
+
+        openFlowTraceResultDialog(data)
+    }
+
+    // === ---------------------------
+    // === Module Factory Definition
+
+    angular.module('ovSonaTopov', [])
+        .factory('SonaTopovService',
+        ['$log', 'FnService', 'FlashService', 'WebSocketService', 'DialogService',
+
+        function (_$log_, _fs_, _flash_, _wss_, _ds_) {
+            $log = _$log_;
+            fs = _fs_;
+            flash = _flash_;
+            wss = _wss_;
+            ds = _ds_;
+
+            return {
+                startDisplay: startDisplay,
+                updateDisplay: updateDisplay,
+                stopDisplay: stopDisplay,
+                flowTraceResult: flowTraceResult,
+                sendFlowTraceRequest: sendFlowTraceRequest,
+            };
+        }]);
+}());
diff --git a/apps/openstacknetworkingui/src/main/resources/sonaTopov/css.html b/apps/openstacknetworkingui/src/main/resources/sonaTopov/css.html
new file mode 100644
index 0000000..a2e04f4
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/sonaTopov/css.html
@@ -0,0 +1 @@
+<link rel="stylesheet" href="app/view/sonaTopov/sonaTopov.css">
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/resources/sonaTopov/js.html b/apps/openstacknetworkingui/src/main/resources/sonaTopov/js.html
new file mode 100644
index 0000000..72026ff
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/resources/sonaTopov/js.html
@@ -0,0 +1,2 @@
+<script src="app/view/sonaTopov/sonaTopovService.js"></script>
+<script src="app/view/sonaTopov/sonaTopovOverlay.js"></script>
\ No newline at end of file
diff --git a/apps/openstacknetworkingui/src/main/webapp/WEB-INF/web.xml b/apps/openstacknetworkingui/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..616ad86
--- /dev/null
+++ b/apps/openstacknetworkingui/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present Open Networking Foundation
+  ~
+  ~ Licensed 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.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="ONOS" version="2.5">
+    <display-name>SONA GUI REST API v1.0</display-name>
+
+    <servlet>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>jersey.config.server.provider.classnames</param-name>
+            <param-value>
+                org.onosproject.openstacknetworkingui.web.FlowTraceWebResource
+            </param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/apps/p4runtime-test/BUCK b/apps/p4runtime-test/BUCK
index c91aced..66fc291 100644
--- a/apps/p4runtime-test/BUCK
+++ b/apps/p4runtime-test/BUCK
@@ -39,7 +39,8 @@
     '//lib:minimal-json',
 ]
 
-osgi_jar_with_tests(
-    deps = COMPILE_DEPS,
-    test_deps = TEST_DEPS,
+java_test(
+    name = "onos-apps-p4runtime-test-tests",
+    srcs = glob([ 'src/test/java/**/*.java' ]),
+    deps = COMPILE_DEPS + TEST_DEPS,
 )
diff --git a/apps/pi-demo/common/src/main/java/org/onosproject/pi/demo/app/common/AbstractUpgradableFabricApp.java b/apps/pi-demo/common/src/main/java/org/onosproject/pi/demo/app/common/AbstractUpgradableFabricApp.java
index ee051b4..18f1e8c 100644
--- a/apps/pi-demo/common/src/main/java/org/onosproject/pi/demo/app/common/AbstractUpgradableFabricApp.java
+++ b/apps/pi-demo/common/src/main/java/org/onosproject/pi/demo/app/common/AbstractUpgradableFabricApp.java
@@ -157,8 +157,7 @@
     protected AbstractUpgradableFabricApp(String appName, Collection<PiPipeconf> appPipeconfs) {
         this.appName = checkNotNull(appName);
         this.appPipeconfs = checkNotNull(appPipeconfs);
-        checkArgument(appPipeconfs.size() > 0);
-
+        checkArgument(appPipeconfs.size() > 0, "appPipeconfs cannot have size 0");
     }
 
     @Activate
diff --git a/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpFabricApp.java b/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpFabricApp.java
index 7e02f95..fccbab5 100644
--- a/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpFabricApp.java
+++ b/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpFabricApp.java
@@ -21,14 +21,11 @@
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.felix.scr.annotations.Component;
 import org.onlab.util.ImmutableByteSequence;
-import org.onosproject.bmv2.model.Bmv2PipelineModelParser;
-import org.onosproject.driver.pipeline.DefaultSingleTablePipeline;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Host;
 import org.onosproject.net.Path;
 import org.onosproject.net.Port;
 import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.Pipeliner;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.FlowRule;
@@ -36,10 +33,6 @@
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.flow.criteria.Criterion;
 import org.onosproject.net.flow.criteria.PiCriterion;
-import org.onosproject.net.pi.model.DefaultPiPipeconf;
-import org.onosproject.net.pi.model.PiPipeconf;
-import org.onosproject.net.pi.model.PiPipeconfId;
-import org.onosproject.net.pi.model.PiPipelineInterpreter;
 import org.onosproject.net.pi.runtime.PiAction;
 import org.onosproject.net.pi.runtime.PiActionId;
 import org.onosproject.net.pi.runtime.PiActionParam;
@@ -51,7 +44,6 @@
 import org.onosproject.net.topology.TopologyGraph;
 import org.onosproject.pi.demo.app.common.AbstractUpgradableFabricApp;
 
-import java.net.URL;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -62,8 +54,6 @@
 import static java.lang.String.format;
 import static java.util.stream.Collectors.toSet;
 import static org.onlab.packet.EthType.EtherType.IPV4;
-import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.BMV2_JSON;
-import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
 import static org.onosproject.pi.demo.app.ecmp.EcmpInterpreter.*;
 
 
diff --git a/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpPipeconfFactory.java b/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpPipeconfFactory.java
index 7f515b9..a415472 100644
--- a/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpPipeconfFactory.java
+++ b/apps/pi-demo/ecmp/src/main/java/org/onosproject/pi/demo/app/ecmp/EcmpPipeconfFactory.java
@@ -31,51 +31,34 @@
 
 import java.net.URL;
 import java.util.Collection;
-import java.util.Collections;
 
 import static java.lang.String.format;
 import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.*;
 
-public class EcmpPipeconfFactory {
+final class EcmpPipeconfFactory {
 
     private static final String BMV2_PIPECONF_ID = "bmv2-ecmp";
     private static final URL BMV2_P4INFO_URL = EcmpFabricApp.class.getResource("/ecmp_14.p4info");
     private static final URL BMV2_JSON_URL = EcmpFabricApp.class.getResource("/ecmp_14.json");
 
     private static final String TOFINO_PIPECONF_ID_BASE = "tofino-ecmp-%s";
-    private static final String TOFINO_JSON_PATH_BASE = "/ecmp-tofino/%s/default.json";
-    private static final String TOFINO_P4INFO_PATH_BASE = "/ecmp-tofino/%s/default.p4info";
+    private static final String TOFINO_JSON_PATH_BASE = "/ecmp-tofino/%s/ecmp.json";
+    private static final String TOFINO_P4INFO_PATH_BASE = "/ecmp-tofino/%s/ecmp.p4info";
     private static final String TOFINO_CONTEXT_JSON_PATH_BASE = "/ecmp-tofino/%s/context/context.json";
     private static final String TOFINO_BIN_PATH_BASE = "/ecmp-tofino/%s/tofino.bin";
 
     private static final String MAVERICKS = "mavericks";
     private static final String MONTARA = "montara";
 
-    private static final PiPipeconf PIPECONF_BMV2 = buildBmv2();
-    private static final PiPipeconf PIPECONF_MAVERICKS = buildTofino(MAVERICKS);
-    private static final PiPipeconf PIPECONF_MONTARA = buildTofino(MONTARA);
-
-    private EcmpPipeconfFactory() {
-        // Hides constructor.
-    }
-
-    static PiPipeconf getMavericks() {
-        return PIPECONF_MAVERICKS;
-    }
-
-    static PiPipeconf getMontara() {
-        return PIPECONF_MONTARA;
-    }
-
-    static PiPipeconf getBmv2() {
-        return PIPECONF_BMV2;
-    }
+    private static final PiPipeconf BMV2_PIPECONF = buildBmv2Pipeconf();
+    private static final PiPipeconf MAVERICKS_PIPECONF = buildTofinoPipeconf(MAVERICKS);
+    private static final PiPipeconf MONTARA_PIPECONF = buildTofinoPipeconf(MONTARA);
 
     static Collection<PiPipeconf> getAll() {
-        return Lists.newArrayList(getBmv2(), getMavericks(), getMontara());
+        return Lists.newArrayList(BMV2_PIPECONF, MAVERICKS_PIPECONF, MONTARA_PIPECONF);
     }
 
-    private static PiPipeconf buildTofino(String system) {
+    private static PiPipeconf buildTofinoPipeconf(String system) {
         final URL bmv2JsonUrl = EcmpPipeconfFactory.class.getResource(format(TOFINO_JSON_PATH_BASE, system));
         final URL p4InfoUrl = EcmpPipeconfFactory.class.getResource(format(TOFINO_P4INFO_PATH_BASE, system));
         final URL tofinoUrl = EcmpPipeconfFactory.class.getResource(format(TOFINO_BIN_PATH_BASE, system));
@@ -87,7 +70,7 @@
                 .addBehaviour(PiPipelineInterpreter.class, EcmpInterpreter.class)
                 .addBehaviour(Pipeliner.class, DefaultSingleTablePipeline.class)
                 .addBehaviour(PortStatisticsDiscovery.class, DefaultP4PortStatisticsDiscovery.class)
-                // FIXME: remove as soon as we get Packet I/O working
+                // FIXME: can remove if Packet I/O is working
                 .addBehaviour(LinkDiscovery.class, NetcfgLinkDiscovery.class)
                 .addExtension(P4_INFO_TEXT, p4InfoUrl)
                 .addExtension(TOFINO_BIN, tofinoUrl)
@@ -95,14 +78,14 @@
                 .build();
     }
 
-    private static PiPipeconf buildBmv2() {
+    private static PiPipeconf buildBmv2Pipeconf() {
         return DefaultPiPipeconf.builder()
                 .withId(new PiPipeconfId(BMV2_PIPECONF_ID))
                 .withPipelineModel(Bmv2PipelineModelParser.parse(BMV2_JSON_URL))
                 .addBehaviour(PiPipelineInterpreter.class, EcmpInterpreter.class)
                 .addBehaviour(Pipeliner.class, DefaultSingleTablePipeline.class)
                 .addBehaviour(PortStatisticsDiscovery.class, DefaultP4PortStatisticsDiscovery.class)
-                // FIXME: remove as soon as we get Packet I/O working
+                // FIXME: can remove if Packet I/O is working
                 .addBehaviour(LinkDiscovery.class, NetcfgLinkDiscovery.class)
                 .addExtension(P4_INFO_TEXT, BMV2_P4INFO_URL)
                 .addExtension(BMV2_JSON, BMV2_JSON_URL)
diff --git a/apps/pom.xml b/apps/pom.xml
index b43c0db..26deeee 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -96,6 +96,7 @@
         <module>route-service</module>
         <module>evpn-route-service</module>
         <module>l3vpn</module>
+        <module>openstacknetworkingui</module>
     </modules>
 
     <properties>
diff --git a/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/DefaultResolvedRouteStore.java b/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/DefaultResolvedRouteStore.java
index 4981932..725a7a9 100644
--- a/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/DefaultResolvedRouteStore.java
+++ b/apps/route-service/app/src/main/java/org/onosproject/routeservice/impl/DefaultResolvedRouteStore.java
@@ -143,7 +143,7 @@
                                 immutableAlternatives);
                     } else {
                         return new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, route,
-                                oldRoute, immutableAlternatives);
+                                oldRoute, immutableAlternatives, oldRoutes);
                     }
                 }
 
@@ -185,11 +185,11 @@
                 String key = createBinaryString(prefix);
 
                 ResolvedRoute route = routeTable.getValueForExactKey(key);
-                alternativeRoutes.remove(prefix);
+                Set<ResolvedRoute> alternatives = alternativeRoutes.remove(prefix);
 
                 if (route != null) {
                     routeTable.remove(key);
-                    return new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route);
+                    return new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route, alternatives);
                 }
                 return null;
             }
diff --git a/apps/route-service/app/src/test/java/org/onosproject/routeservice/impl/RouteManagerTest.java b/apps/route-service/app/src/test/java/org/onosproject/routeservice/impl/RouteManagerTest.java
index 8febe68..3ba34da 100644
--- a/apps/route-service/app/src/test/java/org/onosproject/routeservice/impl/RouteManagerTest.java
+++ b/apps/route-service/app/src/test/java/org/onosproject/routeservice/impl/RouteManagerTest.java
@@ -16,6 +16,7 @@
 
 package org.onosproject.routeservice.impl;
 
+import java.util.Collection;
 import java.util.Collections;
 
 import org.junit.Before;
@@ -212,7 +213,8 @@
     private void verifyRouteAdd(Route route, ResolvedRoute resolvedRoute) {
         reset(routeListener);
 
-        routeListener.event(event(RouteEvent.Type.ROUTE_ADDED, resolvedRoute));
+        routeListener.event(event(RouteEvent.Type.ROUTE_ADDED, resolvedRoute, null,
+                Sets.newHashSet(resolvedRoute), null));
 
         replay(routeListener);
 
@@ -267,7 +269,8 @@
         addRoute(original);
 
         routeListener.event(event(RouteEvent.Type.ROUTE_UPDATED,
-                updatedResolvedRoute, resolvedRoute));
+                updatedResolvedRoute, resolvedRoute,
+                Sets.newHashSet(updatedResolvedRoute), Sets.newHashSet(resolvedRoute)));
         expectLastCall().once();
 
         replay(routeListener);
@@ -304,7 +307,7 @@
         addRoute(route);
 
         RouteEvent withdrawRouteEvent = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED,
-                removedResolvedRoute);
+                removedResolvedRoute, Sets.newHashSet(removedResolvedRoute));
 
         reset(routeListener);
         routeListener.event(withdrawRouteEvent);
@@ -342,8 +345,9 @@
 
         // Now when we send the event, we expect the FIB update to be sent
         reset(routeListener);
-        routeListener.event(event(RouteEvent.Type.ROUTE_ADDED,
-                new ResolvedRoute(route, MAC1, CP1)));
+        ResolvedRoute resolvedRoute = new ResolvedRoute(route, MAC1, CP1);
+        routeListener.event(event(RouteEvent.Type.ROUTE_ADDED, resolvedRoute, null,
+                Sets.newHashSet(resolvedRoute), null));
         replay(routeListener);
 
         Host host = createHost(MAC1, V4_NEXT_HOP1);
@@ -362,12 +366,10 @@
         verify(routeListener);
     }
 
-    private static RouteEvent event(RouteEvent.Type type, ResolvedRoute subject) {
-        return event(type, subject, null);
-    }
-
-    private static RouteEvent event(RouteEvent.Type type, ResolvedRoute subject, ResolvedRoute prevSubject) {
-        return new RouteEvent(type, subject, prevSubject, Collections.singleton(subject));
+    private static RouteEvent event(RouteEvent.Type type, ResolvedRoute subject, ResolvedRoute prevSubject,
+                                    Collection<ResolvedRoute> alternatives,
+                                    Collection<ResolvedRoute> prevAlternatives) {
+        return new RouteEvent(type, subject, prevSubject, alternatives, prevAlternatives);
     }
 
     /**
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
index 50b0cd2..0d263e7 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
@@ -27,11 +27,14 @@
 import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
 import org.onosproject.cluster.NodeId;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Link;
+import org.onosproject.net.PortNumber;
 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
 import org.onosproject.segmentrouting.config.DeviceConfiguration;
 import org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler;
@@ -238,7 +241,8 @@
      *
      * @param cpts connect point(s) of the subnets being added
      * @param subnets subnets being added
-     */ //XXX refactor
+     */
+    // XXX refactor
     protected void populateSubnet(Set<ConnectPoint> cpts, Set<IpPrefix> subnets) {
         lastRoutingChange = DateTime.now();
         statusLock.lock();
@@ -250,7 +254,8 @@
             }
             populationStatus = Status.STARTED;
             rulePopulator.resetCounter();
-            log.info("Starting to populate routing rules for added routes");
+            log.info("Starting to populate routing rules for added routes, subnets={}, cpts={}",
+                    subnets, cpts);
             // Take snapshots of the topology
             updatedEcmpSpgMap = new HashMap<>();
             Set<EdgePair> edgePairs = new HashSet<>();
@@ -972,6 +977,40 @@
     }
 
     /**
+     * Populates IP rules for a route that has direct connection to the switch
+     * if the current instance is the master of the switch.
+     *
+     * @param deviceId device ID of the device that next hop attaches to
+     * @param prefix IP prefix of the route
+     * @param hostMac MAC address of the next hop
+     * @param hostVlanId Vlan ID of the nexthop
+     * @param outPort port where the next hop attaches to
+     */
+    void populateRoute(DeviceId deviceId, IpPrefix prefix,
+                       MacAddress hostMac, VlanId hostVlanId, PortNumber outPort) {
+        if (srManager.mastershipService.isLocalMaster(deviceId)) {
+            srManager.routingRulePopulator.populateRoute(deviceId, prefix, hostMac, hostVlanId, outPort);
+        }
+    }
+
+    /**
+     * Removes IP rules for a route when the next hop is gone.
+     * if the current instance is the master of the switch.
+     *
+     * @param deviceId device ID of the device that next hop attaches to
+     * @param prefix IP prefix of the route
+     * @param hostMac MAC address of the next hop
+     * @param hostVlanId Vlan ID of the nexthop
+     * @param outPort port that next hop attaches to
+     */
+    void revokeRoute(DeviceId deviceId, IpPrefix prefix,
+                     MacAddress hostMac, VlanId hostVlanId, PortNumber outPort) {
+        if (srManager.mastershipService.isLocalMaster(deviceId)) {
+            srManager.routingRulePopulator.revokeRoute(deviceId, prefix, hostMac, hostVlanId, outPort);
+        }
+    }
+
+    /**
      * Remove ECMP graph entry for the given device. Typically called when
      * device is no longer available.
      *
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
index 5029b30..7a205ee 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/HostHandler.java
@@ -50,7 +50,6 @@
  * Handles host-related events.
  */
 public class HostHandler {
-    private static final String NOT_MASTER = "Current instance is not the master of {}. Ignore.";
 
     private static final Logger log = LoggerFactory.getLogger(HostHandler.class);
     protected final SegmentRoutingManager srManager;
@@ -87,8 +86,7 @@
     void processHostAddedAtLocation(Host host, HostLocation location) {
         checkArgument(host.locations().contains(location), "{} is not a location of {}", location, host);
 
-        if (!isMasterOf(location)) {
-            log.debug(NOT_MASTER, location);
+        if (!srManager.isMasterOf(location)) {
             return;
         }
 
@@ -115,16 +113,19 @@
         Set<IpAddress> ips = host.ipAddresses();
         log.info("Host {}/{} is removed from {}", hostMac, hostVlanId, locations);
 
-        locations.stream().filter(this::isMasterOf).forEach(location -> {
-            processBridgingRule(location.deviceId(), location.port(), hostMac, hostVlanId, true);
-            ips.forEach(ip ->
-                processRoutingRule(location.deviceId(), location.port(), hostMac, hostVlanId, ip, true)
-            );
+        locations.forEach(location -> {
+            if (srManager.isMasterOf(location)) {
+                processBridgingRule(location.deviceId(), location.port(), hostMac, hostVlanId, true);
+                ips.forEach(ip ->
+                        processRoutingRule(location.deviceId(), location.port(), hostMac, hostVlanId, ip, true)
+                );
+            }
 
             // Also remove redirection flows on the pair device if exists.
             Optional<DeviceId> pairDeviceId = srManager.getPairDeviceId(location.deviceId());
             Optional<PortNumber> pairLocalPort = srManager.getPairLocalPorts(location.deviceId());
-            if (pairDeviceId.isPresent() && pairLocalPort.isPresent()) {
+            if (pairDeviceId.isPresent() && pairLocalPort.isPresent() &&
+                    srManager.mastershipService.isLocalMaster(pairDeviceId.get())) {
                 // NOTE: Since the pairLocalPort is trunk port, use assigned vlan of original port
                 //       when the host is untagged
                 VlanId vlanId = Optional.ofNullable(srManager.getInternalVlanId(location)).orElse(hostVlanId);
@@ -150,7 +151,7 @@
                 .collect(Collectors.toSet());
 
         // For each old location
-        Sets.difference(prevLocations, newLocations).stream().filter(this::isMasterOf)
+        Sets.difference(prevLocations, newLocations).stream().filter(srManager::isMasterOf)
                 .forEach(prevLocation -> {
             // Remove routing rules for old IPs
             Sets.difference(prevIps, newIps).forEach(ip ->
@@ -211,7 +212,7 @@
         });
 
         // For each new location, add all new IPs.
-        Sets.difference(newLocations, prevLocations).stream().filter(this::isMasterOf)
+        Sets.difference(newLocations, prevLocations).stream().filter(srManager::isMasterOf)
                 .forEach(newLocation -> {
             processBridgingRule(newLocation.deviceId(), newLocation.port(), hostMac, hostVlanId, false);
             newIps.forEach(ip ->
@@ -221,7 +222,7 @@
         });
 
         // For each unchanged location, add new IPs and remove old IPs.
-        Sets.intersection(newLocations, prevLocations).stream().filter(this::isMasterOf)
+        Sets.intersection(newLocations, prevLocations).stream().filter(srManager::isMasterOf)
                 .forEach(unchangedLocation -> {
             Sets.difference(prevIps, newIps).forEach(ip ->
                     processRoutingRule(unchangedLocation.deviceId(), unchangedLocation.port(), hostMac,
@@ -243,7 +244,7 @@
         Set<IpAddress> newIps = event.subject().ipAddresses();
         log.info("Host {}/{} is updated", mac, vlanId);
 
-        locations.stream().filter(this::isMasterOf).forEach(location -> {
+        locations.stream().filter(srManager::isMasterOf).forEach(location -> {
             Sets.difference(prevIps, newIps).forEach(ip ->
                     processRoutingRule(location.deviceId(), location.port(), mac, vlanId, ip, true)
             );
@@ -378,20 +379,9 @@
 
         log.info("{} routing rule for {} at {}", revoke ? "Revoking" : "Populating", ip, location);
         if (revoke) {
-            srManager.routingRulePopulator.revokeRoute(deviceId, ip.toIpPrefix(), mac, vlanId, port);
+            srManager.defaultRoutingHandler.revokeRoute(deviceId, ip.toIpPrefix(), mac, vlanId, port);
         } else {
-            srManager.routingRulePopulator.populateRoute(deviceId, ip.toIpPrefix(), mac, vlanId, port);
+            srManager.defaultRoutingHandler.populateRoute(deviceId, ip.toIpPrefix(), mac, vlanId, port);
         }
     }
-
-    /**
-     * Determine if current instance is the master of given connect point.
-     *
-     * @param cp connect point
-     * @return true if current instance is the master of given connect point
-     */
-    private boolean isMasterOf(ConnectPoint cp) {
-        log.debug(NOT_MASTER, cp);
-        return srManager.mastershipService.isLocalMaster(cp.deviceId());
-    }
 }
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RouteHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RouteHandler.java
index 214ba6b..c80bc09 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RouteHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RouteHandler.java
@@ -16,20 +16,33 @@
 
 package org.onosproject.segmentrouting;
 
-import com.google.common.collect.ImmutableSet;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalCause;
+import com.google.common.cache.RemovalNotification;
 import com.google.common.collect.Sets;
 
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.host.HostEvent;
 import org.onosproject.routeservice.ResolvedRoute;
 import org.onosproject.routeservice.RouteEvent;
 import org.onosproject.net.DeviceId;
+import org.onosproject.routeservice.RouteInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Collection;
 import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * Handles RouteEvent and manages routing entries.
@@ -38,8 +51,35 @@
     private static final Logger log = LoggerFactory.getLogger(RouteHandler.class);
     private final SegmentRoutingManager srManager;
 
+    private static final int WAIT_TIME_MS = 1000;
+    /**
+     * The routeEventCache is implemented to avoid race condition by giving more time to the
+     * underlying flow subsystem to process previous populateSubnet call.
+     */
+    private Cache<IpPrefix, RouteEvent> routeEventCache = CacheBuilder.newBuilder()
+            .expireAfterWrite(WAIT_TIME_MS, TimeUnit.MILLISECONDS)
+            .removalListener((RemovalNotification<IpPrefix, RouteEvent> notification) -> {
+                IpPrefix prefix = notification.getKey();
+                RouteEvent routeEvent = notification.getValue();
+                RemovalCause cause = notification.getCause();
+                log.debug("routeEventCache removal event. prefix={}, routeEvent={}, cause={}",
+                        prefix, routeEvent, cause);
+
+                switch (notification.getCause()) {
+                    case REPLACED:
+                    case EXPIRED:
+                        dequeueRouteEvent(routeEvent);
+                        break;
+                    default:
+                        break;
+                }
+            }).build();
+
     RouteHandler(SegmentRoutingManager srManager) {
         this.srManager = srManager;
+
+        Executors.newSingleThreadScheduledExecutor()
+                .scheduleAtFixedRate(routeEventCache::cleanUp, 0, WAIT_TIME_MS, TimeUnit.MILLISECONDS);
     }
 
     protected void init(DeviceId deviceId) {
@@ -56,70 +96,239 @@
     }
 
     void processRouteAdded(RouteEvent event) {
-        log.info("processRouteAdded {}", event);
-        processRouteAddedInternal(event.subject());
+        enqueueRouteEvent(event);
     }
 
     private void processRouteAddedInternal(ResolvedRoute route) {
+        processRouteAddedInternal(Sets.newHashSet(route));
+    }
+
+    private void processRouteAddedInternal(Collection<ResolvedRoute> routes) {
         if (!isReady()) {
-            log.info("System is not ready. Skip adding route for {}", route.prefix());
+            log.info("System is not ready. Skip adding route for {}", routes);
             return;
         }
 
-        IpPrefix prefix = route.prefix();
-        MacAddress nextHopMac = route.nextHopMac();
-        VlanId nextHopVlan = route.nextHopVlan();
-        ConnectPoint location = srManager.nextHopLocations(route).stream().findFirst().orElse(null);
+        log.info("processRouteAddedInternal. routes={}", routes);
 
-        if (location == null) {
-            log.info("{} ignored. Cannot find nexthop location", prefix);
-            return;
-        }
+        Set<ConnectPoint> allLocations = Sets.newHashSet();
+        Set<IpPrefix> allPrefixes = Sets.newHashSet();
+        routes.forEach(route -> {
+            allLocations.addAll(srManager.nextHopLocations(route));
+            allPrefixes.add(route.prefix());
+        });
+        log.debug("RouteAdded. populateSubnet {}, {}", allLocations, allPrefixes);
+        srManager.defaultRoutingHandler.populateSubnet(allLocations, allPrefixes);
 
-        srManager.deviceConfiguration.addSubnet(location, prefix);
-        // XXX need to handle the case where there are two connectpoints
-        srManager.defaultRoutingHandler.populateSubnet(Sets.newHashSet(location),
-                                                       Sets.newHashSet(prefix));
-        srManager.routingRulePopulator.populateRoute(location.deviceId(), prefix,
-                nextHopMac, nextHopVlan, location.port());
+        routes.forEach(route -> {
+            IpPrefix prefix = route.prefix();
+            MacAddress nextHopMac = route.nextHopMac();
+            VlanId nextHopVlan = route.nextHopVlan();
+            Set<ConnectPoint> locations = srManager.nextHopLocations(route);
+
+            locations.forEach(location -> {
+                log.debug("RouteAdded. addSubnet {}, {}", location, prefix);
+                srManager.deviceConfiguration.addSubnet(location, prefix);
+                log.debug("RouteAdded populateRoute {}, {}, {}, {}", location, prefix, nextHopMac, nextHopVlan);
+                srManager.defaultRoutingHandler.populateRoute(location.deviceId(), prefix,
+                        nextHopMac, nextHopVlan, location.port());
+            });
+        });
     }
 
     void processRouteUpdated(RouteEvent event) {
-        log.info("processRouteUpdated {}", event);
-        processRouteRemovedInternal(event.prevSubject());
-        processRouteAddedInternal(event.subject());
+        enqueueRouteEvent(event);
+    }
+
+    void processAlternativeRoutesChanged(RouteEvent event) {
+        enqueueRouteEvent(event);
+    }
+
+    private void processRouteUpdatedInternal(Set<ResolvedRoute> routes, Set<ResolvedRoute> oldRoutes) {
+        if (!isReady()) {
+            log.info("System is not ready. Skip updating route for {} -> {}", oldRoutes, routes);
+            return;
+        }
+
+        log.info("processRouteUpdatedInternal. routes={}, oldRoutes={}", routes, oldRoutes);
+
+        Set<ConnectPoint> allLocations = Sets.newHashSet();
+        Set<IpPrefix> allPrefixes = Sets.newHashSet();
+        routes.forEach(route -> {
+            allLocations.addAll(srManager.nextHopLocations(route));
+            allPrefixes.add(route.prefix());
+        });
+        log.debug("RouteUpdated. populateSubnet {}, {}", allLocations, allPrefixes);
+        srManager.defaultRoutingHandler.populateSubnet(allLocations, allPrefixes);
+
+
+        Set<ResolvedRoute> toBeRemoved = Sets.difference(oldRoutes, routes).immutableCopy();
+        Set<ResolvedRoute> toBeAdded = Sets.difference(routes, oldRoutes).immutableCopy();
+
+        toBeRemoved.forEach(route -> {
+            srManager.nextHopLocations(route).forEach(oldLocation -> {
+               if (toBeAdded.stream().map(srManager::nextHopLocations)
+                       .flatMap(Set::stream).map(ConnectPoint::deviceId)
+                       .noneMatch(deviceId -> deviceId.equals(oldLocation.deviceId()))) {
+                   IpPrefix prefix = route.prefix();
+                   MacAddress nextHopMac = route.nextHopMac();
+                   VlanId nextHopVlan = route.nextHopVlan();
+
+                   log.debug("RouteUpdated. removeSubnet {}, {}", oldLocation, prefix);
+                   srManager.deviceConfiguration.removeSubnet(oldLocation, prefix);
+                   log.debug("RouteUpdated. revokeRoute {}, {}, {}, {}", oldLocation, prefix, nextHopMac, nextHopVlan);
+                   srManager.defaultRoutingHandler.revokeRoute(oldLocation.deviceId(), prefix,
+                           nextHopMac, nextHopVlan, oldLocation.port());
+               }
+            });
+        });
+
+        toBeAdded.forEach(route -> {
+            IpPrefix prefix = route.prefix();
+            MacAddress nextHopMac = route.nextHopMac();
+            VlanId nextHopVlan = route.nextHopVlan();
+            Set<ConnectPoint> locations = srManager.nextHopLocations(route);
+
+            locations.forEach(location -> {
+                log.debug("RouteUpdated. addSubnet {}, {}", location, prefix);
+                srManager.deviceConfiguration.addSubnet(location, prefix);
+                log.debug("RouteUpdated. populateRoute {}, {}, {}, {}", location, prefix, nextHopMac, nextHopVlan);
+                srManager.defaultRoutingHandler.populateRoute(location.deviceId(), prefix,
+                        nextHopMac, nextHopVlan, location.port());
+            });
+        });
+
     }
 
     void processRouteRemoved(RouteEvent event) {
-        log.info("processRouteRemoved {}", event);
-        processRouteRemovedInternal(event.subject());
+        enqueueRouteEvent(event);
     }
 
-    private void processRouteRemovedInternal(ResolvedRoute route) {
+    private void processRouteRemovedInternal(Collection<ResolvedRoute> routes) {
         if (!isReady()) {
-            log.info("System is not ready. Skip removing route for {}", route.prefix());
+            log.info("System is not ready. Skip removing route for {}", routes);
             return;
         }
 
-        IpPrefix prefix = route.prefix();
-        MacAddress nextHopMac = route.nextHopMac();
-        VlanId nextHopVlan = route.nextHopVlan();
-        ConnectPoint location = srManager.nextHopLocations(route).stream().findFirst().orElse(null);
+        log.info("processRouteRemovedInternal. routes={}", routes);
 
-        if (location == null) {
-            log.info("{} ignored. Cannot find nexthop location", prefix);
-            return;
-        }
+        Set<IpPrefix> allPrefixes = Sets.newHashSet();
+        routes.forEach(route -> {
+            allPrefixes.add(route.prefix());
+        });
+        log.debug("RouteRemoved. revokeSubnet {}", allPrefixes);
+        srManager.defaultRoutingHandler.revokeSubnet(allPrefixes);
 
-        srManager.deviceConfiguration.removeSubnet(location, prefix);
-        srManager.defaultRoutingHandler.revokeSubnet(ImmutableSet.of(prefix));
-        srManager.routingRulePopulator.revokeRoute(
-                location.deviceId(), prefix, nextHopMac, nextHopVlan, location.port());
+        routes.forEach(route -> {
+            IpPrefix prefix = route.prefix();
+            MacAddress nextHopMac = route.nextHopMac();
+            VlanId nextHopVlan = route.nextHopVlan();
+            Set<ConnectPoint> locations = srManager.nextHopLocations(route);
+
+            locations.forEach(location -> {
+                log.debug("RouteRemoved. removeSubnet {}, {}", location, prefix);
+                srManager.deviceConfiguration.removeSubnet(location, prefix);
+                log.debug("RouteRemoved. revokeRoute {}, {}, {}, {}", location, prefix, nextHopMac, nextHopVlan);
+                srManager.defaultRoutingHandler.revokeRoute(location.deviceId(), prefix,
+                        nextHopMac, nextHopVlan, location.port());
+
+                // Also remove redirection flows on the pair device if exists.
+                Optional<DeviceId> pairDeviceId = srManager.getPairDeviceId(location.deviceId());
+                Optional<PortNumber> pairLocalPort = srManager.getPairLocalPorts(location.deviceId());
+                if (pairDeviceId.isPresent() && pairLocalPort.isPresent()) {
+                    // NOTE: Since the pairLocalPort is trunk port, use assigned vlan of original port
+                    //       when the host is untagged
+                    VlanId vlanId = Optional.ofNullable(srManager.getInternalVlanId(location)).orElse(nextHopVlan);
+
+                    log.debug("RouteRemoved. revokeRoute {}, {}, {}, {}", location, prefix, nextHopMac, nextHopVlan);
+                    srManager.defaultRoutingHandler.revokeRoute(pairDeviceId.get(), prefix,
+                            nextHopMac, vlanId, pairLocalPort.get());
+                }
+            });
+        });
+    }
+
+    void processHostMovedEvent(HostEvent event) {
+        log.info("processHostMovedEvent {}", event);
+        MacAddress hostMac = event.subject().mac();
+        VlanId hostVlanId = event.subject().vlan();
+
+        affectedRoutes(hostMac, hostVlanId).forEach(affectedRoute -> {
+            IpPrefix prefix = affectedRoute.prefix();
+            Set<HostLocation> prevLocations = event.prevSubject().locations();
+            Set<HostLocation> newLocations = event.subject().locations();
+
+            // For each old location
+            Sets.difference(prevLocations, newLocations).stream().filter(srManager::isMasterOf)
+                    .forEach(prevLocation -> {
+                // Redirect the flows to pair link if configured
+                // Note: Do not continue removing any rule
+                Optional<DeviceId> pairDeviceId = srManager.getPairDeviceId(prevLocation.deviceId());
+                Optional<PortNumber> pairLocalPort = srManager.getPairLocalPorts(prevLocation.deviceId());
+                if (pairDeviceId.isPresent() && pairLocalPort.isPresent() && newLocations.stream()
+                        .anyMatch(location -> location.deviceId().equals(pairDeviceId.get()))) {
+                    // NOTE: Since the pairLocalPort is trunk port, use assigned vlan of original port
+                    //       when the host is untagged
+                    VlanId vlanId = Optional.ofNullable(srManager.getInternalVlanId(prevLocation)).orElse(hostVlanId);
+                    log.debug("HostMoved. populateRoute {}, {}, {}, {}", prevLocation, prefix, hostMac, vlanId);
+                    srManager.defaultRoutingHandler.populateRoute(prevLocation.deviceId(), prefix,
+                            hostMac, vlanId, pairLocalPort.get());
+                    return;
+                }
+
+                // No pair information supplied. Remove route
+                log.debug("HostMoved. revokeRoute {}, {}, {}, {}", prevLocation, prefix, hostMac, hostVlanId);
+                srManager.defaultRoutingHandler.revokeRoute(prevLocation.deviceId(), prefix,
+                        hostMac, hostVlanId, prevLocation.port());
+            });
+
+            // For each new location, add all new IPs.
+            Sets.difference(newLocations, prevLocations).stream().filter(srManager::isMasterOf)
+                    .forEach(newLocation -> {
+                log.debug("HostMoved. populateRoute {}, {}, {}, {}", newLocation, prefix, hostMac, hostVlanId);
+                srManager.defaultRoutingHandler.populateRoute(newLocation.deviceId(), prefix,
+                        hostMac, hostVlanId, newLocation.port());
+            });
+
+        });
+    }
+
+    private Set<ResolvedRoute> affectedRoutes(MacAddress mac, VlanId vlanId) {
+        return srManager.routeService.getRouteTables().stream()
+                .map(routeTableId -> srManager.routeService.getRoutes(routeTableId))
+                .flatMap(Collection::stream)
+                .map(RouteInfo::allRoutes)
+                .flatMap(Collection::stream)
+                .filter(resolvedRoute -> mac.equals(resolvedRoute.nextHopMac()) &&
+                        vlanId.equals(resolvedRoute.nextHopVlan())).collect(Collectors.toSet());
     }
 
     private boolean isReady() {
         return Objects.nonNull(srManager.deviceConfiguration) &&
-                Objects.nonNull(srManager.defaultRoutingHandler) &&
-                Objects.nonNull(srManager.routingRulePopulator);
+                Objects.nonNull(srManager.defaultRoutingHandler);
+    }
+
+    void enqueueRouteEvent(RouteEvent routeEvent) {
+        log.debug("Enqueue routeEvent {}", routeEvent);
+        routeEventCache.put(routeEvent.subject().prefix(), routeEvent);
+    }
+
+    void dequeueRouteEvent(RouteEvent routeEvent) {
+        log.debug("Dequeue routeEvent {}", routeEvent);
+        switch (routeEvent.type()) {
+            case ROUTE_ADDED:
+                processRouteAddedInternal(routeEvent.alternatives());
+                break;
+            case ROUTE_REMOVED:
+                processRouteRemovedInternal(routeEvent.alternatives());
+                break;
+            case ROUTE_UPDATED:
+            case ALTERNATIVE_ROUTES_CHANGED:
+                processRouteUpdatedInternal(Sets.newHashSet(routeEvent.alternatives()),
+                        Sets.newHashSet(routeEvent.prevAlternatives()));
+                break;
+            default:
+                break;
+        }
     }
 }
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index dd11423..3fb38ba 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -119,7 +119,7 @@
      * @param hostVlanId Vlan ID of the nexthop
      * @param outPort port where the next hop attaches to
      */
-    public void populateRoute(DeviceId deviceId, IpPrefix prefix,
+    void populateRoute(DeviceId deviceId, IpPrefix prefix,
                               MacAddress hostMac, VlanId hostVlanId, PortNumber outPort) {
         log.debug("Populate direct routing entry for route {} at {}:{}",
                 prefix, deviceId, outPort);
@@ -136,9 +136,11 @@
                     + "to error for dev:{} route:{}", deviceId, prefix);
             return;
         }
+
+        int nextId = fwdBuilder.add().nextId();
         ObjectiveContext context = new DefaultObjectiveContext(
-                (objective) -> log.debug("Direct routing rule for route {} populated",
-                                         prefix),
+                (objective) -> log.debug("Direct routing rule for route {} populated. nextId={}",
+                                         prefix, nextId),
                 (objective, error) ->
                         log.warn("Failed to populate direct routing rule for route {}: {}",
                                  prefix, error));
@@ -155,7 +157,7 @@
      * @param hostVlanId Vlan ID of the nexthop
      * @param outPort port that next hop attaches to
      */
-    public void revokeRoute(DeviceId deviceId, IpPrefix prefix,
+    void revokeRoute(DeviceId deviceId, IpPrefix prefix,
             MacAddress hostMac, VlanId hostVlanId, PortNumber outPort) {
         log.debug("Revoke IP table entry for route {} at {}:{}",
                 prefix, deviceId, outPort);
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 6be675a..79bd8d3 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -130,6 +130,7 @@
 public class SegmentRoutingManager implements SegmentRoutingService {
 
     private static Logger log = LoggerFactory.getLogger(SegmentRoutingManager.class);
+    private static final String NOT_MASTER = "Current instance is not the master of {}. Ignore.";
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     private ComponentConfigService compCfgService;
@@ -700,6 +701,20 @@
     }
 
     /**
+     * Determine if current instance is the master of given connect point.
+     *
+     * @param cp connect point
+     * @return true if current instance is the master of given connect point
+     */
+    boolean isMasterOf(ConnectPoint cp) {
+        boolean isMaster = mastershipService.isLocalMaster(cp.deviceId());
+        if (!isMaster) {
+            log.debug(NOT_MASTER, cp);
+        }
+        return isMaster;
+    }
+
+    /**
      * Returns locations of given resolved route.
      *
      * @param resolvedRoute resolved route
@@ -1539,6 +1554,7 @@
                     break;
                 case HOST_MOVED:
                     hostHandler.processHostMovedEvent(event);
+                    routeHandler.processHostMovedEvent(event);
                     break;
                 case HOST_REMOVED:
                     hostHandler.processHostRemovedEvent(event);
@@ -1587,6 +1603,9 @@
                 case ROUTE_REMOVED:
                     routeHandler.processRouteRemoved(event);
                     break;
+                case ALTERNATIVE_ROUTES_CHANGED:
+                    routeHandler.processAlternativeRoutesChanged(event);
+                    break;
                 default:
                     break;
             }
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/HostHandlerTest.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/HostHandlerTest.java
index 3ad2d52..3e576b95 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/HostHandlerTest.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/HostHandlerTest.java
@@ -60,6 +60,7 @@
             Maps.newConcurrentMap();
     private static final Map<MockRoutingTableKey, MockRoutingTableValue> ROUTING_TABLE =
             Maps.newConcurrentMap();
+    private static final Map<ConnectPoint, Set<IpPrefix>> SUBNET_TABLE = Maps.newConcurrentMap();
     // Mocked Next Id
     private static final Map<Integer, TrafficTreatment> NEXT_TABLE = Maps.newConcurrentMap();
 
@@ -191,6 +192,7 @@
         srManager.deviceConfiguration = new DeviceConfiguration(srManager);
         srManager.flowObjectiveService = new MockFlowObjectiveService(BRIDGING_TABLE, NEXT_TABLE);
         srManager.routingRulePopulator = new MockRoutingRulePopulator(srManager, ROUTING_TABLE);
+        srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE);
         srManager.interfaceService = new MockInterfaceService(INTERFACES);
         srManager.mastershipService = new MockMastershipService(LOCAL_DEVICES);
         srManager.hostService = new MockHostService(HOSTS);
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockDefaultRoutingHandler.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockDefaultRoutingHandler.java
index a69d5e7..ec07238 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockDefaultRoutingHandler.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockDefaultRoutingHandler.java
@@ -36,6 +36,15 @@
 
     @Override
     protected void populateSubnet(Set<ConnectPoint> cpts, Set<IpPrefix> subnets) {
+        subnetTable.forEach((k, v) -> {
+            if (!cpts.contains(k)) {
+                subnetTable.get(k).removeAll(subnets);
+                if (subnetTable.get(k).isEmpty()) {
+                    subnetTable.remove(k);
+                }
+            }
+        });
+
         cpts.forEach(cpt -> subnetTable.put(cpt, subnets));
     }
 
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockRouteService.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockRouteService.java
index 14e2166..7927636 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockRouteService.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/MockRouteService.java
@@ -16,29 +16,44 @@
 
 package org.onosproject.segmentrouting;
 
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.routeservice.ResolvedRoute;
+import org.onosproject.routeservice.Route;
 import org.onosproject.routeservice.RouteInfo;
 import org.onosproject.routeservice.RouteServiceAdapter;
 import org.onosproject.routeservice.RouteTableId;
 
 import java.util.Collection;
-import java.util.Set;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * Mock Route Service.
  * We assume there is only one routing table named "default".
  */
 public class MockRouteService extends RouteServiceAdapter {
-    private Set<RouteInfo> routes;
+    private Map<MockRoutingTableKey, MockRoutingTableValue> routingTable;
 
-    MockRouteService(Set<RouteInfo> routes) {
-        this.routes = ImmutableSet.copyOf(routes);
+    MockRouteService(Map<MockRoutingTableKey, MockRoutingTableValue> routingTable) {
+        this.routingTable = routingTable;
     }
 
     @Override
     public Collection<RouteInfo> getRoutes(RouteTableId id) {
-        return routes;
+        return routingTable.entrySet().stream().map(e -> {
+            IpPrefix prefix = e.getKey().ipPrefix;
+            IpAddress nextHop = IpAddress.valueOf(0); // dummy
+            MacAddress mac = e.getValue().macAddress;
+            VlanId vlan = e.getValue().vlanId;
+            Route route = new Route(Route.Source.STATIC, prefix, nextHop);
+            ResolvedRoute rr = new ResolvedRoute(route, mac, vlan);
+
+            return new RouteInfo(prefix, rr, Sets.newHashSet(rr));
+        }).collect(Collectors.toSet());
     }
 
     @Override
diff --git a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
index 383f800..775e5ee 100644
--- a/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
+++ b/apps/segmentrouting/src/test/java/org/onosproject/segmentrouting/RouteHandlerTest.java
@@ -16,6 +16,8 @@
 
 package org.onosproject.segmentrouting;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import org.junit.Before;
@@ -24,21 +26,25 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
+import org.onosproject.net.config.ConfigApplyDelegate;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultHost;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Host;
 import org.onosproject.net.HostId;
 import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
 import org.onosproject.net.config.NetworkConfigRegistryAdapter;
 import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.host.HostEvent;
+import org.onosproject.net.host.HostService;
 import org.onosproject.net.intf.Interface;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.routeservice.ResolvedRoute;
 import org.onosproject.routeservice.Route;
 import org.onosproject.routeservice.RouteEvent;
-import org.onosproject.routeservice.RouteInfo;
 import org.onosproject.segmentrouting.config.DeviceConfiguration;
+import org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig;
 
 import java.util.Map;
 import java.util.Set;
@@ -50,6 +56,7 @@
  */
 public class RouteHandlerTest {
     private RouteHandler routeHandler;
+    private HostService hostService;
 
     // Mocked routing and bridging tables
     private static final Map<MockBridgingTableKey, MockBridgingTableValue> BRIDGING_TABLE =
@@ -61,6 +68,8 @@
     private static final Map<Integer, TrafficTreatment> NEXT_TABLE = Maps.newConcurrentMap();
 
     private static final IpPrefix P1 = IpPrefix.valueOf("10.0.0.0/24");
+
+    // Single homed router 1
     private static final IpAddress N1 = IpAddress.valueOf("10.0.1.254");
     private static final MacAddress M1 = MacAddress.valueOf("00:00:00:00:00:01");
     private static final VlanId V1 = VlanId.vlanId((short) 1);
@@ -68,48 +77,61 @@
     private static final Route R1 = new Route(Route.Source.STATIC, P1, N1);
     private static final ResolvedRoute RR1 = new ResolvedRoute(R1, M1, V1);
 
+    // Single homed router 2
     private static final IpAddress N2 = IpAddress.valueOf("10.0.2.254");
     private static final MacAddress M2 = MacAddress.valueOf("00:00:00:00:00:02");
     private static final VlanId V2 = VlanId.vlanId((short) 2);
-    private static final ConnectPoint CP2 = ConnectPoint.deviceConnectPoint("of:0000000000000001/2");
+    private static final ConnectPoint CP2 = ConnectPoint.deviceConnectPoint("of:0000000000000002/2");
     private static final Route R2 = new Route(Route.Source.STATIC, P1, N2);
     private static final ResolvedRoute RR2 = new ResolvedRoute(R2, M2, V2);
 
-    private static final RouteInfo RI1 = new RouteInfo(P1, RR1, Sets.newHashSet(RR1));
+    // Dual homed router 1
+    private static final IpAddress N3 = IpAddress.valueOf("10.0.3.254");
+    private static final MacAddress M3 = MacAddress.valueOf("00:00:00:00:00:03");
+    private static final VlanId V3 = VlanId.vlanId((short) 3);
+    private static final Route R3 = new Route(Route.Source.STATIC, P1, N3);
+    private static final ResolvedRoute RR3 = new ResolvedRoute(R3, M3, V3);
 
+    // Hosts
     private static final Host H1 = new DefaultHost(ProviderId.NONE, HostId.hostId(M1, V1), M1, V1,
             Sets.newHashSet(new HostLocation(CP1, 0)), Sets.newHashSet(N1), false);
     private static final Host H2 = new DefaultHost(ProviderId.NONE, HostId.hostId(M2, V2), M2, V2,
             Sets.newHashSet(new HostLocation(CP2, 0)), Sets.newHashSet(N2), false);
+    private static final Host H3D = new DefaultHost(ProviderId.NONE, HostId.hostId(M3, V3), M3, V3,
+            Sets.newHashSet(new HostLocation(CP1, 0), new HostLocation(CP2, 0)), Sets.newHashSet(N3), false);
+    private static final Host H3S = new DefaultHost(ProviderId.NONE, HostId.hostId(M3, V3), M3, V3,
+            Sets.newHashSet(new HostLocation(CP1, 0)), Sets.newHashSet(N3), false);
+
+    // Pair Local Port
+    private static final PortNumber P9 = PortNumber.portNumber(9);
 
     // A set of hosts
-    private static final Set<Host> HOSTS = Sets.newHashSet(H1, H2);
+    private static final Set<Host> HOSTS = Sets.newHashSet(H1, H2, H3D);
+    private static final Set<Host> HOSTS_ONE_FAIL = Sets.newHashSet(H1, H2, H3S);
+    private static final Set<Host> HOSTS_BOTH_FAIL = Sets.newHashSet(H1, H2);
     // A set of devices of which we have mastership
-    private static final Set<DeviceId> LOCAL_DEVICES = Sets.newHashSet();
+    private static final Set<DeviceId> LOCAL_DEVICES = Sets.newHashSet(CP1.deviceId(), CP2.deviceId());
     // A set of interfaces
     private static final Set<Interface> INTERFACES = Sets.newHashSet();
-    // A set of routes
-    private static final Set<RouteInfo> ROUTE_INFOS = Sets.newHashSet(RI1);
 
     @Before
     public void setUp() throws Exception {
-// TODO Initialize pairDevice and pairLocalPort config
-//        ObjectMapper mapper = new ObjectMapper();
-//        ConfigApplyDelegate delegate = config -> {};
-//
-//        SegmentRoutingDeviceConfig dev3Config = new SegmentRoutingDeviceConfig();
-//        JsonNode dev3Tree = mapper.createObjectNode();
-//        dev3Config.init(DEV3, "host-handler-test", dev3Tree, mapper, delegate);
-//        dev3Config.setPairDeviceId(DEV4).setPairLocalPort(P9);
-//
-//        SegmentRoutingDeviceConfig dev4Config = new SegmentRoutingDeviceConfig();
-//        JsonNode dev4Tree = mapper.createObjectNode();
-//        dev4Config.init(DEV4, "host-handler-test", dev4Tree, mapper, delegate);
-//        dev4Config.setPairDeviceId(DEV3).setPairLocalPort(P9);
+        ObjectMapper mapper = new ObjectMapper();
+        ConfigApplyDelegate delegate = config -> { };
+
+        SegmentRoutingDeviceConfig dev1Config = new SegmentRoutingDeviceConfig();
+        JsonNode dev1Tree = mapper.createObjectNode();
+        dev1Config.init(CP1.deviceId(), "host-handler-test", dev1Tree, mapper, delegate);
+        dev1Config.setPairDeviceId(CP2.deviceId()).setPairLocalPort(P9);
+
+        SegmentRoutingDeviceConfig dev2Config = new SegmentRoutingDeviceConfig();
+        JsonNode dev2Tree = mapper.createObjectNode();
+        dev2Config.init(CP2.deviceId(), "host-handler-test", dev2Tree, mapper, delegate);
+        dev2Config.setPairDeviceId(CP1.deviceId()).setPairLocalPort(P9);
 
         MockNetworkConfigRegistry mockNetworkConfigRegistry = new MockNetworkConfigRegistry();
-//        mockNetworkConfigRegistry.applyConfig(dev3Config);
-//        mockNetworkConfigRegistry.applyConfig(dev4Config);
+        mockNetworkConfigRegistry.applyConfig(dev1Config);
+        mockNetworkConfigRegistry.applyConfig(dev2Config);
 
         // Initialize Segment Routing Manager
         SegmentRoutingManager srManager = new MockSegmentRoutingManager(NEXT_TABLE);
@@ -120,11 +142,18 @@
         srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE);
         srManager.interfaceService = new MockInterfaceService(INTERFACES);
         srManager.mastershipService = new MockMastershipService(LOCAL_DEVICES);
-        srManager.hostService = new MockHostService(HOSTS);
+        hostService = new MockHostService(HOSTS);
+        srManager.hostService = hostService;
         srManager.cfgService = mockNetworkConfigRegistry;
-        srManager.routeService = new MockRouteService(ROUTE_INFOS);
+        srManager.routeService = new MockRouteService(ROUTING_TABLE);
 
-        routeHandler = new RouteHandler(srManager);
+        routeHandler = new RouteHandler(srManager) {
+            // routeEventCache is not necessary for unit tests
+            @Override
+            void enqueueRouteEvent(RouteEvent routeEvent) {
+                dequeueRouteEvent(routeEvent);
+            }
+        };
 
         ROUTING_TABLE.clear();
         BRIDGING_TABLE.clear();
@@ -133,6 +162,10 @@
 
     @Test
     public void init() throws Exception {
+        MockRoutingTableKey rtk = new MockRoutingTableKey(CP1.deviceId(), P1);
+        MockRoutingTableValue rtv = new MockRoutingTableValue(CP1.port(), M1, V1);
+        ROUTING_TABLE.put(rtk, rtv);
+
         routeHandler.init(CP1.deviceId());
 
         assertEquals(1, ROUTING_TABLE.size());
@@ -147,7 +180,7 @@
 
     @Test
     public void processRouteAdded() throws Exception {
-        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, RR1);
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, RR1, Sets.newHashSet(RR1));
         routeHandler.processRouteAdded(re);
 
         assertEquals(1, ROUTING_TABLE.size());
@@ -164,11 +197,12 @@
     public void processRouteUpdated() throws Exception {
         processRouteAdded();
 
-        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, RR2, RR1);
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, RR2, RR1, Sets.newHashSet(RR2),
+                Sets.newHashSet(RR1));
         routeHandler.processRouteUpdated(re);
 
         assertEquals(1, ROUTING_TABLE.size());
-        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP2.deviceId(), P1));
         assertEquals(M2, rtv2.macAddress);
         assertEquals(V2, rtv2.vlanId);
         assertEquals(CP2.port(), rtv2.portNumber);
@@ -181,7 +215,148 @@
     public void processRouteRemoved() throws Exception {
         processRouteAdded();
 
-        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, RR1);
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, RR1, Sets.newHashSet(RR1));
+        routeHandler.processRouteRemoved(re);
+
+        assertEquals(0, ROUTING_TABLE.size());
+        assertEquals(0, SUBNET_TABLE.size());
+    }
+
+    @Test
+    public void testTwoSingleHomedAdded() throws Exception {
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, RR1, Sets.newHashSet(RR1, RR2));
+        routeHandler.processRouteAdded(re);
+
+        assertEquals(2, ROUTING_TABLE.size());
+        MockRoutingTableValue rtv1 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP2.deviceId(), P1));
+        assertEquals(M1, rtv1.macAddress);
+        assertEquals(M2, rtv2.macAddress);
+        assertEquals(V1, rtv1.vlanId);
+        assertEquals(V2, rtv2.vlanId);
+        assertEquals(CP1.port(), rtv1.portNumber);
+        assertEquals(CP2.port(), rtv2.portNumber);
+
+        assertEquals(2, SUBNET_TABLE.size());
+        assertTrue(SUBNET_TABLE.get(CP1).contains(P1));
+        assertTrue(SUBNET_TABLE.get(CP2).contains(P1));
+    }
+
+    @Test
+    public void testOneDualHomedAdded() throws Exception {
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, RR3, Sets.newHashSet(RR3));
+        routeHandler.processRouteAdded(re);
+
+        assertEquals(2, ROUTING_TABLE.size());
+        MockRoutingTableValue rtv1 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP2.deviceId(), P1));
+        assertEquals(M3, rtv1.macAddress);
+        assertEquals(M3, rtv2.macAddress);
+        assertEquals(V3, rtv1.vlanId);
+        assertEquals(V3, rtv2.vlanId);
+        assertEquals(CP1.port(), rtv1.portNumber);
+        assertEquals(CP2.port(), rtv2.portNumber);
+
+        assertEquals(2, SUBNET_TABLE.size());
+        assertTrue(SUBNET_TABLE.get(CP1).contains(P1));
+        assertTrue(SUBNET_TABLE.get(CP2).contains(P1));
+    }
+
+    @Test
+    public void testOneSingleHomedToTwoSingleHomed() throws Exception {
+        processRouteAdded();
+
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ALTERNATIVE_ROUTES_CHANGED, RR1, null,
+                Sets.newHashSet(RR1, RR2), Sets.newHashSet(RR1));
+        routeHandler.processAlternativeRoutesChanged(re);
+
+        assertEquals(2, ROUTING_TABLE.size());
+        MockRoutingTableValue rtv1 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP2.deviceId(), P1));
+        assertEquals(M1, rtv1.macAddress);
+        assertEquals(M2, rtv2.macAddress);
+        assertEquals(V1, rtv1.vlanId);
+        assertEquals(V2, rtv2.vlanId);
+        assertEquals(CP1.port(), rtv1.portNumber);
+        assertEquals(CP2.port(), rtv2.portNumber);
+
+        assertEquals(2, SUBNET_TABLE.size());
+        assertTrue(SUBNET_TABLE.get(CP1).contains(P1));
+        assertTrue(SUBNET_TABLE.get(CP2).contains(P1));
+    }
+
+    @Test
+    public void testTwoSingleHomedToOneSingleHomed() throws Exception {
+        testTwoSingleHomedAdded();
+
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ALTERNATIVE_ROUTES_CHANGED, RR1, null,
+                Sets.newHashSet(RR1), Sets.newHashSet(RR1, RR2));
+        routeHandler.processAlternativeRoutesChanged(re);
+
+        assertEquals(1, ROUTING_TABLE.size());
+        MockRoutingTableValue rtv1 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        assertEquals(M1, rtv1.macAddress);
+        assertEquals(V1, rtv1.vlanId);
+        assertEquals(CP1.port(), rtv1.portNumber);
+
+        assertEquals(1, SUBNET_TABLE.size());
+        assertTrue(SUBNET_TABLE.get(CP1).contains(P1));
+    }
+
+    @Test
+    public void testDualHomedSingleLocationFail() throws Exception {
+        testOneDualHomedAdded();
+
+        HostEvent he = new HostEvent(HostEvent.Type.HOST_MOVED, H3S, H3D);
+        routeHandler.processHostMovedEvent(he);
+
+        assertEquals(2, ROUTING_TABLE.size());
+        MockRoutingTableValue rtv1 = ROUTING_TABLE.get(new MockRoutingTableKey(CP1.deviceId(), P1));
+        MockRoutingTableValue rtv2 = ROUTING_TABLE.get(new MockRoutingTableKey(CP2.deviceId(), P1));
+        assertEquals(M3, rtv1.macAddress);
+        assertEquals(M3, rtv2.macAddress);
+        assertEquals(V3, rtv1.vlanId);
+        assertEquals(V3, rtv2.vlanId);
+        assertEquals(CP1.port(), rtv1.portNumber);
+        assertEquals(P9, rtv2.portNumber);
+
+        // ECMP route table hasn't changed
+        assertEquals(2, SUBNET_TABLE.size());
+        assertTrue(SUBNET_TABLE.get(CP1).contains(P1));
+        assertTrue(SUBNET_TABLE.get(CP2).contains(P1));
+    }
+
+    @Test
+    public void testDualHomedBothLocationFail() throws Exception {
+        testDualHomedSingleLocationFail();
+
+        hostService = new MockHostService(HOSTS_ONE_FAIL);
+
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, RR3, Sets.newHashSet(RR3));
+        routeHandler.processRouteRemoved(re);
+
+        assertEquals(0, ROUTING_TABLE.size());
+        assertEquals(0, SUBNET_TABLE.size());
+    }
+
+    @Test
+    public void testTwoSingleHomedRemoved() throws Exception {
+        testTwoSingleHomedAdded();
+
+        hostService = new MockHostService(HOSTS_BOTH_FAIL);
+
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, RR1, Sets.newHashSet(RR1, RR2));
+        routeHandler.processRouteRemoved(re);
+
+        assertEquals(0, ROUTING_TABLE.size());
+        assertEquals(0, SUBNET_TABLE.size());
+    }
+
+    @Test
+    public void testOneDualHomeRemoved() throws Exception {
+        testOneDualHomedAdded();
+
+        RouteEvent re = new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, RR3, Sets.newHashSet(RR3));
         routeHandler.processRouteRemoved(re);
 
         assertEquals(0, ROUTING_TABLE.size());
diff --git a/core/api/src/main/java/org/onosproject/net/provider/AbstractListenerProviderRegistry.java b/core/api/src/main/java/org/onosproject/net/provider/AbstractListenerProviderRegistry.java
index 43303cb..f65f3bc 100644
--- a/core/api/src/main/java/org/onosproject/net/provider/AbstractListenerProviderRegistry.java
+++ b/core/api/src/main/java/org/onosproject/net/provider/AbstractListenerProviderRegistry.java
@@ -27,7 +27,7 @@
 /**
  * Basis for components which need to export listener mechanism.
  */
-@Component(componentAbstract = true)
+@Component
 public abstract class AbstractListenerProviderRegistry<E extends Event, L extends EventListener<E>,
                                                        P extends Provider, S extends ProviderService<P>>
         extends AbstractProviderRegistry<P, S> implements ListenerService<E, L> {
diff --git a/core/api/src/main/java/org/onosproject/rest/AbstractApiDocRegistrator.java b/core/api/src/main/java/org/onosproject/rest/AbstractApiDocRegistrator.java
index 505d090..de8058a 100644
--- a/core/api/src/main/java/org/onosproject/rest/AbstractApiDocRegistrator.java
+++ b/core/api/src/main/java/org/onosproject/rest/AbstractApiDocRegistrator.java
@@ -24,7 +24,7 @@
 /**
  * Self-registering REST API provider.
  */
-@Component(immediate = true, componentAbstract = true)
+@Component(immediate = true)
 public abstract class AbstractApiDocRegistrator {
 
     protected final ApiDocProvider provider;
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
index 333cbb1..0ef9aef 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
@@ -74,8 +74,8 @@
     public DocumentPath(String nodeName, DocumentPath parentPath) {
         checkNotNull(nodeName, "Node name cannot be null");
         if (nodeName.contains(pathSeparator)) {
-            throw new IllegalDocumentNameException(
-                    "Periods are not allowed in names.");
+            throw new IllegalDocumentNameException("'" + pathSeparator + "'" +
+                    " are not allowed in names.");
         }
         if (parentPath != null) {
             pathElements.addAll(parentPath.pathElements());
diff --git a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
index b1b315a..8839c59 100644
--- a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
+++ b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
@@ -30,7 +30,6 @@
 import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 import org.slf4j.Logger;
-import java.io.IOException;
 import java.util.List;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.slf4j.LoggerFactory.getLogger;
@@ -49,7 +48,7 @@
         NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession();
         try {
             version = session.get(showVersionRequestBuilder());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve version info.", e));
         }
 
@@ -71,7 +70,7 @@
         NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession();
         try {
             interfaces = session.get(showInterfacesRequestBuilder());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Failed to retrieve Interfaces");
             return ImmutableList.of();
         }
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuT100DeviceDescription.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuT100DeviceDescription.java
index 32dd5cd..142b53a 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuT100DeviceDescription.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuT100DeviceDescription.java
@@ -33,11 +33,11 @@
 import org.onosproject.net.device.PortDescription;
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 import org.slf4j.Logger;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -68,7 +68,7 @@
         String reply;
         try {
             reply = session.get(requestBuilder());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Failed to retrieve port details for device {}", handler().data().deviceId());
             return ImmutableList.of();
         }
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlarmConsumer.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlarmConsumer.java
index f0ae5fe..01df800 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlarmConsumer.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlarmConsumer.java
@@ -27,11 +27,11 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.mastership.MastershipService;
 
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.text.SimpleDateFormat;
@@ -138,7 +138,7 @@
                 alarms = parseVoltActiveAlerts(XmlConfigParser.
                     loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8))));
             }
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Error reading alarms for device {} exception {}", ncDeviceId, e);
         }
 
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
index 860d6e1..18fe8ee 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
@@ -21,10 +21,10 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.mastership.MastershipService;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Set;
 
 import com.google.common.collect.ImmutableSet;
@@ -79,7 +79,7 @@
                     .get(ncDeviceId)
                     .getSession()
                     .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -118,7 +118,7 @@
 
             controller.getDevicesMap().get(ncDeviceId).getSession().
                     editConfig(RUNNING, null, request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
             return false;
         }
@@ -159,7 +159,7 @@
                 controller.getDevicesMap().get(ncDeviceId).getSession().
                         startSubscription(request.toString());
             }
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
             return false;
         }
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfig.java
index 2431d2d..9d5ba5c 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfig.java
@@ -37,7 +37,6 @@
 import org.slf4j.Logger;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.io.StringWriter;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -110,7 +109,7 @@
                 log.debug("Reply XML {}", reply);
                 controllers.addAll(parseStreamVoltControllers(XmlConfigParser.
                         loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8)))));
-            } catch (IOException e) {
+            } catch (NetconfException e) {
                 log.error("Cannot communicate to device {} ", ncDeviceId);
             }
         } else {
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfig.java
index f48024e..05c4466 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfig.java
@@ -22,10 +22,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
-
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtility.*;
 import static org.slf4j.LoggerFactory.getLogger;
@@ -136,7 +135,7 @@
                     .get(ncDeviceId)
                     .getSession()
                     .doWrappedRpc(request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfig.java
index 59b6bf2..90b2678 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfig.java
@@ -22,10 +22,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
-
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtility.*;
 import static org.slf4j.LoggerFactory.getLogger;
@@ -67,7 +66,7 @@
                     .get(ncDeviceId)
                     .getSession()
                     .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
index c304609..2ae393c 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
@@ -22,9 +22,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Set;
 
 import com.google.common.collect.ImmutableSet;
@@ -99,7 +99,7 @@
                         .get(ncDeviceId)
                         .getSession()
                         .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -166,7 +166,7 @@
                 .get(ncDeviceId)
                 .getSession()
                 .editConfig(RUNNING, null, request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
             return false;
         }
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfig.java
index 56113cb..9174464 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfig.java
@@ -23,9 +23,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Set;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -118,7 +118,7 @@
                         .get(ncDeviceId)
                         .getSession()
                         .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -180,7 +180,7 @@
                         .get(ncDeviceId)
                         .getSession()
                         .doWrappedRpc(request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -255,7 +255,7 @@
                         .get(ncDeviceId)
                         .getSession()
                         .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfig.java
index 1af5e34..a126694 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfig.java
@@ -23,9 +23,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Set;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -88,7 +88,7 @@
                     .get(ncDeviceId)
                     .getSession()
                     .doWrappedRpc(request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -157,7 +157,7 @@
                     .get(ncDeviceId)
                     .getSession()
                     .doWrappedRpc(request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
index bbf405c..675378b 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
@@ -22,9 +22,9 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.HashMap;
@@ -138,7 +138,7 @@
                         .get(ncDeviceId)
                         .getSession()
                         .get(request.toString(), REPORT_ALL);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return reply;
@@ -186,7 +186,7 @@
 
             result = controller.getDevicesMap().get(ncDeviceId).getSession().
                     editConfig(RUNNING, null, request.toString());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Cannot communicate to device {} exception {}", ncDeviceId, e);
         }
         return result;
diff --git a/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiDeviceDescription.java b/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiDeviceDescription.java
index 1693a09..5162b48 100644
--- a/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiDeviceDescription.java
+++ b/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiDeviceDescription.java
@@ -33,7 +33,6 @@
 import org.onosproject.netconf.NetconfSession;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
 
@@ -79,7 +78,7 @@
         String sysInfo;
         try {
             sysInfo = session.get(getVersionReq());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new IllegalArgumentException(
                     new NetconfException(DEV_INFO_FAILURE));
         }
@@ -191,7 +190,7 @@
         String interfaces = null;
         try {
             interfaces = session.get(getInterfacesReq());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.info("Failed to retrive interface {} ", e.getMessage());
         }
         return interfaces;
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
index f61b837..c60c448 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/DeviceDiscoveryJuniperImpl.java
@@ -25,10 +25,10 @@
 import org.onosproject.net.device.PortDescription;
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -59,7 +59,7 @@
         try {
             sysInfo = session.get(requestBuilder(REQ_SYS_INFO));
             chassis = session.get(requestBuilder(REQ_MAC_ADD_INFO));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.warn("Failed to retrieve device details for {}", devId);
             return null;
         }
@@ -80,7 +80,7 @@
         String reply;
         try {
             reply = session.get(requestBuilder(REQ_IF_INFO));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.warn("Failed to retrieve ports for device {}", devId);
             return ImmutableList.of();
         }
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
index 18d08dd..d4c09dc 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
@@ -42,7 +42,6 @@
 import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -100,7 +99,7 @@
         String reply;
         try {
             reply = session.get(routingTableBuilder());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
                     e));
         }
@@ -241,7 +240,7 @@
                             type == ADD ? "added" : "removed", staticRoute);
                 }
             }
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
                     e));
         }
@@ -335,7 +334,7 @@
         String replay;
         try {
             replay = session.get(commitBuilder());
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
                     e));
         }
@@ -355,7 +354,7 @@
         String replay;
         try {
             replay = session.get(rollbackBuilder(0));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
                     e));
         }
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
index fb15c3e..613f6d4 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
@@ -27,10 +27,10 @@
 import org.onosproject.net.driver.AbstractHandlerBehaviour;
 import org.onosproject.net.link.LinkDescription;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 import org.slf4j.Logger;
 
-import java.io.IOException;
 import java.util.HashSet;
 import java.util.Optional;
 import java.util.Set;
@@ -66,7 +66,7 @@
         String reply;
         try {
             reply = session.get(requestBuilder(REQ_LLDP_NBR_INFO));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.warn("Failed to retrieve ports for device {}", localDeviceId);
             return ImmutableSet.of();
         }
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
index 087af0c..039b760 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
@@ -19,8 +19,6 @@
 import static org.onosproject.netconf.DatastoreId.datastore;
 import static org.slf4j.LoggerFactory.getLogger;
 
-import java.io.IOException;
-
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onosproject.net.DeviceId;
@@ -30,6 +28,7 @@
 import org.onosproject.net.packet.PacketProcessor;
 import org.onosproject.net.packet.PacketService;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
 import com.google.common.base.Preconditions;
@@ -69,7 +68,7 @@
         try {
             return controller.getDevicesMap().get(ofDeviceId).getSession()
                     .getConfig(datastore(type.replace("cfgType=", "")));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Configuration could not be retrieved {}", e.getMessage());
         }
         return UNABLE_TO_READ_CONFIG;
diff --git a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
index 2739872..a353c28 100644
--- a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
+++ b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
@@ -23,10 +23,9 @@
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.DatastoreId;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
-import java.io.IOException;
-
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
@@ -57,7 +56,7 @@
                     get(ofDeviceId).
                     getSession().
                     getConfig(DatastoreId.datastore(type));
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Configuration could not be retrieved {}",
                       e.getMessage());
         }
diff --git a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigSetter.java b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigSetter.java
index 138aa4f..6102b1a 100644
--- a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigSetter.java
+++ b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigSetter.java
@@ -22,6 +22,7 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.driver.DriverHandler;
 import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
 import java.io.IOException;
@@ -68,7 +69,7 @@
                     .get(deviceId)
                     .getSession()
                     .requestSync(request);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Configuration could not be set", e);
         }
         return UNABLE_TO_SET_CONFIG;
diff --git a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
index 6a8710d..70f01a6 100644
--- a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
+++ b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
@@ -27,11 +27,10 @@
 import org.onosproject.netconf.DatastoreId;
 import org.onosproject.netconf.NetconfController;
 import org.onosproject.netconf.NetconfDevice;
-
+import org.onosproject.netconf.NetconfException;
 import org.slf4j.Logger;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
@@ -63,7 +62,7 @@
                 log.debug("Reply XML {}", reply);
                 controllers.addAll(XmlConfigParser.parseStreamControllers(XmlConfigParser.
                         loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8)))));
-            } catch (IOException e) {
+            } catch (NetconfException e) {
                 log.error("Cannot communicate with device {} ", deviceId, e);
             }
         } else {
@@ -95,14 +94,14 @@
                                     new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8))),
                             "running", "merge", "create", controllers
                     );
-                } catch (IOException e) {
+                } catch (NetconfException e) {
                     log.error("Cannot comunicate to device {} , exception {}", deviceId, e.getMessage());
                 }
                 device.getSession().editConfig(config.substring(config.indexOf("-->") + 3));
             } catch (NullPointerException e) {
                 log.warn("No NETCONF device with requested parameters " + e);
                 throw new NullPointerException("No NETCONF device with requested parameters " + e);
-            } catch (IOException e) {
+            } catch (NetconfException e) {
                 log.error("Cannot comunicate to device {} , exception {}", deviceId, e.getMessage());
             }
         } else {
diff --git a/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java b/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
index 2f59b0f..c7053da 100644
--- a/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
+++ b/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
@@ -25,7 +25,6 @@
 import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 
-import java.io.IOException;
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -68,7 +67,7 @@
         String reply;
         try {
             reply = session.get(filter, null);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
         }
         return reply;
@@ -87,7 +86,7 @@
         String reply;
         try {
             reply = session.getConfig(DatastoreId.RUNNING, filter);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
         }
         return reply;
@@ -107,7 +106,7 @@
         boolean reply = false;
         try {
             reply = session.editConfig(DatastoreId.RUNNING, mode, cfg);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             throw new RuntimeException(new NetconfException("Failed to edit configuration.", e));
         }
         return reply;
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualMeterProvider.java b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualMeterProvider.java
index 26e47a9..69639de 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualMeterProvider.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/provider/DefaultVirtualMeterProvider.java
@@ -193,6 +193,10 @@
                     break;
                 case METER_REM_REQ:
                     break;
+                case METER_ADDED:
+                    break;
+                case METER_REMOVED:
+                    break;
                 default:
                     log.warn("Unknown meter event {}", event.type());
             }
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java
new file mode 100644
index 0000000..943627a
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualFlowRuleStore.java
@@ -0,0 +1,923 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ComparisonChain;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import com.google.common.util.concurrent.Futures;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Modified;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
+import org.onlab.util.Tools;
+import org.onosproject.cfg.ComponentConfigService;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.core.CoreService;
+import org.onosproject.core.IdGenerator;
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.incubator.net.virtual.VirtualNetworkFlowRuleStore;
+import org.onosproject.incubator.net.virtual.VirtualNetworkService;
+import org.onosproject.incubator.store.virtual.impl.primitives.VirtualDeviceId;
+import org.onosproject.incubator.store.virtual.impl.primitives.VirtualFlowEntry;
+import org.onosproject.incubator.store.virtual.impl.primitives.VirtualFlowRule;
+import org.onosproject.incubator.store.virtual.impl.primitives.VirtualFlowRuleBatchEvent;
+import org.onosproject.incubator.store.virtual.impl.primitives.VirtualFlowRuleBatchOperation;
+import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.flow.BatchOperationEntry;
+import org.onosproject.net.flow.CompletedBatchOperation;
+import org.onosproject.net.flow.DefaultFlowEntry;
+import org.onosproject.net.flow.FlowEntry;
+import org.onosproject.net.flow.FlowId;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleBatchEntry;
+import org.onosproject.net.flow.FlowRuleBatchEvent;
+import org.onosproject.net.flow.FlowRuleBatchOperation;
+import org.onosproject.net.flow.FlowRuleBatchRequest;
+import org.onosproject.net.flow.FlowRuleEvent;
+import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flow.FlowRuleStoreDelegate;
+import org.onosproject.net.flow.StoredFlowEntry;
+import org.onosproject.net.flow.TableStatisticsEntry;
+import org.onosproject.store.Timestamp;
+import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
+import org.onosproject.store.cluster.messaging.ClusterMessage;
+import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
+import org.onosproject.store.cluster.messaging.MessageSubject;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.EventuallyConsistentMapEvent;
+import org.onosproject.store.service.EventuallyConsistentMapListener;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.WallClockTimestamp;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.get;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Manages inventory of flow rules using a distributed state management protocol
+ * for virtual networks.
+ */
+//TODO: support backup and persistent mechanism
+@Component(immediate = true, enabled = false)
+@Service
+public class DistributedVirtualFlowRuleStore
+        extends AbstractVirtualStore<FlowRuleBatchEvent, FlowRuleStoreDelegate>
+        implements VirtualNetworkFlowRuleStore {
+
+    private final Logger log = getLogger(getClass());
+
+    //TODO: confirm this working fine with multiple thread more than 1
+    private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 1;
+    private static final boolean DEFAULT_PERSISTENCE_ENABLED = false;
+    private static final int DEFAULT_BACKUP_PERIOD_MILLIS = 2000;
+    private static final long FLOW_RULE_STORE_TIMEOUT_MILLIS = 5000;
+
+    private static final String FLOW_OP_TOPIC = "virtual-flow-ops-ids";
+
+    // MessageSubjects used by DistributedVirtualFlowRuleStore peer-peer communication.
+    private static final MessageSubject APPLY_BATCH_FLOWS
+            = new MessageSubject("virtual-peer-forward-apply-batch");
+    private static final MessageSubject GET_FLOW_ENTRY
+            = new MessageSubject("virtual-peer-forward-get-flow-entry");
+    private static final MessageSubject GET_DEVICE_FLOW_ENTRIES
+            = new MessageSubject("virtual-peer-forward-get-device-flow-entries");
+    private static final MessageSubject REMOVE_FLOW_ENTRY
+            = new MessageSubject("virtual-peer-forward-remove-flow-entry");
+    private static final MessageSubject REMOTE_APPLY_COMPLETED
+            = new MessageSubject("virtual-peer-apply-completed");
+
+    @Property(name = "msgHandlerPoolSize", intValue = MESSAGE_HANDLER_THREAD_POOL_SIZE,
+            label = "Number of threads in the message handler pool")
+    private int msgHandlerPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE;
+
+    @Property(name = "backupPeriod", intValue = DEFAULT_BACKUP_PERIOD_MILLIS,
+            label = "Delay in ms between successive backup runs")
+    private int backupPeriod = DEFAULT_BACKUP_PERIOD_MILLIS;
+    @Property(name = "persistenceEnabled", boolValue = false,
+            label = "Indicates whether or not changes in the flow table should be persisted to disk.")
+    private boolean persistenceEnabled = DEFAULT_PERSISTENCE_ENABLED;
+
+    private InternalFlowTable flowTable = new InternalFlowTable();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterCommunicationService clusterCommunicator;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ComponentConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected VirtualNetworkService vnaService;
+
+    private Map<Long, NodeId> pendingResponses = Maps.newConcurrentMap();
+    private ExecutorService messageHandlingExecutor;
+    private ExecutorService eventHandler;
+
+    private EventuallyConsistentMap<NetworkId, Map<DeviceId, List<TableStatisticsEntry>>> deviceTableStats;
+    private final EventuallyConsistentMapListener<NetworkId, Map<DeviceId, List<TableStatisticsEntry>>>
+            tableStatsListener = new InternalTableStatsListener();
+
+
+    protected final Serializer serializer = Serializer.using(KryoNamespace.newBuilder()
+                                                                     .register(KryoNamespaces.API)
+                                                                     .register(NetworkId.class)
+                                                                     .register(VirtualFlowRuleBatchOperation.class)
+                                                                     .register(VirtualFlowRuleBatchEvent.class)
+                                                                     .build());
+
+    protected final KryoNamespace.Builder serializerBuilder = KryoNamespace.newBuilder()
+            .register(KryoNamespaces.API)
+            .register(MastershipBasedTimestamp.class);
+
+    private IdGenerator idGenerator;
+    private NodeId local;
+
+
+    @Activate
+    public void activate(ComponentContext context) {
+        configService.registerProperties(getClass());
+
+        idGenerator = coreService.getIdGenerator(FLOW_OP_TOPIC);
+
+        local = clusterService.getLocalNode().id();
+
+        eventHandler = Executors.newSingleThreadExecutor(
+                groupedThreads("onos/virtual-flow", "event-handler", log));
+        messageHandlingExecutor = Executors.newFixedThreadPool(
+                msgHandlerPoolSize, groupedThreads("onos/store/virtual-flow", "message-handlers", log));
+
+        registerMessageHandlers(messageHandlingExecutor);
+
+        deviceTableStats = storageService
+                .<NetworkId, Map<DeviceId, List<TableStatisticsEntry>>>eventuallyConsistentMapBuilder()
+                .withName("onos-virtual-flow-table-stats")
+                .withSerializer(serializerBuilder)
+                .withAntiEntropyPeriod(5, TimeUnit.SECONDS)
+                .withTimestampProvider((k, v) -> new WallClockTimestamp())
+                .withTombstonesDisabled()
+                .build();
+        deviceTableStats.addListener(tableStatsListener);
+
+        logConfig("Started");
+    }
+
+    @Deactivate
+    public void deactivate(ComponentContext context) {
+        configService.unregisterProperties(getClass(), false);
+        unregisterMessageHandlers();
+        deviceTableStats.removeListener(tableStatsListener);
+        deviceTableStats.destroy();
+        eventHandler.shutdownNow();
+        messageHandlingExecutor.shutdownNow();
+        log.info("Stopped");
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Modified
+    public void modified(ComponentContext context) {
+        if (context == null) {
+            logConfig("Default config");
+            return;
+        }
+
+        Dictionary properties = context.getProperties();
+        int newPoolSize;
+        int newBackupPeriod;
+        try {
+            String s = get(properties, "msgHandlerPoolSize");
+            newPoolSize = isNullOrEmpty(s) ? msgHandlerPoolSize : Integer.parseInt(s.trim());
+
+            s = get(properties, "backupPeriod");
+            newBackupPeriod = isNullOrEmpty(s) ? backupPeriod : Integer.parseInt(s.trim());
+        } catch (NumberFormatException | ClassCastException e) {
+            newPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE;
+            newBackupPeriod = DEFAULT_BACKUP_PERIOD_MILLIS;
+        }
+
+        boolean restartBackupTask = false;
+
+        if (newBackupPeriod != backupPeriod) {
+            backupPeriod = newBackupPeriod;
+            restartBackupTask = true;
+        }
+        if (restartBackupTask) {
+            log.warn("Currently, backup tasks are not supported.");
+        }
+        if (newPoolSize != msgHandlerPoolSize) {
+            msgHandlerPoolSize = newPoolSize;
+            ExecutorService oldMsgHandler = messageHandlingExecutor;
+            messageHandlingExecutor = Executors.newFixedThreadPool(
+                    msgHandlerPoolSize, groupedThreads("onos/store/virtual-flow", "message-handlers", log));
+
+            // replace previously registered handlers.
+            registerMessageHandlers(messageHandlingExecutor);
+            oldMsgHandler.shutdown();
+        }
+
+        logConfig("Reconfigured");
+    }
+
+    @Override
+    public int getFlowRuleCount(NetworkId networkId) {
+        AtomicInteger sum = new AtomicInteger(0);
+        DeviceService deviceService = vnaService.get(networkId, DeviceService.class);
+        deviceService.getDevices()
+                .forEach(device -> sum.addAndGet(
+                        Iterables.size(getFlowEntries(networkId, device.id()))));
+        return sum.get();
+    }
+
+    @Override
+    public FlowEntry getFlowEntry(NetworkId networkId, FlowRule rule) {
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(rule.deviceId());
+
+        if (master == null) {
+            log.debug("Failed to getFlowEntry: No master for {}, vnet {}",
+                      rule.deviceId(), networkId);
+            return null;
+        }
+
+        if (Objects.equals(local, master)) {
+            return flowTable.getFlowEntry(networkId, rule);
+        }
+
+        log.trace("Forwarding getFlowEntry to {}, which is the primary (master) " +
+                          "for device {}, vnet {}",
+                  master, rule.deviceId(), networkId);
+
+        VirtualFlowRule vRule = new VirtualFlowRule(networkId, rule);
+
+        return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(vRule,
+                                                                        GET_FLOW_ENTRY,
+                                                                        serializer::encode,
+                                                                        serializer::decode,
+                                                                        master),
+                                     FLOW_RULE_STORE_TIMEOUT_MILLIS,
+                                     TimeUnit.MILLISECONDS,
+                                     null);
+    }
+
+    @Override
+    public Iterable<FlowEntry> getFlowEntries(NetworkId networkId, DeviceId deviceId) {
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(deviceId);
+
+        if (master == null) {
+            log.debug("Failed to getFlowEntries: No master for {}, vnet {}", deviceId, networkId);
+            return Collections.emptyList();
+        }
+
+        if (Objects.equals(local, master)) {
+            return flowTable.getFlowEntries(networkId, deviceId);
+        }
+
+        log.trace("Forwarding getFlowEntries to {}, which is the primary (master) for device {}",
+                  master, deviceId);
+
+        return Tools.futureGetOrElse(
+                clusterCommunicator.sendAndReceive(deviceId,
+                                                   GET_DEVICE_FLOW_ENTRIES,
+                                                   serializer::encode,
+                                                   serializer::decode,
+                                                   master),
+                FLOW_RULE_STORE_TIMEOUT_MILLIS,
+                TimeUnit.MILLISECONDS,
+                Collections.emptyList());
+    }
+
+    @Override
+    public void storeBatch(NetworkId networkId, FlowRuleBatchOperation operation) {
+        if (operation.getOperations().isEmpty()) {
+            notifyDelegate(networkId, FlowRuleBatchEvent.completed(
+                    new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
+                    new CompletedBatchOperation(true, Collections.emptySet(), operation.deviceId())));
+            return;
+        }
+
+        DeviceId deviceId = operation.deviceId();
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(deviceId);
+
+        if (master == null) {
+            log.warn("No master for {}, vnet {} : flows will be marked for removal", deviceId, networkId);
+
+            updateStoreInternal(networkId, operation);
+
+            notifyDelegate(networkId, FlowRuleBatchEvent.completed(
+                    new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
+                    new CompletedBatchOperation(true, Collections.emptySet(), operation.deviceId())));
+            return;
+        }
+
+        if (Objects.equals(local, master)) {
+            storeBatchInternal(networkId, operation);
+            return;
+        }
+
+        log.trace("Forwarding storeBatch to {}, which is the primary (master) for device {}, vent {}",
+                  master, deviceId, networkId);
+
+        clusterCommunicator.unicast(new VirtualFlowRuleBatchOperation(networkId, operation),
+                                    APPLY_BATCH_FLOWS,
+                                    serializer::encode,
+                                    master)
+                .whenComplete((result, error) -> {
+                    if (error != null) {
+                        log.warn("Failed to storeBatch: {} to {}", operation, master, error);
+
+                        Set<FlowRule> allFailures = operation.getOperations()
+                                .stream()
+                                .map(BatchOperationEntry::target)
+                                .collect(Collectors.toSet());
+
+                        notifyDelegate(networkId, FlowRuleBatchEvent.completed(
+                                new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
+                                new CompletedBatchOperation(false, allFailures, deviceId)));
+                    }
+                });
+    }
+
+    @Override
+    public void batchOperationComplete(NetworkId networkId, FlowRuleBatchEvent event) {
+        //FIXME: need a per device pending response
+        NodeId nodeId = pendingResponses.remove(event.subject().batchId());
+        if (nodeId == null) {
+            notifyDelegate(networkId, event);
+        } else {
+            // TODO check unicast return value
+            clusterCommunicator.unicast(new VirtualFlowRuleBatchEvent(networkId, event),
+                                        REMOTE_APPLY_COMPLETED, serializer::encode, nodeId);
+            //error log: log.warn("Failed to respond to peer for batch operation result");
+        }
+    }
+
+    @Override
+    public void deleteFlowRule(NetworkId networkId, FlowRule rule) {
+        storeBatch(networkId,
+                new FlowRuleBatchOperation(
+                        Collections.singletonList(
+                                new FlowRuleBatchEntry(
+                                        FlowRuleBatchEntry.FlowRuleOperation.REMOVE,
+                                        rule)), rule.deviceId(), idGenerator.getNewId()));
+    }
+
+    @Override
+    public FlowRuleEvent addOrUpdateFlowRule(NetworkId networkId, FlowEntry rule) {
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(rule.deviceId());
+        if (Objects.equals(local, master)) {
+            return addOrUpdateFlowRuleInternal(networkId, rule);
+        }
+
+        log.warn("Tried to update FlowRule {} state,"
+                         + " while the Node was not the master.", rule);
+        return null;
+    }
+
+    private FlowRuleEvent addOrUpdateFlowRuleInternal(NetworkId networkId, FlowEntry rule) {
+        // check if this new rule is an update to an existing entry
+        StoredFlowEntry stored = flowTable.getFlowEntry(networkId, rule);
+        if (stored != null) {
+            //FIXME modification of "stored" flow entry outside of flow table
+            stored.setBytes(rule.bytes());
+            stored.setLife(rule.life(TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS);
+            stored.setLiveType(rule.liveType());
+            stored.setPackets(rule.packets());
+            stored.setLastSeen();
+            if (stored.state() == FlowEntry.FlowEntryState.PENDING_ADD) {
+                stored.setState(FlowEntry.FlowEntryState.ADDED);
+                return new FlowRuleEvent(FlowRuleEvent.Type.RULE_ADDED, rule);
+            }
+            return new FlowRuleEvent(FlowRuleEvent.Type.RULE_UPDATED, rule);
+        }
+
+        // TODO: Confirm if this behavior is correct. See SimpleFlowRuleStore
+        // TODO: also update backup if the behavior is correct.
+        flowTable.add(networkId, rule);
+        return null;
+    }
+
+    @Override
+    public FlowRuleEvent removeFlowRule(NetworkId networkId, FlowEntry rule) {
+        final DeviceId deviceId = rule.deviceId();
+
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(deviceId);
+
+        if (Objects.equals(local, master)) {
+            // bypass and handle it locally
+            return removeFlowRuleInternal(new VirtualFlowEntry(networkId, rule));
+        }
+
+        if (master == null) {
+            log.warn("Failed to removeFlowRule: No master for {}", deviceId);
+            // TODO: revisit if this should be null (="no-op") or Exception
+            return null;
+        }
+
+        log.trace("Forwarding removeFlowRule to {}, which is the master for device {}",
+                  master, deviceId);
+
+        return Futures.getUnchecked(clusterCommunicator.sendAndReceive(
+                new VirtualFlowEntry(networkId, rule),
+                REMOVE_FLOW_ENTRY,
+                serializer::encode,
+                serializer::decode,
+                master));
+    }
+
+    @Override
+    public FlowRuleEvent pendingFlowRule(NetworkId networkId, FlowEntry rule) {
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        if (mastershipService.isLocalMaster(rule.deviceId())) {
+            StoredFlowEntry stored = flowTable.getFlowEntry(networkId, rule);
+            if (stored != null &&
+                    stored.state() != FlowEntry.FlowEntryState.PENDING_ADD) {
+                stored.setState(FlowEntry.FlowEntryState.PENDING_ADD);
+                return new FlowRuleEvent(FlowRuleEvent.Type.RULE_UPDATED, rule);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void purgeFlowRules(NetworkId networkId) {
+        flowTable.purgeFlowRules(networkId);
+    }
+
+    @Override
+    public FlowRuleEvent updateTableStatistics(NetworkId networkId,
+                                               DeviceId deviceId,
+                                               List<TableStatisticsEntry> tableStats) {
+        if (deviceTableStats.get(networkId) == null) {
+            deviceTableStats.put(networkId, Maps.newConcurrentMap());
+        }
+        deviceTableStats.get(networkId).put(deviceId, tableStats);
+        return null;
+    }
+
+    @Override
+    public Iterable<TableStatisticsEntry> getTableStatistics(NetworkId networkId, DeviceId deviceId) {
+        MastershipService mastershipService =
+                vnaService.get(networkId, MastershipService.class);
+        NodeId master = mastershipService.getMasterFor(deviceId);
+
+        if (master == null) {
+            log.debug("Failed to getTableStats: No master for {}", deviceId);
+            return Collections.emptyList();
+        }
+
+        if (deviceTableStats.get(networkId) == null) {
+            deviceTableStats.put(networkId, Maps.newConcurrentMap());
+        }
+
+        List<TableStatisticsEntry> tableStats = deviceTableStats.get(networkId).get(deviceId);
+        if (tableStats == null) {
+            return Collections.emptyList();
+        }
+        return ImmutableList.copyOf(tableStats);
+    }
+
+    private void registerMessageHandlers(ExecutorService executor) {
+        clusterCommunicator.addSubscriber(APPLY_BATCH_FLOWS, new OnStoreBatch(), executor);
+        clusterCommunicator.<VirtualFlowRuleBatchEvent>addSubscriber(
+                REMOTE_APPLY_COMPLETED, serializer::decode,
+                this::notifyDelicateByNetwork, executor);
+        clusterCommunicator.addSubscriber(
+                GET_FLOW_ENTRY, serializer::decode, this::getFlowEntryByNetwork,
+                serializer::encode, executor);
+        clusterCommunicator.addSubscriber(
+                GET_DEVICE_FLOW_ENTRIES, serializer::decode,
+                this::getFlowEntriesByNetwork,
+                serializer::encode, executor);
+        clusterCommunicator.addSubscriber(
+                REMOVE_FLOW_ENTRY, serializer::decode, this::removeFlowRuleInternal,
+                serializer::encode, executor);
+    }
+
+    private void unregisterMessageHandlers() {
+        clusterCommunicator.removeSubscriber(REMOVE_FLOW_ENTRY);
+        clusterCommunicator.removeSubscriber(GET_DEVICE_FLOW_ENTRIES);
+        clusterCommunicator.removeSubscriber(GET_FLOW_ENTRY);
+        clusterCommunicator.removeSubscriber(APPLY_BATCH_FLOWS);
+        clusterCommunicator.removeSubscriber(REMOTE_APPLY_COMPLETED);
+    }
+
+
+    private void logConfig(String prefix) {
+        log.info("{} with msgHandlerPoolSize = {}; backupPeriod = {}",
+                 prefix, msgHandlerPoolSize, backupPeriod);
+    }
+
+    private void storeBatchInternal(NetworkId networkId, FlowRuleBatchOperation operation) {
+
+        final DeviceId did = operation.deviceId();
+        //final Collection<FlowEntry> ft = flowTable.getFlowEntries(did);
+        Set<FlowRuleBatchEntry> currentOps = updateStoreInternal(networkId, operation);
+        if (currentOps.isEmpty()) {
+            batchOperationComplete(networkId, FlowRuleBatchEvent.completed(
+                    new FlowRuleBatchRequest(operation.id(), Collections.emptySet()),
+                    new CompletedBatchOperation(true, Collections.emptySet(), did)));
+            return;
+        }
+
+        //Confirm that flowrule service is created
+        vnaService.get(networkId, FlowRuleService.class);
+
+        notifyDelegate(networkId, FlowRuleBatchEvent.requested(new
+                                                            FlowRuleBatchRequest(operation.id(),
+                                                                                 currentOps), operation.deviceId()));
+    }
+
+    private Set<FlowRuleBatchEntry> updateStoreInternal(NetworkId networkId,
+                                                        FlowRuleBatchOperation operation) {
+        return operation.getOperations().stream().map(
+                op -> {
+                    StoredFlowEntry entry;
+                    switch (op.operator()) {
+                        case ADD:
+                            entry = new DefaultFlowEntry(op.target());
+                            // always add requested FlowRule
+                            // Note: 2 equal FlowEntry may have different treatment
+                            flowTable.remove(networkId, entry.deviceId(), entry);
+                            flowTable.add(networkId, entry);
+
+                            return op;
+                        case REMOVE:
+                            entry = flowTable.getFlowEntry(networkId, op.target());
+                            if (entry != null) {
+                                //FIXME modification of "stored" flow entry outside of flow table
+                                entry.setState(FlowEntry.FlowEntryState.PENDING_REMOVE);
+                                log.debug("Setting state of rule to pending remove: {}", entry);
+                                return op;
+                            }
+                            break;
+                        case MODIFY:
+                            //TODO: figure this out at some point
+                            break;
+                        default:
+                            log.warn("Unknown flow operation operator: {}", op.operator());
+                    }
+                    return null;
+                }
+        ).filter(Objects::nonNull).collect(Collectors.toSet());
+    }
+
+    private FlowRuleEvent removeFlowRuleInternal(VirtualFlowEntry rule) {
+        final DeviceId deviceId = rule.flowEntry().deviceId();
+        // This is where one could mark a rule as removed and still keep it in the store.
+        final FlowEntry removed = flowTable.remove(rule.networkId(), deviceId, rule.flowEntry());
+        // rule may be partial rule that is missing treatment, we should use rule from store instead
+        return removed != null ? new FlowRuleEvent(RULE_REMOVED, removed) : null;
+    }
+
+    private final class OnStoreBatch implements ClusterMessageHandler {
+
+        @Override
+        public void handle(final ClusterMessage message) {
+            VirtualFlowRuleBatchOperation vOperation = serializer.decode(message.payload());
+            log.debug("received batch request {}", vOperation);
+
+            FlowRuleBatchOperation operation = vOperation.operation();
+
+            final DeviceId deviceId = operation.deviceId();
+            MastershipService mastershipService =
+                    vnaService.get(vOperation.networkId(), MastershipService.class);
+            NodeId master = mastershipService.getMasterFor(deviceId);
+            if (!Objects.equals(local, master)) {
+                Set<FlowRule> failures = new HashSet<>(operation.size());
+                for (FlowRuleBatchEntry op : operation.getOperations()) {
+                    failures.add(op.target());
+                }
+                CompletedBatchOperation allFailed = new CompletedBatchOperation(false, failures, deviceId);
+                // This node is no longer the master, respond as all failed.
+                // TODO: we might want to wrap response in envelope
+                // to distinguish sw programming failure and hand over
+                // it make sense in the latter case to retry immediately.
+                message.respond(serializer.encode(allFailed));
+                return;
+            }
+
+            pendingResponses.put(operation.id(), message.sender());
+            storeBatchInternal(vOperation.networkId(), operation);
+        }
+    }
+
+    /**
+     * Returns flow rule entry using virtual flow rule.
+     *
+     * @param rule an encapsulated flow rule to be queried
+     */
+    private FlowEntry getFlowEntryByNetwork(VirtualFlowRule rule) {
+        return flowTable.getFlowEntry(rule.networkId(), rule.rule());
+    }
+
+    /**
+     * returns flow entries using virtual device id.
+     *
+     * @param deviceId an encapsulated virtual device id
+     * @return a set of flow entries
+     */
+    private Set<FlowEntry> getFlowEntriesByNetwork(VirtualDeviceId deviceId) {
+        return flowTable.getFlowEntries(deviceId.networkId(), deviceId.deviceId());
+    }
+
+    /**
+     * span out Flow Rule Batch event according to virtual network id.
+     *
+     * @param event a event to be span out
+     */
+    private void notifyDelicateByNetwork(VirtualFlowRuleBatchEvent event) {
+        batchOperationComplete(event.networkId(), event.event());
+    }
+
+    private class InternalFlowTable {
+        //TODO replace the Map<V,V> with ExtendedSet
+        //TODO: support backup mechanism
+        private final Map<NetworkId, Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>>
+                flowEntriesMap = Maps.newConcurrentMap();
+        private final Map<NetworkId, Map<DeviceId, Long>> lastUpdateTimesMap = Maps.newConcurrentMap();
+
+        private Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>
+        getFlowEntriesByNetwork(NetworkId networkId) {
+            return flowEntriesMap.computeIfAbsent(networkId, k -> Maps.newConcurrentMap());
+        }
+
+        private Map<DeviceId, Long> getLastUpdateTimesByNetwork(NetworkId networkId) {
+            return lastUpdateTimesMap.computeIfAbsent(networkId, k -> Maps.newConcurrentMap());
+        }
+
+        /**
+         * Returns the flow table for specified device.
+         *
+         * @param networkId virtual network identifier
+         * @param deviceId identifier of the device
+         * @return Map representing Flow Table of given device.
+         */
+        private Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>
+        getFlowTable(NetworkId networkId, DeviceId deviceId) {
+            Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>
+                    flowEntries = getFlowEntriesByNetwork(networkId);
+            if (persistenceEnabled) {
+                //TODO: support persistent
+                log.warn("Persistent is not supported");
+                return null;
+            } else {
+                return flowEntries.computeIfAbsent(deviceId, id -> Maps.newConcurrentMap());
+            }
+        }
+
+        private Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>
+        getFlowTableCopy(NetworkId networkId, DeviceId deviceId) {
+
+            Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>
+                    flowEntries = getFlowEntriesByNetwork(networkId);
+            Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>> copy = Maps.newHashMap();
+
+            if (persistenceEnabled) {
+                //TODO: support persistent
+                log.warn("Persistent is not supported");
+                return null;
+            } else {
+                flowEntries.computeIfAbsent(deviceId, id -> Maps.newConcurrentMap()).forEach((k, v) -> {
+                    copy.put(k, Maps.newHashMap(v));
+                });
+                return copy;
+            }
+        }
+
+        private Map<StoredFlowEntry, StoredFlowEntry>
+        getFlowEntriesInternal(NetworkId networkId, DeviceId deviceId, FlowId flowId) {
+
+            return getFlowTable(networkId, deviceId)
+                    .computeIfAbsent(flowId, id -> Maps.newConcurrentMap());
+        }
+
+        private StoredFlowEntry getFlowEntryInternal(NetworkId networkId, FlowRule rule) {
+
+            return getFlowEntriesInternal(networkId, rule.deviceId(), rule.id()).get(rule);
+        }
+
+        private Set<FlowEntry> getFlowEntriesInternal(NetworkId networkId, DeviceId deviceId) {
+
+            return getFlowTable(networkId, deviceId).values().stream()
+                    .flatMap(m -> m.values().stream())
+                    .collect(Collectors.toSet());
+        }
+
+        public StoredFlowEntry getFlowEntry(NetworkId networkId, FlowRule rule) {
+            return getFlowEntryInternal(networkId, rule);
+        }
+
+        public Set<FlowEntry> getFlowEntries(NetworkId networkId, DeviceId deviceId) {
+
+            return getFlowEntriesInternal(networkId, deviceId);
+        }
+
+        public void add(NetworkId networkId, FlowEntry rule) {
+            Map<DeviceId, Long> lastUpdateTimes = getLastUpdateTimesByNetwork(networkId);
+
+            getFlowEntriesInternal(networkId, rule.deviceId(), rule.id())
+                    .compute((StoredFlowEntry) rule, (k, stored) -> {
+                        //TODO compare stored and rule timestamps
+                        //TODO the key is not updated
+                        return (StoredFlowEntry) rule;
+                    });
+            lastUpdateTimes.put(rule.deviceId(), System.currentTimeMillis());
+        }
+
+        public FlowEntry remove(NetworkId networkId, DeviceId deviceId, FlowEntry rule) {
+            final AtomicReference<FlowEntry> removedRule = new AtomicReference<>();
+            Map<DeviceId, Long> lastUpdateTimes = getLastUpdateTimesByNetwork(networkId);
+
+            getFlowEntriesInternal(networkId, rule.deviceId(), rule.id())
+                    .computeIfPresent((StoredFlowEntry) rule, (k, stored) -> {
+                        if (rule instanceof DefaultFlowEntry) {
+                            DefaultFlowEntry toRemove = (DefaultFlowEntry) rule;
+                            if (stored instanceof DefaultFlowEntry) {
+                                DefaultFlowEntry storedEntry = (DefaultFlowEntry) stored;
+                                if (toRemove.created() < storedEntry.created()) {
+                                    log.debug("Trying to remove more recent flow entry {} (stored: {})",
+                                              toRemove, stored);
+                                    // the key is not updated, removedRule remains null
+                                    return stored;
+                                }
+                            }
+                        }
+                        removedRule.set(stored);
+                        return null;
+                    });
+
+            if (removedRule.get() != null) {
+                lastUpdateTimes.put(deviceId, System.currentTimeMillis());
+                return removedRule.get();
+            } else {
+                return null;
+            }
+        }
+
+        public void purgeFlowRule(NetworkId networkId, DeviceId deviceId) {
+            Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>
+                    flowEntries = getFlowEntriesByNetwork(networkId);
+            flowEntries.remove(deviceId);
+        }
+
+        public void purgeFlowRules(NetworkId networkId) {
+            Map<DeviceId, Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>>
+                    flowEntries = getFlowEntriesByNetwork(networkId);
+            flowEntries.clear();
+        }
+    }
+
+    private class InternalTableStatsListener
+            implements EventuallyConsistentMapListener<NetworkId, Map<DeviceId, List<TableStatisticsEntry>>> {
+
+        @Override
+        public void event(EventuallyConsistentMapEvent<NetworkId, Map<DeviceId,
+                List<TableStatisticsEntry>>> event) {
+            //TODO: Generate an event to listeners (do we need?)
+        }
+    }
+
+    public final class MastershipBasedTimestamp implements Timestamp {
+
+        private final long termNumber;
+        private final long sequenceNumber;
+
+        /**
+         * Default constructor for serialization.
+         */
+        protected MastershipBasedTimestamp() {
+            this.termNumber = -1;
+            this.sequenceNumber = -1;
+        }
+
+        /**
+         * Default version tuple.
+         *
+         * @param termNumber the mastership termNumber
+         * @param sequenceNumber  the sequenceNumber number within the termNumber
+         */
+        public MastershipBasedTimestamp(long termNumber, long sequenceNumber) {
+            this.termNumber = termNumber;
+            this.sequenceNumber = sequenceNumber;
+        }
+
+        @Override
+        public int compareTo(Timestamp o) {
+            checkArgument(o instanceof MastershipBasedTimestamp,
+                          "Must be MastershipBasedTimestamp", o);
+            MastershipBasedTimestamp that = (MastershipBasedTimestamp) o;
+
+            return ComparisonChain.start()
+                    .compare(this.termNumber, that.termNumber)
+                    .compare(this.sequenceNumber, that.sequenceNumber)
+                    .result();
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(termNumber, sequenceNumber);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (!(obj instanceof MastershipBasedTimestamp)) {
+                return false;
+            }
+            MastershipBasedTimestamp that = (MastershipBasedTimestamp) obj;
+            return Objects.equals(this.termNumber, that.termNumber) &&
+                    Objects.equals(this.sequenceNumber, that.sequenceNumber);
+        }
+
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(getClass())
+                    .add("termNumber", termNumber)
+                    .add("sequenceNumber", sequenceNumber)
+                    .toString();
+        }
+
+        /**
+         * Returns the termNumber.
+         *
+         * @return termNumber
+         */
+        public long termNumber() {
+            return termNumber;
+        }
+
+        /**
+         * Returns the sequenceNumber number.
+         *
+         * @return sequenceNumber
+         */
+        public long sequenceNumber() {
+            return sequenceNumber;
+        }
+    }
+}
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java
index 9bb2d3b..706c006 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java
@@ -15,6 +15,6 @@
  */
 
 /**
- * Implementation of distributed virtual network store.
+ * Implementation of virtual network stores.
  */
 package org.onosproject.incubator.store.virtual.impl;
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualDeviceId.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualDeviceId.java
new file mode 100644
index 0000000..c5e0d83
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualDeviceId.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl.primitives;
+
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.net.DeviceId;
+
+import java.util.Objects;
+
+/**
+ * A wrapper class to isolate device id from other virtual networks.
+ */
+public class VirtualDeviceId {
+
+    NetworkId networkId;
+    DeviceId deviceId;
+
+    public VirtualDeviceId(NetworkId networkId, DeviceId deviceId) {
+        this.networkId = networkId;
+        this.deviceId = deviceId;
+    }
+
+    public NetworkId networkId() {
+        return networkId;
+    }
+
+    public DeviceId deviceId() {
+        return deviceId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, deviceId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof VirtualDeviceId) {
+            VirtualDeviceId that = (VirtualDeviceId) obj;
+            return this.deviceId.equals(that.deviceId) &&
+                    this.networkId.equals(that.networkId);
+        }
+        return false;
+    }
+}
+
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowEntry.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowEntry.java
new file mode 100644
index 0000000..58ff60b
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowEntry.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl.primitives;
+
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.net.flow.FlowEntry;
+
+import java.util.Objects;
+
+/**
+ * A wrapper class to encapsulate flow entry.
+ */
+public class VirtualFlowEntry {
+    NetworkId networkId;
+    FlowEntry flowEntry;
+
+    public VirtualFlowEntry(NetworkId networkId, FlowEntry flowEntry) {
+        this.networkId = networkId;
+        this.flowEntry = flowEntry;
+    }
+
+    public NetworkId networkId() {
+        return networkId;
+    }
+
+    public FlowEntry flowEntry() {
+        return flowEntry;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, flowEntry);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof VirtualFlowEntry) {
+            VirtualFlowEntry that = (VirtualFlowEntry) other;
+            return this.networkId.equals(that.networkId) &&
+                    this.flowEntry.equals(that.flowEntry);
+        } else {
+            return false;
+        }
+    }
+}
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRule.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRule.java
new file mode 100644
index 0000000..9b51a92
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRule.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl.primitives;
+
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.net.flow.FlowRule;
+
+import java.util.Objects;
+
+/**
+ * A wrapper class to encapsulate flow rule.
+ */
+public class VirtualFlowRule {
+    NetworkId networkId;
+    FlowRule rule;
+
+    public VirtualFlowRule(NetworkId networkId, FlowRule rule) {
+        this.networkId = networkId;
+        this.rule = rule;
+    }
+
+    public NetworkId networkId() {
+        return networkId;
+    }
+
+    public FlowRule rule() {
+        return rule;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, rule);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this ==  other) {
+            return true;
+        }
+
+        if (other instanceof VirtualFlowRule) {
+            VirtualFlowRule that = (VirtualFlowRule) other;
+            return this.networkId.equals(that.networkId) &&
+                    this.rule.equals(that.rule);
+        } else {
+            return false;
+        }
+    }
+}
+
+
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchEvent.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchEvent.java
new file mode 100644
index 0000000..6ca341d
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchEvent.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl.primitives;
+
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.net.flow.FlowRuleBatchEvent;
+
+import java.util.Objects;
+
+/**
+ * A wrapper class to encapsulate flow rule batch event.
+ */
+public class VirtualFlowRuleBatchEvent {
+    NetworkId networkId;
+    FlowRuleBatchEvent event;
+
+    public VirtualFlowRuleBatchEvent(NetworkId networkId, FlowRuleBatchEvent event) {
+        this.networkId = networkId;
+        this.event = event;
+    }
+
+    public NetworkId networkId() {
+        return networkId;
+    }
+
+    public FlowRuleBatchEvent event() {
+        return event;
+    }
+
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, event);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof VirtualFlowRuleBatchEvent) {
+            VirtualFlowRuleBatchEvent that = (VirtualFlowRuleBatchEvent) other;
+            return this.networkId.equals(that.networkId) &&
+                    this.event.equals(that.event);
+        } else {
+            return false;
+        }
+    }
+}
+
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchOperation.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchOperation.java
new file mode 100644
index 0000000..c390ff6
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/VirtualFlowRuleBatchOperation.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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 org.onosproject.incubator.store.virtual.impl.primitives;
+
+import org.onosproject.incubator.net.virtual.NetworkId;
+import org.onosproject.net.flow.FlowRuleBatchOperation;
+
+import java.util.Objects;
+
+/**
+ * A wrapper class to encapsulate flow rule batch operation.
+ */
+public class VirtualFlowRuleBatchOperation {
+    NetworkId networkId;
+    FlowRuleBatchOperation operation;
+
+    public VirtualFlowRuleBatchOperation(NetworkId networkId,
+                                         FlowRuleBatchOperation operation) {
+        this.networkId = networkId;
+        this.operation = operation;
+    }
+
+    public NetworkId networkId() {
+        return networkId;
+    }
+
+    public FlowRuleBatchOperation operation() {
+        return operation;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(networkId, operation);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this ==  other) {
+            return true;
+        }
+
+        if (other instanceof VirtualFlowRuleBatchOperation) {
+            VirtualFlowRuleBatchOperation that = (VirtualFlowRuleBatchOperation) other;
+            return this.networkId.equals(that.networkId) &&
+                    this.operation.equals(that.operation);
+        } else {
+            return false;
+        }
+    }
+}
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/package-info.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/package-info.java
new file mode 100644
index 0000000..d8253a7
--- /dev/null
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/primitives/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Implementation of distributed virtual network store primitives.
+ */
+package org.onosproject.incubator.store.virtual.impl.primitives;
diff --git a/modules.defs b/modules.defs
index 8998724..5025038 100644
--- a/modules.defs
+++ b/modules.defs
@@ -219,6 +219,7 @@
     '//apps/route-service:onos-apps-route-service-oar',
     '//apps/evpn-route-service:onos-apps-evpn-route-service-oar',
     '//incubator/protobuf/registry:onos-incubator-protobuf-registry-oar',
+    '//apps/openstacknetworkingui:onos-apps-openstacknetworkingui-oar',
 ]
 
 PROTOCOL_APPS = [
@@ -247,7 +248,7 @@
     '//apps/vtn/sfcmgr:onos-apps-vtn-sfcmgr',
     '//apps/vtn/vtnmgr:onos-apps-vtn-vtnmgr',
     '//apps/vtn/vtnweb:onos-apps-vtn-vtnweb',
-    '//apps/p4runtime-test:onos-apps-p4runtime-test',
+#   '//apps/p4runtime-test:onos-apps-p4runtime-test',
 ]
 
 APPS = ONOS_DRIVERS + ONOS_PROVIDERS + ONOS_APPS + MODELS + PROTOCOL_APPS
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
index 420a961..4d8cfa1 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
@@ -286,7 +286,6 @@
      * @throws NetconfException when there is a problem in reestablishing
      * the connection or the session to the device.
      */
-
     default void checkAndReestablish() throws NetconfException {
         Logger log = LoggerFactory.getLogger(NetconfSession.class);
         log.error("Not implemented/exposed by the underlying session implementation");
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfConfigGetCommand.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfConfigGetCommand.java
index b7651a5..bac6bef 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfConfigGetCommand.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfConfigGetCommand.java
@@ -18,14 +18,13 @@
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.netconf.DatastoreId.datastore;
 
-import java.io.IOException;
-
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.DeviceId;
 import org.onosproject.netconf.NetconfController;
 import org.onosproject.netconf.NetconfDevice;
+import org.onosproject.netconf.NetconfException;
 import org.onosproject.netconf.NetconfSession;
 
 /**
@@ -71,7 +70,7 @@
         try {
             String res = session.getConfig(datastore(cfgType.toLowerCase()));
             print("%s", res);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.error("Configuration could not be retrieved", e);
             print("Error occurred retrieving configuration");
         }
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/DefaultNetconfDevice.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/DefaultNetconfDevice.java
index 362cbac..f700768 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/DefaultNetconfDevice.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/DefaultNetconfDevice.java
@@ -24,8 +24,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-
 /**
  * Default implementation of a NETCONF device.
  */
@@ -54,7 +52,7 @@
         sessionFactory = new NetconfSessionMinaImpl.MinaSshNetconfSessionFactory();
         try {
             netconfSession = sessionFactory.createNetconfSession(deviceInfo);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             deviceState = false;
             throw new NetconfException("Cannot create connection and session for device " +
                                                deviceInfo, e);
@@ -78,7 +76,7 @@
         sessionFactory = factory;
         try {
             netconfSession = sessionFactory.createNetconfSession(deviceInfo);
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             deviceState = false;
             throw new NetconfException("Cannot create connection and session for device " +
                                                deviceInfo, e);
@@ -100,7 +98,7 @@
         deviceState = false;
         try {
             netconfSession.close();
-        } catch (IOException e) {
+        } catch (NetconfException e) {
             log.warn("Cannot communicate with the device {} session already closed", netconfDeviceInfo);
         }
     }
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
index a1797d7..0728bd9 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
@@ -130,7 +130,7 @@
     public void activate(ComponentContext context) {
         cfgService.registerProperties(getClass());
         modified(context);
-        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
+        Security.addProvider(new BouncyCastleProvider());
         log.info("Started");
     }
 
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
index 48727a2..e54e6cd 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
@@ -61,7 +61,10 @@
 
 /**
  * Implementation of a NETCONF session to talk to a device.
+ *
+ * @deprecated in 1.12.0 use {@link NetconfSessionMinaImpl}
  */
+@Deprecated
 public class NetconfSessionImpl implements NetconfSession {
 
     private static final Logger log = LoggerFactory
@@ -358,7 +361,7 @@
             try {
                 log.debug("Trying to reopen the Sesion with {}", deviceInfo.getDeviceId());
                 startSshSession();
-            } catch (IOException | IllegalStateException e) {
+            } catch (NetconfException | IllegalStateException e) {
                 log.debug("Trying to reopen the Connection with {}", deviceInfo.getDeviceId());
                 try {
                     connectionActive = false;
@@ -369,7 +372,7 @@
                         subscriptionConnected = false;
                         startSubscription(notificationFilterSchema);
                     }
-                } catch (IOException e2) {
+                } catch (NetconfException e2) {
                     log.error("No connection {} for device {}", netconfConnection, e.getMessage());
                     throw new NetconfException("Cannot re-open the connection with device" + deviceInfo, e);
                 }
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
index c8a4604..dfb82ca 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
@@ -80,6 +80,9 @@
     private static final Logger log = LoggerFactory
             .getLogger(NetconfSessionMinaImpl.class);
 
+    /**
+     * NC 1.0, RFC4742 EOM sequence.
+     */
     private static final String ENDPATTERN = "]]>]]>";
     private static final String MESSAGE_ID_STRING = "message-id";
     private static final String HELLO = "<hello";
@@ -101,6 +104,7 @@
     private static final String EDIT_CONFIG_CLOSE = "</edit-config>";
     private static final String TARGET_OPEN = "<target>";
     private static final String TARGET_CLOSE = "</target>";
+    // FIXME hard coded namespace nc
     private static final String CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">";
     private static final String CONFIG_CLOSE = "</config>";
     private static final String XML_HEADER =
@@ -109,6 +113,7 @@
             "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"";
     private static final String NETCONF_WITH_DEFAULTS_NAMESPACE =
             "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\"";
+    // FIXME hard coded namespace base10
     private static final String SUBSCRIPTION_SUBTREE_FILTER_OPEN =
             "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">";
 
@@ -119,8 +124,6 @@
 
     private static final String SESSION_ID_REGEX = "<session-id>\\s*(.*?)\\s*</session-id>";
     private static final Pattern SESSION_ID_REGEX_PATTERN = Pattern.compile(SESSION_ID_REGEX);
-    private static final String RSA = "RSA";
-    private static final String DSA = "DSA";
     private static final String HASH = "#";
     private static final String LF = "\n";
     private static final String MSGLEN_REGEX_PATTERN = "\n#\\d+\n";
@@ -133,11 +136,12 @@
     private Iterable<String> onosCapabilities =
             ImmutableList.of(NETCONF_10_CAPABILITY, NETCONF_11_CAPABILITY);
 
-    /* NOTE: the "serverHelloResponseOld" is deprecated in 1.10.0 and should eventually be removed */
-    @Deprecated
-    private String serverHelloResponseOld;
     private final Set<String> deviceCapabilities = new LinkedHashSet<>();
     private NetconfStreamHandler streamHandler;
+    // FIXME ONOS-7019 key type should be revised to a String, see RFC6241
+    /**
+     * Message-ID and corresponding Future waiting for response.
+     */
     private Map<Integer, CompletableFuture<String>> replies;
     private List<String> errorReplies; // Not sure why we need this?
     private boolean subscriptionConnected = false;
@@ -350,13 +354,13 @@
     }
 
     private void sendHello() throws NetconfException {
-        serverHelloResponseOld = sendRequest(createHelloString(), true);
-        Matcher capabilityMatcher = CAPABILITY_REGEX_PATTERN.matcher(serverHelloResponseOld);
+        String serverHelloResponse = sendRequest(createHelloString(), true);
+        Matcher capabilityMatcher = CAPABILITY_REGEX_PATTERN.matcher(serverHelloResponse);
         while (capabilityMatcher.find()) {
             deviceCapabilities.add(capabilityMatcher.group(1));
         }
         sessionID = String.valueOf(-1);
-        Matcher sessionIDMatcher = SESSION_ID_REGEX_PATTERN.matcher(serverHelloResponseOld);
+        Matcher sessionIDMatcher = SESSION_ID_REGEX_PATTERN.matcher(serverHelloResponse);
         if (sessionIDMatcher.find()) {
             sessionID = sessionIDMatcher.group(1);
         } else {
@@ -423,8 +427,11 @@
     }
 
 
+    // FIXME rename to align with what it actually do
     /**
      * Validate and format netconf message.
+     * - NC1.0 if no EOM sequence present on {@code message}, append.
+     * - NC1.1 chunk-encode given message unless it already is chunk encoded
      *
      * @param message to format
      * @return formated message
@@ -433,11 +440,11 @@
         if (deviceCapabilities.contains(NETCONF_11_CAPABILITY)) {
             message = formatChunkedMessage(message);
         } else {
-            if (!message.contains(ENDPATTERN)) {
+            if (!message.endsWith(ENDPATTERN)) {
                 message = message + NEW_LINE + ENDPATTERN;
             }
         }
-        return  message;
+        return message;
     }
 
     /**
@@ -499,11 +506,11 @@
         // FIXME potentially re-writing chunked encoded String?
         request = formatXmlHeader(request);
         request = formatRequestMessageId(request, messageId);
+        log.debug("Sending request to NETCONF with timeout {} for {}",
+                  replyTimeout, deviceInfo.name());
         CompletableFuture<String> futureReply = request(request, messageId);
         String rp;
         try {
-            log.debug("Sending request to NETCONF with timeout {} for {}",
-                    replyTimeout, deviceInfo.name());
             rp = futureReply.get(replyTimeout, TimeUnit.SECONDS);
             replies.remove(messageId); // Why here???
         } catch (InterruptedException e) {
@@ -539,6 +546,7 @@
     private String formatRequestMessageId(String request, int messageId) {
         if (request.contains(MESSAGE_ID_STRING)) {
             //FIXME if application provides his own counting of messages this fails that count
+            // FIXME assumes message-id is integer. RFC6241 allows anything as long as it is allowed in XML
             request = request.replaceFirst(MESSAGE_ID_STRING + EQUAL + NUMBER_BETWEEN_QUOTES_MATCHER,
                     MESSAGE_ID_STRING + EQUAL + "\"" + messageId + "\"");
         } else if (!request.contains(MESSAGE_ID_STRING) && !request.contains(HELLO)) {
@@ -546,11 +554,11 @@
             request = request.replaceFirst(END_OF_RPC_OPEN_TAG, "\" " + MESSAGE_ID_STRING + EQUAL + "\""
                     + messageId + "\"" + ">");
         }
-        request = updateRequestLenght(request);
+        request = updateRequestLength(request);
         return request;
     }
 
-    private String updateRequestLenght(String request) {
+    private String updateRequestLength(String request) {
         if (request.contains(LF + HASH + HASH + LF)) {
             int oldLen = Integer.parseInt(request.split(HASH)[1].split(LF)[0]);
             String rpcWithEnding = request.substring(request.indexOf('<'));
@@ -564,8 +572,13 @@
         return request;
     }
 
+    /**
+     * Ensures xml start directive/declaration appears in the {@code request}.
+     * @param request RPC request message
+     * @return XML RPC message
+     */
     private String formatXmlHeader(String request) {
-        if (!request.contains(XML_HEADER)) {
+        if (!request.startsWith(XML_HEADER)) {
             //FIXME if application provides his own XML header of different type there is a clash
             if (request.startsWith(LF + HASH)) {
                 request = request.split("<")[0] + XML_HEADER + request.substring(request.split("<")[0].length());
@@ -864,7 +877,7 @@
         streamHandler.removeDeviceEventListener(listener);
     }
 
-    private boolean checkReply(String reply) throws NetconfException {
+    private boolean checkReply(String reply) {
         if (reply != null) {
             if (!reply.contains("<rpc-error>")) {
                 log.debug("Device {} sent reply {}", deviceInfo, reply);
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
index 6e609e1..e0386f7 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
@@ -65,9 +65,8 @@
  */
 public class NetconfSessionImplTest {
     private static final Logger log = LoggerFactory
-            .getLogger(NetconfStreamThread.class);
+            .getLogger(NetconfSessionImplTest.class);
 
-    private static final int PORT_NUMBER = TestTools.findAvailablePort(50830);
     private static final String TEST_USERNAME = "netconf";
     private static final String TEST_PASSWORD = "netconf123";
     private static final String TEST_HOSTNAME = "127.0.0.1";
@@ -99,6 +98,7 @@
 
     @BeforeClass
     public static void setUp() throws Exception {
+        int portNumber = TestTools.findAvailablePort(50830);
         sshServerNetconf = SshServer.setUpDefaultServer();
         sshServerNetconf.setPasswordAuthenticator(
                 new PasswordAuthenticator() {
@@ -110,14 +110,14 @@
                         return TEST_USERNAME.equals(username) && TEST_PASSWORD.equals(password);
                     }
                 });
-        sshServerNetconf.setPort(PORT_NUMBER);
+        sshServerNetconf.setPort(portNumber);
         SimpleGeneratorHostKeyProvider provider = new SimpleGeneratorHostKeyProvider();
         provider.setFile(new File(TEST_SERFILE));
         sshServerNetconf.setKeyPairProvider(provider);
         sshServerNetconf.setSubsystemFactories(
                 Arrays.<NamedFactory<Command>>asList(new NetconfSshdTestSubsystem.Factory()));
         sshServerNetconf.open();
-        log.info("SSH Server opened on port {}", PORT_NUMBER);
+        log.info("SSH Server opened on port {}", portNumber);
 
         NetconfController netconfCtl = new NetconfControllerImpl();
         NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
@@ -125,7 +125,7 @@
         NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
 
         NetconfDeviceInfo deviceInfo1 = new NetconfDeviceInfo(
-                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), PORT_NUMBER);
+                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), portNumber);
 
         session1 = new NetconfSessionImpl(deviceInfo1, ImmutableList.of("urn:ietf:params:netconf:base:1.0"));
         log.info("Started NETCONF Session {} with test SSHD server in Unit Test", session1.getSessionId());
@@ -135,7 +135,7 @@
                 NetconfSessionMinaImplTest.DEFAULT_CAPABILITIES.toArray()));
 
         NetconfDeviceInfo deviceInfo2 = new NetconfDeviceInfo(
-                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), PORT_NUMBER);
+                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), portNumber);
         deviceInfo2.setConnectTimeoutSec(OptionalInt.of(11));
         deviceInfo2.setReplyTimeoutSec(OptionalInt.of(10));
         deviceInfo2.setIdleTimeoutSec(OptionalInt.of(12));
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
index 7e78b80..ada609b 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
@@ -22,6 +22,7 @@
 import org.apache.sshd.server.auth.password.PasswordAuthenticator;
 import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
 import org.apache.sshd.server.session.ServerSession;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,6 +36,7 @@
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.security.Security;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -63,9 +65,8 @@
  */
 public class NetconfSessionMinaImplTest {
     private static final Logger log = LoggerFactory
-            .getLogger(NetconfStreamThread.class);
+            .getLogger(NetconfSessionMinaImplTest.class);
 
-    private static final int PORT_NUMBER = TestTools.findAvailablePort(50830);
     private static final String TEST_USERNAME = "netconf";
     private static final String TEST_PASSWORD = "netconf123";
     private static final String TEST_HOSTNAME = "127.0.0.1";
@@ -123,6 +124,8 @@
 
     @BeforeClass
     public static void setUp() throws Exception {
+        Security.addProvider(new BouncyCastleProvider());
+        int portNumber = TestTools.findAvailablePort(50830);
         sshServerNetconf = SshServer.setUpDefaultServer();
         sshServerNetconf.setPasswordAuthenticator(
                 new PasswordAuthenticator() {
@@ -134,17 +137,17 @@
                         return TEST_USERNAME.equals(username) && TEST_PASSWORD.equals(password);
                     }
                 });
-        sshServerNetconf.setPort(PORT_NUMBER);
+        sshServerNetconf.setPort(portNumber);
         SimpleGeneratorHostKeyProvider provider = new SimpleGeneratorHostKeyProvider();
         provider.setFile(new File(TEST_SERFILE));
         sshServerNetconf.setKeyPairProvider(provider);
         sshServerNetconf.setSubsystemFactories(
                 Arrays.<NamedFactory<Command>>asList(new NetconfSshdTestSubsystem.Factory()));
         sshServerNetconf.open();
-        log.info("SSH Server opened on port {}", PORT_NUMBER);
+        log.info("SSH Server opened on port {}", portNumber);
 
         NetconfDeviceInfo deviceInfo = new NetconfDeviceInfo(
-                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), PORT_NUMBER);
+                TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), portNumber);
 
         session1 = new NetconfSessionMinaImpl(deviceInfo, ImmutableList.of("urn:ietf:params:netconf:base:1.0"));
         log.info("Started NETCONF Session {} with test SSHD server in Unit Test", session1.getSessionId());
diff --git a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
index 4d97af7..90efcf4 100644
--- a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
+++ b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
@@ -434,6 +434,7 @@
                 MacAddress probeMac = providerService.addPendingHostLocation(host.id(), location);
 
                 host.ipAddresses().stream().findFirst().ifPresent(ip -> {
+                    log.debug("Probing host {} with {}", host.id(), ip);
                     Ethernet probe;
                     if (ip.isIp4()) {
                         probe = ARP.buildArpRequest(probeMac.toBytes(), Ip4Address.ZERO.toOctets(),
diff --git a/providers/ospf/cfg/BUCK b/providers/ospf/cfg/BUCK
index c884550..83c5e19 100644
--- a/providers/ospf/cfg/BUCK
+++ b/providers/ospf/cfg/BUCK
@@ -1,5 +1,6 @@
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
+    '//lib:JACKSON',
     '//protocols/ospf/api:onos-protocols-ospf-api',
 ]
 
diff --git a/tools/dev/mininet/bmv2.py b/tools/dev/mininet/bmv2.py
index fb3d9d8..f218257 100644
--- a/tools/dev/mininet/bmv2.py
+++ b/tools/dev/mininet/bmv2.py
@@ -18,6 +18,7 @@
 CPU_PORT = 255
 PKT_BYTES_TO_DUMP = 80
 VALGRIND_PREFIX = 'valgrind --leak-check=yes'
+VALGRIND_SLEEP = 10  # seconds
 
 
 def parseBoolean(value):
@@ -51,7 +52,7 @@
 
     def __init__(self, name, json=None, debugger=False, loglevel="warn", elogger=False,
                  persistent=False, grpcPort=None, thriftPort=None, netcfg=True, dryrun=False,
-                 pipeconfId="", pktdump=False, valgrind=False, netcfgSleep=1, **kwargs):
+                 pipeconfId="", pktdump=False, valgrind=False, **kwargs):
         Switch.__init__(self, name, **kwargs)
         self.grpcPort = ONOSBmv2Switch.pickUnusedPort() if not grpcPort else grpcPort
         self.thriftPort = ONOSBmv2Switch.pickUnusedPort() if not thriftPort else thriftPort
@@ -70,7 +71,6 @@
         self.netcfg = parseBoolean(netcfg)
         self.dryrun = parseBoolean(dryrun)
         self.valgrind = parseBoolean(valgrind)
-        self.netcfgSleep = netcfgSleep
         self.netcfgfile = '/tmp/bmv2-%d-netcfg.json' % self.deviceId
         self.pipeconfId = pipeconfId
         if persistent:
@@ -216,7 +216,7 @@
             bmv2cmd = "%s %s" % (VALGRIND_PREFIX, bmv2cmd)
         if self.dryrun:
             info("\n*** DRY RUN (not executing bmv2)")
-        info("\nStarting BMv2 target: %s" % bmv2cmd)
+        info("\nStarting BMv2 target: %s\n" % bmv2cmd)
 
         if self.persistent:
             # Bash loop to re-exec the switch if it crashes.
@@ -229,12 +229,11 @@
             out = self.cmd(cmdStr)
             if out:
                 print out
-
-        # Wait before pushing the netcfg.
-        if self.netcfgSleep > 0:
-            info("\n*** Waiting %d seconds before pushing the config to ONOS...\n"
-                 % self.netcfgSleep)
-        time.sleep(self.netcfgSleep)
+            if self.netcfg and self.valgrind:
+                # With valgrind, it takes some time before the gRPC server is available.
+                # Wait before pushing the netcfg.
+                info("\n*** Waiting %d seconds before pushing the config to ONOS...\n" % VALGRIND_SLEEP)
+                time.sleep(VALGRIND_SLEEP)
 
         try:  # onos.py
             clist = controllers[0].nodes()
diff --git a/tools/test/cells/simon-single b/tools/test/cells/simon-single
index acbd481..8e15a2b 100644
--- a/tools/test/cells/simon-single
+++ b/tools/test/cells/simon-single
@@ -4,4 +4,4 @@
 export OC1="192.168.36.1"
 export OCN="192.168.36.101"
 
-export ONOS_APPS="drivers,openflow,fwd,drivermatrix"
+export ONOS_APPS="drivers,openflow,fwd,drivermatrix,null"
diff --git a/tools/test/topos/bmv2-demo.py b/tools/test/topos/bmv2-demo.py
index 2864dca..9bccc5c 100755
--- a/tools/test/topos/bmv2-demo.py
+++ b/tools/test/topos/bmv2-demo.py
@@ -70,10 +70,7 @@
                                                     netcfg=False,
                                                     longitude=longitude,
                                                     latitude=latitude,
-                                                    pipeconfId=args.pipeconf_id,
-                                                    valgrind=True,
-                                                    netcfgSleep=0,
-                                                    leglevel="debug")
+                                                    pipeconfId=args.pipeconf_id)
 
         for i in range(1, args.size + 1):
             for j in range(1, args.size + 1):
@@ -109,14 +106,14 @@
         self.cmd(self.getInfiniteCmdBg("arping -w5000000 %s" % h.IP()))
 
     def startIperfServer(self):
-        self.cmd(self.getInfiniteCmdBg("iperf3 -s"))
+        self.cmd(self.getInfiniteCmdBg("iperf -s -u"))
 
     def startIperfClient(self, h, flowBw="512k", numFlows=5, duration=5):
-        iperfCmd = "iperf3 -c{} -b{} -P{} -t{}".format(h.IP(), flowBw, numFlows, duration)
+        iperfCmd = "iperf -c{} -u -b{} -P{} -t{}".format(h.IP(), flowBw, numFlows, duration)
         self.cmd(self.getInfiniteCmdBg(iperfCmd, sleep=0))
 
     def stop(self):
-        self.cmd("killall iperf3")
+        self.cmd("killall iperf")
         self.cmd("killall ping")
         self.cmd("killall arping")
 
@@ -236,14 +233,8 @@
 
     print "Network started"
 
-    generateNetcfg(onosIp, net, args)
-
-    sleep(30)
-    print "Uploading netcfg..."
-    call(("%s/onos-netcfg" % RUN_PACK_PATH, onosIp, TEMP_NETCFG_FILE))
-
     # Generate background traffic.
-    sleep(5)
+    sleep(3)
     for (h1, h2) in combinations(net.hosts, 2):
         h1.startPingBg(h2)
         h2.startPingBg(h1)
@@ -259,6 +250,15 @@
     # print "Starting traffic from h1 to h3..."
     # net.hosts[0].startIperfClient(net.hosts[-1], flowBw="200k", numFlows=100, duration=10)
 
+    generateNetcfg(onosIp, net, args)
+
+    if args.netcfg_sleep > 0:
+        print "Waiting %d seconds before pushing config to ONOS..." % args.netcfg_sleep
+        sleep(args.netcfg_sleep)
+
+    print "Pushing config to ONOS..."
+    call(("%s/onos-netcfg" % RUN_PACK_PATH, onosIp, TEMP_NETCFG_FILE))
+
     if not args.onos_ip:
         ONOSCLI(net)
     else:
@@ -279,6 +279,8 @@
                         type=bool, action="store", required=False, default=False)
     parser.add_argument('--pipeconf-id', help='Pipeconf ID for switches',
                         type=str, action="store", required=False, default='')
+    parser.add_argument('--netcfg-sleep', help='Seconds to wait before pushing config to ONOS',
+                        type=int, action="store", required=False, default=5)
     args = parser.parse_args()
     setLogLevel('info')
     main(args)
diff --git a/tools/test/topos/regions-korea.sh b/tools/test/topos/regions-korea.sh
index 513566c..1d94673 100755
--- a/tools/test/topos/regions-korea.sh
+++ b/tools/test/topos/regions-korea.sh
@@ -98,6 +98,15 @@
 null-create-link direct Goyang Suwon
 null-create-link direct Seongnam Suwon
 
+# -- GG peers
+
+region-add-peer-loc rGG rGW 37.7252   127.6672
+region-add-peer-loc rGG rCC 37.0227   127.3566
+region-add-peer-loc rGG rGS 37.1117   127.7196
+region-add-peer-loc rGG rJL 36.9509   127.1277
+region-add-peer-loc rGG rJJ 36.9232   126.8540
+
+
 # -- GW devices
 
 null-create-device switch Wonju             ${nports} 37.3422190 127.9201620
@@ -117,6 +126,15 @@
 null-create-link direct Wonju Gangneung
 null-create-link direct Gangneung Chuncheon
 
+# -- GW peers
+
+region-add-peer-loc rGW rGG 37.8043   127.0020
+region-add-peer-loc rGW rCC 36.8942   127.0999
+region-add-peer-loc rGW rGS 36.9275   129.1693
+region-add-peer-loc rGW rJL 36.8730   128.4439
+region-add-peer-loc rGW rJJ 36.7671   127.7459
+
+
 # -- CC devices
 
 null-create-device switch Daejeon           ${nports} 36.3504120 127.3845480
@@ -140,6 +158,15 @@
 null-create-link direct Chungju Cheongju
 null-create-link direct Asan Cheongju
 
+# -- CC peers
+
+region-add-peer-loc rCC rGW 37.2499   128.0815
+region-add-peer-loc rCC rGG 37.0604   127.2840
+region-add-peer-loc rCC rGS 36.9256   128.5413
+region-add-peer-loc rCC rJL 36.0471   127.2376
+region-add-peer-loc rCC rJJ 35.9449   127.0086
+
+
 # -- GS devices
 
 null-create-device switch Busan         ${nports} 35.1795540 129.0756420
@@ -163,6 +190,15 @@
 null-create-link direct Daegu Pohang
 null-create-link direct Pohang Ulsan
 
+# -- GS peers
+
+region-add-peer-loc rGS rGG 36.1994   127.9788
+region-add-peer-loc rGS rGW 36.1775   128.7119
+region-add-peer-loc rGS rCC 35.9361   127.6306
+region-add-peer-loc rGS rJL 35.0274   127.4704
+region-add-peer-loc rGS rJJ 34.7682   128.0892
+
+
 # -- JL devices
 
 null-create-device switch Gwangju       ${nports} 35.1595450 126.8526010
@@ -190,6 +226,16 @@
 null-create-link direct Jeonju Iksan
 null-create-link direct Jeonju Yeosu
 
+# -- JL peers
+
+region-add-peer-loc rJL rCC 36.0736   126.7974
+region-add-peer-loc rJL rGG 36.1204   127.3223
+region-add-peer-loc rJL rGW 36.0254   127.8910
+region-add-peer-loc rJL rGS 35.5403   127.8257
+region-add-peer-loc rJL rJJ 34.5884   127.1328
+
+# {"lng":9731256818,"lat":4647468107}}}
+
 # -- JJ devices
 
 null-create-device switch Jeju          ${nports} 33.4890110 126.4983020
@@ -205,6 +251,15 @@
 
 null-create-link direct Jeju Seogwipo
 
+# -- JJ peers
+
+region-add-peer-loc rJJ rGW 34.0295   126.8138
+region-add-peer-loc rJJ rGG 33.9136   126.6015
+region-add-peer-loc rJJ rCC 33.7931   126.4294
+region-add-peer-loc rJJ rGS 33.6874   127.0029
+region-add-peer-loc rJJ rJL 33.6607   126.3719
+
+
 ### Set up debug log messages for classes we care about
 onos ${host} <<-EOF
 log:set DEBUG org.onosproject.ui.impl.topo.Topo2ViewMessageHandler
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
index 0678eb2..90dc434 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
@@ -24,14 +24,14 @@
 uninstall=Disinstalla
 activate=Attiva
 deactivate=Disattiva
-show=Show (it)
-hide=Hide (it)
-enable=Enable (it)
-disable=Disable (it)
-select=Select (it)
+show=Mostra
+hide=Nascondi
+enable=Abilita
+disable=Disabilita
+select=Seleziona
 
 # Past Tense
-purged=purged (it)
-withdrawn=withdrawn (it)
-resubmitted=resubmitted (it)
-added=added (it)
+purged=Eliminati
+withdrawn=Rimossi
+resubmitted=Risottomessi
+added=Aggiunti
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_it.properties
index 5cf41eb..e88b4fa 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_it.properties
@@ -22,24 +22,24 @@
 device=Dispositivo
 host=Host
 link=Collegamento
-intent=Intent (it)
-tunnel=Tunnel (it)
-flow=Flow (it)
-port=Port (it)
+intent=Intent
+tunnel=Tunnel
+flow=Flow
+port=Port
 
 # --- Elements (Plural)
 nodes=Nodi
 topologies=Topologie
-topology_sccs=Topology SCCs (it)
+topology_sccs=Topologia SCCs
 networks=Reti
 regions=Regioni
 devices=Dispositivi
 hosts=Hosts
 links=Collegamenti
-intents=Intents (it)
-tunnels=Tunnels (it)
-flows=Flows (it)
-ports=Ports (it)
+intents=Intents
+tunnels=Tunnels
+flows=Flows
+ports=Porte
 
 # --- Element IDs
 node_id=ID del Nodo
@@ -47,10 +47,10 @@
 device_id=ID del Dispositivo
 host_id=ID dell'Host
 link_id=ID del collegamento
-intent_id=Intent ID (it)
-tunnel_id=Tunnel ID (it)
-flow_id=Flow ID (it)
-port_id=Port ID (it)
+intent_id=ID dell'Intent
+tunnel_id=ID del Tunnel
+flow_id=ID del Flusso
+port_id=ID della Porta
 
 # --- Protocol terms
 protocol=Protocollo
@@ -60,4 +60,4 @@
 mac=MAC
 mac_address=Indirizzo MAC
 uri=URI
-vlan=VLAN (it)
+vlan=VLAN
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_ko.properties
index 1f6d81c..abc9fbb 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_ko.properties
@@ -30,7 +30,7 @@
 # --- Elements (Plural)
 nodes=노드
 topologies=토폴로지
-topology_sccs=토폴로지 강한 연결 요소
+topology_sccs=토폴로지 SCCs
 networks=네트워크
 regions=리젼
 devices=장치
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_it.properties
index e897aea..324bd4f 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_it.properties
@@ -33,7 +33,7 @@
 origin=Origine
 role=Ruolo
 
-latitude=Latitude (it)
-longitude=Longitude (it)
-grid_y=Grid Y (it)
-grid_x=Grid X (it)
+latitude=Latitudine
+longitude=Longitudine
+grid_y=Asse Y
+grid_x=Asse X
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_it.properties
index 8fa919f..2e2f5d4 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_it.properties
@@ -23,12 +23,12 @@
 last_updated=Ultimo Aggiornamento
 last_modified=Ultima Modifica
 
-visible=Visible (it)
-hidden=Hidden (it)
+visible=Visibile
+hidden=Nascosto
 
 # VLAN id == NONE (-1)
-vlan_none=None (it)
+vlan_none=Nessuno
 
 # lower case values, please
-expected=expected (it)
-not_expected=not expected (it)
+expected=atteso
+not_expected=non atteso
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
index ce7cb68..7fd4db6 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
@@ -18,16 +18,16 @@
 # Common button text
 ok=OK
 cancel=Annulla
-close=Close (it)
+close=Chiudi
 
 # Gesture text
 click=click
 click_row=click sulla riga
 scroll_down=scorri verso il basso
-shift_click=shift-click (it)
-drag=drag (it)
-cmd_scroll=cmd-scroll (it)
-cmd_drag=cmd-drag (it)
+shift_click=shift-click
+drag=trascina
+cmd_scroll=cmd-scorri
+cmd_drag=cmd-trascina
 
 # Common control button tooltips
 tt_ctl_auto_refresh=Attiva aggiornamento automatico
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_it.properties
index 9166889..2d724f3 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_it.properties
@@ -15,20 +15,20 @@
 #
 
 # display names for Device.Type constants
-switch=switch (it)
-router=router (it)
-roadm=roadm (it)
-otn=otn (it)
-roadm_otn=roadm otn (it)
-firewall=firewall (it)
-balancer=balancer (it)
-ips=ips (it)
-ids=ids (it)
-controller=controller (it)
-virtual=virtual (it)
-fiber_switch=fiber switch (it)
-microwave=microwave (it)
-olt=olt (it)
-onu=onu (it)
-optical_amplifier=optical amplifier (it)
-other=other (it)
+switch=switch
+router=router
+roadm=roadm
+otn=otn
+roadm_otn=roadm otn
+firewall=firewall
+balancer=balancer
+ips=ips
+ids=ids
+controller=controller
+virtual=virtual
+fiber_switch=switch ottico
+microwave=microonde
+olt=olt
+onu=onu
+optical_amplifier=amplificatore ottico
+other=altro
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_it.properties
index f3fb9fa..a137099 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_it.properties
@@ -15,13 +15,13 @@
 #
 
 # display names for Link.Type constants
-direct=direct (it)
-indirect=indirect (it)
-edge=edge (it)
-tunnel=tunnel (it)
-optical=optical (it)
-virtual=virtual (it)
+direct=diretto
+indirect=indiretto
+edge=arco esterno
+tunnel=tunnel
+optical=ottico
+virtual=virtuale
 
 # display names for Link.State constants
-active=active (it)
-inactive=inactive (it)
+active=attivo
+inactive=inattivo
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties
index 15cd698..9a1b1af 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties
@@ -26,7 +26,7 @@
 tt_ctl_activate=Attiva l'applicazione selezionata
 tt_ctl_deactivate=Disattiva l'applicazione selezionata
 tt_ctl_uninstall=Rimuovi l'applicazione selezionata
-tt_ctl_download=Download selected application (.oar file) (it)
+tt_ctl_download=Scarica l'applicazione selezionata (file .oar)
 
 # Quick-Help panel
 qh_hint_esc=Deseleziona l'applicazione
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_ko.properties
index 040a9db..fa6db41 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_ko.properties
@@ -16,26 +16,26 @@
 #
 
 # Text that appears in the navigation panel
-nav_item_app=어플리케이션
+nav_item_app=애플리케이션
 
 # View title
-title_apps=어플리케이션
+title_apps=애플리케이션
 
 # Control button tooltips
-tt_ctl_upload=어플리케이션 업로드 (.oar 파일)
-tt_ctl_activate=선택된 어플리케이션 활성화
-tt_ctl_deactivate=선택된 어플리케이션 비활성화
-tt_ctl_uninstall=선택된 어플리케이션 삭제
-tt_ctl_download=Download selected application (.oar file) (ko)
+tt_ctl_upload=애플리케이션 업로드 (.oar 파일)
+tt_ctl_activate=선택된 애플리케이션 활성화
+tt_ctl_deactivate=선택된 애플리케이션 비활성화
+tt_ctl_uninstall=선택된 애플리케이션 삭제
+tt_ctl_download=선택된 애플리케이션 다운로드 (.oar 파일)
 
 # Quick-Help panel
-qh_hint_esc=어플리케이션 선택 취소
-qh_hint_click_row=어플리케이션 선택 / 선택 취소
-qh_hint_scroll_down=어플리케이션 더보기
+qh_hint_esc=애플리케이션 선택 취소
+qh_hint_click_row=애플리케이션 선택 / 선택 취소
+qh_hint_scroll_down=애플리케이션 더보기
 
 # App details panel
 dp_features=기능
-dp_required_apps=필수 어플리케이션
+dp_required_apps=필수 애플리케이션
 dp_permissions=권한
 
 # App dialog panel
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_zh_CN.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_zh_CN.properties
index 44b60a2..c7187a5 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_zh_CN.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_zh_CN.properties
@@ -26,7 +26,7 @@
 tt_ctl_activate=激活选定的应用
 tt_ctl_deactivate=停用选定的应用
 tt_ctl_uninstall=卸载选定的应用
-tt_ctl_download=Download selected application (.oar file) (zh_CN)
+tt_ctl_download=下载选定应用 (.oar 文件)
 
 # Quick-Help panel
 qh_hint_esc=取消选定的应用
@@ -42,4 +42,4 @@
 dlg_confirm_action=确认操作
 
 dlg_warn_deactivate=停用或卸载此组件会产生严重的后果!
-dlg_warn_own_risk=** 自行承担风险 **
\ No newline at end of file
+dlg_warn_own_risk=** 自行承担风险 **
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
index a08c629..8494447 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
@@ -19,14 +19,14 @@
 nav_item_topo=Topologia
 
 # Message when no devices are connected
-no_devices_are_connected=Nessuna Apparecchiatura Connessa
+no_devices_are_connected=Nessun device connesso
 
 # Action Key Toolbar Tooltips ...
 tbtt_tog_instances=Attiva il pannello delle istanze di ONOS
 tbtt_tog_summary=Attiva il pannello riassuntivo di ONOS
 tbtt_tog_use_detail=Diasattiva / Attiva il pannello dei dettagli
 tbtt_tog_host=Visualizza gli host
-tbtt_tog_offline=Visualizza le apparecchiature disconnesse
+tbtt_tog_offline=Visualizza i device disconnesse
 tbtt_tog_porthi=Evidenzia le porte
 tbtt_bad_links=Mostra i link fallito
 tbtt_tog_map=Attiva la mappa geografica sullo sfondo
@@ -35,7 +35,7 @@
 tbtt_reset_loc=Riporta i nodi nella posizione originale
 tbtt_tog_oblique=Attiva la visualizzazione obliqua (sperimentale)
 tbtt_cyc_layers=Cicla fra i nodi attivi
-tbtt_cyc_dev_labs=Cicla fra le etichette delle apparecchiature
+tbtt_cyc_dev_labs=Cicla fra le etichette dei device
 tbtt_cyc_host_labs=Cicla fra le etichette degli host
 tbtt_unpin_node=Sblocca un nodo (Passa il cursore sopra)
 tbtt_reset_zoom=Azzera spostamento / zoom
@@ -45,99 +45,99 @@
 # Quick Help Gestures
 qh_gest_click=Seleziona l'oggetto e mostra i dettagli
 qh_gest_shift_click=Attiva la possibilità di selezionare
-qh_gest_drag=Riposiziona e blocca un'apparecchiatura o un host
+qh_gest_drag=Riposiziona e blocca un device o un host
 qh_gest_cmd_scroll=Ingradisci più / meno
 qh_gest_cmd_drag=Spostati lateralmente
 
 # Flash Messages
-fl_background_map=background map (it)
-fl_sprite_layer=sprite layer (it)
-fl_pan_zoom_reset=Pan and zoom reset (it)
-fl_eq_masters=Equalizing master roles (it)
+fl_background_map=Mappa di sfondo
+fl_sprite_layer=Livello sprite
+fl_pan_zoom_reset=Azzera spostamento e zoom
+fl_eq_masters=Ripartizione del ruolo di master
 
-fl_device_labels_hide=Hide device labels (it)
-fl_device_labels_show_friendly=Show friendly device labels (it)
-fl_device_labels_show_id=Show device ID labels (it)
-fl_host_labels_show_friendly=Show friendly host labels (it)
-fl_host_labels_show_ip=Show host IP addresses (it)
-fl_host_labels_show_mac=Show host MAC addresses (it)
+fl_device_labels_hide=Nascondi etichette dei device
+fl_device_labels_show_friendly=Mostra etichette semplici dei device
+fl_device_labels_show_id=Mostra le etichette con l'ID del device
+fl_host_labels_show_friendly=Mostra etichette semplici degli host
+fl_host_labels_show_ip=Mostra l'indirizzo IP degli Host
+fl_host_labels_show_mac=Mostra l'indirizzo MAC degli Host
 
-fl_offline_devices=Offline Devices (it)
-fl_bad_links=Bad Links (it)
-fl_reset_node_locations=Reset Node Locations (it)
+fl_offline_devices=Device disconnessi
+fl_bad_links=Link corrotti
+fl_reset_node_locations=Riporta i nodi in posizione originale
 
-fl_layer_all=All Layers Shown (it)
-fl_layer_pkt=Packet Layer Shown (it)
-fl_layer_opt=Optical Layer Shown (it)
+fl_layer_all=Tutti i livelli
+fl_layer_pkt=Livello a pacchetto
+fl_layer_opt=Livello ottico
 
-fl_panel_instances=Instances Panel (it)
-fl_panel_summary=Summary Panel (it)
-fl_panel_details=Details Panel (it)
+fl_panel_instances=Pannello delle istanze
+fl_panel_summary=Pannello riassuntivo
+fl_panel_details=Pannello dei dettagli
 
-fl_port_highlighting=Port Highlighting (it)
+fl_port_highlighting=Evidenzia Porte
 
-fl_oblique_view=Oblique View (it)
-fl_normal_view=Normal View (it)
+fl_oblique_view=Visualizzazione obliqua
+fl_normal_view=Visualizzazione normale
 
-fl_monitoring_canceled=Monitoring Canceled (it)
-fl_selecting_intent=Selecting Intent (it)
+fl_monitoring_canceled=Analisi cancellata
+fl_selecting_intent=Selezione di un intent
 
 # Core Overlays
-ov_tt_protected_intents=Protected Intents Overlay (it)
-ov_tt_traffic=Traffic Overlay (it)
-ov_tt_none=No Overlay (it)
+ov_tt_protected_intents=Livello degli Intent protetti
+ov_tt_traffic=Livello del Traffico
+ov_tt_none=Nessun livello
 
 # Traffic Overlay
-tr_btn_create_h2h_flow=Create Host-to-Host Flow (it)
-tr_btn_create_msrc_flow=Create Multi-Source Flow (it)
-tr_btn_show_device_flows=Show Device Flows (it)
-tr_btn_show_related_traffic=Show Related Traffic (it)
-tr_btn_cancel_monitoring=Cancel traffic monitoring (it)
-tr_btn_monitor_all=Monitor all traffic (it)
-tr_btn_show_dev_link_flows=Show device link flows (it)
-tr_btn_show_all_rel_intents=Show all related intents (it)
-tr_btn_show_prev_rel_intent=Show previous related intent (it)
-tr_btn_show_next_rel_intent=Show next related intent (it)
-tr_btn_monitor_sel_intent=Monitor traffic of selected intent (it)
-tr_fl_fstats_bytes=Flow Stats (bytes) (it)
-tr_fl_pstats_bits=Port Stats (bits / second) (it)
-tr_fl_pstats_pkts=Port Stats (packets / second) (it)
-tr_fl_dev_flows=Device Flows (it)
-tr_fl_rel_paths=Related Paths (it)
-tr_fl_prev_rel_int=Previous related intent (it)
-tr_fl_next_rel_int=Next related intent (it)
-tr_fl_traf_on_path=Traffic on Selected Path (it)
-tr_fl_h2h_flow_added=Host-to-Host flow added (it)
-tr_fl_multisrc_flow=Multi-Source Flow (it)
+tr_btn_create_h2h_flow=Crea flusso Host-to-Host
+tr_btn_create_msrc_flow=Crea flusso Multi-Source
+tr_btn_show_device_flows=Mostra i Flussi del device
+tr_btn_show_related_traffic=Mostra il traffico collegato
+tr_btn_cancel_monitoring=Cancella l'analisi del traffico
+tr_btn_monitor_all=Analizza tutto il traffico
+tr_btn_show_dev_link_flows=Mostra i flussi dei link del device
+tr_btn_show_all_rel_intents=Mostra tutti gli intent relativi al device
+tr_btn_show_prev_rel_intent=Mostra il precedente Intent
+tr_btn_show_next_rel_intent=Mostra l'Intent successivo
+tr_btn_monitor_sel_intent=Analizza il traffico dell'intent selezionato
+tr_fl_fstats_bytes=Statistiche del flusso (byte)
+tr_fl_pstats_bits=Statistiche della porta (bits / second)
+tr_fl_pstats_pkts=Statistiche della porta (pacchetti / secondo)
+tr_fl_dev_flows=Flussi del device
+tr_fl_rel_paths=Collegamenti inerenti
+tr_fl_prev_rel_int=Intent inerente precedente
+tr_fl_next_rel_int=Intent inerente successivo
+tr_fl_traf_on_path=Traffico sul percorso selezionato
+tr_fl_h2h_flow_added=Aggiunto un flusso Host-to-Host
+tr_fl_multisrc_flow=Aggiunto un flusso Multi-Source
 
 # Button tooltips
-btn_show_view_device=Show Device View (it)
-btn_show_view_flow=Show Flow View for this Device (it)
-btn_show_view_port=Show Port View for this Device (it)
-btn_show_view_group=Show Group View for this Device (it)
-btn_show_view_meter=Show Meter View for this Device (it)
+btn_show_view_device=Vilsualizza i device
+btn_show_view_flow=Mostra i flussi di questo device
+btn_show_view_port=Mostra le porte di questo device
+btn_show_view_group=Mostra i gruppi di questo device
+btn_show_view_meter=Mostra i meter di questo device
 
 # Panel Titles
-title_select_map=Select Map (it)
-title_panel_summary=ONOS Summary (it)
-title_selected_items=Selected Items (it)
-title_edge_link=Edge Link (it)
-title_infra_link=Infrastructure Link (it)
+title_select_map=Seleziona la mappa
+title_panel_summary=Riassunto di ONOS
+title_selected_items=Elementi selezionati
+title_edge_link=Collegamento esterno
+title_infra_link=Collegamento interno
 
 # Custom Panel Labels / Values
-lp_label_friendly=Friendly (it)
+lp_label_friendly=Semplice
 
-lp_label_a_type=A type (it)
-lp_label_a_id=A id (it)
-lp_label_a_friendly=A friendly (it)
-lp_label_a_port=A port (it)
+lp_label_a_type=Tipo di A type
+lp_label_a_id=A id
+lp_label_a_friendly=semplice A
+lp_label_a_port=Porta A
 
-lp_label_b_type=B type (it)
-lp_label_b_id=B id (it)
-lp_label_b_friendly=B friendly (it)
-lp_label_b_port=B port (it)
+lp_label_b_type=Tipo di B
+lp_label_b_id=B id
+lp_label_b_friendly=semplice B friendly
+lp_label_b_port=Porta B
 
-lp_label_a2b=A to B (it)
-lp_label_b2a=B to A (it)
+lp_label_a2b=da A a B
+lp_label_b2a=da B a A
 
-lp_value_no_link=[no link] (it)
+lp_value_no_link=[nessun collegamento]
diff --git a/web/gui/src/main/webapp/app/fw/svg/glyphData.js b/web/gui/src/main/webapp/app/fw/svg/glyphData.js
index 4d2cfbc..083acbd 100644
--- a/web/gui/src/main/webapp/app/fw/svg/glyphData.js
+++ b/web/gui/src/main/webapp/app/fw/svg/glyphData.js
@@ -291,6 +291,9 @@
             'M55,85c-4.1,0-7.9-1-11.4-2.8l29-50.1c5.8,5.5,9.5,13.7,9.5,22.8' +
             'C82.1,71.6,70,85,55,85z',
 
+            download: 'M90.3,94.5H19.7V79.2H90.3V94.5Z' +
+            'm-49.1-79V44H26.2L55,72.3,83.8,44H68.9V15.5H41.1Z',
+
             // --- Navigation glyphs ------------------------------------
 
             flowTable: tableFrame +
diff --git a/web/gui/src/main/webapp/app/fw/svg/icon.js b/web/gui/src/main/webapp/app/fw/svg/icon.js
index aabbc17..5dc8a3d 100644
--- a/web/gui/src/main/webapp/app/fw/svg/icon.js
+++ b/web/gui/src/main/webapp/app/fw/svg/icon.js
@@ -37,6 +37,7 @@
         play: 'play',
         stop: 'stop',
 
+        download: 'download',
         delta: 'delta',
         nonzero: 'nonzero',
         close: 'xClose',
diff --git a/web/gui/src/main/webapp/app/fw/widget/listBuilder.js b/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
index 8dc5053..0c6df5d 100644
--- a/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
@@ -43,13 +43,19 @@
     }
 
     function listProps(el, data) {
+        var sepLast = false;
+
+        // note: track whether we end with a separator or not...
         data.propOrder.forEach(function (p) {
             if (p === '-') {
                 addSep(el);
+                sepLast = true;
             } else {
-                addProp(el, p, data.props[p]);
+                addProp(el, data.propLabels[p], data.propValues[p]);
+                sepLast = false;
             }
         });
+        return sepLast;
     }
 
     angular.module('onosWidget')
diff --git a/web/gui/src/main/webapp/app/view/app/app.html b/web/gui/src/main/webapp/app/view/app/app.html
index e371248..1d6c94a 100644
--- a/web/gui/src/main/webapp/app/view/app/app.html
+++ b/web/gui/src/main/webapp/app/view/app/app.html
@@ -38,8 +38,7 @@
                  tooltip tt-msg="uninstallTip"
                  ng-class="{active: ctrlBtnState.selection}">
             </div>
-            <!-- FIXME: create proper download icon -->
-            <div icon icon-size="42" icon-id="downArrow"
+            <div icon icon-size="42" icon-id="download"
                  ng-click="downloadApp()"
                  tooltip tt-msg="downloadTip"
                  ng-class="{active: ctrlBtnState.selection}">
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
index bcf0469..0fd33a7 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
@@ -101,6 +101,7 @@
     }
 
     function renderSingle(data) {
+        var endedWithSeparator;
 
         detailsPanel.emptyRegions();
 
@@ -117,15 +118,14 @@
             table = detailsPanel.appendToBody('table'),
             tbody = table.append('tbody');
 
-        gs.addGlyph(svg, (data.type || 'unknown'), 26);
+        gs.addGlyph(svg, (data.glyphId || 'm_unknown'), 26);
         title.text(data.title);
 
-        if (!data.props.Latitude) {
-            var locationIndex = data.propOrder.indexOf('Latitude');
-            data.propOrder.splice(locationIndex - 1, 3);
-        }
+        // TODO: add navigation hot-link if defined
+        //  See topoPanel.js for equivalent code in "classic" topo
 
-        ls.listProps(tbody, data);
+        endedWithSeparator = ls.listProps(tbody, data);
+        // TODO : review whether we need to use/store end-with-sep state
         addBtnFooter();
     }
 
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
index 070c6f2..bbfd808 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
@@ -35,14 +35,27 @@
     function formatSubRegionData(data) {
         return {
             title: data.get('name'),
-            propOrder: ['Id', 'Type', '-', 'Number of Devices', 'Number of Hosts'],
-            props: {
-                '-': '',
-                'Id': data.get('id'),
-                'Type': data.get('nodeType'),
-                'Number of Devices': data.get('nDevs'),
-                'Number of Hosts': data.get('nHosts'),
+            propLabels: {
+                '-': '-',
+                'id': 'Id',
+                'nodeType': 'Type',
+                'nDevs': '# Devices',
+                'nHosts': '# Hosts',
             },
+            propValues: {
+                '-': '-',
+                'id': data.get('id'),
+                'nodeType': data.get('nodeType'),
+                'nDevs': data.get('nDevs'),
+                'nHosts': data.get('nHosts'),
+            },
+            propOrder: [
+                'id',
+                'nodeType',
+                '-',
+                'nDevs',
+                'nHosts',
+            ],
         };
     }
 
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
index 24785f7..6cdf3fe 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
@@ -55,6 +55,8 @@
     }
 
     function render() {
+        var endedWithSeparator;
+
         summaryPanel.emptyRegions();
 
         var svg = summaryPanel.appendToHeader('div')
@@ -66,7 +68,8 @@
 
         title.text(summaryData.title);
         gs.addGlyph(svg, 'bird', 24, 0, [1, 1]);
-        ls.listProps(tbody, summaryData);
+        endedWithSeparator = ls.listProps(tbody, summaryData);
+        // TODO : review whether we need to use/store end-with-sep state
     }
 
     function handleSummaryData(data) {
diff --git a/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js b/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
index 966202e..0d6e17e 100644
--- a/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
@@ -21,7 +21,7 @@
 describe('factory: fw/svg/glyph.js', function() {
     var $log, fs, gs, d3Elem, svg;
 
-    var numBaseGlyphs = 103,
+    var numBaseGlyphs = 104,
         vbBird = '352 224 113 112',
         vbGlyph = '0 0 110 110',
         vbBadge = '0 0 10 10',