Ensuring up-to-date status for SDX-L2

Changes:
- Implements commands: sdxl2-clean
- Removes check for active circuit
- Removes intents when deleting SDX
- Adds completers: mac (sdxl2cp-add), placeholder, null
- Introduces enum-like for the VC types
- Modifies app name and description
- Updates README, pom, BUCK files
- Updates and refactors unit tests
- Reduces checkstyle warnings with more javadoc and restricted visibility

Change-Id: Ic672c81168e51690080d9d6466afe9f12b19e397
diff --git a/sdx-l2/BUCK b/sdx-l2/BUCK
index a24176b..9ea3f47 100644
--- a/sdx-l2/BUCK
+++ b/sdx-l2/BUCK
@@ -16,9 +16,9 @@
 )
 
 onos_app (
-  title = 'SDX-L2 Application',
+  title = 'SDX-L2 App',
   category = 'Utility',
   url = 'http://www.geant.org',
   included_bundles = BUNDLES,
-  description = 'SDX-L2 application for ONOS project developed by GEANT',
+  description = 'SDX-L2 application to create and manage Ethernet circuits',
 )
\ No newline at end of file
diff --git a/sdx-l2/README.md b/sdx-l2/README.md
index 397f4f8..7f1fc61 100644
--- a/sdx-l2/README.md
+++ b/sdx-l2/README.md
@@ -1,28 +1,34 @@
 ![GEANT logo](http://www.geant.org/Style%20Library/Geant/Images/logo.png "http://geant.org")
 
 Software Defined eXchange - L2 (SDX-L2)
-==========================
+========================================
 
 SDX-L2 is an application for ONOS project which can provide layer 2 connectivity between edge ports of a given SDN network.
 
 
 License
-=======
+========
 
 This sofware is licensed under the Apache License, Version 2.0.
 
-Information can be found here:
- [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
+Information can be found here: [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
 
 
-SDX-L2 dependencies
-=============================
+Documentation
+==============
 
-SDX-L2 implements its own ARP/NDP handler, it is important to disable the ONOS ARP/NDP handler.
+Check [SDX-L2 page](https://wiki.onosproject.org/display/ONOS/SDX-L2+application) at ONOS wiki.
 
 
-SDX-L2 installation
-=============================
+Dependencies
+=============
+
+SDX-L2 implements its own ARP/NDP handler and does not require proxyarp, fwd and hostprovider apps.
+It is suggested to start ONOS for this app by using ONOS_APPS=drivers,openflow-base,lldpprovider
+
+
+Installation
+=============
 
 - Compile the project:
 
@@ -36,12 +42,17 @@
 
         onos-app $OC1 install target/onos-app-sdx-l2-1.7.0-SNAPSHOT.oar
 
+- Verify that the application is active:
 
-SDX-L2 CLI commands
-=============================
+        onos> onos:apps | grep sdx-l2
+          * id=79, name=org.onosproject.sdx-l2, version=1.7.0.SNAPSHOT, origin=GN4 project, category=Utility, description=SDX-L2 application to create and manage Ethernet circuits, features=[onos-app-sdx-l2], featuresRepo=mvn:org.onosproject/onos-app-sdx-l2/1.7.0-SNAPSHOT/xml/features, apps=[], permissions=[], url=https://wiki.onosproject.org/display/ONOS/SDX-L2+application
+
+
+CLI commands
+=============
 
 General
------------------------------
+--------
 
 - Create a named SDX:
 
@@ -59,7 +70,7 @@
 
 
 Connection Points (CP)
------------------------------
+-----------------------
 
 - Create a named SDX-L2 CP:
 
@@ -71,28 +82,32 @@
 
  *note that CPs must have same number of VLANs in order to establish a VC*
 
+
 - Remove a named SDX-L2 CP:
 
         sdxl2cp-remove $sdxcpname
 
 
-- Get the information of an SDX-L2 CP:
+- Get the information of a SDX-L2 CP:
 
         sdxl2cp $sdxcpname
 
 
-- List all active SDX-L2 CPs or all active SDX CPs related to an SDX:
+- List all active SDX-L2 CPs or all active SDX CPs related to a SDX:
 
         sdxl2cp-list [$sdxname]
 
 
 Virtual Circuits (VC)
------------------------------
+----------------------
 
 - Create a VC between two CPs:
 
         sdxl2vc-add $sdxname $sdxcp1 $sdxcp2
 
+  where the circuit can be based on MAC (default), VLAN or MPLS mechanisms:
+    - cfg set org.onosproject.sdxl2.SdxL2Manager VirtualCircuitType {MAC|VLAN|MPLS}
+
 
 - Remove a named VC:
 
@@ -104,13 +119,13 @@
         sdxl2vc $sdxvcname
 
 
-- List all active L2 VCs or all L2 VCs related to an SDX:
+- List all active L2 VCs or all L2 VCs related to a SDX:
 
         sdxl2vc-list [$sdxname]
 
 
-SDX-L2 usage examples
-=============================
+Usage examples
+===============
 
 - Create a named SDX-L2:
 
@@ -126,7 +141,7 @@
 
   where the connection points are the IDs of the devices provided through the 'edge-ports' ONOS CLI command
 
-        onos> sdxl2:sdxl2cp-add -ce_mac 00:00:00:00:00:01 SDXL2Test of:0000000000000003/2 Sw3P2 5,15-17
+        onos> sdxl2:sdxl2cp-add -ce_mac 00:00:00:00:00:01 SDXL2Test of:0000000000000003/1 Sw3P1 5,15-17
         onos> sdxl2:sdxl2cp-add -ce_mac 00:00:00:00:00:02 SDXL2Test of:0000000000000002/1 Sw2P1 6,19-21
 
         onos> sdxl2:sdxl2cp-list
@@ -134,7 +149,7 @@
         Status		SDXL2 Connection Point
         -----------------------------------------------
         ONLINE		Sw2P1
-        ONLINE		Sw3P2
+        ONLINE		Sw3P1
 
         onos> sdxl2:sdxl2cp Sw2P1
 
@@ -143,64 +158,103 @@
         ONLINE		of:0000000000000002/1		Sw2P1		[6, 19, 20, 21]		00:00:00:00:00:02
 
 
-- Create a VC connecting the two CPs and get its details:
+- Create a (MAC-based) VC connecting the two CPs and get its details:
 
-        onos> sdxl2:sdxl2vc-add SDXL2Test Sw2P1 Sw3P2
+        onos> sdxl2:sdxl2vc-add SDXL2Test Sw2P1 Sw3P1
         onos> sdxl2:sdxl2vc-list
 
         Status		Virtual Circuit
         -----------------------------------------------
-        ONLINE		Sw2P1-Sw3P2
+        ONLINE		Sw2P1-Sw3P1
 
 
-        onos> sdxl2:sdxl2vc SDXL2Test:Sw2P1-Sw3P2
+        onos> sdxl2:sdxl2vc SDXL2Test:Sw2P1-Sw3P1
 
         Status		Connection Point		Name		Vlan IDs		CE Mac Address
         -------------------------------------------------------------------------------------------------------------
         ONLINE		of:0000000000000002/1		Sw2P1		[6, 19, 20, 21]		00:00:00:00:00:02
-        ONLINE		of:0000000000000003/2		Sw3P2		[5, 15, 16, 17]		00:00:00:00:00:01
+        ONLINE		of:0000000000000003/1		Sw3P1		[5, 15, 16, 17]		00:00:00:00:00:01
 
 
         Status		Intent
         --------------------------------------------
-        ONLINE		SDXL2Test:Sw2P1-Sw3P2,4
-        ONLINE		SDXL2Test:Sw3P2-Sw2P1,3
-        ONLINE		SDXL2Test:Sw3P2-Sw2P1,1
-        ONLINE		SDXL2Test:Sw3P2-Sw2P1,4
-        ONLINE		SDXL2Test:Sw3P2-Sw2P1,2
-        ONLINE		SDXL2Test:Sw2P1-Sw3P2,1
-        ONLINE		SDXL2Test:Sw2P1-Sw3P2,2
-        ONLINE		SDXL2Test:Sw2P1-Sw3P2,3
+        ONLINE		SDXL2Test:Sw2P1-Sw3P1,4
+        ONLINE		SDXL2Test:Sw3P1-Sw2P1,3
+        ONLINE		SDXL2Test:Sw3P1-Sw2P1,1
+        ONLINE		SDXL2Test:Sw3P1-Sw2P1,4
+        ONLINE		SDXL2Test:Sw3P1-Sw2P1,2
+        ONLINE		SDXL2Test:Sw2P1-Sw3P1,1
+        ONLINE		SDXL2Test:Sw2P1-Sw3P1,2
+        ONLINE		SDXL2Test:Sw2P1-Sw3P1,3
 
 
-- Remove VC and check it exists no longer:
+- Create an (MPLS-based) VC connecting two new CPs and get its details:
 
-        onos> sdxl2:sdxl2vc-remove SDXL2Test:Sw2P1-Sw3P2
+        onos> cfg set org.onosproject.sdxl2.SdxL2Manager VirtualCircuitType MPLS
+        onos> cfg get org.onosproject.sdxl2.SdxL2Manager 
+            org.onosproject.sdxl2.SdxL2Manager
+                name=VirtualCircuitType, type=string, value=MPLS, defaultValue=MAC, description=Tunnel mechanism for Virtual Circuits
+
+        onos> sdxl2:sdxl2cp-add SDXL2Test of:0000000000000003/2 Sw3P2
+        onos> sdxl2:sdxl2cp-add SDXL2Test of:0000000000000002/2 Sw2P2
+        onos> sdxl2:sdxl2vc-add SDXL2Test Sw2P2 Sw3P2
         onos> sdxl2:sdxl2vc-list
+        onos> sdxl2:sdxl2vc SDXL2Test:Sw2P2-Sw3P2
 
 
-- Remove CPs and check they exist no longer:
+- Create a (VLAN-based) VC connecting two new CPs and get its details:
+
+        onos> cfg set org.onosproject.sdxl2.SdxL2Manager VirtualCircuitType VLAN
+        onos> cfg get org.onosproject.sdxl2.SdxL2Manager
+            org.onosproject.sdxl2.SdxL2Manager
+                name=VirtualCircuitType, type=string, value=VLAN, defaultValue=MAC, description=Tunnel mechanism for Virtual Circuits
+
+        onos> sdxl2:sdxl2cp-add SDXL2Test of:0000000000000003/2 Sw3P2 10-12
+        onos> sdxl2:sdxl2cp-add SDXL2Test of:0000000000000002/2 Sw2P2 10-12
+        onos> sdxl2:sdxl2vc-add SDXL2Test Sw2P2 Sw3P2
+        onos> sdxl2:sdxl2vc-list
+        onos> sdxl2:sdxl2vc SDXL2Test:Sw2P2-Sw3P2
+
+
+- Remove VCs, CPs, SDX-L2 instances or just everything.
+  Deleting a CP that is part of a VC removes the VC as well. Likewise, deleting
+  the whole instance removes every resource related to it:
+
+        onos> sdxl2:sdxl2vc-remove SDXL2Test:Sw2P1-Sw3P1
+        onos> sdxl2:sdxl2vc-remove SDXL2Test:Sw2P2-Sw3P2
 
         onos> sdxl2:sdxl2cp-remove Sw2P1
+        onos> sdxl2:sdxl2cp-remove Sw3P1
+        onos> sdxl2:sdxl2cp-remove Sw2P2
         onos> sdxl2:sdxl2cp-remove Sw3P2
+
+        onos> sdxl2:sdxl2-remove SDXL2Test
+
+        onos> sdxl2:sdxl2-clean
+
+        onos> sdxl2:sdxl2vc-list
         onos> sdxl2:sdxl2cp-list
-
-- Remove SDX-L2 and check it does not exist anymore:
-
-        onos> sdxl2:sdxl2-list SDXL2Test
         onos> sdxl2:sdxl2-list
 
 
 Tips
-=============================
+=====
 
 - You should define a topology and point to your local/remote ONOS instance. Some examples:
 
-  - Mininet
-        sudo mn --controller remote,ip=127.0.0.1 --tree,2,2
+  - Mininet (OVS, CPqD)
+
+        sudo mn --topo linear,3 --controller remote,ip=127.0.0.1 --switch ovsk,protocols=OpenFlow13
+        sudo mn --topo linear,3 --controller remote,ip=127.0.0.1 --switch user,protocols=OpenFlow13
+
   - ONOS/Mininet
+
         onos-start-network
 
 - You may check the nodes available at ONOS from Mininet:
 
         onos> edge-ports
+
+- Non-critical errors are described in the log. Attach to ONOS in a new terminal:
+
+        onos> log:tail
diff --git a/sdx-l2/pom.xml b/sdx-l2/pom.xml
index 892dbb4..42ef399 100644
--- a/sdx-l2/pom.xml
+++ b/sdx-l2/pom.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
   ~ Copyright 2016-present Open Networking Laboratory
   ~
@@ -15,148 +14,163 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
+<modelVersion>4.0.0</modelVersion>
+<parent>
     <artifactId>onos-app-samples</artifactId>
     <groupId>org.onosproject</groupId>
     <version>1.7.0-SNAPSHOT</version>
-  </parent>
+</parent>
 
-    <groupId>org.onosproject</groupId>
-    <artifactId>onos-app-sdx-l2</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
-    <packaging>bundle</packaging>
+<groupId>org.onosproject</groupId>
+<artifactId>onos-app-sdx-l2</artifactId>
+<version>1.7.0-SNAPSHOT</version>
+<packaging>bundle</packaging>
 
-    <description>SDX-L2 application for ONOS project developed by GEANT</description>
-    <url>http://www.geant.org</url>
+<description>SDX-L2 application to create and manage Ethernet circuits</description>
+<url>http://www.geant.org</url>
 
-    <properties>
-        <onos.version>1.7.0-SNAPSHOT</onos.version>
-        <onos.app.name>org.onosproject.sdx-l2</onos.app.name>
-        <onos.app.origin>GN4 project</onos.app.origin>
-    </properties>
+<properties>
+    <onos.version>1.7.0-SNAPSHOT</onos.version>
+    <onos.app.name>org.onosproject.sdx-l2</onos.app.name>
+    <onos.app.title>SDX-L2 App</onos.app.title>
+    <onos.app.category>Utility</onos.app.category>
+    <onos.app.url>
+        https://wiki.onosproject.org/display/ONOS/SDX-L2+application
+    </onos.app.url>
+    <onos.app.readme>SDX-L2 application to create and manage Ethernet
+        circuits
+    </onos.app.readme>
+    <onos.app.origin>GN4 project</onos.app.origin>
+</properties>
 
-    <dependencies>
-        <dependency>
+<dependencies>
+    <dependency>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-api</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-core-dist</artifactId>
+        <version>${onos.version}</version>
+    </dependency>
+
+    <dependency>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onlab-junit</artifactId>
+        <scope>test</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-api</artifactId>
+        <scope>test</scope>
+        <classifier>tests</classifier>
+    </dependency>
+
+    <dependency>
+        <groupId>com.google.guava</groupId>
+        <artifactId>guava-testlib</artifactId>
+        <scope>test</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-cli</artifactId>
+        <version>${onos.version}</version>
+        <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.apache.karaf.shell</groupId>
+        <artifactId>org.apache.karaf.shell.console</artifactId>
+        <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+
+</dependencies>
+
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+                <useFile>false</useFile>
+                <redirectTestOutputToFile>false</redirectTestOutputToFile>
+            </configuration>
+        </plugin>
+        <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-bundle-plugin</artifactId>
+            <extensions>true</extensions>
+        </plugin>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <configuration>
+                <source>1.8</source>
+                <target>1.8</target>
+            </configuration>
+        </plugin>
+        <plugin>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>maven-scr-plugin</artifactId>
+            <executions>
+                <execution>
+                    <id>generate-scr-srcdescriptor</id>
+                    <goals>
+                        <goal>scr</goal>
+                    </goals>
+                </execution>
+            </executions>
+            <configuration>
+                <supportedProjectTypes>
+                    <supportedProjectType>bundle</supportedProjectType>
+                    <supportedProjectType>war</supportedProjectType>
+                </supportedProjectTypes>
+            </configuration>
+        </plugin>
+        <plugin>
             <groupId>org.onosproject</groupId>
-            <artifactId>onos-api</artifactId>
-        </dependency>
+            <artifactId>onos-maven-plugin</artifactId>
+            <executions>
+                <execution>
+                    <id>cfg</id>
+                    <phase>generate-resources</phase>
+                    <goals>
+                        <goal>cfg</goal>
+                    </goals>
+                </execution>
+                <execution>
+                    <id>swagger</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>swagger</goal>
+                    </goals>
+                </execution>
+                <execution>
+                    <id>app</id>
+                    <phase>package</phase>
+                    <goals>
+                        <goal>app</goal>
+                    </goals>
+                </execution>
+            </executions>
+        </plugin>
+    </plugins>
+</build>
 
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-core-dist</artifactId>
-            <version>${onos.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onlab-junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-api</artifactId>
-            <scope>test</scope>
-            <classifier>tests</classifier>
-        </dependency>
-
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-cli</artifactId>
-            <version>${onos.version}</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <useFile>false</useFile>
-                    <redirectTestOutputToFile>false</redirectTestOutputToFile>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>generate-scr-srcdescriptor</id>
-                        <goals>
-                            <goal>scr</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <supportedProjectTypes>
-                        <supportedProjectType>bundle</supportedProjectType>
-                        <supportedProjectType>war</supportedProjectType>
-                    </supportedProjectTypes>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.onosproject</groupId>
-                <artifactId>onos-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>cfg</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>cfg</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>swagger</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>swagger</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>app</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>app</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
+</project>
\ No newline at end of file
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ArpNdpHandler.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ArpNdpHandler.java
index 6100763..377d46a 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ArpNdpHandler.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ArpNdpHandler.java
@@ -19,13 +19,13 @@
 
 import org.onlab.packet.ARP;
 import org.onlab.packet.Ethernet;
-import org.onlab.packet.IpAddress;
+import org.onlab.packet.ICMP6;
+import org.onlab.packet.IPv6;
 import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip6Address;
-import org.onlab.packet.VlanId;
-import org.onlab.packet.IPv6;
-import org.onlab.packet.ICMP6;
+import org.onlab.packet.IpAddress;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
 import org.onlab.packet.ndp.NeighborSolicitation;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
@@ -90,7 +90,7 @@
      * @param context containing the packet to process.
      * @return true if the packet has been handled otherwise false.
      */
-    public boolean handlePacket(PacketContext context) {
+    boolean handlePacket(PacketContext context) {
 
         checkPermission(PACKET_WRITE);
 
@@ -169,7 +169,7 @@
 
     /**
      * Verifies if the TrafficSelector of the packet is equal
-     * to the one derived from an SDX-L2 Intent.
+     * to the one derived from a SDX-L2 Intent.
      *
      * @param generated the traffic selector of the packet.
      * @param fromIntent the traffic selector of the intent.
@@ -179,7 +179,7 @@
 
         Set<Criterion> criteria = generated.criteria();
         for (Criterion criterion : criteria) {
-            if (!vcType.equals("MAC") && criterion.type().equals(Type.ETH_SRC)) {
+            if (!vcType.equals(VirtualCircuitMechanism.MAC) && criterion.type().equals(Type.ETH_SRC)) {
                 continue;
             }
 
@@ -236,7 +236,6 @@
         } else if (eth.getEtherType() == Ethernet.TYPE_IPV6) {
             return createNdpContext(eth, inPort);
         }
-
         return null;
     }
 
@@ -266,7 +265,6 @@
         } else {
             return null;
         }
-
         return new MessageContext(eth, inPort, Protocol.ARP, type, target, sender);
     }
 
@@ -302,16 +300,19 @@
         } else {
             return null;
         }
-
         return new MessageContext(eth, inPort, Protocol.NDP, type, target, sender);
     }
 
-
-
+    /**
+     * Provides supported protocols.
+     */
     private enum Protocol {
         ARP, NDP
     }
 
+    /**
+     * Provides supported messages.
+     */
     private enum MessageType {
         REQUEST, REPLY
     }
@@ -330,10 +331,9 @@
         private Ethernet eth;
         private ConnectPoint inPort;
 
-
-        public MessageContext(Ethernet eth, ConnectPoint inPort,
-                              Protocol protocol, MessageType type,
-                              IpAddress target, IpAddress sender) {
+        MessageContext(Ethernet eth, ConnectPoint inPort,
+                       Protocol protocol, MessageType type,
+                       IpAddress target, IpAddress sender) {
             this.eth = eth;
             this.inPort = inPort;
             this.protocol = protocol;
@@ -382,13 +382,11 @@
          */
         public TrafficSelector selector() {
             switch (vcType) {
-                case "MPLS":
-                case "VLAN":
+                case VirtualCircuitMechanism.MPLS:
+                case VirtualCircuitMechanism.VLAN:
                 default:
             }
-
             return buildMacSelector(this.srcMac(), this.vlan());
-
         }
 
         /**
@@ -424,7 +422,7 @@
      *
      * @param vcType VC type
      */
-    public static void setVcType(String vcType) {
+    static void setVcType(String vcType) {
         SdxL2ArpNdpHandler.vcType = vcType;
     }
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java
index e1075df..f4180bb 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java
@@ -35,7 +35,6 @@
  */
 public class SdxL2ConnectionPoint {
 
-    private static final String ERROR_INVALID_VLAN = "Provide VLAN with at least value '-1' or '1'";
     private final ConnectPoint cPoint;
     private final List<VlanId> vlanIds;
     private final MacAddress ceMac;
@@ -149,7 +148,7 @@
         if (vlans == null) {
             vlans = "-1";
         }
-        ArrayList<String> vlanRange = new ArrayList<String>();
+        ArrayList<String> vlanRange = new ArrayList<>();
         String[] splittedVlans;
         String commaSeparator = ",";
         if (vlans.contains(commaSeparator)) {
@@ -172,7 +171,7 @@
      * @return a list with numbers between "X" and "Y" (inclusive)
      */
     private static ArrayList<String> generateNumberRange(String range) {
-        ArrayList<String> parsedNumbers = new ArrayList<String>();
+        ArrayList<String> parsedNumbers = new ArrayList<>();
         Pattern p = Pattern.compile("(\\d+)-(\\d+)");
         Matcher m = p.matcher(range);
         if (m.matches()) {
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointMatcher.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointMatcher.java
new file mode 100644
index 0000000..2ba0ce8
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointMatcher.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.sdxl2;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.intent.Intent;
+
+import java.util.Objects;
+
+import static java.lang.String.format;
+
+/**
+ * Matches intents related with Connection Points.
+ */
+public class SdxL2ConnectionPointMatcher {
+
+    private static final String MATCH_FORMAT = "%s-%s";
+    protected ApplicationId appId;
+
+    /**
+     * Creates a SDX-L2 CP Matcher.
+     */
+    public SdxL2ConnectionPointMatcher() {
+    }
+
+    /**
+     * Creates a SDX-L2 CP Matcher.
+     *
+     * @param sdxl2id application ID
+     */
+    SdxL2ConnectionPointMatcher(ApplicationId sdxl2id) {
+        this.appId = sdxl2id;
+    }
+
+    /**
+     * Matches an intent given a SDX-L2 Connection Point.
+     *
+     * @param sdxl2cplhs left-hand side of a Virtual Circuit
+     * @param sdxl2cprhs left-hand side of a Virtual Circuit
+     * @param intent intent to match
+     * @return result of the match
+     */
+    public boolean matches(SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs, Intent intent) {
+        if (!checkSimilarAppId(intent)) {
+            return false;
+        }
+        String key = intent.key().toString();
+        String[] fields = key.split(":");
+        String cps = format(MATCH_FORMAT, sdxl2cplhs.name(), sdxl2cprhs.name());
+        return fields.length == 2 && fields[1].contains(cps);
+    }
+
+    /**
+     * Matches an intent given a SDX-L2 Connection Point.
+     *
+     * @param cp hand side of a Virtual Circuit
+     * @param intent intent to match
+     * @return result of the match
+     */
+    public boolean matches(SdxL2ConnectionPoint cp, Intent intent) {
+        if (!checkSimilarAppId(intent)) {
+            return false;
+        }
+        String key = intent.key().toString();
+        String[] fields = key.split(":");
+        if (fields.length != 2) {
+            return false;
+        }
+        String[] cps = fields[1].split(",");
+
+        if (cps.length != 2) {
+            return false;
+        }
+        String[] hss = cps[0].split("-");
+        return hss.length == 2 && (hss[0].equals(cp.name()) || hss[1].equals(cp.name()));
+    }
+
+    /**
+     * Matches an intent given a SDX-L2 Connection Point.
+     *
+     * @param sdxl2 name of SDX-L2
+     * @param intent intent to match
+     * @return result of the match
+     */
+    public boolean matches(String sdxl2, Intent intent) {
+        if (!checkSimilarAppId(intent)) {
+            return false;
+        }
+        String key = intent.key().toString();
+        String[] fields = key.split(":");
+        return fields.length == 2 && fields[0].equals(sdxl2);
+    }
+
+    /**
+     * Determines whether the given intent corresponds to this app.
+     *
+     * @param intent intent to check
+     * @return result indicating whether the intent belongs to this app
+     */
+    private boolean checkSimilarAppId(Intent intent) {
+        return appId == null || Objects.equals(appId, intent.appId());
+    }
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2DistributedStore.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2DistributedStore.java
index a3ada37..152fe9b 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2DistributedStore.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2DistributedStore.java
@@ -65,42 +65,36 @@
     private Map<String, String> sdxL2VCs;
     private ConsistentMap<String, String> sdxL2vcs;
 
-    private static String errorAddSdx = "It is not possible to add %s " +
-            "because it exists";
-
-    private static String errorRemoveSdx = "It is not possible to remove %s " +
-            "because it does not exist";
-
-    /*
-    Error definitions for CPs.
+    /**
+     * Error definitions for SDX-L2 instances,CPs and VCs.
      */
-    private static String errorAddSdxL2CPName = "It is not possible to add %s " +
+    private static final String ERROR_SDX_ADD = "It is not possible to add %s " +
+            "because it already exists";
+    private static final String ERROR_SDX_REMOVE = "It is not possible to remove %s " +
+            "because it does not exist";
+
+    private static final String ERROR_SDX_ADD_CP_NAME = "It is not possible to add %s " +
             "because there is a sdxl2cp with the same name";
-    private static String errorAddSdxL2CPVlans = "It is not possible to add %s " +
+    private static final String ERROR_SDX_ADD_CP_VLANS = "It is not possible to add %s " +
             "because there is a conflict with %s on the vlan ids";
-    private static String errorAddSdxL2CPCP = "It is not possible to add %s " +
+    private static final String ERROR_SDX_ADD_CP_EXISTING = "It is not possible to add %s " +
             "because there is a conflict with %s on the connection point";
-    private static String errorAddSdxL2CPSdx = "It is not possible to add %s " +
+    private static final String ERROR_SDX_ADD_CP_MISSING = "It is not possible to add %s " +
             "because the relative sdxl2 %s does not exist";
-
-    private static String errorGetSdxL2CP = "It is not possible to retrieve %s " +
+    private static final String ERROR_SDX_GET_CP_MISSING = "It is not possible to retrieve %s " +
             "because it does not exist";
-    private static String errorGetSdxL2CPs = "It is not possible to list the sdxl2cps " +
+    private static final String ERROR_SDX_GET_CPS_MISSING = "It is not possible to list the sdxl2cps " +
             "because sdxl2 %s does not exist";
-
-    private static String errorRemoveSdxL2CP = "It is not possible to remove %s " +
+    private static final String ERROR_SDX_REMOVE_CP_MISSING = "It is not possible to remove %s " +
             "because it does not exist";
 
-    /*
-    Error definitions for VCs.
-    */
-    private static String errorVCKey = "It is not possible to add vc because " +
+    private static final String ERROR_VC_KEY = "It is not possible to %s vc because " +
             "there is a problem with key %s (wrong format)";
-    private static String errorAddVCOverlap = "It is not possible to add vc " +
+    private static final String ERROR_VC_ADD_OVERLAP = "It is not possible to add vc " +
             "because there is an overlap with %s";
-    private static String errorRemoveVC = "It is not possible to remove the " +
+    private static final String ERROR_VC_REMOVE_MISSING = "It is not possible to remove the " +
             "vc because it does not exist";
-    private static String errorRemoveVCAux = "Virtual Circuit between %s and %s " +
+    private static final String ERROR_VC_MISSING = "Virtual Circuit between %s and %s " +
             "does not exist";
 
     /**
@@ -142,8 +136,8 @@
      */
     public void initForTest() {
         this.sdxL2s = Sets.newHashSet();
-        this.sdxL2CPs = new ConcurrentHashMap<SdxL2ConnectionPoint, String>();
-        this.sdxL2VCs = new ConcurrentHashMap<String, String>();
+        this.sdxL2CPs = new ConcurrentHashMap<>();
+        this.sdxL2VCs = new ConcurrentHashMap<>();
     }
 
     /**
@@ -158,7 +152,7 @@
     public void putSdxL2(String sdxl2) throws SdxL2Exception {
         boolean inserted = sdxL2s.add(sdxl2);
         if (!inserted) {
-            throw new SdxL2Exception(String.format(errorAddSdx, sdxl2));
+            throw new SdxL2Exception(String.format(ERROR_SDX_ADD, sdxl2));
         }
     }
 
@@ -166,15 +160,16 @@
     public void removeSdxL2(String sdxl2) throws SdxL2Exception {
         boolean removed = sdxL2s.remove(sdxl2);
         if (!removed) {
-            throw new SdxL2Exception(String.format(errorRemoveSdx, sdxl2));
+            throw new SdxL2Exception(String.format(ERROR_SDX_REMOVE, sdxl2));
         }
 
-        Set<Map.Entry<SdxL2ConnectionPoint, String>> toRemove = sdxL2CPs.entrySet().parallelStream().filter(
+        // Removes CPs
+        Set<Map.Entry<SdxL2ConnectionPoint, String>> cpsToRemove = sdxL2CPs.entrySet().parallelStream().filter(
                 key_value -> {
                     String sdxl2Temp = key_value.getValue();
-                    return sdxl2Temp.equals(sdxl2) ? true : false;
+                    return sdxl2Temp.equals(sdxl2);
                 }).collect(Collectors.toSet());
-        toRemove.forEach(key_value -> sdxL2CPs.remove(key_value.getKey()));
+        cpsToRemove.forEach(key_value -> sdxL2CPs.remove(key_value.getKey()));
     }
 
     @Override
@@ -185,7 +180,7 @@
     @Override
     public void addSdxL2ConnectionPoint(String sdxl2, SdxL2ConnectionPoint connectionPoint) throws SdxL2Exception {
         boolean exist = sdxL2s.contains(sdxl2);
-        String errorMissingSdxL2 = String.format(errorAddSdxL2CPSdx, connectionPoint.name(), sdxl2);
+        String errorMissingSdxL2 = String.format(ERROR_SDX_ADD_CP_MISSING, connectionPoint.name(), sdxl2);
         if (!exist) {
             throw new SdxL2Exception(errorMissingSdxL2);
         }
@@ -196,8 +191,8 @@
                 )
         ).collect(Collectors.toSet());
 
-        if (sdxl2cpsTempByName.size() != 0) {
-            throw new SdxL2Exception(String.format(errorAddSdxL2CPName, connectionPoint.name()));
+        if (!sdxl2cpsTempByName.isEmpty()) {
+            throw new SdxL2Exception(String.format(ERROR_SDX_ADD_CP_NAME, connectionPoint.name()));
         }
 
         Set<SdxL2ConnectionPoint> sdxl2cpsByCP = sdxl2cpsTemp.parallelStream().filter(
@@ -215,15 +210,15 @@
 
             tempName = sdxl2cpsByVlan.iterator().hasNext() ? sdxl2cpsByVlan.iterator().next().name() : null;
 
-            if (sdxl2cpsByVlan.size() != 0) {
-                throw new SdxL2Exception(String.format(errorAddSdxL2CPVlans, connectionPoint.name(), tempName));
+            if (!sdxl2cpsByVlan.isEmpty()) {
+                throw new SdxL2Exception(String.format(ERROR_SDX_ADD_CP_VLANS, connectionPoint.name(), tempName));
             }
 
         }
 
         tempName = sdxl2cpsByCP.iterator().hasNext() ? sdxl2cpsByCP.iterator().next().name() : null;
-        if (sdxl2cpsByCP.size() != 0 && vlans.size() == 0) {
-            throw new SdxL2Exception(String.format(errorAddSdxL2CPCP, connectionPoint.name(), tempName));
+        if (!sdxl2cpsByCP.isEmpty() && vlans.size() == 0) {
+            throw new SdxL2Exception(String.format(ERROR_SDX_ADD_CP_EXISTING, connectionPoint.name(), tempName));
         }
 
         sdxL2CPs.put(connectionPoint, sdxl2);
@@ -231,13 +226,11 @@
 
     @Override
     public Set<String> getSdxL2ConnectionPoints(Optional<String> sdxl2) throws SdxL2Exception {
-
         if (sdxl2.isPresent()) {
-
             Set<Map.Entry<SdxL2ConnectionPoint, String>> toGet = sdxL2CPs.entrySet().parallelStream().filter(
                     key_value -> {
                         String sdxl2Temp = key_value.getValue();
-                        return sdxl2Temp.equals(sdxl2.get()) ? true : false;
+                        return sdxl2Temp.equals(sdxl2.get());
                     }).collect(Collectors.toSet());
 
             Iterator<String> itsdxL2s = sdxL2s.iterator();
@@ -249,7 +242,7 @@
             }
 
             if (!found) {
-                throw new SdxL2Exception(String.format(errorGetSdxL2CPs, sdxl2.get()));
+                throw new SdxL2Exception(String.format(ERROR_SDX_GET_CPS_MISSING, sdxl2.get()));
             }
 
             Set<String> cpsTemp = Sets.newHashSet();
@@ -259,29 +252,22 @@
 
             return cpsTemp;
         }
-
         return ImmutableSet.copyOf(sdxL2CPs.keySet()).parallelStream().map(
                 SdxL2ConnectionPoint::name).collect(Collectors.toSet());
-
     }
 
     @Override
     public void removeSdxL2ConnectionPoint(String sdxl2cp) throws SdxL2Exception {
-
         Set<SdxL2ConnectionPoint> sdxl2cpsTemp = ImmutableSet.copyOf(sdxL2CPs.keySet());
         Set<SdxL2ConnectionPoint> sdxl2cpsTempByName = sdxl2cpsTemp.parallelStream().filter(
-                sdxl2cpTemp -> sdxl2cpTemp.name().equals(sdxl2cp
-                )
+                sdxl2cpTemp -> sdxl2cpTemp.name().equals(sdxl2cp)
         ).collect(Collectors.toSet());
 
         if (sdxl2cpsTempByName.size() == 0) {
-            throw new SdxL2Exception(String.format(errorRemoveSdxL2CP, sdxl2cp));
+            throw new SdxL2Exception(String.format(ERROR_SDX_REMOVE_CP_MISSING, sdxl2cp));
         }
 
-        for (SdxL2ConnectionPoint sdxl2cpTemp : sdxl2cpsTempByName) {
-            sdxL2CPs.remove(sdxl2cpTemp);
-        }
-
+        sdxl2cpsTempByName.forEach(sdxl2cpTemp -> sdxL2CPs.remove(sdxl2cpTemp));
     }
 
     @Override
@@ -290,7 +276,7 @@
                 .filter(sdxl2cp_temp -> sdxl2cp_temp.name().equals(sdxl2cp)).findFirst().orElse(null);
 
         if (sdxl2cpTemp == null) {
-            throw new SdxL2Exception(String.format(errorGetSdxL2CP, sdxl2cp));
+            throw new SdxL2Exception(String.format(ERROR_SDX_GET_CP_MISSING, sdxl2cp));
         }
 
         return sdxl2cpTemp;
@@ -306,21 +292,21 @@
             String[] splitted = vctemp.split("~");
 
             if (splitted.length != 2) {
-                throw new SdxL2Exception(String.format(errorVCKey, "add", vctemp));
+                throw new SdxL2Exception(String.format(ERROR_VC_KEY, "add", vctemp));
             }
 
             if (!(!sdxl2cplhs.toString().equals(splitted[0]) &&
                     !sdxl2cplhs.toString().equals(splitted[1]) &&
                     !sdxl2cprhs.toString().equals(splitted[0]) &&
                     !sdxl2cprhs.toString().equals(splitted[1]))) {
-                throw new SdxL2Exception(String.format(errorAddVCOverlap, vctemp));
+                throw new SdxL2Exception(String.format(ERROR_VC_ADD_OVERLAP, vctemp));
             }
         }
 
         String cps = sdxl2cplhs.toString().compareTo(sdxl2cprhs.toString()) < 0 ?
                 format(SdxL2VCManager.SDXL2_CPS_FORMAT, sdxl2cplhs, sdxl2cprhs) :
                 format(SdxL2VCManager.SDXL2_CPS_FORMAT, sdxl2cprhs, sdxl2cplhs);
-        String name = sdxl2cplhs.name().compareTo(sdxl2cprhs.name().toString()) < 0 ?
+        String name = sdxl2cplhs.name().compareTo(sdxl2cprhs.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, sdxl2, sdxl2cplhs.name(), sdxl2cprhs.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, sdxl2, sdxl2cprhs.name(), sdxl2cplhs.name());
         sdxL2VCs.put(cps, name);
@@ -329,28 +315,25 @@
     @Override
     public void removeVC(SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs)
             throws SdxL2Exception {
-
         String cps = sdxl2cplhs.toString().compareTo(sdxl2cprhs.toString()) < 0 ?
                 format(SdxL2VCManager.SDXL2_CPS_FORMAT, sdxl2cplhs, sdxl2cprhs) :
                 format(SdxL2VCManager.SDXL2_CPS_FORMAT, sdxl2cprhs, sdxl2cplhs);
         String name = sdxL2VCs.remove(cps);
         if (name == null) {
-            throw new SdxL2Exception(String.format(errorRemoveVC));
+            throw new SdxL2Exception(ERROR_VC_REMOVE_MISSING);
         }
     }
 
     @Override
     public void removeVC(SdxL2ConnectionPoint cp) throws SdxL2Exception {
-
         Set<String> vcs = ImmutableSet.copyOf(sdxL2VCs.keySet()
                                                       .parallelStream()
                                                       .filter((vctemp -> vctemp.contains(cp.toString())))
                                                       .collect(Collectors.toSet()));
-
         for (String vctemp : vcs) {
             String[] splitted = vctemp.split("~");
             if (splitted.length != 2) {
-                throw new SdxL2Exception(String.format(errorVCKey, "delete", vctemp));
+                throw new SdxL2Exception(String.format(ERROR_VC_KEY, "delete", vctemp));
             }
             if (cp.toString().equals(splitted[0]) || cp.toString().equals(splitted[1])) {
                 sdxL2VCs.remove(vctemp);
@@ -360,10 +343,9 @@
 
     @Override
     public void removeVCs(String sdxl2) {
-
         Set<Map.Entry<String, String>> vcsToRemove = sdxL2VCs.entrySet().parallelStream().filter(key_value -> {
             String[] fields = key_value.getValue().split(":");
-            return fields.length == 2 && fields[0].equals(sdxl2) ? true : false;
+            return fields.length == 2 && fields[0].equals(sdxl2);
         }).collect(Collectors.toSet());
 
         vcsToRemove.forEach(key_value -> sdxL2VCs.remove(key_value.getKey()));
@@ -380,7 +362,7 @@
                 encoded_cps -> encoded_cps.equals(cps)).findFirst().orElse(null);
 
         if (encodedvc == null) {
-            throw new SdxL2Exception(String.format(errorRemoveVCAux,
+            throw new SdxL2Exception(String.format(ERROR_VC_MISSING,
                                                    sdxl2cplhs.name(), sdxl2cprhs.name()));
         }
         return encodedvc;
@@ -389,14 +371,12 @@
     @Override
     public Set<String> getVCs(Optional<String> sdxl2) {
         if (sdxl2.isPresent()) {
-            Set<String> vcs = ImmutableSet.copyOf(sdxL2VCs.values())
+            return ImmutableSet.copyOf(sdxL2VCs.values())
                     .parallelStream()
                     .filter(vc -> {
                         String[] parts = vc.split(":");
                         return parts.length == 2 && parts[0].equals(sdxl2.get());
                     }).collect(Collectors.toSet());
-
-            return vcs;
         }
         return ImmutableSet.copyOf(sdxL2VCs.values());
     }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MacVCManager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MacVCManager.java
index 5a76979..b3bb1ce 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MacVCManager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MacVCManager.java
@@ -49,7 +49,7 @@
     private static String errorMacEqual = "VC cannot be %s: same mac addresses on both sides";
 
     /**
-     * Creates an SDX-L2 MAC VC Manager.
+     * Creates a SDX-L2 MAC-based VC Manager.
      *
      * @param sdxl2id application ID
      * @param store reference to the SDX-L2 store
@@ -70,7 +70,7 @@
         Key key;
 
         if (ingress.vlanIds().size() == egress.vlanIds().size()) {
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
             if (ingress.vlanIds().size() == 0) {
                 selector = buildSelector(ingress.macAddress(),
                                          egress.macAddress(),
@@ -112,7 +112,7 @@
                                         .egressPoint(egress.connectPoint())
                                         .priority(PRIORITY_OFFSET)
                                         .build());
-                    index = index + 1;
+                    index += 1;
                 }
             }
             return intents;
@@ -120,7 +120,7 @@
 
         if (ingress.vlanIds().size() == 1 && egress.vlanIds().size() == 0) {
             Iterator<VlanId> ingressTags = ingress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
             selector = buildSelector(ingress.macAddress(),
                                      egress.macAddress(),
                                      null,
@@ -144,7 +144,7 @@
 
         if (ingress.vlanIds().size() == 0 && egress.vlanIds().size() == 1) {
             Iterator<VlanId> egressTags = egress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
             selector = buildSelector(ingress.macAddress(),
                                      egress.macAddress(),
                                      null,
@@ -165,9 +165,7 @@
                                 .build());
             return intents;
         }
-
-        log.warn(String.format(errorCreateIntents, ingress.name(), egress.name()));
-
+        log.warn(String.format(ERROR_CREATE_INTENTS, ingress.name(), egress.name()));
         return intents;
     }
 
@@ -199,25 +197,38 @@
         super.removeVC(cp);
     }
 
+    /**
+     * Determines whether a MAC address is empty or not.
+     *
+     * @param mac MacAddress object
+     * @return boolean indicating whether MAC is empty (true) or not
+     */
     private boolean isNullMac(MacAddress mac) {
         return mac.equals(MacAddress.ZERO);
     }
 
-    private TrafficSelector buildSelector(MacAddress ingressMac,
+    /**
+     * Returns the traffic selector, used in the definition of the intents.
+     *
+     * @param ingressMac Input MAC address
+     * @param egressMac Output MAC address
+     * @param etherType name of the Ethernet type used (e.g. of SDX-L2)
+     * @param ingressTag VLAN id used at the ingress
+     * @return TrafficSelector object
+     */
+    protected TrafficSelector buildSelector(MacAddress ingressMac,
                                           MacAddress egressMac,
-                                          Short ethertype,
-                                          VlanId ingresstag) {
-
+                                          Short etherType,
+                                          VlanId ingressTag) {
         TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
         selectorBuilder.matchEthSrc(ingressMac);
         selectorBuilder.matchEthDst(egressMac);
-        if (ethertype != null) {
-            selectorBuilder.matchEthType(ethertype);
+        if (etherType != null) {
+            selectorBuilder.matchEthType(etherType);
         }
-        if (ingresstag != null) {
-            selectorBuilder.matchVlanId(ingresstag);
+        if (ingressTag != null) {
+            selectorBuilder.matchVlanId(ingressTag);
         }
         return selectorBuilder.build();
     }
-
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Manager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Manager.java
index 69b3510..6e633a7 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Manager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Manager.java
@@ -20,10 +20,10 @@
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Modified;
+import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Property;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.ICMP6;
 import org.onlab.packet.IPv6;
@@ -31,13 +31,10 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
 import org.onosproject.net.edge.EdgePortService;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentService;
-import org.onosproject.net.intent.IntentState;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.packet.InboundPacket;
 import org.onosproject.net.packet.PacketContext;
@@ -49,7 +46,6 @@
 
 import java.util.Collections;
 import java.util.Dictionary;
-import java.util.Iterator;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -78,7 +74,7 @@
             "Cannot create VC when CPs have different number of VLANs";
     private static final String ERROR_ADD_VC_VLANS_CLI =
             "\u001B[0;31mError executing command: " + ERROR_ADD_VC_VLANS + "\u001B[0;49m";
-    private static final String VC_0 = "MAC";
+    private static final String VC_0 = VirtualCircuitMechanism.MAC;
     @Property(name = "VirtualCircuitType", value = VC_0, label = "Tunnel mechanism for Virtual Circuits")
     private String vcType = VC_0;
     private String previousvcType = vcType;
@@ -87,21 +83,21 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected SdxL2Store sdxL2Store;
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected CoreService coreService;
+    private CoreService coreService;
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected IntentService intentService;
+    private IntentService intentService;
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected EdgePortService edgePortService;
+    private EdgePortService edgePortService;
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected ComponentConfigService cfgService;
+    private ComponentConfigService cfgService;
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected PacketService packetService;
+    private PacketService packetService;
 
-    protected SdxL2Processor processor = new SdxL2Processor();
+    private SdxL2Processor processor = new SdxL2Processor();
     protected ApplicationId appId;
-    protected SdxL2MonitoringService monitoringManager;
-    protected SdxL2ArpNdpHandler arpndpHandler;
-    protected SdxL2VCService vcManager;
+    private SdxL2MonitoringService monitoringManager;
+    private SdxL2ArpNdpHandler arpndpHandler;
+    SdxL2VCService vcManager;
 
 
     /**
@@ -131,6 +127,10 @@
         log.info("Stopped");
     }
 
+    /**
+     * Modifies the implementation of the SDX-L2 service.
+     * @param context ComponentContext object
+     */
     @Modified
     public void modified(ComponentContext context) {
         readComponentConfiguration(context);
@@ -138,25 +138,6 @@
     }
 
     /**
-     * Determines if the currently used VC is active or not.
-     *
-     * @return Boolean value indicating whether VC is active (true) or not (false).
-     */
-    private boolean isCircuitActive() {
-        Iterator<Intent> intents = intentService.getIntents().iterator();
-        Intent intent;
-        while (intents.hasNext()) {
-            intent = intents.next();
-            if (intent.appId().equals(this.appId) &&
-                    intentService.getIntentState(intent.key()) == IntentState.INSTALLED) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if property name is defined and set to True.
      *
      * @param properties properties to be looked up
@@ -170,9 +151,9 @@
             String s = (String) properties.get(propertyName);
             value = isNullOrEmpty(s) ? null : s.trim();
             if (value != null &&
-                    !value.equals("MAC") &&
-                    !value.equals("VLAN") &&
-                    !value.equals("MPLS")) {
+                    !value.equals(VirtualCircuitMechanism.MAC) &&
+                    !value.equals(VirtualCircuitMechanism.VLAN) &&
+                    !value.equals(VirtualCircuitMechanism.MPLS)) {
                 value = null;
             }
         } catch (ClassCastException e) {
@@ -195,7 +176,7 @@
                              "using current value {}", vcType);
         } else {
             vcType = tunnel;
-            log.info("Configured. Tunnel mechanism is {}", vcType);
+            log.info("Configured. Tunnel mechanism set to {}", vcType);
         }
     }
 
@@ -207,11 +188,6 @@
             log.info("Tunnel mechanism has not been changed");
             return;
         }
-        if (isCircuitActive()) {
-            log.info("Change of tunnels not allowed - there are active circuits");
-            vcType = previousvcType;
-            return;
-        }
         previousvcType = vcType;
         SdxL2ArpNdpHandler.setVcType(vcType);
         vcManager = buildVCManager();
@@ -226,23 +202,24 @@
     private SdxL2VCService buildVCManager() {
         SdxL2VCService manager;
         switch (vcType) {
-            case "MAC":
-                manager = new SdxL2MacVCManager(appId, sdxL2Store, intentService);
-                break;
-            case "MPLS":
+            case VirtualCircuitMechanism.MPLS:
                 manager = new SdxL2MplsVCManager(appId, sdxL2Store, intentService);
                 break;
-            default:
-            case "VLAN":
+            case VirtualCircuitMechanism.VLAN:
                 manager = new SdxL2VlanVCManager(appId, sdxL2Store, intentService);
                 break;
+            default:
+                log.info(String.format("Chosen tunnel mechanism does not exist. " +
+                                               "Switching to %s", VirtualCircuitMechanism.MAC));
+            case VirtualCircuitMechanism.MAC:
+                manager = new SdxL2MacVCManager(appId, sdxL2Store, intentService);
+                break;
         }
         return manager;
     }
 
     @Override
     public void createSdxL2(String sdxl2) {
-
         checkNotNull(sdxl2, "sdxl2 name cannot be null");
         checkState(!sdxl2.contains(","), "sdxl2 names cannot contain commas");
         checkState(!sdxl2.contains("|"), "sdxl2 names cannot contain pipe");
@@ -258,15 +235,13 @@
 
     @Override
     public void deleteSdxL2(String sdxl2) {
-
         checkNotNull(sdxl2, "sdxl2 name cannot be null");
-
+        this.vcManager.removeVCs(sdxl2);
         try {
             this.sdxL2Store.removeSdxL2(sdxl2);
         } catch (SdxL2Exception e) {
             log.info(e.getMessage());
         }
-
     }
 
     @Override
@@ -276,41 +251,38 @@
 
     @Override
     public void addSdxL2ConnectionPoint(String sdxl2, SdxL2ConnectionPoint sdxl2cp) {
-
         checkNotNull(sdxl2, "sdxl2 name cannot be null");
         checkNotNull(sdxl2cp, "SdxL2ConnectionPoint cannot be null");
-
         try {
             this.sdxL2Store.addSdxL2ConnectionPoint(sdxl2, sdxl2cp);
         } catch (SdxL2Exception e) {
             log.info(e.getMessage());
         }
-
     }
 
     @Override
     public Set<String> getSdxL2ConnectionPoints(Optional<String> sdxl2) {
-
         try {
             return this.sdxL2Store.getSdxL2ConnectionPoints(sdxl2);
         } catch (SdxL2Exception e) {
             log.info(e.getMessage());
         }
-
         return Collections.emptySet();
     }
 
     @Override
     public void removeSdxL2ConnectionPoint(String sdxl2cp) {
-
         checkNotNull(sdxl2cp, "SdxL2ConnectionPoint name cannot be null");
-
+        // If the CP is removed, the VC will not be active anymore -> delete
+        SdxL2ConnectionPoint cp = this.getSdxL2ConnectionPoint(sdxl2cp);
+        if (cp != null) {
+            this.vcManager.removeVC(cp);
+        }
         try {
             this.sdxL2Store.removeSdxL2ConnectionPoint(sdxl2cp);
         } catch (SdxL2Exception e) {
             log.info(e.getMessage());
         }
-
     }
 
     @Override
@@ -418,7 +390,7 @@
     @Override
     public void cleanSdxL2() {
         Set<String> sdxl2s = this.getSdxL2s();
-        sdxl2s.forEach(sdxl2 -> this.deleteSdxL2(sdxl2));
+        sdxl2s.forEach(this::deleteSdxL2);
     }
 
     /**
@@ -443,28 +415,28 @@
                 DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_ARP);
         packetService.requestPackets(selectorBuilder.build(),
-                                     CONTROL, appId, Optional.<DeviceId>empty());
+                                     CONTROL, appId, Optional.empty());
 
-        // IPv6 Neighbor Solicitation packet.
+        // IPv6 Neighbor Solicitation packet
         selectorBuilder = DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_IPV6);
         selectorBuilder.matchIPProtocol(PROTOCOL_ICMP6);
         selectorBuilder.matchIcmpv6Type(NEIGHBOR_SOLICITATION);
         packetService.requestPackets(selectorBuilder.build(),
-                                     CONTROL, appId, Optional.<DeviceId>empty());
+                                     CONTROL, appId, Optional.empty());
 
-        // IPv6 Neighbor Advertisement packet.
+        // IPv6 Neighbor Advertisement packet
         selectorBuilder = DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_IPV6);
         selectorBuilder.matchIPProtocol(PROTOCOL_ICMP6);
         selectorBuilder.matchIcmpv6Type(NEIGHBOR_ADVERTISEMENT);
         packetService.requestPackets(selectorBuilder.build(),
-                                     CONTROL, appId, Optional.<DeviceId>empty());
+                                     CONTROL, appId, Optional.empty());
     }
 
     /**
      * Withdraws the requests for ARP/NDP packets and
-     * unregisters the SDX-L2 PacketProcessor.
+     * un-registers the SDX-L2 PacketProcessor.
      */
     private void unhandleArpNdp() {
         arpndpHandler = null;
@@ -475,25 +447,26 @@
                 DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_ARP);
         packetService.cancelPackets(selectorBuilder.build(),
-                                    CONTROL, appId, Optional.<DeviceId>empty());
+                                    CONTROL, appId, Optional.empty());
 
         selectorBuilder = DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_IPV6);
         selectorBuilder.matchIPProtocol(PROTOCOL_ICMP6);
         selectorBuilder.matchIcmpv6Type(NEIGHBOR_SOLICITATION);
         packetService.cancelPackets(selectorBuilder.build(),
-                                    CONTROL, appId, Optional.<DeviceId>empty());
+                                    CONTROL, appId, Optional.empty());
 
         selectorBuilder = DefaultTrafficSelector.builder();
         selectorBuilder.matchEthType(TYPE_IPV6);
         selectorBuilder.matchIPProtocol(PROTOCOL_ICMP6);
         selectorBuilder.matchIcmpv6Type(NEIGHBOR_ADVERTISEMENT);
         packetService.cancelPackets(selectorBuilder.build(),
-                                    CONTROL, appId, Optional.<DeviceId>empty());
+                                    CONTROL, appId, Optional.empty());
     }
 
     /**
      * Packet processor responsible for forwarding packets along their paths.
+     * Adapted from onos/apps/proxyarp packet handling.
      */
     private class SdxL2Processor implements PacketProcessor {
 
@@ -505,9 +478,8 @@
         @Override
         public void process(PacketContext context) {
 
-            /** Stop processing if the packet has been handled, since we
-             * can't do any more to it
-             */
+            // Stop processing if the packet has been handled, since we
+            // cannot do any more to it
             if (context.isHandled()) {
                 return;
             }
@@ -520,7 +492,7 @@
 
             boolean handled = false;
             if (ethPkt.getEtherType() == TYPE_ARP) {
-                //handle the arp packet.
+                // Handle the ARP packet
                 handled = arpndpHandler.handlePacket(context);
             } else if (ethPkt.getEtherType() == TYPE_IPV6) {
                 IPv6 ipv6Pkt = (IPv6) ethPkt.getPayload();
@@ -528,7 +500,7 @@
                     ICMP6 icmp6Pkt = (ICMP6) ipv6Pkt.getPayload();
                     if (icmp6Pkt.getIcmpType() == NEIGHBOR_SOLICITATION ||
                             icmp6Pkt.getIcmpType() == NEIGHBOR_ADVERTISEMENT) {
-                        // handle ICMPv6 solicitations and advertisements
+                        // Handle ICMPv6 solicitations and advertisements
                         handled = arpndpHandler.handlePacket(context);
                     }
                 }
@@ -538,6 +510,13 @@
                 context.block();
             }
 
+            // XXX why were we listening to IPv4 frames at all?
+            // Do not ARP for multicast packets.  Let mfwd handle them.
+            if (ethPkt.getEtherType() == Ethernet.TYPE_IPV4) {
+                if (ethPkt.getDestinationMAC().isMulticast()) {
+                    return;
+                }
+            }
         }
     }
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MonitoringManager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MonitoringManager.java
index 734cbdc..9eaa0fd 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MonitoringManager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MonitoringManager.java
@@ -41,7 +41,7 @@
 public class SdxL2MonitoringManager implements SdxL2MonitoringService {
 
     private static Logger log = LoggerFactory.getLogger(SdxL2MonitoringManager.class);
-    protected ApplicationId appId;
+    private ApplicationId appId;
     private final IntentService intentService;
     private final EdgePortService edgePortService;
 
@@ -49,6 +49,7 @@
      * It is a local cache for the Intents' events.
      */
     private ConcurrentMap<Key, IntentEvent> intentsState;
+
     /**
      * Last time intentsState has been updated.
      */
@@ -58,12 +59,15 @@
      * It is a local cache for the edge ports related events.
      */
     private ConcurrentMap<ConnectPoint, EdgePortEvent> edgeportsState;
+
     /**
      * Last time edgeportsState has been updated.
      */
     private long lastEdgePortUpdate;
 
-    // A kind of timeout which causes a manual update.
+    /**
+     * A kind of timeout which causes a manual update.
+     */
     private static int deltaUpdate = 60000;
 
     private InternalIntentListener intentListener;
@@ -77,7 +81,6 @@
      * @param edgePortService reference to the EdgePort service.
      */
     public SdxL2MonitoringManager(ApplicationId sdxl2id, IntentService intentService, EdgePortService edgePortService) {
-
         this.appId = sdxl2id;
         this.intentListener = new InternalIntentListener();
         this.edgePortListener = new InternalEdgePortListener();
@@ -94,7 +97,6 @@
         this.lastIntentUpdate = 0;
 
         log.info("Started");
-
     }
 
     /**
@@ -165,6 +167,9 @@
         return state;
     }
 
+    /**
+     * Implementation of listener to account for changes on intents.
+     */
     private class InternalIntentListener implements IntentListener {
 
         /**
@@ -237,6 +242,9 @@
         return type == EdgePortEvent.Type.EDGE_PORT_ADDED ? SdxL2State.ONLINE : SdxL2State.OFFLINE;
     }
 
+    /**
+     * Implementation of listener to account for changes on edge ports.
+     */
     private class InternalEdgePortListener implements EdgePortListener {
 
         /**
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MplsVCManager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MplsVCManager.java
index 3a6c33d..e6c4081 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MplsVCManager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2MplsVCManager.java
@@ -49,7 +49,7 @@
     // TODO Remember to create two intents: one for IPv4 and one for IPv6
 
     /**
-     * Creates an SDX-L2 MPLS VC Manager.
+     * Creates a SDX-L2 MPLS VC Manager.
      *
      * @param sdxl2id application ID
      * @param store reference to the SDX-L2 store
@@ -73,7 +73,7 @@
         Key key;
 
         if (ingress.vlanIds().size() == egress.vlanIds().size()) {
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
             if (ingress.vlanIds().size() == 0) {
 
                 selector = buildSelector(null, null);
@@ -116,7 +116,7 @@
                                         .egressPoint(egress.connectPoint())
                                         .priority(PRIORITY_OFFSET)
                                         .build());
-                    index = index + 1;
+                    index += 1;
                 }
 
             }
@@ -126,7 +126,7 @@
         if (ingress.vlanIds().size() == 1 && egress.vlanIds().size() == 0) {
 
             Iterator<VlanId> ingressTags = ingress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
 
             selector = buildSelector(null, ingressTags.next());
             treatment = buildTreatment(null,
@@ -154,7 +154,7 @@
         if (ingress.vlanIds().size() == 0 && egress.vlanIds().size() == 1) {
 
             Iterator<VlanId> egressTags = egress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
 
             selector = buildSelector(null, null);
             treatment = buildTreatment(null,
@@ -177,7 +177,7 @@
             return intents;
         }
 
-        log.warn(String.format(errorCreateIntents, ingress.name(), egress.name()));
+        log.warn(String.format(ERROR_CREATE_INTENTS, ingress.name(), egress.name()));
 
         return intents;
     }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Service.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Service.java
index 8601abb..30703be 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Service.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Service.java
@@ -51,7 +51,7 @@
     Set<String> getSdxL2s();
 
     /**
-     * Adds a Connection Point to an SDX-L2.
+     * Adds a Connection Point to a SDX-L2.
      *
      * @param sdxl2 name of SDX-L2
      * @param sdxl2cp SDX-L2 Connection Point object
@@ -68,7 +68,7 @@
     Set<String> getSdxL2ConnectionPoints(Optional<String> sdxl2);
 
     /**
-     * Removes a Connection Point from an SDX-L2.
+     * Removes a Connection Point from a SDX-L2.
      *
      * @param sdxl2cp name of SDX-L2 Connection Point
      */
@@ -84,14 +84,14 @@
     void addVC(String sdxl2, String sdxl2cplhs, String sdxl2cprhs);
 
     /**
-     * Deletes a Virtual Circuit between Connection Points in an SDX-L2.
+     * Deletes a Virtual Circuit between Connection Points in a SDX-L2.
      *
      * @param vc name of SDX-L2 VC
      */
     void removeVC(String vc);
 
     /**
-     * Returns a Connection Point in an SDX-L2.
+     * Returns a Connection Point in a SDX-L2.
      *
      * @param sdxl2cp name of SDX-L2 Connection Point
      * @return the relative SdxL2ConnectionPoint object
@@ -99,7 +99,7 @@
     SdxL2ConnectionPoint getSdxL2ConnectionPoint(String sdxl2cp);
 
     /**
-     * Returns all the Virtual Circuits in an SDX-L2.
+     * Returns all the Virtual Circuits in a SDX-L2.
      *
      * @param sdxl2 name of SDX-L2
      * @return set of Virtual Circuits names
@@ -107,7 +107,7 @@
     Set<String> getVirtualCircuits(Optional<String> sdxl2);
 
     /**
-     * Returns a Virtual Circuit in an SDX-L2.
+     * Returns a Virtual Circuit in a SDX-L2.
      *
      * @param sdxl2vc name of the SDX-L2 VC
      * @return the relative VirtualCircuit object
@@ -134,5 +134,4 @@
      * Cleans the state of the Application.
      */
     void cleanSdxL2();
-
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Store.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Store.java
index 0c465ee..b824b23 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Store.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2Store.java
@@ -48,7 +48,7 @@
     Set<String> getSdxL2s();
 
     /**
-     * Adds a Connection Point to an SDX-L2.
+     * Adds a Connection Point to a SDX-L2.
      *
      * @param sdxl2 name of SDX-L2
      * @param connectionPoint SDX-L2 cCnnection Point object
@@ -58,7 +58,7 @@
 
     /**
      * Returns all the SDX-L2 connection points names or the SDX-L2 connection points name
-     * that are related to an SDX-L2.
+     * that are related to a SDX-L2.
      *
      * @param sdxl2 name of the SDX-L2 (optional)
      * @return a set of SDX-L2 connection points names, the result depends on the input parameter;
@@ -67,7 +67,7 @@
     Set<String> getSdxL2ConnectionPoints(Optional<String> sdxl2) throws SdxL2Exception;
 
     /**
-     * Removes a named Connection Point in an SDX-L2.
+     * Removes a named Connection Point in a SDX-L2.
      *
      * @param sdxl2cp name of Connection Point
      * @throws SdxL2Exception if SDX-L2 Connection Point does not exist
@@ -92,17 +92,17 @@
      * @throws SdxL2Exception if SDX-L2 VC cannot be added
      */
     void addVC(String sdxl2, SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs)
-            throws SdxL2Exception;;
+            throws SdxL2Exception;
 
     /**
-     * Deletes a Virtual Circuit between Connection Points in an SDX-L2.
+     * Deletes a Virtual Circuit between Connection Points in a SDX-L2.
      *
      * @param sdxl2cplhs name of SDX-L2 CP, left hand side of the VC
      * @param sdxl2cprhs ame of SDX-L2 CP, right hand side of the VC
      * @throws SdxL2Exception if no name is provided for VC
      */
     void removeVC(SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs)
-            throws SdxL2Exception;;
+            throws SdxL2Exception;
 
     /**
      * Deletes a Virtual Circuit where a given SDX-L2 CP acts as endpoint.
@@ -110,7 +110,7 @@
      * @param cp Connection Point
      * @throws SdxL2Exception if appropriate VC identifier is not provided
      */
-    void removeVC(SdxL2ConnectionPoint cp) throws SdxL2Exception;;
+    void removeVC(SdxL2ConnectionPoint cp) throws SdxL2Exception;
 
     /**
      * Removes all Virtual Circuits created in a given SDX-L2.
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCManager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCManager.java
index 1d4d4e1..18d53aa 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCManager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCManager.java
@@ -34,7 +34,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 
@@ -49,22 +48,22 @@
 
     private static Logger log = LoggerFactory.getLogger(SdxL2VCManager.class);
 
-    protected static final String MATCH_FORMAT = "%s-%s";
     protected static final String NAME_FORMAT = "%s:%s-%s";
     protected static final String SDXL2_CPS_FORMAT = "%s~%s";
-    protected static final String KEY_FORMAT = "%s,%s";
+    private static final String KEY_FORMAT = "%s,%s";
 
     protected ApplicationId appId;
     protected SdxL2Store sdxL2Store;
     protected IntentService intentService;
+    private SdxL2ConnectionPointMatcher matcher;
 
-    private static String errorIntentsForward = "Unable to create forward Intents";
-    private static String errorIntentsReverse = "Unable to create reverse Intents";
-    protected static String errorCreateIntents = "Unable to create Intents for %s-%s";
+    private static final String ERROR_INTENTS_FORWARD = "Unable to create forward Intents";
+    private static final String ERROR_INTENTS_REVERSE = "Unable to create reverse Intents";
+    protected static final String ERROR_CREATE_INTENTS = "Unable to create Intents for %s-%s";
 
 
     /**
-     * Creates an SDX-L2 VC Manager.
+     * Creates a SDX-L2 VC Manager.
      *
      * @param sdxl2id application ID
      * @param store reference to the SDX-L2 store
@@ -77,6 +76,7 @@
         this.appId = sdxl2id;
         this.sdxL2Store = store;
         this.intentService = intentService;
+        this.matcher = new SdxL2ConnectionPointMatcher(sdxl2id);
     }
 
     @Override
@@ -89,21 +89,19 @@
 
             if (intentsFW == null) {
                 System.err.println("\u001B[0;31mError executing command: "
-                                           + errorIntentsForward + "\u001B[0;49m");
+                                           + ERROR_INTENTS_FORWARD + "\u001B[0;49m");
                 return;
             }
             if (intentsRV == null) {
                 System.err.println("\u001B[0;31mError executing command: "
-                                           + errorIntentsReverse + "\u001B[0;49m");
+                                           + ERROR_INTENTS_REVERSE + "\u001B[0;49m");
                 return;
             }
 
-            List<Intent> intents = new ArrayList<Intent>();
+            List<Intent> intents = new ArrayList<>();
             intents.addAll(intentsFW);
             intents.addAll(intentsRV);
-            intents.forEach(intent -> {
-                intentService.submit(intent);
-            });
+            intents.forEach(intent -> intentService.submit(intent));
         } catch (SdxL2Exception e) {
             log.error(e.getMessage());
         }
@@ -114,8 +112,8 @@
         try {
             this.sdxL2Store.removeVC(sdxl2cplhs, sdxl2cprhs);
             Iterables.filter(intentService.getIntents(), intent ->
-                    (matches(sdxl2cplhs, sdxl2cprhs, intent) ||
-                            (matches(sdxl2cprhs, sdxl2cplhs, intent))))
+                    (matcher.matches(sdxl2cplhs, sdxl2cprhs, intent) ||
+                            (matcher.matches(sdxl2cprhs, sdxl2cplhs, intent))))
                     .forEach(intentService::withdraw);
         } catch (SdxL2Exception e) {
             log.error(e.getMessage());
@@ -126,7 +124,7 @@
     public void removeVC(SdxL2ConnectionPoint cp) {
         try {
             this.sdxL2Store.removeVC(cp);
-            Iterables.filter(intentService.getIntents(), intent -> (matches(cp, intent)))
+            Iterables.filter(intentService.getIntents(), intent -> (matcher.matches(cp, intent)))
                     .forEach(intentService::withdraw);
         } catch (SdxL2Exception e) {
             log.error(e.getMessage());
@@ -146,83 +144,14 @@
         throw new NotImplementedException("buildIntents not implemented");
     }
 
-    /**
-     * Matches an intent given two SDX-L2 connection points.
-     *
-     * @param sdxl2cplhs left hand side of the virtual circuit
-     * @param sdxl2cprhs right hand side of the virtual circuit
-     * @param intent     intent to match
-     * @return result of the match
-     */
-    protected boolean matches(SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs, Intent intent) {
-        if (!Objects.equals(appId, intent.appId())) {
-            // different app ids
-            return false;
-        }
-
-        String key = intent.key().toString();
-        String[] fields = key.split(":");
-        String cps = format(MATCH_FORMAT, sdxl2cplhs.name(), sdxl2cprhs.name());
-
-        return fields.length == 2 && fields[1].contains(cps);
-    }
-
-    /**
-     * Matches an intent given an SDX-L2 Connection Point.
-     *
-     * @param cp hand side of a Virtual Circuit
-     * @param intent intent to match
-     * @return result of the match
-     */
-    protected boolean matches(SdxL2ConnectionPoint cp, Intent intent) {
-        if (!Objects.equals(appId, intent.appId())) {
-            // different app ids
-            return false;
-        }
-
-        String key = intent.key().toString();
-        String[] fields = key.split(":");
-
-        if (fields.length != 2) {
-            return false;
-        }
-        String[] cps = fields[1].split(",");
-
-        if (cps.length != 2) {
-            return false;
-        }
-        String[] hss = cps[0].split("-");
-
-        return hss.length == 2 && (hss[0].equals(cp.name()) || hss[1].equals(cp.name()));
-    }
-
     @Override
     public void removeVCs(String sdxl2) {
         this.sdxL2Store.removeVCs(sdxl2);
-        Iterables.filter(intentService.getIntents(), intent -> (matches(sdxl2, intent)))
+        Iterables.filter(intentService.getIntents(), intent -> (matcher.matches(sdxl2, intent)))
                 .forEach(intentService::withdraw);
 
     }
 
-    /**
-     * Matches an intent given an SDX-L2 Connection Point.
-     *
-     * @param sdxl2 name of SDX-L2
-     * @param intent intent to match
-     * @return result of the match
-     */
-    protected boolean matches(String sdxl2, Intent intent) {
-        if (!Objects.equals(appId, intent.appId())) {
-            // different app ids
-            return false;
-        }
-
-        String key = intent.key().toString();
-        String[] fields = key.split(":");
-
-        return fields.length == 2 && fields[0].equals(sdxl2);
-    }
-
     @Override
     public Set<String> getVCs(Optional<String> sdxl2) {
         return this.sdxL2Store.getVCs(sdxl2);
@@ -242,14 +171,14 @@
      * Returns Intent key from SDX-L2 and two SDX-L2 Connection Points.
      *
      * @param sdxl2 name of SDX-L2
-     * @param cpone sdxl2 connection point one
-     * @param cptwo sdxl2 connection point two
+     * @param cpOne sdxl2 connection point one
+     * @param cpTwo sdxl2 connection point two
      * @param index digit used to help identify Intent
      * @return canonical intent string key
      */
-    protected Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpone,
-                                    SdxL2ConnectionPoint cptwo, String index) {
-        String cps = format(NAME_FORMAT, sdxl2, cpone.name(), cptwo.name());
+    protected Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpOne,
+                                    SdxL2ConnectionPoint cpTwo, String index) {
+        String cps = format(NAME_FORMAT, sdxl2, cpOne.name(), cpTwo.name());
         String key = format(KEY_FORMAT, cps, index);
         return Key.of(key, appId);
     }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCService.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCService.java
index 6f65b8b..6b1d8ec 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCService.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VCService.java
@@ -35,7 +35,7 @@
     void addVC(String sdxl2, SdxL2ConnectionPoint sdxl2cplhs, SdxL2ConnectionPoint sdxl2cprhs);
 
     /**
-     * Deletes a Virtual Circuit from an SDX-L2.
+     * Deletes a Virtual Circuit from a SDX-L2.
      *
      * @param sdxl2cplhs name of SDX-L2 CP, left hand side of the VC
      * @param sdxl2cprhs name of SDX-L2 CP, right hand side of the VC
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VlanVCManager.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VlanVCManager.java
index ddf6896..dcb4122 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VlanVCManager.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2VlanVCManager.java
@@ -47,7 +47,7 @@
     private static Logger log = LoggerFactory.getLogger(SdxL2VlanVCManager.class);
 
     /**
-     * Creates an SDX-L2 VLAN VC Manager.
+     * Creates a SDX-L2 VLAN VC Manager.
      *
      * @param sdxl2id application ID
      * @param store reference to the SDX-L2 store
@@ -69,15 +69,12 @@
         Key key;
 
         if (ingress.vlanIds().size() == egress.vlanIds().size()) {
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
             if (ingress.vlanIds().size() == 0) {
-
                 selector = buildSelector(null, null);
                 treatment = DefaultTrafficTreatment.emptyTreatment();
                 encapsulation = buildConstraints();
-
                 key = generateIntentKey(sdxl2, ingress, egress, "1");
-
                 intents.add(PointToPointIntent.builder()
                                     .appId(appId)
                                     .key(key)
@@ -89,20 +86,16 @@
                                     .priority(PRIORITY_OFFSET)
                                     .build());
             } else {
-
                 Iterator<VlanId> ingressTags = ingress.vlanIds().iterator();
                 Iterator<VlanId> egressTags = egress.vlanIds().iterator();
                 int index = 1;
                 while (ingressTags.hasNext()) {
-
                     selector = buildSelector(null, ingressTags.next());
                     treatment = buildTreatment(egressTags.next(),
                                                null,
                                                false);
                     encapsulation = buildConstraints();
-
                     key = generateIntentKey(sdxl2, ingress, egress, String.valueOf(index));
-
                     intents.add(PointToPointIntent.builder()
                                         .appId(appId)
                                         .key(key)
@@ -113,27 +106,21 @@
                                         .egressPoint(egress.connectPoint())
                                         .priority(PRIORITY_OFFSET)
                                         .build());
-                    index = index + 1;
+                    index += 1;
                 }
-
             }
             return intents;
         }
 
         if (ingress.vlanIds().size() == 1 && egress.vlanIds().size() == 0) {
-
             Iterator<VlanId> ingressTags = ingress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
-
+            intents = new ArrayList<>();
             selector = buildSelector(null, ingressTags.next());
             treatment = buildTreatment(null,
                                        null,
                                        true);
             encapsulation = buildConstraints();
-
-
             key = generateIntentKey(sdxl2, ingress, egress, "1");
-
             intents.add(PointToPointIntent.builder()
                                 .appId(appId)
                                 .key(key)
@@ -145,22 +132,18 @@
                                 .priority(PRIORITY_OFFSET)
                                 .build());
             return intents;
-
         }
 
         if (ingress.vlanIds().size() == 0 && egress.vlanIds().size() == 1) {
-
             Iterator<VlanId> egressTags = egress.vlanIds().iterator();
-            intents = new ArrayList<Intent>();
+            intents = new ArrayList<>();
 
             selector = buildSelector(null, null);
             treatment = buildTreatment(null,
                                        egressTags.next(),
                                        false);
             encapsulation = buildConstraints();
-
             key = generateIntentKey(sdxl2, ingress, egress, "1");
-
             intents.add(PointToPointIntent.builder()
                                 .appId(appId)
                                 .key(key)
@@ -173,9 +156,7 @@
                                 .build());
             return intents;
         }
-
-        log.warn(String.format(errorCreateIntents, ingress.name(), egress.name()));
-
+        log.warn(String.format(ERROR_CREATE_INTENTS, ingress.name(), egress.name()));
         return intents;
     }
 
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuit.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuit.java
index 1561382..7191346 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuit.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuit.java
@@ -62,7 +62,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(name, sdxl2cplhs, sdxl2cprhs);
+        return sdxl2cplhs.hashCode() + sdxl2cprhs.hashCode();
     }
 
     @Override
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuitMechanism.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuitMechanism.java
new file mode 100644
index 0000000..da4ed35
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/VirtualCircuitMechanism.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.sdxl2;
+
+/**
+ * Definition of the different types of tunnels used in SDX-L2.
+ */
+final class VirtualCircuitMechanism {
+
+    /**
+     * Empty constructor.
+     */
+    private VirtualCircuitMechanism() {
+    }
+
+    /**
+     * Virtual Circuits using MAC addresses to identify traffic.
+     */
+    protected static final String MAC = "MAC";
+
+    /**
+     * Virtual Circuits using VLAN tags to identify traffic.
+     */
+    protected static final String VLAN = "VLAN";
+
+    /**
+     * Virtual Circuits using MPLS tags to identify traffic.
+     */
+    protected static final String MPLS = "MPLS";
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCPCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCPCommand.java
index ea13441..2f1b399 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCPCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCPCommand.java
@@ -30,24 +30,23 @@
 @Command(scope = "sdxl2", name = "sdxl2cp-add", description = "Creates a named SDX-L2 Connection Point")
 public class SdxL2AddCPCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2",
-            required = true, multiValued = false)
+    @Argument(name = "sdxl2name", description = "Name of SDX-L2",
+            required = true)
     private String sdxl2name = null;
 
     @Argument(index = 1, name = "connectionpoint", description = "Identifier of SDX-L2 Connection point",
-            required = true, multiValued = false)
+            required = true)
     private String cp = null;
 
     @Argument(index = 2, name = "sdxl2cpname", description = "Name of SDX-L2 Connection Point",
-            required = true, multiValued = false)
+            required = true)
     private String sdxl2cpname = null;
 
     @Argument(index = 3, name = "vlans", description = "Customer edge VLANs, separated by dash " +
-            "and comma", required = false, multiValued = false)
+            "and comma")
     private String vlans = null;
 
-    @Option(name = "-ce_mac", description = "Customer edge MAC address",
-            required = false, multiValued = false)
+    @Option(name = "-ce_mac", description = "Customer edge MAC address")
     private String mac = null;
 
     @Override
@@ -56,6 +55,5 @@
         SdxL2ConnectionPoint sdxl2cp = SdxL2ConnectionPoint.sdxl2ConnectionPoint(sdxl2cpname, cp, vlans, mac);
         sdxl2Service.addSdxL2ConnectionPoint(sdxl2name, sdxl2cp);
     }
-
 }
 
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCommand.java
index 4aea7be..5794faf 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddCommand.java
@@ -27,7 +27,7 @@
 @Command(scope = "sdxl2", name = "sdxl2-add", description = "Creates a SDX-L2")
 public class SdxL2AddCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2", required = true, multiValued = false)
+    @Argument(name = "sdxl2name", description = "Name of SDX-L2", required = true)
     private String sdxl2 = null;
 
     @Override
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddVCCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddVCCommand.java
index 2a75e37..cafc82f 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddVCCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2AddVCCommand.java
@@ -28,16 +28,16 @@
         description = "Creates a VC between two Connection Points in the same SDX-L2")
 public class SdxL2AddVCCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2",
-            required = true, multiValued = false)
+    @Argument(name = "sdxl2name", description = "Name of SDX-L2",
+            required = true)
     private String sdxL2name = null;
 
     @Argument(index = 1, name = "lhs", description = "Left hand side Connection Point",
-            required = true, multiValued = false)
+            required = true)
     private String lhs = null;
 
     @Argument(index = 2, name = "rhs", description = "Right hand side Connection Point",
-            required = true, multiValued = false)
+            required = true)
     private String rhs = null;
 
     @Override
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2CleanCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2CleanCommand.java
new file mode 100644
index 0000000..ef1b7ba
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2CleanCommand.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.sdxl2.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.sdxl2.SdxL2Service;
+
+/**
+ * CLI to wipe out the state of the Application.
+ */
+@Command(scope = "sdxl2", name = "sdxl2-clean", description = "Wipes out the state of SDX-L2")
+public class SdxL2CleanCommand extends AbstractShellCommand {
+
+    @Override
+    protected void execute() {
+        SdxL2Service sdxl2Service = get(SdxL2Service.class);
+        sdxl2Service.cleanSdxL2();
+    }
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetCPCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetCPCommand.java
index 779da65..3bd4949 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetCPCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetCPCommand.java
@@ -24,12 +24,12 @@
 import org.onosproject.sdxl2.SdxL2State;
 
 /**
- * CLI to print the details of an SdxL2ConnectionPoint.
+ * CLI to print the details of a SdxL2ConnectionPoint.
  */
-@Command(scope = "sdxl2", name = "sdxl2cp", description = "Prints the details of an SDX-L2 Connection Point")
+@Command(scope = "sdxl2", name = "sdxl2cp", description = "Prints the details of a SDX-L2 Connection Point")
 public class SdxL2GetCPCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2cpname", description = "Name of SDX-L2", required = true, multiValued = false)
+    @Argument(name = "sdxl2cpname", description = "Name of SDX-L2", required = true)
     private String sdxl2cpname = null;
 
     private static final String HEADER       = "\n\u001B[1;37mStatus\t\t" +
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetVCCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetVCCommand.java
index 66efaf7..b957d69 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetVCCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2GetVCCommand.java
@@ -24,24 +24,23 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.Key;
 import org.onosproject.sdxl2.SdxL2ConnectionPoint;
+import org.onosproject.sdxl2.SdxL2ConnectionPointMatcher;
 import org.onosproject.sdxl2.SdxL2Service;
 import org.onosproject.sdxl2.SdxL2State;
 import org.onosproject.sdxl2.VirtualCircuit;
 
 import java.util.Iterator;
 
-import static java.lang.String.format;
-
 /**
- * CLI to print the details of a Virtual Circuit in an SDX-L2.
+ * CLI to print the details of a Virtual Circuit in a SDX-L2.
  */
-@Command(scope = "sdxl2", name = "sdxl2vc", description = "Prints the details of an SDX-L2 Virtual Circuit")
+@Command(scope = "sdxl2", name = "sdxl2vc", description = "Prints the details of a SDX-L2 Virtual Circuit")
 public class SdxL2GetVCCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2vcname", description = "Name of SDX-L2 VC", required = true, multiValued = false)
+    @Argument(name = "sdxl2vcname", description = "Name of SDX-L2 VC",
+            required = true)
     private String sdxl2vcname = null;
 
-    private  static final String MATCH_FORMAT = "%s-%s";
     private static final String HEADER_CP =
             "\n\u001B[1;37mStatus\t\tConnection Point\t\tName\t\tVlan IDs\t\tCE Mac Address\u001B[0m";
     private static final String SEPARATOR_CP = "\u001B[1;37m------------" +
@@ -66,6 +65,7 @@
     @Override
     protected void execute() {
         SdxL2Service sdxl2Service = get(SdxL2Service.class);
+        SdxL2ConnectionPointMatcher matcher = new SdxL2ConnectionPointMatcher();
         VirtualCircuit virtualCircuit;
         SdxL2ConnectionPoint sdxl2ConnectionPoint;
         SdxL2State state;
@@ -122,9 +122,13 @@
         print(HEADER_VC);
         print(SEPARATOR_VC);
         IntentService intentService = get(IntentService.class);
-        Iterator<Intent> intents = Iterables.filter(intentService.getIntents(), intent ->
-                (matches(virtualCircuit.lhs(), virtualCircuit.rhs(), intent) ||
-                        (matches(virtualCircuit.rhs(), virtualCircuit.lhs(), intent)))).iterator();
+        Iterator<Intent> intents = Iterables.filter(
+                intentService.getIntents(), intent ->
+                        (matcher.matches(virtualCircuit.lhs(),
+                                                    virtualCircuit.rhs(), intent) ||
+                                (matcher.matches(virtualCircuit.rhs(),
+                                                            virtualCircuit.lhs(), intent))))
+                .iterator();
         Intent intent;
         Key key;
         while (intents.hasNext()) {
@@ -147,21 +151,4 @@
         }
         print("");
     }
-
-    /**
-     * Matches an intent given two sdxl2 connection points.
-     *
-     * @param lhs    left hand side of the virtual circuit
-     * @param rhs    right hand side of the virtual circuit
-     * @param intent intent to match
-     * @return result of the match
-     */
-    private boolean matches(SdxL2ConnectionPoint lhs, SdxL2ConnectionPoint rhs, Intent intent) {
-
-        String key = intent.key().toString();
-        String[] fields = key.split(":");
-        String cps = format(MATCH_FORMAT, lhs.name(), rhs.name());
-
-        return fields.length == 2 && fields[1].contains(cps);
-    }
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCPCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCPCommand.java
index 4e702af..29c4f59 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCPCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCPCommand.java
@@ -29,11 +29,11 @@
 /**
  * CLI to list the SDX-L2 connection points.
  */
-@Command(scope = "sdxl2", name = "sdxl2cp-list", description = "Lists " +
-        "all the SDX-L2 Connection Points. Argument not required the name of SDX-L2")
+@Command(scope = "sdxl2", name = "sdxl2cp-list",
+    description = "Lists all SDX-L2 Connection Points or details for a given SDX-L2")
 public class SdxL2ListCPCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2", required = false, multiValued = false)
+    @Argument(name = "sdxl2name", description = "Name of SDX-L2")
     private String sdxl2 = null;
 
     private static final String HEADER = "\n\u001B[1;37mStatus\t\tSDXL2 Connection Point\u001B[0m";
@@ -48,9 +48,9 @@
         Set<String> result = sdxl2Service.getSdxL2ConnectionPoints(sdxl2name);
         SdxL2ConnectionPoint sdxl2ConnectionPoint;
         SdxL2State sdxl2cpState;
-        print(HEADER);
-        print(SEPARATOR);
-        if (result.size() > 0) {
+        if (!result.isEmpty()) {
+            print(HEADER);
+            print(SEPARATOR);
             for (String sdxl2cp : result) {
                 sdxl2ConnectionPoint = sdxl2Service.getSdxL2ConnectionPoint(sdxl2cp);
                 if (sdxl2ConnectionPoint == null) {
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCommand.java
index f03b656..0fe370a 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListCommand.java
@@ -36,7 +36,7 @@
     protected void execute() {
         SdxL2Service sdxl2Service = get(SdxL2Service.class);
         Set<String> sdxl2s = sdxl2Service.getSdxL2s();
-        if (sdxl2s.size() > 0) {
+        if (!sdxl2s.isEmpty()) {
             print(HEADER);
             print(SEPARATOR);
             for (String sdxl2 : sdxl2s) {
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListVCCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListVCCommand.java
index 13eb0f9..319372f 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListVCCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2ListVCCommand.java
@@ -23,7 +23,7 @@
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.Key;
-import org.onosproject.sdxl2.SdxL2ConnectionPoint;
+import org.onosproject.sdxl2.SdxL2ConnectionPointMatcher;
 import org.onosproject.sdxl2.SdxL2Service;
 import org.onosproject.sdxl2.SdxL2State;
 import org.onosproject.sdxl2.VirtualCircuit;
@@ -32,20 +32,15 @@
 import java.util.Optional;
 import java.util.Set;
 
-import static java.lang.String.format;
-
 /**
- * CLI to delete a Connection Point in an SDX-L2.
+ * CLI to delete a Connection Point in a SDX-L2.
  */
 @Command(scope = "sdxl2", name = "sdxl2vc-list",
-        description = "Lists all the SDX-L2 Virtual Circuits. Argument not required the name of SDX-L2")
+        description = "Lists all SDX-L2 Virtual Circuits or details for a given SDX-L2")
 public class SdxL2ListVCCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "Name of SDX-L2",
-            description = "Sdxl2 name", required = false, multiValued = false)
-    private String sdxl2 = null;
-
-    private static final String MATCH_FORMAT = "%s-%s";
+    @Argument(name = "sdxl2vcname", description = "Name of SDX-L2 VC")
+    private String sdxl2vcname = null;
 
     private static final String HEADER =
             "\n\u001B[1;37mStatus\t\tVirtual Circuit\u001B[0m";
@@ -58,17 +53,16 @@
     private static final String FORMAT_SDXL2VC_CHECK =
             "\u001B[1;33m%s\u001B[0m\t\t\u001B[1;37m%s\u001B[0m";
 
-
     @Override
     protected void execute() {
         SdxL2Service sdxl2Service = get(SdxL2Service.class);
-        Optional<String> sdxl2name = Optional.ofNullable(sdxl2);
+        Optional<String> sdxl2name = Optional.ofNullable(sdxl2vcname);
         Set<String> result = sdxl2Service.getVirtualCircuits(sdxl2name);
         VirtualCircuit vc;
         SdxL2State state;
-        print(HEADER);
-        print(SEPARATOR);
-        if (result.size() > 0) {
+        if (!result.isEmpty()) {
+            print(HEADER);
+            print(SEPARATOR);
             String[] sdxl2VC;
             for (String sdxl2vc : result) {
                 sdxl2VC = sdxl2vc.split(":");
@@ -99,12 +93,13 @@
     private SdxL2State getVirtualCircuitState(VirtualCircuit vc) {
         IntentService intentService = get(IntentService.class);
         SdxL2Service sdxl2Service = get(SdxL2Service.class);
+        SdxL2ConnectionPointMatcher matcher = new SdxL2ConnectionPointMatcher();
         SdxL2State intentState = SdxL2State.ONLINE;
         SdxL2State lhsState;
         SdxL2State rhsstate;
         Iterator<Intent> intents = Iterables.filter(intentService.getIntents(), intent ->
-                (matches(vc.lhs(), vc.rhs(), intent) ||
-                        (matches(vc.rhs(), vc.lhs(), intent)))).iterator();
+                (matcher.matches(vc.lhs(), vc.rhs(), intent) ||
+                        (matcher.matches(vc.rhs(), vc.lhs(), intent)))).iterator();
         Intent intent;
         Key key;
         int numIntents = 0;
@@ -114,9 +109,9 @@
             key = intent.key();
             intentState = sdxl2Service.getIntentState(key);
             if (intentState == SdxL2State.OFFLINE || intentState == SdxL2State.CHECK) {
-                numIntentsOffline = numIntentsOffline + 1;
+                numIntentsOffline += 1;
             }
-            numIntents = numIntents + 1;
+            numIntents += 1;
         }
 
         if (numIntents == numIntentsOffline) {
@@ -140,20 +135,4 @@
 
         return SdxL2State.CHECK;
     }
-
-    /**
-     * Matches an intent given two SDX-L2 Connection Points.
-     *
-     * @param lhs    left hand side of the virtual circuit
-     * @param rhs    right hand side of the virtual circuit
-     * @param intent intent to match
-     * @return result of the match
-     */
-    private boolean matches(SdxL2ConnectionPoint lhs, SdxL2ConnectionPoint rhs, Intent intent) {
-        String key = intent.key().toString();
-        String[] fields = key.split(":");
-        String cps = format(MATCH_FORMAT, lhs.name(), rhs.name());
-
-        return fields.length == 2 && fields[1].contains(cps);
-    }
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCPCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCPCommand.java
index 00da8c5..ec01761 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCPCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCPCommand.java
@@ -28,8 +28,8 @@
 @Command(scope = "sdxl2", name = "sdxl2cp-remove", description = "Removes a named SDX-L2 Connection Point")
 public class SdxL2RemoveCPCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2cpname", description = "Name of SDX-L2 Connection Point",
-            required = true, multiValued = false)
+    @Argument(name = "sdxl2cpname", description = "Name of SDX-L2 Connection Point",
+            required = true)
     private String sdxl2cpname = null;
 
     @Override
@@ -37,6 +37,4 @@
         SdxL2Service sdxl2Service = get(SdxL2Service.class);
         sdxl2Service.removeSdxL2ConnectionPoint(sdxl2cpname);
     }
-
 }
-
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCommand.java
index ab416e4..9f4f715 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveCommand.java
@@ -27,8 +27,8 @@
 @Command(scope = "sdxl2", name = "sdxl2-remove", description = "Deletes a SDX-L2")
 public class SdxL2RemoveCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2",
-            required = true, multiValued = false)
+    @Argument(name = "sdxl2name", description = "Name of SDX-L2",
+            required = true)
     private String sdxl2 = null;
 
     @Override
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveVCCommand.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveVCCommand.java
index d4b8d25..8f2514b 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveVCCommand.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/SdxL2RemoveVCCommand.java
@@ -22,13 +22,13 @@
 import org.onosproject.sdxl2.SdxL2Service;
 
 /**
- * CLI to delete a named Virtual Circuit in an SDX-L2.
+ * CLI to delete a named Virtual Circuit in a SDX-L2.
  */
 @Command(scope = "sdxl2", name = "sdxl2vc-remove", description = "Removes a named Virtual Circuit")
 public class SdxL2RemoveVCCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "sdxl2vcname", description = "Name of SDX-L2 Virtual Circuit",
-            required = true, multiValued = false)
+    @Argument(name = "sdxl2vcname", description = "Name of SDX-L2 Virtual Circuit",
+            required = true)
     private String sdxL2VCname = null;
 
     @Override
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/MacIdCompleter.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/MacIdCompleter.java
new file mode 100644
index 0000000..9fb2dae
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/MacIdCompleter.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.sdxl2.cli.completer;
+
+import org.apache.karaf.shell.console.Completer;
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.Host;
+import org.onosproject.net.host.HostService;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedSet;
+
+/**
+ * MAC ID Completer.
+ */
+public class MacIdCompleter implements Completer {
+
+    @Override
+    public int complete(String buffer, int cursor, List<String> candidates) {
+        // Delegate string completer
+        StringsCompleter delegate = new StringsCompleter();
+        HostService service = AbstractShellCommand.get(HostService.class);
+        Iterator<Host> it = service.getHosts().iterator();
+        SortedSet<String> strings = delegate.getStrings();
+
+        while (it.hasNext()) {
+            strings.add(it.next().mac().toString());
+        }
+
+        // Now let the completer do the work for figuring out what to offer.
+        return delegate.complete(buffer, cursor, candidates);
+    }
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2CPNameCompleter.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2CPNameCompleter.java
index 31bebb4..8966383 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2CPNameCompleter.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2CPNameCompleter.java
@@ -33,7 +33,7 @@
     public int complete(String buffer, int cursor, List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         SdxL2Service service = AbstractShellCommand.get(SdxL2Service.class);
-        delegate.getStrings().addAll(service.getSdxL2ConnectionPoints(Optional.ofNullable(null)));
+        delegate.getStrings().addAll(service.getSdxL2ConnectionPoints(Optional.empty()));
         return delegate.complete(buffer, cursor, candidates);
     }
 }
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2VCNameCompleter.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2VCNameCompleter.java
index e61c33f..56c6a26 100644
--- a/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2VCNameCompleter.java
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/cli/completer/SdxL2VCNameCompleter.java
@@ -34,7 +34,7 @@
     public int complete(String buffer, int cursor, List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         SdxL2Service service = AbstractShellCommand.get(SdxL2Service.class);
-        delegate.getStrings().addAll(service.getVirtualCircuits(Optional.ofNullable(null)));
+        delegate.getStrings().addAll(service.getVirtualCircuits(Optional.empty()));
         return delegate.complete(buffer, cursor, candidates);
     }
 }
diff --git a/sdx-l2/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/sdx-l2/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 76b3572..696cffe 100644
--- a/sdx-l2/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/sdx-l2/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -24,64 +24,85 @@
             <action class="org.onosproject.sdxl2.cli.SdxL2RemoveCommand"/>
             <completers>
                 <ref component-id="sdxl2Completer"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2ListCommand"/>
         </command>
         <command>
+            <action class="org.onosproject.sdxl2.cli.SdxL2CleanCommand"/>
+        </command>
+        <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2AddCPCommand"/>
             <completers>
                 <ref component-id="sdxl2Completer"/>
                 <ref component-id="connectPointCompleter"/>
+                <ref component-id="placeholderCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
+            <optional-completers>
+                <entry key="-ce_mac" value-ref="macCompleter"/>
+            </optional-completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2RemoveCPCommand"/>
             <completers>
                 <ref component-id="sdxl2cpnameCompleter"/>
-            </completers>
-        </command>
-        <command>
-            <action class="org.onosproject.sdxl2.cli.SdxL2GetCPCommand"/>
-            <completers>
-                <ref component-id="sdxl2cpnameCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2ListCPCommand"/>
             <completers>
                 <ref component-id="sdxl2Completer"/>
+                <ref component-id="nullCompleter"/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.onosproject.sdxl2.cli.SdxL2GetCPCommand"/>
+            <completers>
+                <ref component-id="sdxl2cpnameCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2AddVCCommand"/>
             <completers>
                 <ref component-id="sdxl2vcnameCompleter"/>
+                <ref component-id="sdxl2cpnameCompleter"/>
+                <ref component-id="sdxl2cpnameCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2RemoveVCCommand"/>
             <completers>
                 <ref component-id="sdxl2vcnameCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2GetVCCommand"/>
             <completers>
                 <ref component-id="sdxl2vcnameCompleter"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
         <command>
             <action class="org.onosproject.sdxl2.cli.SdxL2ListVCCommand"/>
             <completers>
                 <ref component-id="sdxl2Completer"/>
+                <ref component-id="nullCompleter"/>
             </completers>
         </command>
     </command-bundle>
 
+    <bean id="nullCompleter" class="org.apache.karaf.shell.console.completer.NullCompleter"/>
+    <bean id="placeholderCompleter" class="org.onosproject.cli.PlaceholderCompleter"/>
     <bean id="sdxl2Completer" class="org.onosproject.sdxl2.cli.completer.SdxL2NameCompleter"/>
     <bean id="connectPointCompleter" class="org.onosproject.cli.net.ConnectPointCompleter"/>
+    <bean id="macCompleter" class="org.onosproject.sdxl2.cli.completer.MacIdCompleter"/>
     <bean id="sdxl2cpnameCompleter" class="org.onosproject.sdxl2.cli.completer.SdxL2CPNameCompleter"/>
     <bean id="sdxl2vcnameCompleter" class="org.onosproject.sdxl2.cli.completer.SdxL2VCNameCompleter"/>
 
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/IntentServiceTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/IntentServiceTest.java
index a9711d3..83e0c20 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/IntentServiceTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/IntentServiceTest.java
@@ -34,7 +34,7 @@
     /**
      * Defines a set of intents.
      */
-    public IntentServiceTest() {
+    IntentServiceTest() {
         intents = Sets.newHashSet();
     }
 
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java
index ae20d28..8dd0371 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java
@@ -16,6 +16,7 @@
 
 package org.onosproject.sdxl2;
 
+import com.google.common.testing.EqualsTester;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -27,130 +28,232 @@
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 
 /**
  * Tests SdxL2ConnectionPoint functionality.
  */
 public class SdxL2ConnectionPointTest {
 
+    private static final String CP1 = "of:00000000000001/1";
+    private static final String CP2 = "of:00000000000002/1";
+    private static final String CP3 = "of:00000000000003/1";
+    private static final String CP4 = "of:00000000000003/2";
+    private static final String CP5 = "-1";
+    private static final String CP6 = "of:00000000000004/2";
+    private static final String CP7 = "of:00000000000004/1";
+
+    private static final String VLANS1 = "1,2,3,4";
+    private static final String VLANS2 = "-1";
+    private static final String VLANS3 = "1,2,3";
+    private static final String VLANS4 = "2,2,2";
+    private static final String VLANS5 = "2";
+    private static final String VLANS6 = "-1";
+    private static final String VLANS7 = "5";
+    private static final String VLANS8 = "3,2,1";
+    private static final String VLANS10 = "a";
+    private static final String VLANS11 = "5196";
+    private static final String VLANS12 = "2,-1,6";
+
+    private static final String CEMAC1 = "52:40:00:12:44:01";
+    private static final String CEMAC2 = "-1";
+    private static final String CEMAC3 = "-1";
+    private static final String CEMAC5 = "52:40:00:12:44:01";
+    private static final String CEMAC6 = "52:40:00:12:44:01";
+    private static final String CEMAC7 = "-1";
+
+    /**
+     * Exception expected to raise on bad format of CP name.
+     */
+    @Rule
+    public ExpectedException exceptionconnectionpoint = ExpectedException.none();
+    /**
+     * Exception expected to raise on missing MAC.
+     */
+    @Rule
+    public ExpectedException exceptionmac = ExpectedException.none();
+    /**
+     * Exception expected to raise on symbols on CP name.
+     */
+    @Rule
+    public ExpectedException exceptionname = ExpectedException.none();
+    /**
+     * Exception expected to raise on VLANs not in allowed range.
+     */
+    @Rule
+    public ExpectedException exceptionVlans = ExpectedException.none();
+
+    /**
+     * Prepares environment before starting testing.
+     */
     @Before
     public void setUp() {
-
     }
 
+    /**
+     * Cleans up environment after finishing testing.
+     */
     @After
     public void tearDown() {
-
     }
 
-    public static final String CP1 = "of:00000000000001/1";
-    public static final String CP2 = "of:00000000000002/1";
-    public static final String CP3 = "of:00000000000003/1";
-    public static final String CP4 = "of:00000000000003/2";
-    public static final String CP5 = "-1";
-    public static final String CP6 = "of:00000000000004/2";
-    public static final String CP7 = "of:00000000000004/1";
-
-    public static final String VLANS1 = "1,2,3,4";
-    public static final String VLANS2 = "-1";
-    public static final String VLANS3 = "1,2,3";
-    public static final String VLANS4 = "2,2,2";
-    public static final String VLANS5 = "2";
-    public static final String VLANS6 = "-1";
-    public static final String VLANS7 = "5";
-    public static final String VLANS8 = "3,2,1";
-    public static final String VLANS10 = "a";
-    public static final String VLANS11 = "5196";
-    public static final String VLANS12 = "2,-1,6";
-
-    public static final String CEMAC1 = "52:40:00:12:44:01";
-    public static final String CEMAC2 = "-1";
-    public static final String CEMAC3 = "-1";
-    public static final String CEMAC4 = "-1";
-    public static final String CEMAC5 = "52:40:00:12:44:01";
-    public static final String CEMAC6 = "52:40:00:12:44:01";
-    public static final String CEMAC7 = "-1";
-
+    /**
+     * Ensures CP with MAC address is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint1() {
         SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO1", CP1, VLANS1, CEMAC1);
+        // scp1 != null
+        new EqualsTester()
+                .addEqualityGroup(scp1)
+                .addEqualityGroup()
+                .testEquals();
     }
 
+    /**
+     * Ensures CP with all VLANs is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint2() {
         SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO2", CP2, VLANS2);
+        // scp2 != null
+        new EqualsTester()
+                .addEqualityGroup(scp2)
+                .addEqualityGroup()
+                .testEquals();
     }
 
+    /**
+     * Ensures CP is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint3() {
         SdxL2ConnectionPoint scp3 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI1", CP3, VLANS3);
+        // scp3 != null
+        new EqualsTester()
+                .addEqualityGroup(scp3)
+                .addEqualityGroup()
+                .testEquals();
     }
 
+    /**
+     * Ensures CP with list of same VLANs is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint4() {
         SdxL2ConnectionPoint scp4 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO3", CP4, VLANS4);
+        // scp4 != null
+        new EqualsTester()
+                .addEqualityGroup(scp4)
+                .addEqualityGroup()
+                .testEquals();
     }
 
-    @Rule
-    public ExpectedException exceptionconnectionpoint = ExpectedException.none();
-
+    /**
+     * Asseses that CP with bad name is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
     @Test
     public void testSdxL2ConnectionPoint5() {
         exceptionconnectionpoint.expect(IllegalArgumentException.class);
         exceptionconnectionpoint.expectMessage("Connect point must be in \"deviceUri/portNumber\" format");
-        SdxL2ConnectionPoint scp5 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI2", CP5, VLANS5, CEMAC5);
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI2", CP5, VLANS5, CEMAC5);
     }
 
+    /**
+     * Ensures CP with all VLANs and MAC address is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint6() {
         SdxL2ConnectionPoint scp6 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI3", CP6, VLANS6, CEMAC6);
-
+        // scp6 != null
+        new EqualsTester()
+                .addEqualityGroup(scp6)
+                .addEqualityGroup()
+                .testEquals();
     }
 
-    @Rule
-    public ExpectedException exceptionmac = ExpectedException.none();
-
+    /**
+     * Ensures CP with bad input for MAC is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
     @Test
     public void testSdxL2ConnectionPoint7() {
         exceptionmac.expect(IllegalArgumentException.class);
         exceptionmac.expectMessage("Specified MAC Address must contain");
-        SdxL2ConnectionPoint scp7 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO4", CP7, VLANS7, CEMAC7);
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO4", CP7, VLANS7, CEMAC7);
     }
 
+    /**
+     * Ensures CP with all VLANs and MAC address is properly created (i.e. not null).
+     */
     @Test
     public void testSdxL2ConnectionPoint8() {
         SdxL2ConnectionPoint scp8 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("", CP4, VLANS2, CEMAC6);
+        // scp8 != null
+        new EqualsTester()
+                .addEqualityGroup(scp8)
+                .addEqualityGroup()
+                .testEquals();
     }
 
-    @Rule
-    public ExpectedException exceptionname = ExpectedException.none();
-
+    /**
+     * Ensures CP with bad input for name is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
     @Test
-    public void testSdxL2ConnectionPoint9() {
+    public void testSdxL2ConnectionPoint9a() {
         exceptionname.expect(IllegalStateException.class);
         exceptionname.expectMessage("Names cannot contain some special characters");
-        SdxL2ConnectionPoint scp9a = SdxL2ConnectionPoint.sdxl2ConnectionPoint("NA,1", CP1, VLANS1, CEMAC1);
-        SdxL2ConnectionPoint scp9b = SdxL2ConnectionPoint.sdxl2ConnectionPoint("{NA2}", CP2, VLANS2, CEMAC2);
-        SdxL2ConnectionPoint scp9c = SdxL2ConnectionPoint.sdxl2ConnectionPoint("NA3,elementId=50", CP3, VLANS3, CEMAC3);
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("NA,1", CP1, VLANS1, CEMAC1);
     }
 
-    @Rule
-    public ExpectedException exceptionvlans = ExpectedException.none();
+    /**
+     * Ensures CP with bad input for name is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
+    @Test
+    public void testSdxL2ConnectionPoint9b() {
+        exceptionname.expect(IllegalStateException.class);
+        exceptionname.expectMessage("Names cannot contain some special characters");
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("{NA2}", CP2, VLANS2, CEMAC2);
+    }
 
+    /**
+     * Ensures CP with bad input for name is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
+    @Test
+    public void testSdxL2ConnectionPoint9c() {
+        exceptionname.expect(IllegalStateException.class);
+        exceptionname.expectMessage("Names cannot contain some special characters");
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("NA3,elementId=50", CP3, VLANS3, CEMAC3);
+    }
+
+    /**
+     * Ensures CP with bad input for VLAN is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
     @Test
     public void testSdxL2ConnectionPoint10() {
-        exceptionvlans.expect(NumberFormatException.class);
-        SdxL2ConnectionPoint scp10 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("VE1", CP1, VLANS10, CEMAC7);
+        exceptionVlans.expect(NumberFormatException.class);
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("VE1", CP1, VLANS10, CEMAC7);
     }
 
+    /**
+     * Ensures CP with VLAN in a non-allowed range is not created.
+     * The exception blocks the flow of the program and no CP is created,
+     */
     @Test
     public void testSdxL2ConnectionPoint11() {
-        exceptionvlans.expect(IllegalArgumentException.class);
-        exceptionvlans.expectMessage("value exceeds allowed maximum VLAN ID value (4095)");
-        SdxL2ConnectionPoint scp11 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("VE2", CP2, VLANS11, CEMAC6);
+        exceptionVlans.expect(IllegalArgumentException.class);
+        exceptionVlans.expectMessage("value exceeds allowed maximum VLAN ID value (4095)");
+        SdxL2ConnectionPoint.sdxl2ConnectionPoint("VE2", CP2, VLANS11, CEMAC6);
     }
 
+    /**
+     * Ensures CP using all VLANs and specific, repeated VLANs at the same time
+     * do only consider the latter (non-repeated).
+     */
     @Test
     public void testSdxL2ConnectionPoint12() {
         SdxL2ConnectionPoint scp12 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("AQ1", CP1, VLANS12, CEMAC5);
@@ -160,15 +263,20 @@
         assertEquals(vlanIdList, scp12.vlanIds());
     }
 
+    /**
+     * Assesses that endpoints using same, but reversed VLANs, are not regarded as similar.
+     */
     @Test
     public void testSdxL2ConnectionPointEquality() {
         SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC6);
-        assertEquals(scp1, scp2);
         SdxL2ConnectionPoint scp3 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS3, CEMAC6);
-        assertNotEquals(scp1, scp3);
         SdxL2ConnectionPoint scp4 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS8, CEMAC6);
-        assertNotEquals(scp3, scp4);
+        // scp1 == scp2, but those are different from scp3 and scp4
+        new EqualsTester()
+                .addEqualityGroup(scp1, scp2)
+                .addEqualityGroup(scp3)
+                .addEqualityGroup(scp4)
+                .testEquals();
     }
-
 }
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MacVCManagerTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MacVCManagerTest.java
index 32865c7..a6db1fc 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MacVCManagerTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MacVCManagerTest.java
@@ -25,8 +25,6 @@
 import org.onosproject.TestApplicationId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.AbstractIntentTest;
@@ -35,8 +33,8 @@
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
 
-import java.util.Arrays;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -62,11 +60,7 @@
     private static final String CP9 = "of:0000000000000a/4";
     private static final String CP10 = "of:00000000000009/4";
     private static final String VLANS1 = "2,3,4";
-    private static final ArrayList<String> VLANS1_ARRAY =
-            new ArrayList<String>(Arrays.asList(VLANS1.split(",")));
     private static final String VLANS2 = "4,5,6";
-    private static final ArrayList<String> VLANS2_ARRAY =
-            new ArrayList<String>(Arrays.asList(VLANS2.split(",")));
 
     private static final String VLANS5 = "100";
     private static final String VLANS6 = "1";
@@ -85,12 +79,11 @@
     private static final String NAME_FORMAT = "%s:%s-%s";
     private static final String KEY_FORMAT = "%s,%s";
     private static final ApplicationId APPID = TestApplicationId.create("foo");
-    private static final int POINT_TO_POINT_INDEXES = 3;
     private SdxL2MacVCManager manager;
     private List<PointToPointIntent> intentList;
 
     /**
-     * Prepare environment before starting testing MAC-based VCs.
+     * Prepares environment before starting testing.
      */
     @Before
     public void setUp() throws Exception {
@@ -102,15 +95,20 @@
     }
 
     /**
-     * Clean up environment after finishing testing MAC-based VCs.
+     * Cleans up environment after finishing testing.
      */
     @After
     public void tearDown() {
         super.tearDown();
     }
 
-    public List<PointToPointIntent> setIntents() {
-        List<PointToPointIntent> intents = new ArrayList<PointToPointIntent>();
+    /**
+     * Defines the intents to be used when testing the VC.
+     *
+     * @return List of point-to-point intents
+     */
+    private List<PointToPointIntent> setIntents() {
+        List<PointToPointIntent> intents = new ArrayList<>();
         intents.addAll(setupConnectionPoints1To2());
         intents.addAll(setupConnectionPoints5To6());
         intents.addAll(setupConnectionPoints7To8());
@@ -118,47 +116,53 @@
         return intents;
     }
 
+    /**
+     * Returns the traffic treatment, used in the definition of the intents.
+     *
+     * @param setVlan VLAN to set
+     * @param pushVlan VLAN to push
+     * @param popVlan boolean to indicate whether a popVlan action is
+     *                performed (true) or not (false)
+     * @return TrafficTreatment object
+     */
     private TrafficTreatment buildTreatment(VlanId setVlan,
                                             VlanId pushVlan,
                                             boolean popVlan) {
-
-        TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
-        if (setVlan != null) {
-            treatmentBuilder.setVlanId(setVlan);
-        }
-        if (pushVlan != null) {
-            treatmentBuilder.pushVlan();
-            treatmentBuilder.setVlanId(pushVlan);
-        }
-        if (popVlan) {
-            treatmentBuilder.popVlan();
-        }
-        return treatmentBuilder.build();
+        return manager.buildTreatment(setVlan, pushVlan, popVlan);
     }
 
+    /**
+     * Returns the traffic selector, used in the definition of the intents.
+     *
+     * @param ingressMac Input MAC address
+     * @param egressMac Output MAC address
+     * @param etherType name of the Ethernet type used (e.g. of SDX-L2)
+     * @param ingressTag VLAN id used at the ingress
+     * @return TrafficSelector object
+     */
     private TrafficSelector buildSelector(MacAddress ingressMac,
                                           MacAddress egressMac,
                                           Short etherType,
                                           VlanId ingressTag) {
-
-        TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
-        selectorBuilder.matchEthSrc(ingressMac);
-        selectorBuilder.matchEthDst(egressMac);
-        if (etherType != null) {
-            selectorBuilder.matchEthType(etherType);
-        }
-        if (ingressTag != null) {
-            selectorBuilder.matchVlanId(ingressTag);
-        }
-        return selectorBuilder.build();
+        return manager.buildSelector(ingressMac, egressMac, etherType, ingressTag);
     }
 
+    /**
+     * Returns Intent key from SDX-L2 and two SDX-L2 Connection Points.
+     *
+     * @param sdxl2 name of SDX-L2
+     * @param cpOne sdxl2 connection point one
+     * @param cpTwo sdxl2 connection point two
+     * @param index digit used to help identify Intent
+     * @return canonical intent string key
+     */
     private Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpOne, SdxL2ConnectionPoint cpTwo, String index) {
-        String cps = format(NAME_FORMAT, sdxl2, cpOne.name(), cpTwo.name());
-        String key = format(KEY_FORMAT, cps, index);
-        return Key.of(key, APPID);
+        return manager.generateIntentKey(sdxl2, cpOne, cpTwo, index);
     }
 
+    /**
+     * Ensures that when adding a VC its related intents are inserted.
+     */
     @Test
     public void testConnectionSetup() {
         Iterator<SdxL2ConnectionPoint> lhs = setupLhsCPs().iterator();
@@ -183,8 +187,13 @@
         }
     }
 
-    public List<SdxL2ConnectionPoint> setupLhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the left-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupLhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         cps.add(cpone);
         SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5, CEMAC5);
@@ -196,8 +205,13 @@
         return cps;
     }
 
-    public List<SdxL2ConnectionPoint> setupRhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the right-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupRhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2, CEMAC2);
         cps.add(cptwo);
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6, CEMAC6);
@@ -209,6 +223,22 @@
         return cps;
     }
 
+    /**
+     * Creates the intents from the information of couple of endpoints.
+     *
+     * @param keyIndex identifier of the intent
+     * @param lhs left-hand side Connection Point
+     * @param lhsID DPID of the left-hand side CP
+     * @param lhsMac MAC of the left-hand side CP
+     * @param lhsVlan VLAN of the left-hand side CP
+     * @param lhsBuiltTreatment specific treatment for the left-hand side CP
+     * @param rhs right-hand side Connection Point
+     * @param rhsID DPID of the right-hand side CP
+     * @param rhsMac MAC of the right-hand side
+     * @param rhsVlan VLAN of the right-hand side CP
+     * @param rhsBuiltTreatment specific treatment for the right-hand side CP
+     * @return List of point-to-point intents
+     */
     private List<PointToPointIntent> setupConnectionPoints(String keyIndex,
                                                            SdxL2ConnectionPoint lhs, String lhsID,
                                                            String lhsMac, String lhsVlan,
@@ -216,7 +246,7 @@
                                                            SdxL2ConnectionPoint rhs, String rhsID,
                                                            String rhsMac, String rhsVlan,
                                                            TrafficTreatment rhsBuiltTreatment) {
-        List<PointToPointIntent> intents = new ArrayList<PointToPointIntent>();
+        List<PointToPointIntent> intents = new ArrayList<>();
         VlanId lhsVlanValue = null, rhsVlanValue = null;
         if (lhsVlan != null) {
             lhsVlanValue = VlanId.vlanId(Short.parseShort(lhsVlan));
@@ -250,13 +280,19 @@
         return intents;
     }
 
+    /**
+     * Defines three pairs of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
     private List<PointToPointIntent> setupConnectionPoints1To2() {
-        List<PointToPointIntent> intents = new ArrayList<PointToPointIntent>();
+        List<PointToPointIntent> intents = new ArrayList<>();
         String lhsID = CP1;
-        ArrayList<String> lhsVlan = VLANS1_ARRAY;
+        ArrayList<String> lhsVlan = new ArrayList<>(Arrays.asList(VLANS1.split(",")));
         String lhsMac = CEMAC1;
         String rhsID = CP2;
-        ArrayList<String> rhsVlan = VLANS2_ARRAY;
+        ArrayList<String> rhsVlan = new ArrayList<>(Arrays.asList(VLANS2.split(",")));
         String rhsMac = CEMAC2;
         SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint(
                 "TEST1", lhsID, VLANS1, lhsMac);
@@ -264,7 +300,7 @@
                 "TEST2", rhsID, VLANS2, rhsMac);
         TrafficTreatment lhsBuiltTreatment, rhsBuiltTreatment;
 
-        for (int i = 0; i < POINT_TO_POINT_INDEXES; i++) {
+        for (int i = 0; i < 3; i++) {
             lhsBuiltTreatment = buildTreatment(VlanId.vlanId(rhsVlan.get(i)), null, false);
             rhsBuiltTreatment = buildTreatment(VlanId.vlanId(lhsVlan.get(i)), null, false);
             intents.addAll(setupConnectionPoints(Integer.toString(i + 1),
@@ -274,6 +310,12 @@
         return intents;
     }
 
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
     private List<PointToPointIntent> setupConnectionPoints5To6() {
         String lhsID = CP5;
         String lhsVlan = VLANS5;
@@ -289,6 +331,12 @@
                                      rhs, rhsID, rhsMac, null, rhsBuiltTreatment);
     }
 
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
     private List<PointToPointIntent> setupConnectionPoints7To8() {
         String lhsID = CP7;
         String lhsVlan = VLANS7;
@@ -304,6 +352,12 @@
                                      rhs, rhsID, rhsMac, rhsVlan, rhsBuiltTreatment);
     }
 
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
     private List<PointToPointIntent> setupConnectionPoints9To10() {
         String lhsID = CP9;
         String lhsVlan = VLANS9;
@@ -318,10 +372,13 @@
                                      rhs, rhsID, rhsMac, null, nullTreatment);
     }
 
+    /**
+     * Ensures that when removing a VC its related intents are deleted.
+     */
     @Test
-    public void removeConnection() {
+    public void removeVCAndIntents() {
         testConnectionSetup();
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
 
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2, CEMAC2);
@@ -353,24 +410,22 @@
             }
             assertTrue(!found);
         }
-
     }
 
