diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
index 8211b68..c28e894 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -21,23 +21,14 @@
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.onlab.packet.Ethernet;
 import org.onosproject.app.ApplicationService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.incubator.component.ComponentService;
 import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.edge.EdgePortService;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.packet.InboundPacket;
-import org.onosproject.net.packet.PacketContext;
-import org.onosproject.net.packet.PacketProcessor;
 import org.onosproject.net.packet.PacketService;
 import org.onosproject.routing.IntentSynchronizationAdminService;
 import org.onosproject.routing.IntentSynchronizationService;
-import org.onosproject.routing.RoutingService;
-import org.onosproject.routing.config.BgpConfig;
 import org.slf4j.Logger;
 
 import java.util.ArrayList;
@@ -49,7 +40,7 @@
  * Component for the SDX-L3 application.
  */
 @Component(immediate = true)
-public class SdxL3  {
+public class SdxL3 {
 
     public static final String SDX_L3_APP = "org.onosproject.sdxl3";
 
@@ -62,9 +53,6 @@
     protected ApplicationService applicationService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected NetworkConfigService networkConfigService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected InterfaceService interfaceService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -79,16 +67,6 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected PacketService packetService;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected EdgePortService edgeService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected HostService hostService;
-
-    protected SdxL3ArpHandler arpHandler = null;
-
-    private InternalPacketProcessor processor = null;
-
     private ApplicationId appId;
 
     private static List<String> components = new ArrayList<>();
@@ -96,57 +74,23 @@
         components.add("org.onosproject.routing.bgp.BgpSessionManager");
         components.add("org.onosproject.routing.impl.Router");
         components.add(org.onosproject.sdxl3.impl.SdxL3PeerManager.class.getName());
-        components.add(org.onosproject.sdxl3.SdxL3Fib.class.getName());
+        components.add(SdxL3Fib.class.getName());
+        components.add(SdxL3ArpHandler.class.getName());
     }
 
     @Activate
     protected void activate() {
         components.forEach(name -> componentService.activate(appId, name));
-
         appId = coreService.registerApplication(SDX_L3_APP);
-
-        ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
-        BgpConfig bgpConfig =
-                networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
-
-        arpHandler = new SdxL3ArpHandler(bgpConfig,
-                edgeService,
-                hostService,
-                packetService,
-                interfaceService);
-        processor = new InternalPacketProcessor();
-        packetService.addProcessor(processor, PacketProcessor.director(2));
-
         // TODO fix removing intents
         applicationService.registerDeactivateHook(appId,
                 intentSynchronizerAdmin::removeIntents);
-
         log.info("SDX-L3 started");
     }
 
     @Deactivate
     protected void deactivate() {
         components.forEach(name -> componentService.deactivate(appId, name));
-
-        packetService.removeProcessor(processor);
-
         log.info("SDX-L3 stopped");
     }
-
-    private class InternalPacketProcessor implements PacketProcessor {
-        @Override
-        public void process(PacketContext context) {
-
-            if (context.isHandled()) {
-                return;
-            }
-
-            InboundPacket pkt = context.inPacket();
-            Ethernet ethernet = pkt.parsed();
-            if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
-                arpHandler.processPacketIn(pkt);
-            }
-        }
-    }
-
 }
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
index a1643c3..64693ea 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3ArpHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -15,6 +15,11 @@
  */
 package org.onosproject.sdxl3;
 
+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.onlab.packet.ARP;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.ICMP6;
@@ -27,39 +32,68 @@
 import org.onlab.packet.ndp.NeighborAdvertisement;
 import org.onlab.packet.ndp.NeighborDiscoveryOptions;
 import org.onlab.packet.ndp.NeighborSolicitation;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.incubator.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.Host;
+import org.onosproject.net.config.NetworkConfigService;
 import org.onosproject.net.edge.EdgePortService;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.host.HostService;
 import org.onosproject.net.packet.DefaultOutboundPacket;
 import org.onosproject.net.packet.InboundPacket;
+import org.onosproject.net.packet.PacketContext;
+import org.onosproject.net.packet.PacketProcessor;
 import org.onosproject.net.packet.PacketService;
+import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.net.HostId.hostId;
 import static org.onosproject.security.AppGuard.checkPermission;
 import static org.onosproject.security.AppPermission.Type.PACKET_WRITE;
 
