[ONOS-5420] CP/untagged ifaces support in VPLS

Changes:
- Tests to account for tag-tag and tag-notag connectivity
- Introducing untagged ifaces in netcfg and topo files

Change-Id: If56fd4d8bbe4f1f2505e4d5d85c3eeda8c22ac5c
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
index 039cd12..10f8254 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
@@ -50,7 +50,7 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.Key;
 import org.onosproject.routing.IntentSynchronizationService;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 import org.slf4j.Logger;
 
 import java.util.Collection;
@@ -59,9 +59,9 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import static org.slf4j.LoggerFactory.getLogger;
 import static org.onosproject.vpls.IntentInstaller.PREFIX_BROADCAST;
 import static org.onosproject.vpls.IntentInstaller.PREFIX_UNICAST;
+import static org.slf4j.LoggerFactory.getLogger;
 
 /**
  * Application to create L2 broadcast overlay networks using VLANs.
@@ -102,7 +102,7 @@
     protected NetworkConfigService configService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected VplsConfigurationService vplsConfigService;
+    protected VplsConfigService vplsConfigService;
 
     private final HostListener hostListener = new InternalHostListener();
 
@@ -176,7 +176,7 @@
                     vplsConfigService.encap(vplsName);
 
             setupConnectivity(vplsName, interfaces, hosts, encap,
-                    vplsAffectedByApi.contains(vplsName));
+                              vplsAffectedByApi.contains(vplsName));
             vplsAffectedByApi.remove(vplsName);
         });
 
@@ -190,10 +190,10 @@
     /**
      * Sets up connectivity for specific VPLS.
      *
-     * @param vplsName the VPLS name
-     * @param interfaces the interfaces that belong to the VPLS
-     * @param hosts the hosts that belong to the VPLS
-     * @param encap the encapsulation type
+     * @param vplsName      the VPLS name
+     * @param interfaces    the interfaces that belong to the VPLS
+     * @param hosts         the hosts that belong to the VPLS
+     * @param encap         the encapsulation type
      * @param affectedByApi true if this function is triggered from the APIs;
      *                      false otherwise
      */
@@ -202,6 +202,7 @@
                                    Set<Host> hosts,
                                    EncapsulationType encap,
                                    boolean affectedByApi) {
+
         List<Intent> intents = Lists.newArrayList();
         List<Key> keys = Lists.newArrayList();
         Set<FilteredConnectPoint> fcPoints = buildFCPoints(interfaces);
@@ -223,7 +224,7 @@
      * Withdraws intents belonging to a VPLS, given a VPLS name.
      *
      * @param vplsName the VPLS name
-     * @param keys the keys of the intents to be installed
+     * @param keys     the keys of the intents to be installed
      */
     private void withdrawIntents(String vplsName, List<Key> keys) {
         List<Intent> intents = Lists.newArrayList();
@@ -233,7 +234,7 @@
                     if (!keys.contains(intent.key())) {
                         intents.add(intent);
                     }
-        });
+                });
 
         intentInstaller.withdrawIntents(intents);
     }