+    /**
+     * Ensures that when removing a CP its related VCs and intents are also deleted.
+     */
     @Test
     public void testRemoveVCbyCP() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
-
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         removedIntents.addAll(setupConnectionPoints1To2());
-
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6, CEMAC6);
         removedIntents.addAll(setupConnectionPoints5To6());
-
         SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7, CEMAC7);
         removedIntents.addAll(setupConnectionPoints7To8());
-
         SdxL2ConnectionPoint cpten = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10, CEMAC10);
         removedIntents.addAll(setupConnectionPoints9To10());
 
@@ -379,7 +434,7 @@
         manager.removeVC(cpseven);
         manager.removeVC(cpten);
 
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
 
         assertEquals(0, manager.intentService.getIntentCount());
 
@@ -395,22 +450,24 @@
             }
             assertTrue(!found);
         }
-
     }
 
+    /**
+     * Ensures that when removing a SDX its related VCs and intents are also deleted.
+     */
     @Test
     public void testRemoveVCbySdx() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
-
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
         removedIntents.addAll(setupConnectionPoints1To2());
         removedIntents.addAll(setupConnectionPoints5To6());
         removedIntents.addAll(setupConnectionPoints7To8());
         removedIntents.addAll(setupConnectionPoints9To10());
+
         manager.removeVCs(SDXL2_2);
 
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
         assertEquals(Collections.emptySet(), manager.getVCs(Optional.of(SDXL2_2)));
 
         for (Intent removedIntent : removedIntents) {
@@ -425,6 +482,5 @@
             }
             assertTrue(!found);
         }