+/**
+ * Proxy-ARP functionality adapted to SDX-L3.
+ */
+@Component(immediate = true, enabled = false)
 public class SdxL3ArpHandler {
-
     private static final String REQUEST_NULL = "ARP or NDP request cannot be null.";
-    private static final String MSG_NOT_REQUEST = "Message is not an ARP or NDP request";
+
+    private Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected InterfaceService interfaceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected EdgePortService edgeService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected HostService hostService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PacketService packetService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService networkConfigService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected SdxL3PeerService sdxL3PeerService;
 
     private BgpConfig bgpConfig;
-    private EdgePortService edgeService;
-    private HostService hostService;
-    private PacketService packetService;
-    private InterfaceService interfaceService;
+    private InternalPacketProcessor processor = null;
 
     private enum Protocol {
         ARP, NDP
@@ -69,20 +103,19 @@
         REQUEST, REPLY
     }
 
-    /**
-     * Creates an ArpHandler object.
-     *
-     */
-    public SdxL3ArpHandler(BgpConfig bgpConfig,
-                           EdgePortService edgeService,
-                           HostService hostService,
-                           PacketService packetService,
-                           InterfaceService interfaceService) {
-        this.bgpConfig = bgpConfig;
-        this.edgeService = edgeService;
-        this.hostService = hostService;
-        this.packetService = packetService;
-        this.interfaceService = interfaceService;
+    @Activate
+    public void activate() {
+        ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
+        bgpConfig = networkConfigService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
+        processor = new InternalPacketProcessor();
+        packetService.addProcessor(processor, PacketProcessor.director(2));
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        packetService.removeProcessor(processor);
+        log.info("Stopped");
     }
 
     /**
@@ -90,7 +123,7 @@
      *
      * @param pkt incoming packet
      */
-    public void processPacketIn(InboundPacket pkt) {
+    protected void processPacketIn(InboundPacket pkt) {
         checkPermission(PACKET_WRITE);
 
         Ethernet eth = pkt.parsed();
@@ -99,7 +132,63 @@
         ConnectPoint inPort = pkt.receivedFrom();
         MessageContext context = createContext(eth, inPort);
         if (context != null) {
-            replyInternal(context);
+            if (context.type() == MessageType.REQUEST) {
+                handleRequest(context);
+            } else if (context.type() == MessageType.REPLY) {
+                handleReply(context);
+            }
+        }
+    }
+
+    /**
+     * Handles a reply message only in the case it concerns a reply from an
+     * internal speaker to external peer where VLAN translation is necessary.
+     *
+     * @param context reply message context to process
+     */
+    private void handleReply(MessageContext context) {
+        if (fromPeerToSpeaker(context)) {
+            translateVlanAndSendToSpeaker(context);
+        } else if (fromPeerToPeer(context)) {
+            translateVlanAndSendToPeer(context);
+        }
+    }
+
+    private boolean fromPeerToSpeaker(MessageContext context) {
+        return sdxL3PeerService != null &&
+                isPeerAddress(context.sender()) &&
+                !interfaceService.getInterfacesByIp(context.target()).isEmpty();
+    }
+
+    /**
+     * Makes the VLAN translation if necessary and sends the packet at the port
+     * configured for the speaker.
+     *
+     * @param context reply message context to process
+     */
+    private void translateVlanAndSendToSpeaker(MessageContext context) {
+        BgpConfig.BgpSpeakerConfig speaker =
+                bgpConfig.getSpeakerFromPeer(context.sender());
+        if (speaker != null) {
+            Interface peeringInterface = sdxL3PeerService.getInterfaceForPeer(context.sender());
+            if (context.vlan().equals(peeringInterface.vlan())) {
+                context.setVlan(speaker.vlan());
+                sendTo(context.packet(), speaker.connectPoint());
+            }
+        }
+    }
+
+    /**
+     * Makes the VLAN translation if necessary and sends the packet at the port
+     * configured for the peer.
+     *
+     * @param context reply message context to process
+     */
+    private void translateVlanAndSendToPeer(MessageContext context) {
+        Interface interfaceForPeer = sdxL3PeerService.getInterfaceForPeer(context.target());
+        if (interfaceForPeer != null) {
+            context.setVlan(interfaceForPeer.vlan());
+            sendTo(context.packet(), interfaceForPeer.connectPoint());
         }
     }
 
@@ -112,22 +201,19 @@
      *
      * @param context request message context to process
      */
-    private void replyInternal(MessageContext context) {
-        checkNotNull(context);
-        checkArgument(context.type() == MessageType.REQUEST, MSG_NOT_REQUEST);
-
+    private void handleRequest(MessageContext context) {
         if (hasIpAddress(context.inPort())) {
             // If the request came from outside the network, only reply if it was
             // for one of our external addresses.
 
             interfaceService.getInterfacesByPort(context.inPort())
                     .stream()
-                    .filter(intf -> intf.ipAddresses()
+                    .filter(intf -> intf.ipAddressesList()
                             .stream()
                             .anyMatch(ia -> ia.ipAddress().equals(context.target())))
                     .forEach(intf -> buildAndSendReply(context, intf.mac()));
 
-            if (!isPeerAddress(context.sender()) || !isPeerAddress(context.target())) {
+            if (!fromPeerToPeer(context)) {
                 // Only care about requests from/towards external BGP peers
                 return;
             }
@@ -139,6 +225,14 @@
         Host dst = null;
         Host src = hostService.getHost(hostId(context.srcMac(), context.vlan()));
 
+        // If the request concerns an external BGP peer address and an internal
+        // BGP speaker or is between external BGP peers, VLAN translation may be
+        // necessary on the ARP request.
+        if (fromSpeakerToPeer(context) || fromPeerToPeer(context)) {
+            translateVlanAndSendToPeer(context);
+            return;
+        }
+
         for (Host host : hosts) {
             if (host.vlan().equals(context.vlan())) {
                 dst = host;
@@ -189,6 +283,31 @@
         flood(context.packet(), context.inPort());
     }
 
+    private boolean fromPeerToPeer(MessageContext context) {
+        return isPeerAddress(context.sender()) && isPeerAddress(context.target());
+    }
+
+    private boolean fromSpeakerToPeer(MessageContext context) {
+        return sdxL3PeerService != null &&
+                isPeerAddress(context.target()) &&
+                !interfaceService.getInterfacesByIp(context.sender()).isEmpty();
+    }
+
+    /**
+     * Makes the VLAN translation if necessary on the packet.
+     *
+     * @param context request message context to process
+     */
+    private VlanId getDestinationPeerVlan(MessageContext context) {
+        return sdxL3PeerService.getInterfaceForPeer(context.target()).vlan();
+    }
+
+    /**
+     * Controls whether an IP address is configured for an external peer.
+     *
+     * @param ip the examined IP address
+     * @return result of the control
+     */
     private boolean isPeerAddress(IpAddress ip) {
         return bgpConfig.bgpSpeakers()
                 .stream()
@@ -199,7 +318,7 @@
     private Set<Interface> filterVlanInterfacesNoIp(Set<Interface> vlanInterfaces) {
         return vlanInterfaces
                 .stream()
-                .filter(intf -> intf.ipAddresses().isEmpty())
+                .filter(intf -> intf.ipAddressesList().isEmpty())
                 .collect(Collectors.toSet());
     }
 
@@ -215,7 +334,8 @@
         Set<Interface> vlanInterfaces = interfaceService.getInterfacesByVlan(vlanId);
         return interfaceService.getInterfacesByVlan(vlanId)
                 .stream()
-                .anyMatch(intf -> intf.connectPoint().equals(connectPoint) && intf.ipAddresses().isEmpty())
+                .anyMatch(intf -> intf.connectPoint().equals(connectPoint) &&
+                        intf.ipAddressesList().isEmpty())
                 && vlanInterfaces.size() > 1;
     }
 
@@ -281,7 +401,7 @@
     private boolean hasIpAddress(ConnectPoint connectPoint) {
         return interfaceService.getInterfacesByPort(connectPoint)
                 .stream()
-                .flatMap(intf -> intf.ipAddresses().stream())
+                .flatMap(intf -> intf.ipAddressesList().stream())
                 .findAny()
                 .isPresent();
     }
@@ -302,7 +422,7 @@
     }
 
     /**
-     * Flood the arp request at all edges on a specifc VLAN.
+     * Floods the arp request at all edges on a specifc VLAN.
      *
      * @param request the arp request
      * @param dsts the destination interfaces
@@ -457,7 +577,7 @@
         ICMP6 icmpv6 = (ICMP6) ipv6.getPayload();
 
         IpAddress sender = Ip6Address.valueOf(ipv6.getSourceAddress());
-        IpAddress target = null;
+        IpAddress target = Ip6Address.valueOf(ipv6.getDestinationAddress());
 
         MessageType type;
         if (icmpv6.getIcmpType() == ICMP6.NEIGHBOR_SOLICITATION) {
@@ -530,6 +650,26 @@
         public IpAddress sender() {
             return sender;
         }
+
+        public void setVlan(VlanId vlanId) {
+            this.eth.setVlanID(vlanId.toShort());
+        }
+    }
+
+    private class InternalPacketProcessor implements PacketProcessor {
+        @Override
+        public void process(PacketContext context) {
+
+            if (context.isHandled()) {
+                return;
+            }
+
+            InboundPacket pkt = context.inPacket();
+            Ethernet ethernet = pkt.parsed();
+            if (ethernet.getEtherType() == Ethernet.TYPE_ARP) {
+                processPacketIn(pkt);
+            }
+        }
     }
 
 }
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
index 9cd228d..2a64240 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
index c0a7a77..9b8e2d2 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -20,7 +20,7 @@
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.routing.config.BgpConfig;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
 
 import java.util.List;
 
@@ -29,8 +29,8 @@
  */
 public interface SdxL3PeerService {
 
-    Class<SdxProvidersConfig> CONFIG_CLASS = SdxProvidersConfig.class;
-    String CONFIG_KEY = "providers";
+    Class<SdxParticipantsConfig> CONFIG_CLASS = SdxParticipantsConfig.class;
+    String CONFIG_KEY = "participants";
 
     /**
      * Returns the list of IP addresses of BGP peers.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
index acc4579..dae6b49 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/AddPeerDetailsCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
index 2e22bed..b50c2e2 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/BgpPeersListCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -27,7 +27,7 @@
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
 import org.onosproject.sdxl3.SdxL3PeerService;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
 
 import java.util.Comparator;
 import java.util.List;
@@ -46,7 +46,7 @@
     private static final String NAME_FORMAT = "%s: " + DETAILS_FORMAT;
     public static final String NO_PEERS = "No peers configured";
 
-    private static final Comparator<SdxProvidersConfig.PeerConfig> PEER_COMPARATOR =
+    private static final Comparator<SdxParticipantsConfig.PeerConfig> PEER_COMPARATOR =
             Comparator.comparing(p -> p.ip());
     public static final String EMPTY = "";
 
@@ -60,8 +60,8 @@
         BgpConfig bgpConfig = configService.getConfig(routerAppId, RoutingService.CONFIG_CLASS);
 
         ApplicationId sdxL3AppId = coreService.getAppId(SdxL3.SDX_L3_APP);
-        SdxProvidersConfig peersConfig = configService.
-                getConfig(sdxL3AppId, SdxProvidersConfig.class);
+        SdxParticipantsConfig peersConfig = configService.
+                getConfig(sdxL3AppId, SdxParticipantsConfig.class);
 
         if (bgpConfig == null && peersConfig == null) {
             print(NO_PEERS);
@@ -74,7 +74,7 @@
             peeringAddresses = peerService.getPeerAddresses(bgpConfig);
         }
 
-        List<SdxProvidersConfig.PeerConfig> bgpPeers =
+        List<SdxParticipantsConfig.PeerConfig> bgpPeers =
                 Lists.newArrayList();
         if (peersConfig != null) {
             // Get all peers having details specified
@@ -103,15 +103,15 @@
         });
     }
 
-    private List<SdxProvidersConfig.PeerConfig> mergePeers(
+    private List<SdxParticipantsConfig.PeerConfig> mergePeers(
                 List<IpAddress> peeringAddresses,
-                List<SdxProvidersConfig.PeerConfig> bgpPeers) {
+                List<SdxParticipantsConfig.PeerConfig> bgpPeers) {
         peeringAddresses.forEach(a -> {
             boolean exists = bgpPeers.stream()
                     .filter(p -> p.ip().equals(a))
                     .findAny().isPresent();
             if (!exists) {
-                bgpPeers.add(new SdxProvidersConfig
+                bgpPeers.add(new SdxParticipantsConfig
                         .PeerConfig(Optional.<String>empty(), a, null, EMPTY));
             }
         });
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
index 8eee2ba..a8e1bb9 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/RemovePeerDetailsCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
index a5216de..0aa9aed 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/cli/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
similarity index 98%
rename from sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java
rename to sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
index 8206fda..6d3dfce 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxProvidersConfig.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/SdxParticipantsConfig.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -36,7 +36,7 @@
  * Configuration for the Service Providers being connected to the
  * software defined internet exchange point.
  */
-public class SdxProvidersConfig extends Config<ApplicationId> {
+public class SdxParticipantsConfig extends Config<ApplicationId> {
 
     public static final String PEERS = "bgpPeers";
     public static final String NAME = "name";
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
index ebcfa19..14c6552 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/config/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
index dfa68ba..e9105a3 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -29,6 +29,7 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.TpPort;
+import org.onlab.packet.VlanId;
 import org.onlab.util.ItemNotFoundException;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
@@ -54,7 +55,7 @@
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
 import org.onosproject.sdxl3.SdxL3PeerService;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -103,8 +104,8 @@
             new ConfigFactory(SubjectFactories.APP_SUBJECT_FACTORY,
                               CONFIG_CLASS, CONFIG_KEY) {
                 @Override
-                public SdxProvidersConfig createConfig() {
-                    return new SdxProvidersConfig();
+                public SdxParticipantsConfig createConfig() {
+                    return new SdxParticipantsConfig();
                 }
             };
 
@@ -146,7 +147,10 @@
      * @param interfaceName Name of the interface configured on port
      */
     @Override
-    public void addPeerDetails(String peerName, IpAddress peerAddress, ConnectPoint port, String interfaceName) {
+    public void addPeerDetails(String peerName,
+                               IpAddress peerAddress,
+                               ConnectPoint port,
+                               String interfaceName) {
 
         BgpConfig bgpConfig = getBgpConfig();
         if (bgpConfig == null) {
@@ -178,15 +182,15 @@
             }
         }
 
-        SdxProvidersConfig peersConfig =
-                configService.addConfig(sdxAppId, SdxProvidersConfig.class);
+        SdxParticipantsConfig peersConfig =
+                configService.addConfig(sdxAppId, SdxParticipantsConfig.class);
         if (peerName != null && peerNameExists(peersConfig, peerName)) {
             throw new IllegalArgumentException("Peer name in use");
         }
 
         addPeerToConf(peersConfig, peerName, peerAddress, port, interfaceName);
         configService.
-                applyConfig(sdxAppId, SdxProvidersConfig.class, peersConfig.node());
+                applyConfig(sdxAppId, SdxParticipantsConfig.class, peersConfig.node());
     }
 
     /**
@@ -201,8 +205,8 @@
             throw new ItemNotFoundException("BGP configuration not found");
         }
 
-        SdxProvidersConfig peersConfig =
-                configService.addConfig(sdxAppId, SdxProvidersConfig.class);
+        SdxParticipantsConfig peersConfig =
+                configService.addConfig(sdxAppId, SdxParticipantsConfig.class);
 
         if (peersConfig.getPeerForIp(peerAddress) == null) {
             throw new ItemNotFoundException("Peer details not found");
@@ -210,7 +214,7 @@
 
         removePeerFromConf(peersConfig, peerAddress);
         configService.applyConfig(sdxAppId,
-                                  SdxProvidersConfig.class,
+                                  SdxParticipantsConfig.class,
                                   peersConfig.node());
     }
 
@@ -244,7 +248,7 @@
     }
 
     private boolean interfaceSubnetIncludesIp(Interface peerInterface, IpAddress peerAddress) {
-        if (peerInterface.ipAddresses().stream()
+        if (peerInterface.ipAddressesList().stream()
                 .anyMatch(intfIp -> intfIp.subnetAddress().
                         contains(peerAddress))) {
             // Interface configured subnet not including peer address
@@ -253,7 +257,7 @@
         return false;
     }
 
-    private boolean peerNameExists(SdxProvidersConfig config, String peerName) {
+    private boolean peerNameExists(SdxParticipantsConfig config, String peerName) {
         if (config.getPeerForName(Optional.of(peerName)) == null) {
             return false;
         }
@@ -265,11 +269,11 @@
      *
      * @param peersConfig the BGP peers configuration
      */
-    private void addPeerToConf(SdxProvidersConfig peersConfig, String peerName,
+    private void addPeerToConf(SdxParticipantsConfig peersConfig, String peerName,
                                IpAddress peerAddress, ConnectPoint port,
                                String interfaceName) {
         log.debug("Adding peer with IP to configuration: {}", peerAddress);
-        SdxProvidersConfig.PeerConfig peer = new SdxProvidersConfig.
+        SdxParticipantsConfig.PeerConfig peer = new SdxParticipantsConfig.
                 PeerConfig(Optional.ofNullable(peerName), peerAddress,
                            port, interfaceName);
 
@@ -281,7 +285,7 @@
      *
      * @param peersConfig the BGP peeers configuration
      */
-    private void removePeerFromConf(SdxProvidersConfig peersConfig,
+    private void removePeerFromConf(SdxParticipantsConfig peersConfig,
                                     IpAddress peerAddress) {
         log.debug("Removing peer details from configuration: {}",
                   peerAddress.toString());
@@ -311,7 +315,7 @@
             return null;
         }
 
-        SdxProvidersConfig config = configService.getConfig(sdxAppId, SdxProvidersConfig.class);
+        SdxParticipantsConfig config = configService.getConfig(sdxAppId, SdxParticipantsConfig.class);
         if (config == null) {
             return null;
         }
@@ -395,6 +399,9 @@
     private Collection<PointToPointIntent> buildSpeakerIntents(BgpConfig.BgpSpeakerConfig speaker) {
         List<PointToPointIntent> intents = new ArrayList<>();
 
+        // Get the BGP Speaker VLAN Id
+        VlanId bgpSpeakerVlanId = speaker.vlan();
+
         for (IpAddress peerAddress : speaker.peers()) {
             Interface peeringInterface = getInterfaceForPeer(peerAddress);
 
@@ -404,18 +411,23 @@
                 continue;
             }
 
-            IpAddress peeringAddress = null;
-            for (InterfaceIpAddress address : peeringInterface.ipAddresses()) {
+            IpAddress bgpSpeakerAddress = null;
+            for (InterfaceIpAddress address : peeringInterface.ipAddressesList()) {
                 if (address.subnetAddress().contains(peerAddress)) {
-                    peeringAddress = address.ipAddress();
+                    bgpSpeakerAddress = address.ipAddress();
                     break;
                 }
             }
 
-            checkNotNull(peeringAddress);
+            checkNotNull(bgpSpeakerAddress);
 
-            intents.addAll(buildIntents(speaker.connectPoint(), peeringAddress,
-                    peeringInterface.connectPoint(), peerAddress));
+            VlanId peerVlanId = peeringInterface.vlan();
+
+            intents.addAll(buildIntents(speaker.connectPoint(), bgpSpeakerVlanId,
+                                        bgpSpeakerAddress,
+                                        peeringInterface.connectPoint(),
+                                        peerVlanId,
+                                        peerAddress));
         }
 
         return intents;
@@ -426,19 +438,24 @@
      * IP addresses.
      *
      * @param portOne the first connect point
+     * @param vlanOne the ingress VLAN
      * @param ipOne the first IP address
      * @param portTwo the second connect point
+     * @param vlanTwo the egress VLAN
      * @param ipTwo the second IP address
      * @return the intents to install
      */
     private Collection<PointToPointIntent> buildIntents(ConnectPoint portOne,
+                                                        VlanId vlanOne,
                                                         IpAddress ipOne,
                                                         ConnectPoint portTwo,
+                                                        VlanId vlanTwo,
                                                         IpAddress ipTwo) {
 
         List<PointToPointIntent> intents = new ArrayList<>();
 
-        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
+        TrafficTreatment.Builder treatmentToPeer = DefaultTrafficTreatment.builder();
+        TrafficTreatment.Builder treatmentToSpeaker = DefaultTrafficTreatment.builder();
         TrafficSelector selector;
         Key key;
 
@@ -453,8 +470,14 @@
             icmpProtocol = IPv6.PROTOCOL_ICMP6;
         }
 
-        // Path from BGP speaker to BGP peer matching destination TCP connectPoint 179
+        // Add treatment for VLAN for traffic going from BGP speaker to BGP peer
+        if (!vlanTwo.equals(VlanId.NONE)) {
+            treatmentToPeer.setVlanId(vlanTwo);
+        }
+
+        // Path from BGP speaker to BGP peer matching destination TCP port 179
         selector = buildSelector(tcpProtocol,
+                vlanOne,
                 ipOne,
                 ipTwo,
                 null,
@@ -466,14 +489,15 @@
                 .appId(sdxAppId)
                 .key(key)
                 .selector(selector)
-                .treatment(treatment)
+                .treatment(treatmentToPeer.build())
                 .ingressPoint(portOne)
                 .egressPoint(portTwo)
                 .priority(PRIORITY_OFFSET)
                 .build());
 
-        // Path from BGP speaker to BGP peer matching source TCP connectPoint 179
+        // Path from BGP speaker to BGP peer matching source TCP port 179
         selector = buildSelector(tcpProtocol,
+                vlanOne,
                 ipOne,
                 ipTwo,
                 BGP_PORT,
@@ -485,52 +509,15 @@
                 .appId(sdxAppId)
                 .key(key)
                 .selector(selector)
-                .treatment(treatment)
+                .treatment(treatmentToPeer.build())
                 .ingressPoint(portOne)
                 .egressPoint(portTwo)
                 .priority(PRIORITY_OFFSET)
                 .build());
 
-        // Path from BGP peer to BGP speaker matching destination TCP connectPoint 179
-        selector = buildSelector(tcpProtocol,
-                ipTwo,
-                ipOne,
-                null,
-                BGP_PORT);
-
-        key = buildKey(ipTwo, ipOne, SUFFIX_DST);
-
-        intents.add(PointToPointIntent.builder()
-                .appId(sdxAppId)
-                .key(key)
-                .selector(selector)
-                .treatment(treatment)
-                .ingressPoint(portTwo)
-                .egressPoint(portOne)
-                .priority(PRIORITY_OFFSET)
-                .build());
-
-        // Path from BGP peer to BGP speaker matching source TCP connectPoint 179
-        selector = buildSelector(tcpProtocol,
-                ipTwo,
-                ipOne,
-                BGP_PORT,
-                null);
-
-        key = buildKey(ipTwo, ipOne, SUFFIX_SRC);
-
-        intents.add(PointToPointIntent.builder()
-                .appId(sdxAppId)
-                .key(key)
-                .selector(selector)
-                .treatment(treatment)
-                .ingressPoint(portTwo)
-                .egressPoint(portOne)
-                .priority(PRIORITY_OFFSET)
-                .build());
-
         // ICMP path from BGP speaker to BGP peer
         selector = buildSelector(icmpProtocol,
+                vlanOne,
                 ipOne,
                 ipTwo,
                 null,
@@ -542,14 +529,60 @@
                 .appId(sdxAppId)
                 .key(key)
                 .selector(selector)
-                .treatment(treatment)
+                .treatment(treatmentToPeer.build())
                 .ingressPoint(portOne)
                 .egressPoint(portTwo)
                 .priority(PRIORITY_OFFSET)
                 .build());
 
+        // Add treatment for VLAN for traffic going from BGP peer to BGP speaker
+        if (!vlanOne.equals(VlanId.NONE)) {
+            treatmentToSpeaker.setVlanId(vlanOne);
+        }
+
+        // Path from BGP peer to BGP speaker matching destination TCP port 179
+        selector = buildSelector(tcpProtocol,
+                vlanTwo,
+                ipTwo,
+                ipOne,
+                null,
+                BGP_PORT);
+
+        key = buildKey(ipTwo, ipOne, SUFFIX_DST);
+
+        intents.add(PointToPointIntent.builder()
+                .appId(sdxAppId)
+                .key(key)
+                .selector(selector)
+                .treatment(treatmentToSpeaker.build())
+                .ingressPoint(portTwo)
+                .egressPoint(portOne)
+                .priority(PRIORITY_OFFSET)
+                .build());
+
+        // Path from BGP peer to BGP speaker matching source TCP port 179
+        selector = buildSelector(tcpProtocol,
+                vlanTwo,
+                ipTwo,
+                ipOne,
+                BGP_PORT,
+                null);
+
+        key = buildKey(ipTwo, ipOne, SUFFIX_SRC);
+
+        intents.add(PointToPointIntent.builder()
+                .appId(sdxAppId)
+                .key(key)
+                .selector(selector)
+                .treatment(treatmentToSpeaker.build())
+                .ingressPoint(portTwo)
+                .egressPoint(portOne)
+                .priority(PRIORITY_OFFSET)
+                .build());
+
         // ICMP path from BGP peer to BGP speaker
         selector = buildSelector(icmpProtocol,
+                vlanTwo,
                 ipTwo,
                 ipOne,
                 null,
@@ -561,7 +594,7 @@
                 .appId(sdxAppId)
                 .key(key)
                 .selector(selector)
-                .treatment(treatment)
+                .treatment(treatmentToSpeaker.build())
                 .ingressPoint(portTwo)
                 .egressPoint(portOne)
                 .priority(PRIORITY_OFFSET)
@@ -574,16 +607,23 @@
      * Builds a traffic selector based on the set of input parameters.
      *
      * @param ipProto IP protocol
+     * @param ingressVlanId VLAN Id configured on the ingress interface
      * @param srcIp source IP address
      * @param dstIp destination IP address
-     * @param srcTcpPort source TCP connectPoint, or null if shouldn't be set
-     * @param dstTcpPort destination TCP connectPoint, or null if shouldn't be set
+     * @param srcTcpPort source TCP port, or null if shouldn't be set
+     * @param dstTcpPort destination TCP port, or null if shouldn't be set
      * @return the new traffic selector
      */
-    private TrafficSelector buildSelector(byte ipProto, IpAddress srcIp,
+    private TrafficSelector buildSelector(byte ipProto,
+                                          VlanId ingressVlanId,
+                                          IpAddress srcIp,
                                           IpAddress dstIp, Short srcTcpPort,
                                           Short dstTcpPort) {
         TrafficSelector.Builder builder = DefaultTrafficSelector.builder().matchIPProtocol(ipProto);
+        // Match on any VLAN Id if a VLAN Id configured on the ingress interface
+        if (!ingressVlanId.equals(VlanId.NONE)) {
+            builder.matchVlanId(VlanId.ANY);
+        }
 
         if (dstIp.isIp4()) {
             builder.matchEthType(Ethernet.TYPE_IPV4)
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
index d172822..81773cb 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
index eb7b599..6869796 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/package-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 237a9dc..6c3a84d 100644
--- a/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/sdx-l3/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -1,5 +1,5 @@
 <!--
-  ~ Copyright 2014-2015 Open Networking Laboratory
+  ~ Copyright 2016-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.
diff --git a/sdx-l3/src/main/resources/config-examples/network-cfg.json b/sdx-l3/src/main/resources/config-examples/network-cfg.json
index 7100e7a..31fde3f 100644
--- a/sdx-l3/src/main/resources/config-examples/network-cfg.json
+++ b/sdx-l3/src/main/resources/config-examples/network-cfg.json
@@ -50,7 +50,7 @@
   },
   "apps" : {
     "org.onosproject.sdxl3": {
-      "providers": {
+      "participants": {
         "bgpPeers": [
           {
             "name": "AS1-Router1",
diff --git a/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json b/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
index 1bdc232..e4df2f8 100644
--- a/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
+++ b/sdx-l3/src/main/resources/config-examples/route-server_network-cfg.json
@@ -21,7 +21,7 @@
   },
   "apps" : {
     "org.onosproject.sdxl3" : {
-      "providers" : {
+      "participants" : {
         "bgpPeers": [
           {
             "name": "AS65001-R1",
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
index e32a63d..0608ee6 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3ArpHandlerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -15,6 +15,7 @@
  */
 package org.onosproject.sdxl3;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.junit.Before;
 import org.junit.Test;
@@ -34,6 +35,10 @@
 import org.onlab.packet.ndp.NeighborAdvertisement;
 import org.onlab.packet.ndp.NeighborDiscoveryOptions;
 import org.onlab.packet.ndp.NeighborSolicitation;
+import org.onosproject.TestApplicationId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.core.CoreServiceAdapter;
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.incubator.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
@@ -46,6 +51,9 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.Port;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.NetworkConfigServiceAdapter;
 import org.onosproject.net.device.DeviceListener;
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.edge.EdgePortService;
@@ -60,14 +68,17 @@
 import org.onosproject.net.packet.OutboundPacket;
 import org.onosproject.net.packet.PacketServiceAdapter;
 import org.onosproject.net.provider.ProviderId;
+import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
@@ -90,6 +101,10 @@
  * also included.
  */
 public class SdxL3ArpHandlerTest {
+    private static final ApplicationId ROUTER_APPID =
+            TestApplicationId.create("foo");
+    private static final ApplicationId SDXL3_APPID =
+            TestApplicationId.create("bar");
 
     private static final int NUM_DEVICES = 10;
     private static final int NUM_PORTS_PER_DEVICE = 3;
@@ -111,6 +126,7 @@
     private static final MacAddress MAC2 = MacAddress.valueOf("00:00:00:00:00:02");
     private static final MacAddress MAC3 = MacAddress.valueOf("00:00:00:00:00:03");
     private static final MacAddress MAC4 = MacAddress.valueOf("00:00:00:00:00:04");
+    private static final MacAddress MAC5 = MacAddress.valueOf("00:00:00:00:00:05");
     private static final MacAddress MAC10 = MacAddress.valueOf("00:00:00:00:00:0A");
 
     private static final MacAddress SOLICITED_MAC3 = MacAddress.valueOf("33:33:FF:00:00:01");
@@ -119,22 +135,44 @@
     private static final HostId HID2 = HostId.hostId(MAC2, VLAN1);
     private static final HostId HID3 = HostId.hostId(MAC3, VLAN1);
     private static final HostId HID4 = HostId.hostId(MAC4, VLAN1);
+    private static final HostId HID5 = HostId.hostId(MAC5, VLAN1);
     private static final HostId HID10 = HostId.hostId(MAC10, VLAN10);
 
     private static final DeviceId DID1 = getDeviceId(1);
     private static final DeviceId DID2 = getDeviceId(2);
+    private static final DeviceId DID3 = getDeviceId(100);
 
     private static final PortNumber P1 = PortNumber.portNumber(1);
 
     private static final ConnectPoint CP1 = new ConnectPoint(DID1, P1);
     private static final ConnectPoint CP2 = new ConnectPoint(DID2, P1);
+    private static final ConnectPoint CP3 = new ConnectPoint(DID3, P1);
 
     private static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L);
+    private static final HostLocation LOC2 = new HostLocation(DID2, P1, 123L);
 
-    private static final String PEER1_IP = "10.0.1.201";
-    private static final String PEER2_IP = "10.0.1.101";
-    private static final String PEER1_IP6 = "1000::1";
-    private static final String PEER2_IP6 = "1000::100";
+    private static final String SPEAKER_IP_STRING = "10.0.2.201";
+    private static final Ip4Address SPEAKER_IP = Ip4Address.valueOf(SPEAKER_IP_STRING);
+    private static final IpPrefix INTF1_IP_PREFIX = IpPrefix.valueOf(SPEAKER_IP_STRING + "/24");
+    private static final String PEER1_IP_STRING = "10.0.1.1";
+    private static final Ip4Address PEER1_IP = Ip4Address.valueOf(PEER1_IP_STRING);
+    private static final String PEER2_IP_STRING = "10.0.1.2";
+    private static final Ip4Address PEER2_IP = Ip4Address.valueOf(PEER2_IP_STRING);
+    private static final String PEER3_IP_STRING = "10.0.2.1";
+    private static final Ip4Address PEER3_IP = Ip4Address.valueOf(PEER3_IP_STRING);
+    private static final String SPEAKER_IP6_STRING = "1001::1";
+    private static final Ip6Address SPEAKER_IP6 = Ip6Address.valueOf(SPEAKER_IP6_STRING);
+    private static final IpPrefix INTF2_IP6_PREFIX = IpPrefix.valueOf(SPEAKER_IP6_STRING + "/64");
+    private static final String PEER1_IP6_STRING = "1001::100";
+    private static final Ip6Address PEER1_IP6 = Ip6Address.valueOf(PEER1_IP6_STRING);
+    private static final String PEER2_IP6_STRING = "1001::200";
+    private static final Ip6Address PEER2_IP6 = Ip6Address.valueOf(PEER2_IP6_STRING);
+    private static final String PEER3_IP6_STRING = "1001::1000";
+    private static final Ip6Address PEER3_IP6 = Ip6Address.valueOf(PEER3_IP6_STRING);
+    private static final String INTF1_NAME = "intf1";
+    private static final String INTF2_NAME = "intf2";
+    private static final String INTF_NAME_PREFIX = "intf";
+    private static final String NO_NAME = "";
 
     private final byte[] zeroMacAddress = MacAddress.ZERO.toBytes();
 
@@ -152,22 +190,28 @@
 
     private SdxL3ArpHandler proxyArp;
 
-    private BgpConfig bgpConfig;
-    private TestPacketService packetService;
-    private DeviceService deviceService;
-    private EdgePortService edgePortService;
-    private LinkService linkService;
-    private HostService hostService;
+    private CoreService coreService;
     private InterfaceService interfaceService;
+    private EdgePortService edgePortService;
+    private HostService hostService;
+    private TestPacketService packetService;
+    private NetworkConfigService networkConfigService;
+    private SdxL3PeerService sdxL3PeerService;
+    private BgpConfig bgpConfig;
+
+    private DeviceService deviceService;
+    private LinkService linkService;
 
     @Before
     public void setUp() throws Exception {
-
-        bgpConfig = createMock(BgpConfig.class);
-        packetService = new TestPacketService();
-        hostService = createMock(HostService.class);
-        edgePortService = createMock(EdgePortService.class);
         interfaceService = createMock(InterfaceService.class);
+        edgePortService = createMock(EdgePortService.class);
+        hostService = createMock(HostService.class);
+        sdxL3PeerService = createMock(SdxL3PeerService.class);
+        bgpConfig = createMock(BgpConfig.class);
+        coreService = new TestCoreService();
+        packetService = new TestPacketService();
+        networkConfigService = new TestNetworkConfigService();
 
         // Create the topology
         createTopology();
@@ -176,11 +220,15 @@
         setupconfigIpCPoints();
         setupconfigVlanCPoints();
 
-        proxyArp = new SdxL3ArpHandler(bgpConfig,
-                                       edgePortService,
-                                       hostService,
-                                       packetService,
-                                       interfaceService);
+        proxyArp = new SdxL3ArpHandler();
+        proxyArp.coreService = coreService;
+        proxyArp.interfaceService = interfaceService;
+        proxyArp.edgeService = edgePortService;
+        proxyArp.hostService = hostService;
+        proxyArp.packetService = packetService;
+        proxyArp.networkConfigService = networkConfigService;
+        proxyArp.sdxL3PeerService = sdxL3PeerService;
+        proxyArp.activate();
     }
 
     /**
@@ -204,7 +252,7 @@
         createLinks(NUM_DEVICES);
         addIntfConfig();
         addEmptyBgpConfig();
-        popluateEdgePortService();
+        populateEdgePortService();
     }
 
     /**
@@ -276,6 +324,7 @@
         Set<Interface> interfaces = Sets.newHashSet();
 
         Set<Interface> vlanOneSet = new HashSet<>();
+        Set<Interface> vlanTwoSet = new HashSet<>();
 
         for (int i = 1; i <= LAST_CONF_DEVICE_INTF_VLAN_IP; i++) {
             ConnectPoint cp = new ConnectPoint(getDeviceId(i), P1);
@@ -297,33 +346,42 @@
             InterfaceIpAddress ia4 = new InterfaceIpAddress(addr4, prefix4);
 
             // Setting up interfaces
-            Interface intf1 = new Interface(cp, Sets.newHashSet(ia1, ia3),
+            Interface intf1 = new Interface(INTF1_NAME, cp,
+                                            Lists.newArrayList(ia1, ia3),
                                             MacAddress.valueOf(2 * i - 1),
-                                            VlanId.vlanId((short) 1));
-            Interface intf2 = new Interface(cp, Sets.newHashSet(ia2, ia4),
+                                            VLAN1);
+            Interface intf2 = new Interface(INTF2_NAME, cp,
+                                            Lists.newArrayList(ia2, ia4),
                                             MacAddress.valueOf(2 * i),
-                                            VlanId.NONE);
+                                            VLAN2);
 
             interfaces.add(intf1);
             interfaces.add(intf2);
 
             vlanOneSet.add(intf1);
+            vlanTwoSet.add(intf2);
 
             expect(interfaceService.getInterfacesByPort(cp))
                     .andReturn(Sets.newHashSet(intf1, intf2)).anyTimes();
         }
         for (int i = LAST_CONF_DEVICE_INTF_VLAN_IP + 1; i <= LAST_CONF_DEVICE_INTF_VLAN; i++) {
             ConnectPoint cp = new ConnectPoint(getDeviceId(i), P1);
-            Interface intf1 = new Interface(cp, Collections.emptyList(),
-                                            MacAddress.NONE,
-                                            VlanId.vlanId((short) 1));
+            Interface intf = new Interface(INTF_NAME_PREFIX + i, cp,
+                                           Collections.emptyList(),
+                                           MacAddress.NONE,
+                                           VlanId.vlanId((short) 1));
 
-            interfaces.add(intf1);
-            vlanOneSet.add(intf1);
+            interfaces.add(intf);
+            vlanOneSet.add(intf);
 
             expect(interfaceService.getInterfacesByPort(cp))
-                    .andReturn(Sets.newHashSet(intf1)).anyTimes();
+                    .andReturn(Sets.newHashSet(intf)).anyTimes();
         }
+        expect(interfaceService.getInterfacesByPort(CP3))
+                .andReturn(Collections.emptySet()).anyTimes();
+
+        expect(interfaceService.getInterfacesByVlan(VlanId.NONE))
+                .andReturn(vlanTwoSet).anyTimes();
         expect(interfaceService.getInterfacesByVlan(VLAN1))
                 .andReturn(vlanOneSet).anyTimes();
         expect(interfaceService.getInterfacesByVlan(VLAN10))
@@ -345,6 +403,7 @@
         Set<BgpConfig.BgpSpeakerConfig> speakers = Sets.newHashSet();
 
         expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(anyObject())).andReturn(null).anyTimes();
         replay(bgpConfig);
     }
 
@@ -352,7 +411,7 @@
      * Populates edge ports in the EdgePortService to return all port 1
      * as edge ports.
      */
-    private void popluateEdgePortService() {
+    private void populateEdgePortService() {
         Set<ConnectPoint> edgeConnectPoints = new HashSet<>();
 
         for (int i = 1; i <= NUM_DEVICES; i++) {
@@ -380,6 +439,8 @@
         expect(edgePortService.getEdgePoints())
                 .andReturn(edgeConnectPoints).anyTimes();
 
+        expect(edgePortService.isEdgePoint(CP3)).andReturn(true).anyTimes();
+
         replay(edgePortService);
     }
 
@@ -479,7 +540,7 @@
         replay(hostService);
         replay(interfaceService);
 
-        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
                                        MAC4, SOLICITED_MAC3,
                                        IP4, IP3);
 
@@ -490,7 +551,7 @@
         proxyArp.processPacketIn(pkt);
 
         assertEquals(1, packetService.packets.size());
-        Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+        Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT, VLAN1,
                                      MAC3, MAC4, IP3, IP4);
         verifyPacketOut(ndpReply, getLocation(5), packetService.packets.get(0));
     }
@@ -548,7 +609,7 @@
         replay(hostService);
         replay(interfaceService);
 
-        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
                                        MAC4, SOLICITED_MAC3,
                                        IP4, IP3);
 
@@ -694,7 +755,7 @@
         replay(hostService);
         replay(interfaceService);
 
-        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
                                        MAC4, SOLICITED_MAC3,
                                        IP4, IP3);
 
@@ -771,7 +832,7 @@
         replay(hostService);
         replay(interfaceService);
 
-        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION, VLAN1,
                                        MAC2,
                                        MacAddress.valueOf("33:33:ff:00:00:01"),
                                        theirIp,
@@ -785,6 +846,7 @@
         assertEquals(1, packetService.packets.size());
 
         Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+                                     VLAN1,
                                      firstMac,
                                      MAC2,
                                      ourFirstIp,
@@ -794,6 +856,7 @@
         // Test a request for the second address on that port
         packetService.packets.clear();
         ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                              VLAN1,
                               MAC2,
                               MacAddress.valueOf("33:33:ff:00:00:01"),
                               theirIp,
@@ -807,6 +870,7 @@
         assertEquals(1, packetService.packets.size());
 
         ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+                            VLAN1,
                             secondMac,
                             MAC2,
                             ourSecondIp,
@@ -854,6 +918,7 @@
         Ip6Address theirIp = Ip6Address.valueOf("1000::ffff");
 
         Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                                       VLAN1,
                                        MAC1,
                                        MacAddress.valueOf("33:33:ff:00:00:01"),
                                        theirIp,
@@ -870,6 +935,7 @@
         // Request for a valid internal IP address but coming in an external port
         packetService.packets.clear();
         ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                              VLAN1,
                               MAC1,
                               MacAddress.valueOf("33:33:ff:00:00:01"),
                               theirIp,
@@ -894,9 +960,12 @@
 
         expect(hostService.getHostsByIp(theirIp)).andReturn(Collections.emptySet());
         expect(interfaceService.getInterfacesByIp(ourIp)).andReturn(
-                        Collections.singleton(new Interface(getLocation(1),
-                        Collections.singleton(new InterfaceIpAddress(ourIp, IpPrefix.valueOf("10.0.1.1/24"))),
-                        ourMac, VLAN1)));
+                        Collections.singleton(new Interface(NO_NAME,
+                                    getLocation(1),
+                                    Collections.singletonList(
+                                            new InterfaceIpAddress(ourIp,
+                                                            IpPrefix.valueOf("10.0.1.1/24"))),
+                                                            ourMac, VLAN1)));
         expect(hostService.getHost(HostId.hostId(ourMac, VLAN1))).andReturn(null);
         replay(hostService);
         replay(interfaceService);
@@ -938,8 +1007,9 @@
 
         expect(hostService.getHostsByIp(theirIp)).andReturn(Collections.emptySet());
         expect(interfaceService.getInterfacesByIp(ourIp))
-                .andReturn(Collections.singleton(new Interface(getLocation(1),
-                                                               Collections.singleton(new InterfaceIpAddress(
+                .andReturn(Collections.singleton(new Interface(NO_NAME,
+                                                               getLocation(1),
+                                                               Collections.singletonList(new InterfaceIpAddress(
                                                                        ourIp,
                                                                        IpPrefix.valueOf("1000::1/64"))),
                                                                ourMac,
@@ -951,6 +1021,7 @@
         // This is a request from something inside our network (like a BGP
         // daemon) to an external host.
         Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                                       VLAN1,
                                        ourMac,
                                        MacAddress.valueOf("33:33:ff:00:00:01"),
                                        ourIp,
@@ -985,28 +1056,10 @@
      */
     @Test
     public void testReplyExternalPortForPeer() {
-        Ip4Address peer1 = Ip4Address.valueOf(PEER1_IP);
-        MacAddress ourMac = MacAddress.valueOf(1L);
-        Ip4Address peer2 = Ip4Address.valueOf(PEER2_IP);
-
-        expect(hostService.getHostsByIp(peer2)).andReturn(Collections.emptySet());
-        expect(interfaceService.getInterfacesByIp(peer1)).andReturn(
-                Collections.singleton(
-                        new Interface(getLocation(1),
-                                      Collections.singleton(
-                                              new InterfaceIpAddress(
-                                                      peer1,
-                                                      IpPrefix.valueOf("10.0.1.1/24"))),
-                                      ourMac, VLAN1)));
-        expect(hostService.getHost(HostId.hostId(ourMac, VLAN1))).andReturn(null);
-        replay(hostService);
-        replay(interfaceService);
-
-        addPeersToBgpConfig();
+        setupSdx();
 
         // Request for a valid external IP address belonging to BGP peer
-        Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null, peer1,
-                                       peer2);
+        Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null, PEER1_IP, PEER2_IP);
         InboundPacket pkt =
                 new DefaultInboundPacket(CP1, arpRequest,
                                          ByteBuffer.wrap(arpRequest.serialize()));
@@ -1021,29 +1074,14 @@
      */
     @Test
     public void testReplyExternalPortForPeerIpv6() {
-        Ip6Address peer1 = Ip6Address.valueOf(PEER1_IP6);
-        MacAddress peer1Mac = MacAddress.valueOf(1L);
-        Ip6Address peer2 = Ip6Address.valueOf(PEER2_IP6);
-
-        expect(hostService.getHostsByIp(peer2)).andReturn(Collections.emptySet());
-        expect(interfaceService.getInterfacesByIp(peer1))
-                .andReturn(Collections.singleton(new Interface(getLocation(1),
-                                                               Collections.singleton(new InterfaceIpAddress(
-                                                                       peer1,
-                                                                       IpPrefix.valueOf("1000::1/64"))),
-                                                               peer1Mac,
-                                                               VLAN1)));
-        expect(hostService.getHost(HostId.hostId(peer1Mac, VLAN1))).andReturn(null);
-        replay(hostService);
-        replay(interfaceService);
-
-        addPeersToBgpConfig();
+        setupSdx();
 
         Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                                       VLAN1,
                                        MAC1,
                                        MacAddress.valueOf("33:33:ff:00:00:01"),
-                                       peer1,
-                                       peer2);
+                                       PEER1_IP6,
+                                       PEER2_IP6);
 
         InboundPacket pkt =
                 new DefaultInboundPacket(CP1, ndpRequest,
@@ -1054,6 +1092,212 @@
         assertEquals(1, packetService.packets.size());
     }
 
+    /**
+     * Request for a valid IPv4 address for BGP peer, coming from a
+     * BGP speaker and VLAN translation is necessary.
+     */
+    @Test
+    public void testReplySpeakerForPeerWithVlan() {
+        setupSdx();
+
+        // Request for a valid external IP address belonging to BGP peer
+        Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN10, MAC1, null,
+                                       SPEAKER_IP, PEER3_IP);
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, arpRequest,
+                                         ByteBuffer.wrap(arpRequest.serialize()));
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+    /**
+     * Request for a valid IPv6 address for BGP peer, coming from a
+     * BGP speaker and VLAN translation is necessary.
+     */
+    @Test
+    public void testReplySpeakerForPeerWithVlanIpv6() {
+        setupSdx();
+
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                                       VLAN10,
+                                       MAC1,
+                                       MacAddress.valueOf("33:33:ff:00:00:01"),
+                                       SPEAKER_IP6,
+                                       PEER3_IP6);
+
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, ndpRequest,
+                                         ByteBuffer.wrap(ndpRequest.serialize()));
+
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+    /**
+     * Request for a valid IPv4 address of BGP speaker, originating from a
+     * BGP peer and VLAN translation is necessary.
+     */
+    @Test
+    public void testReplyPeerForSpeakerWithVlan() {
+        setupSdx();
+
+        // Request for a valid external IP address belonging to BGP peer
+        Ethernet arpRequest = buildArp(ARP.OP_REQUEST, VLAN1, MAC1, null,
+                                       PEER3_IP, SPEAKER_IP);
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, arpRequest,
+                                         ByteBuffer.wrap(arpRequest.serialize()));
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+    /**
+     * Request for a valid IPv6 address for BGP speaker, originating from a
+     * BGP peer and VLAN translation is necessary.
+     */
+    @Test
+    public void testReplyPeerForSpeakerWithVlanIpv6() {
+        setupSdx();
+
+        Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
+                                       VLAN1,
+                                       MAC1,
+                                       MacAddress.valueOf("33:33:ff:00:00:01"),
+                                       PEER3_IP6,
+                                       SPEAKER_IP6);
+
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, ndpRequest,
+                                         ByteBuffer.wrap(ndpRequest.serialize()));
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+
+    /**
+     * Tests the VLAN translation for ARP reply originating from external peer
+     * and addressing to internal speaker.
+     */
+    @Test
+    public void testHandleArpReplyWithVlan() {
+        setupSdx();
+
+        // Reply for a valid external IP address belonging to BGP peer
+        Ethernet arpReply = buildArp(ARP.OP_REPLY, VLAN1, MAC2, MAC1,
+                                     PEER3_IP, SPEAKER_IP);
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, arpReply,
+                                         ByteBuffer.wrap(arpReply.serialize()));
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+    /**
+     * Tests the VLAN translation for NDP reply originating from external peer
+     * and addressing to internal speaker.
+     */
+    @Test
+    public void testHandleNdpReplyWithVlan() {
+        setupSdx();
+
+        Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
+                                     VLAN1,
+                                     MAC2,
+                                     MAC1,
+                                     PEER3_IP6,
+                                     SPEAKER_IP6);
+
+        InboundPacket pkt =
+                new DefaultInboundPacket(CP3, ndpReply,
+                                         ByteBuffer.wrap(ndpReply.serialize()));
+        proxyArp.processPacketIn(pkt);
+
+        assertEquals(1, packetService.packets.size());
+    }
+
+    private void setupSdx() {
+        MacAddress dstMac = MacAddress.valueOf(1L);
+
+        Host peer1Host = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1,
+                                         Collections.singleton(PEER1_IP));
+
+        expect(hostService.getHost(HID1)).andReturn(peer1Host);
+        expect(hostService.getHostsByIp(PEER1_IP))
+                .andReturn(Collections.singleton(peer1Host));
+        Host peer2Host = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC2,
+                                         Collections.singleton(PEER2_IP));
+        expect(hostService.getHost(HID2)).andReturn(peer2Host);
+        expect(hostService.getHostsByIp(PEER2_IP))
+                .andReturn(Collections.singleton(peer2Host));
+        Host peer1Ipv6Host = new DefaultHost(PID, HID3, MAC3, VLAN1, LOC1,
+                                         Collections.singleton(PEER1_IP6));
+        expect(hostService.getHost(HID3)).andReturn(peer1Ipv6Host);
+        expect(hostService.getHostsByIp(PEER1_IP6))
+                .andReturn(Collections.singleton(peer1Ipv6Host));
+        Host peer2Ipv6Host = new DefaultHost(PID, HID4, MAC4, VLAN1, LOC2,
+                                         Collections.singleton(PEER2_IP6));
+        expect(hostService.getHost(HID4)).andReturn(peer2Ipv6Host);
+        expect(hostService.getHostsByIp(PEER2_IP6))
+                .andReturn(Collections.singleton(peer2Ipv6Host));
+        expect(hostService.getHost(HostId.hostId(dstMac, VLAN1))).andReturn(null);
+        expect(hostService.getHostsByIp(PEER3_IP)).andReturn(Collections.emptySet());
+        expect(hostService.getHost(HostId.hostId(dstMac, VLAN10))).andReturn(null);
+        Host peer3Ipv6Host = new DefaultHost(PID, HID5, MAC5, VLAN1, LOC2,
+                                             Collections.singleton(PEER3_IP6));
+        expect(hostService.getHost(HID5)).andReturn(peer3Ipv6Host);
+        expect(hostService.getHostsByIp(PEER3_IP6))
+                .andReturn(Collections.singleton(peer3Ipv6Host));
+        expect(hostService.getHost(HostId.hostId(dstMac, VLAN10))).andReturn(null);
+        expect(hostService.getHostsByIp(SPEAKER_IP)).andReturn(Collections.emptySet());
+        expect(hostService.getHostsByIp(SPEAKER_IP6)).andReturn(Collections.emptySet());
+
+        replay(hostService);
+
+        expect(interfaceService.getInterfacesByIp(PEER1_IP))
+                .andReturn(Collections.emptySet()).anyTimes();
+        expect(interfaceService.getInterfacesByIp(PEER1_IP6))
+                .andReturn(Collections.emptySet()).anyTimes();
+
+        Interface intf1 =  new Interface(NO_NAME,
+                                        getLocation(1),
+                                        Collections.singletonList(
+                                                new InterfaceIpAddress(
+                                                        SPEAKER_IP,
+                                                        INTF1_IP_PREFIX)),
+                                        dstMac, VLAN1);
+        expect(interfaceService.getInterfacesByIp(SPEAKER_IP)).andReturn(
+                Collections.singleton(intf1)).anyTimes();
+
+        Interface intf2 = new Interface(NO_NAME,
+                                          getLocation(1),
+                                          Collections.singletonList(
+                                                  new InterfaceIpAddress(
+                                                          SPEAKER_IP6,
+                                                          INTF2_IP6_PREFIX)),
+                                          dstMac, VLAN1);
+        expect(interfaceService.getInterfacesByIp(SPEAKER_IP6)).andReturn(
+                Collections.singleton(intf2)).anyTimes();
+        expect(interfaceService.getInterfacesByIp(PEER3_IP)).andReturn(
+                Collections.singleton(intf1));
+        expect(interfaceService.getInterfacesByIp(PEER3_IP6)).andReturn(
+                Collections.singleton(intf2));
+
+        replay(interfaceService);
+
+        expect(sdxL3PeerService.getInterfaceForPeer(PEER2_IP)).andReturn(intf1);
+        expect(sdxL3PeerService.getInterfaceForPeer(PEER2_IP6)).andReturn(intf2);
+        expect(sdxL3PeerService.getInterfaceForPeer(PEER3_IP)).andReturn(intf1);
+        expect(sdxL3PeerService.getInterfaceForPeer(PEER3_IP6)).andReturn(intf2);
+        replay(sdxL3PeerService);
+
+        addPeersToBgpConfig();
+    }
+
     private void addPeersToBgpConfig() {
         reset(bgpConfig);
 
@@ -1062,16 +1306,36 @@
         Optional<String> speakerName = Optional.empty();
         ConnectPoint connectPoint = CP2;
         Set<IpAddress> connectedPeers =
-                new HashSet<>(Arrays.asList(IpAddress.valueOf(PEER1_IP),
-                                            IpAddress.valueOf(PEER2_IP),
-                                            IpAddress.valueOf(PEER1_IP6),
-                                            IpAddress.valueOf(PEER2_IP6)));
+                new HashSet<>(Arrays.asList(PEER1_IP,
+                                            PEER2_IP,
+                                            PEER1_IP6,
+                                            PEER2_IP6));
+        BgpConfig.BgpSpeakerConfig speaker1 =
+                new BgpConfig.BgpSpeakerConfig(speakerName,
+                                               VlanId.NONE,
+                                               connectPoint,
+                                               connectedPeers);
+        speakers.add(speaker1);
 
-        speakers.add(new BgpConfig.BgpSpeakerConfig(speakerName, VlanId.NONE,
-                                                    connectPoint,
-                                                    connectedPeers));
+        speakerName = Optional.empty();
+        connectPoint = CP3;
+        connectedPeers = new HashSet<>(Arrays.asList(PEER3_IP,
+                                                     PEER3_IP6));
+        BgpConfig.BgpSpeakerConfig speaker2 =
+                new BgpConfig.BgpSpeakerConfig(speakerName,
+                                               VLAN10,
+                                               connectPoint,
+                                               connectedPeers);
+        speakers.add(speaker2);
 
         expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
+
+        expect(bgpConfig.getSpeakerFromPeer(PEER1_IP)).andReturn(speaker1).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(PEER2_IP)).andReturn(speaker1).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(PEER3_IP)).andReturn(speaker2).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(PEER1_IP6)).andReturn(speaker1).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(PEER2_IP6)).andReturn(speaker1).anyTimes();
+        expect(bgpConfig.getSpeakerFromPeer(PEER3_IP6)).andReturn(speaker2).anyTimes();
         replay(bgpConfig);
     }
 
@@ -1184,7 +1448,7 @@
      * @param dstIp  destination IP address
      * @return the NDP packet
      */
-    private Ethernet buildNdp(byte type, MacAddress srcMac, MacAddress dstMac,
+    private Ethernet buildNdp(byte type, VlanId vlanId, MacAddress srcMac, MacAddress dstMac,
                               Ip6Address srcIp, Ip6Address dstIp) {
         assertThat(type, anyOf(
                 is(ICMP6.NEIGHBOR_SOLICITATION),
@@ -1223,7 +1487,7 @@
         eth.setDestinationMACAddress(dstMac);
         eth.setSourceMACAddress(srcMac);
         eth.setEtherType(Ethernet.TYPE_IPV6);
-        eth.setVlanID(VLAN1.toShort());
+        eth.setVlanID(vlanId.toShort());
         eth.setPayload(ipv6);
 
         return eth;
@@ -1242,5 +1506,45 @@
             packets.add(packet);
         }
     }
+
+    /**
+     * Mocks the CoreService.
+     */
+    private class TestCoreService extends CoreServiceAdapter {
+        private final Map<String, ApplicationId> registeredApps =
+                new HashMap<>();
+
+        public TestCoreService() {
+            registeredApps.put(RoutingService.ROUTER_APP_ID, ROUTER_APPID);
+            registeredApps.put(SdxL3.SDX_L3_APP, SDXL3_APPID);
+        }
+
+        @Override
+        public ApplicationId getAppId(String name) {
+            return registeredApps.get(name);
+        }
+    }
+
+    /**
+     * Mocks the NetworkConfigService.
+     */
+    private class TestNetworkConfigService extends NetworkConfigServiceAdapter {
+        private final Map<ApplicationId, Config> registeredConfigs
+                = new HashMap<>();
+
+        public TestNetworkConfigService() {
+            registeredConfigs.put(ROUTER_APPID, bgpConfig);
+        }
+
+        @Override
+        public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
+            return (C) registeredConfigs.get(subject);
+        }
+
+        @Override
+        public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) {
+            return (C) registeredConfigs.get(subject);
+        }
+    }
 }
 
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
index 1a09d0d..bea2fe8 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
similarity index 78%
rename from sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java
rename to sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
index aea859a..8dedc82 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxProvidersConfigTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/config/SdxParticipantsConfigTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -36,7 +36,10 @@
 import static junit.framework.TestCase.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-public class SdxProvidersConfigTest {
+/**
+ * Unit tests for SdxParticipantsConfig class.
+ */
+public class SdxParticipantsConfigTest {
     private static final ApplicationId APP_ID =
             new TestApplicationId(SdxL3.SDX_L3_APP);
     private static final String KEY = "key";
@@ -64,22 +67,22 @@
     private static final IpAddress IP3 = IpAddress.valueOf(IP_STRING3);
     private static final String INTF_NAME3 = "conn_point3";
 
-    private static final String JSON_TREE = "{\"" + SdxProvidersConfig.PEERS + "\"" +
-            ": [{\"" + SdxProvidersConfig.NAME + "\" : \"" + NAME1 + "\", " +
-            "\"" + SdxProvidersConfig.IP + "\" : \"" + IP_STRING1 + "\", " +
-            "\"" + SdxProvidersConfig.CONN_POINT + "\" : \"" + PORT_STRING1 + "\", " +
-            "\"" + SdxProvidersConfig.INTF_NAME + "\" : \"" + INTF_NAME1 + "\"}, " +
-            "{ \"" + SdxProvidersConfig.IP + "\" : \"" + IP_STRING2 + "\", " +
-            "\"" + SdxProvidersConfig.CONN_POINT + "\" : \"" + PORT_STRING2 + "\", " +
-            "\"" + SdxProvidersConfig.INTF_NAME + "\" : \"" + INTF_NAME2 + "\"}]}";
+    private static final String JSON_TREE = "{\"" + SdxParticipantsConfig.PEERS + "\"" +
+            ": [{\"" + SdxParticipantsConfig.NAME + "\" : \"" + NAME1 + "\", " +
+            "\"" + SdxParticipantsConfig.IP + "\" : \"" + IP_STRING1 + "\", " +
+            "\"" + SdxParticipantsConfig.CONN_POINT + "\" : \"" + PORT_STRING1 + "\", " +
+            "\"" + SdxParticipantsConfig.INTF_NAME + "\" : \"" + INTF_NAME1 + "\"}, " +
+            "{ \"" + SdxParticipantsConfig.IP + "\" : \"" + IP_STRING2 + "\", " +
+            "\"" + SdxParticipantsConfig.CONN_POINT + "\" : \"" + PORT_STRING2 + "\", " +
+            "\"" + SdxParticipantsConfig.INTF_NAME + "\" : \"" + INTF_NAME2 + "\"}]}";
 
     private static final String EMPTY_JSON_TREE = "{ }";
 
-    private Set<SdxProvidersConfig.PeerConfig> peers = new HashSet<>();
-    private SdxProvidersConfig.PeerConfig peer1;
+    private Set<SdxParticipantsConfig.PeerConfig> peers = new HashSet<>();
+    private SdxParticipantsConfig.PeerConfig peer1;
 
-    private SdxProvidersConfig peersConfig = new SdxProvidersConfig();
-    private SdxProvidersConfig emptyPeersConfig = new SdxProvidersConfig();
+    private SdxParticipantsConfig peersConfig = new SdxParticipantsConfig();
+    private SdxParticipantsConfig emptyPeersConfig = new SdxParticipantsConfig();
 
     private final ConfigApplyDelegate delegate = new MockCfgDelegate();
     private final ObjectMapper mapper = new ObjectMapper();
@@ -115,7 +118,7 @@
     @Test
     public void testAddPeer() throws Exception {
         int initialSize = peersConfig.bgpPeers().size();
-        SdxProvidersConfig.PeerConfig newPeer = createNewPeer();
+        SdxParticipantsConfig.PeerConfig newPeer = createNewPeer();
         peersConfig.addPeer(newPeer);
         assertEquals(initialSize + 1, peersConfig.bgpPeers().size());
         peers.add(newPeer);
@@ -158,20 +161,20 @@
         peers.remove(peer1);
         assertEquals(peers, peersConfig.bgpPeers());    }
 
-    private Set<SdxProvidersConfig.PeerConfig> createPeers() {
-        Set<SdxProvidersConfig.PeerConfig> peers = Sets.newHashSet();
+    private Set<SdxParticipantsConfig.PeerConfig> createPeers() {
+        Set<SdxParticipantsConfig.PeerConfig> peers = Sets.newHashSet();
 
-        peer1 = new SdxProvidersConfig.
+        peer1 = new SdxParticipantsConfig.
                 PeerConfig(Optional.of(NAME1), IP1, PORT1, INTF_NAME1);
         peers.add(peer1);
-        peers.add(new SdxProvidersConfig.
+        peers.add(new SdxParticipantsConfig.
                 PeerConfig(Optional.empty(), IP2, PORT2, INTF_NAME2));
 
         return peers;
     }
 
-    private SdxProvidersConfig.PeerConfig createNewPeer() {
-        return new SdxProvidersConfig.
+    private SdxParticipantsConfig.PeerConfig createNewPeer() {
+        return new SdxParticipantsConfig.
                 PeerConfig(Optional.of(NAME3), IP3, PORT3, INTF_NAME3);
     }
 
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
index e4b5c9e..325d8fb 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -45,7 +45,7 @@
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -102,12 +102,12 @@
     private NetworkConfigRegistry registry;
 
     private BgpConfig bgpConfig;
-    private SdxProvidersConfig providersConfig;
+    private SdxParticipantsConfig participantsConfig;
 
     private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers;
     private Map<String, Interface> interfaces;
 
-    SdxProvidersConfig.PeerConfig newPeer = createNewPeer();
+    SdxParticipantsConfig.PeerConfig newPeer = createNewPeer();
 
     private List<PointToPointIntent> intentList;
 
@@ -153,7 +153,7 @@
     private void setupEnvironment() {
         // Create mocks for configurations
         bgpConfig = createMock(BgpConfig.class);
-        providersConfig = createMock(SdxProvidersConfig.class);
+        participantsConfig = createMock(SdxParticipantsConfig.class);
 
         // Create mocks for services
         coreService = new TestCoreService();
@@ -190,7 +190,7 @@
 
         public TestNetworkConfigService() {
             registeredConfigs.put(ROUTER_APPID, bgpConfig);
-            registeredConfigs.put(SDXL3_APPID, providersConfig);
+            registeredConfigs.put(SDXL3_APPID, participantsConfig);
         }
 
         @Override
@@ -312,39 +312,39 @@
      * @return configured BGP peers as a MAP from peer IP address to BgpPeer
      */
     private void setUpPeers() {
-        SdxProvidersConfig.PeerConfig peer1 =
-                new SdxProvidersConfig.PeerConfig(Optional.of(PEER1_NAME),
-                                                  IpAddress.valueOf(PEER_IP),
-                                                  SW1_ETH1,
-                                                  INTERFACE_SW1_ETH1);
+        SdxParticipantsConfig.PeerConfig peer1 =
+                new SdxParticipantsConfig.PeerConfig(Optional.of(PEER1_NAME),
+                                                     IpAddress.valueOf(PEER_IP),
+                                                     SW1_ETH1,
+                                                     INTERFACE_SW1_ETH1);
 
         // Set up the related expectations
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER_IP)))
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER_IP)))
                 .andReturn(SW1_ETH1).anyTimes();
-        expect(providersConfig.
+        expect(participantsConfig.
                 getInterfaceNameForPeer(IpAddress.valueOf(PEER_IP)))
                 .andReturn(INTERFACE_SW1_ETH1).anyTimes();
-        expect(providersConfig.getPeerForName(Optional.of(PEER1_NAME)))
+        expect(participantsConfig.getPeerForName(Optional.of(PEER1_NAME)))
                 .andReturn(peer1).anyTimes();
-        expect(providersConfig.getPeerForIp(IpAddress.valueOf(PEER_IP)))
+        expect(participantsConfig.getPeerForIp(IpAddress.valueOf(PEER_IP)))
                 .andReturn(peer1).anyTimes();
 
         // Set up expectations for peers that will be added
-        expect(providersConfig.
+        expect(participantsConfig.
                 getInterfaceNameForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER1_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.getPeerForIp(IpAddress.valueOf(NEW_PEER1_IP)))
+        expect(participantsConfig.getPeerForIp(IpAddress.valueOf(NEW_PEER1_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.
+        expect(participantsConfig.
                 getInterfaceNameForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(NEW_PEER2_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.getPeerForName(Optional.of(NEW_PEER_NAME)))
+        expect(participantsConfig.getPeerForName(Optional.of(NEW_PEER_NAME)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.node()).andReturn(null).anyTimes();
+        expect(participantsConfig.node()).andReturn(null).anyTimes();
     }
 
     /**
@@ -352,7 +352,7 @@
      */
     @Test(expected = ItemNotFoundException.class)
     public void testAddPeerWithNoBgpConfig() {
-        replay(providersConfig);
+        replay(participantsConfig);
         // Reset NetworkConfigService
         peerManager.configService = new NetworkConfigServiceAdapter();
         peerManager.activate();
@@ -368,7 +368,7 @@
      */
     @Test(expected = ItemNotFoundException.class)
     public void testAddPeerUknownIp() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -383,7 +383,7 @@
      */
     @Test(expected = ItemNotFoundException.class)
     public void testAddPeerToUnknownInterface() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -398,7 +398,7 @@
      */
     @Test(expected = IllegalArgumentException.class)
     public void testAddPeerToNonMatchingInterface() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -413,7 +413,7 @@
      */
     @Test(expected = IllegalArgumentException.class)
     public void testAddAlreadyRegisteredPeer() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -428,7 +428,7 @@
      */
     @Test(expected = IllegalArgumentException.class)
     public void testAddPeerWithNameInUse() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -443,9 +443,9 @@
      */
     @Test
     public void testAddPeerDetailsSuccess() {
-        providersConfig.addPeer(newPeer);
+        participantsConfig.addPeer(newPeer);
         expectLastCall().once();
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -453,14 +453,14 @@
                                    newPeer.ip(),
                                    newPeer.connectPoint(),
                                    newPeer.interfaceName());
-        verify(providersConfig);
+        verify(participantsConfig);
     }
 
-    private SdxProvidersConfig.PeerConfig createNewPeer() {
-        return new SdxProvidersConfig.PeerConfig(Optional.of(NEW_PEER_NAME),
-                                                 IpAddress.valueOf(NEW_PEER1_IP),
-                                                 SW2_ETH1,
-                                                 INTERFACE_SW2_ETH1);
+    private SdxParticipantsConfig.PeerConfig createNewPeer() {
+        return new SdxParticipantsConfig.PeerConfig(Optional.of(NEW_PEER_NAME),
+                                                    IpAddress.valueOf(NEW_PEER1_IP),
+                                                    SW2_ETH1,
+                                                    INTERFACE_SW2_ETH1);
     }
 
     /**
@@ -468,7 +468,7 @@
      */
     @Test(expected = ItemNotFoundException.class)
     public void testRemovePeerWithNoBgpConfig() {
-        replay(providersConfig);
+        replay(participantsConfig);
         // Reset NetworkConfigService
         peerManager.configService = new NetworkConfigServiceAdapter();
         peerManager.activate();
@@ -481,7 +481,7 @@
      */
     @Test(expected = ItemNotFoundException.class)
     public void testRemoveNonFoundPeer() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -493,14 +493,14 @@
      */
     @Test
     public void testRemovePeerDetailsSuccess() {
-        providersConfig.removePeer(IpAddress.valueOf(PEER_IP));
+        participantsConfig.removePeer(IpAddress.valueOf(PEER_IP));
         expectLastCall().once();
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
         peerManager.removePeerDetails(IpAddress.valueOf(PEER_IP));
-        verify(providersConfig);
+        verify(participantsConfig);
     }
 
     /**
@@ -508,7 +508,7 @@
      */
     @Test
     public void testGetPeerAddresses() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
@@ -529,7 +529,7 @@
      */
     @Test
     public void testGetInterfaceForPeer() {
-        replay(providersConfig);
+        replay(participantsConfig);
 
         peerManager.activate();
 
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
index 6d775ab..1f9cbdd 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Open Networking Laboratory
+ * Copyright 2016-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.
@@ -54,7 +54,7 @@
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
-import org.onosproject.sdxl3.config.SdxProvidersConfig;
+import org.onosproject.sdxl3.config.SdxParticipantsConfig;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -85,21 +85,30 @@
     private static final String DPID1 = "00:00:00:00:00:00:00:01";
     private static final String DPID2 = "00:00:00:00:00:00:00:02";
     private static final String DPID3 = "00:00:00:00:00:00:00:03";
+    private static final String DPID4 = "00:00:00:00:00:00:00:04";
+
+    private static final VlanId NO_VLAN = VlanId.NONE;
+    private static final VlanId VLAN10 = VlanId.vlanId(Short.valueOf("10"));
+    private static final VlanId VLAN20 = VlanId.vlanId(Short.valueOf("20"));
 
     private static final String PEER1_IP = "192.168.10.1";
-    private static final String PEER2_IP = "192.168.20.1";
-    private static final String PEER3_IP = "192.168.10.2";
+    private static final String PEER2_IP = "192.168.10.2";
+    private static final String PEER3_IP = "192.168.20.1";
+    private static final String PEER4_IP = "192.168.30.1";
     private static final String SPEAKER1_IP = "192.168.10.101";
     private static final String SPEAKER2_IP = "192.168.20.101";
+    private static final String SPEAKER3_IP = "192.168.30.101";
     private static final String PREFIX32 = "/32";
     private static final String PREFIX24 = "/24";
 
     private static final String INTERFACE_SW1_ETH1 = "s1-eth1";
     private static final String INTERFACE_SW2_ETH1 = "s2-eth1";
     private static final String INTERFACE_SW3_ETH1 = "s3-eth1";
+    private static final String INTERFACE_SW4_ETH1 = "s4-eth1";
 
     private static final String MAC1 = "00:00:00:00:00:01";
     private static final String MAC2 = "00:00:00:00:00:02";
+    private static final String MAC3 = "00:00:00:00:00:03";
 
     private SdxL3PeerManager peerManager;
     private CoreService coreService;
@@ -109,7 +118,7 @@
     private NetworkConfigRegistry registry;
 
     private BgpConfig bgpConfig;
-    private SdxProvidersConfig providersConfig;
+    private SdxParticipantsConfig participantsConfig;
 
     private Set<BgpConfig.BgpSpeakerConfig> bgpSpeakers;
     private Map<String, Interface> interfaces;
@@ -122,12 +131,16 @@
             DeviceId.deviceId(dpidToUri(DPID2));
     private static final DeviceId DEVICE3_ID =
             DeviceId.deviceId(dpidToUri(DPID3));
+    private static final DeviceId DEVICE4_ID =
+            DeviceId.deviceId(dpidToUri(DPID4));
 
     // Ports where BGP speakers are connected
     private static final ConnectPoint SW1_ETH100 =
             new ConnectPoint(DEVICE1_ID, PortNumber.portNumber(100));
     private static final ConnectPoint SW2_ETH100 =
             new ConnectPoint(DEVICE2_ID, PortNumber.portNumber(100));
+    private static final ConnectPoint SW3_ETH100 =
+            new ConnectPoint(DEVICE3_ID, PortNumber.portNumber(100));
 
     // Ports where BGP peers are connected
     private static final ConnectPoint SW1_ETH1 =
@@ -136,6 +149,8 @@
             new ConnectPoint(DEVICE2_ID, PortNumber.portNumber(1));
     private static final ConnectPoint SW3_ETH1 =
             new ConnectPoint(DEVICE3_ID, PortNumber.portNumber(1));
+    private static final ConnectPoint SW4_ETH1 =
+            new ConnectPoint(DEVICE4_ID, PortNumber.portNumber(1));
 
     private final TrafficTreatment noTreatment =
             DefaultTrafficTreatment.emptyTreatment();
@@ -162,7 +177,7 @@
     private void setupEnvironment() {
         // Create mocks for configurations
         bgpConfig = createMock(BgpConfig.class);
-        providersConfig = createMock(SdxProvidersConfig.class);
+        participantsConfig = createMock(SdxParticipantsConfig.class);
 
         // Create mocks for services
         coreService = new TestCoreService();
@@ -199,7 +214,7 @@
 
         public TestNetworkConfigService() {
             registeredConfigs.put(ROUTER_APPID, bgpConfig);
-            registeredConfigs.put(SDXL3_APPID, providersConfig);
+            registeredConfigs.put(SDXL3_APPID, participantsConfig);
         }
 
         @Override
@@ -240,50 +255,66 @@
                                        IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
         Interface intfSw1Eth1 = new Interface(INTERFACE_SW1_ETH1,
                                               SW1_ETH1,
-                                              Collections.singleton(ia1),
+                                              Collections.singletonList(ia1),
                                               MacAddress.valueOf(MAC1),
                                               VlanId.NONE);
 
         configuredInterfaces.put(INTERFACE_SW1_ETH1, intfSw1Eth1);
 
         InterfaceIpAddress ia2 =
-                new InterfaceIpAddress(IpAddress.valueOf(SPEAKER2_IP),
-                                       IpPrefix.valueOf(SPEAKER2_IP + PREFIX24));
+                new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
+                                       IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
         Interface intfSw2Eth1 = new Interface(INTERFACE_SW2_ETH1,
                                               SW2_ETH1,
-                                              Collections.singleton(ia2),
-                                              MacAddress.valueOf(MAC2),
+                                              Collections.singletonList(ia2),
+                                              MacAddress.valueOf(MAC1),
                                               VlanId.NONE);
         configuredInterfaces.put(INTERFACE_SW2_ETH1, intfSw2Eth1);
 
         InterfaceIpAddress ia3 =
-                new InterfaceIpAddress(IpAddress.valueOf(SPEAKER1_IP),
-                                       IpPrefix.valueOf(SPEAKER1_IP + PREFIX24));
+                new InterfaceIpAddress(IpAddress.valueOf(SPEAKER2_IP),
+                                       IpPrefix.valueOf(SPEAKER2_IP + PREFIX24));
         Interface intfSw3Eth1 = new Interface(INTERFACE_SW3_ETH1,
                                               SW3_ETH1,
-                                              Collections.singleton(ia3),
-                                              MacAddress.valueOf(MAC1),
+                                              Collections.singletonList(ia3),
+                                              MacAddress.valueOf(MAC2),
                                               VlanId.NONE);
         configuredInterfaces.put(INTERFACE_SW3_ETH1, intfSw3Eth1);
 
+        InterfaceIpAddress ia4 =
+                new InterfaceIpAddress(IpAddress.valueOf(SPEAKER3_IP),
+                                       IpPrefix.valueOf(SPEAKER3_IP + PREFIX24));
+        Interface intfSw4Eth1 = new Interface(INTERFACE_SW4_ETH1,
+                                              SW4_ETH1,
+                                              Collections.singletonList(ia4),
+                                              MacAddress.valueOf(MAC3),
+                                              VLAN20);
+        configuredInterfaces.put(INTERFACE_SW4_ETH1, intfSw4Eth1);
+
         // Set up the related expectations
         expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER1_IP)))
                 .andReturn(Collections.singleton(intfSw1Eth1)).anyTimes();
         // Always return the first matching even if not associated interface
         expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER1_IP)))
                 .andReturn(intfSw1Eth1).anyTimes();
-        expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER3_IP)))
-                .andReturn(intfSw1Eth1).anyTimes();
-        expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER2_IP)))
-                .andReturn(Collections.singleton(intfSw2Eth1)).anyTimes();
         expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER2_IP)))
                 .andReturn(intfSw2Eth1).anyTimes();
+        expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER2_IP)))
+                .andReturn(Collections.singleton(intfSw3Eth1)).anyTimes();
+        expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER3_IP)))
+                .andReturn(intfSw3Eth1).anyTimes();
+        expect(interfaceService.getInterfacesByIp(IpAddress.valueOf(SPEAKER3_IP)))
+                .andReturn(Collections.singleton(intfSw4Eth1)).anyTimes();
+        expect(interfaceService.getMatchingInterface(IpAddress.valueOf(PEER4_IP)))
+                .andReturn(intfSw4Eth1).anyTimes();
         expect(interfaceService.getInterfacesByPort(SW1_ETH1))
                 .andReturn(Collections.singleton(intfSw1Eth1)).anyTimes();
         expect(interfaceService.getInterfacesByPort(SW2_ETH1))
                 .andReturn(Collections.singleton(intfSw2Eth1)).anyTimes();
         expect(interfaceService.getInterfacesByPort(SW3_ETH1))
                 .andReturn(Collections.singleton(intfSw3Eth1)).anyTimes();
+        expect(interfaceService.getInterfacesByPort(SW4_ETH1))
+                .andReturn(Collections.singleton(intfSw4Eth1)).anyTimes();
         expect(interfaceService.getInterfacesByPort(new ConnectPoint(
                 DeviceId.deviceId(dpidToUri("00:00:00:00:00:00:01:00")),
                 PortNumber.portNumber(1))))
@@ -314,17 +345,22 @@
 
         Set<IpAddress> connectedPeers = new HashSet<>();
         connectedPeers.add(IpAddress.valueOf(PEER1_IP));
-        connectedPeers.add(IpAddress.valueOf(PEER3_IP));
+        connectedPeers.add(IpAddress.valueOf(PEER2_IP));
         BgpConfig.BgpSpeakerConfig speaker1 = new BgpConfig.BgpSpeakerConfig(
                 Optional.empty(), VlanId.NONE, SW1_ETH100, connectedPeers);
 
         BgpConfig.BgpSpeakerConfig speaker2 = new BgpConfig.BgpSpeakerConfig(
                 Optional.empty(), VlanId.NONE,
-                SW2_ETH100, Collections.singleton(IpAddress.valueOf(PEER2_IP)));
+                SW2_ETH100, Collections.singleton(IpAddress.valueOf(PEER3_IP)));
+
+        BgpConfig.BgpSpeakerConfig speaker3 = new BgpConfig.BgpSpeakerConfig(
+                Optional.empty(), VLAN10, SW3_ETH100,
+                Collections.singleton(IpAddress.valueOf(PEER4_IP)));
 
         Set<BgpConfig.BgpSpeakerConfig> speakers = Sets.newHashSet();
         speakers.add(speaker1);
         speakers.add(speaker2);
+        speakers.add(speaker3);
 
         // Set up the related expectations
         expect(bgpConfig.bgpSpeakers()).andReturn(speakers).anyTimes();
@@ -341,22 +377,30 @@
     private void setUpPeers() {
 
         // Set up the related expectations
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER1_IP)))
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER1_IP)))
                 .andReturn(SW1_ETH1).anyTimes();
-        expect(providersConfig.
-                getInterfaceNameForPeer(IpAddress.valueOf(PEER1_IP)))
+        expect(participantsConfig
+                .getInterfaceNameForPeer(IpAddress.valueOf(PEER1_IP)))
                 .andReturn(INTERFACE_SW1_ETH1).anyTimes();
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER2_IP)))
-                .andReturn(null).anyTimes();
-        expect(providersConfig
+
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER2_IP)))
+                .andReturn(SW2_ETH1).anyTimes();
+        expect(participantsConfig
                 .getInterfaceNameForPeer(IpAddress.valueOf(PEER2_IP)))