@@ -241,9 +242,9 @@
     /**
      * Sets up broadcast intents between any given filtered connect point.
      *
-     * @param vplsName the VPLS name
-     * @param fcPoints the set of filtered connect points
-     * @param encap the encapsulation type
+     * @param vplsName      the VPLS name
+     * @param fcPoints      the set of filtered connect points
+     * @param encap         the encapsulation type
      * @param affectedByApi true if the function triggered from APIs;
      *                      false otherwise
      * @return the set of broadcast intents
@@ -265,7 +266,7 @@
                                                   MacAddress.BROADCAST);
 
             if ((!intentInstaller.intentExists(brcKey) || affectedByApi)
-              && !otherPoints.isEmpty()) {
+                    && !otherPoints.isEmpty()) {
                 intents.add(intentInstaller.buildBrcIntent(brcKey,
                                                            point,
                                                            otherPoints,
@@ -279,10 +280,10 @@
     /**
      * Sets up unicast intents between any given filtered connect point.
      *
-     * @param vplsName the VPLS name
-     * @param hosts the set of destination hosts
-     * @param fcPoints the set of filtered connect points
-     * @param encap the encapsulation type
+     * @param vplsName      the VPLS name
+     * @param hosts         the set of destination hosts
+     * @param fcPoints      the set of filtered connect points
+     * @param encap         the encapsulation type
      * @param affectedByApi true if the function triggered from APIs;
      *                      false otherwise
      * @return the set of unicast intents
@@ -325,7 +326,7 @@
     }
 
     /**
-     * Finds the filtered connect point a host is attached to.
+     * Returns the filtered connect point associated to a given host.
      *
      * @param host the target host
      * @param fcps the filtered connected points
@@ -339,8 +340,7 @@
                     VlanIdCriterion vlanCriterion =
                             (VlanIdCriterion) fcp.trafficSelector().
                                     getCriterion(Criterion.Type.VLAN_VID);
-
-                    return vlanCriterion != null &&
+                    return vlanCriterion == null ||
                             vlanCriterion.vlanId().equals(host.vlan());
                 })
                 .findFirst()
@@ -360,11 +360,9 @@
                 .map(intf -> {
                     TrafficSelector.Builder selectorBuilder =
                             DefaultTrafficSelector.builder();
-
                     if (!intf.vlan().equals(VlanId.NONE)) {
                         selectorBuilder.matchVlanId(intf.vlan());
                     }
-
                     return new FilteredConnectPoint(intf.connectPoint(),
                                                     selectorBuilder.build());
                 })
@@ -404,7 +402,6 @@
                 case INTERFACE_REMOVED:
                     setupConnectivity(false);
                     break;
-
                 default:
                     break;
             }
@@ -417,7 +414,7 @@
     private class InternalNetworkConfigListener implements NetworkConfigListener {
         @Override
         public void event(NetworkConfigEvent event) {
-            if (event.configClass() == VplsConfigurationService.CONFIG_CLASS) {
+            if (event.configClass() == VplsConfigService.CONFIG_CLASS) {
                 log.debug(NET_CONF_EVENT, event.configClass());
                 switch (event.type()) {
                     case CONFIG_ADDED:
@@ -425,7 +422,6 @@
                     case CONFIG_REMOVED:
                         setupConnectivity(true);
                         break;
-
                     default:
                         break;
                 }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java b/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
index f2bfa9d..817c49e 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
@@ -35,11 +35,11 @@
 import org.onosproject.net.config.NetworkConfigEvent;
 import org.onosproject.net.config.NetworkConfigListener;
 import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.host.HostService;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 import org.slf4j.Logger;
 
-import java.util.Collection;
 import java.util.Set;
 
 import static org.slf4j.LoggerFactory.getLogger;
@@ -59,13 +59,16 @@
     protected CoreService coreService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected InterfaceService interfaceService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected NeighbourResolutionService neighbourService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected VplsConfigurationService vplsConfigService;
+    protected VplsConfigService vplsConfigService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected NetworkConfigService configService;
@@ -144,14 +147,11 @@
      * @param context the message context
      */
     protected void handleRequest(NeighbourMessageContext context) {
-
-        SetMultimap<String, Interface> vpls =
+        SetMultimap<String, Interface> interfaces =
                 vplsConfigService.ifacesByVplsName(context.vlan(),
-                                                             context.inPort());
-
-        if (vpls != null) {
-            Collection<Interface> vplsInterfaces = vpls.values();
-            vplsInterfaces.stream()
+                                                   context.inPort());
+        if (interfaces != null) {
+            interfaces.values().stream()
                     .filter(intf -> !context.inPort().equals(intf.connectPoint()))
                     .forEach(context::forward);
 
@@ -168,15 +168,12 @@
      */
     protected void handleReply(NeighbourMessageContext context,
                                HostService hostService) {
-
-        SetMultimap<String, Interface> vpls =
-                vplsConfigService.ifacesByVplsName(context.vlan(),
-                                                             context.inPort());
-
         Set<Host> hosts = hostService.getHostsByMac(context.dstMac());
-        if (vpls != null) {
-            Collection<Interface> vplsInterfaces = vpls.values();
-            hosts.forEach(host -> vplsInterfaces.stream()
+        SetMultimap<String, Interface> interfaces =
+                vplsConfigService.ifacesByVplsName(context.vlan(),
+                                                   context.inPort());
+        if (interfaces != null) {
+            hosts.forEach(host -> interfaces.values().stream()
                     .filter(intf -> intf.connectPoint().equals(host.location()))
                     .filter(intf -> intf.vlan().equals(host.vlan()))
                     .forEach(context::forward));
@@ -206,5 +203,4 @@
             configNeighbourHandler();
         }
     }
-
-}
+}
\ No newline at end of file
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java
index b2c1da5..b14d8f5 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java
@@ -19,7 +19,7 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.HashSet;
 
@@ -29,8 +29,8 @@
 @Command(scope = "onos", name = "vpls-add", description = "Creates a new VPLS")
 public class VplsAddCommand extends AbstractShellCommand {
 
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = true, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java
index d6a50ff..c02b7e6 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java
@@ -19,7 +19,7 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to add an interface to a VPLS.
@@ -28,8 +28,8 @@
         description = "Adds an interface to an existing VPLS")
 public class VplsAddIfaceCommand extends AbstractShellCommand {
 
-    private static VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private static VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = true, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java
index 4156e08..dcae5ee 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java
@@ -18,7 +18,7 @@
 
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to clean the VPLS app configuration.
@@ -26,8 +26,8 @@
 @Command(scope = "onos", name = "vpls-clean",
         description = "Cleans the VPLS app configuration")
 public class VplsCleanCommand extends AbstractShellCommand {
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Override
     protected void execute() {
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCommandUtils.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCommandUtils.java
index e37a34d..2a239b9 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCommandUtils.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCommandUtils.java
@@ -19,7 +19,7 @@
 import com.google.common.collect.Sets;
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.Map;
 import java.util.Optional;
@@ -43,8 +43,8 @@
     protected static final String IFACE_NOT_ASSOCIATED =
             "Interface %s is associated to VPLS %s.";
 
-    private static VplsConfigurationService vplsConfigService =
-            getService(VplsConfigurationService.class);
+    private static VplsConfigService vplsConfigService =
+            getService(VplsConfigService.class);
     private static InterfaceService interfaceService =
             getService(InterfaceService.class);
 
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java
index 23e77ee..160e17d 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java
@@ -19,7 +19,7 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to remove VPLSs.
@@ -28,8 +28,8 @@
         description = "Deletes an existing VPLS")
 public class VplsDelCommand extends AbstractShellCommand {
 
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = true, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java
index adf9ce9..296e402 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java
@@ -19,7 +19,7 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to remove an interface from an existing VPLS.
@@ -28,8 +28,8 @@
         description = "Removes an interface from an existing VPLS")
 public class VplsDelIfaceCommand extends AbstractShellCommand {
 
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = true, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java
index aca247c..ba9ca5b 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java
@@ -18,15 +18,15 @@
 
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to list VPLSs.
  */
 @Command(scope = "onos", name = "vpls-list", description = "List the VPLSs configured")
 public class VplsListCommand extends AbstractShellCommand {
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Override
     protected void execute() {
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsSetEncapCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsSetEncapCommand.java
index ba46ea7..9f06155 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsSetEncapCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsSetEncapCommand.java
@@ -19,7 +19,7 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 /**
  * CLI to set encapsulation for a VPLS.
@@ -30,8 +30,8 @@
 public class VplsSetEncapCommand extends AbstractShellCommand {
 
     private static final String VPLS_NOT_FOUND = "VPLS %s not found.";
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = true, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java
index 9dbeed6..fbd54b5 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java
@@ -20,7 +20,7 @@
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.EncapsulationType;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.Map;
 import java.util.Set;
@@ -34,8 +34,8 @@
         description = "Shows the details of an existing VPLS")
 public class VplsShowCommand extends AbstractShellCommand {
 
-    private VplsConfigurationService vplsConfigService =
-            get(VplsConfigurationService.class);
+    private VplsConfigService vplsConfigService =
+            get(VplsConfigService.class);
 
     @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
             required = false, multiValued = false)
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCommandCompleter.java
index a1cdfbb..9591772 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCommandCompleter.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCommandCompleter.java
@@ -18,7 +18,7 @@
 
 import com.google.common.collect.Lists;
 import org.onosproject.cli.AbstractChoicesCompleter;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.List;
 import static org.onosproject.cli.AbstractShellCommand.get;
@@ -29,8 +29,8 @@
 public class VplsAddIfaceCommandCompleter extends AbstractChoicesCompleter {
     @Override
     protected List<String> choices() {
-        VplsConfigurationService vplsConfigService =
-                get(VplsConfigurationService.class);
+        VplsConfigService vplsConfigService =
+                get(VplsConfigService.class);
 
         return Lists.newArrayList(vplsConfigService.vplsNames());
     }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java
index d360b2a..96ac364 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java
@@ -18,7 +18,7 @@
 
 import com.google.common.collect.Lists;
 import org.onosproject.cli.AbstractChoicesCompleter;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.List;
 
@@ -31,8 +31,8 @@
 
     @Override
     protected List<String> choices() {
-        VplsConfigurationService vplsConfigService =
-                get(VplsConfigurationService.class);
+        VplsConfigService vplsConfigService =
+                get(VplsConfigService.class);
         return Lists.newArrayList(vplsConfigService.vplsNames());
     }
 }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java
index 794ccfc..ddaf359 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java
@@ -18,7 +18,7 @@
 
 import org.onosproject.cli.AbstractChoicesCompleter;
 import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.List;
 import java.util.Set;
@@ -33,8 +33,8 @@
 
     @Override
     protected List<String> choices() {
-        VplsConfigurationService vplsConfigService =
-                get(VplsConfigurationService.class);
+        VplsConfigService vplsConfigService =
+                get(VplsConfigService.class);
         Set<Interface> ifaces = vplsConfigService.allIfaces();
         return ifaces.stream().map(Interface::name).collect(Collectors.toList());
     }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsSetEncapCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsSetEncapCommandCompleter.java
index 409d2a7..8ae7df2 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsSetEncapCommandCompleter.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsSetEncapCommandCompleter.java
@@ -18,7 +18,7 @@
 
 import com.google.common.collect.Lists;
 import org.onosproject.cli.AbstractChoicesCompleter;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.List;
 
@@ -30,8 +30,8 @@
 public class VplsSetEncapCommandCompleter extends AbstractChoicesCompleter {
     @Override
     protected List<String> choices() {
-        VplsConfigurationService vplsConfigService =
-                get(VplsConfigurationService.class);
+        VplsConfigService vplsConfigService =
+                get(VplsConfigService.class);
 
         return Lists.newArrayList(vplsConfigService.vplsNames());
     }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java
index 0f572ea..397d5c9 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java
@@ -18,7 +18,7 @@
 
 import com.google.common.collect.Lists;
 import org.onosproject.cli.AbstractChoicesCompleter;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.List;
 
@@ -31,8 +31,8 @@
 
     @Override
     protected List<String> choices() {
-        VplsConfigurationService vplsConfigService =
-                get(VplsConfigurationService.class);
+        VplsConfigService vplsConfigService =
+                get(VplsConfigService.class);
         return Lists.newArrayList(vplsConfigService.vplsNames());
     }
 }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsAppConfig.java b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsAppConfig.java
index 398962e..66f7882 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsAppConfig.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsAppConfig.java
@@ -23,8 +23,6 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.EncapsulationType;
 import org.onosproject.net.config.Config;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.Set;
 
@@ -37,8 +35,6 @@
     private static final String INTERFACE = "interfaces";
     private static final String ENCAPSULATION = "encapsulation";
 
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
     /**
      * Returns a set of configured VPLSs.
      *
@@ -57,17 +53,19 @@
             String name = jsonNode.get(NAME).asText();
 
             Set<String> ifaces = Sets.newHashSet();
-            jsonNode.path(INTERFACE).forEach(ifacesNode ->
-                    ifaces.add(ifacesNode.asText())
-            );
+            JsonNode vplsIfaces = jsonNode.path(INTERFACE);
+            if (vplsIfaces.toString().isEmpty()) {
+                vplsIfaces = ((ObjectNode) jsonNode).putArray(INTERFACE);
+            }
+            vplsIfaces.forEach(ifacesNode -> ifaces.add(ifacesNode.asText()));
 
             String encap = null;
             if (jsonNode.hasNonNull(ENCAPSULATION)) {
                 encap = jsonNode.get(ENCAPSULATION).asText();
             }
             vplss.add(new VplsConfig(name,
-                                    ifaces,
-                                    EncapsulationType.enumFromString(encap)));
+                                     ifaces,
+                                     EncapsulationType.enumFromString(encap)));
         });
 
         return vplss;
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfig.java b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfig.java
index 94e96ab..0d8c0c1 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfig.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfig.java
@@ -73,11 +73,10 @@
 
     /**
      * States if a given interface is part of a VPLS.
-     *
      * @param iface the interface attached to a VPLS
      * @return true if the interface is associated to the VPLS; false otherwise
      */
-    public boolean isAttached(String iface) {
+    protected boolean isAttached(String iface) {
         return ifaces.stream().anyMatch(iface::equals);
     }
 
@@ -89,8 +88,8 @@
         if (obj instanceof VplsConfig) {
             VplsConfig that = (VplsConfig) obj;
             return Objects.equals(name, that.name) &&
-                   Objects.equals(ifaces, that.ifaces) &&
-                   Objects.equals(encap, that.encap);
+                    Objects.equals(ifaces, that.ifaces) &&
+                    Objects.equals(encap, that.encap);
         }
         return false;
     }
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigurationService.java b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigService.java
similarity index 95%
rename from apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigurationService.java
rename to apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigService.java
index 6579378..7500a08 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigurationService.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/config/VplsConfigService.java
@@ -27,7 +27,7 @@
 /**
  * Provides information about the VPLS configuration.
  */
-public interface VplsConfigurationService {
+public interface VplsConfigService {
     Class<VplsAppConfig> CONFIG_CLASS = VplsAppConfig.class;
 
     /**
@@ -98,6 +98,13 @@
     Set<Interface> allIfaces();
 
     /**
+     * Retrieves the interfaces from the VPLS configuration.
+     *
+     * @return a set of interfaces belonging to the VPLS
+     */
+    Set<Interface> ifaces();
+
+    /**
      * Retrieves the interfaces belonging to the VPLS.
      *
      * @param vplsName the name of the VPLS
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigurationImpl.java b/apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigImpl.java
similarity index 94%
rename from apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigurationImpl.java
rename to apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigImpl.java
index 0c2f09b..658a27d 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigurationImpl.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/config/impl/VplsConfigImpl.java
@@ -42,7 +42,7 @@
 import org.onosproject.net.config.basics.SubjectFactories;
 import org.onosproject.vpls.config.VplsAppConfig;
 import org.onosproject.vpls.config.VplsConfig;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,7 +57,7 @@
  */
 @Component(immediate = true)
 @Service
-public class VplsConfigurationImpl implements VplsConfigurationService {
+public class VplsConfigImpl implements VplsConfigService {
     private static final String VPLS_APP = "org.onosproject.vpls";
     private static final String VPLS = "vpls";
     private static final String EMPTY = "";
@@ -90,6 +90,7 @@
     private SetMultimap<String, String> ifacesOfVpls = HashMultimap.create();
     private SetMultimap<String, String> oldIfacesOfVpls = HashMultimap.create();
     private SetMultimap<String, Interface> vplsIfaces = HashMultimap.create();
+
     private Map<String, EncapsulationType> vplsEncaps = Maps.newHashMap();
 
     private final InternalNetworkConfigListener configListener =
@@ -201,15 +202,20 @@
     public Set<String> vplsAffectedByApi() {
         Set<String> vplsNames = ImmutableSet.copyOf(vplsAffectedByApi);
         vplsAffectedByApi.clear();
-
         return vplsNames;
     }
 
     @Override
     public Set<Interface> allIfaces() {
         Set<Interface> allVplsInterfaces = new HashSet<>();
-        vplsIfaces.values().forEach(allVplsInterfaces::add);
+        interfaceService.getInterfaces().forEach(allVplsInterfaces::add);
+        return allVplsInterfaces;
+    }
 
+    @Override
+    public Set<Interface> ifaces() {
+        Set<Interface> allVplsInterfaces = new HashSet<>();
+        vplsIfaces.values().forEach(allVplsInterfaces::add);
         return allVplsInterfaces;
     }
 
@@ -217,7 +223,6 @@
     public Set<Interface> ifaces(String vplsName) {
         Set<Interface> vplsInterfaces = new HashSet<>();
         vplsIfaces.get(vplsName).forEach(vplsInterfaces::add);
-
         return vplsInterfaces;
     }
 
@@ -243,7 +248,7 @@
                 vplsIfaces.entries().stream()
                         .filter(e -> e.getValue().connectPoint().equals(connectPoint))
                         .filter(e -> e.getValue().vlan().equals(vlan))
-                        .map(e -> e.getKey())
+                        .map(Map.Entry::getKey)
                         .findFirst()
                         .orElse(null);
         SetMultimap<String, Interface> result = HashMultimap.create();
@@ -276,7 +281,7 @@
 
         oldIfacesOfVpls = ifacesOfVpls;
         ifacesOfVpls = getConfigInterfaces();
-        vplsIfaces = getConfigCPoints();
+        vplsIfaces = getConfigCPointsFromIfaces();
         vplsEncaps = getConfigEncap();
 
         log.debug(CONFIG_CHANGED, ifacesOfVpls);
@@ -310,7 +315,7 @@
         Map<String, EncapsulationType> configEncap = new HashMap<>();
 
         vplsAppConfig.vplss().forEach(vpls -> {
-                configEncap.put(vpls.name(), vpls.encap());
+            configEncap.put(vpls.name(), vpls.encap());
         });
 
         return configEncap;
@@ -341,7 +346,7 @@
      *
      * @return a map of VPLS names and related interfaces
      */
-    private SetMultimap<String, Interface> getConfigCPoints() {
+    private SetMultimap<String, Interface> getConfigCPointsFromIfaces() {
         log.debug(CHECK_CONFIG);
 
         SetMultimap<String, Interface> confCPointsByIntf =
@@ -364,7 +369,7 @@
     private class InternalNetworkConfigListener implements NetworkConfigListener {
         @Override
         public void event(NetworkConfigEvent event) {
-            if (event.configClass() == VplsConfigurationService.CONFIG_CLASS) {
+            if (event.configClass() == VplsConfigService.CONFIG_CLASS) {
                 log.debug(NET_CONF_EVENT, event.configClass());
                 switch (event.type()) {
                     case CONFIG_ADDED:
@@ -378,4 +383,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file
diff --git a/apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigurationServiceAdapter.java b/apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigServiceAdapter.java
similarity index 91%
rename from apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigurationServiceAdapter.java
rename to apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigServiceAdapter.java
index 4f7de35..c4269b1 100644
--- a/apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigurationServiceAdapter.java
+++ b/apps/vpls/src/test/java/org/onosproject/vpls/VplsConfigServiceAdapter.java
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onosproject.vpls;
 
 import com.google.common.collect.SetMultimap;
@@ -20,7 +21,7 @@
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.EncapsulationType;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import java.util.Map;
 import java.util.Set;
@@ -28,7 +29,7 @@
 /**
  * Test adapter for VPLS configuration service.
  */
-public class VplsConfigurationServiceAdapter implements VplsConfigurationService {
+public class VplsConfigServiceAdapter implements VplsConfigService {
     @Override
     public void addVpls(String vplsName, Set<String> ifaces, String encap) {}
 
@@ -63,6 +64,11 @@
     }
 
     @Override
+    public Set<Interface> ifaces() {
+        return null;
+    }
+
+    @Override
     public Set<Interface> ifaces(String vplsName) {
         return null;
     }
diff --git a/apps/vpls/src/test/java/org/onosproject/vpls/VplsNeighbourHandlerTest.java b/apps/vpls/src/test/java/org/onosproject/vpls/VplsNeighbourHandlerTest.java
index 66edd13..ab2b7f4 100644
--- a/apps/vpls/src/test/java/org/onosproject/vpls/VplsNeighbourHandlerTest.java
+++ b/apps/vpls/src/test/java/org/onosproject/vpls/VplsNeighbourHandlerTest.java
@@ -66,28 +66,38 @@
 
     private static final String IFACES_NOT_EXPECTED =
             "The interfaces reached by the packet are not equal to the " +
-                    "interfaces expected";
+                    "interfaces expected.";
 
     private static final DeviceId DID1 = getDeviceId(1);
     private static final DeviceId DID2 = getDeviceId(2);
     private static final DeviceId DID3 = getDeviceId(3);
     private static final DeviceId DID4 = getDeviceId(4);
+    private static final DeviceId DID5 = getDeviceId(5);
 
     private static final PortNumber P1 = PortNumber.portNumber(1);
     private static final PortNumber P2 = PortNumber.portNumber(2);
+    private static final PortNumber P3 = PortNumber.portNumber(3);
 
     private static final ConnectPoint OF1P1 = new ConnectPoint(DID1, P1);
     private static final ConnectPoint OF2P1 = new ConnectPoint(DID2, P1);
     private static final ConnectPoint OF3P1 = new ConnectPoint(DID3, P1);
     private static final ConnectPoint OF4P1 = new ConnectPoint(DID4, P1);
     private static final ConnectPoint OF4P2 = new ConnectPoint(DID4, P2);
+    private static final ConnectPoint OF4P3 = new ConnectPoint(DID4, P3);
+    private static final ConnectPoint OF5P1 = new ConnectPoint(DID5, P1);
+    private static final ConnectPoint OF5P2 = new ConnectPoint(DID5, P2);
+    private static final ConnectPoint OF5P3 = new ConnectPoint(DID5, P3);
 
     private static final String VPLS1 = "vpls1";
     private static final String VPLS2 = "vpls2";
+    private static final String VPLS3 = "vpls3";
+    private static final String VPLS4 = "vpls4";
 
     private static final VlanId VLAN100 = VlanId.vlanId("100");
     private static final VlanId VLAN200 = VlanId.vlanId("200");
     private static final VlanId VLAN300 = VlanId.vlanId("300");
+    private static final VlanId VLAN400 = VlanId.vlanId("400");
+    private static final VlanId VLAN_NONE = VlanId.NONE;
 
     private static final Interface V100H1 =
             new Interface("v100h1", OF1P1, null, null, VLAN100);
@@ -99,12 +109,24 @@
             new Interface("v200h2", OF2P1, null, null, VLAN200);
     private static final Interface V300H1 =
             new Interface("v300h1", OF3P1, null, null, VLAN300);
+    private static final Interface V400H1 =
+            new Interface("v400h1", OF5P1, null, null, VLAN400);
+    private static final Interface VNONEH1 =
+            new Interface("vNoneh1", OF5P2, null, null, VLAN_NONE);
+    private static final Interface VNONEH2 =
+            new Interface("vNoneh2", OF5P3, null, null, VLAN_NONE);
+    private static final Interface VNONEH3 =
+            new Interface("vNoneh3", OF4P3, null, null, VLAN_NONE);
 
     private static final MacAddress MAC1 = MacAddress.valueOf("00:00:00:00:00:01");
     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 MAC6 = MacAddress.valueOf("00:00:00:00:00:06");
+    private static final MacAddress MAC7 = MacAddress.valueOf("00:00:00:00:00:07");
+    private static final MacAddress MAC8 = MacAddress.valueOf("00:00:00:00:00:08");
+    private static final MacAddress MAC9 = MacAddress.valueOf("00:00:00:00:00:09");
 
     private static final ProviderId PID = new ProviderId("of", "foo");
 
@@ -113,24 +135,35 @@
     private final Host v200Host1 = makeHost(MAC3, VLAN200, OF4P2);
     private final Host v200Host2 = makeHost(MAC5, VLAN200, OF2P1);
     private final Host v300Host1 = makeHost(MAC4, VLAN300, OF3P1);
+    private final Host v400Host1 = makeHost(MAC6, VLAN400, OF5P1);
+    private final Host vNoneHost1 = makeHost(MAC7, VLAN_NONE, OF5P2);
+    private final Host vNoneHost2 = makeHost(MAC8, VLAN_NONE, OF5P3);
+    private final Host vNoneHost3 = makeHost(MAC9, VLAN_NONE, OF4P3);
 
     private final Set<Host> availableHosts = ImmutableSet.of(v100Host1,
                                                              v100Host2,
                                                              v200Host1,
                                                              v300Host1,
-                                                             v200Host2);
+                                                             v200Host2,
+                                                             v400Host1,
+                                                             vNoneHost1,
+                                                             vNoneHost2,
+                                                             vNoneHost3);
 
     private final Set<Interface> availableInterfaces =
-            ImmutableSet.of(V100H1, V100H2, V200H1, V200H2, V300H1);
+            ImmutableSet.of(V100H1, V100H2, V200H1, V200H2, V300H1,
+                            V400H1, VNONEH1, VNONEH2, VNONEH3);
 
     private VplsNeighbourHandler vplsNeighbourHandler;
 
     private HostService hostService;
 
     /**
-     * Sets up 2 VPLS.
+     * Sets up 4 VPLS.
      * VPLS 1 contains 3 hosts: v100h1, v200h1 and v300h1
      * VPLS 2 contains 2 hosts: v100h2, v200h2
+     * VPLS 3 contains 2 hosts: vNoneh1, vNoneh2
+     * VPLS 4 contains 2 hosts: v400h1, vNoneh3
      */
     @Before
     public void setUp() {
@@ -142,6 +175,10 @@
         ifacesByVpls.put(VPLS1, V300H1);
         ifacesByVpls.put(VPLS2, V100H2);
         ifacesByVpls.put(VPLS2, V200H2);
+        ifacesByVpls.put(VPLS3, VNONEH1);
+        ifacesByVpls.put(VPLS3, VNONEH2);
+        ifacesByVpls.put(VPLS4, V400H1);
+        ifacesByVpls.put(VPLS4, VNONEH3);
         HashMap<String, EncapsulationType> encap = Maps.newHashMap();
         vplsNeighbourHandler.vplsConfigService =
                 new TestVplsConfigService(ifacesByVpls, encap);
@@ -149,13 +186,11 @@
                 new TestInterfaceService();
         vplsNeighbourHandler.neighbourService =
                 new TestNeighbourService();
-
         hostService = new TestHostService();
     }
 
     @After
     public void tearDown() {
-
     }
 
     /**
@@ -205,6 +240,50 @@
     }
 
     /**
+     * Tests correct connection between untagged interfaces.
+     *
+     * Sends request messages to all hosts in VPLS 3.
+     * Request messages should be received from other hosts in VPLS 3.
+     */
+    @Test
+    public void vpls3RequestMessage() {
+        // Request messages from vNoneHost1 (VPLS 3) should be received by vNoneHost2
+        TestMessageContext requestMessage =
+                makeBroadcastRequestContext(vNoneHost1);
+        Set<Interface> expectInterfaces = ImmutableSet.of(VNONEH2);
+        vplsNeighbourHandler.handleRequest(requestMessage);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, requestMessage.forwardResults);
+
+        // Request messages from vNoneh2 (VPLS 3) should be received by vNoneh1
+        requestMessage = makeBroadcastRequestContext(vNoneHost2);
+        expectInterfaces = ImmutableSet.of(VNONEH1);
+        vplsNeighbourHandler.handleRequest(requestMessage);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, requestMessage.forwardResults);
+    }
+
+    /**
+     * Tests correct connection between tagged and untagged interfaces.
+     *
+     * Sends request messages to all hosts in VPLS 4.
+     * Request messages should be received from other hosts in VPLS 4.
+     */
+    @Test
+    public void vpls4RequestMessage() {
+        // Request messages from v400Host1 (VPLS 4) should be received by vNoneHost3
+        TestMessageContext requestMessage =
+                makeBroadcastRequestContext(v400Host1);
+        Set<Interface> expectInterfaces = ImmutableSet.of(VNONEH3);
+        vplsNeighbourHandler.handleRequest(requestMessage);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, requestMessage.forwardResults);
+
+        // Request messages from vNoneHost3 (VPLS 4) should be received by v400Host1
+        requestMessage = makeBroadcastRequestContext(vNoneHost3);
+        expectInterfaces = ImmutableSet.of(V400H1);
+        vplsNeighbourHandler.handleRequest(requestMessage);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, requestMessage.forwardResults);
+    }
+
+    /**
      * Sends reply messages to hosts in VPLS 1.
      * Reply messages should be received by the host with MAC address equal to
      * the dstMac of the message context.
@@ -253,6 +332,48 @@
     }
 
     /**
+     * Sends reply messages to hosts in VPLS 3.
+     * Reply messages should be received by the host with MAC address equal to
+     * the dstMac of the message context.
+     */
+    @Test
+    public void vpls3ReplyMessage() {
+        // Reply messages from vNoneh1 (VPLS 3) should be received by vNoneh2
+        TestMessageContext replyMessage =
+                makeReplyContext(vNoneHost1, vNoneHost2);
+        Set<Interface> expectInterfaces = ImmutableSet.of(VNONEH2);
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+
+        // Reply messages from vNoneh2 (VPLS 3) should be received by vNoneh1
+        replyMessage = makeReplyContext(vNoneHost2, vNoneHost1);
+        expectInterfaces = ImmutableSet.of(VNONEH1);
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+    }
+
+    /**
+     * Sends reply messages to hosts in VPLS 4.
+     * Reply messages should be received by the host with MAC address equal to
+     * the dstMac of the message context.
+     */
+    @Test
+    public void vpls4ReplyMessage() {
+        // Reply messages from v400h1 (VPLS 4) should be received by vNoneh3
+        TestMessageContext replyMessage =
+                makeReplyContext(v400Host1, vNoneHost3);
+        Set<Interface> expectInterfaces = ImmutableSet.of(VNONEH3);
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+
+        // Reply messages from vNoneh3 (VPLS 4) should be received by v400h1
+        replyMessage = makeReplyContext(vNoneHost3, v400Host1);
+        expectInterfaces = ImmutableSet.of(V400H1);
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+    }
+
+    /**
      * Sends wrong reply messages to hosts.
      * The source and the destination MAC addresses are not set on any host of the VPLS.
      * The reply messages will not be received by any hosts.
@@ -272,6 +393,20 @@
         expectInterfaces = ImmutableSet.of();
         vplsNeighbourHandler.handleReply(replyMessage, hostService);
         assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+
+        // Reply message from vNoneh1 (VPLS 3) to v400h1 (VPLS 4).
+        // Forward results should be empty
+        replyMessage = makeReplyContext(vNoneHost1, v400Host1);
+        expectInterfaces = ImmutableSet.of();
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
+
+        // Reply message from vNoneh3 (VPLS 4) to vNoneH2 (VPLS 3).
+        // Forward results should be empty
+        replyMessage = makeReplyContext(vNoneHost3, vNoneHost2);
+        expectInterfaces = ImmutableSet.of();
+        vplsNeighbourHandler.handleReply(replyMessage, hostService);
+        assertEquals(IFACES_NOT_EXPECTED, expectInterfaces, replyMessage.forwardResults);
     }
 
     /**
@@ -343,7 +478,6 @@
             this.type = type;
 
             this.forwardResults = Sets.newHashSet();
-
         }
 
         @Override
@@ -383,7 +517,6 @@
 
         @Override
         public void forward(ConnectPoint outPort) {
-
         }
 
         @Override
@@ -393,17 +526,14 @@
 
         @Override
         public void reply(MacAddress targetMac) {
-
         }
 
         @Override
         public void flood() {
-
         }
 
         @Override
         public void drop() {
-
         }
 
         @Override
@@ -417,7 +547,7 @@
         }
     }
 
-    private class TestVplsConfigService extends VplsConfigurationServiceAdapter {
+    private class TestVplsConfigService extends VplsConfigServiceAdapter {
 
         private final SetMultimap<String, Interface> ifacesByVplsName;
 
@@ -463,7 +593,6 @@
                     toBeRemoved.put(e.getKey(), e.getValue());
                 }
             });
-
             toBeRemoved.entries()
                     .forEach(e -> ifacesByVplsName.remove(e.getKey(),
                                                           e.getValue()));
@@ -503,7 +632,7 @@
                     ifacesByVplsName.entries().stream()
                             .filter(e -> e.getValue().connectPoint().equals(connectPoint))
                             .filter(e -> e.getValue().vlan().equals(vlan))
-                            .map(e -> e.getKey())
+                            .map(Map.Entry::getKey)
                             .findFirst()
                             .orElse(null);
             SetMultimap<String, Interface> result = HashMultimap.create();
@@ -637,7 +766,6 @@
             public ApplicationId appId() {
                 return appId;
             }
-
         }
     }
 
@@ -645,12 +773,10 @@
 
         @Override
         public void addListener(InterfaceListener listener) {
-
         }
 
         @Override
         public void removeListener(InterfaceListener listener) {
-
         }
 
         @Override
@@ -665,7 +791,6 @@
                     .filter(intf -> intf.name().equals(name))
                     .findFirst()
                     .orElse(null);
-
         }
 
         @Override
diff --git a/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java b/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
index a7585da..bc1c3f2 100644
--- a/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
+++ b/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.vpls;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -76,7 +77,7 @@
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.routing.IntentSynchronizationAdminService;
 import org.onosproject.routing.IntentSynchronizationService;
-import org.onosproject.vpls.config.VplsConfigurationService;
+import org.onosproject.vpls.config.VplsConfigService;
 
 import static java.lang.String.format;
 import static org.easymock.EasyMock.anyObject;
@@ -101,8 +102,11 @@
     private static final int PRIORITY_OFFSET = 1000;
     private static final String VPLS1 = "vpls1";
     private static final String VPLS2 = "vpls2";
+    private static final String VPLS3 = "vpls3";
+    private static final String VPLS4 = "vpls4";
 
     private static final PortNumber P1 = PortNumber.portNumber(1);
+    private static final PortNumber P2 = PortNumber.portNumber(2);
 
     private static final DeviceId DID1 = getDeviceId(1);
     private static final DeviceId DID2 = getDeviceId(2);
@@ -117,25 +121,28 @@
     private static final ConnectPoint CP4 = new ConnectPoint(DID4, P1);
     private static final ConnectPoint CP5 = new ConnectPoint(DID5, P1);
     private static final ConnectPoint CP6 = new ConnectPoint(DID6, P1);
+    private static final ConnectPoint CP7 = new ConnectPoint(DID4, P2);
+    private static final ConnectPoint CP8 = new ConnectPoint(DID3, P2);
+    private static final ConnectPoint CP9 = new ConnectPoint(DID5, P1);
+    private static final ConnectPoint CP10 = new ConnectPoint(DID5, P2);
 
     private static final VlanId VLAN100 = VlanId.vlanId((short) 100);
     private static final VlanId VLAN200 = VlanId.vlanId((short) 200);
     private static final VlanId VLAN300 = VlanId.vlanId((short) 300);
+    private static final VlanId VLAN400 = VlanId.vlanId((short) 400);
+    private static final VlanId VLAN_NONE = VlanId.NONE;
 
-    private static final MacAddress MAC1 =
-            MacAddress.valueOf("00:00:00:00:00:01");
-    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 MAC6 =
-            MacAddress.valueOf("00:00:00:00:00:06");
-    private static final MacAddress MAC7 =
-            MacAddress.valueOf("00:00:00:00:00:07");
+    private static final MacAddress MAC1 = getMac(1);
+    private static final MacAddress MAC2 = getMac(2);
+    private static final MacAddress MAC3 = getMac(3);
+    private static final MacAddress MAC4 = getMac(4);
+    private static final MacAddress MAC5 = getMac(5);
+    private static final MacAddress MAC6 = getMac(6);
+    private static final MacAddress MAC7 = getMac(7);
+    private static final MacAddress MAC8 = getMac(8);
+    private static final MacAddress MAC9 = getMac(9);
+    private static final MacAddress MAC10 = getMac(10);
+    private static final MacAddress MAC11 = getMac(11);
 
     private static final Ip4Address IP1 = Ip4Address.valueOf("192.168.1.1");
     private static final Ip4Address IP2 = Ip4Address.valueOf("192.168.1.2");
@@ -147,6 +154,10 @@
     private static final HostId HID5 = HostId.hostId(MAC5, VLAN300);
     private static final HostId HID6 = HostId.hostId(MAC6, VLAN300);
     private static final HostId HID7 = HostId.hostId(MAC7, VLAN300);
+    private static final HostId HID8 = HostId.hostId(MAC8, VLAN400);
+    private static final HostId HID9 = HostId.hostId(MAC9);
+    private static final HostId HID10 = HostId.hostId(MAC10);
+    private static final HostId HID11 = HostId.hostId(MAC11);
 
     private static final ProviderId PID = new ProviderId("of", "foo");
 
@@ -164,35 +175,62 @@
             new Interface("v300h1", CP5, null, null, VLAN300);
     private static final Interface V300H2 =
             new Interface("v300h2", CP6, null, null, VLAN300);
+    private static final Interface V400H1 =
+            new Interface("v400h1", CP7, null, null, VLAN400);
+
+    private static final Interface VNONEH1 =
+            new Interface("vNoneh1", CP8, null, null, VLAN_NONE);
+    private static final Interface VNONEH2 =
+            new Interface("vNoneh2", CP9, null, null, VLAN_NONE);
+    private static final Interface VNONEH3 =
+            new Interface("vNoneh3", CP10, null, null, VLAN_NONE);
 
     private static final Host V100HOST1 =
             new DefaultHost(PID, HID1, MAC1, VLAN100,
-                    getLocation(1), Collections.singleton(IP1));
+                            getLocation(1), Collections.singleton(IP1));
     private static final Host V100HOST2 =
             new DefaultHost(PID, HID2, MAC2, VLAN100,
-                    getLocation(2), Sets.newHashSet());
+                            getLocation(2), Sets.newHashSet());
     private static final Host V200HOST1 =
             new DefaultHost(PID, HID3, MAC3, VLAN200,
-                    getLocation(3), Collections.singleton(IP2));
+                            getLocation(3), Collections.singleton(IP2));
     private static final Host V200HOST2 =
             new DefaultHost(PID, HID4, MAC4, VLAN200,
-                    getLocation(4), Sets.newHashSet());
+                            getLocation(4), Sets.newHashSet());
     private static final Host V300HOST1 =
             new DefaultHost(PID, HID5, MAC5, VLAN300,
-                    getLocation(5), Sets.newHashSet());
+                            getLocation(5), Sets.newHashSet());
     private static final Host V300HOST2 =
             new DefaultHost(PID, HID6, MAC6, VLAN300,
-                    getLocation(6), Sets.newHashSet());
+                            getLocation(6), Sets.newHashSet());
     private static final Host V300HOST3 =
             new DefaultHost(PID, HID7, MAC7, VLAN300,
-                    getLocation(7), Sets.newHashSet());
+                            getLocation(7), Sets.newHashSet());
+    private static final Host V400HOST1 =
+            new DefaultHost(PID, HID8, MAC8, VLAN400,
+                            getLocation(4, 2), Sets.newHashSet());
 
-    private static final Set<Interface> AVALIABLE_INTERFACES =
-            ImmutableSet.of(V100H1, V100H2, V200H1, V200H2, V300H1, V300H2);
+    private static final Host VNONEHOST1 =
+            new DefaultHost(PID, HID9, MAC9, VlanId.NONE,
+                            getLocation(3, 2), Sets.newHashSet());
+    private static final Host VNONEHOST2 =
+            new DefaultHost(PID, HID10, MAC10, VlanId.NONE,
+                            getLocation(5, 1), Sets.newHashSet());
+    private static final Host VNONEHOST3 =
+            new DefaultHost(PID, HID11, MAC11, VlanId.NONE,
+                            getLocation(5, 2), Sets.newHashSet());
 
-    private static final Set<Host> AVALIABLE_HOSTS =
+    private static final Set<Interface> AVAILABLE_INTERFACES =
+            ImmutableSet.of(V100H1, V100H2, V200H1, V200H2, V300H1, V300H2,
+                            V400H1, VNONEH1, VNONEH2);
+
+    private static final Set<Host> AVAILABLE_HOSTS =
             ImmutableSet.of(V100HOST1, V100HOST2, V200HOST1,
-                            V200HOST2, V300HOST1, V300HOST2, V300HOST3);
+                            V200HOST2, V300HOST1, V300HOST2, V300HOST3,
+                            VNONEHOST1, VNONEHOST2,
+                            V400HOST1, VNONEHOST3);
+
+    private SetMultimap<String, Interface> interfacesByVpls = HashMultimap.create();
 
     private ApplicationService applicationService;
     private CoreService coreService;
@@ -202,7 +240,7 @@
     private HostService hostService;
     private IntentService intentService;
     private InterfaceService interfaceService;
-    private VplsConfigurationService vplsConfigService;
+    private VplsConfigService vplsConfigService;
     private Vpls vpls;
 
     @Before
@@ -232,18 +270,22 @@
         expectLastCall().anyTimes();
         addIfaceConfig();
 
-        SetMultimap<String, Interface> interfacesByVpls =
-                HashMultimap.create();
         interfacesByVpls.put(VPLS1, V100H1);
         interfacesByVpls.put(VPLS1, V200H1);
         interfacesByVpls.put(VPLS1, V300H1);
         interfacesByVpls.put(VPLS2, V100H2);
         interfacesByVpls.put(VPLS2, V200H2);
         interfacesByVpls.put(VPLS2, V300H2);
+        interfacesByVpls.put(VPLS3, VNONEH1);
+        interfacesByVpls.put(VPLS3, VNONEH2);
+        interfacesByVpls.put(VPLS4, V400H1);
+        interfacesByVpls.put(VPLS4, VNONEH3);
 
         Map<String, EncapsulationType> encapByVpls = new HashMap<>();
         encapByVpls.put(VPLS1, VLAN);
         encapByVpls.put(VPLS2, NONE);
+        encapByVpls.put(VPLS3, NONE);
+        encapByVpls.put(VPLS4, NONE);
 
         vplsConfigService = new TestVplsConfigService(interfacesByVpls, encapByVpls);
 
@@ -265,18 +307,22 @@
     }
 
     /**
-     * Creates the interface configuration. On devices 1 and 2 is configured
-     * an interface on port 1 with vlan 100. On devices 3 and 4 is configured
-     * an interface on port 1 with vlan 200. On device 5 and 6 is configured
-     * an interface on port 1 with vlan 300.
+     * Creates the interface configuration:
+     *  On devices 1 and 2 is configured an interface on port 1 with vlan 100.
+     *  On device 3 is configured an interface on port 3 with no vlan.
+     *  On devices 3 and 4 is configured an interface on port 1 with vlan 200.
+     *  On device 4 is an interface configured on port 2 with vlan 400.
+     *  On device 5 are configured two interfaces on port 1 and 2 with no vlan.
+     *  On device 5 and 6 is configured an interface on port 1 with vlan 300.
      */
     private void addIfaceConfig() {
-        Set<Interface> interfaces = ImmutableSet.copyOf(AVALIABLE_INTERFACES);
+        Set<Interface> interfaces = ImmutableSet.copyOf(AVAILABLE_INTERFACES);
         Set<Interface> vlanOneSet = ImmutableSet.of(V100H1, V100H2);
         Set<Interface> vlanTwoSet = ImmutableSet.of(V200H1, V200H2);
-        Set<Interface> vlanThreeSet = ImmutableSet.of(V300H1, V300H2);
+        Set<Interface> vlanThreeSet = ImmutableSet.of(VNONEH1, VNONEH2);
+        Set<Interface> vlanFourSet = ImmutableSet.of(V400H1, VNONEH3);
 
-        AVALIABLE_INTERFACES.forEach(intf -> {
+        AVAILABLE_INTERFACES.forEach(intf -> {
             expect(interfaceService.getInterfacesByPort(intf.connectPoint()))
                     .andReturn(Sets.newHashSet(intf)).anyTimes();
         });
@@ -286,18 +332,27 @@
                 .andReturn(vlanTwoSet).anyTimes();
         expect(interfaceService.getInterfacesByVlan(VLAN300))
                 .andReturn(vlanThreeSet).anyTimes();
+        expect(interfaceService.getInterfacesByVlan(VLAN400))
+                .andReturn(vlanFourSet).anyTimes();
+        expect(interfaceService.getInterfacesByVlan(VlanId.NONE))
+                .andReturn(vlanFourSet).anyTimes();
         expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
 
         replay(interfaceService);
     }
 
     /**
-     * Six ports are configured with VLANs but no hosts are registered by the
-     * HostService. The first three ports have an interface configured on VPLS 1,
-     * the other three on VPLS 2. The number of intents expected is six: three for
-     * VPLS 1, three for VPLS 2. Six MP2SP intents. Checks if the number of intents
-     * submitted to the intent framework is equal to the number of intents
-     * expected and if all intents are equivalent.
+     * Seven ports are configured with VLANs, while three ports are not. No hosts are
+     * registered by the HostService.
+     *
+     * The first three ports have an interface configured on VPLS 1,
+     * the other three on VPLS 2. Two ports are defined for VPLS 3, while
+     * the two remaining ports are configured on VPLS 4.
+     *
+     * The number of intents expected is 10: three for VPLS 1, three for VPLS 2,
+     * two for VPLS 3, two for VPLS 4. Eight MP2SP intents.
+     * Checks if the number of intents submitted to the intent framework is
+     * equal to the number of intents expected and if all intents are equivalent.
      */
     @Test
     public void activateNoHosts() {
@@ -312,22 +367,33 @@
         fcPoints = buildFCPoints(ImmutableSet.of(V100H2, V200H2, V300H2));
         expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS2, NONE));
 
+        fcPoints = buildFCPoints(ImmutableSet.of(VNONEH1, VNONEH2));
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS3, NONE));
+
+        fcPoints = buildFCPoints(ImmutableSet.of(V400H1, VNONEH3));
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS4, NONE));
+
         checkIntents(expectedIntents);
     }
 
     /**
-     * Six ports are configured with VLANs and six hosts are registered by the
-     * HostService. The first three ports have an interface configured on VPLS 1,
-     * the other three on VPLS 2. The number of intents expected is twelve: six
-     * for VLAN 1, six for VPLS 2. six sp2mp intents, six mp2sp intents. For VPLS 1
+     * Ten ports are configured with VLANs and ten hosts are registered by the
+     * HostService.
+     *
+     * The first three ports have an interface configured on VPLS 1,
+     * the other three on VPLS 2, two on VPLS3 and two on VPLS4.
+     *
+     * The number of intents expected is twenty: six
+     * for VPLS 1, six for VPLS 2. four for VPLS 3, four for VPLS 4.
+     * That is ten sp2mp intents, ten mp2sp intents. For VPLS 1
      * IPs are added to demonstrate this doesn't influence the number of intents
      * created. Checks if the number of intents submitted to the intent
      * framework is equal to the number of intents expected and if all intents
      * are equivalent.
      */
     @Test
-    public void sixInterfacesConfiguredHostsPresent() {
-        hostsAvailable.addAll(AVALIABLE_HOSTS);
+    public void tenInterfacesConfiguredHostsPresent() {
+        hostsAvailable.addAll(AVAILABLE_HOSTS);
 
         vpls.activate();
 
@@ -345,19 +411,35 @@
         expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS2, NONE));
         expectedIntents.addAll(generateVplsUni(fcPoints, hosts, VPLS2, NONE));
 
+        fcPoints = buildFCPoints(ImmutableSet.of(VNONEH1, VNONEH2));
+        hosts = ImmutableSet.of(VNONEHOST1, VNONEHOST2);
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS3, NONE));
+        expectedIntents.addAll(generateVplsUni(fcPoints, hosts, VPLS3, NONE));
+
+        fcPoints = buildFCPoints(ImmutableSet.of(V400H1, VNONEH3));
+        hosts = ImmutableSet.of(V400HOST1, VNONEHOST3);
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS4, NONE));
+        expectedIntents.addAll(generateVplsUni(fcPoints, hosts, VPLS4, NONE));
+
         checkIntents(expectedIntents);
     }
 
     /**
-     * Six ports are configured with VLANs and initially no hosts are registered
-     * by the HostService. The first three ports have an interface configured on
-     * VPLS 1, the other three have an interface configured on VPLS 2. When the
+     * Ten ports are configured; seven have VLANs and three do not.
+     * Initially, no hosts are registered by the HostService.
+     *
+     * The first three ports have an interface configured on
+     * VPLS 1, three have an interface configured on VPLS 2, two have an
+     * interface configured on VPLS 3 and two have an interface configured
+     * on VPLS 4, three have an interface configure. When the
      * module starts up, three hosts attached to device one, two and three -
      * port 1, are registered by the HostService and events are sent to the
      * application. sp2mp intents are created for all interfaces configured and
      * mp2sp intents are created only for the hosts attached.
-     * The number of intents expected is nine: six for VPLS 1, three for VPLS 2.
-     * Six sp2mp intents, three mp2sp intents. IPs are added on the first two
+     *
+     * The number of intents expected is seventeen: six for VPLS 1,
+     * three for VPLS 2, four for VPLS3 and four for VPLS4.
+     * Ten sp2mp intents, seven mp2sp intents. IPs are added on the first two
      * hosts only to demonstrate this doesn't influence the number of intents
      * created.
      * An additional host is added on device seven - port 1, to demonstrate that
@@ -367,17 +449,19 @@
      * to the number of intents expected and if all intents are equivalent.
      */
     @Test
-    public void sixInterfacesThreeHostEventsSameVpls() {
+    public void tenInterfacesThreeHostEventsSameVpls() {
         vpls.activate();
 
         List<Intent> expectedIntents = Lists.newArrayList();
         Set<FilteredConnectPoint> fcPoints;
         Set<Host> hosts;
 
-        hostsAvailable.addAll(Sets.newHashSet(V100HOST1, V200HOST1, V300HOST1, V300HOST3));
-
+        hostsAvailable.addAll(Sets.newHashSet(V100HOST1, V200HOST1,
+                                              V300HOST1, V300HOST3,
+                                              VNONEHOST1, VNONEHOST2,
+                                              V400HOST1, VNONEHOST3));
         hostsAvailable.forEach(host ->
-                hostListener.event(new HostEvent(HostEvent.Type.HOST_ADDED, host)));
+                                       hostListener.event(new HostEvent(HostEvent.Type.HOST_ADDED, host)));
 
         fcPoints = buildFCPoints(ImmutableSet.of(V100H1, V200H1, V300H1));
         hosts = ImmutableSet.of(V100HOST1, V200HOST1, V300HOST1);
@@ -387,6 +471,16 @@
         fcPoints = buildFCPoints(ImmutableSet.of(V100H2, V200H2, V300H2));
         expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS2, NONE));
 
+        fcPoints = buildFCPoints(ImmutableSet.of(VNONEH1, VNONEH2));
+        hosts = ImmutableSet.of(VNONEHOST1, VNONEHOST2);
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS3, NONE));
+        expectedIntents.addAll(generateVplsUni(fcPoints, hosts, VPLS3, NONE));
+
+        fcPoints = buildFCPoints(ImmutableSet.of(V400H1, VNONEH3));
+        hosts = ImmutableSet.of(V400HOST1, VNONEHOST3);
+        expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS4, NONE));
+        expectedIntents.addAll(generateVplsUni(fcPoints, hosts, VPLS4, NONE));
+
         checkIntents(expectedIntents);
     }
 
