Changes:
- sdx-l2 first commit
- Add entity SdxL2ConnectionPoint
- Add serialization for SdxL2ConnectionPoint
- Add test for SdxL2ConnectionPoint
- Add readme
- Add high level design representation

Change-Id: Ieebfcda273b48918348aa7628bdb7fde6b1cd830
diff --git a/pom.xml b/pom.xml
index 2629e09..9b7a99c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
         <module>ipfix</module>
         <module>oneping</module>
         <module>sdx-l3</module>
+	<module>sdx-l2</module>
         <module>tvue</module>
         <module>uiref</module>
         <module>ecord/co</module>
diff --git a/sdx-l2/README.md b/sdx-l2/README.md
new file mode 100644
index 0000000..19baf7b
--- /dev/null
+++ b/sdx-l2/README.md
@@ -0,0 +1,101 @@
+![GEANT logo](http://www.geant.org/Style%20Library/Geant/Images/logo.png "http://geant.org")
+
+Software Defined eXchange - L2
+==========================
+
+SDXL2 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).
+
+Tips
+==============
+
+TBD.
+
+SDXL2 dependencies
+=============================
+
+TBD.
+
+SDXL2 installation
+=============================
+
+- Compile the project:
+
+        mci
+
+    or to skip unit tests:
+
+        mci -Dmaven.test.skip=true
+
+- Install in your ONOS deployment:
+
+        onos-app $OC1 install target/SDXL2-1.0-SNAPSHOT.oar
+
+SDXL2 cli commands
+=============================
+
+- Create a named SDX:
+
+        add-sdxl2 $sdxname
+
+
+- Delete a named SDX:
+
+        remove-sdxl2 $sdxname
+
+
+- List all the active SDXs:
+
+        list-sdxl2s
+
+
+- Create a named SDX connection point:
+
+        add-sdxl2cp [-ce_mac] $mac $sdxname $connectionpoint $vlans $sdxcpname
+
+
+- Remove a named SDX connection point:
+
+        remove-sdxl2cp $sdxcpname
+
+
+- List all the active SDX connection points or all the active SDX connection points related to an SDX:
+
+        list-sdxl2cps [$sdxname]
+
+
+- Get the information of an SDX connection point:
+
+        sdxl2cp $sdxcpname
+
+
+- Create a VC between two connection points:
+
+        add-sdxl2vc $sdxname $sdxcp1 $sdxcp2
+
+
+- Remove a named VC:
+
+        remove-sdxl2vc $sdxcname
+
+
+- List all the active layer2 virtual circuit or all the layer2 vc related to an SDX:
+
+        list-sdxl2vcs [$sdxname]
+
+
+- Get the information of a layer 2 virtual circuit:
+
+        sdxl2vc $sdxvcname
+
+SDXL2 GUI
+=============================
+
+- TBD
\ No newline at end of file
diff --git a/sdx-l2/pom.xml b/sdx-l2/pom.xml
new file mode 100644
index 0000000..3929c23
--- /dev/null
+++ b/sdx-l2/pom.xml
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016 Open Networking Laboratory
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+    <artifactId>onos-app-samples</artifactId>
+    <groupId>org.onosproject</groupId>
+    <version>1.6.0-SNAPSHOT</version>
+  </parent>
+
+    <groupId>org.onosproject</groupId>
+    <artifactId>onos-app-sdx-l2</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <description>SDX-L2 application for ONOS project developed by GEANT</description>
+    <url>http://www.geant.org</url>
+
+    <properties>
+        <onos.version>1.6.0-SNAPSHOT</onos.version>
+        <onos.app.name>org.onosproject.sdx-l2</onos.app.name>
+        <onos.app.origin>GN4 project</onos.app.origin>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+        </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>
+            <version>${onos.version}</version>
+            <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>
+            <version>4.3.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>3.0.3</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-sdnip</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>3.2</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-routing-api</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>5.0.0</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.5.3</version>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.5.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <version>1.20.0</version>
+                <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>
+                <version>1.5</version>
+                <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>
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java
new file mode 100644
index 0000000..6370ddc
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPoint.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2016 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 com.google.common.base.MoreObjects;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Sdx-l2 connection point expressed as composition of a:
+ * ConnectPoint; Set of Vlanid; Customer edge MAC address (optional).
+ */
+public class SdxL2ConnectionPoint {
+
+    private String name;
+    private final ConnectPoint cPoint;
+    private final List<VlanId> vlanIds;
+    private final MacAddress ceMac;
+
+    /**
+     * Creates a new SDXL2 connection point.
+     *
+     * @param name connection point name
+     * @param cPoint connection point
+     * @param vlans the customer edge vlans
+     * @param ceMac the customer edge router mac address
+     */
+    public SdxL2ConnectionPoint(String name, ConnectPoint cPoint, List<VlanId> vlans, MacAddress ceMac) {
+        this.name = name;
+        this.cPoint = cPoint;
+        this.vlanIds = vlans;
+        this.ceMac = ceMac;
+    }
+
+    /**
+     * Return the name of SDXL2 connection point.
+     *
+     * @return a string representing the name of connection point
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Returns the connection point.
+     *
+     * @return connection point object
+     */
+    public ConnectPoint connectPoint() {
+        return cPoint;
+    }
+
+    /**
+     * Returns the set of vlans that are used by the customer edge.
+     *
+     * @return a set of vlan ids
+     */
+    public List<VlanId> vlanIds() {
+        return vlanIds;
+    }
+
+    /**
+     * Returns the customer edge mac address.
+     *
+     * @return a mac address object
+     */
+    public MacAddress macAddress() {
+        return ceMac;
+    }
+
+    /**
+     * Parse a device connect point from a string, set of vlans from a string
+     * and mac from a string.
+     * The connect point should be in the format "deviceUri/portNumber".
+     * The vlans should be in the format "vlan1,vlan2,vlan3"
+     * The mac address should be in hex
+     *
+     * @param name name of the SDXL2 cp
+     * @param connectPoint connection point to parse
+     * @param vlans vlanIds to parse
+     * @param mac mac address to parse
+     * @return a ConnectPoint based on the information in the string.
+     *
+     */
+    public static SdxL2ConnectionPoint
+    sdxl2ConnectionPoint(String name, String connectPoint, String vlans, String mac) {
+        checkNotNull(connectPoint);
+        checkNotNull(vlans);
+        checkState(!(name.contains(",") ||
+                name.contains("-") ||
+                name.contains("vlanid=") ||
+                name.contains("ConnectPoint{") ||
+                name.contains("elementId=") ||
+                name.contains("portNumber=") ||
+                name.contains("{") ||
+                name.contains("}") ||
+                name.contains("|")), "Names cannot contain some special characters");
+        checkNotNull(mac);
+        ConnectPoint connectionPoint = ConnectPoint.deviceConnectPoint(connectPoint);
+        String[] splitted = vlans.split(",");
+        checkArgument(splitted.length != 0, "At least '-1' or '1' as value");
+        List<VlanId> vlanslist = new ArrayList<>();
+        for (String vlan : splitted) {
+            if (!vlanslist.contains(VlanId.vlanId(Short.parseShort(vlan))) &&
+                    Short.parseShort(vlan) != -1 &&
+                    Short.parseShort(vlan) != 1) {
+                vlanslist.add(VlanId.vlanId(Short.parseShort(vlan)));
+            }
+        }
+        MacAddress macAddress = MacAddress.valueOf(mac);
+        return new SdxL2ConnectionPoint(name, connectionPoint, vlanslist, macAddress);
+    }
+
+    /**
+     * Parse a device connect point from a string and set of vlans from a string.
+     * The connect point should be in the format "deviceUri/portNumber".
+     * The vlans should be in the format "vlan1,vlan2,vlan3"
+     *
+     * @param name name of the SDXL2 cp
+     * @param connectPoint connection point to parse
+     * @param vlans vlanIds to parse
+     * @return a ConnectPoint based on the information in the string.
+     *
+     */
+    public static SdxL2ConnectionPoint sdxl2ConnectionPoint(String name, String connectPoint, String vlans) {
+        checkNotNull(connectPoint);
+        checkNotNull(vlans);
+        checkState(!(name.contains(",") ||
+                name.contains("-") ||
+                name.contains("vlanid=") ||
+                name.contains("ConnectPoint{") ||
+                name.contains("elementId=") ||
+                name.contains("portNumber=") ||
+                name.contains("{") ||
+                name.contains("}") ||
+                name.contains("|")), "Names cannot contain some special characters");
+        ConnectPoint connectionPoint = ConnectPoint.deviceConnectPoint(connectPoint);
+        String[] splitted = vlans.split(",");
+        checkArgument(splitted.length != 0, "At least '-1' or '1' as value");
+        List<VlanId> vlanslist = new ArrayList<>();
+        for (String vlan : splitted) {
+            if (!vlanslist.contains(VlanId.vlanId(Short.parseShort(vlan))) &&
+                    Short.parseShort(vlan) != -1 &&
+                    Short.parseShort(vlan) != 1) {
+                vlanslist.add(VlanId.vlanId(Short.parseShort(vlan)));
+            }
+        }
+        MacAddress macAddress = MacAddress.ZERO;
+        return new SdxL2ConnectionPoint(name, connectionPoint, vlanslist, macAddress);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(name, cPoint, vlanIds, ceMac);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof SdxL2ConnectionPoint) {
+            final SdxL2ConnectionPoint other = (SdxL2ConnectionPoint) obj;
+            return  Objects.equals(this.name, other.name) &&
+                    Objects.equals(this.cPoint, other.cPoint) &&
+                    Objects.equals(this.vlanIds, other.vlanIds) &&
+                    Objects.equals(this.ceMac, other.ceMac);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .add("name", name)
+                .add("connectionPoint", cPoint)
+                .add("vlanIds", vlanIds)
+                .add("ceMac", ceMac)
+                .toString();
+    }
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointSerializer.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointSerializer.java
new file mode 100644
index 0000000..adbc246
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/SdxL2ConnectionPointSerializer.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016 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 com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.Serializer;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.List;
+
+/**
+ * Kryo serializer for SdxL2ConnectionPoint.
+ */
+public class SdxL2ConnectionPointSerializer extends Serializer<SdxL2ConnectionPoint> {
+
+    /**
+     * Serialize the object using kryo.
+     *
+     * @param kryo the serializer
+     * @param output the output
+     * @param object the object to serialize
+     */
+    public void write(Kryo kryo, Output output, SdxL2ConnectionPoint object) {
+        kryo.writeClassAndObject(output, object.name());
+        kryo.writeClassAndObject(output, object.connectPoint());
+        kryo.writeClassAndObject(output, object.macAddress());
+        kryo.writeClassAndObject(output, object.vlanIds());
+    }
+
+    /**
+     * Create an object from one serialized using kryo.
+     *
+     * @param kryo the serializer
+     * @param input the inpunt
+     * @param type the object to create
+     * @return the object
+     */
+    public SdxL2ConnectionPoint read(Kryo kryo, Input input, Class<SdxL2ConnectionPoint> type) {
+        String name = (String) kryo.readClassAndObject(input);
+        ConnectPoint cp = (ConnectPoint) kryo.readClassAndObject(input);
+        MacAddress mac = (MacAddress) kryo.readClassAndObject(input);
+        List<VlanId> vlans = (List<VlanId>) kryo.readClassAndObject(input);
+        return new SdxL2ConnectionPoint(name, cp, vlans, mac);
+    }
+}
diff --git a/sdx-l2/src/main/java/org/onosproject/sdxl2/package-info.java b/sdx-l2/src/main/java/org/onosproject/sdxl2/package-info.java
new file mode 100644
index 0000000..0e134d7
--- /dev/null
+++ b/sdx-l2/src/main/java/org/onosproject/sdxl2/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Application providing the basic functionality of a L2-SDX.
+ */
+package org.onosproject.sdxl2;
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java
new file mode 100644
index 0000000..bea7ccc
--- /dev/null
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/SdxL2ConnectionPointTest.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2016 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.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onlab.packet.VlanId;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * Test SdxL2ConnectionPoint functionalities.
+ */
+public class SdxL2ConnectionPointTest {
+
+    @Before
+    public void setUp() {
+
+    }
+
+    @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";
+
+    @Test
+    public void testSdxL2ConnectionPoint1() {
+        SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO1", CP1, VLANS1, CEMAC1);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint2() {
+        SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO2", CP2, VLANS2);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint3() {
+        SdxL2ConnectionPoint scp3 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI1", CP3, VLANS3);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint4() {
+        SdxL2ConnectionPoint scp4 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO3", CP4, VLANS4);
+    }
+
+    @Rule
+    public ExpectedException exceptionconnectionpoint = ExpectedException.none();
+
+    @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);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint6() {
+        SdxL2ConnectionPoint scp6 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("MI3", CP6, VLANS6, CEMAC6);
+
+    }
+
+    @Rule
+    public ExpectedException exceptionmac = ExpectedException.none();
+
+    @Test
+    public void testSdxL2ConnectionPoint7() {
+        exceptionmac.expect(IllegalArgumentException.class);
+        exceptionmac.expectMessage("Specified MAC Address must contain");
+        SdxL2ConnectionPoint scp7 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("RO4", CP7, VLANS7, CEMAC7);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint8() {
+        SdxL2ConnectionPoint scp8 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("", CP4, VLANS2, CEMAC6);
+    }
+
+    @Rule
+    public ExpectedException exceptionname = ExpectedException.none();
+
+    @Test
+    public void testSdxL2ConnectionPoint9() {
+        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);
+    }
+
+    @Rule
+    public ExpectedException exceptionvlans = ExpectedException.none();
+
+    @Test
+    public void testSdxL2ConnectionPoint10() {
+        exceptionvlans.expect(NumberFormatException.class);
+        SdxL2ConnectionPoint scp10 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("VE1", CP1, VLANS10, CEMAC7);
+    }
+
+    @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);
+    }
+
+    @Test
+    public void testSdxL2ConnectionPoint12() {
+        SdxL2ConnectionPoint scp12 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("AQ1", CP1, VLANS12, CEMAC5);
+        List<VlanId> vlanIdList = new ArrayList<>();
+        vlanIdList.add(VlanId.vlanId(Short.parseShort("2")));
+        vlanIdList.add(VlanId.vlanId(Short.parseShort("6")));
+        assertEquals(vlanIdList, scp12.vlanIds());
+    }
+
+    @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);
+    }
+
+}
diff --git a/sdx-l2/src/test/java/org/onosproject/sdxl2/package-info.java b/sdx-l2/src/test/java/org/onosproject/sdxl2/package-info.java
new file mode 100644
index 0000000..4a06994
--- /dev/null
+++ b/sdx-l2/src/test/java/org/onosproject/sdxl2/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Test sdx-l2 functionalities.
+ */
+package org.onosproject.sdxl2;