-
     }
 }
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ManagerTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ManagerTest.java
index 1017e72..52b9c03 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ManagerTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ManagerTest.java
@@ -33,57 +33,72 @@
 import java.util.Set;
 
 import static java.lang.String.format;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
 
 /**
  * Tests SdxL2Manager functionality.
  */
 public class SdxL2ManagerTest {
 
-    public static final String SDXL2 = "test";
-    public static final String SDXL2_2 = "test2";
-    public static final String CP1 = "of:00000000000001/1";
-    public static final String CP2 = "of:00000000000002/1";
-    public static final String CP3 = "of:00000000000003/1";
-    public static final String CP4 = "of:00000000000003/2";
-    public static final String CP5 = "of:00000000000004/2";
-    public static final String VLANS1 = "1,2,3,4";
-    public static final String VLANS2 = "-1";
-    public static final String VLANS3 = "1,2,3";
-    public static final String VLANS4 = "2,2,2";
-    public static final String VLANS7 = "5";
-    public static final String VLANS8 = "3,2,1";
-    public static final String CEMAC1 = "52:40:00:12:44:01";
-    public static final String CEMAC2 = "52:44:00:12:44:01";
-    public static final String CEMAC3 = "54:40:00:12:44:01";
-    public static final String CEMAC4 = "52:40:00:12:42:01";
-    public static final String CEMAC5 = "52:40:00:10:44:01";
-    public static final String CEMAC6 = "52:40:00:12:46:01";
-    public static final String CP6 = "of:00000000000004/3";
-    public static final String CP7 = "of:00000000000004/3";
-    public static final String CP8 = "of:00000000000005/2";
-    public static final String VLANS6 = "1,2,3,4";
-    public static final String VLANS5 = "8,9,10";
-    public static final String CEMAC7 = "52:40:00:12:46:01";
-    public static final String CEMAC8 = "52:40:90:12:46:01";
+    private static final String SDXL2 = "test";
+    private static final String SDXL2_2 = "test2";
+    private static final String CP1 = "of:00000000000001/1";
+    private static final String CP2 = "of:00000000000002/1";
+    private static final String CP3 = "of:00000000000003/1";
+    private static final String CP4 = "of:00000000000003/2";
+    private static final String CP5 = "of:00000000000004/2";
+    private static final String VLANS1 = "1,2,3,4";
+    private static final String VLANS2 = "-1";
+    private static final String VLANS3 = "1,2,3";
+    private static final String VLANS4 = "2,2,2";
+    private static final String VLANS7 = "5";
+    private static final String VLANS8 = "3,2,1";
+    private static final String CEMAC1 = "52:40:00:12:44:01";
+    private static final String CEMAC2 = "52:44:00:12:44:01";
+    private static final String CEMAC3 = "54:40:00:12:44:01";
+    private static final String CEMAC4 = "52:40:00:12:42:01";
+    private static final String CEMAC5 = "52:40:00:10:44:01";
+    private static final String CEMAC6 = "52:40:00:12:46:01";
+    private static final String CP6 = "of:00000000000004/3";
+    private static final String CP7 = "of:00000000000004/3";
+    private static final String CP8 = "of:00000000000005/2";
+    private static final String VLANS6 = "1,2,3,4";
+    private static final String VLANS5 = "8,9,10";
+    private static final String CEMAC7 = "52:40:00:12:46:01";
+    private static final String CEMAC8 = "52:40:90:12:46:01";
+
+    /**
+     * Exception expected to raise when creating VC with non-existing CP(s).
+     */
     @Rule
-    public ExpectedException exceptionAddVC1 = ExpectedException.none();
+    public ExpectedException exceptionAddVC = ExpectedException.none();
+    /**
+     * Exception expected to raise when removing non-existing VC.
+     */
     @Rule
-    public ExpectedException exceptionAddVC2 = ExpectedException.none();
-    @Rule
-    public ExpectedException exceptionRemoveVC1 = ExpectedException.none();
-    @Rule
-    public ExpectedException exceptionRemoveVC2 = ExpectedException.none();
+    public ExpectedException exceptionRemoveVC = ExpectedException.none();
+    /**
+     * Exception expected to raise when creating SDX-L2 with missing or bad name.
+     */
     @Rule
     public ExpectedException exceptionSdxL2Name = ExpectedException.none();
+    /**
+     * Exception expected to raise when removing SDX-L2 passing no name.
+     */
     @Rule
     public ExpectedException exceptionDelSdxL2Name = ExpectedException.none();
+    /**
+     * Exception expected to raise when retrieving VC using a bad name format.
+     */
     @Rule
-    public ExpectedException exceptionGetVC2 = ExpectedException.none();
-    protected SdxL2Manager manager;
-    protected IdGenerator idGenerator = new MockIdGenerator();
+    public ExpectedException exceptionGetVC = ExpectedException.none();
+    /**
+     * Exception expected to raise when removing SDX-L2 CPs that do not exist.
+     */
+    @Rule
+    public ExpectedException exceptionRemoveCP = ExpectedException.none();
+    private SdxL2Manager manager;
+    private IdGenerator idGenerator = new MockIdGenerator();
 
     @Before
     public void setUp() {
@@ -92,9 +107,8 @@
         SdxL2DistributedStore store = new SdxL2DistributedStore();
         store.initForTest();
         manager.sdxL2Store = store;
-        SdxL2MacVCManager vcManager = new SdxL2MacVCManager(
+        manager.vcManager = new SdxL2MacVCManager(
                 manager.appId, manager.sdxL2Store, new IntentServiceTest());
-        manager.vcManager = vcManager;
         Intent.bindIdGenerator(idGenerator);
     }
 
@@ -103,6 +117,9 @@
         Intent.unbindIdGenerator(idGenerator);
     }
 
+    /**
+     * Ensures SDXs are properly created (no exception is thrown).
+     */
     @Test
     public void testCreateSdxL2s() {
         manager.createSdxL2(SDXL2);
@@ -110,6 +127,9 @@
         manager.createSdxL2(SDXL2);
     }
 
+    /**
+     * Ensures that SDXs are properly removed (no exception is thrown).
+     */
     @Test
     public void testRemoveSdxL2s() {
         manager.createSdxL2(SDXL2);
@@ -119,9 +139,12 @@
         manager.deleteSdxL2(SDXL2);
     }
 
+    /**
+     * Verifies that manager is able to retrieve and delete SDXs.
+     */
     @Test
     public void testGetSdxL2s() {
-        Set<String> old = new HashSet<String>();
+        Set<String> old = new HashSet<>();
         old.add(SDXL2_2);
         old.add(SDXL2);
         manager.createSdxL2(SDXL2);
@@ -133,9 +156,11 @@
         assertNotEquals(sdxl2, old);
     }
 
+    /**
+     * Verifies that manager can add Connection Points using different sets of VLANs and MACs.
+     */
     @Test
     public void testAddSdxL2ConnectionPoint() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
         manager.createSdxL2("test1");
@@ -186,12 +211,13 @@
 
         SdxL2ConnectionPoint thirteen = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI31", CP5, VLANS8, CEMAC1);
         manager.addSdxL2ConnectionPoint(SDXL2_2, thirteen);
-
     }
 