+                .andReturn(INTERFACE_SW2_ETH1).anyTimes();
+
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER3_IP)))
                 .andReturn(null).anyTimes();
-        expect(providersConfig.getPortForPeer(IpAddress.valueOf(PEER3_IP)))
-                .andReturn(SW3_ETH1).anyTimes();
-        expect(providersConfig
+        expect(participantsConfig
                 .getInterfaceNameForPeer(IpAddress.valueOf(PEER3_IP)))
-                .andReturn(INTERFACE_SW3_ETH1).anyTimes();
-        replay(providersConfig);
+                .andReturn(null).anyTimes();
+
+        expect(participantsConfig.getPortForPeer(IpAddress.valueOf(PEER4_IP)))
+                .andReturn(null).anyTimes();
+        expect(participantsConfig
+                .getInterfaceNameForPeer(IpAddress.valueOf(PEER4_IP)))
+                .andReturn(null).anyTimes();
+        replay(participantsConfig);
     }
 
     /**
@@ -379,6 +423,8 @@
      * The purpose of this method is too simplify the setUpBgpIntents() method,
      * and to make the setUpBgpIntents() easy to read.
      *
+     * @param srcVlanId ingress VlanId
+     * @param dstVlanId egress VlanId
      * @param srcPrefix source IP prefix to match
      * @param dstPrefix destination IP prefix to match
      * @param srcTcpPort source TCP port to match
@@ -386,9 +432,14 @@
      * @param srcConnectPoint source connect point for PointToPointIntent
      * @param dstConnectPoint destination connect point for PointToPointIntent
      */
