diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEvcUtils.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEvcUtils.java
new file mode 100644
index 0000000..fab928b
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEvcUtils.java
@@ -0,0 +1,159 @@
+package org.onosproject.ecord.carrierethernet.app;
+
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection.MAX_NUM_UNI;
+
+/**
+ * Utilities to build EthernetVirtualConnections.
+ */
+public final class CarrierEthernetEvcUtils {
+
+    // no instantiation
+    private CarrierEthernetEvcUtils() {
+    }
+
+    /**
+     * Return the CE-VLAN ID for the CE evc based on the CLI-supplied argument.
+     *
+     * @param argCeVlanId vlanID
+     * @return CE-VLAN ID for the CE evc
+     */
+    public static VlanId generateCeVlanId(short argCeVlanId) {
+        return ((argCeVlanId == -1) ? null : VlanId.vlanId(argCeVlanId));
+    }
+
+    /**
+     * Return the CE evc type based on the CLI-supplied arguments.
+     *
+     * @param evcTypeString EVC type
+     * @param uniList       UNIs list
+     * @return the CE evc type
+     */
+    public static CarrierEthernetConnection.Type generateEvcType(String evcTypeString, List<String> uniList) {
+        if (evcTypeString == null) {
+            return ((uniList.size() > 2) ?
+                    CarrierEthernetConnection.Type.MULTIPOINT_TO_MULTIPOINT :
+                    CarrierEthernetConnection.Type.POINT_TO_POINT);
+        } else {
+            // TODO: Catch exception
+            return CarrierEthernetConnection.Type.valueOf(evcTypeString);
+        }
+    }
+
+    /**
+     * Return the EVC maxNumUni parameter based on the CLI-supplied arguments.
+     *
+     * @param maxNumUni     maximum numbers of UNIs
+     * @param evcTypeString EVC Type
+     * @param uniList       UNIs list
+     * @return the maxNumUni parameter
+     */
+    public static Integer generateMaxNumUni(int maxNumUni, String evcTypeString, List<String> uniList) {
+        if (maxNumUni == -1) {
+            if (evcTypeString == null) {
+                return ((uniList.size() > 2) ?
+                        MAX_NUM_UNI : 2);
+            } else {
+                // TODO: Catch exception
+                CarrierEthernetConnection.Type evcType =
+                        CarrierEthernetConnection.Type.valueOf(evcTypeString);
+                return (evcType.equals(CarrierEthernetConnection.Type.POINT_TO_POINT) ? 2 :
+                        MAX_NUM_UNI);
+            }
+        } else {
+            return maxNumUni;
+        }
+    }
+
+    /**
+     * Return the BW profile type based on the CLI-supplied arguments.
+     *
+     * @param ceVlanId vlanID
+     * @return the BWP profile type
+     */
+    public static CarrierEthernetBandwidthProfile.Type generateBandwidthProfileType(short ceVlanId) {
+        // TODO: Add the CoS BW profile case
+        return ((ceVlanId == -1) ?
+                CarrierEthernetBandwidthProfile.Type.INTERFACE : CarrierEthernetBandwidthProfile.Type.EVC);
+    }
+
+    /**
+     * Return the BW profile id based on the CLI-supplied arguments.
+     *
+     * @param uniId    UNI id
+     * @param evcCfgId EVC configuration Id
+     * @param ceVlanId vlanID
+     * @return the BW profile id
+     */
+    public static String generateBandwidthProfileId(String uniId, String evcCfgId, int ceVlanId) {
+        // TODO: Add the CoS BW profile case
+        return ((ceVlanId == -1) ? uniId : evcCfgId);
+    }
+
+    /**
+     * Return the set of UNIs for the CE EVC based on the CLI-supplied arguments.
+     *
+     * @param evcTypeString Type of the UNI
+     * @param uniList       list of remaning UNIs
+     * @param ceVlanId      vlanID
+     * @param firstUni      first UNI id
+     * @param evcCfgId      EVC configuration Id
+     * @param cir           The CIR in Mbps
+     * @param eir           The EIR in Mbps
+     * @param cbs           The CBS in Byte
+     * @param ebs           The EBS in Byte
+     * @return the set of UNIs for the CE EVC
+     */
+    public static Set<CarrierEthernetUni> generateUniSet(String evcTypeString, List<String> uniList,
+                                                         short ceVlanId, String firstUni, String evcCfgId,
+                                                         Double cir, Double eir, Long cbs, Long ebs) {
+
+        Set<CarrierEthernetUni> uniSet = new HashSet<>();
+
+        CarrierEthernetConnection.Type evcType = generateEvcType(evcTypeString, uniList);
+
+        // We assume that first UNI supplied is always root
+        uniSet.add(CarrierEthernetUni.builder()
+                           .cp(ConnectPoint.deviceConnectPoint(firstUni))
+                           .role(CarrierEthernetUni.Role.ROOT)
+                           .ceVlanId(generateCeVlanId(ceVlanId))
+                           .bwp(CarrierEthernetBandwidthProfile.builder()
+                                        .id(generateBandwidthProfileId(firstUni, evcCfgId, ceVlanId))
+                                        .type(generateBandwidthProfileType(ceVlanId))
+                                        .cir(Bandwidth.mbps(cir))
+                                        .eir(Bandwidth.mbps(eir))
+                                        .cbs(cbs)
+                                        .ebs(ebs)
+                                        .build())
+                           .build());
+
+        final CarrierEthernetUni.Role role;
+        // For E-Line and E-LAN all UNIs are roots. For E-Tree all UNIs are leafs except from one
+        role = ((evcType == CarrierEthernetConnection.Type.ROOT_MULTIPOINT) ?
+                CarrierEthernetUni.Role.LEAF : CarrierEthernetUni.Role.ROOT);
+
+       uniList.forEach(argUni -> uniSet.add(
+                CarrierEthernetUni.builder()
+                        .cp(ConnectPoint.deviceConnectPoint(argUni))
+                        .role(role)
+                        .ceVlanId(generateCeVlanId(ceVlanId))
+                        .bwp(CarrierEthernetBandwidthProfile.builder()
+                                     .id(generateBandwidthProfileId(argUni, evcCfgId, ceVlanId))
+                                     .type(generateBandwidthProfileType(ceVlanId))
+                                     .cir(Bandwidth.mbps(cir))
+                                     .eir(Bandwidth.mbps(eir))
+                                     .cbs(cbs)
+                                     .ebs(ebs)
+                                     .build())
+                        .build()));
+
+        return uniSet;
+    }
+}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
index b3c4225..c5ce82e 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
@@ -19,24 +19,19 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.VlanId;
-import org.onlab.util.Bandwidth;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.ecord.carrierethernet.api.CarrierEthernetService;
-import org.onosproject.ecord.carrierethernet.app.CarrierEthernetBandwidthProfile;
-import org.onosproject.ecord.carrierethernet.app.CarrierEthernetUni;
 import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