+    /**
+     * Verifies that manager can retrieve Connection Points using different sets of VLANs and MACs.
+     */
     @Test
     public void testGetSdxL2ConnectionPoints() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
 
@@ -224,7 +250,7 @@
         allExt.add(ten.name());
         allExtBySdxl2.add(ten.name());
 
-        Set<String> all = manager.getSdxL2ConnectionPoints(Optional.ofNullable(null));
+        Set<String> all = manager.getSdxL2ConnectionPoints(Optional.empty());
         Set<String> allBySdxl2 = manager.getSdxL2ConnectionPoints(Optional.of(SDXL2));
         Set<String> allBySdxl22 = manager.getSdxL2ConnectionPoints(Optional.of(SDXL2_2));
 
@@ -239,12 +265,13 @@
         assertNotEquals(allExt, allBySdxl22);
         assertNotEquals(allExtBySdxl2, allBySdxl22);
         assertEquals(allExtBySdxl2Aux, allBySdxl22);
-
     }
 
+    /**
+     * Verifies that manager can remove Connection Points using different sets of VLANs and MACs.
+     */
     @Test
     public void testRemoveSdxL2ConnectionPoint() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
 
@@ -270,9 +297,11 @@
         manager.removeSdxL2ConnectionPoint(six.name());
         manager.removeSdxL2ConnectionPoint(one.name());
         manager.removeSdxL2ConnectionPoint("ROM");