-    private void bgpPathintentConstructor(String srcPrefix, String dstPrefix,
-                                          Short srcTcpPort, Short dstTcpPort,
-                                          ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
+    private void bgpPathIntentConstructor(VlanId srcVlanId,
+                                          VlanId dstVlanId,
+                                          String srcPrefix,
+                                          String dstPrefix,
+                                          Short srcTcpPort,
+                                          Short dstTcpPort,
+                                          ConnectPoint srcConnectPoint,
+                                          ConnectPoint dstConnectPoint) {
 
         TrafficSelector.Builder builder = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
@@ -396,6 +447,16 @@
                 .matchIPSrc(IpPrefix.valueOf(srcPrefix))
                 .matchIPDst(IpPrefix.valueOf(dstPrefix));
 
+        if (!srcVlanId.equals(VlanId.NONE)) {
+            builder.matchVlanId(VlanId.ANY);
+        }
+
+        TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+        if (!dstVlanId.equals(VlanId.NONE)) {
+            treatment.setVlanId(dstVlanId);
+        }
+
         if (srcTcpPort != null) {
             builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
         }
@@ -404,13 +465,14 @@
         }
 
         Key key = Key.of(srcPrefix.split("/")[0] + "-" + dstPrefix.split("/")[0]
-                                 + "-" + ((srcTcpPort == null) ? "dst" : "src"), SDXL3_APPID);
+                                 + "-" + ((srcTcpPort == null) ? "dst" : "src"),
+                         SDXL3_APPID);
 
         PointToPointIntent intent = PointToPointIntent.builder()
                 .appId(SDXL3_APPID)
                 .key(key)
                 .selector(builder.build())