@@ -409,7 +503,7 @@
                             .collect(Collectors.toSet());
 
             Key brckey = buildKey(PREFIX_BROADCAST,
-                    point.connectPoint(), name, MacAddress.BROADCAST);
+                                  point.connectPoint(), name, MacAddress.BROADCAST);
 
             intents.add(buildBrcIntent(brckey, point, otherPoints, encap));
         });
@@ -440,7 +534,7 @@
                             .collect(Collectors.toSet());
 
             Key uniKey = buildKey(PREFIX_UNICAST,
-                    host.location(), name, host.mac());
+                                  host.location(), name, host.mac());
 
             intents.add(buildUniIntent(uniKey, otherPoints, hostPoint, host, encap));
         });
@@ -456,7 +550,7 @@
      */
     private void checkIntents(List<Intent> intents) {
         assertEquals("The number of intents submitted differs from the number" +
-                             "of intents expected",
+                             " of intents expected. ",
                      intents.size(), intentService.getIntentCount());
 
         for (Intent intentOne : intents) {
@@ -465,14 +559,14 @@
                 if (intentOne.key().equals(intentTwo.key())) {
                     found = true;
                     assertTrue(format("The intent submitted is different from" +
-                                              "the intent expected",
+                                              " the intent expected. %s %s",
                                       intentOne, intentTwo),
-                            IntentUtils.intentsAreEqual(intentOne, intentTwo));
+                               IntentUtils.intentsAreEqual(intentOne, intentTwo));
                     break;
                 }
             }
             assertTrue("The intent submitted is not equal to any of the expected" +
-                               "intents", found);
+                               " intents. ", found);
         }
     }
 