-
     }
 
+    /**
+     * Verifies that manager removes all CPs associated to a given SDX when this is removed.
+     */
     @Test
     public void test2RemoveSdxL2s() {
         manager.createSdxL2(SDXL2);
@@ -308,17 +337,18 @@
         manager.deleteSdxL2(SDXL2);
 
         assertEquals(sdxl2CPsAux, this.manager.getSdxL2ConnectionPoints(Optional.of(SDXL2_2)));
-        assertEquals(sdxl2CPsAux, this.manager.getSdxL2ConnectionPoints(Optional.ofNullable(null)));
+        assertEquals(sdxl2CPsAux, this.manager.getSdxL2ConnectionPoints(Optional.empty()));
         manager.deleteSdxL2(SDXL2_2);
 
         assertEquals(Collections.emptySet(), this.manager.getSdxL2ConnectionPoints(Optional.of(SDXL2)));
         assertEquals(Collections.emptySet(), this.manager.getSdxL2ConnectionPoints(Optional.of(SDXL2_2)));
-
     }
 
+    /**
+     * Assesses that manager retrieves the expected Connection Points.
+     */
     @Test
     public void testGetSdxL2ConnectionPoint() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
 
@@ -357,12 +387,13 @@
         assertNotEquals(eleven, manager.getSdxL2ConnectionPoint(eleven.name()));
         assertNotEquals(twelve, manager.getSdxL2ConnectionPoint(twelve.name()));
         assertNotEquals(thirteen, manager.getSdxL2ConnectionPoint(thirteen.name()));