-                .treatment(noTreatment)
+                .treatment(treatment.build())
                 .ingressPoint(srcConnectPoint)
                 .egressPoint(dstConnectPoint)
                 .build();
@@ -426,46 +488,61 @@
         Short bgpPort = 179;
 
         // Start to build intents between BGP speaker1 and BGP peer1
-        bgpPathintentConstructor(
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
                 SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, null, bgpPort,
                 SW1_ETH100, SW1_ETH1);
-        bgpPathintentConstructor(
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
                 SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, bgpPort, null,
                 SW1_ETH100, SW1_ETH1);
-        bgpPathintentConstructor(
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
                 PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
                 SW1_ETH1, SW1_ETH100);
-        bgpPathintentConstructor(
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
                 PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
                 SW1_ETH1, SW1_ETH100);
 
-        // Start to build intents between BGP speaker2 and BGP peer2
-        bgpPathintentConstructor(
-                SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, null, bgpPort,
-                SW2_ETH100, SW2_ETH1);
-        bgpPathintentConstructor(
-                SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, bgpPort, null,
-                SW2_ETH100, SW2_ETH1);
-        bgpPathintentConstructor(
-                PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, null, bgpPort,
-                SW2_ETH1, SW2_ETH100);
-        bgpPathintentConstructor(
-                PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, bgpPort, null,
-                SW2_ETH1, SW2_ETH100);
+        // Start to build intents between BGP speaker1 and BGP peer2
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                SPEAKER1_IP + PREFIX32, PEER2_IP + PREFIX32, null, bgpPort,
+                SW1_ETH100, SW2_ETH1);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                SPEAKER1_IP + PREFIX32, PEER2_IP + PREFIX32, bgpPort, null,
+                SW1_ETH100, SW2_ETH1);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                PEER2_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
+                SW2_ETH1, SW1_ETH100);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                PEER2_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
+                SW2_ETH1, SW1_ETH100);
 