@@ -556,8 +650,7 @@
                     VlanIdCriterion vlanCriterion =
                             (VlanIdCriterion) fcp.trafficSelector().
                                     getCriterion(Criterion.Type.VLAN_VID);
-
-                    return vlanCriterion != null &&
+                    return vlanCriterion == null ||
                             vlanCriterion.vlanId().equals(host.vlan());
                 })
                 .findFirst()
@@ -565,25 +658,23 @@
     }
 
     /**
-     * Computes a set of filtered connect points from given interfaces.
+     * Computes a set of filtered connect points from a list of given interfaces.
      *
-     * @param interfaces the interfaces belonging to the VPLS
+     * @param interfaces the interfaces to compute
      * @return the set of filtered connect points
      */
-    private Set<FilteredConnectPoint> buildFCPoints(Set<Interface> interfaces) {
-        // Build all filtered connected point for the VPLS
+    private Set<FilteredConnectPoint> buildFCPoints(Collection<Interface> interfaces) {
+        // Build all filtered connected points in the VPLS
         return interfaces
                 .stream()
                 .map(intf -> {
                     TrafficSelector.Builder selectorBuilder =
                             DefaultTrafficSelector.builder();
-
                     if (!intf.vlan().equals(VlanId.NONE)) {
                         selectorBuilder.matchVlanId(intf.vlan());
                     }
-
                     return new FilteredConnectPoint(intf.connectPoint(),
-                            selectorBuilder.build());
+                                                    selectorBuilder.build());
                 })
                 .collect(Collectors.toSet());
     }