-
     }
 
+    /**
+     * Checks that manager is able to add Connection Points to Virtual Circuits.
+     */
     @Test
     public void testAddVCChecks() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
 
@@ -394,7 +425,7 @@
         manager.addVC(SDXL2, two.name(), four.name());
         manager.addVC(SDXL2, seven.name(), eight.name());
 
-        exceptionAddVC2.expect(IllegalStateException.class);
+        exceptionAddVC.expect(IllegalStateException.class);
         manager.addVC(SDXL2, four.name() + "x", five.name());
         manager.addVC(SDXL2, one.name(), three.name());
         manager.addVC(SDXL2, one.name(), five.name());
@@ -406,9 +437,11 @@
         manager.addVC(SDXL2, four.name(), five.name());
     }
 
+    /**
+     * Checks that manager is able to remove Virtual Circuits properly.
+     */
     @Test
     public void testRemoveVCChecks() {
-
         manager.createSdxL2(SDXL2);
         manager.createSdxL2(SDXL2_2);
 
@@ -436,88 +469,91 @@
         manager.addVC(SDXL2, seven.name(), nine.name());
 
         String vc;
-        vc = two.name().compareTo(six.name().toString()) < 0 ?
+        vc = two.name().compareTo(six.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), six.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, six.name(), two.name());
         manager.removeVC(vc);
 
-        vc = seven.name().compareTo(nine.name().toString()) < 0 ?
+        vc = seven.name().compareTo(nine.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, seven.name(), nine.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, seven.name(), nine.name());
         manager.removeVC(vc);
 
-        vc = one.name().compareTo(four.name().toString()) < 0 ?
+        vc = one.name().compareTo(four.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), four.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, four.name(), one.name());
         manager.removeVC(vc);
-        vc = one.name().compareTo(five.name().toString()) < 0 ?
+        vc = one.name().compareTo(five.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), five.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, five.name(), one.name());
         manager.removeVC(vc);
-        vc = one.name().compareTo(six.name().toString()) < 0 ?
+        vc = one.name().compareTo(six.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), six.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, six.name(), one.name());
         manager.removeVC(vc);
-        vc = two.name().compareTo(three.name().toString()) < 0 ?
+        vc = two.name().compareTo(three.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), three.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, three.name(), two.name());
         manager.removeVC(vc);
-        vc = two.name().compareTo(four.name().toString()) < 0 ?
+        vc = two.name().compareTo(four.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), four.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, four.name(), two.name());
         manager.removeVC(vc);
-        vc = two.name().compareTo(five.name().toString()) < 0 ?
+        vc = two.name().compareTo(five.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), five.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, five.name(), two.name());
         manager.removeVC(vc);
-        vc = three.name().compareTo(four.name().toString()) < 0 ?
+        vc = three.name().compareTo(four.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, three.name(), four.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, four.name(), three.name());
         manager.removeVC(vc);
-        vc = three.name().compareTo(five.name().toString()) < 0 ?
+        vc = three.name().compareTo(five.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, three.name(), five.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, five.name(), three.name());
         manager.removeVC(vc);
-        vc = three.name().compareTo(six.name().toString()) < 0 ?
+        vc = three.name().compareTo(six.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, three.name(), six.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, six.name(), three.name());
         manager.removeVC(vc);
-        vc = four.name().compareTo(five.name().toString()) < 0 ?
+        vc = four.name().compareTo(five.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, four.name(), five.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, five.name(), four.name());
         manager.removeVC(vc);
-        vc = seven.name().compareTo(eight.name().toString()) < 0 ?
+        vc = seven.name().compareTo(eight.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, seven.name(), eight.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, eight.name(), seven.name());
         manager.removeVC(vc);
-        vc = seven.name().compareTo(nine.name().toString()) < 0 ?
+        vc = seven.name().compareTo(nine.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2_2, seven.name(), nine.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, seven.name(), nine.name());
         manager.removeVC(vc);
-        vc = seven.name().compareTo(nine.name().toString()) < 0 ?
+        vc = seven.name().compareTo(nine.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2 + "x", seven.name(), nine.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, seven.name(), nine.name());
         manager.removeVC(vc);
 
-        exceptionRemoveVC1.expect(IllegalStateException.class);
-        vc = one.name().compareTo(three.name().toString()) < 0 ?
+        exceptionRemoveVC.expect(IllegalStateException.class);
+        vc = one.name().compareTo(three.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), three.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, three.name(), one.name());
         manager.removeVC(vc);
         manager.removeVC(":A");
         manager.removeVC("A:B");
 
-        vc = four.name().compareTo(five.name().toString()) < 0 ?
+        vc = four.name().compareTo(five.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, four.name() + "x", five.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, five.name(), four.name() + "x");
         manager.removeVC(vc);
 
-        vc = one.name().compareTo(two.name().toString()) < 0 ?
+        vc = one.name().compareTo(two.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), two.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), one.name());
         manager.removeVC(vc);
     }
 
