[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