-        // Start to build intents between BGP speaker1 and BGP peer3
-        bgpPathintentConstructor(
-                SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, null, bgpPort,
-                SW1_ETH100, SW3_ETH1);
-        bgpPathintentConstructor(
-                SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, bgpPort, null,
-                SW1_ETH100, SW3_ETH1);
-        bgpPathintentConstructor(
-                PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, null, bgpPort,
-                SW3_ETH1, SW1_ETH100);
-        bgpPathintentConstructor(
-                PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, bgpPort, null,
-                SW3_ETH1, SW1_ETH100);
+        // Start to build intents between BGP speaker2 and BGP peer3
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                SPEAKER2_IP + PREFIX32, PEER3_IP + PREFIX32, null, bgpPort,
+                SW2_ETH100, SW3_ETH1);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                SPEAKER2_IP + PREFIX32, PEER3_IP + PREFIX32, bgpPort, null,
+                SW2_ETH100, SW3_ETH1);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                PEER3_IP + PREFIX32, SPEAKER2_IP + PREFIX32, null, bgpPort,
+                SW3_ETH1, SW2_ETH100);
+        bgpPathIntentConstructor(NO_VLAN, NO_VLAN,
+                PEER3_IP + PREFIX32, SPEAKER2_IP + PREFIX32, bgpPort, null,
+                SW3_ETH1, SW2_ETH100);
+
+        // Start to build intents between BGP speaker3 and BGP peer4
+        bgpPathIntentConstructor(VLAN10, VLAN20,
+                SPEAKER3_IP + PREFIX32, PEER4_IP + PREFIX32, null, bgpPort,
+                SW3_ETH100, SW4_ETH1);
+        bgpPathIntentConstructor(VLAN10, VLAN20,
+                SPEAKER3_IP + PREFIX32, PEER4_IP + PREFIX32, bgpPort, null,
+                SW3_ETH100, SW4_ETH1);
+        bgpPathIntentConstructor(VLAN20, VLAN10,
+                PEER4_IP + PREFIX32, SPEAKER3_IP + PREFIX32, null, bgpPort,
+                SW4_ETH1, SW3_ETH100);
+        bgpPathIntentConstructor(VLAN20, VLAN10,
+                PEER4_IP + PREFIX32, SPEAKER3_IP + PREFIX32, bgpPort, null,
+                SW4_ETH1, SW3_ETH100);
+
     }
 
     /**
@@ -474,20 +551,35 @@
      * The purpose of this method is too simplify the setUpBgpIntents() method,
      * and to make the setUpBgpIntents() easy to read.
      *
+     * @param srcVlanId ingress VlanId
+     * @param dstVlanId egress VlanId
      * @param srcPrefix source IP prefix to match
      * @param dstPrefix destination IP prefix to match
      * @param srcConnectPoint source connect point for PointToPointIntent
      * @param dstConnectPoint destination connect point for PointToPointIntent
      */