@@ -601,9 +692,9 @@
      * @return the key to identify the intent
      */
     private Key buildKey(String prefix,
-                           ConnectPoint cPoint,
-                           String vplsName,
-                           MacAddress hostMac) {
+                         ConnectPoint cPoint,
+                         String vplsName,
+                         MacAddress hostMac) {
         String keyString = vplsName +
                 DASH +
                 prefix +
@@ -627,8 +718,8 @@
     private static void encap(ConnectivityIntent.Builder builder,
                               EncapsulationType encap) {
         if (!encap.equals(NONE)) {
-                builder.constraints(ImmutableList.of(
-                        new EncapsulationConstraint(encap)));
+            builder.constraints(ImmutableList.of(
+                    new EncapsulationConstraint(encap)));
         }
     }
 
@@ -642,10 +733,19 @@
         return DeviceId.deviceId("" + i);
     }
 
+    private static MacAddress getMac(int n) {
+        return MacAddress.valueOf(String.format("00:00:00:00:00:%s", n));
+    }
+
     private static HostLocation getLocation(int i) {
         return new HostLocation(new ConnectPoint(getDeviceId(i), P1), 123L);
     }
 
+    private static HostLocation getLocation(int d, int p) {
+        return new HostLocation(new ConnectPoint(getDeviceId(d),
+                                                 PortNumber.portNumber(p)), 123L);
+    }
+
     /**
      * Represents a fake IntentService class that allows to store and retrieve
      * intents without implementing the IntentService logic.
@@ -768,7 +868,7 @@
     /**
      * Represents a fake VplsConfigService class which is needed for testing.
      */