-import org.onosproject.net.ConnectPoint;
 
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
+
+import static org.onosproject.ecord.carrierethernet.app.CarrierEthernetEvcUtils.*;
 
 /**
  * CLI command for installing an Ethernet Virtual Connection.
  */
 @Command(scope = "onos", name = "ce-evc-create",
-         description = "Carrier Ethernet EVC creation command.")
+        description = "Carrier Ethernet EVC creation command.")
 public class CarrierEthernetCreateEvcCommand extends AbstractShellCommand {
 
     @Argument(index = 0, name = "argEvcCfgId",
@@ -46,160 +41,40 @@
             "EVC type (defaults to POINT_TO_POINT or MULTIPOINT_TO_MULTIPOINT, depending on number of UNIs)",
             required = false, multiValued = false)
     String argEvcType = null;
-    @Argument(index = 2, name = "argFirstUni", description =
-            "First UNI in list (if point to multipoint, this is the root)", required = true, multiValued = false)
-    String argFirstUni = null;
     @Argument(index = 3, name = "argUniList",
-            description = "List of remaining UNIs (if point to multipoint, these are the leaves)",
+            description = "List of UNIs (if point to multipoint, first is root, other are leaves)",
             required = true, multiValued = true)
     List<String> argUniList = Lists.newArrayList();
     @Option(name = "-v", aliases = "--cevlan", description = "CE-VLAN ID (applied to all UNIs)",
             required = false, multiValued = false)
-    String argCeVlanId = null;
+    short argCeVlanId = -1;
     @Option(name = "-id", aliases = "--evc-id", description = "The ID of a evc to be updated" +
             " (if evc does not exist, a new evc will be installed)", required = false, multiValued = false)
     String argEvcId = null;
     @Option(name = "-u", aliases = "--maxNumUni", description = "The maximum number of UNIs in the EVC",
             required = false, multiValued = false)
-    String argMaxNumUni = null;
+    int argMaxNumUni = -1;
     @Option(name = "-c", aliases = "--cir", description = "The CIR in Mbps", required = false, multiValued = false)
-    String argCir = "0";
+    double argCir = 0;
     @Option(name = "-e", aliases = "--eir", description = "The EIR in Mbps", required = false, multiValued = false)
-    String argEir = "0";
+    double argEir = 0;
     @Option(name = "-cbs", aliases = "--cbs", description = "The CBS in Bytes", required = false, multiValued = false)
-    String argCbs = "0";
+    long argCbs = 0;
     @Option(name = "-ebs", aliases = "--ebs", description = "The EBS in Bytes", required = false, multiValued = false)
-    String argEbs = "0";
+    long argEbs = 0;
 
     // TODO: Add further arguments for VLAN tag preservation, CoS preservation etc.
 
     @Override
     protected void execute() {
         CarrierEthernetService ceManager = get(CarrierEthernetService.class);
-        ceManager.installEvc(CarrierEthernetVirtualConnection.builder()
-                                     .id(argEvcId)
-                                     .cfgId(argEvcCfgId)
-                                     .type(generateEvcType())
-                                     .maxNumUni(generateMaxNumUni())
-                                     .uniSet(generateUniSet())
+        ceManager.installEvc(CarrierEthernetVirtualConnection.builder().id(argEvcId).cfgId(argEvcCfgId)
+                                     .type(generateEvcType(argEvcType, argUniList))
+                                     .maxNumUni(generateMaxNumUni(argMaxNumUni, argEvcType, argUniList))
+                                     .uniSet(generateUniSet(argEvcType,  argUniList.subList(1, argUniList.size()),
+                                                            argCeVlanId, argUniList.get(0), argEvcCfgId, argCir,
+                                                            argEir, argCbs, argEbs))
                                      .build());
     }
 
-    /**
-     * Return the CE-VLAN ID for the CE evc based on the CLI-supplied argument.
-     *
-     * @return CE-VLAN ID for the CE evc
-     */
-    VlanId generateCeVlanId() {
-        return ((argCeVlanId == null) ? null : VlanId.vlanId(Short.parseShort(argCeVlanId)));
-    }
-
-    /**
-     * Return the CE evc type based on the CLI-supplied arguments.
-     *
-     * @return the CE evc type
-     */
-    CarrierEthernetVirtualConnection.Type generateEvcType() {
-        if (argEvcType == null) {
-            return ((argUniList.size() > 2) ?
-                    CarrierEthernetVirtualConnection.Type.MULTIPOINT_TO_MULTIPOINT :
-                    CarrierEthernetVirtualConnection.Type.POINT_TO_POINT);
-        } else {
-            // TODO: Catch exception
-            return CarrierEthernetVirtualConnection.Type.valueOf(argEvcType);
-        }
-    }
-
-    /**
-     * Return the EVC maxNumUni parameter based on the CLI-supplied arguments.
-     *
-     * @return the maxNumUni parameter
-     */
-    Integer generateMaxNumUni() {
-        if (argMaxNumUni == null) {
-            if (argEvcType == null) {
-                return ((argUniList.size() > 2) ?
-                        CarrierEthernetVirtualConnection.MAX_NUM_UNI : 2);
-            } else {
-                // TODO: Catch exception
-                CarrierEthernetVirtualConnection.Type evcType =
-                        CarrierEthernetVirtualConnection.Type.valueOf(argEvcType);
-                return (evcType.equals(CarrierEthernetVirtualConnection.Type.POINT_TO_POINT) ? 2 :
-                        CarrierEthernetVirtualConnection.MAX_NUM_UNI);
-            }
-        } else {
-            return Integer.valueOf(argMaxNumUni);
-        }
-    }
-
-    /**
-     * Return the BW profile type based on the CLI-supplied arguments.
-     *
-     * @return the BWP profile type
-     */
-    CarrierEthernetBandwidthProfile.Type generateBandwidthProfileType() {
-        // TODO: Add the CoS BW profile case
-        return ((argCeVlanId == null) ?
-                CarrierEthernetBandwidthProfile.Type.INTERFACE : CarrierEthernetBandwidthProfile.Type.EVC);
-    }
-
-    /**
-     * Return the BW profile id based on the CLI-supplied arguments.
-     *
-     * @param uniId the UNI id
-     * @return the BW profile id
-     */
-    String generateBandwidthProfileId(String uniId) {
-        // TODO: Add the CoS BW profile case
-        return ((argCeVlanId == null) ? uniId : argEvcCfgId);
-    }
-
-    /**
-     * Return the set of UNIs for the CE EVC based on the CLI-supplied arguments.
-     *
-     * @return the set of UNIs for the CE EVC
-     */
-    Set<CarrierEthernetUni> generateUniSet() {
-
-        Set<CarrierEthernetUni> uniSet = new HashSet<>();
-
-        CarrierEthernetVirtualConnection.Type evcType = generateEvcType();
-
-        // We assume that first UNI supplied is always root
-        uniSet.add(CarrierEthernetUni.builder()
-                           .cp(ConnectPoint.deviceConnectPoint(argFirstUni))
-                           .role(CarrierEthernetUni.Role.ROOT)
-                           .ceVlanId(generateCeVlanId())
-                           .bwp(CarrierEthernetBandwidthProfile.builder()
-                                        .id(generateBandwidthProfileId(argFirstUni))
-                                        .type(generateBandwidthProfileType())
-                                        .cir(Bandwidth.mbps(Double.parseDouble(argCir)))
-                                        .eir(Bandwidth.mbps(Double.parseDouble(argEir)))
-                                        .cbs(Long.parseLong(argCbs))
-                                        .ebs(Long.parseLong(argEbs))
-                                        .build())
-                           .build());
-
-        final CarrierEthernetUni.Role role;
-        // For E-Line and E-LAN all UNIs are roots. For E-Tree all UNIs are leafs except from one
-        role = ((evcType == CarrierEthernetVirtualConnection.Type.ROOT_MULTIPOINT) ?
-                CarrierEthernetUni.Role.LEAF : CarrierEthernetUni.Role.ROOT);
-
-        argUniList.forEach(argUni -> uniSet.add(
-                CarrierEthernetUni.builder()
-                        .cp(ConnectPoint.deviceConnectPoint(argUni))
-                        .role(role)
-                        .ceVlanId(generateCeVlanId())
-                        .bwp(CarrierEthernetBandwidthProfile.builder()
-                                     .id(generateBandwidthProfileId(argUni))
-                                     .type(generateBandwidthProfileType())
-                                     .cir(Bandwidth.mbps(Double.parseDouble(argCir)))
-                                     .eir(Bandwidth.mbps(Double.parseDouble(argEir)))
-                                     .cbs(Long.parseLong(argCbs))
-                                     .ebs(Long.parseLong(argEbs))
-                                     .build())
-                        .build()));
-
-        return uniSet;
-    }
-}
+}
\ No newline at end of file
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebApplication.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebApplication.java
new file mode 100644
index 0000000..a56dba1
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebApplication.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-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.ecord.carrierethernet.rest;
+
+import org.onlab.rest.AbstractWebApplication;
+
+import java.util.Set;
+
+/**
+ * CarrierEthernet REST API web application.
+ */
+public class CarrierEthernetWebApplication extends AbstractWebApplication {
+    @Override
+    public Set<Class<?>> getClasses() {
+        return getClasses(CarrierEthernetWebResource.class);
+    }
+}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebResource.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebResource.java
new file mode 100644
index 0000000..f606026
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/CarrierEthernetWebResource.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2017-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.ecord.carrierethernet.rest;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.ecord.carrierethernet.api.CarrierEthernetService;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
+import org.onosproject.rest.AbstractWebResource;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Carrier Ethernet web resource.
+ */
+@Path("carrierethernet")
+public class CarrierEthernetWebResource extends AbstractWebResource {
+
+    private static final String EVCS = "evcs";
+    private final ObjectNode root = mapper().createObjectNode();
+    private final ArrayNode evcsNode = root.putArray(EVCS);
+
+    CarrierEthernetService ceManager = get(CarrierEthernetService.class);
+
+    /**
+     * Gets all EVC entries. Returns array of all EVCs in the system.
+     *
+     * @return 200 OK with a collection of Evcs
+     */
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("evc")
+    public Response getEvcs() {
+        ceManager.evcMap().values().stream()
+                .forEach(evc -> evcsNode.add(
+                        codec(CarrierEthernetVirtualConnection.class)
+                                .encode(evc, this)));
+
+
+        return ok(root).build();
+    }
+
+    /**
+     * Gets an EVC entry by deviceId.
+     *
+     * @return 200 OK with the requested Evc.
+     */
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("evc/{evcId}")
+    public Response getEvc(@PathParam("evcId") String evcId) {
+        ObjectNode evc = codec(CarrierEthernetVirtualConnection.class)
+                .encode(ceManager.getEvc(evcId), this);
+        return ok(evc).build();
+    }
+
+    /**
+     * Install an EVC with given parameters.
+     *
+     * @return 200 OK if the EVC was installed
+     */
+    @POST
+    @Path("evc")
+    @Consumes(MediaType.APPLICATION_JSON)
+    public Response setEvc(InputStream stream) {
+        ObjectNode root = mapper().createObjectNode();
+        try {
+            ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
+            CarrierEthernetVirtualConnection evc =
+                    codec(CarrierEthernetVirtualConnection.class).decode(jsonTree, this);
+            ceManager.installEvc(evc);
+            root.put("evcId", evc.id());
+        } catch (IOException e) {
+            throw new IllegalArgumentException(e.getMessage());
+        }
+        return ok(root).build();
+    }
+
+    /**
+     * Removes all EVCs installed in the CE app.
+     *
+     * @return 204 NO CONTENT
+     */
+    @DELETE
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("evc")
+    public Response removeAllEvc() {
+        ceManager.removeAllEvcs();
+        return Response.noContent().build();
+    }
+
+    /**
+     * Removes one EVCs by evcId.
+     *
+     * @param evcId the EVC to remove.
+     * @return 204 NO CONTENT
+     */
+    @DELETE
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("evc/{evcId}")
+    public Response removeEvcWithId(@PathParam("evcId") String evcId) {
+        ceManager.removeEvc(evcId);
+        return Response.noContent().build();
+    }
+
+}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodec.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodec.java
new file mode 100644
index 0000000..cfc378f
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodec.java
@@ -0,0 +1,95 @@
+package org.onosproject.ecord.carrierethernet.rest;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetBandwidthProfile;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetNetworkInterface;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetUni;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.onlab.util.Tools.nullIsIllegal;
+import static org.onosproject.ecord.carrierethernet.app.CarrierEthernetEvcUtils.*;
+import static org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection.builder;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Implementation of encoder for Alarm codec.
+ */
+public class EvcCodec extends JsonCodec<CarrierEthernetVirtualConnection> {
+
+    private static final String EVC_ID_REQUIRED = "EVC Id Must be specified";
+    private static final String EVC_TYPE_REQUIRED = "EVC Type Must be specified";
+    private static final String ARRAY_REQUIRED = "UNI array was not specified";
+
+    private final Logger log = getLogger(getClass());
+
+    @Override
+    public ObjectNode encode(CarrierEthernetVirtualConnection evc, CodecContext context) {
+        ObjectNode evcRoot = context.mapper().createObjectNode();
+        evcRoot.put("evcCfgId", evc.cfgId());
+        evcRoot.put("evcId", evc.id());
+        ArrayNode uniList = context.mapper()
+                .valueToTree(evc.uniSet().stream()
+                                     .map(CarrierEthernetNetworkInterface::id)
+                                     .collect(Collectors.toList()));
+        evcRoot.putArray("uniList").addAll(uniList);
+        evcRoot.put("maxNumUni", evc.maxNumUni());
+        CarrierEthernetUni uni = evc.uniSet().iterator().next();
+        evcRoot.put("vlanId", uni.ceVlanId().toString());
+        CarrierEthernetBandwidthProfile bwp = uni.bwp();
+        if (bwp != null) {
+            evcRoot.put("cir", bwp.cir().bps());
+            evcRoot.put("eir", bwp.eir().bps());
+            evcRoot.put("cbs", bwp.cbs());
+            evcRoot.put("ebs", bwp.ebs());
+        }
+        return evcRoot;
+    }
+
+    @Override
+    public CarrierEthernetVirtualConnection decode(ObjectNode json, CodecContext context) {
+        String argEvcCfgId = json.get("evcCfgId").asText(null);
+        String argEvcId = null;
+        if (json.has("evcId")) {
+            argEvcId = json.get("evcId").asText();
+        }
+        ArrayNode uniArray = nullIsIllegal((ArrayNode) json.get("uniList"),
+                                           ARRAY_REQUIRED);
+        List<String> uniList = new ArrayList<>();
+        uniArray.forEach(jsonNode -> uniList.add(jsonNode.asText()));
+        String evcTypeString = nullIsIllegal(json.get("evcType").asText(),
+                                             EVC_TYPE_REQUIRED);
+        int maxNumUni = -1;
+        if (json.has("maxNumUni")) {
+            maxNumUni = json.get("maxNumUni").asInt(-1);
+        }
+
+        short vlanId = -1;
+        if (json.has("vlanId")) {
+            vlanId = json.get("vlanId").shortValue();
+        }
+        double cir = json.get("cir").asDouble(0.0);
+        double eir = json.get("eir").asDouble(0.0);
+        long cbs = json.get("cbs").asLong(0L);
+        long ebs = json.get("ebs").asLong(0L);
+        log.info("Received REST call with parameters: " + "evcCfgId={}, evcId={}," +
+                         " uniList={}, evcType={}, maxNumUni={}, vlanId={}, cir={}, " +
+                         "eir={}, cbs={}, ebs={}", argEvcCfgId, argEvcId, uniList,
+                 evcTypeString, maxNumUni, vlanId, cir, eir, cbs, ebs);
+        return builder().id(argEvcId).cfgId(argEvcCfgId)
+                .type(generateEvcType(evcTypeString, uniList))
+                .maxNumUni(generateMaxNumUni(maxNumUni, evcTypeString, uniList))
+                .uniSet(generateUniSet(evcTypeString, uniList.subList(1, uniList.size()),
+                                       vlanId, uniList.get(0), argEvcCfgId, cir, eir,
+                                       cbs, ebs))
+                .build();
+    }
+
+}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodecRegistrator.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodecRegistrator.java
new file mode 100644
index 0000000..9405b7c
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/EvcCodecRegistrator.java
@@ -0,0 +1,34 @@
+package org.onosproject.ecord.carrierethernet.rest;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.codec.CodecService;
+import org.onosproject.ecord.carrierethernet.app.CarrierEthernetVirtualConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of the JSON codec brokering service for Carrier Ethernet app.
+ */
+@Component(immediate = true)
+public class EvcCodecRegistrator {
+
+    private static final Logger log = LoggerFactory.getLogger(EvcCodecRegistrator.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CodecService codecService;
+
+    @Activate
+    public void activate() {
+        codecService.registerCodec(CarrierEthernetVirtualConnection.class, new EvcCodec());
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        log.info("Stopped");
+    }
+}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/package-info.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/package-info.java
new file mode 100644
index 0000000..400df6e
--- /dev/null
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/rest/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * CLI implementation for the Carrier Ethernet Application.
+ */
+package org.onosproject.ecord.carrierethernet.rest;
\ No newline at end of file
diff --git a/carrierethernet/src/main/resources/sampleEVC.json b/carrierethernet/src/main/resources/sampleEVC.json
new file mode 100644
index 0000000..2eaf759
--- /dev/null
+++ b/carrierethernet/src/main/resources/sampleEVC.json
@@ -0,0 +1,14 @@
+{
+  "evcId": "evc1",
+  "evcCfgId": "evpl1",
+  "uniList": [
+    "netconf:192.168.56.10:830/0",
+    "netconf:192.168.56.20:830/0"
+  ],
+  "evcType": "POINT_TO_POINT",
+  "vlanId": 100,
+  "cir": "400",
+  "eir": "200",
+  "cbs": "3000",
+  "ebs": "2000"
+}
\ No newline at end of file
diff --git a/carrierethernet/src/main/webapp/WEB-INF/web.xml b/carrierethernet/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..5774d22
--- /dev/null
+++ b/carrierethernet/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-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.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="ONOS" version="2.5">
+    <display-name>CarrierEthernet REST APIs</display-name>
+
+    <servlet>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>javax.ws.rs.Application</param-name>
+            <param-value>org.onosproject.ecord.carrierethernet.rest.CarrierEthernetWebApplication</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