-    private void icmpPathintentConstructor(String srcPrefix, String dstPrefix,
-                                           ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
+    private void icmpPathIntentConstructor(VlanId srcVlanId,
+                                           VlanId dstVlanId,
+                                           String srcPrefix,
+                                           String dstPrefix,
+                                           ConnectPoint srcConnectPoint,
+                                           ConnectPoint dstConnectPoint) {
 
-        TrafficSelector selector = DefaultTrafficSelector.builder()
+        TrafficSelector.Builder builder = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4)
                 .matchIPProtocol(IPv4.PROTOCOL_ICMP)
                 .matchIPSrc(IpPrefix.valueOf(srcPrefix))
-                .matchIPDst(IpPrefix.valueOf(dstPrefix))
-                .build();
+                .matchIPDst(IpPrefix.valueOf(dstPrefix));
+
+        if (!srcVlanId.equals(VlanId.NONE)) {
+            builder.matchVlanId(VlanId.ANY);
+        }
+
+        TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+        if (!dstVlanId.equals(VlanId.NONE)) {
+            treatment.setVlanId(dstVlanId);
+        }
 
         Key key = Key.of(srcPrefix.split("/")[0] + "-" + dstPrefix.split("/")[0]
                                  + "-" + "icmp", SDXL3_APPID);
@@ -495,8 +587,8 @@
         PointToPointIntent intent = PointToPointIntent.builder()
                 .appId(SDXL3_APPID)
                 .key(key)
-                .selector(selector)
-                .treatment(noTreatment)
+                .selector(builder.build())
+                .treatment(treatment.build())
                 .ingressPoint(srcConnectPoint)
                 .egressPoint(dstConnectPoint)
                 .build();
@@ -509,21 +601,60 @@
      */
     private void setUpIcmpIntents() {
         // Start to build intents between BGP speaker1 and BGP peer1
-        icmpPathintentConstructor(
-                SPEAKER1_IP + PREFIX32, PEER1_IP + PREFIX32, SW1_ETH100, SW1_ETH1);
-        icmpPathintentConstructor(
-                PEER1_IP + PREFIX32, SPEAKER1_IP + PREFIX32, SW1_ETH1, SW1_ETH100);
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  SPEAKER1_IP + PREFIX32,
+                                  PEER1_IP + PREFIX32,
+                                  SW1_ETH100,
+                                  SW1_ETH1);
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  PEER1_IP + PREFIX32,
+                                  SPEAKER1_IP + PREFIX32,
+                                  SW1_ETH1,
+                                  SW1_ETH100);
 
         // Start to build intents between BGP speaker1 and BGP peer2