+    /**
+     * Assesses that SDX instances are not created with invalid characters or no name.
+     */
     @Test
     public void testSdxL2NameChecks() {
         String sdxL2 = "";
@@ -534,6 +570,9 @@
         manager.createSdxL2(sdxL2Aux);
     }
 
+    /**
+     * Assesses that SDX instances are not deleted when having invalid characters or no name.
+     */
     @Test
     public void testDeleteSdxL2NameChecks() {
         String sdxL2 = "";
@@ -544,6 +583,35 @@
         manager.deleteSdxL2(sdxL2);
     }
 
+    /**
+     * Tests proper cleaning of all SDX-L2 related information.
+     */
+    @Test
+    public void testCleanSdxL2s() {
+        manager.createSdxL2(SDXL2);
+        SdxL2ConnectionPoint one = SdxL2ConnectionPoint.sdxl2ConnectionPoint("ROM1", CP1, VLANS1, CEMAC1);
+        SdxL2ConnectionPoint two = SdxL2ConnectionPoint.sdxl2ConnectionPoint("ROM2", CP2, VLANS2, CEMAC2);
+        manager.addSdxL2ConnectionPoint(SDXL2, one);
+        manager.addSdxL2ConnectionPoint(SDXL2, two);
+        manager.getSdxL2ConnectionPoint("ROM1");
+
+        assertTrue(manager.getSdxL2s().contains(SDXL2));
+        assertEquals(one, manager.getSdxL2ConnectionPoint(one.name()));
+        assertEquals(two, manager.getSdxL2ConnectionPoint(two.name()));
+
+        manager.cleanSdxL2();
+
+        assertFalse(manager.getSdxL2s().contains(SDXL2));
+        assertEquals(null, manager.getSdxL2ConnectionPoint(one.name()));
+        assertEquals(null, manager.getSdxL2ConnectionPoint(two.name()));
+    }
+
+    /**
+     * Verifies that the retrieved VC is in a correct state.
+     * It specifically checks that it returns the expected name, that the VC
+     * returned is null if it does not exist and that an exception is thrown when
+     * a badly formatted VC is requested.
+     */
     @Test
     public void testGetVC() {
         manager.createSdxL2(SDXL2);
@@ -573,9 +641,9 @@
         manager.addSdxL2ConnectionPoint(SDXL2, eight);
         manager.addSdxL2ConnectionPoint(SDXL2, nine);
 
-        // VC created using the manager, check against manually generates
+        // VC created using the manager, check against manually generated
         manager.addVC(SDXL2, two.name(), six.name());
-        vc = two.name().compareTo(six.name().toString()) < 0 ?
+        vc = two.name().compareTo(six.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), six.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, six.name(), two.name());
         expectedVC = new VirtualCircuit(two, six);
@@ -583,7 +651,7 @@
         assertEquals(expectedVC, actualVC);
 
         // VC not created, check that getVC returns null if VC does not exist
-        vc = one.name().compareTo(two.name().toString()) < 0 ?
+        vc = one.name().compareTo(two.name()) < 0 ?
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, one.name(), two.name()) :
                 format(SdxL2VCManager.NAME_FORMAT, SDXL2, two.name(), one.name());
         expectedVC = new VirtualCircuit(one, two);
@@ -592,7 +660,7 @@
         assertNull(actualVC);
 
         // Testing illegal character
-        exceptionGetVC2.expect(IllegalStateException.class);
+        exceptionGetVC.expect(IllegalStateException.class);
         manager.getVirtualCircuit(":A");
         manager.getVirtualCircuit("A:B");
     }
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MplsVCManagerTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MplsVCManagerTest.java
index 914678b..92aa7c6 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MplsVCManagerTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2MplsVCManagerTest.java
@@ -23,9 +23,6 @@
 import org.onosproject.TestApplicationId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.EncapsulationType;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.AbstractIntentTest;
@@ -34,11 +31,10 @@
 import org.onosproject.net.intent.IntentUtils;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.net.intent.constraint.EncapsulationConstraint;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Iterator;
 import java.util.Optional;
@@ -76,7 +72,7 @@
     private List<PointToPointIntent> intentList;
 
     /**
-     * Prepare environment before starting testing MPLS-based VCs.
+     * Prepares environment before starting testing.
      */
     @Before
     public void setUp() throws Exception {
@@ -88,196 +84,79 @@
     }
 
     /**
-     * Clean up environment after finishing testing MPLS-based VCs.
+     * Cleans up environment after finishing testing.
      */
     @After
     public void tearDown() {
         super.tearDown();
     }
 
+    /**
+     * Defines the intents to be used when testing.
+     *
+     * @return List of point-to-point intents
+     */
     private List<PointToPointIntent> setIntents() {
-        List<PointToPointIntent> intents = new ArrayList<PointToPointIntent>();
-        List<Constraint> encapsulation = buildConstraints();
-        SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cpTwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "2"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "2"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "3"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "3"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                            .priority(2000)
-                            .build());
-
-        SdxL2ConnectionPoint cpFive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpFive, cpSix, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                            .treatment(buildTreatment(null, null, true))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpSix, cpFive, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                            .priority(2000)
-                            .build());
-
-        SdxL2ConnectionPoint cpSeven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpEight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpSeven, cpEight, "1"))
-                            .selector(buildSelector(null, null))
-                            .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpEight, cpSeven, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, true))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                            .priority(2000)
-                            .build());
-
-        SdxL2ConnectionPoint cpNine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
-        SdxL2ConnectionPoint cpTen = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpNine, cpTen, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpTen, cpNine, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                            .priority(2000)
-                            .build());
-
+        List<PointToPointIntent> intents = new ArrayList<>();
+        intents.addAll(setupConnectionPoints1To2());
+        intents.addAll(setupConnectionPoints5To6());
+        intents.addAll(setupConnectionPoints7To8());
+        intents.addAll(setupConnectionPoints9To10());
         return intents;
     }
 
+    /**
+     * Returns the traffic treatment, used in the definition of the intents.
+     *
+     * @param setVlan VLAN to set
+     * @param pushVlan VLAN to push
+     * @param popVlan boolean to indicate whether a popVlan action is
+     *                performed (true) or not (false)
+     * @return TrafficTreatment object
+     */
     private TrafficTreatment buildTreatment(VlanId setVlan,
                                             VlanId pushVlan,
                                             boolean popVlan) {
-
-        TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
-        if (setVlan != null) {
-            treatmentBuilder.setVlanId(setVlan);
-        }
-        if (pushVlan != null) {
-            treatmentBuilder.pushVlan();
-            treatmentBuilder.setVlanId(pushVlan);
-        }
-        if (popVlan) {
-            treatmentBuilder.popVlan();
-        }
-        return treatmentBuilder.build();
+        return manager.buildTreatment(setVlan, pushVlan, popVlan);
     }
 
+    /**
+     * Returns the traffic selector, used in the definition of the intents.
+     *
+     * @param ethertype name of the Ethernet type used (e.g.  of SDX-L2
+     * @param ingresstag VLAN id used at the ingress
+     * @return TrafficSelector object
+     */
     private TrafficSelector buildSelector(Short ethertype,
                                           VlanId ingresstag) {
-
-        TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
-        if (ethertype != null) {
-            selectorBuilder.matchEthType(ethertype);
-        }
-        if (ingresstag != null) {
-            selectorBuilder.matchVlanId(ingresstag);
-        }
-        return selectorBuilder.build();
+        return manager.buildSelector(ethertype, ingresstag);
     }
 
+    /**
+     * Returns constraints depending on the encapsulation used on the VC.
+     *
+     * @return list of constraints to be used in the intents
+     */
     private List<Constraint> buildConstraints() {
-        final List<Constraint> constraints = new LinkedList<>();
-        constraints.add(new EncapsulationConstraint(EncapsulationType.MPLS));
-        return constraints;
+        return manager.buildConstraints();
     }
 
-    private Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpOne,
-                                  SdxL2ConnectionPoint cpTwo, String index) {
-        String cps = format(NAME_FORMAT, sdxl2, cpOne.name(), cpTwo.name());
-        String key = format(KEY_FORMAT, cps, index);
-        return Key.of(key, APPID);
+    /**
+     * Returns Intent key from SDX-L2 and two SDX-L2 Connection Points.
+     *
+     * @param sdxl2 name of SDX-L2
+     * @param cpOne sdxl2 connection point one
+     * @param cpTwo sdxl2 connection point two
+     * @param index digit used to help identify Intent
+     * @return canonical intent string key
+     */
+    private Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpOne, SdxL2ConnectionPoint cpTwo, String index) {
+        return manager.generateIntentKey(sdxl2, cpOne, cpTwo, index);
     }
 
+    /**
+     * Ensures that when adding a VC its related intents are inserted.
+     */
     @Test
     public void testConnectionSetup() {
         Iterator<SdxL2ConnectionPoint> lhs = setupLhsCPs().iterator();
@@ -303,8 +182,12 @@
 
     }
 
+    /**
+     * Defines the left-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
     private List<SdxL2ConnectionPoint> setupLhsCPs() {
-
         List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
         cps.add(cpOne);
@@ -314,13 +197,16 @@
         cps.add(cpSeven);
         SdxL2ConnectionPoint cpNine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
         cps.add(cpNine);
-
         return cps;
     }
 
+    /**
+     * Defines the right-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
     private List<SdxL2ConnectionPoint> setupRhsCPs() {
-
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cpTwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
         cps.add(cpTwo);
         SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
@@ -329,118 +215,169 @@
         cps.add(cpEight);
         SdxL2ConnectionPoint cpTen = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
         cps.add(cpTen);
-
         return cps;
     }
 
+    /**
+     * Creates the intents from the information of couple of endpoints.
+     *
+     * @param keyIndex identifier of the intent
+     * @param lhs left-hand side Connection Point
+     * @param lhsID DPID of the left-hand side CP
+     * @param lhsVlan VLAN of the left-hand side CP
+     * @param lhsBuiltTreatment specific treatment for the left-hand side CP
+     * @param rhs right-hand side Connection Point
+     * @param rhsID DPID of the right-hand side CP
+     * @param rhsVlan VLAN of the right-hand side CP
+     * @param rhsBuiltTreatment specific treatment for the right-hand side CP
+     * @return List of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints(String keyIndex,
+                                                           SdxL2ConnectionPoint lhs, String lhsID,
+                                                           String lhsVlan,
+                                                           TrafficTreatment lhsBuiltTreatment,
+                                                           SdxL2ConnectionPoint rhs, String rhsID,
+                                                           String rhsVlan,
+                                                           TrafficTreatment rhsBuiltTreatment) {
+        List<PointToPointIntent> intents = new ArrayList<>();
+        VlanId lhsVlanValue = null, rhsVlanValue = null;
+        if (lhsVlan != null) {
+            lhsVlanValue = VlanId.vlanId(Short.parseShort(lhsVlan));
+        }
+        if (rhsVlan != null) {
+            rhsVlanValue = VlanId.vlanId(Short.parseShort(rhsVlan));
+        }
 
+        intents.add(PointToPointIntent.builder()
+                            .appId(APPID)
+                            .key(generateIntentKey(SDXL2_2, lhs, rhs, keyIndex))
+                            .selector(buildSelector(null, lhsVlanValue))
+                            .constraints(buildConstraints())
+                            .treatment(lhsBuiltTreatment)
+                            .ingressPoint(ConnectPoint.deviceConnectPoint(lhsID))
+                            .egressPoint(ConnectPoint.deviceConnectPoint(rhsID))
+                            .priority(2000)
+                            .build());
+        intents.add(PointToPointIntent.builder()
+                            .appId(APPID)
+                            .key(generateIntentKey(SDXL2_2, rhs, lhs, keyIndex))
+                            .selector(buildSelector(null, rhsVlanValue))
+                            .constraints(buildConstraints())
+                            .treatment(rhsBuiltTreatment)
+                            .ingressPoint(ConnectPoint.deviceConnectPoint(rhsID))
+                            .egressPoint(ConnectPoint.deviceConnectPoint(lhsID))
+                            .priority(2000)
+                            .build());
+        return intents;
+    }
+
+    /**
+     * Defines three pairs of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints1To2() {
+        List<PointToPointIntent> intents = new ArrayList<>();
+        String lhsID = CP1;
+        ArrayList<String> lhsVlan =  new ArrayList<>(Arrays.asList(VLANS1.split(",")));
+        String rhsID = CP2;
+        ArrayList<String> rhsVlan =  new ArrayList<>(Arrays.asList(VLANS2.split(",")));
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint(
+                "TEST1", lhsID, VLANS1);
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint(
+                "TEST2", rhsID, VLANS2);
+        TrafficTreatment lhsBuiltTreatment, rhsBuiltTreatment;
+
+        for (int i = 0; i < 3; i++) {
+            lhsBuiltTreatment = buildTreatment(VlanId.vlanId(rhsVlan.get(i)), null, false);
+            rhsBuiltTreatment = buildTreatment(VlanId.vlanId(lhsVlan.get(i)), null, false);
+            intents.addAll(setupConnectionPoints(Integer.toString(i + 1),
+                                                 lhs, lhsID, lhsVlan.get(i), lhsBuiltTreatment,
+                                                 rhs, rhsID, rhsVlan.get(i), rhsBuiltTreatment));
+        }
+        return intents;
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints5To6() {
+        String lhsID = CP5;
+        String lhsVlan = VLANS5;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", lhsID, lhsVlan);
+        String rhsID = CP6;
+        String rhsVlan = VLANS6;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", rhsID, rhsVlan);
+        TrafficTreatment lhsBuiltTreatment =  buildTreatment(null, null, true);
+        TrafficTreatment rhsBuiltTreatment = buildTreatment(null, VlanId.vlanId(Short.parseShort(lhsVlan)), false);
+        return setupConnectionPoints("1", lhs, lhsID, lhsVlan, lhsBuiltTreatment,
+                                     rhs, rhsID, null, rhsBuiltTreatment);
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints7To8() {
+        String lhsID = CP7;
+        String lhsVlan = VLANS7;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", lhsID, lhsVlan);
+        String rhsID = CP8;
+        String rhsVlan = VLANS8;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", rhsID, rhsVlan);
+        TrafficTreatment lhsBuiltTreatment = buildTreatment(null, VlanId.vlanId(Short.parseShort(rhsVlan)), false);
+        TrafficTreatment rhsBuiltTreatment = buildTreatment(null, null, true);
+        return setupConnectionPoints("1", lhs, lhsID, null, lhsBuiltTreatment,
+                                     rhs, rhsID, rhsVlan, rhsBuiltTreatment);
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints9To10() {
+        String lhsID = CP9;
+        String lhsVlan = VLANS9;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", lhsID, lhsVlan);
+        String rhsID = CP10;
+        String rhsVlan = VLANS10;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", rhsID, rhsVlan);
+        TrafficTreatment nullTreatment = buildTreatment(null, null, false);
+        return setupConnectionPoints("1", lhs, lhsID, null, nullTreatment,
+                                     rhs, rhsID, null, nullTreatment);
+    }
+
+    /**
+     * Ensures that when removing a VC its related intents are deleted.
+     */
     @Test
-    public void removeConnection() {
+    public void removeVCAndIntents() {
         testConnectionSetup();
-
         List<PointToPointIntent> removedIntents = new ArrayList<>();
-        SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cpTwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
 
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
+        SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
+        SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
+        removedIntents.addAll(setupConnectionPoints1To2());
 
-        SdxL2ConnectionPoint cpFive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpFive, cpSix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSix, cpFive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
+        SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
+        SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
+        removedIntents.addAll(setupConnectionPoints5To6());
 
-        SdxL2ConnectionPoint cpSeven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpEight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSeven, cpEight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpEight, cpSeven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
-        manager.removeVC(cpOne, cpTwo);
-        manager.removeVC(cpFive, cpSix);
-        manager.removeVC(cpSeven, cpEight);
+        SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
+        SdxL2ConnectionPoint cpeight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
+        removedIntents.addAll(setupConnectionPoints7To8());
+
+        manager.removeVC(cpone, cptwo);
+        manager.removeVC(cpfive, cpsix);
+        manager.removeVC(cpseven, cpeight);
 
         assertEquals(2, manager.intentService.getIntentCount());
 
@@ -458,140 +395,29 @@
         }
     }
 
-
+    /**
+     * Ensures that when removing a CP its related VCs and intents are also deleted.
+     */
     @Test
-    public void testremoveVCbyCP() {
+    public void testRemoveVCbyCP() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
-        SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cpTwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
+        SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
+        removedIntents.addAll(setupConnectionPoints1To2());
+        SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
+        removedIntents.addAll(setupConnectionPoints5To6());
+        SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
+        removedIntents.addAll(setupConnectionPoints7To8());
+        SdxL2ConnectionPoint cpten = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
+        removedIntents.addAll(setupConnectionPoints9To10());
 
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
+        manager.removeVC(cpone);
+        manager.removeVC(cpsix);
+        manager.removeVC(cpseven);
+        manager.removeVC(cpten);
 
-        SdxL2ConnectionPoint cpFive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpFive, cpSix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSix, cpFive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpSeven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpEight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSeven, cpEight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpEight, cpSeven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpNine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
-        SdxL2ConnectionPoint cpTen = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpNine, cpTen, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTen, cpNine, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .priority(2000)
-                                    .build());
-
-
-        manager.removeVC(cpOne);
-        manager.removeVC(cpSix);
-        manager.removeVC(cpSeven);
-        manager.removeVC(cpTen);
-
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
 
         assertEquals(0, manager.intentService.getIntentCount());
 
@@ -610,134 +436,21 @@
 
     }
 
+    /**
+     * Ensures that when removing a CP its related VCs and intents are also deleted.
+     */
     @Test
-    public void testremoveVCbySdx() {
+    public void testRemoveVCbySdx() {
         testConnectionSetup();
 
         List<PointToPointIntent> removedIntents = new ArrayList<>();
-        SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cpTwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpOne, cpTwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTwo, cpOne, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpFive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpFive, cpSix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSix, cpFive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpSeven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpEight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpSeven, cpEight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpEight, cpSeven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpNine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
-        SdxL2ConnectionPoint cpTen = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpNine, cpTen, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpTen, cpNine, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .priority(2000)
-                                    .build());
+        removedIntents.addAll(setupConnectionPoints1To2());
+        removedIntents.addAll(setupConnectionPoints5To6());
+        removedIntents.addAll(setupConnectionPoints7To8());
+        removedIntents.addAll(setupConnectionPoints9To10());
 
         manager.removeVCs(SDXL2_2);
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
         assertEquals(Collections.emptySet(), manager.getVCs(Optional.of(SDXL2_2)));
 
         for (Intent removedIntent : removedIntents) {
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VCManagerTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VCManagerTest.java
index 26323fb..4071a96 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VCManagerTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VCManagerTest.java
@@ -42,6 +42,9 @@
 import static org.junit.Assert.assertNull;
 
 
+/**
+ * Unit tests for SDX-L2 VC Manager.
+ */
 public class SdxL2VCManagerTest {
 
     private static final String SDXL2_1 = "sdxl2_test1";
@@ -74,12 +77,16 @@
     private static final String VLANS10 = "1";
     private static final String CEMAC10 = "52:12:14:aa:23:11";
     private static final ApplicationId APPID = TestApplicationId.create("foo");
+    /**
+     * Exception expected to raise when creating VC with CPs using both same MAC.
+     */
     @Rule
     public ExpectedException exceptionAddVC = ExpectedException.none();
+    /**
+     * Exception expected to raise when removing VC with CPs using both same MAC.
+     */
     @Rule
     public ExpectedException exceptionRemoveVC = ExpectedException.none();
-    @Rule
-    public ExpectedException exceptionGetVC = ExpectedException.none();
     private SdxL2MacVCManager manager;
     private IdGenerator idGenerator = new MockIdGenerator();
 
@@ -103,8 +110,11 @@
         Intent.unbindIdGenerator(idGenerator);
     }
 
+    /**
+     * Ensure that intents generated when reversing endpoints are different.
+     */
     @Test
-    public void testgenerateKey() {
+    public void testGeneratedIntentsHaveDifferentKey() {
         SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint cpOneAux = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2, CEMAC1);
 
@@ -120,9 +130,11 @@
         assertNotEquals(key3, key4);
     }
 
+    /**
+     * Tests proper creation of VCs only when endpoints have different MAC address.
+     */
     @Test
     public void testAddVCChecks() {
-
         SdxL2ConnectionPoint cpFive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint cpSix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2, CEMAC2);
         manager.addVC(SDXL2_1, cpFive, cpSix);
@@ -141,6 +153,9 @@
         manager.addVC(SDXL2_1, cpOne, cpTwo);
     }
 
+    /**
+     * Tests proper removal of VCs only when endpoints have different MAC address.
+     */
     @Test
     public void testremoveVCChecks() {
         SdxL2ConnectionPoint cpOne = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
@@ -164,6 +179,9 @@
         manager.removeVC(cpOne, cpTwo);
     }
 
+    /**
+     * Verifies that only VCs created properly (here, during set up) are retrieved.
+     */
     @Test
     public void testGetVC() {
         connectionSetup();
@@ -184,17 +202,14 @@
 
         SdxL2ConnectionPoint cpLeft = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint cpRight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP3, VLANS3, CEMAC1);
-
-        // This VC has not been created before
-        vc = cpLeft.toString().compareTo(cpRight.toString()) < 0 ?
-                format(SdxL2VCManager.SDXL2_CPS_FORMAT, cpLeft, cpRight) :
-                format(SdxL2VCManager.SDXL2_CPS_FORMAT, cpRight, cpLeft);
-
         assertNull(manager.getVC(cpLeft, cpRight));
     }
 
+    /**
+     * Verifies that only VCs created properly (here, during set up) are retrieved.
+     */
     @Test
-    public void testgetVCs() {
+    public void testGetVCs() {
         connectionSetup();
         Iterator<SdxL2ConnectionPoint> lhs = setupLhsCPs().iterator();
         Iterator<SdxL2ConnectionPoint> rhs = setupRhsCPs().iterator();
@@ -205,7 +220,7 @@
         while (lhs.hasNext()) {
             lhsName = lhs.next().name();
             rhsName = rhs.next().name();
-            vc = lhsName.compareTo(rhsName.toString()) < 0 ?
+            vc = lhsName.compareTo(rhsName) < 0 ?
                     format(SdxL2VCManager.NAME_FORMAT, SDXL2_2, lhsName, rhsName) :
                     format(SdxL2VCManager.NAME_FORMAT, SDXL2_2, rhsName, lhsName);
             expectedVCs.add(vc);
@@ -214,12 +229,17 @@
         assertEquals(expectedVCs, vcs);
         vcs = manager.getVCs(Optional.of(SDXL2_1));
         assertEquals(Collections.emptySet(), vcs);
-        vcs = manager.getVCs(Optional.ofNullable(null));
+        vcs = manager.getVCs(Optional.empty());
         assertEquals(expectedVCs, vcs);
     }
 
-    public List<SdxL2ConnectionPoint> setupLhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the left-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupLhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1, CEMAC1);
         cps.add(cpone);
         SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5, CEMAC5);