-    private class TestVplsConfigService extends VplsConfigurationServiceAdapter {
+    private class TestVplsConfigService extends VplsConfigServiceAdapter {
 
         private final SetMultimap<String, Interface> ifacesByVplsName;
         private final Map<String, EncapsulationType> encapsByVplsName;
@@ -785,12 +885,14 @@
         public void addVpls(String vplsName, Set<String> ifaceNames, String encap) {
             if (!ifacesByVplsName.containsKey(vplsName)) {
                 ifaceNames.forEach(ifaceName -> {
-                    AVALIABLE_INTERFACES.forEach(iface -> {
+                    AVAILABLE_INTERFACES.forEach(iface -> {
                         if (iface.name().equals(ifaceName)) {
                             ifacesByVplsName.put(vplsName, iface);
                         }
                     });
                 });
+            }
+            if (!ifacesByVplsName.containsKey(vplsName)) {
                 encapsByVplsName.put(vplsName, valueOf(encap));
             }
         }
@@ -805,7 +907,7 @@
         @Override
         public void addIface(String vplsName, String iface) {
             if (!ifacesByVplsName.containsKey(vplsName)) {
-                AVALIABLE_INTERFACES.forEach(intf -> {
+                AVAILABLE_INTERFACES.forEach(intf -> {
                     if (intf.name().equals(iface)) {
                         ifacesByVplsName.put(vplsName, intf);
                     }
@@ -881,12 +983,12 @@
 
         @Override
         public SetMultimap<String, Interface> ifacesByVplsName(VlanId vlan,
-                                                             ConnectPoint connectPoint) {
+                                                               ConnectPoint connectPoint) {
             String vplsName =
                     ifacesByVplsName.entries().stream()
                             .filter(e -> e.getValue().connectPoint().equals(connectPoint))
                             .filter(e -> e.getValue().vlan().equals(vlan))
-                            .map(e -> e.getKey())
+                            .map(Map.Entry::getKey)
                             .findFirst()
                             .orElse(null);
             SetMultimap<String, Interface> result = HashMultimap.create();
diff --git a/apps/vpls/src/test/java/org/onosproject/vpls/config/VplsAppConfigTest.java b/apps/vpls/src/test/java/org/onosproject/vpls/config/VplsAppConfigTest.java
index d7098e7..b3ca89d 100644
--- a/apps/vpls/src/test/java/org/onosproject/vpls/config/VplsAppConfigTest.java
+++ b/apps/vpls/src/test/java/org/onosproject/vpls/config/VplsAppConfigTest.java
@@ -29,11 +29,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 /**
  * Tests for the {@link VplsAppConfig} class.
@@ -233,6 +229,8 @@
 
         assertTrue("Interface not correctly attached to the VPLS",
                    vpls.isAttached(IF4));
+        assertTrue("Interface not correctly attached to the VPLS",
+                   vpls.isAttached(IF4));
         assertFalse("Unexpected interface attached to the VPLS",
                     vpls.isAttached(IF_NON_EXIST));
     }
@@ -254,18 +252,15 @@
         public void onApply(@SuppressWarnings("rawtypes") Config config) {
             config.apply();
         }
-
     }
 
     private VplsConfig createInitialVpls() {
         Set<String> ifaces = new HashSet<>(Arrays.asList(IF1, IF2, IF3));
-
         return new VplsConfig(VPLS1, ifaces, EncapsulationType.NONE);
     }
 
     private VplsConfig createNewVpls() {
         Set<String> ifaces = new HashSet<>(Arrays.asList(IF4, IF5));
-
         return new VplsConfig(NEWVPLS, ifaces, EncapsulationType.NONE);
     }
 }
diff --git a/tools/test/topos/vpls.json b/tools/test/topos/vpls.json
index 0ffe259..26829fe 100644
--- a/tools/test/topos/vpls.json
+++ b/tools/test/topos/vpls.json
@@ -3,44 +3,78 @@
     "of:0000000000000001": { "basic": { "name": "s1", "latitude": 37.7576793, "longitude": -122.5076405 }},
     "of:0000000000000002": { "basic": { "name": "s2", "latitude": 34.0502337, "longitude": -118.3263353 }},
     "of:0000000000000003": { "basic": { "name": "s3", "latitude": 38.9082909, "longitude": -77.0886051 }},
-    "of:0000000000000004": { "basic": { "name": "s4", "latitude": 30.2787717, "longitude": -82.3069047 }}
+    "of:0000000000000004": { "basic": { "name": "s4", "latitude": 30.2787717, "longitude": -82.3069047 }},
+    "of:0000000000000005": { "basic": { "name": "s5", "latitude": 32.1932468, "longitude": -96.6318932 }}
   },
   "hosts": {
-    "00:00:00:00:00:01/100": { "basic": { "location": "of:0000000000000001/1", "ips": [ "10.0.0.1" ], "name": "v100h1", "latitude": 37.7576793, "longitude": -125.0076405  }},
-    "00:00:00:00:00:02/200": { "basic": { "location": "of:0000000000000002/1", "ips": [ "10.0.0.2" ], "name": "v200h1", "latitude": 34.0502337, "longitude": -120.8263353  }},
-    "00:00:00:00:00:03/300": { "basic": { "location": "of:0000000000000003/1", "ips": [ "10.0.0.3" ], "name": "v300h1", "latitude": 38.9082909, "longitude": -74.5886051  }},
-    "00:00:00:00:00:04/400": { "basic": { "location": "of:0000000000000004/1", "ips": [ "10.0.0.4" ], "name": "v400h1", "latitude": 30.2787717, "longitude": -79.8069047  }}
+    "00:00:00:00:00:01/10": { "basic": { "location": "of:0000000000000001/1", "ips": [ "10.0.0.1" ], "name": "vpls1h1", "latitude": 37.7576793, "longitude": -125.0076405 }},
+    "00:00:00:00:00:02/10": { "basic": { "location": "of:0000000000000004/1", "ips": [ "10.0.0.2" ], "name": "vpls1h2", "latitude": 30.2787717, "longitude": -79.8069047 }},
+    "00:00:00:00:00:03/20": { "basic": { "location": "of:0000000000000003/1", "ips": [ "10.0.0.3" ], "name": "vpls1h3", "latitude": 38.9082909, "longitude": -74.5886051 }},
+    "00:00:00:00:00:04/30": { "basic": { "location": "of:0000000000000004/2", "ips": [ "10.0.0.4" ], "name": "vpls2h1", "latitude": 30.2787717, "longitude": -79.8069047 }},
+    "00:00:00:00:00:05/40": { "basic": { "location": "of:0000000000000002/1", "ips": [ "10.0.0.5" ], "name": "vpls2h2", "latitude": 34.0502337, "longitude": -120.8263353 }},
+    "00:00:00:00:00:06/-1": { "basic": { "location": "of:0000000000000004/3", "ips": [ "10.0.0.6" ], "name": "vpls2h3", "latitude": 30.2787717, "longitude": -79.8069047 }},
+    "00:00:00:00:00:07/-1": { "basic": { "location": "of:0000000000000003/2", "ips": [ "10.0.0.7" ], "name": "vpls3h1", "latitude": 38.9082909, "longitude": -74.5886051 }},
+    "00:00:00:00:00:08/-1": { "basic": { "location": "of:0000000000000005/1", "ips": [ "10.0.0.8" ], "name": "vpls3h2", "latitude": 32.1932468, "longitude": -96.6318932 }}
   },
   "ports": {
     "of:0000000000000001/1": {
       "interfaces": [
         {
-          "name": "vlan100H1",
-          "vlan": "100"
+          "name": "vpls1h1",
+          "vlan": "10"
         }
       ]
     },
     "of:0000000000000002/1": {
       "interfaces": [
         {
-          "name": "vlan200H1",
-          "vlan": "200"
+          "name": "vpls2h2",
+          "vlan": "40"
         }
       ]
     },
     "of:0000000000000003/1": {
       "interfaces": [
         {
-          "name": "vlan300H1",
-          "vlan": "300"
+          "name": "vpls1h3",
+          "vlan": "20"
+        }
+      ]
+    },
+    "of:0000000000000003/2": {
+      "interfaces": [
+        {
+          "name": "vpls3h1"
         }
       ]
     },
     "of:0000000000000004/1": {
       "interfaces": [
         {
-          "name": "vlan400H1",
-          "vlan": "400"
+          "name": "vpls1h2",
+          "vlan": "10"
+        }
+      ]
+    },
+    "of:0000000000000004/2": {
+      "interfaces": [
+        {
+          "name": "vpls2h1",
+          "vlan": "30"
+        }
+      ]
+    },
+    "of:0000000000000004/3": {
+      "interfaces": [
+        {
+          "name": "vpls2h3"
+        }
+      ]
+    },
+    "of:0000000000000005/1": {
+      "interfaces": [
+        {
+          "name": "vpls3h2"
         }
       ]
     }
@@ -50,12 +84,17 @@
       "vpls": {
         "vplsList" : [
           {
-            "name" : "net1",
-            "interfaces" : ["vlan100H1", "vlan200H1"]
+            "name" : "VPLS1",
+            "encapsulation" : "VLAN",
+            "interfaces" : ["vpls1h1", "vpls1h2", "vpls1h3"]
           },
           {
-            "name" : "net2",
-            "interfaces" : []
+            "name" : "VPLS2",
+            "interfaces" : ["vpls2h1", "vpls2h2", "vpls2h3"]
+          },
+          {
+            "name" : "VPLS3",
+            "interfaces" : ["vpls3h1", "vpls3h2"]
           }
         ]
       }
diff --git a/tools/test/topos/vpls.py b/tools/test/topos/vpls.py
index 0124541..35e593b 100755
--- a/tools/test/topos/vpls.py
+++ b/tools/test/topos/vpls.py
@@ -11,7 +11,7 @@
 class VLANHost( Host ):
     "Host connected to VLAN interface"
 
-    def config( self, vlan=100, **params ):
+    def config( self, vlan=10, **params ):
         """Configure VLANHost according to (optional) parameters:
            vlan: VLAN ID for default interface"""
 
@@ -43,22 +43,32 @@
         s2 = self.addSwitch('s2')
         s3 = self.addSwitch('s3')
         s4 = self.addSwitch('s4')
+        s5 = self.addSwitch('s5')
 
-        v100h1 = self.addHost('v100h1', cls=VLANHost, vlan=100, mac='00:00:00:00:00:01')
-        v200h1 = self.addHost('v200h1', cls=VLANHost, vlan=200, mac='00:00:00:00:00:02')
-        v300h1 = self.addHost('v300h1', cls=VLANHost, vlan=300, mac='00:00:00:00:00:03')
-        v400h1 = self.addHost('v400h1', cls=VLANHost, vlan=400, mac='00:00:00:00:00:04')
+        vpls1h1 = self.addHost('vpls1h1', cls=VLANHost, vlan=10, mac='00:00:00:00:00:01')
+        vpls1h2 = self.addHost('vpls1h2', cls=VLANHost, vlan=10, mac='00:00:00:00:00:02')
+        vpls1h3 = self.addHost('vpls1h3', cls=VLANHost, vlan=20, mac='00:00:00:00:00:03')
+        vpls2h1 = self.addHost('vpls2h1', cls=VLANHost, vlan=30, mac='00:00:00:00:00:04')
+        vpls2h2 = self.addHost('vpls2h2', cls=VLANHost, vlan=40, mac='00:00:00:00:00:05')
+        vpls2h3 = self.addHost('vpls2h3', mac='00:00:00:00:00:06')
+        vpls3h1 = self.addHost('vpls3h1', mac='00:00:00:00:00:07')
+        vpls3h2 = self.addHost('vpls3h2', mac='00:00:00:00:00:08')
 
-        self.addLink(s1, v100h1, port1=1, port2=0)
-        self.addLink(s2, v200h1, port1=1, port2=0)
-        self.addLink(s3, v300h1, port1=1, port2=0)
-        self.addLink(s4, v400h1, port1=1, port2=0)
+        self.addLink(s1, vpls1h1, port1=1, port2=0)
+        self.addLink(s2, vpls2h2, port1=1, port2=0)
+        self.addLink(s3, vpls1h3, port1=1, port2=0)
+        self.addLink(s3, vpls3h1, port1=2, port2=0)
+        self.addLink(s4, vpls1h2, port1=1, port2=0)
+        self.addLink(s4, vpls2h1, port1=2, port2=0)
+        self.addLink(s4, vpls2h3, port1=3, port2=0)
+        self.addLink(s5, vpls3h2, port1=1, port2=0)
 
         self.addLink(s1, s4)
         self.addLink(s1, s2)
         self.addLink(s2, s4)
         self.addLink(s2, s3)
         self.addLink(s3, s4)
+        self.addLink(s3, s5)
 
 topos = { 'vpls': ( lambda: VplsTopo() ) }