-        icmpPathintentConstructor(
-                SPEAKER2_IP + PREFIX32, PEER2_IP + PREFIX32, SW2_ETH100, SW2_ETH1);
-        icmpPathintentConstructor(
-                PEER2_IP + PREFIX32, SPEAKER2_IP + PREFIX32, SW2_ETH1, SW2_ETH100);
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  SPEAKER1_IP + PREFIX32,
+                                  PEER2_IP + PREFIX32,
+                                  SW1_ETH100,
+                                  SW2_ETH1);
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  PEER2_IP + PREFIX32,
+                                  SPEAKER1_IP + PREFIX32,
+                                  SW2_ETH1,
+                                  SW1_ETH100);
 
-        icmpPathintentConstructor(
-                SPEAKER1_IP + PREFIX32, PEER3_IP + PREFIX32, SW1_ETH100, SW3_ETH1);
-        icmpPathintentConstructor(
-                PEER3_IP + PREFIX32, SPEAKER1_IP + PREFIX32, SW3_ETH1, SW1_ETH100);
+        // Start to build intents between BGP speaker2 and BGP peer3
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  SPEAKER2_IP + PREFIX32,
+                                  PEER3_IP + PREFIX32,
+                                  SW2_ETH100,
+                                  SW3_ETH1);
+        icmpPathIntentConstructor(NO_VLAN,
+                                  NO_VLAN,
+                                  PEER3_IP + PREFIX32,
+                                  SPEAKER2_IP + PREFIX32,
+                                  SW3_ETH1,
+                                  SW2_ETH100);
+
+        // Start to build intents between BGP speaker3 and BGP peer4
+        icmpPathIntentConstructor(VLAN10,
+                                  VLAN20,
+                                  SPEAKER3_IP + PREFIX32,
+                                  PEER4_IP + PREFIX32,
+                                  SW3_ETH100,
+                                  SW4_ETH1);
+        icmpPathIntentConstructor(VLAN20,
+                                  VLAN10,
+                                  PEER4_IP + PREFIX32,
+                                  SPEAKER3_IP + PREFIX32,
+                                  SW4_ETH1,
+                                  SW3_ETH100);
     }
 
     /**
@@ -600,10 +731,10 @@
         interfaceService.addListener(anyObject(InterfaceListener.class));
         expect(interfaceService.getMatchingInterface(ip)).andReturn(null).anyTimes();
         replay(interfaceService);
-        reset(providersConfig);
-        expect(providersConfig.getPortForPeer(ip)).andReturn(null);
-        expect(providersConfig.getInterfaceNameForPeer(ip)).andReturn(null);
-        replay(providersConfig);
+        reset(participantsConfig);
+        expect(participantsConfig.getPortForPeer(ip)).andReturn(null);
+        expect(participantsConfig.getInterfaceNameForPeer(ip)).andReturn(null);
+        replay(participantsConfig);
 
         // We don't expect any intents in this case
         reset(intentSynchronizer);