@@ -231,8 +251,13 @@
         return cps;
     }
 
-    public List<SdxL2ConnectionPoint> setupRhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the right-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupRhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2, CEMAC2);
         cps.add(cptwo);
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6, CEMAC6);
@@ -244,6 +269,9 @@
         return cps;
     }
 
+    /**
+     * Sets the connection up by adding CPs for left and right hand side of the VCs.
+     */
     private void connectionSetup() {
         Iterator<SdxL2ConnectionPoint> lhs = setupLhsCPs().iterator();
         Iterator<SdxL2ConnectionPoint> rhs = setupRhsCPs().iterator();
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VlanVCManagerTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VlanVCManagerTest.java
index e6dd921..6b03ca7 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VlanVCManagerTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2VlanVCManagerTest.java
@@ -23,9 +23,6 @@
 import org.onosproject.TestApplicationId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.EncapsulationType;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.AbstractIntentTest;
@@ -34,13 +31,11 @@
 import org.onosproject.net.intent.IntentUtils;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.net.intent.constraint.EncapsulationConstraint;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Optional;
 
@@ -63,11 +58,7 @@
     private static final String CP9 = "of:0000000000000a/4";
     private static final String CP10 = "of:00000000000009/4";
     private static final String VLANS1 = "2,3,4";
-    private static final ArrayList<String> VLANS1_ARRAY =
-            new ArrayList<String>(Arrays.asList(VLANS1.split(",")));;
     private static final String VLANS2 = "4,5,6";
-    private static final ArrayList<String> VLANS2_ARRAY =
-            new ArrayList<String>(Arrays.asList(VLANS2.split(",")));;
     private static final String VLANS5 = "100";
     private static final String VLANS6 = "1";
     private static final String VLANS7 = "1";
@@ -77,12 +68,13 @@
     private static final String NAME_FORMAT = "%s:%s-%s";
     private static final String KEY_FORMAT = "%s,%s";
     private static final ApplicationId APPID = TestApplicationId.create("foo");
-    private static final int POINT_TO_POINT_INDEXES = 3;
     private SdxL2VlanVCManager manager;
     private List<PointToPointIntent> intentList;
 
     /**
-     * Prepare environment before starting testing VLAN-based VCs.
+     * Prepares environment before starting testing.
+     *
+     * @throws Exception when set-up fails
      */
     @Before
     public void setUp() throws Exception {
@@ -95,159 +87,79 @@
     }
 
     /**
-     * Clean up environment after finishing testing VLAN-based VCs.
+     * Cleans up environment after finishing testing.
      */
     @After
     public void tearDown() {
         super.tearDown();
     }
 
-    public List<PointToPointIntent> setIntents() {
-        List<PointToPointIntent> intents = new ArrayList<PointToPointIntent>();
-        List<Constraint> encapsulation = buildConstraints();
-
-        SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-        for (int i = 0; i < POINT_TO_POINT_INDEXES; i++) {
-            intents.add(PointToPointIntent.builder()
-                                .appId(APPID)
-                                .key(generateIntentKey(SDXL2_2, cpone, cptwo, Integer.toString(i + 1))) // 1
-                                .selector(buildSelector(null, VlanId.vlanId(Short.parseShort(VLANS1_ARRAY.get(i)))))
-                                .treatment(buildTreatment(
-                                        VlanId.vlanId(Short.parseShort(VLANS2_ARRAY.get(i))), null, false))
-                                .constraints(encapsulation)
-                                .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                .priority(2000)
-                                .build());
-            intents.add(PointToPointIntent.builder()
-                                .appId(APPID)
-                                .key(generateIntentKey(SDXL2_2, cptwo, cpone, Integer.toString(i + 1)))
-                                .selector(buildSelector(null, VlanId.vlanId(Short.parseShort(VLANS2_ARRAY.get(i)))))
-                                .treatment(buildTreatment(
-                                        VlanId.vlanId(Short.parseShort(VLANS1_ARRAY.get(i))), null, false))
-                                .constraints(encapsulation)
-                                .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                .priority(2000)
-                                .build());
-        }
-
-        SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpfive, cpsix, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                            .treatment(buildTreatment(null, null, true))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpsix, cpfive, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                            .priority(2000)
-                            .build());
-
-        SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpeight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpseven, cpeight, "1"))
-                            .selector(buildSelector(null, null))
-                            .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                            .constraints(encapsulation)
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpeight, cpseven, "1"))
-                            .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, true))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                            .priority(2000)
-                            .build());
-
-        SdxL2ConnectionPoint cpnine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
-        SdxL2ConnectionPoint cpten = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpnine, cpten, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                            .priority(2000)
-                            .build());
-        intents.add(PointToPointIntent.builder()
-                            .appId(APPID)
-                            .key(generateIntentKey(SDXL2_2, cpten, cpnine, "1"))
-                            .selector(buildSelector(null, null))
-                            .constraints(encapsulation)
-                            .treatment(buildTreatment(null, null, false))
-                            .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                            .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                            .priority(2000)
-                            .build());
-
+    /**
+     * Defines the intents to be used when testing the VC.
+     *
+     * @return List of point-to-point intents
+     */
+    private List<PointToPointIntent> setIntents() {
+        List<PointToPointIntent> intents = new ArrayList<>();
+        intents.addAll(setupConnectionPoints1To2());
+        intents.addAll(setupConnectionPoints5To6());
+        intents.addAll(setupConnectionPoints7To8());
+        intents.addAll(setupConnectionPoints9To10());
         return intents;
     }
 
+    /**
+     * Returns the traffic treatment, used in the definition of the intents.
+     *
+     * @param setVlan VLAN to set
+     * @param pushVlan VLAN to push
+     * @param popVlan boolean to indicate whether a popVlan action is
+     *                performed (true) or not (false)
+     * @return TrafficTreatment object
+     */
     private TrafficTreatment buildTreatment(VlanId setVlan,
                                             VlanId pushVlan,
                                             boolean popVlan) {
-
-        TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
-        if (setVlan != null) {
-            treatmentBuilder.setVlanId(setVlan);
-        }
-        if (pushVlan != null) {
-            treatmentBuilder.pushVlan();
-            treatmentBuilder.setVlanId(pushVlan);
-        }
-        if (popVlan) {
-            treatmentBuilder.popVlan();
-        }
-        return treatmentBuilder.build();
+        return manager.buildTreatment(setVlan, pushVlan, popVlan);
     }
 
+    /**
+     * Returns the traffic selector, used in the definition of the intents.
+     *
+     * @param ethertype name of the Ethernet type used (e.g.  of SDX-L2
+     * @param ingresstag VLAN id used at the ingress
+     * @return TrafficSelector object
+     */
     private TrafficSelector buildSelector(Short ethertype,
                                           VlanId ingresstag) {
-
-        TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
-        if (ethertype != null) {
-            selectorBuilder.matchEthType(ethertype);
-        }
-        if (ingresstag != null) {
-            selectorBuilder.matchVlanId(ingresstag);
-        }
-        return selectorBuilder.build();
+        return manager.buildSelector(ethertype, ingresstag);
     }
 
-    protected List<Constraint> buildConstraints() {
-        final List<Constraint> constraints = new LinkedList<>();
-        constraints.add(new EncapsulationConstraint(EncapsulationType.VLAN));
-        return constraints;
+    /**
+     * Returns constraints depending on the encapsulation used on the VC.
+     *
+     * @return list of constraints to be used in the intents
+     */
+    private List<Constraint> buildConstraints() {
+        return manager.buildConstraints();
     }
 
-    private Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpone, SdxL2ConnectionPoint cptwo, String index) {
-        String cps = format(NAME_FORMAT, sdxl2, cpone.name(), cptwo.name());
-        String key = format(KEY_FORMAT, cps, index);
-        return Key.of(key, APPID);
+    /**
+     * Returns Intent key from SDX-L2 and two SDX-L2 Connection Points.
+     *
+     * @param sdxl2 name of SDX-L2
+     * @param cpOne sdxl2 connection point one
+     * @param cpTwo sdxl2 connection point two
+     * @param index digit used to help identify Intent
+     * @return canonical intent string key
+     */
+    private Key generateIntentKey(String sdxl2, SdxL2ConnectionPoint cpOne, SdxL2ConnectionPoint cpTwo, String index) {
+        return manager.generateIntentKey(sdxl2, cpOne, cpTwo, index);
     }
 
+    /**
+     * Ensures that when adding a VC its related intents are inserted.
+     */
     @Test
     public void testConnectionSetup() {
         Iterator<SdxL2ConnectionPoint> lhs = setupLhsCPs().iterator();
@@ -272,8 +184,13 @@
         }
     }
 
-    public List<SdxL2ConnectionPoint> setupLhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the left-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupLhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
         cps.add(cpone);
         SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
@@ -285,8 +202,13 @@
         return cps;
     }
 
-    public List<SdxL2ConnectionPoint> setupRhsCPs() {
-        List<SdxL2ConnectionPoint> cps = new ArrayList<SdxL2ConnectionPoint>();
+    /**
+     * Defines the right-hand side endpoints, each with a specific VLAN.
+     *
+     * @return list of SdxL2ConnectionPoint objects
+     */
+    private List<SdxL2ConnectionPoint> setupRhsCPs() {
+        List<SdxL2ConnectionPoint> cps = new ArrayList<>();
         SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
         cps.add(cptwo);
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
@@ -298,111 +220,162 @@
         return cps;
     }
 
+    /**
+     * Creates the intents from the information of couple of endpoints.
+     *
+     * @param keyIndex identifier of the intent
+     * @param lhs left-hand side Connection Point
+     * @param lhsID DPID of the left-hand side CP
+     * @param lhsVlan VLAN of the left-hand side CP
+     * @param lhsBuiltTreatment specific treatment for the left-hand side CP
+     * @param rhs right-hand side Connection Point
+     * @param rhsID DPID of the right-hand side CP
+     * @param rhsVlan VLAN of the right-hand side CP
+     * @param rhsBuiltTreatment specific treatment for the right-hand side CP
+     * @return List of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints(String keyIndex,
+                                                           SdxL2ConnectionPoint lhs, String lhsID,
+                                                           String lhsVlan,
+                                                           TrafficTreatment lhsBuiltTreatment,
+                                                           SdxL2ConnectionPoint rhs, String rhsID,
+                                                           String rhsVlan,
+                                                           TrafficTreatment rhsBuiltTreatment) {
+        List<PointToPointIntent> intents = new ArrayList<>();
+        VlanId lhsVlanValue = null, rhsVlanValue = null;
+        if (lhsVlan != null) {
+            lhsVlanValue = VlanId.vlanId(Short.parseShort(lhsVlan));
+        }
+        if (rhsVlan != null) {
+            rhsVlanValue = VlanId.vlanId(Short.parseShort(rhsVlan));
+        }
 
+        intents.add(PointToPointIntent.builder()
+                            .appId(APPID)
+                            .key(generateIntentKey(SDXL2_2, lhs, rhs, keyIndex))
+                            .selector(buildSelector(null, lhsVlanValue))
+                            .treatment(lhsBuiltTreatment)
+                            .constraints(buildConstraints())
+                            .ingressPoint(ConnectPoint.deviceConnectPoint(lhsID))
+                            .egressPoint(ConnectPoint.deviceConnectPoint(rhsID))
+                            .priority(2000)
+                            .build());
+        intents.add(PointToPointIntent.builder()
+                            .appId(APPID)
+                            .key(generateIntentKey(SDXL2_2, rhs, lhs, keyIndex))
+                            .selector(buildSelector(null, rhsVlanValue))
+                            .treatment(rhsBuiltTreatment)
+                            .constraints(buildConstraints())
+                            .ingressPoint(ConnectPoint.deviceConnectPoint(rhsID))
+                            .egressPoint(ConnectPoint.deviceConnectPoint(lhsID))
+                            .priority(2000)
+                            .build());
+        return intents;
+    }
+
+    /**
+     * Defines three pairs of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints1To2() {
+        List<PointToPointIntent> intents = new ArrayList<>();
+        String lhsID = CP1;
+        ArrayList<String> lhsVlan = new ArrayList<>(Arrays.asList(VLANS1.split(",")));
+        String rhsID = CP2;
+        ArrayList<String> rhsVlan = new ArrayList<>(Arrays.asList(VLANS2.split(",")));
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint(
+                "TEST1", lhsID, VLANS1);
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint(
+                "TEST2", rhsID, VLANS2);
+        TrafficTreatment lhsBuiltTreatment, rhsBuiltTreatment;
+
+        for (int i = 0; i < 3; i++) {
+            lhsBuiltTreatment = buildTreatment(VlanId.vlanId(rhsVlan.get(i)), null, false);
+            rhsBuiltTreatment = buildTreatment(VlanId.vlanId(lhsVlan.get(i)), null, false);
+            intents.addAll(setupConnectionPoints(Integer.toString(i + 1),
+                                                 lhs, lhsID, lhsVlan.get(i), lhsBuiltTreatment,
+                                                 rhs, rhsID, rhsVlan.get(i), rhsBuiltTreatment));
+        }
+        return intents;
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints5To6() {
+        String lhsID = CP5;
+        String lhsVlan = VLANS5;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", lhsID, lhsVlan);
+        String rhsID = CP6;
+        String rhsVlan = VLANS6;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", rhsID, rhsVlan);
+        TrafficTreatment lhsBuiltTreatment =  buildTreatment(null, null, true);
+        TrafficTreatment rhsBuiltTreatment = buildTreatment(null, VlanId.vlanId(Short.parseShort(lhsVlan)), false);
+        return setupConnectionPoints("1", lhs, lhsID, lhsVlan, lhsBuiltTreatment,
+                                     rhs, rhsID, null, rhsBuiltTreatment);
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints7To8() {
+        String lhsID = CP7;
+        String lhsVlan = VLANS7;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", lhsID, lhsVlan);
+        String rhsID = CP8;
+        String rhsVlan = VLANS8;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", rhsID, rhsVlan);
+        TrafficTreatment lhsBuiltTreatment = buildTreatment(null, VlanId.vlanId(Short.parseShort(rhsVlan)), false);
+        TrafficTreatment rhsBuiltTreatment = buildTreatment(null, null, true);
+        return setupConnectionPoints("1", lhs, lhsID, null, lhsBuiltTreatment,
+                                     rhs, rhsID, rhsVlan, rhsBuiltTreatment);
+    }
+
+    /**
+     * Defines a couple of Connection Points, each with a specific VLAN.
+     * The intents are created aftewards, from this input.
+     *
+     * @return list of point-to-point intents
+     */
+    private List<PointToPointIntent> setupConnectionPoints9To10() {
+        String lhsID = CP9;
+        String lhsVlan = VLANS9;
+        SdxL2ConnectionPoint lhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", lhsID, lhsVlan);
+        String rhsID = CP10;
+        String rhsVlan = VLANS10;
+        SdxL2ConnectionPoint rhs = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", rhsID, rhsVlan);
+        TrafficTreatment nullTreatment = buildTreatment(null, null, false);
+        return setupConnectionPoints("1", lhs, lhsID, null, nullTreatment,
+                                     rhs, rhsID, null, nullTreatment);
+    }
+
+    /**
+     * Ensures that when removing a VC its related intents are deleted.
+     */
     @Test
-    public void removeConnection() {
+    public void removeVCAndIntents() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
         SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
+        removedIntents.addAll(setupConnectionPoints1To2());
 
         SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpfive, cpsix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpsix, cpfive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
+        removedIntents.addAll(setupConnectionPoints5To6());
 
         SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
         SdxL2ConnectionPoint cpeight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpseven, cpeight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpeight, cpseven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
+        removedIntents.addAll(setupConnectionPoints7To8());
 
         manager.removeVC(cpone, cptwo);
         manager.removeVC(cpfive, cpsix);
@@ -422,142 +395,31 @@
             }
             assertTrue(!found);
         }
-
     }
 
-
+    /**
+     * Ensures that when removing a CP its related VCs and intents are also deleted.
+     */
     @Test
     public void testRemoveVCbyCP() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
         SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
+        removedIntents.addAll(setupConnectionPoints1To2());
         SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpfive, cpsix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpsix, cpfive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
-
+        removedIntents.addAll(setupConnectionPoints5To6());
         SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpeight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpseven, cpeight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpeight, cpseven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpnine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
+        removedIntents.addAll(setupConnectionPoints7To8());
         SdxL2ConnectionPoint cpten = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpnine, cpten, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpten, cpnine, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .priority(2000)
-                                    .build());
+        removedIntents.addAll(setupConnectionPoints9To10());
 
         manager.removeVC(cpone);
         manager.removeVC(cpsix);
         manager.removeVC(cpseven);
         manager.removeVC(cpten);
 
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
 
         assertEquals(0, manager.intentService.getIntentCount());
 
@@ -573,137 +435,23 @@
             }
             assertTrue(!found);
         }
-
     }
 
+    /**
+     * Ensures that when removing a SDX its related VCs and intents are also deleted.
+     */
     @Test
     public void testremoveVCbySdx() {
         testConnectionSetup();
 
-        List<PointToPointIntent> removedIntents = new ArrayList<PointToPointIntent>();
-        SdxL2ConnectionPoint cpone = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST1", CP1, VLANS1);
-        SdxL2ConnectionPoint cptwo = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST2", CP2, VLANS2);
-
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("2"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("2")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("3"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("5")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "2"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("5"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("3")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpone, cptwo, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("4"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("6")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cptwo, cpone, "3"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("6"))))
-                                    .treatment(buildTreatment(VlanId.vlanId(Short.parseShort("4")), null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP2))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP1))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpfive = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST5", CP5, VLANS5);
-        SdxL2ConnectionPoint cpsix = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST6", CP6, VLANS6);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpfive, cpsix, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("100"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpsix, cpfive, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("100")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP6))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP5))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpseven = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST7", CP7, VLANS7);
-        SdxL2ConnectionPoint cpeight = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST8", CP8, VLANS8);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpseven, cpeight, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, VlanId.vlanId(Short.parseShort("111")), false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpeight, cpseven, "1"))
-                                    .selector(buildSelector(null, VlanId.vlanId(Short.parseShort("111"))))
-                                    .treatment(buildTreatment(null, null, true))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP8))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP7))
-                                    .priority(2000)
-                                    .build());
-
-        SdxL2ConnectionPoint cpnine = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST9", CP9, VLANS9);
-        SdxL2ConnectionPoint cpten = SdxL2ConnectionPoint.sdxl2ConnectionPoint("TEST10", CP10, VLANS10);
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpnine, cpten, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .priority(2000)
-                                    .build());
-        removedIntents.add(PointToPointIntent.builder()
-                                    .appId(APPID)
-                                    .key(generateIntentKey(SDXL2_2, cpten, cpnine, "1"))
-                                    .selector(buildSelector(null, null))
-                                    .treatment(buildTreatment(null, null, false))
-                                    .ingressPoint(ConnectPoint.deviceConnectPoint(CP10))
-                                    .egressPoint(ConnectPoint.deviceConnectPoint(CP9))
-                                    .priority(2000)
-                                    .build());
+        List<PointToPointIntent> removedIntents = new ArrayList<>();
+        removedIntents.addAll(setupConnectionPoints1To2());
+        removedIntents.addAll(setupConnectionPoints5To6());
+        removedIntents.addAll(setupConnectionPoints7To8());
+        removedIntents.addAll(setupConnectionPoints9To10());
 
         manager.removeVCs(SDXL2_2);
-        assertEquals(Collections.emptySet(), manager.getVCs(Optional.ofNullable(null)));
+        assertEquals(Collections.emptySet(), manager.getVCs(Optional.empty()));
         assertEquals(Collections.emptySet(), manager.getVCs(Optional.of(SDXL2_2)));
 
         for (Intent removedIntent : removedIntents) {
@@ -718,6 +466,5 @@
             }
             assertTrue(!found);
         }
-
     }
 }
\ No newline at end of file
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/VirtualCircuitTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/VirtualCircuitTest.java
index 97dadcb..7184d67 100644
--- a/sdx-l2/src/test/java/org/onosproject/sdxl2/VirtualCircuitTest.java
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/VirtualCircuitTest.java
@@ -17,47 +17,49 @@
 package org.onosproject.sdxl2;
 
 
+import com.google.common.testing.EqualsTester;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 
 /**
- * Tests VirtualCircuit functionalities.
+ * Tests VirtualCircuit functionality.
  */
 public class VirtualCircuitTest {
 
+    private static final String CP1 = "of:00000000000001/1";
+    private static final String CP2 = "of:00000000000002/1";
+    private static final String VLANS1 = "1,2,3,4";
+    private static final String VLANS3 = "1,2,3";
+    private static final String CEMAC1 = "52:40:00:12:44:01";
+    private static final String CEMAC6 = "52:40:00:12:44:02";
 
-    public static final String CP1 = "of:00000000000001/1";
-    public static final String CP2 = "of:00000000000002/1";
-    public static final String VLANS1 = "1,2,3,4";
-    public static final String VLANS3 = "1,2,3";
-    public static final String CEMAC1 = "52:40:00:12:44:01";
-    public static final String CEMAC6 = "52:40:00:12:44:02";
-
-    /*
-     * Tests VC with different VLANs.
+    /**
+     * Tests creation of VC with CPs using different endpoints, VLANs and Mac.
      */
     @Test
     public void testVC1() {
         SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS3, CEMAC6);
         VirtualCircuit vc1 = new VirtualCircuit(scp1, scp2);
+        assertNotEquals(null, vc1);
     }
 
-    /*
-    Tests creating VC with the same VLANs.
-    */
+    /**
+     * Tests whether VCs with same endpoints (VC1, VC2) are considered similar.
+     */
     @Test
     public void testVCEquality() {
         SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC1);
         SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS3, CEMAC6);
         VirtualCircuit vc1 = new VirtualCircuit(scp1, scp2);
         VirtualCircuit vc2 = new VirtualCircuit(scp2, scp1);
-        assertEquals(vc1, vc2);
         SdxL2ConnectionPoint scp3 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI2", CP1, VLANS1, CEMAC1);
         VirtualCircuit vc3 = new VirtualCircuit(scp1, scp3);
-        assertNotEquals(vc1, vc3);
+        // vc1 == vc2, but those are different from vc3
+        new EqualsTester()
+                .addEqualityGroup(vc1, vc2)
+                .addEqualityGroup(vc3)
+                .testEquals();
     }
-
 }