diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a4f1f28
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*~
+*.class
+.classpath
+.project
+.settings
+.checkstyle
+target
+*.iml
+.idea
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..ded4f63
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   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.
diff --git a/ce-api/pom.xml b/ce-api/pom.xml
new file mode 100644
index 0000000..52ab448
--- /dev/null
+++ b/ce-api/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+    	<groupId>org.opencord</groupId>
+    	<artifactId>ce</artifactId>
+	    <version>1.0.0</version>
+        <relativePath>../</relativePath>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>ce-api</artifactId>
+    <version>1.0.0</version>
+    <packaging>bundle</packaging>
+
+    <description>Virtual ethernet edge service for CORD</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.api</onos.app.name>
+        <onos.app.title>ECORD CE API App</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>1.10.3</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetBandwidthProfile.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetBandwidthProfile.java
new file mode 100644
index 0000000..890ce25
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetBandwidthProfile.java
@@ -0,0 +1,268 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import org.onlab.util.Bandwidth;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Bandwidth profile for a CE UNI.
+ */
+// TODO: Methods to associate a CE BWP to a generic BWP and a Meter
+public final class CarrierEthernetBandwidthProfile {
+
+    public enum Type {
+        INTERFACE, EVC, COS
+    }
+
+    protected String id;
+    protected String cfgId;
+    protected Type type;
+    protected Bandwidth cir;
+    protected Bandwidth eir;
+    protected long cbs;
+    protected long ebs;
+
+    // TODO: Remove id from constructor - should be generated by some manager
+    private CarrierEthernetBandwidthProfile(String id, String cfgId, Type type,
+                                            Bandwidth cir, Bandwidth eir,
+                                            long cbs, long ebs) {
+        checkNotNull(cir, "BW Profile must have an associated CIR");
+        checkNotNull(type, "BW profile must have a type");
+        this.id = id;
+        this.cfgId = cfgId;
+        this.type = type;
+        this.cir = cir;
+        this.eir = eir;
+        this.cbs = cbs;
+        this.ebs = ebs;
+    }
+
+    /**
+     * Returns BWP string identifier.
+     *
+     * @return BWP string identifier
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns BWP string config identifier.
+     *
+     * @return BWP string config identifier
+     */
+    public String cfgId() {
+        return cfgId;
+    }
+
+    /**
+     * Returns BWP type (INTERFACE, EVC, COS).
+     *
+     * @return BWP type
+     */
+    public Type type() {
+        return type;
+    }
+
+    /**
+     * Returns BWP CIR rate.
+     *
+     * @return BWP CIR rate
+     */
+    public Bandwidth cir() {
+        return cir;
+    }
+
+    /**
+     * Returns BWP EIR rate.
+     *
+     * @return BWP EIR rate
+     */
+    public Bandwidth eir() {
+        return eir;
+    }
+
+    /**
+     * Returns BWP CBS in Bytes.
+     *
+     * @return BWP CBS in Bytes
+     */
+    public long cbs() {
+        return cbs;
+    }
+
+    /**
+     * Returns BWP EBS in Bytes.
+     *
+     * @return BWP EBS in Bytes
+     */
+    public long ebs() {
+        return ebs;
+    }
+
+    /**
+     * Sets BWP id.
+     *
+     * @param id the id to set
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * Sets BWP CIR rate.
+     *
+     * @param cir the CIR to set
+     */
+    public void setCir(Bandwidth cir) {
+        this.cir = cir;
+    }
+
+    /**
+     * Sets BWP EIR rate.
+     *
+     * @param eir the EIR to set
+     */
+    public void setEir(Bandwidth eir) {
+        this.eir = eir;
+    }
+
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", id)
+                .add("type", type)
+                .add("cir", cir)
+                .add("cbs", cbs)
+                .add("eir", eir)
+                .add("ebs", ebs).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetBandwidthProfile entities.
+     */
+    public static final class Builder {
+
+        String id;
+        String cfgId;
+        Type type;
+        Bandwidth cir;
+        Bandwidth eir;
+        long cbs;
+        long ebs;
+
+        /**
+         * Sets the id of this builder.
+         *
+         * @param id the builder id to set
+         * @return this builder instance
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the type of this builder.
+         *
+         * @param type the builder type to set
+         * @return this builder instance
+         */
+        public Builder type(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        /**
+         * Sets the cir of this builder.
+         *
+         * @param cir the builder cir to set
+         * @return this builder instance
+         */
+        public Builder cir(Bandwidth cir) {
+            this.cir = cir;
+            return this;
+        }
+
+        /**
+         * Sets the eir of this builder.
+         *
+         * @param eir the builder eir to set
+         * @return this builder instance
+         */
+        public Builder eir(Bandwidth eir) {
+            this.eir = eir;
+            return this;
+        }
+
+        /**
+         * Sets the cbs of this builder.
+         *
+         * @param cbs the builder cbs to set
+         * @return this builder instance
+         */
+        public Builder cbs(long cbs) {
+            this.cbs = cbs;
+            return this;
+        }
+
+        /**
+         * Sets the ebs of this builder.
+         *
+         * @param ebs the builder ebs to set
+         * @return this builder instance
+         */
+        public Builder ebs(long ebs) {
+            this.ebs = ebs;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetBandwidthProfile instance based on this builder's parameters.
+         *
+         * @return a new CarrierEthernetBandwidthProfile instance
+         */
+        public CarrierEthernetBandwidthProfile build() {
+            return new CarrierEthernetBandwidthProfile(id, cfgId, type, cir, eir, cbs, ebs);
+        }
+    }
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetConnection.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetConnection.java
new file mode 100644
index 0000000..ade3f5a
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetConnection.java
@@ -0,0 +1,153 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import java.time.Duration;
+
+/**
+ * Representation of an abstract CE connection (meant to be extended by the EVC and FC classes).
+ */
+public abstract class CarrierEthernetConnection {
+
+    public enum Type {
+        POINT_TO_POINT, // E-LINE
+        MULTIPOINT_TO_MULTIPOINT, // E-LAN
+        ROOT_MULTIPOINT // E_TREE
+    }
+
+    public enum State {
+        ACTIVE,
+        INACTIVE,
+        PARTIAL
+    }
+
+    protected EvcConnId id;
+    protected String cfgId;
+    protected Type type;
+    protected State state;
+    protected Duration maxLatency;
+
+    private static final Duration DEFAULT_MAX_LATENCY = Duration.ofMillis(50);
+
+    // Note: id should be provided only when updating an existing connection
+    public CarrierEthernetConnection(EvcConnId id, String cfgId, Type type, Duration maxLatency) {
+        this.id = id;
+        this.cfgId = cfgId;
+        this.type = type;
+        this.state = State.INACTIVE;
+        this.maxLatency = maxLatency == null ? DEFAULT_MAX_LATENCY : maxLatency;
+    }
+
+    /**
+     * Returns connection identifier.
+     *
+     * @return connection identifier
+     */
+    public EvcConnId id() {
+        return id;
+    }
+
+    /**
+     * Returns connection config identifier.
+     *
+     * @return connection config identifier
+     */
+    public String cfgId() {
+        return cfgId;
+    }
+
+    /**
+     * Returns type of connection.
+     *
+     * @return type of connection
+     */
+    public Type type() {
+        return type;
+    }
+
+    /**
+     * Returns connectivity state of the connection.
+     *
+     * @return connectivity state
+     */
+    public State state() {
+        return state;
+    }
+
+    /**
+     * Indicates whether the connection is active or partially active.
+     *
+     * @return connectivity state
+     */
+    public boolean isActive() {
+        return !state.equals(State.INACTIVE);
+    }
+
+    /**
+     * Returns maximum latency constraint.
+     *
+     * @return maximum latency constraint
+     */
+    public Duration maxLatency() {
+        return maxLatency;
+    }
+
+    /**
+     * Sets connection identifier.
+     *
+     * @param id the connection identifier to set
+     */
+    public void setId(EvcConnId id) {
+        this.id = id;
+    }
+
+    /**
+     * Sets connection config identifier.
+     *
+     * @param cfgId connection config identifier
+     */
+    public void setCfgId(String cfgId) {
+        this.cfgId = cfgId;
+    }
+
+    /**
+     * Sets the connectivity state of the connection.
+     *
+     * @param state the connectivity state to set
+     */
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    /**
+     * Sets the type of connection.
+     *
+     * @param type type of connection to set
+     */
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    /**
+     * Sets maximum latency constraint.
+     *
+     * @param maxLatency the maximum latency constraint to set
+     */
+    public void setMaxLatency(Duration maxLatency) {
+        this.maxLatency = maxLatency;
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEnni.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEnni.java
new file mode 100644
index 0000000..ed29558
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEnni.java
@@ -0,0 +1,326 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import com.google.common.collect.Sets;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Representation of a Carrier Ethernet ENNI.
+ * Class can be used in different two ways:
+ * 1. As a global ENNI descriptor containing one or more S-VLAN tags
+ * 2. As a service-specific ENNI descriptor containing a single S-VLAN tag and including a role (e.g. hub, spoke)
+ */
+public final class CarrierEthernetEnni extends CarrierEthernetNetworkInterface {
+
+    private final Logger log = getLogger(getClass());
+
+    public enum Role {
+
+        HUB("Hub"),
+        SPOKE("Spoke"),
+        // FIXME: Remove these after LTP-NI role mapping is fixed
+        ROOT("Root"),
+        LEAF("Leaf");
+
+        private String value;
+
+        Role(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
+    protected Role role;
+    protected Set<VlanId> sVlanIdSet;
+    String tpid;
+
+    private CarrierEthernetEnni(ConnectPoint cp, String uniCfgId,
+                                Role role, VlanId sVlanId, String tpid,
+                                Bandwidth usedCapacity, Annotations...annotations) {
+        super(cp, Type.ENNI, uniCfgId, annotations);
+        // TODO: Check for null
+        this.role = role;
+        this.sVlanIdSet = Sets.newConcurrentHashSet();
+        // The following applies only to service-specific ENNIs
+        if (sVlanId != null) {
+            this.sVlanIdSet.add(sVlanId);
+            // TODO: Use Hub/Spoke role correctly
+            this.role = Role.HUB;
+            this.usedCapacity = usedCapacity;
+            this.tpid = tpid;
+        }
+    }
+
+    /**
+     * Adds the resources associated with an FC-specific ENNI to a global ENNI.
+     *
+     * @param enni the FC-specific ENNI to be added
+     */
+    @Override
+    public void addEcNi(CarrierEthernetNetworkInterface enni) {
+        // Add S-VLAN ID
+        if (enni.sVlanId() != VlanId.NONE) {
+            this.sVlanIdSet.add(enni.sVlanId());
+        }
+        // Used capacity cannot be more than ENNI capacity
+        this.usedCapacity = Bandwidth.bps(Math.min(this.usedCapacity.bps() + enni.usedCapacity().bps(),
+                this.capacity.bps()));
+    }
+
+    /**
+     * Removes the resources associated with an FC-specific ENNI from a global ENNI.
+     *
+     * @param enni the FC-specific ENNI to be removed
+     */
+    @Override
+    public void removeEcNi(CarrierEthernetNetworkInterface enni) {
+        // Remove UNI CE-VLAN ID
+        sVlanIdSet.remove(enni.sVlanId());
+        // Redundant check - should be avoided by check in validateBwp
+        this.usedCapacity = Bandwidth.bps(Math.max(this.usedCapacity.bps() - enni.usedCapacity().bps(), 0));
+    }
+
+    /**
+     * Validates whether an FC-specific ENNI is compatible with the corresponding global ENNI.
+     *
+     * @param enni the FC-specific ENNI
+     * @return boolean value indicating whether the ENNIs are compatible
+     */
+    @Override
+    public boolean validateEcNi(CarrierEthernetNetworkInterface enni) {
+
+        // Check if the S-VLAN ID of the ENNI is already included in global ENNI
+        if (enni.sVlanId() != VlanId.NONE) {
+            if (sVlanIdSet.contains(enni.sVlanId())) {
+                log.error("S-VLAN ID {} already exists in ENNI {}", enni.sVlanId().toString(), this.id());
+                return false;
+            }
+        }
+
+        // Check whether there are enough available resources on the ENNI
+        if (usedCapacity.bps() + enni.usedCapacity().bps() > capacity.bps()) {
+            log.error("ENNI {} cannot be added to global ENNI {} due to lack of resources", enni.id(), this.id());
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns ENNI role - applicable only to service-specific ENNIs.
+     *
+     * @return ENNI role
+     */
+    @Override
+    public Role role() {
+        return role;
+    }
+
+    /**
+     * Returns the S-VLAN id associated with a service ENNI,
+     * or the first S-VLAN ID found for a global ENNI.
+     * This is assumed to be the S-TAG of another FC interconnected with this ENNI.
+     *
+     * @return S-VLAN id
+     */
+    @Override
+    public VlanId sVlanId() {
+        if (sVlanIdSet.isEmpty()) {
+            return VlanId.NONE;
+        } else {
+            return sVlanIdSet.iterator().next();
+        }
+    }
+
+    /**
+     * Always returns null, since CE-VLAN IDs are not associated with ENNIs.
+     *
+     * @return null
+     */
+    @Override
+    public VlanId ceVlanId() {
+        return null;
+    }
+
+    /**
+     * Returns ENNI tpid - applicable only to service-specific ENNIs.
+     *
+     * @return tpid
+     */
+    public String tpid() {
+        return tpid;
+    }
+
+    /**
+     * Returns the set of S-VLAN ids associated with the ENNI.
+     * Those are assumed to be the S-TAGs of other FCs interconnected with this ENNI.
+     *
+     * @return S-VLAN id set
+     */
+    public Set<VlanId> sVlanIdSet() {
+        return sVlanIdSet;
+    }
+
+    // FIXME: Find a better way to implement this method
+    /**
+     * Sets the S-VLAN id associated with an FC INNI.
+     *
+     * @param sVlanId S-VLAN id to set
+     */
+    public void setSVlanId(VlanId sVlanId) {
+        sVlanIdSet.add(sVlanId);
+    }
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", this.id)
+                .add("cfgId", this.cfgId)
+                .add("role", role)
+                .add("refCount", refCount)
+                .add("sVlanIds", sVlanIdSet)
+                .add("capacity", this.capacity)
+                .add("usedCapacity", this.usedCapacity).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetEnni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId sVlanId;
+        private String tpid;
+        private Bandwidth usedCapacity;
+        private Annotations annotations;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the sVlanId of this builder.
+         *
+         * @param sVlanId the builder sVlanId to set
+         * @return this builder instance
+         */
+        public Builder sVlanId(VlanId sVlanId) {
+            this.sVlanId = sVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the tpid of this builder.
+         *
+         * @param tpid the builder tpid to set
+         * @return this builder instance
+         */
+        public Builder tpid(String tpid) {
+            this.tpid = tpid;
+            return this;
+        }
+
+        /**
+         * Sets the usedCapacity of this builder.
+         *
+         * @param usedCapacity the builder usedCapacity to set
+         * @return this builder instance
+         */
+        public Builder usedCapacity(Bandwidth usedCapacity) {
+            this.usedCapacity = usedCapacity;
+            return this;
+        }
+
+        /**
+         * Sets annotations.
+         *
+         * @param annotations annotations
+         * @return this builder instance
+         */
+        public Builder annotations(Annotations annotations) {
+            this.annotations = annotations;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetEnni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetEnni instance
+         */
+        public CarrierEthernetEnni build() {
+            return new CarrierEthernetEnni(cp, cfgId, role, sVlanId, tpid, usedCapacity, annotations);
+        }
+    }
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEvcUtils.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEvcUtils.java
new file mode 100644
index 0000000..2b40713
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEvcUtils.java
@@ -0,0 +1,176 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+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.opencord.ce.api.models.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/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetForwardingConstruct.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetForwardingConstruct.java
new file mode 100644
index 0000000..4e90aaa
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetForwardingConstruct.java
@@ -0,0 +1,221 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import org.onlab.packet.VlanId;
+
+import java.time.Duration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Representation of a CE Forwarding Construct.
+ */
+public final class CarrierEthernetForwardingConstruct extends CarrierEthernetConnection {
+
+    private Set<CarrierEthernetLogicalTerminationPoint> ltpSet;
+    private VlanId vlanId;
+    private boolean congruentPaths = true;
+    protected AtomicInteger refCount;
+
+    // TODO: Remove id from constructor - currently used only when updating FC
+    // TODO: Add congruentPaths flag to constructor and Builder
+    private CarrierEthernetForwardingConstruct(EvcConnId id, String cfgId, Type type,
+                                               Set<CarrierEthernetLogicalTerminationPoint> ltpSet,
+                                               Duration maxLatency) {
+        super(id, cfgId, type, maxLatency);
+        this.ltpSet = new HashSet<>(ltpSet);
+        this.vlanId = null;
+        this.refCount = new AtomicInteger();
+    }
+
+    /**
+     * Returns Vlan id.
+     *
+     * @return Vlan id
+     */
+    public VlanId vlanId() {
+        return vlanId;
+    }
+
+
+    /**
+     * Returns the set of LTPs associated with the FC.
+     *
+     * @return set of LTPs associated with the FC
+     */
+    public Set<CarrierEthernetLogicalTerminationPoint> ltpSet() {
+        return ltpSet;
+    }
+
+    /**
+     * Returns the set of UNIs associated with the FC.
+     *
+     * @return set of UNIs associated with the FC
+     */
+    public Set<CarrierEthernetUni> uniSet() {
+        // FIXME: Find a more efficient way to get the FC UNIs
+        return ltpSet
+                .stream()
+                .filter(ltp -> ltp.type().equals(CarrierEthernetNetworkInterface.Type.UNI))
+                .map(ltp -> (CarrierEthernetUni) ltp.ni()).collect(Collectors.toSet());
+    }
+
+    /**
+     * Returns true if FC requires that both directions should use the same path.
+     *
+     * @return true if both directions should use the same path
+     */
+    public boolean congruentPaths() {
+        return congruentPaths;
+    }
+
+    /**
+     * Returns counter with the number of references (from EVCs) to the particular FC.
+     *
+     * @return number of references counter
+     */
+    public AtomicInteger refCount() {
+        return refCount;
+    }
+
+    /**
+     * Sets the vlanId to be used by the FC.
+     *
+     * @param vlanId the vlanId to set
+     */
+    public void setVlanId(VlanId vlanId) {
+        this.vlanId = vlanId;
+    }
+
+    /**
+     * Sets the set of LTPs.
+     *
+     * @param ltpSet the set of LTPs to be set
+     */
+    public void setLtpSet(Set<CarrierEthernetLogicalTerminationPoint> ltpSet) {
+        this.ltpSet = ltpSet;
+    }
+
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", id)
+                .add("cfgId", cfgId)
+                .add("type", type)
+                .add("vlanId", vlanId)
+                .add("refCount", refCount)
+                .add("LTPs", ltpSet).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetForwardingConstruct entities.
+     */
+    public static final class Builder {
+
+        private EvcConnId id;
+        private String cfgId;
+        private Type type;
+        private Duration maxLatency;
+        private Set<CarrierEthernetLogicalTerminationPoint> ltpSet;
+
+        /**
+         * Sets the id of this builder.
+         *
+         * @param id the builder id to set
+         * @return this builder instance
+         */
+        public Builder id(EvcConnId id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the type of this builder.
+         *
+         * @param type the builder type to set
+         * @return this builder instance
+         */
+        public Builder type(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        /**
+         * Sets the maxLatency of this builder.
+         *
+         * @param maxLatency the builder maxLatency to set
+         * @return this builder instance
+         */
+        public Builder maxLatency(Duration maxLatency) {
+            this.maxLatency = maxLatency;
+            return this;
+        }
+
+        /**
+         * Sets the ltpSet of this builder.
+         *
+         * @param ltpSet the builder ltpSet to set
+         * @return this builder instance
+         */
+        public Builder ltpSet(Set<CarrierEthernetLogicalTerminationPoint> ltpSet) {
+            this.ltpSet = ltpSet;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetForwardingConstruct instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetForwardingConstruct instance
+         */
+        public CarrierEthernetForwardingConstruct build() {
+            checkNotNull(type, "FC must have a type");
+            checkArgument(ltpSet != null && ltpSet.size() > 1,
+                    "FC must include at least two LTPs");
+
+            return new CarrierEthernetForwardingConstruct(id, cfgId, type, ltpSet, maxLatency);
+        }
+    }
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetGenericNi.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetGenericNi.java
new file mode 100644
index 0000000..7e64d1a
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetGenericNi.java
@@ -0,0 +1,117 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import org.onlab.packet.VlanId;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of a Generic Carrier Ethernet NI.
+ * Class is only meant to be used for establishing forwarding in CarrierEthernetPacketNodeManagers
+ */
+public class CarrierEthernetGenericNi extends CarrierEthernetNetworkInterface {
+
+    public enum Role {
+
+        NONE("None");
+
+        private String value;
+
+        Role(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
+    public CarrierEthernetGenericNi(ConnectPoint connectPoint, String uniCfgId,
+                                    Annotations...annotations) {
+        super(connectPoint, Type.GENERIC, uniCfgId, annotations);
+    }
+
+    @Override
+    public Role role() {
+        return Role.NONE;
+    }
+
+    /**
+     * Always returns null, since CE-VLAN IDs are not associated with Generic NIs.
+     *
+     * @return null
+     */
+    @Override
+    public VlanId ceVlanId() {
+        return null;
+    }
+
+    /**
+     * Always returns null, since S-TAGs are not associated with Generic NIs.
+     *
+     * @return null
+     */
+    @Override
+    public VlanId sVlanId() {
+        return null;
+    }
+
+    /**
+     * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
+     *
+     * @param gni a generic NI
+     */
+    @Override
+    public void addEcNi(CarrierEthernetNetworkInterface gni) {}
+
+    /**
+     * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
+     *
+     * @param gni a generic NI
+     */
+    @Override
+    public void removeEcNi(CarrierEthernetNetworkInterface gni) {}
+
+    /**
+     * Dummy implementation of abstract method (for generic NI type there is no concept of EVC vs. global NIs).
+     *
+     * @param gni a generic NI
+     * @return true
+     */
+    @Override
+    public boolean validateEcNi(CarrierEthernetNetworkInterface gni) {
+        return true;
+    }
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", this.id)
+                .add("cfgId", this.cfgId)
+                .add("refCount", refCount)
+                .add("capacity", this.capacity)
+                .add("usedCapacity", this.usedCapacity).toString();
+    }
+
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetInni.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetInni.java
new file mode 100644
index 0000000..da2c5b7
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetInni.java
@@ -0,0 +1,333 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Representation of a Carrier Ethernet INNI.
+ * Class can be used in different two ways:
+ * 1. As a global INNI descriptor containing one or more S-VLAN tags
+ * 2. As a service-specific INNI descriptor containing a single S-VLAN tag and including a role (e.g. hub, spoke)
+ */
+public final class CarrierEthernetInni extends CarrierEthernetNetworkInterface {
+
+    private final Logger log = getLogger(getClass());
+
+    public enum Role {
+
+        HUB("Hub"),
+        // FIXME: Remove that after hackathon?
+        TRUNK("Trunk"),
+        SPOKE("Spoke"),
+        // FIXME: Remove these after LTP-NI role mapping is fixed
+        ROOT("Root"),
+        LEAF("Leaf");
+
+        private String value;
+
+        Role(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
+    protected Role role;
+    protected Set<VlanId> sVlanIdSet;
+    // TODO: Associate TPIDs with S-TAGs
+    protected String tpid;
+
+    // TODO: Change sVlanId to Collection<VlanId>
+    private CarrierEthernetInni(ConnectPoint connectPoint, String uniCfgId,
+                                Role role, VlanId sVlanId, String tpid,
+                                Bandwidth usedCapacity,
+                                Annotations...annotations) {
+
+        super(connectPoint, Type.INNI, uniCfgId, annotations);
+
+        // TODO: Check for null
+        this.role = role;
+        this.sVlanIdSet = Sets.newConcurrentHashSet();
+        // The following applies only to service-specific INNIs
+        if (sVlanId != null) {
+            this.sVlanIdSet.add(sVlanId);
+            // TODO: Use role correctly
+            this.role = Role.HUB;
+            this.usedCapacity = usedCapacity;
+            this.tpid = tpid;
+        }
+    }
+
+    /**
+     * Adds the resources associated with an FC-specific INNI to a global INNI.
+     *
+     * @param inni the FC-specific INNI to be added
+     */
+    @Override
+    public void addEcNi(CarrierEthernetNetworkInterface inni) {
+        // Add S-VLAN ID
+        if (inni.sVlanId() != VlanId.NONE) {
+            this.sVlanIdSet.add(inni.sVlanId());
+        }
+        // Used capacity cannot be more than INNI capacity
+        this.usedCapacity = Bandwidth.bps(Math.min(this.usedCapacity.bps() + inni.usedCapacity().bps(),
+                this.capacity.bps()));
+    }
+
+    /**
+     * Removes the resources associated with an FC-specific INNI from a global INNI.
+     *
+     * @param inni the FC-specific INNI to be removed
+     */
+    @Override
+    public void removeEcNi(CarrierEthernetNetworkInterface inni) {
+        // Remove UNI CE-VLAN ID
+        sVlanIdSet.remove(inni.sVlanId());
+        // Redundant check - should be avoided by check in validateBwp
+        this.usedCapacity = Bandwidth.bps(Math.max(this.usedCapacity.bps() - inni.usedCapacity().bps(), 0));
+    }
+
+    /**
+     * Validates whether an FC-specific INNI is compatible with the corresponding global INNI.
+     *
+     * @param inni the FC-specific INNI
+     * @return boolean value indicating whether the INNIs are compatible
+     */
+    @Override
+    public boolean validateEcNi(CarrierEthernetNetworkInterface inni) {
+
+        // Check if the S-VLAN ID of the INNI is already included in global INNI
+        if (inni.sVlanId() != null) {
+            if (sVlanIdSet.contains(inni.sVlanId())) {
+                log.error("S-VLAN ID {} already exists in INNI {}", inni.sVlanId().toString(), this.id());
+                return false;
+            }
+        }
+
+        // Check whether there are enough available resources on the INNI
+        if (usedCapacity.bps() + inni.usedCapacity().bps() > capacity.bps()) {
+            log.error("INNI {} cannot be added to global INNI {} due to lack of resources", inni.id(), this.id());
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns INNI role - applicable only to service-specific INNIs.
+     *
+     * @return INNI role
+     */
+    @Override
+    public Role role() {
+        return role;
+    }
+
+    /**
+     * Returns the S-VLAN id associated with a service INNI, or the first S-VLAN ID found for a global INNI.
+     * This is assumed to be the S-TAG of another FC interconnected with this INNI.
+     *
+     * @return S-VLAN id
+     */
+    @Override
+    public VlanId sVlanId() {
+        if (sVlanIdSet.isEmpty()) {
+            return VlanId.NONE;
+        } else {
+            return sVlanIdSet.iterator().next();
+        }
+    }
+
+    /**
+     * Always returns null, since CE-VLAN IDs are not associated with INNIs.
+     *
+     * @return null
+     */
+    @Override
+    public VlanId ceVlanId() {
+        return null;
+    }
+
+    /**
+     * Returns the set of S-VLAN ids associated with the INNI.
+     * Those are assumed to be the S-TAGs of other FCs interconnected with this INNI.
+     *
+     * @return S-VLAN id set
+     */
+    public Set<VlanId> sVlanIdSet() {
+        return ImmutableSet.copyOf(sVlanIdSet);
+    }
+
+    // FIXME: Find a better way to implement this method
+    /**
+     * Sets the S-VLAN id associated with an FC INNI.
+     *
+     * @param sVlanId S-VLAN id to set
+     */
+    public void setSVlanId(VlanId sVlanId) {
+        sVlanIdSet.add(sVlanId);
+    }
+
+    /**
+     * Returns INNI tpid - applicable only to service-specific INNIs.
+     *
+     * @return tpid
+     */
+    public String tpid() {
+        return tpid;
+    }
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", this.id)
+                .add("cfgId", this.cfgId)
+                .add("role", role)
+                .add("refCount", refCount)
+                .add("sVlanIds", sVlanIdSet)
+                .add("capacity", this.capacity)
+                .add("usedCapacity", this.usedCapacity).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetInni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId sVlanId;
+        private String tpid;
+        private Bandwidth usedCapacity;
+        private Annotations annotations;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the sVlanId of this builder.
+         *
+         * @param sVlanId the builder sVlanId to set
+         * @return this builder instance
+         */
+        public Builder sVlanId(VlanId sVlanId) {
+            this.sVlanId = sVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the tpid of this builder.
+         *
+         * @param tpid the builder tpid to set
+         * @return this builder instance
+         */
+        public Builder tpid(String tpid) {
+            this.tpid = tpid;
+            return this;
+        }
+
+        /**
+         * Sets the usedCapacity of this builder.
+         *
+         * @param usedCapacity the builder usedCapacity to set
+         * @return this builder instance
+         */
+        public Builder usedCapacity(Bandwidth usedCapacity) {
+            this.usedCapacity = usedCapacity;
+            return this;
+        }
+
+        /**
+         * Sets annotations.
+         *
+         * @param annotations annotations
+         * @return this builder instance
+         */
+        public CarrierEthernetInni.Builder annotations(Annotations annotations) {
+            this.annotations = annotations;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetInni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetInni instance
+         */
+        public CarrierEthernetInni build() {
+            return new CarrierEthernetInni(cp, cfgId, role, sVlanId, tpid, usedCapacity, annotations);
+        }
+    }
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetLogicalTerminationPoint.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetLogicalTerminationPoint.java
new file mode 100644
index 0000000..533d25d
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetLogicalTerminationPoint.java
@@ -0,0 +1,209 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import org.onosproject.net.ConnectPoint;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Representation of a CE Logical Termination Point.
+ */
+public class CarrierEthernetLogicalTerminationPoint {
+
+    public enum Role {
+
+        WORKING("Working"),
+        PROTECTION("Protection"),
+        PROTECTED("Protected"),
+        SYMMETRIC("Symmetric"),
+        HUB("Hub"),
+        SPOKE("Spoke"),
+        LEAF("Leaf"),
+        // FIXME: Remove that after hackathon?
+        TRUNK("Trunk"),
+        ROOT("Root");
+
+        private String value;
+
+        Role(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
+    protected String ltpId;
+    protected String ltpCfgId;
+    protected Role role;
+    // A global LTP will point to the corresponding global NI and a service LTP to the corresponding service NI
+    protected CarrierEthernetNetworkInterface ni;
+
+    public CarrierEthernetLogicalTerminationPoint(String ltpCfgId, CarrierEthernetNetworkInterface ni) {
+        checkNotNull(ni);
+        this.ni = ni;
+        // NOTE: Role is expected to be null for global LTPs/NIs
+        if (ni.type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+            this.role = (ni.role() == null ? null : Role.valueOf(((CarrierEthernetUni) ni).role().name()));
+        } else if (ni.type().equals(CarrierEthernetNetworkInterface.Type.INNI)) {
+            this.role = (ni.role() == null ? null : Role.valueOf(((CarrierEthernetInni) ni).role().name()));
+        } else if (ni.type().equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
+            this.role = (ni.role() == null ? null : Role.valueOf(((CarrierEthernetEnni) ni).role().name()));
+        }
+        this.ltpId = this.cp().deviceId().toString() + "/" + this.cp().port().toString();
+        this.ltpCfgId = (ltpCfgId == null ? this.ltpId : ltpCfgId);
+    }
+
+    public CarrierEthernetLogicalTerminationPoint(ConnectPoint cp, String ltpCfgId,
+                                                  CarrierEthernetNetworkInterface.Type niType,
+                                                  CarrierEthernetLogicalTerminationPoint.Role role) {
+        this.ltpId = cp.deviceId().toString() + "/" + cp.port().toString();
+        this.ltpCfgId = (ltpCfgId == null ? this.ltpId : ltpCfgId);
+        this.role = role;
+        // NOTE: Role is expected to be null for global LTPs/NIs
+        // FIXME: Provide appropriate mapping between LTP and NI roles (e.g. ROOT -> HUB, LEAF -> SPOKE)
+        if (niType.equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+            CarrierEthernetUni.Role uniRole = (role == null) ? null : CarrierEthernetUni.Role.valueOf(role.name());
+            this.ni = CarrierEthernetUni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(uniRole)
+                    .build();
+        } else if (niType.equals(CarrierEthernetNetworkInterface.Type.INNI))  {
+            CarrierEthernetInni.Role inniRole = (role == null) ? null : CarrierEthernetInni.Role.valueOf(role.name());
+            this.ni = CarrierEthernetInni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(inniRole)
+                    .build();
+        } else if (niType.equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
+            CarrierEthernetEnni.Role enniRole = (role == null) ? null : CarrierEthernetEnni.Role.valueOf(role.name());
+            this.ni = CarrierEthernetEnni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(enniRole)
+                    .build();
+        }
+    }
+
+    /**
+     * Returns associated connect point.
+     *
+     * @return associated connect point
+     */
+    public ConnectPoint cp() {
+        return ni.cp();
+    }
+
+    /**
+     * Returns LTP string identifier.
+     *
+     * @return LTP string identifier
+     */
+    public String id() {
+        return ltpId;
+    }
+
+    /**
+     * Returns LTP string config identifier.
+     *
+     * @return LTP string config identifier
+     */
+    public String cfgId() {
+        return ltpCfgId;
+    }
+
+    /**
+     * Returns LTP role - applicable only to service-specific LTPs.
+     *
+     * @return LTP role
+     */
+    public Role role() {
+        return role;
+    }
+
+    /**
+     * Returns LTP type.
+     *
+     * @return LTP type
+     */
+    public CarrierEthernetNetworkInterface.Type type() {
+        return ni.type();
+    }
+
+    /**
+     * Returns the NI associated with the LTP or null of there is none.
+     *
+     * @return NI associated with LTP
+     */
+    public CarrierEthernetNetworkInterface ni() {
+        return ni;
+    }
+
+    /**
+     * Returns the scope of the LTP (always matches that of the associated NI).
+     *
+     * @return LTP scope
+     */
+    public CarrierEthernetNetworkInterface.Scope scope() {
+        return this.ni().scope();
+    }
+
+    /**
+     * Returns counter with the number of references (from EVCs/FCs) to the associated NI.
+     *
+     * @return number of references counter
+     */
+    public AtomicInteger refCount() {
+        return ni().refCount();
+    }
+
+    /**
+     * Sets the NI associated with the LTP.
+     *
+     * @param ni the NI to set
+     */
+    public void setNi(CarrierEthernetNetworkInterface ni) {
+        this.ni = ni;
+    }
+
+    /**
+     * Sets LTP role - applicable only to EVC- or FC-specific LTPs.
+     *
+     * @param role the LTP role to set
+     */
+    public void setRole(Role role) {
+        this.role = role;
+    }
+
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", ltpId)
+                .add("cfgId", ltpCfgId)
+                .add("role", role)
+                .add("ni", ni).toString();
+    }
+
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetNetworkInterface.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetNetworkInterface.java
new file mode 100644
index 0000000..b32ab3f
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetNetworkInterface.java
@@ -0,0 +1,251 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import com.google.common.base.Objects;
+import org.onlab.osgi.DefaultServiceDirectory;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.AbstractAnnotated;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.DeviceService;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Representation of a Carrier Ethernet Network Interface (UNI, INNI or ENNI).
+ */
+public abstract class CarrierEthernetNetworkInterface extends AbstractAnnotated {
+
+    protected DeviceService deviceService = DefaultServiceDirectory.getService(DeviceService.class);
+
+    public enum Scope {
+        GLOBAL, SERVICE
+    }
+
+    public enum Type {
+        UNI, INNI, ENNI, GENERIC
+    }
+
+    protected ConnectPoint connectPoint;
+    protected String id;
+    protected String cfgId;
+    protected Bandwidth capacity;
+    protected Bandwidth usedCapacity;
+    protected Scope scope;
+    protected AtomicInteger refCount;
+    protected Type type;
+
+
+    public CarrierEthernetNetworkInterface(ConnectPoint connectPoint, Type type, String cfgId,
+                                           Annotations...annotations) {
+        super(annotations);
+        checkNotNull(connectPoint);
+        checkNotNull(type);
+        this.type = type;
+        this.connectPoint = connectPoint;
+        this.id = this.connectPoint.deviceId().toString() + "/" + this.connectPoint.port().toString();
+        this.cfgId = (cfgId == null ? this.id : cfgId);
+        Port port = deviceService.getPort(connectPoint.deviceId(), connectPoint.port());
+        if (port != null) {
+            this.capacity = Bandwidth.mbps(port.portSpeed());
+        } else {
+            this.capacity = Bandwidth.mbps((double) 1000);
+        }
+
+        this.usedCapacity = Bandwidth.mbps((double) 0);
+        this.scope = null;
+        this.refCount = new AtomicInteger();
+    }
+
+    /**
+     * Returns associated connect point.
+     *
+     * @return associated connect point
+     */
+    public ConnectPoint cp() {
+        return connectPoint;
+    }
+
+    /**
+     * Returns NI string identifier.
+     *
+     * @return NI string identifier
+     */
+    public String id() {
+        return id;
+    }
+
+    /**
+     * Returns NI string config identifier.
+     *
+     * @return NI string config identifier
+     */
+    public String cfgId() {
+        return cfgId;
+    }
+
+    /**
+     * Returns NI capacity.
+     *
+     * @return NI capacity
+     */
+    public Bandwidth capacity() {
+        return capacity;
+    }
+
+    /**
+     * Returns NI used capacity.
+     *
+     * @return NI used capacity
+     */
+    public Bandwidth usedCapacity() {
+        return usedCapacity;
+    }
+
+    /**
+     * Returns the NI S-TAG.
+     *
+     * @return NI S-TAG
+     */
+    public abstract VlanId sVlanId();
+
+    /**
+     * Returns the NI CE-VLAN ID.
+     *
+     * @return NI CE-VLAN ID
+     */
+    public abstract VlanId ceVlanId();
+
+    /**
+     * Returns the scope of the NI (GLOBAL or SERVICE).
+     *
+     * @return NI scope
+     */
+    public Scope scope() {
+        return scope;
+    }
+
+    /**
+     * Returns the type of the NI (UNI, INNI or ENNI).
+     *
+     * @return NI scope
+     */
+    public Type type() {
+        return type;
+    }
+
+    /**
+     * Returns counter with the number of references (from EVCs/FCs) to the particular NI.
+     *
+     * @return number of references counter
+     */
+    public AtomicInteger refCount() {
+        return refCount;
+    }
+
+    /**
+     * Sets NI string identifier.
+     *
+     * @param id the UNI string identifier to set
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * Sets NI string config identifier.
+     *
+     * @param cfgId the UNI string config identifier to set
+     */
+    public void setCfgId(String cfgId) {
+        this.cfgId = cfgId;
+    }
+
+    /**
+     * Sets NI capacity.
+     *
+     * @param capacity the capacity to set
+     */
+    public void setCapacity(Bandwidth capacity) {
+        this.capacity = capacity;
+    }
+
+    /**
+     * Returns the NI role, depending on the NI.
+     *
+     * @param <T> the NI role
+     * @return the NI role
+     */
+    public abstract <T> T role();
+
+    /**
+     * Adds the resources associated with an EVC- or FC-specific NI to a global NI.
+     *
+     * @param ni the EVC- or FC-specific NI to be added
+     */
+    public abstract void addEcNi(CarrierEthernetNetworkInterface ni);
+
+    /**
+     * Removes the resources associated with an EVC- or FC-specific NI from a global NI.
+     *
+     * @param ni the EVC- or FC-specific NI to be removed
+     */
+    public abstract void removeEcNi(CarrierEthernetNetworkInterface ni);
+
+    /**
+     * Validates whether an EVC- or FC-specific NI is compatible with the corresponding global NI.
+     *
+     * @param ni the EVC- or FC-specific NI
+     * @return boolean value indicating whether the NIs are compatible
+     */
+    public abstract boolean validateEcNi(CarrierEthernetNetworkInterface ni);
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", id)
+                .add("cfgId", cfgId)
+                .add("capacity", capacity)
+                .add("usedCapacity", usedCapacity).toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        CarrierEthernetNetworkInterface that = (CarrierEthernetNetworkInterface) o;
+        return Objects.equal(connectPoint, that.connectPoint);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(connectPoint);
+    }
+
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetSpanningTreeWeight.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetSpanningTreeWeight.java
new file mode 100644
index 0000000..8bc2b16
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetSpanningTreeWeight.java
@@ -0,0 +1,65 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.topology.LinkWeight;
+import org.onosproject.net.topology.TopologyEdge;
+import org.onosproject.net.topology.TopologyService;
+import org.slf4j.Logger;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Weight class to cause path selection only on the pre-calculated spanning tree.
+ */
+public class CarrierEthernetSpanningTreeWeight implements LinkWeight {
+
+    private final Logger log = getLogger(getClass());
+
+    protected TopologyService topologyService = null;
+
+    public CarrierEthernetSpanningTreeWeight(TopologyService topologyService) {
+        this.topologyService = topologyService;
+    }
+
+    @Override
+    public double weight(TopologyEdge edge) {
+        if (!isBroadCastPoint(edge.link().src()) || !isBroadCastPoint(edge.link().dst())) {
+            return -1;
+        } else {
+            return 1;
+        }
+    }
+
+    /**
+     * Checks if a connect point is on the pre-calculated spanning tree.
+     *
+     * @param cp the connect point to check
+     * @return true if the connect point is on the spanning tree and false otherwise
+     */
+    private boolean isBroadCastPoint(ConnectPoint cp) {
+        // TODO: Get topology snapshot so that same spanning tree is used by all pairs if topology changes
+        if (cp == null) {
+            log.info("Cp is null!");
+        }
+        if (topologyService == null) {
+            log.info("topologyservice is null!");
+        }
+        return topologyService.isBroadcastPoint(topologyService.currentTopology(), cp);
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetUni.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetUni.java
new file mode 100644
index 0000000..c220483
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetUni.java
@@ -0,0 +1,419 @@
+/*
+ * 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.opencord.ce.api.models;
+
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.ConnectPoint;
+import org.slf4j.Logger;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Representation of a Carrier Ethernet UNI.
+ * Class can be used in different two ways:
+ * 1. As a global UNI descriptor containing one or more BW profiles
+ * 2. As a service-specific UNI descriptor containing a single BW profile and including a type (root, leaf)
+ */
+public final class CarrierEthernetUni extends CarrierEthernetNetworkInterface {
+
+    private final Logger log = getLogger(getClass());
+
+    public enum Role {
+
+        ROOT("Root"),
+        LEAF("Leaf");
+
+        private String value;
+
+        Role(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
+    protected Role role = null;
+    protected Set<VlanId> ceVlanIdSet = Sets.newConcurrentHashSet();
+
+    // Note: INTERFACE BWP map can only have up to one element
+    protected final Map<CarrierEthernetBandwidthProfile.Type, Map<String, CarrierEthernetBandwidthProfile>> bwpMap =
+            new HashMap<>();
+
+    // TODO: May be needed to add refCount for CoS BWPs - only applicable to global UNIs
+    // TODO: Change ceVlanId to Collection<VlanId>
+    private CarrierEthernetUni(ConnectPoint cp, String uniCfgId, Role role,
+                               VlanId ceVlanId,
+                               CarrierEthernetBandwidthProfile bwp,
+                               Annotations annotations) {
+        super(cp, Type.UNI, uniCfgId, annotations);
+
+        this.role = role;
+        // FIXME: Set the NI scope directly instead?
+        this.scope = (role == null ? Scope.GLOBAL : Scope.SERVICE);
+        if (ceVlanId != null) {
+            this.ceVlanIdSet.add(ceVlanId);
+        }
+        for (CarrierEthernetBandwidthProfile.Type bwpType : CarrierEthernetBandwidthProfile.Type.values()) {
+            this.bwpMap.put(bwpType, new HashMap<>());
+        }
+
+        if (bwp != null) {
+            // Limit the CIR of the provided bwp according to UNI capacity
+            if (bwp.cir().bps() > this.capacity.bps()) {
+                log.warn("UNI {}: Limiting provided CIR ({} bps) to UNI capacity ({} bps)",
+                        this.id, (long) bwp.cir().bps(), this.capacity);
+            }
+            bwp.setCir(Bandwidth.bps(Math.min(bwp.cir().bps(), this.capacity.bps())));
+
+            // Limit the EIR of the provided bwp according to the UNI capacity minus CIR
+            if (bwp.eir().bps() > this.capacity.bps() - bwp.cir().bps()) {
+                log.warn("UNI {}: Limiting provided EIR ({} bps) to UNI capacity minus CIR ({} bps)",
+                        this.id, bwp.eir().bps(), this.capacity.bps() - bwp.cir().bps());
+            }
+            bwp.setEir(Bandwidth.bps(Math.min(bwp.eir().bps(), this.capacity.bps() - bwp.cir().bps())));
+
+            addBandwidthProfile(bwp);
+        }
+    }
+
+    /**
+     * Adds a BW profile to a UNI.
+     *
+     * @param bwp the BWP to be added
+     */
+    public void addBandwidthProfile(CarrierEthernetBandwidthProfile bwp) {
+
+        Map<String, CarrierEthernetBandwidthProfile> subBwpMap = this.bwpMap.get(bwp.type());
+        subBwpMap.put(bwp.id(), bwp);
+        this.bwpMap.put(bwp.type(), subBwpMap);
+        // Used capacity cannot be more than UNI capacity (redundant check - should be avoided by check in validateBwp)
+        this.usedCapacity = Bandwidth.bps(Math.min(this.usedCapacity.bps() + bwp.cir().bps(), this.capacity.bps()));
+    }
+
+    /**
+     * Adds the resources associated with an EVC- or FC-specific UNI to a global UNI.
+     *
+     * @param ni the EVC- or FC-specific UNI to be added
+     */
+    @Override
+    public void addEcNi(CarrierEthernetNetworkInterface ni) {
+        CarrierEthernetUni uni;
+        if (!(ni instanceof CarrierEthernetUni)) {
+            return;
+        } else {
+            uni = (CarrierEthernetUni) ni;
+        }
+
+        // Add CE-VLAN ID
+        if (uni.ceVlanId() != VlanId.NONE) {
+            this.ceVlanIdSet.add(uni.ceVlanId());
+        }
+
+        // Add UNI BWP
+        CarrierEthernetBandwidthProfile bwp = uni.bwp();
+        if (bwp != null) {
+            Map<String, CarrierEthernetBandwidthProfile> subBwpMap = this.bwpMap.get(bwp.type());
+            subBwpMap.put(bwp.id(), bwp);
+            this.bwpMap.put(bwp.type(), subBwpMap);
+            // Used capacity cannot be more than UNI capacity
+            // (redundant check - should be avoided by check in validateBwp)
+            this.usedCapacity = Bandwidth.bps(Math.min(this.usedCapacity.bps() + bwp.cir().bps(), this.capacity.bps()));
+        }
+    }
+
+    /**
+     * Removes the resources associated with an EVC- or FC-specific UNI from a global UNI.
+     *
+     * @param ni the EVC- or FC-specific UNI to be removed
+     */
+    @Override
+    public void removeEcNi(CarrierEthernetNetworkInterface ni) {
+        CarrierEthernetUni uni;
+        if (!(ni instanceof CarrierEthernetUni)) {
+            return;
+        } else {
+            uni = (CarrierEthernetUni) ni;
+        }
+
+        // Remove UNI CE-VLAN ID
+        if (uni.ceVlanId() != VlanId.NONE) {
+            ceVlanIdSet.remove(uni.ceVlanId());
+        }
+
+        // Remove UNI BWP
+        CarrierEthernetBandwidthProfile bwp = uni.bwp();
+        Map<String, CarrierEthernetBandwidthProfile> subBwpMap = this.bwpMap.get(bwp.type());
+        subBwpMap.remove(bwp.id());
+        this.bwpMap.put(bwp.type(), subBwpMap);
+        // Redundant check - should be avoided by check in validateBwp
+        this.usedCapacity = Bandwidth.bps(Math.max(this.usedCapacity.bps() - bwp.cir().bps(), 0));
+    }
+
+    /**
+     * Validates whether an EVC- or FC-specific UNI is compatible with the corresponding global UNI.
+     *
+     * @param ni the EVC- or FC-specific UNI
+     * @return boolean value indicating whether the UNIs are compatible
+     */
+    @Override
+    public boolean validateEcNi(CarrierEthernetNetworkInterface ni) {
+        CarrierEthernetUni uni;
+        if (!(ni instanceof CarrierEthernetUni)) {
+            return false;
+        } else {
+            uni = (CarrierEthernetUni) ni;
+        }
+
+        // Check if the CE-VLAN ID of the UNI is already included in global UNI
+        if (uni.ceVlanId() != VlanId.NONE) {
+            if (ceVlanIdSet.contains(uni.ceVlanId())) {
+                log.error("CE-VLAN ID {} already exists in UNI {}", uni.ceVlanId().toString(), this.id());
+                return false;
+            }
+        }
+
+        CarrierEthernetBandwidthProfile bwp = uni.bwp();
+
+        // Check if the UNI BW profile is allowed based on its type and id and the existing profiles on the global UNI
+        for (CarrierEthernetBandwidthProfile.Type bwpType : CarrierEthernetBandwidthProfile.Type.values()) {
+            Map<String, CarrierEthernetBandwidthProfile> subBwpMap = this.bwpMap.get(bwpType);
+            if (!(subBwpMap.isEmpty())) {
+                if (bwpType != bwp.type()) {
+                    log.error("Different bandwidth profile type than {} already exists in UNI {}",
+                            bwp.type().name(), this.id());
+                    return false;
+                } else if (subBwpMap.containsKey(bwp.id())) {
+                    log.error("Bandwidth profile {} already exists in UNI {}", bwp.id(), this.id());
+                    return false;
+                } else if (bwp.type().equals(CarrierEthernetBandwidthProfile.Type.INTERFACE)) {
+                    log.error("Another bandwidth profile already exists in UNI {}", this.id());
+                    return false;
+                }
+            }
+        }
+
+        // Check whether there are enough available resources on the UNI
+        if (usedCapacity.bps() + bwp.cir().bps() > capacity.bps()) {
+            log.error("Bandwidth profile {} cannot be added to UNI {} due to lack of resources", bwp.id(), this.id());
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns UNI role (ROOT or LEAF) - applicable only to service-specific UNIs.
+     *
+     * @return UNI role
+     */
+    @Override
+    public Role role() {
+        return role;
+    }
+
+    /**
+     * Returns the CE-VLAN id associated with a local UNI, or the first CE-VLAN ID found for a global UNI.
+     *
+     * @return CE-VLAN id
+     */
+    @Override
+    public VlanId ceVlanId() {
+        if (ceVlanIdSet.isEmpty()) {
+            return VlanId.NONE;
+        } else {
+            return ceVlanIdSet.iterator().next();
+        }
+    }
+
+    /**
+     * Always returns null, since S-TAGs are not associated with UNIs.
+     *
+     * @return null
+     */
+    @Override
+    public VlanId sVlanId() {
+        return null;
+    }
+
+    /**
+     * Returns the set of CE-VLAN ids associated with the UNI.
+     *
+     * @return CE-VLAN id set
+     */
+    public Set<VlanId> ceVlanIdSet() {
+        return ImmutableSet.copyOf(ceVlanIdSet);
+    }
+
+    /**
+     * Returns the first non-null BWP of the UNI found - used mainly for service-specific UNIs.
+     * Note: The EVC-specific UNI representation will only have one BWP
+     *
+     * @return first non-null BWP of the UNI
+     */
+    public CarrierEthernetBandwidthProfile bwp() {
+
+        for (CarrierEthernetBandwidthProfile.Type bwpType : CarrierEthernetBandwidthProfile.Type.values()) {
+            if (!(this.bwpMap.get(bwpType).isEmpty())) {
+                return bwpMap.get(bwpType).entrySet().iterator().next().getValue();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns a collection of all BWPs of the UNI.
+     *
+     * @return all BWPs of the UNI
+     */
+    public Collection<CarrierEthernetBandwidthProfile> bwps() {
+
+        for (CarrierEthernetBandwidthProfile.Type bwpType : CarrierEthernetBandwidthProfile.Type.values()) {
+            if (!(this.bwpMap.get(bwpType).isEmpty())) {
+                return bwpMap.get(bwpType).values();
+            }
+        }
+        // Return an empty collection if no BWPs exist
+        return Collections.emptyList();
+    }
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .add("id", this.id)
+                .add("cfgId", this.cfgId)
+                .add("role", role)
+                .add("refCount", refCount)
+                .add("ceVlanIds", ceVlanIdSet)
+                .add("capacity", this.capacity)
+                .add("usedCapacity", this.usedCapacity)
+                .add("bandwidthProfiles", this.bwps()).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetUni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId ceVlanId;
+        private CarrierEthernetBandwidthProfile bwp;
+        private Annotations annotations;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the ceVlanId of this builder.
+         *
+         * @param ceVlanId the builder ceVlanId to set
+         * @return this builder instance
+         */
+        public Builder ceVlanId(VlanId ceVlanId) {
+            this.ceVlanId = ceVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the bwp of this builder.
+         *
+         * @param bwp the builder bwp to set
+         * @return this builder instance
+         */
+        public Builder bwp(CarrierEthernetBandwidthProfile bwp) {
+            this.bwp = bwp;
+            return this;
+        }
+        /**
+         * Sets annotations.
+         *
+         * @param annotations annotations
+         * @return this builder instance
+         */
+        public CarrierEthernetUni.Builder annotations(Annotations annotations) {
+            this.annotations = annotations;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetUni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetUni instance
+         */
+        public CarrierEthernetUni build() {
+            return new CarrierEthernetUni(cp, cfgId, role, ceVlanId, bwp, annotations);
+        }
+    }
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetVirtualConnection.java b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetVirtualConnection.java
new file mode 100644
index 0000000..fc3ea62
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetVirtualConnection.java
@@ -0,0 +1,250 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.time.Duration;
+import java.util.HashSet;
+import java.util.Set;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Representation of a Carrier Ethernet EVC.
+ */
+public final class CarrierEthernetVirtualConnection extends CarrierEthernetConnection {
+
+    private Short shortId;
+    private Set<CarrierEthernetUni> uniSet;
+    private boolean isVirtual;
+    private Integer maxNumUni;
+    private Set<CarrierEthernetForwardingConstruct> fcSet;
+
+    // Maximum possible number of UNIs for non-Point-to-Point EVCs
+    public static final Integer MAX_NUM_UNI = 1000;
+
+    // TODO: Remove id from constructor - currently used only when updating EVC
+    private CarrierEthernetVirtualConnection(EvcConnId id, String cfgId, Type type,
+                                             Integer maxNumUni,
+                                             Set<CarrierEthernetUni> uniSet,
+                                             Duration maxLatency) {
+        super(id, cfgId, type, maxLatency);
+        this.maxNumUni = maxNumUni != null ? maxNumUni :
+                type.equals(Type.POINT_TO_POINT) ? 2 : MAX_NUM_UNI;
+        this.uniSet = new HashSet<>(uniSet);
+        this.fcSet = new HashSet<>();
+        this.shortId = null;
+    }
+
+    /**
+     * Returns numerical identifier.
+     *
+     * @return numerical identifier
+     */
+    public Short shortId() {
+        return shortId;
+    }
+
+    /**
+     * Returns the Virtual status of the service (i.e. if all UNIs have CE-VLAN ids).
+     *
+     * @return true if service is virtual, false otherwise
+     */
+    public boolean isVirtual() {
+        return isVirtual;
+    }
+
+    /**
+     * Returns the maximum number of UNIs in the EVC.
+     *
+     * @return true the maximum number of UNIs in the EVC
+     */
+    public Integer maxNumUni() {
+        return maxNumUni;
+    }
+
+    /**
+     * Returns set of UNIs.
+     *
+     * @return set of UNIs
+     */
+    public Set<CarrierEthernetUni> uniSet() {
+        return ImmutableSet.copyOf(uniSet);
+    }
+
+    /**
+     * Returns the set of FCs associated with the EVC.
+     *
+     * @return set of FCs associated with the EVC
+     */
+    public Set<CarrierEthernetForwardingConstruct> fcSet() {
+        return ImmutableSet.copyOf(fcSet);
+    }
+
+    /**
+     * Set numerical identifier.
+     *
+     * @param shortId the numerical identifier to set
+     */
+    public void setShortId(Short shortId) {
+        this.shortId = shortId;
+    }
+
+    /**
+     * Sets the set of UNIs.
+     *
+     * @param uniSet the set of UNIs to be set
+     */
+    public void setUniSet(Set<CarrierEthernetUni> uniSet) {
+        this.uniSet = uniSet;
+    }
+
+    /**
+     * Sets the set of FCs.
+     *
+     * @param fcSet the set of UNIs to be set
+     */
+    public void setFcSet(Set<CarrierEthernetForwardingConstruct> fcSet) {
+        this.fcSet = fcSet;
+    }
+
+    /**
+     * Sets the Virtual status of the service.
+     *
+     * @param isVirtual boolean value with the status to set
+     */
+    public void setIsVirtual(boolean isVirtual) {
+        this.isVirtual = isVirtual;
+    }
+
+    @Override
+    public String toString() {
+
+        return toStringHelper(this)
+                .omitNullValues()
+                .add("id", id)
+                .add("cfgId", cfgId)
+                .add("type", type)
+                .add("state", state)
+                .add("UNIs", uniSet)
+                .add("FCs", fcSet).toString();
+    }
+
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetVirtualConnection entities.
+     */
+    public static final class Builder {
+
+        private EvcConnId id;
+        private String cfgId;
+        private Type type;
+        private Duration maxLatency;
+        private Set<CarrierEthernetUni> uniSet;
+        private Integer maxNumUni;
+
+        /**
+         * Sets the id of this builder.
+         *
+         * @param id the builder id to set
+         * @return this builder instance
+         */
+        public Builder id(EvcConnId id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the type of this builder.
+         *
+         * @param type the builder type to set
+         * @return this builder instance
+         */
+        public Builder type(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        /**
+         * Sets the maxLatency of this builder.
+         *
+         * @param maxLatency the builder maxLatency to set
+         * @return this builder instance
+         */
+        public Builder maxLatency(Duration maxLatency) {
+            this.maxLatency = maxLatency;
+            return this;
+        }
+
+        /**
+         * Sets the uniSet of this builder.
+         *
+         * @param uniSet the builder uniSet to set
+         * @return this builder instance
+         */
+        public Builder uniSet(Set<CarrierEthernetUni> uniSet) {
+            this.uniSet = uniSet;
+            return this;
+        }
+
+        /**
+         * Sets the maxNumUni of this builder.
+         *
+         * @param maxNumUni the builder maxNumUni to set
+         * @return this builder instance
+         */
+        public Builder maxNumUni(Integer maxNumUni) {
+            this.maxNumUni = maxNumUni;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetVirtualConnection instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetVirtualConnection instance
+         */
+        public CarrierEthernetVirtualConnection build() {
+            checkNotNull(type, "EVC must have a type");
+            checkArgument(uniSet != null && uniSet.size() > 1,
+                    "EVC must include at least two UNIs");
+            return new CarrierEthernetVirtualConnection(id, cfgId, type, maxNumUni, uniSet, maxLatency);
+        }
+    }
+}
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/EvcConnId.java b/ce-api/src/main/java/org/opencord/ce/api/models/EvcConnId.java
new file mode 100644
index 0000000..410137c
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/EvcConnId.java
@@ -0,0 +1,33 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import org.onlab.util.Identifier;
+
+/**
+ * Virtual connection identifier class.
+ */
+public class EvcConnId extends Identifier<String> {
+
+    public EvcConnId(String connId) {
+        super(connId);
+    }
+
+    public static EvcConnId of(String connId) {
+        return new EvcConnId(connId);
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/PortVlanConfig.java b/ce-api/src/main/java/org/opencord/ce/api/models/PortVlanConfig.java
new file mode 100644
index 0000000..593ffdd
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/PortVlanConfig.java
@@ -0,0 +1,47 @@
+/*
+ * 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.opencord.ce.api.models;
+
+import org.onlab.packet.VlanId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.config.Config;
+
+import java.util.Optional;
+
+/**
+ * Configuration information for edge connect point and corresponding VLAN tag.
+ */
+public class PortVlanConfig extends Config<ConnectPoint> {
+    public static final String CONFIG_KEY = "portVlan";
+
+    public static final String S_TAG_KEY = "s-tag";
+
+    public Optional<VlanId> portVlanId() {
+        String s = get(S_TAG_KEY, null);
+        if (s == null) {
+            return Optional.empty();
+        }
+        return Optional.of(VlanId.vlanId(Short.valueOf(s)));
+    }
+
+    public PortVlanConfig portVlanId(VlanId vlanId) {
+        if (vlanId == null) {
+            return (PortVlanConfig) setOrClear(S_TAG_KEY, (String) null);
+        }
+        return (PortVlanConfig) setOrClear(S_TAG_KEY, String.valueOf(vlanId.toShort()));
+    }
+}
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetBwProfileCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetBwProfileCodec.java
new file mode 100644
index 0000000..9fccb1c
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetBwProfileCodec.java
@@ -0,0 +1,65 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.util.Bandwidth;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Codec for {@link CarrierEthernetBandwidthProfile}.
+ */
+public class CarrierEthernetBwProfileCodec extends JsonCodec<CarrierEthernetBandwidthProfile> {
+    private static final String ID = "bwpId";
+    private static final String CFG_ID = "cfgId";
+    private static final String TYPE = "bwpType";
+    private static final String CIR = "cir";
+    private static final String CBS = "cbs";
+    private static final String EIR = "eir";
+    private static final String EBS = "ebs";
+
+    @Override
+    public ObjectNode encode(CarrierEthernetBandwidthProfile bwProfile, CodecContext context) {
+        checkNotNull(bwProfile, "BW profile cannot be null");
+        ObjectNode result = context.mapper().createObjectNode();
+        result.put(ID, bwProfile.id())
+                .put(CFG_ID, bwProfile.cfgId())
+                .put(TYPE, bwProfile.type().name())
+                .put(CIR, bwProfile.cir().bps())
+                .put(EIR, bwProfile.eir().bps())
+                .put(CBS, bwProfile.cbs())
+                .put(EBS, bwProfile.ebs());
+        return result;
+    }
+
+    @Override
+    public CarrierEthernetBandwidthProfile decode(ObjectNode json, CodecContext context) {
+        return CarrierEthernetBandwidthProfile.builder()
+                .id(json.path(ID).asText())
+                .cfgId(json.path(CFG_ID).asText())
+                .type(CarrierEthernetBandwidthProfile.Type.valueOf(json.path(TYPE).asText()))
+                .cir(Bandwidth.bps(json.path(CIR).asDouble()))
+                .eir(Bandwidth.bps(json.path(EIR).asDouble()))
+                .cbs(json.path(CBS).asLong())
+                .ebs(json.path(EBS).asLong())
+                .build();
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetConnectionCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetConnectionCodec.java
new file mode 100644
index 0000000..e83f883
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetConnectionCodec.java
@@ -0,0 +1,67 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.opencord.ce.api.models.CarrierEthernetConnection;
+import org.opencord.ce.api.models.EvcConnId;
+
+import java.time.Duration;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.opencord.ce.api.models.CarrierEthernetConnection.Type;
+import static org.opencord.ce.api.models.CarrierEthernetConnection.State;
+/**
+ * Codec for {@link org.opencord.ce.api.models.CarrierEthernetConnection}.
+ */
+public class CarrierEthernetConnectionCodec extends JsonCodec<CarrierEthernetConnection> {
+
+    private static final String ID = "connectionId";
+    private static final String CFG_ID = "cfgId";
+    private static final String TYPE = "type";
+    private static final String STATE = "state";
+    private static final String MAX_LATENCY = "maxLatency";
+
+    @Override
+    public ObjectNode encode(CarrierEthernetConnection connection, CodecContext context) {
+        checkNotNull(connection, "Java connection object cannot be null");
+        ObjectNode result = context.mapper().createObjectNode()
+                .put(ID, connection.id().id())
+                .put(CFG_ID, connection.cfgId())
+                .put(TYPE, connection.type().toString())
+                .put(STATE, connection.type().toString())
+                .put(MAX_LATENCY, connection.maxLatency().toString());
+        return result;
+    }
+
+    @Override
+    public CarrierEthernetConnection decode(ObjectNode json, CodecContext context) {
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+
+        EvcConnId id = EvcConnId.of(json.path(ID).asText());
+        String cfgId = json.path(CFG_ID).asText();
+        Type type = Type.valueOf(json.path(TYPE).asText());
+        State state = State.valueOf(json.path(STATE).asText());
+        Duration maxLatency = Duration.parse(json.path(MAX_LATENCY).asText());
+        return null;
+    }
+
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetEvcCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetEvcCodec.java
new file mode 100644
index 0000000..c01b66b
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetEvcCodec.java
@@ -0,0 +1,256 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Bandwidth;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.ConnectPoint;
+import org.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+import org.opencord.ce.api.models.CarrierEthernetConnection;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static org.onlab.util.Tools.nullIsIllegal;
+import static org.opencord.ce.api.models.CarrierEthernetVirtualConnection.MAX_NUM_UNI;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.api.models.CarrierEthernetVirtualConnection.builder;
+
+/**
+ * Codec for EVC.
+ */
+public class CarrierEthernetEvcCodec 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().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(EvcConnId.of(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();
+    }
+
+    /**
+     * 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;
+    }
+
+}
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetNetworkInterfaceCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetNetworkInterfaceCodec.java
new file mode 100644
index 0000000..864b2e5
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetNetworkInterfaceCodec.java
@@ -0,0 +1,164 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.VlanId;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.ConnectPoint;
+import org.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+import org.opencord.ce.api.models.CarrierEthernetEnni;
+import org.opencord.ce.api.models.CarrierEthernetGenericNi;
+import org.opencord.ce.api.models.CarrierEthernetInni;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.opencord.ce.api.models.CarrierEthernetNetworkInterface.Type;
+
+/**
+ * Codec for {@link org.opencord.ce.api.models.CarrierEthernetNetworkInterface}.
+ */
+public class CarrierEthernetNetworkInterfaceCodec extends JsonCodec<CarrierEthernetNetworkInterface> {
+
+    private static final String TYPE = "type";
+    private static final String CONNECT_POINT = "cp";
+    private static final String NI_ID = "niId";
+    private static final String CFG_ID = "cfgId";
+    private static final String BWP = "bwp";
+    private static final String C_TAGS = "cTags";
+    private static final String ROLE = "role";
+    private static final String CAPACITY = "capacity";
+    private static final String USED_CAPACITY = "usedCapacity";
+    private static final String S_TAG = "sTag";
+    private static final String C_TAG = "cTag";
+
+    @Override
+    public ObjectNode encode(CarrierEthernetNetworkInterface networkInterface, CodecContext context) {
+        checkNotNull(networkInterface, "Java networkInterface class cannot be null");
+        ObjectNode result = context.mapper().createObjectNode()
+                .put(CFG_ID, networkInterface.id())
+                .put(TYPE, networkInterface.type().toString())
+                .put(ROLE, networkInterface.role().toString());
+        if (networkInterface.capacity() != null) {
+            result.put(CAPACITY, networkInterface.capacity().bps());
+        }
+        if (networkInterface.usedCapacity() != null) {
+            result.put(USED_CAPACITY, networkInterface.usedCapacity().bps());
+        }
+        JsonCodec<ConnectPoint> cpCodec = context.codec(ConnectPoint.class);
+        result.set(CONNECT_POINT, cpCodec.encode(networkInterface.cp(), context));
+        switch (networkInterface.type()) {
+            case UNI:
+                CarrierEthernetUni uni = (CarrierEthernetUni) networkInterface;
+                JsonCodec<CarrierEthernetBandwidthProfile> bwpCodec =
+                        context.codec(CarrierEthernetBandwidthProfile.class);
+                result.set(BWP, bwpCodec.encode(uni.bwp(), context));
+                ArrayNode ctags = context.mapper().createArrayNode();
+                uni.ceVlanIdSet().forEach(ceVlan -> ctags.add(ceVlan.toShort()));
+                result.set(C_TAGS, ctags);
+                break;
+            case INNI:
+                CarrierEthernetInni inni = (CarrierEthernetInni) networkInterface;
+                result.put(S_TAG, inni.sVlanId().toShort());
+                break;
+            case ENNI:
+                CarrierEthernetEnni enni = (CarrierEthernetEnni) networkInterface;
+                result.put(S_TAG, enni.sVlanId().toShort());
+                break;
+            case GENERIC:
+            default:
+        }
+        return result;
+    }
+
+    @Override
+    public CarrierEthernetNetworkInterface decode(ObjectNode json, CodecContext context) {
+        String id = json.path(NI_ID).asText();
+        String cfgId = json.path(CFG_ID).asText();
+        Type type = Type.valueOf(json.path(TYPE).asText());
+
+        JsonCodec<ConnectPoint> cpCodec = context.codec(ConnectPoint.class);
+        ConnectPoint cp = cpCodec.decode((ObjectNode) json.path(CONNECT_POINT), context);
+        CarrierEthernetNetworkInterface ni;
+        switch (type) {
+            case UNI:
+                JsonCodec<CarrierEthernetBandwidthProfile> bwpCodec =
+                        context.codec(CarrierEthernetBandwidthProfile.class);
+                Set<VlanId> ceVlanIds = new HashSet<>();
+                json.path(C_TAGS).forEach(jsonCeVlan ->
+                ceVlanIds.add(VlanId.vlanId(jsonCeVlan.shortValue())));
+                CarrierEthernetUni.Role role = null;
+                for (CarrierEthernetUni.Role r : CarrierEthernetUni.Role.values()) {
+                    if (r.toString().equals(json.path(ROLE).asText())) {
+                        role = r;
+                        break;
+                    }
+                }
+                ni = CarrierEthernetUni.builder()
+                        .cp(cp)
+                        .cfgId(cfgId)
+                        .bwp(bwpCodec.decode((ObjectNode) json.path(BWP), context))
+                        .ceVlanId(ceVlanIds.iterator().next())
+                        .role(role)
+                        .build();
+                break;
+            case ENNI:
+                VlanId sTag = VlanId.vlanId(json.path(S_TAG).shortValue());
+                CarrierEthernetEnni.Role roleEnni = null;
+                for (CarrierEthernetEnni.Role r : CarrierEthernetEnni.Role.values()) {
+                    if (r.toString().equals(json.path(ROLE).asText())) {
+                        roleEnni = r;
+                        break;
+                    }
+                }
+                ni = CarrierEthernetEnni.builder()
+                        .cp(cp)
+                        .cfgId(cfgId)
+                        .sVlanId(sTag)
+                        .role(roleEnni)
+                        .build();
+                break;
+            case INNI:
+                VlanId sTagInni = VlanId.vlanId(json.path(S_TAG).shortValue());
+                CarrierEthernetInni.Role roleInni = null;
+                for (CarrierEthernetInni.Role r : CarrierEthernetInni.Role.values()) {
+                    if (r.toString().equals(json.path(ROLE).asText())) {
+                        roleInni = r;
+                        break;
+                    }
+                }
+                ni = CarrierEthernetInni.builder()
+                        .cp(cp)
+                        .cfgId(cfgId)
+                        .sVlanId(sTagInni)
+                        .role(roleInni)
+                        .build();
+                break;
+            case GENERIC:
+            default:
+                ni = new CarrierEthernetGenericNi(cp, cfgId);
+        }
+        return ni;
+    }
+
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CodecRegistrator.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CodecRegistrator.java
new file mode 100644
index 0000000..2829bc5
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CodecRegistrator.java
@@ -0,0 +1,63 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+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.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
+
+@Component(immediate = true)
+public class CodecRegistrator {
+    private final Logger log = getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CodecService codecService;
+
+    @Activate
+    public void activate() {
+        codecService.registerCodec(CarrierEthernetVirtualConnection.class,
+                new CarrierEthernetEvcCodec());
+        codecService.registerCodec(CarrierEthernetBandwidthProfile.class, new CarrierEthernetBwProfileCodec());
+        codecService.registerCodec(CarrierEthernetNetworkInterface.class,
+                new CarrierEthernetNetworkInterfaceCodec());
+        codecService.registerCodec(CarrierEthernetLogicalTerminationPoint.class,
+                new LogicalTerminationEndPointCodec());
+        codecService.registerCodec(CarrierEthernetForwardingConstruct.class,
+                new ForwardingConstructCodec());
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        codecService.unregisterCodec(CarrierEthernetVirtualConnection.class);
+        codecService.unregisterCodec(CarrierEthernetBandwidthProfile.class);
+        codecService.unregisterCodec(CarrierEthernetNetworkInterface.class);
+        codecService.unregisterCodec(CarrierEthernetForwardingConstruct.class);
+        codecService.unregisterCodec(CarrierEthernetLogicalTerminationPoint.class);
+        log.info("Stopped");
+    }
+}
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/ForwardingConstructCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/ForwardingConstructCodec.java
new file mode 100644
index 0000000..b09f897
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/ForwardingConstructCodec.java
@@ -0,0 +1,82 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.VlanId;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.opencord.ce.api.models.CarrierEthernetConnection;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.EvcConnId;
+
+import java.time.Duration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Codec {@link CarrierEthernetForwardingConstruct}.
+ */
+public class ForwardingConstructCodec extends JsonCodec<CarrierEthernetForwardingConstruct> {
+    private static final String FC_ID = "fcId";
+    private static final String CFG_ID = "cfgId";
+    private static final String TYPE = "type";
+    private static final String STATE = "state";
+    private static final String MAX_LATENCY = "maxLatency";
+    private static final String VLAN_ID = "vlanId";
+    private static final String LTP_LIST = "ltpList";
+
+    @Override
+    public ObjectNode encode(CarrierEthernetForwardingConstruct fc, CodecContext context) {
+        JsonCodec<CarrierEthernetLogicalTerminationPoint> ltpCodec =
+                context.codec(CarrierEthernetLogicalTerminationPoint.class);
+        ObjectNode result = context.mapper().createObjectNode()
+                .put(FC_ID, fc.id().id())
+                .put(CFG_ID, fc.cfgId())
+                .put(TYPE, fc.type().toString())
+                .put(STATE, fc.type().toString())
+                .put(MAX_LATENCY, fc.maxLatency().toString());
+        result.put(VLAN_ID, fc.vlanId().toShort());
+        ArrayNode ltpsNode = context.mapper().createArrayNode();
+        fc.ltpSet().forEach(ltp ->
+            ltpsNode.add(ltpCodec.encode(ltp, context)));
+        result.set(LTP_LIST, ltpsNode);
+        return result;
+    }
+
+    @Override
+    public CarrierEthernetForwardingConstruct decode(ObjectNode json, CodecContext context) {
+        JsonCodec<CarrierEthernetLogicalTerminationPoint> ltpCodec =
+                context.codec(CarrierEthernetLogicalTerminationPoint.class);
+        Set<CarrierEthernetLogicalTerminationPoint> ltps =
+                new HashSet<>();
+        json.path(LTP_LIST).forEach(ltpJson ->
+            ltps.add(ltpCodec.decode((ObjectNode) ltpJson, context)));
+
+        CarrierEthernetForwardingConstruct fc = CarrierEthernetForwardingConstruct.builder()
+                .id(EvcConnId.of(json.path(FC_ID).asText()))
+                .cfgId(json.path(CFG_ID).asText())
+                .type(CarrierEthernetConnection.Type.valueOf(json.path(TYPE).asText()))
+                .maxLatency(Duration.parse(json.path(MAX_LATENCY).asText()))
+                .ltpSet(ltps)
+                .build();
+        fc.setVlanId(VlanId.vlanId(json.path(VLAN_ID).shortValue()));
+        return fc;
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/LogicalTerminationEndPointCodec.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/LogicalTerminationEndPointCodec.java
new file mode 100644
index 0000000..e587d0e
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/LogicalTerminationEndPointCodec.java
@@ -0,0 +1,72 @@
+/*
+ * 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.opencord.ce.api.models.codecs;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint.Role;
+
+/**
+ * Codec for {@link CarrierEthernetLogicalTerminationPoint}.
+ */
+public class LogicalTerminationEndPointCodec extends JsonCodec<CarrierEthernetLogicalTerminationPoint> {
+
+    private static final String ROLE = "role";
+    private static final String LTP_ID = "ltpId";
+    private static final String CFG_ID = "cfgId";
+    private static final String NETWORK_INTERFACE = "ni";
+
+    @Override
+    public ObjectNode encode(CarrierEthernetLogicalTerminationPoint ltp, CodecContext context) {
+        checkNotNull(ltp, "Java ltp object cannot be null");
+
+        JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+                context.codec(CarrierEthernetNetworkInterface.class);
+
+        ObjectNode result = context.mapper().createObjectNode()
+                .put(LTP_ID, ltp.id())
+                .put(CFG_ID, ltp.cfgId())
+                .put(ROLE, ltp.role().toString());
+        result.set(NETWORK_INTERFACE, niCodec.encode(ltp.ni(), context));
+        return result;
+    }
+
+    @Override
+    public CarrierEthernetLogicalTerminationPoint decode(ObjectNode json, CodecContext context) {
+
+        String ltpId = json.path(LTP_ID).asText();
+        String cfgId = json.path(CFG_ID).asText();
+        JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+                context.codec(CarrierEthernetNetworkInterface.class);
+        ObjectNode niJson = get(json, NETWORK_INTERFACE);
+        CarrierEthernetNetworkInterface networkInterface =
+                niCodec.decode(niJson, context);
+        CarrierEthernetLogicalTerminationPoint ltp =
+                new CarrierEthernetLogicalTerminationPoint(cfgId, networkInterface);
+        for (Role r : Role.values()) {
+            if (r.toString().equals(json.path(ROLE).asText())) {
+                ltp.setRole(r);
+            }
+        }
+        return ltp;
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/codecs/package-info.java b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/package-info.java
new file mode 100644
index 0000000..2b9ef9a
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Json/Java codecs package.
+ */
+package org.opencord.ce.api.models.codecs;
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/models/package-info.java b/ce-api/src/main/java/org/opencord/ce/api/models/package-info.java
new file mode 100644
index 0000000..87b1a09
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * VEE APIs.
+ */
+package org.opencord.ce.api.models;
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkProvisionerService.java b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkProvisionerService.java
new file mode 100644
index 0000000..07f1710
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkProvisionerService.java
@@ -0,0 +1,64 @@
+/*
+ * 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.opencord.ce.api.services;
+
+
+import com.google.common.annotations.Beta;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+
+/**
+ * Service interface for provisioning of Carrier Ethernet connections.
+ */
+@Beta
+public interface MetroNetworkProvisionerService {
+    /**
+     * Creates bandwidth profiles at the UNIs of an FC.
+     *
+     * @param fc the forwarding construct
+     */
+    void createBandwidthProfiles(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Applies bandwidth profiles to the UNIs of an FC.
+     *
+     * @param fc the forwarding construct
+     */
+    void applyBandwidthProfiles(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Removes bandwidth profiles from the UNIs of an FC.
+     *
+     * @param fc the forwarding construct
+     */
+    void removeBandwidthProfiles(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Establishes connectivity for the provided FC by installing all necessary forwarding rules.
+     *
+     * @param fc the forwarding construct
+     */
+    void setupConnectivity(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Removes connectivity for the provided FC by removing all installed forwarding rules.
+     *
+     * @param fc the forwarding construct
+     */
+    void removeConnectivity(CarrierEthernetForwardingConstruct fc);
+
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkVirtualNodeService.java b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkVirtualNodeService.java
new file mode 100644
index 0000000..66b018d
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkVirtualNodeService.java
@@ -0,0 +1,72 @@
+/*
+ * 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.opencord.ce.api.services;
+
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+
+import java.util.Set;
+
+/**
+ * Boundary interface between global Carrier Ethernet orchestration and local-site
+ * Carrier Ethernet service provisioning.
+ */
+public interface MetroNetworkVirtualNodeService {
+
+    /**
+     * Creates and submits FlowObjectives depending on role of the device in the FC and ingress/egress NI types.
+     *
+     * @param fc the forwarding construct
+     * @param srcNi the source network interface
+     * @param dstNiSet the set of destination network interfaces
+     */
+    void setNodeForwarding(CarrierEthernetForwardingConstruct fc, CarrierEthernetNetworkInterface srcNi,
+                           Set<CarrierEthernetNetworkInterface> dstNiSet);
+
+    /**
+     * Creates and stores meters based on the UNI's bandwidth profile.
+     *
+     * @param fc the forwarding construct
+     * @param uni the user to network interface
+     */
+    void createBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni);
+
+    /**
+     * Applies meters to flows.
+     *
+     * @param fc the forwarding construct
+     * @param uni the user to network interface
+     */
+    void applyBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni);
+
+    /**
+     * Removes the meters associated with a specific UNI of an FC.
+     *
+     * @param fc the forwarding construct
+     * @param uni the user to network interface
+     */
+    void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni);
+
+    /**
+     * Removes all installed flow objectives associated with a specific FC.
+     *
+     * @param fcId the forwarding construct
+     */
+    void removeAllForwardingResources(EvcConnId fcId);
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/MetroOrchestrationService.java b/ce-api/src/main/java/org/opencord/ce/api/services/MetroOrchestrationService.java
new file mode 100644
index 0000000..3253178
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroOrchestrationService.java
@@ -0,0 +1,248 @@
+/*
+ * 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.opencord.ce.api.services;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.ConnectPoint;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+
+import java.util.Map;
+import java.util.Set;
+
+import static org.opencord.ce.api.models.CarrierEthernetNetworkInterface.Type;
+
+/**
+ * Service interface for Carrier Ethernet.
+ *
+ * Defines interactions with CE concepts such as Ethernet Virtual Circuit (EVC), Forwarding Construct (FC),
+ * Logical Termination Point (LTP), and User to Network Interface (UNI).
+ */
+@Beta
+public interface MetroOrchestrationService {
+    /**
+     * Returns the map of installed EVCs.
+     *
+     * @return map of installed EVCs
+     */
+    Map<EvcConnId, CarrierEthernetVirtualConnection> evcMap();
+
+    /**
+     * Get an installed EVC using its id.
+     *
+     * @param evcId the EVC id
+     * @return the EVC representation or null if the EVC doesn't exist
+     */
+    CarrierEthernetVirtualConnection getEvc(EvcConnId evcId);
+
+    // TODO: Add method to remove a UNI from an already installed EVC
+
+    /**
+     * Establish connectivity according to the EVC type (E-Line, E-Tree, E-LAN) and the EVC parameters.
+     *
+     * @param evc the EVC representation
+     * @return the (potentially modified) EVC that was installed or null in case of failure
+     */
+    CarrierEthernetVirtualConnection installEvc(CarrierEthernetVirtualConnection evc);
+
+    /**
+     * Re-establish connectivity for an existing EVC.
+     *
+     * @param evc the updated EVC definition
+     * @return the (potentially modified) EVC that was installed or null if EVC connectivity could not be established
+     */
+    CarrierEthernetVirtualConnection updateEvc(CarrierEthernetVirtualConnection evc);
+
+
+    /**
+     * Removes all resources associated with a specific installed EVC.
+     *
+     * @param evcId the EVC id
+     */
+    void removeEvc(EvcConnId evcId);
+
+
+    /**
+     * Removes all installed EVCs and the associated resources.
+     * <p>
+     * This will be called either from the deactivate method or as a response to a CLI/REST command.
+     */
+    void removeAllEvcs();
+
+    /**
+     * Enable or disable EVC fragmentation into FCs.
+     *
+     * @param evcFragmentationEnabled true to enable fragmentation, false otherwise
+     */
+    void setEvcFragmentation(boolean evcFragmentationEnabled);
+
+
+    /**
+     * Checks the fragmentation state of the EVC.
+     *
+     * @return true if fragmentation is enabled, false otherwise
+     */
+    boolean getEvcFragmentation();
+
+    /**
+     * Set the EVC fragmentation flag to the value before its last change.
+     *
+     */
+    void resetEvcFragmentation();
+
+    /**
+     * Get the map containing all installed FCs.
+     *
+     * @return the FC map
+     */
+    Map<EvcConnId, CarrierEthernetForwardingConstruct> fcMap();
+
+    /**
+     * Get an installed FC using its id.
+     *
+     * @param fcId the FC id
+     * @return the FC representation or null if the EVC doesn't exist
+     */
+    CarrierEthernetForwardingConstruct getFc(EvcConnId fcId);
+
+    /**
+     * Installs all resources associated with a specific FC.
+     *
+     * @param fc the FC to install
+     * @return the FC that was installed
+     */
+    CarrierEthernetForwardingConstruct installFc(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Re-establish connectivity for an existing FC.
+     *
+     * @param fc the updated FC representation
+     * @return the possibly modified FC that was installed or null if updated FC could not be installed
+     */
+    CarrierEthernetForwardingConstruct updateFc(CarrierEthernetForwardingConstruct fc);
+
+    /**
+     * Removes all resources associated with a specific FC.
+     *
+     * @param fcId the FC id
+     * @return the FC that was removed or null if removal failed
+     */
+    CarrierEthernetForwardingConstruct removeFc(EvcConnId fcId);
+
+    /**
+     * Removes all resources associated with the application.
+     *
+     * This will be called either from the deactivate method or as a response to a CLI command.
+     */
+    void removeAllFcs();
+
+    /**
+     * Get the map containing all global UNIs.
+     *
+     * @return the global UNI map
+     */
+    Map<String, CarrierEthernetUni> getUniMap();
+
+    /**
+     * Adds a potential UNI to the global UNI map if they are not already there.
+     *
+     * @param uni the potential UNI to add to global UNI map
+     * @return the UNI that was added or null if UNI existed already
+     */
+    CarrierEthernetUni addGlobalUni(CarrierEthernetUni uni);
+
+    /**
+     * Remove an UNI from the set of global UNIs.
+     *
+     * @param uniId the id of the UNI to be removed
+     * @return the UNI that was removed or null in case of failure (didn't exist of refCount was not 0)
+     */
+    CarrierEthernetUni removeGlobalUni(String uniId);
+
+    // TODO: Add removeAllGlobalUnis method (or command only?)
+
+    /**
+     * Creates a new UNI associated with the provided connect point.
+     *
+     * Conditions for validating an UNI:
+     * - ConnectPoint deviceId and Port are valid
+     * - Port is enabled
+     *
+     * @param cp the connect point to be associated with the generated UNI
+     * @return a new validated UNI or null if the validation failed
+     */
+    CarrierEthernetUni generateUni(ConnectPoint cp);
+
+    /**
+     * Returns all potential UNIs from the topology.
+     *
+     * @param excludeAdded indicates that UNIs already added in the UNI map should not be in the returned set
+     * @param includeRemoved indicates that UNIs explicitly removed from the UNI map should be in the returned set
+     * @return set of all potential UNIs in the topology
+     */
+    Set<CarrierEthernetUni> getUnisFromTopo(boolean excludeAdded, boolean includeRemoved);
+
+    /**
+     * Get the map containing all global LTPs.
+     *
+     * @return the global LTP map
+     */
+    Map<String, CarrierEthernetLogicalTerminationPoint> ltpMap();
+
+    /**
+     * Adds a potential LTP and its UNI or pair INNI to the global LTP/UNI maps if they are not already there.
+     *
+     * @param ltp the potential LTP to add to global LTP map
+     * @return the LTP that was added or null if it already existed
+     */
+    CarrierEthernetLogicalTerminationPoint addGlobalLtp(CarrierEthernetLogicalTerminationPoint ltp);
+
+    /**
+     * Remove an LTP from the set of global LTPs, as well as the corresponding INNI LTP at the other end of the link.
+     *
+     * @param ltpId the id of the LTP to be removed
+     * @return the LTP that was removed or null in case of failure (didn't exist of refCount was not 0)
+     */
+    CarrierEthernetLogicalTerminationPoint removeGlobalLtp(String ltpId);
+
+    // TODO: Add removeAllGlobalLtps method (or command only?)
+
+    /**
+     * Creates a new LTP of the provided type and associated with the provided connect point.
+     *
+     * Conditions for validating an LTP:
+     * - ConnectPoint deviceId and Port are valid
+     * - Port is enabled
+     *
+     * @param cp the connect point to be associated with the generated LTP
+     * @param ltpType the type of the LTP to be generated (UNI/INNI/ENNI)
+     * @return a new validated LTP or null if the validation failed
+     */
+    CarrierEthernetLogicalTerminationPoint generateLtp(ConnectPoint cp, Type ltpType);
+
+    /**
+     * Returns all potential LTPs from the topology.
+     *
+     * @param excludeAdded indicates that LTPs already added in the LTP map should not be in the returned set
+     * @param includeRemoved indicates that LTPs explicitly removed from the LTP map should be in the returned set
+     * @return set of all potential LTPs in the topology
+     */
+    Set<CarrierEthernetLogicalTerminationPoint> getLtpsFromTopo(boolean excludeAdded, boolean includeRemoved);
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/ConnectionService.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/ConnectionService.java
new file mode 100644
index 0000000..89df1b4
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/ConnectionService.java
@@ -0,0 +1,56 @@
+/*
+ * 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.opencord.ce.api.services.channel;
+
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.domain.DomainId;
+
+import javax.ws.rs.client.Client;
+
+/**
+ * Service to control local and remote domain endpoints.
+ */
+public interface ConnectionService {
+
+    /**
+     * Gets the ip of the local (ONOS cluster) instance in charge of handling the communication
+     * with the specified domain.
+     *
+     * @param domainId domain identifier
+     * @return ip address of the local instance
+     */
+    IpAddress getLocalMasterIp(String domainId);
+
+    /**
+     * Gets the ip of the remote (ONOS cluster) instance in charge of
+     * handling the communication with the local cluster.
+     *
+     * @param domainId domain identifier of the remote cluster
+     * @return the ip address of the remote instance
+     */
+    IpAddress getRemoteMasterIp(String domainId);
+
+    /**
+     * Gets the connection info for the specified domain.
+     *
+     * @param domainId target domain ID
+     * @return pair of http client object and destination IP address
+     */
+    Pair<Client, IpAddress> getConnectionInfo(DomainId domainId);
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/ControlChannelListenerService.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/ControlChannelListenerService.java
new file mode 100644
index 0000000..5171ea2
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/ControlChannelListenerService.java
@@ -0,0 +1,33 @@
+/*
+ * 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.opencord.ce.api.services.channel;
+
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+
+import java.util.Set;
+
+/**
+ * Service used by the southbound components of the global ONOS to listen for EVCs setup.
+ */
+public interface ControlChannelListenerService {
+
+    void addListener(MetroNetworkVirtualNodeService listener);
+
+    void removeListener(MetroNetworkVirtualNodeService listener);
+
+    Set<MetroNetworkVirtualNodeService> listeners();
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/EndPoint.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/EndPoint.java
new file mode 100644
index 0000000..7e8305f
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/EndPoint.java
@@ -0,0 +1,68 @@
+/*
+ * 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.opencord.ce.api.services.channel;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.net.domain.DomainId;
+
+import java.util.Set;
+
+/**
+ * ONOS cluster endpoint for the communication between local and global.
+ */
+public class EndPoint {
+    private DomainId domainId;
+    private Set<IpAddress> ipAddresses;
+    private int port;
+    private String username;
+    private String password;
+    private String topic;
+
+    public EndPoint(DomainId domainId, Set<IpAddress> ipAddresses, int port,
+                    String username, String password, String topic) {
+        this.domainId = domainId;
+        this.ipAddresses = ipAddresses;
+        this.port = port;
+        this.username = username;
+        this.password = password;
+        this.topic = topic;
+    }
+
+    public DomainId domainId() {
+        return domainId;
+    }
+
+    public Set<IpAddress> ipAddresses() {
+        return ipAddresses;
+    }
+
+    public int port() {
+        return port;
+    }
+
+    public String username() {
+        return username;
+    }
+
+    public String password() {
+        return password;
+    }
+
+    public String topic() {
+        return topic;
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/RequestCallback.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/RequestCallback.java
new file mode 100644
index 0000000..23e022c
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/RequestCallback.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.opencord.ce.api.services.channel;
+
+import javax.ws.rs.core.Response;
+
+/**
+ * HTTP request callback.
+ */
+public interface RequestCallback {
+
+    // called upon a successful network task
+    default void onSuccess(Response response){}
+
+    // called upon a failured network task
+    default void onError(Response response){}
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/Symbols.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/Symbols.java
new file mode 100644
index 0000000..47ba220
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/Symbols.java
@@ -0,0 +1,83 @@
+/*
+ * 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.opencord.ce.api.services.channel;
+
+
+/**
+ * HTTP resource paths.
+ */
+public final class Symbols {
+
+    private Symbols() {
+    }
+
+    public static final String POST = "post";
+    public static final String GET = "get";
+    public static final String DELETE = "delete";
+    public static final String HTTP = "http";
+    public static final String DOUBLESLASH = "//";
+    public static final String L_BRACKET = "{";
+    public static final String R_BRACKET = "}";
+    public static final String QUOTES = "\"";
+    public static final String COLON = ":";
+    public static final String OK = "ok";
+    public static final String MASTER_IP = "masterIp";
+    public static final String RESULT = "result";
+    public static final String NO_ENDPOINT_AVAILABLE = "unavailable";
+
+    public static final String MASTER_API_NO_IP_BODY = L_BRACKET
+            + QUOTES + RESULT + QUOTES + COLON + QUOTES + NO_ENDPOINT_AVAILABLE + QUOTES
+            + R_BRACKET;
+
+    public static final String BASE_URL = "/ecord";
+
+    public static final String MASTER = "/master";
+
+    public static final String FC = "fc";
+    public static final String SRC_NI = "srcNi";
+    public static final String DST_NI_LIST = "dstNiList";
+    public static final String UNI = "uni";
+
+    public static final String FC_ID = "fcId";
+    // ======== Forwarding Construct data ====== //
+    public static final String FC_TAG = "fcTag";
+    public static final String FC_INGRESS_CP = "fcIngressCp";
+    public static final String FC_TYPE = "fcType";
+    public static final String INGRESS_NI_TYPE = "ingressNiType";
+    public static final String INGRESS_FC_TAG = "ingressFcTag";
+    public static final String CUSTOMER_TAG = "customerTag";
+    public static final String FC_EGRESS_LST = "fcEgressList";
+    public static final String FC_EGRESS_CP = "fcEgressCp";
+    public static final String FC_EGRESS_TYPE = "fcEgressType";
+
+    // ======== Bandwidth profile data ====== //
+    public static final String BW_PROFILE = "bwProfile";
+    public static final String CIR = "cir";
+    public static final String EIR = "eir";
+    public static final String CBS = "cbs";
+    public static final String EBS = "ebs";
+    public static final String UNI_CP = "uniCp";
+
+
+    // ===== Device and Port annotations ==== //
+    public static final String DEVICE_ID = "deviceId";
+    public static final String DOMAIN_ID = "domainId";
+    public static final String MEF_PORT_TYPE = "mefPortType";
+
+
+}
+
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/channel/package-info.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/package-info.java
new file mode 100644
index 0000000..5c94f16
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Communication channel between global orchestrator and local sites.
+ */
+package org.opencord.ce.api.services.channel;
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/package-info.java b/ce-api/src/main/java/org/opencord/ce/api/services/package-info.java
new file mode 100644
index 0000000..d9c83eb
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Service APIs for Carrier Ethernet.
+ */
+package org.opencord.ce.api.services;
\ No newline at end of file
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DefaultDomainVirtualDevice.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DefaultDomainVirtualDevice.java
new file mode 100644
index 0000000..fc0682f
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DefaultDomainVirtualDevice.java
@@ -0,0 +1,75 @@
+/*
+ * 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.opencord.ce.api.services.virtualprovider;
+
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.domain.DomainId;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Default implementation of a domain device.
+ */
+public class DefaultDomainVirtualDevice implements DomainVirtualDevice {
+    private final DeviceId deviceId;
+    private final DomainId domainId;
+
+    public DefaultDomainVirtualDevice(DeviceId deviceId, DomainId domainId) {
+        this.deviceId = deviceId;
+        this.domainId = domainId;
+    }
+
+    @Override
+    public DeviceId deviceId() {
+        return deviceId;
+    }
+
+    @Override
+    public DomainId domainId() {
+        return domainId;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), deviceId, domainId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DefaultDomainVirtualDevice) {
+            final DefaultDomainVirtualDevice other = (DefaultDomainVirtualDevice) obj;
+            return  Objects.equals(this.deviceId, other.deviceId()) &&
+                    Objects.equals(this.domainId, other.domainId());
+
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("deviceId", deviceId.toString())
+                .add("domainId", domainId)
+                .toString();
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainElement.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainElement.java
new file mode 100644
index 0000000..8ea348b
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainElement.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.opencord.ce.api.services.virtualprovider;
+
+import org.onosproject.net.domain.DomainId;
+
+/**
+ * Interface implemented by the domain topology elements.
+ */
+public interface DomainElement {
+
+    /**
+     * Returns the domain id the element belongs to.
+     * @return domain id
+     */
+    DomainId domainId();
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainVirtualDevice.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainVirtualDevice.java
new file mode 100644
index 0000000..d4084f3
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/DomainVirtualDevice.java
@@ -0,0 +1,34 @@
+/*
+ * 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.opencord.ce.api.services.virtualprovider;
+
+import org.onosproject.net.DeviceId;
+
+/**
+ *  Domain virtual device.
+ *  Represents an aggregated set of ports associated to an underlying domain.
+ *
+ */
+public interface DomainVirtualDevice extends DomainElement {
+
+    /**
+     * Returns the device ID.
+     * @return device identifier
+     */
+    DeviceId deviceId();
+
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/EcordDeviceProviderService.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/EcordDeviceProviderService.java
new file mode 100644
index 0000000..0d40fb9
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/EcordDeviceProviderService.java
@@ -0,0 +1,82 @@
+/*
+ * 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.opencord.ce.api.services.virtualprovider;
+
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+
+import java.util.List;
+
+/**
+ * Service used by the southbound communication channel to notify virtual device presence.
+ */
+public interface EcordDeviceProviderService {
+
+    /**
+     * Signals the domain provider to connect a device of another domain.
+     *
+     * @param domainVirtualDevice device object
+     */
+    void connectRemoteDevice(DomainVirtualDevice domainVirtualDevice);
+
+    /**
+     * Adds or updates ports on a remote domain.
+     *
+     * @param domainId domain ID
+     * @param deviceId device ID
+     * @param ports list of port descriptions
+     */
+    void addOrUpdateRemotePorts(DomainId domainId, DeviceId deviceId, List<PortDescription> ports);
+
+    /**
+     * Signals the domain provider that a specific domain has added a new port to a device.
+     *
+     * @param domainId domain identifier
+     * @param deviceId device identifier
+     * @param port port
+     */
+    void addRemotePort(DomainId domainId, DeviceId deviceId, Port port);
+
+    /**
+     * Signals a remote port update.
+     *
+     * @param domainId domain identifier
+     * @param deviceId device identifier
+     * @param port port description
+     */
+    void updateRemotePortState(DomainId domainId, DeviceId deviceId, Port port);
+
+    /**
+     * Signals the disconnection of a remote domain device.
+     *
+     * @param domainId domain identifier
+     * @param deviceId device identifier
+     */
+    void disconnectRemoteDevice(DomainId domainId, DeviceId deviceId);
+
+    /**
+     * Signals the deletion of a remote domain device port.
+     * @param domainId domain identifier
+     * @param deviceId device identifier
+     * @param portNumber port identifier
+     */
+    void removeRemotePort(DomainId domainId, DeviceId deviceId, PortNumber portNumber);
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/LinkId.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/LinkId.java
new file mode 100644
index 0000000..608c7fc
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/LinkId.java
@@ -0,0 +1,34 @@
+/*
+ * 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.opencord.ce.api.services.virtualprovider;
+
+import org.onlab.util.Identifier;
+
+/**
+ * Domain link identifier class.
+ */
+public class LinkId extends Identifier<String> {
+
+    public LinkId(String identifier) {
+        super(identifier);
+    }
+
+    public static LinkId linkId(String id) {
+
+        return new LinkId(id);
+    }
+}
diff --git a/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/package-info.java b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/package-info.java
new file mode 100644
index 0000000..f70473e
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/virtualprovider/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * APIs for virtual device providers.
+ */
+package org.opencord.ce.api.services.virtualprovider;
\ No newline at end of file
diff --git a/global/app/app.xml b/global/app/app.xml
new file mode 100644
index 0000000..9169c46
--- /dev/null
+++ b/global/app/app.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+<app name="org.opencord.ce.global.app" origin="ON.Lab" version="${project.version}"
+     category="Utility" url="http://opencord.org" title="Enterprise CORD"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/orchestration/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/global-channel/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/virtualprovider/${project.version}</artifact>
+    <!--   <artifact>mvn:${project.groupId}/onos-app-icona-driver/${project.version}</artifact> -->
+</app>
diff --git a/global/app/features.xml b/global/app/features.xml
new file mode 100644
index 0000000..ab94ece
--- /dev/null
+++ b/global/app/features.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+  ~ 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <bundle>mvn:${project.groupId}/orchestration/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/global-channel/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/virtualprovider/${project.version}</bundle>
+        <!--  <bundle>mvn:${project.groupId}/onos-app-icona-driver/${project.version}</bundle> -->
+    </feature>
+</features>
\ No newline at end of file
diff --git a/global/app/pom.xml b/global/app/pom.xml
new file mode 100644
index 0000000..1684fea
--- /dev/null
+++ b/global/app/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>global</artifactId>
+        <version>1.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>ecord-global-app</artifactId>
+    <packaging>pom</packaging>
+
+    <description>java application bundling orchestration,
+        http communication and topology provider component
+    </description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.global</onos.app.name>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>orchestration</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>global-channel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>virtualprovider</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/global/ce-orchestration/pom.xml b/global/ce-orchestration/pom.xml
new file mode 100644
index 0000000..ac7f64f
--- /dev/null
+++ b/global/ce-orchestration/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>global</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>orchestration</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Orchestration logic of Carrier Ethernet Forwarding Constructs</description>
+
+    <properties>
+        <web.context>/carrierethernet</web.context>
+        <onos.app.name>org.opencord.ce.global.orchestration</onos.app.name>
+        <onos.version>1.10.3</onos.version>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-rest</artifactId>
+            <version>${onos.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-cli</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>3.0.5</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp/</_wab>
+                        <Bundle-SymbolicName>
+                            ${project.groupId}.${project.artifactId}
+                        </Bundle-SymbolicName>
+                        <Import-Package>
+                            *,org.glassfish.jersey.servlet
+                        </Import-Package>
+                        <Web-ContextPath>${web.context}</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroNetworkProvisioner.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroNetworkProvisioner.java
new file mode 100644
index 0000000..62c3fce
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroNetworkProvisioner.java
@@ -0,0 +1,317 @@
+/*
+ * 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.opencord.ce.global.orchestration;
+
+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.apache.felix.scr.annotations.Service;
+import org.opencord.ce.api.services.channel.ControlChannelListenerService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.net.topology.PathService;
+import org.onosproject.net.topology.TopologyService;
+import org.opencord.ce.api.models.CarrierEthernetConnection;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetGenericNi;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetSpanningTreeWeight;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.services.MetroNetworkProvisionerService;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint.Role;
+import static org.opencord.ce.api.models.CarrierEthernetVirtualConnection.Type;
+
+/**
+ * Carrier Ethernet provisioner of connectivity for forwarding constructs and bandwidth profiles.
+ */
+@Component(immediate = true)
+@Service
+public class MetroNetworkProvisioner implements MetroNetworkProvisionerService {
+
+    private final Logger log = getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PathService pathService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected TopologyService topologyService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ControlChannelListenerService channelListenerService;
+
+    @Activate
+    protected void activate() {
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public void setupConnectivity(CarrierEthernetForwardingConstruct fc) {
+        boolean allPairsConnected = true;
+
+        HashMap<CarrierEthernetNetworkInterface, HashSet<CarrierEthernetNetworkInterface>> ingressEgressNiMap =
+                new HashMap<>();
+
+        // Temporary set for iterating through LTP pairs
+        Set<CarrierEthernetLogicalTerminationPoint> tempLtpSet = new HashSet<>(fc.ltpSet());
+
+        // Temporary set for indicating which LTPs were finally included
+        Set<CarrierEthernetLogicalTerminationPoint> usedLtpSet = new HashSet<>();
+
+        Iterator<CarrierEthernetLogicalTerminationPoint> ltpIt1 = tempLtpSet.iterator();
+        while (ltpIt1.hasNext()) {
+
+            CarrierEthernetLogicalTerminationPoint ltp1 = ltpIt1.next();
+
+            // Iterate through all the remaining NIs
+            Iterator<CarrierEthernetLogicalTerminationPoint> ltpIt2 = tempLtpSet.iterator();
+            while (ltpIt2.hasNext()) {
+
+                CarrierEthernetLogicalTerminationPoint ltp2 = ltpIt2.next();
+
+                // Skip equals
+                if (ltp1.equals(ltp2)) {
+                    continue;
+                }
+
+                // Do not establish connectivity between leaf NIs (applies to Rooted_Multipoint)
+                // FIXME: Use proper LTP roles
+                if (ltp1.role().equals(Role.LEAF)
+                        && ltp2.role().equals(Role.LEAF)) {
+                    continue;
+                }
+
+                // Update the ingress-egress NI map based on the calculated paths
+                if (!updateIngressEgressNiMap(ltp1.ni(), ltp2.ni(), ingressEgressNiMap,
+                        fc.congruentPaths(), fc.type())) {
+                    allPairsConnected = false;
+                    continue;
+                }
+
+                // Indicate that connection for at least one NI pair has been established
+                fc.setState(CarrierEthernetForwardingConstruct.State.ACTIVE);
+
+                // Add NIs to the set of NIs used by the EVC
+                usedLtpSet.add(ltp1);
+                usedLtpSet.add(ltp2);
+            }
+            // Remove NI from temporary set so that each pair is visited only once
+            ltpIt1.remove();
+        }
+
+        // Establish connectivity using the ingressEgressNiMap
+        ingressEgressNiMap.keySet().forEach(srcNi -> {
+            // only the listener that communicates with the domain associated to this fc will
+            // accomplish the request
+            channelListenerService.listeners().forEach(
+                    listener -> listener.setNodeForwarding(fc, srcNi, ingressEgressNiMap.get(srcNi))
+            );
+        });
+
+        // Update the NI set, based on the NIs actually used
+        fc.setLtpSet(usedLtpSet);
+
+        if (fc.isActive()) {
+            if (!allPairsConnected) {
+                fc.setState(CarrierEthernetConnection.State.PARTIAL);
+            }
+        }
+    }
+
+    /**
+     * Select feasible link paths between two NIs in both directions and update
+     * ingressEgressNiMap accordingly.
+     *
+     * @param ni1 the first NI
+     * @param ni2 the second NI
+     * @param ingressEgressNiMap the method will add here any ingress-egress NI associations
+     * @param congruentPaths if true indicates that n1->n2 will follow the same path as n2->n1
+     * @return true if the path was updated and false if a path could not be found in any of the directions
+     */
+    private boolean updateIngressEgressNiMap(CarrierEthernetNetworkInterface ni1, CarrierEthernetNetworkInterface ni2,
+                                             HashMap<CarrierEthernetNetworkInterface,
+                                                     HashSet<CarrierEthernetNetworkInterface>> ingressEgressNiMap,
+                                             boolean congruentPaths, CarrierEthernetVirtualConnection.Type evcType) {
+
+        // Find the paths for both directions at the same time, so that we can skip the pair if needed
+        List<Link> forwardLinks = generateLinkList(ni1.cp(), ni2.cp(), evcType);
+        List<Link> backwardLinks =
+                congruentPaths ? generateInverseLinkList(forwardLinks) : generateLinkList(ni2.cp(), ni1.cp(), evcType);
+
+        // Skip this UNI pair if no feasible path could be found
+        if (forwardLinks == null || (backwardLinks == null)) {
+            log.warn("There are no feasible paths between {} and {}.",
+                    ni1.cp().deviceId(), ni2.cp().deviceId());
+            return false;
+        }
+
+        // Populate the ingress/egress NI map for the forward and backward paths
+        populateIngressEgressNiMap(ni1, ni2, forwardLinks, ingressEgressNiMap);
+        populateIngressEgressNiMap(ni2, ni1, backwardLinks, ingressEgressNiMap);
+
+        return true;
+    }
+
+    private void populateIngressEgressNiMap(CarrierEthernetNetworkInterface srcNi,
+                                            CarrierEthernetNetworkInterface dstNi,
+                                            List<Link> linkList,
+                                            HashMap<CarrierEthernetNetworkInterface,
+                                                    HashSet<CarrierEthernetNetworkInterface>> ingressEgressNiMap
+    ) {
+        // FIXME: Fix the method - avoid generating GENERIC NIs if not needed
+        // Add the src and destination NIs as well as the associated Generic NIs
+        ingressEgressNiMap.putIfAbsent(srcNi, new HashSet<>());
+        // Add last hop entry only if srcNi, dstNi aren't on same device (in which case srcNi, ingressNi would coincide)
+        if (!srcNi.cp().deviceId().equals(dstNi.cp().deviceId())) {
+            // If srcNi, dstNi are not on the same device, create mappings to/from new GENERIC NIs
+            ingressEgressNiMap.get(srcNi).add(new CarrierEthernetGenericNi(linkList.get(1).src(), null));
+            CarrierEthernetGenericNi ingressNi =
+                    new CarrierEthernetGenericNi(linkList.get(linkList.size() - 2).dst(), null);
+            ingressEgressNiMap.putIfAbsent(ingressNi, new HashSet<>());
+            ingressEgressNiMap.get(ingressNi).add(dstNi);
+        } else {
+            // If srcNi, dstNi are on the same device, this is the only mapping that will be created
+            ingressEgressNiMap.get(srcNi).add(dstNi);
+        }
+
+        // Go through the links and
+        //
+        // create/add the intermediate NIs
+        for (int i = 1; i < linkList.size() - 2; i++) {
+            CarrierEthernetGenericNi ingressNi = new CarrierEthernetGenericNi(linkList.get(i).dst(), null);
+            ingressEgressNiMap.putIfAbsent(ingressNi, new HashSet<>());
+            ingressEgressNiMap.get(ingressNi).add(new CarrierEthernetGenericNi(linkList.get(i + 1).src(), null));
+        }
+    }
+
+    private List<Link> generateLinkList(ConnectPoint cp1, ConnectPoint cp2,
+                                        Type evcType) {
+        Set<Path> paths;
+        Path path = null;
+
+        if (!cp1.deviceId().equals(cp2.deviceId())) {
+            // If cp1 and cp2 are not on the same device a path must be found
+            if (evcType.equals(Type.POINT_TO_POINT)) {
+                // For point-to-point connectivity use pre-calculated paths to make sure the shortest paths are chosen
+                paths = pathService.getPaths(cp1.deviceId(), cp2.deviceId());
+            } else {
+                // Recalculate path so that it's over the pre-calculated spanning tree
+                // FIXME: Find a more efficient way (avoid recalculating paths)
+                paths = pathService.getPaths(cp1.deviceId(), cp2.deviceId(),
+                        new CarrierEthernetSpanningTreeWeight(topologyService));
+            }
+
+            // Just select any of the returned paths
+            // TODO: Select path in more sophisticated way and return null if any of the constraints cannot be met
+            path = paths.iterator().hasNext() ? paths.iterator().next() : null;
+
+            if (path == null) {
+                return null;
+            }
+        }
+
+        List<Link> links = new ArrayList<>();
+        links.add(createEdgeLink(cp1, true));
+        if (!cp1.deviceId().equals(cp2.deviceId())) {
+            links.addAll(path.links());
+        }
+        links.add(createEdgeLink(cp2, false));
+
+        return links;
+    }
+
+    private List<Link> generateInverseLinkList(List<Link> originalLinks) {
+
+        if (originalLinks == null) {
+            return null;
+        }
+
+        List<Link> inverseLinks = new ArrayList<>();
+
+        inverseLinks.add(createEdgeLink(originalLinks.get(originalLinks.size() - 1).src(), true));
+
+        for (int i = originalLinks.size() - 2; i > 0; i--) {
+            // FIXME: Check again the Link creation parameters
+            inverseLinks.add(DefaultLink.builder()
+                    .src(originalLinks.get(i).dst())
+                    .dst(originalLinks.get(i).src())
+                    .type(Link.Type.DIRECT)
+                    .providerId(new ProviderId("none", "none"))
+                    .build());
+        }
+        inverseLinks.add(createEdgeLink(originalLinks.get(0).dst(), false));
+
+        return inverseLinks;
+    }
+
+    @Override
+    public void removeConnectivity(CarrierEthernetForwardingConstruct fc) {
+        channelListenerService.listeners()
+                .forEach(listener -> listener.removeAllForwardingResources(fc.id()));
+    }
+
+    @Override
+    public void createBandwidthProfiles(CarrierEthernetForwardingConstruct fc) {
+        fc.uniSet().forEach(uni -> channelListenerService.listeners()
+                .forEach(listener -> listener.createBandwidthProfileResources(fc, uni)));
+    }
+
+    @Override
+    public void applyBandwidthProfiles(CarrierEthernetForwardingConstruct fc) {
+        //  TODO: Select node manager depending on device protocol
+        fc.uniSet().forEach(uni -> channelListenerService.listeners()
+                .forEach(listener -> listener.applyBandwidthProfileResources(fc, uni)));
+    }
+
+    @Override
+    public void removeBandwidthProfiles(CarrierEthernetForwardingConstruct fc) {
+        //  TODO: Select node manager depending on device protocol
+        fc.ltpSet().forEach((ltp -> {
+            if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+                channelListenerService.listeners()
+                        .forEach(listener ->
+                                listener.removeBandwidthProfileResources(fc, (CarrierEthernetUni) ltp.ni()));
+            }
+        }));
+    }
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
new file mode 100644
index 0000000..d9aa564
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
@@ -0,0 +1,1343 @@
+/*
+ * 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.opencord.ce.global.orchestration;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Sets;
+import org.apache.commons.lang3.tuple.Pair;
+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.apache.felix.scr.annotations.Service;
+import org.onlab.packet.VlanId;
+import org.onosproject.codec.CodecService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.net.Port;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.net.topology.PathService;
+import org.onosproject.net.topology.TopologyService;
+import org.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+import org.opencord.ce.api.models.CarrierEthernetEnni;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetInni;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetSpanningTreeWeight;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.models.PortVlanConfig;
+import org.opencord.ce.api.models.codecs.CarrierEthernetBwProfileCodec;
+import org.opencord.ce.api.models.codecs.CarrierEthernetNetworkInterfaceCodec;
+import org.opencord.ce.api.models.codecs.ForwardingConstructCodec;
+import org.opencord.ce.api.models.codecs.LogicalTerminationEndPointCodec;
+import org.opencord.ce.api.services.MetroNetworkProvisionerService;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
+import static org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint.Role;
+import static org.opencord.ce.api.models.CarrierEthernetVirtualConnection.Type;
+import static org.onosproject.net.config.basics.SubjectFactories.CONNECT_POINT_SUBJECT_FACTORY;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Global orchestration component.
+ */
+@Component(immediate = true)
+@Service
+public class MetroOrchestrationManager implements MetroOrchestrationService {
+    private final Logger log = getLogger(getClass());
+    private static final String APP_NAME = "org.opencord.ce.global.orchestration";
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PathService pathService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected TopologyService topologyService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService networkConfigService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry cfgRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CodecService codecService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MetroNetworkProvisionerService  networkProvisionerService;
+
+
+    // Keeps track of the next S-VLAN tag the app will try to use
+    private static short nextVlanId = 1;
+
+    // Keeps track of the next EVC id the app will try to use
+    // TODO: Use Identifier class instead
+    private static short nextEvcShortId = 1;
+
+    private boolean evcFragmentationEnabled = false;
+    private boolean prevEvcFragmentationStatus = evcFragmentationEnabled;
+
+    // TODO: Implement distributed store for EVCs
+    // The installed EVCs
+    private final Map<EvcConnId, CarrierEthernetVirtualConnection> evcMap = new ConcurrentHashMap<>();
+
+    // TODO: Implement distributed store for Forwarding Constructs
+    // The installed Forwarding Constructs
+    private final Map<EvcConnId, CarrierEthernetForwardingConstruct> fcMap = new ConcurrentHashMap<>();
+
+    // TODO: Implement distributed store for CE UNIs
+    // The installed CE UNIs
+    private final Map<String, CarrierEthernetUni> uniMap = new ConcurrentHashMap<>();
+    private final Set<String> removedUniSet = Sets.newConcurrentHashSet();
+
+    // TODO: Implement distributed store for CE LTPs
+    // The installed CE LTPs
+    private final Map<String, CarrierEthernetLogicalTerminationPoint> ltpMap = new ConcurrentHashMap<>();
+
+    // The LTP ids that have been explicitly removed (or requested to be removed) from the global LTP map
+    private final Set<String> removedLtpSet = Sets.newConcurrentHashSet();
+
+    private final List<ConfigFactory<?, ?>> factories = ImmutableList.of(
+            new ConfigFactory<ConnectPoint, PortVlanConfig>(CONNECT_POINT_SUBJECT_FACTORY,
+                    PortVlanConfig.class, PortVlanConfig.CONFIG_KEY) {
+                @Override
+                public PortVlanConfig createConfig() {
+                    return new PortVlanConfig();
+                }
+            });
+
+    // Map of connect points and corresponding VLAN tag
+    private final Map<ConnectPoint, VlanId> portVlanMap = new ConcurrentHashMap<>();
+
+    private NetworkConfigListener netcfgListener = new InternalNetworkConfigListener();
+
+    /**
+     * Activate this component.
+     */
+    @Activate
+    public void activate() {
+        codecService.registerCodec(CarrierEthernetNetworkInterface.class,
+                new CarrierEthernetNetworkInterfaceCodec());
+        codecService.registerCodec(CarrierEthernetBandwidthProfile.class,
+                new CarrierEthernetBwProfileCodec());
+        codecService.registerCodec(CarrierEthernetLogicalTerminationPoint.class,
+                new LogicalTerminationEndPointCodec());
+        codecService.registerCodec(CarrierEthernetForwardingConstruct.class,
+                new ForwardingConstructCodec());
+        appId = coreService.registerApplication(APP_NAME);
+        networkConfigService.addListener(netcfgListener);
+        factories.forEach(cfgRegistry::registerConfigFactory);
+    }
+
+    /**
+     * Deactivate this component.
+     */
+    @Deactivate
+    public void deactivate() {
+        networkConfigService.removeListener(netcfgListener);
+        factories.forEach(cfgRegistry::unregisterConfigFactory);
+        removeAllEvcs();
+        removeAllFcs();
+        codecService.unregisterCodec(CarrierEthernetNetworkInterface.class);
+        codecService.unregisterCodec(CarrierEthernetBandwidthProfile.class);
+        codecService.unregisterCodec(CarrierEthernetLogicalTerminationPoint.class);
+        codecService.unregisterCodec(CarrierEthernetForwardingConstruct.class);
+    }
+
+    @Override
+    public Map<EvcConnId, CarrierEthernetVirtualConnection> evcMap() {
+        return this.evcMap;
+    }
+
+    @Override
+    public CarrierEthernetVirtualConnection getEvc(EvcConnId evcId) {
+        return evcMap.get(evcId);
+    }
+
+    @Override
+    public CarrierEthernetForwardingConstruct getFc(EvcConnId fcId) {
+        return fcMap.get(fcId);
+    }
+
+    @Override
+    public Map<EvcConnId, CarrierEthernetForwardingConstruct> fcMap() {
+        return fcMap;
+    }
+
+    @Override
+    public Map<String, CarrierEthernetLogicalTerminationPoint> ltpMap() {
+        return ltpMap;
+    }
+
+    @Override
+    public Map<String, CarrierEthernetUni> getUniMap() {
+        return uniMap;
+    }
+
+    /**
+     * Verify the validity of an EVC representation taking also into account current network status.
+     *
+     * @param originalEvc the provided EVC representation
+     * @return a valid, potentially modified EVC representation, or null if the EVC could not be validated
+     */
+    private CarrierEthernetVirtualConnection validateEvc(CarrierEthernetVirtualConnection originalEvc) {
+
+        // Make a copy of the provided EVC, since it may be modified
+        CarrierEthernetVirtualConnection evc = originalEvc;
+
+        // Try to set a unique numerical id for the EVC unless the EVC is being updated
+        // FIXME: Check again the EVC update case
+        evc.setShortId(generateEvcShortId());
+        if (evc.shortId()  == null) {
+            log.error("No available EVC id found.");
+            return null;
+        }
+
+        // Generate and set unique FC id
+        evc.setId(EvcConnId.of(generateEvcId(evc)));
+
+        // Verify that CE-VLAN ID is provided to either all UNIs or none
+        // and set the virtualEvc flag accordingly
+        // Note: Checking also that all NIs are UNIs
+        boolean isVirtual = false;
+        Iterator<CarrierEthernetUni> it = evc.uniSet().iterator();
+        while (it.hasNext()) {
+            CarrierEthernetUni ni = it.next();
+            if (ni.ceVlanId() == VlanId.NONE && isVirtual) {
+                log.error("Could not validate the virtual status of the EVC.");
+                return null;
+            } else if (ni.ceVlanId() != VlanId.NONE) {
+                isVirtual = true;
+            }
+        }
+        evc.setIsVirtual(isVirtual);
+
+        // Set unique id for the EVC unless the EVC is being updated
+        if (evc.id() == null) {
+            evc.setId(EvcConnId.of(generateEvcId(evc)));
+        }
+
+        Set<CarrierEthernetUni> validatedUniSet = new HashSet<>();
+
+        // TODO: Refactor according to the validateFc method
+        // Note: Cannot use the validateFc method here,
+        // because FCs can also be standalone
+
+        // Check the UNIs of the EVC, possibly removing UNIs that are
+        // incompatible with existing global ones
+        it = evc.uniSet().iterator();
+        while (it.hasNext()) {
+            CarrierEthernetUni uni = it.next();
+            // Change the name of the UNI's BWP to the EVC name if it is an EVC BWP
+            if (uni.bwp().type().equals(CarrierEthernetBandwidthProfile.Type.EVC)) {
+                uni.bwp().setId(evc.id().id());
+            }
+            // Check first if corresponding global UNI already exists
+            // by checking against the global UNI Map
+            if (uniMap.keySet().contains(uni.id())) {
+                CarrierEthernetUni existingUni = uniMap.get(uni.id());
+                // Check if the EVC-specific UNI is compatible with the global one
+                if (!(existingUni.validateEcNi(uni))) {
+                    // If EVC is of ROOT_MULTIPOINT type and we have removed the root, return null
+                    if (evc.type() == Type.ROOT_MULTIPOINT &&
+                            uni.role() == CarrierEthernetUni.Role.ROOT) {
+                        log.error("Root UNI could not be added to %s EVC.", evc.type().name());
+                        return null;
+                    }
+                    log.warn("UNI {} could not be added to EVC.", uni.id());
+                } else {
+                    // Add UNI to EVC
+                    validatedUniSet.add(uni);
+                }
+            } else {
+                // Add UNI to EVC
+                validatedUniSet.add(uni);
+            }
+        }
+
+        // Update the EVC UNI set, based on the validated UNIs
+        evc.setUniSet(validatedUniSet);
+
+        // TODO: Check that an ROOT_MULTIPOINT EVC has at most one ROOT
+
+        if (evc.uniSet().size() > evc.maxNumUni()) {
+            log.error("{} EVC can have at most {} UNIs.", evc.maxNumUni());
+            return null;
+        }
+
+        if ((evc.type().equals(Type.ROOT_MULTIPOINT)
+                || evc.type().equals(Type.MULTIPOINT_TO_MULTIPOINT))
+                && (evc.uniSet().size() < 2)) {
+            log.error("{} EVC requires at least two UNIs.", evc.type().name());
+            return null;
+        }
+
+        if (evc.type().equals(Type.POINT_TO_POINT) && (evc.uniSet().size() != 2)) {
+            log.error("{} EVC requires exactly two UNIs.", evc.type().name());
+            return null;
+        }
+
+        return evc;
+    }
+
+    @Override
+    public CarrierEthernetVirtualConnection installEvc(CarrierEthernetVirtualConnection evc) {
+
+        // If EVC already exists, remove it and reestablish with new parameters
+        if (evc.id() != null && evcMap.containsKey(evc.id())) {
+            return updateEvc(evc);
+        } else {
+            // id will be generated during validation below
+            evc.setId(null);
+        }
+
+        if (validateEvc(evc) == null) {
+            log.error("EVC could not be installed, please check log for details.");
+            return null;
+        }
+
+        //////////////////////////////////////////////////////////////////////////////////////////////////
+        // This is the "orchestration" part of the CE app
+        //////////////////////////////////////////////////////////////////////////////////////////////////
+
+        // TODO: Add configurable parameter to determine if fragmentation will take place
+        if (evcFragmentationEnabled) {
+            evc.setFcSet(fragmentEvc(evc));
+        } else {
+            evc.setFcSet(Collections.singleton(fcFromEvc(evc)));
+        }
+        evc.fcSet().forEach(fc -> log.info("DEBUG-EVC: {}", fc.toString()));
+        evc.fcSet().forEach(fc -> fc.ltpSet().forEach(ltp -> log.info("DEBUG-LTP: {}", ltp.toString())));
+
+        //////////////////////////////////////////////////////////////////////////////////////////////////
+
+        // Assign S-TAGs to FCs
+        // If network configuration is there, get tags from corresponding ports
+        // else generate unique tags to be used
+        // FIXME: This was supposed to be done in the validateFc method
+        // FIXME: but we need a vlanId here already, so that S-TAGs can be assigned below among paired INNIs/ENNIs
+        Set<VlanId> excludedVlans = usedVlans();
+        evc.fcSet().forEach(fc -> {
+            Optional<VlanId> cfgVlanId = getCfgVlan(fc);
+            if (cfgVlanId.isPresent()) {
+                fc.setVlanId(cfgVlanId.get());
+            } else {
+                fc.setVlanId(generateVlanId(excludedVlans));
+            }
+            excludedVlans.add(fc.vlanId());
+        });
+
+        // For each INNI/ENNI of each FC, find the paired INNI/ENNI and assign S-TAG according to the other FC's vlanId
+        for (CarrierEthernetForwardingConstruct fc : evc.fcSet()) {
+            for (CarrierEthernetLogicalTerminationPoint ltp : fc.ltpSet()) {
+                if (!ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+                    // Find the cp at the other end of the link
+                    Link link = linkService.getEgressLinks(ltp.ni().cp()).iterator().next();
+                    String ltpId = link.dst().deviceId().toString() + "/" + link.dst().port().toString();
+                    // Find the corresponding FC - assuming LTP ids are the same as connect point ids
+                    CarrierEthernetForwardingConstruct neighborFc = getFcFromLtpId(ltpId, evc.fcSet());
+                    if (neighborFc != null) {
+                        if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.INNI)) {
+                            ((CarrierEthernetInni) ltp.ni()).setSVlanId(neighborFc.vlanId());
+                        } else if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
+                            ((CarrierEthernetEnni) ltp.ni()).setSVlanId(neighborFc.vlanId());
+                        }
+                    }
+                }
+            }
+        }
+
+        // Install the constituent FCs
+        evc.fcSet().forEach(fc -> {
+            // Increment the FC refCount
+            fc.refCount().incrementAndGet();
+            installFc(fc);
+        });
+
+        // Update the EVC UNI set based on the LTPs used during FC connectivity
+        Set<CarrierEthernetUni> usedUniSet = new HashSet<>();
+        evc.fcSet().forEach(fc -> usedUniSet.addAll(fc.uniSet()));
+        evc.setUniSet(usedUniSet);
+
+        // Determine EVC state based on the state of the constituent FCs
+        evc.setState(CarrierEthernetVirtualConnection.State.ACTIVE);
+        Iterator<CarrierEthernetForwardingConstruct> fcIt = evc.fcSet().iterator();
+        while (fcIt.hasNext()) {
+            CarrierEthernetForwardingConstruct fc = fcIt.next();
+            evc.setState(CarrierEthernetVirtualConnection.State.valueOf(fc.state().name()));
+            if (!evc.isActive()) {
+                break;
+            }
+        }
+
+        if (evc.isActive()) {
+            // If EVC installation was successful, then register the EVC
+            evcMap.put(evc.id(), evc);
+        } else {
+            // If EVC installation was not successful, then do not register the EVC and rollback FC installations
+            evc.fcSet().forEach(fc -> {
+                // Decrement the FC refCount to make removal possible
+                fc.refCount().decrementAndGet();
+                removeFc(fc.id());
+            });
+        }
+
+        return evc;
+    }
+
+    /**
+     * Creates a single FC out of an EVC.
+     *
+     * @param evc the EVC representation
+     * @return the equivalent FC
+     */
+    private CarrierEthernetForwardingConstruct fcFromEvc(CarrierEthernetVirtualConnection evc) {
+        Set<CarrierEthernetLogicalTerminationPoint> ltpSet = new HashSet<>();
+        evc.uniSet().forEach(uni -> ltpSet.add(new CarrierEthernetLogicalTerminationPoint(null, uni)));
+        return CarrierEthernetForwardingConstruct.builder()
+                .type(evc.type())
+                .ltpSet(ltpSet)
+                .build();
+    }
+
+    /**
+     * Fragments an EVC into multiple FCs.
+     *
+     * @param evc the EVC representation
+     * @return the set of FCs constituting the EVC
+     */
+    private Set<CarrierEthernetForwardingConstruct> fragmentEvc(CarrierEthernetVirtualConnection evc) {
+
+        Set<CarrierEthernetForwardingConstruct> fcSet = new HashSet<>();
+
+        // Each LTP can only belong to a single FC, hence using LTP_id -> LTP_set map
+        Map<String, Set<CarrierEthernetLogicalTerminationPoint>> ltpSetMap = new HashMap<>();
+
+        // Temporary set to browse through all EVC UNI pairs
+        Set<CarrierEthernetUni> tempUniSet = new HashSet<>(evc.uniSet());
+
+        Iterator<CarrierEthernetUni> uniIt1 = tempUniSet.iterator();
+        while (uniIt1.hasNext()) {
+
+            CarrierEthernetUni uni1 = uniIt1.next();
+
+            // Iterate through all the remaining NIs
+            Iterator<CarrierEthernetUni> uniIt2 = tempUniSet.iterator();
+            while (uniIt2.hasNext()) {
+
+                CarrierEthernetUni uni2 = uniIt2.next();
+
+                // Skip equals
+                if (uni1.equals(uni2)) {
+                    continue;
+                }
+
+                // Do not establish connectivity between leaf NIs
+                // (applies to Rooted_Multipoint)
+                if (uni1.role().equals(CarrierEthernetUni.Role.LEAF)
+                        && uni2.role().equals(CarrierEthernetUni.Role.LEAF)) {
+                    continue;
+                }
+
+                // Note: INNIs should always appear in pairs
+                List<Pair<CarrierEthernetLogicalTerminationPoint,
+                        CarrierEthernetLogicalTerminationPoint>> ltpPairList
+                        = new ArrayList<>();
+
+                // If uni1 and uni2 are on same device, skip path calculation
+                // and directly generate a single LTP pair to be used below
+                if (uni1.cp().deviceId().equals(uni2.cp().deviceId())) {
+                    ltpPairList.add(Pair.of(new CarrierEthernetLogicalTerminationPoint(null, uni1),
+                            new CarrierEthernetLogicalTerminationPoint(null, uni2)));
+                } else {
+                    // Calculate path assuming return paths are the same
+                    // TODO: Handle the congruent paths case?
+                    Set<Path> paths;
+                    if (evc.type().equals(Type.POINT_TO_POINT)) {
+                        // For point-to-point connectivity use the pre-calculated paths
+                        // to make sure the shortest paths are chosen
+                        paths = pathService.getPaths(uni1.cp().deviceId(), uni2.cp().deviceId());
+                    } else {
+                        // Recalculate path so that it's over the pre-calculated spanning tree
+                        // FIXME: Find a more efficient way (avoid recalculating paths)
+                        paths = pathService.getPaths(uni1.cp().deviceId(), uni2.cp().deviceId(),
+                                new CarrierEthernetSpanningTreeWeight(topologyService));
+                    }
+
+                    // Just select any of the returned paths
+                    // TODO: Select path in more sophisticated way and return null
+                    // if any of the constraints cannot be met
+                    Path path = paths.iterator().hasNext() ? paths.iterator().next() : null;
+
+                    if (path == null) {
+                        return null;
+                    }
+
+                    List<Link> links = new ArrayList<>();
+                    links.add(createEdgeLink(uni1.cp(), true));
+                    links.addAll(path.links());
+                    links.add(createEdgeLink(uni2.cp(), false));
+
+                    ////////////////////////////////////////////////////////////
+                    // Get LTP pairs of ingress/egress NIs along the link path
+                    // (non-LTP connect points are ignored)
+                    ////////////////////////////////////////////////////////////
+
+                    CarrierEthernetLogicalTerminationPoint srcLtp = null, dstLtp = null;
+                    // These are the roles that will be used for all pairs found below
+                    Role srcLtpRole, dstLtpRole;
+                    // The source in any pair will always have the same role as the LTP from which the paths starts
+                    srcLtpRole = Role.valueOf(uni1.role().name());
+                    // The destination in any pair will always have the same role as the LTP at which the path ends
+                    dstLtpRole = Role.valueOf(uni2.role().name());
+                    for (int i = 0; i < links.size(); i++) {
+                        // Try to get the destination LTP of a pair
+                        if (srcLtp != null && i != 0) {
+                            // If this is the last, use existing EVC UNI, else create a new FC LTP and set Role
+                            dstLtp = (i == links.size() - 1) ?
+                                    new CarrierEthernetLogicalTerminationPoint(null, uni2) :
+                                    fcLtpFromCp(links.get(i).src(), dstLtpRole);
+                        }
+                        if (dstLtp != null) {
+                            // Create a new LTP pair and null the srcLtp
+                            // so that we can continue searching for a new pair
+                            ltpPairList.add(Pair.of(srcLtp, dstLtp));
+                            srcLtp = null;
+                        }
+                        // Try to get the source LTP of a pair
+                        if (srcLtp == null && i != links.size() - 1) {
+                            // If this is the first, use existing EVC UNI, else create a new FC LTP and set Role
+                            srcLtp = (i == 0) ?
+                                    new CarrierEthernetLogicalTerminationPoint(null, uni1) :
+                                    fcLtpFromCp(links.get(i).dst(), srcLtpRole);
+                        }
+                    }
+                }
+
+                ////////////////////////////////////////////////////////////////
+                // Go through all the LTP pairs found and map each LTP to a set
+                // of LTPs (create it if it doesn't exist)
+                ////////////////////////////////////////////////////////////////
+
+                // Note: Each LTP can only belong to a single set, so each set
+                // will eventually correspond to an FC
+
+                ltpPairList.forEach(ltpPair -> {
+                    CarrierEthernetLogicalTerminationPoint ltp1 = ltpPair.getLeft();
+                    CarrierEthernetLogicalTerminationPoint ltp2 = ltpPair.getRight();
+                    if (ltpSetMap.containsKey(ltp1.id()) && !ltpSetMap.containsKey(ltp2.id())) {
+                        // If one of the LTPs is already contained in a set, add the other one as well in that set
+                        ltpSetMap.get(ltp1.id()).add(ltp2);
+                        ltpSetMap.put(ltp2.id(), ltpSetMap.get(ltp1.id()));
+                    } else if (ltpSetMap.containsKey(ltp2.id()) & !ltpSetMap.containsKey(ltp1.id())) {
+                        // If one of the LTPs is already contained in a set, add the other one as well in that set
+                        ltpSetMap.get(ltp2.id()).add(ltp1);
+                        ltpSetMap.put(ltp1.id(), ltpSetMap.get(ltp2.id()));
+                    } else if (!ltpSetMap.containsKey(ltp1.id()) && !ltpSetMap.containsKey(ltp2.id())) {
+                        // Create a new LTP set containing the two LTPs and map both to it
+                        ltpSetMap.put(ltp1.id(), Sets.newHashSet(ltp1, ltp2));
+                        ltpSetMap.put(ltp2.id(), ltpSetMap.get(ltp1.id()));
+                    }
+                });
+            }
+            // Remove UNI from temporary set so that each pair is visited only once
+            uniIt1.remove();
+        }
+
+        //////////////////////////////////////////////////////////////////////////////////
+        // Go through all unique LTP sets generated above and create the corresponding FCs
+        //////////////////////////////////////////////////////////////////////////////////
+
+        new HashSet<>(ltpSetMap.values()).forEach(ltpSet -> {
+            CarrierEthernetForwardingConstruct.Builder fcBuilder =
+                    CarrierEthernetForwardingConstruct.builder().ltpSet(ltpSet);
+            // Type is determined by number and type of LTPs in each set
+            Type fcType =
+                    ltpSet.size() == 2 ? Type.POINT_TO_POINT
+                            : Type.MULTIPOINT_TO_MULTIPOINT;
+            // If one of the LTPs is LEAF, indicate FC as ROOT_MULTIPOINT
+            for (CarrierEthernetLogicalTerminationPoint ltp : ltpSet) {
+                if (ltp.role().equals(Role.LEAF)) {
+                    fcType = Type.ROOT_MULTIPOINT;
+                    break;
+                }
+            }
+            fcSet.add(fcBuilder.type(fcType).build());
+            log.info("Created ForwardingConstruct comprising LogicalTerminationPoints {}",
+                    ltpSet.stream()
+                            .map(CarrierEthernetLogicalTerminationPoint::id)
+                            .collect(Collectors.toList()));
+        });
+
+        return fcSet;
+    }
+
+    @Override
+    public CarrierEthernetVirtualConnection updateEvc(CarrierEthernetVirtualConnection evc) {
+        // Just checking again
+        if (evcMap.containsKey(evc.id())) {
+            log.info("Updating existing EVC {}", evc.id());
+            removeEvc(evc.id());
+        }
+        return installEvc(evc);
+    }
+
+    /**
+     * Applies FC- specific LTP attributes to global LTPs or adds them to the global LTP map if not there.
+     *
+     * @param ltpSet set of FC-specific LTPs the attributes of which will be applied to the global LTPs
+     */
+    private void applyFcToGlobalLtps(Set<CarrierEthernetLogicalTerminationPoint> ltpSet) {
+        ltpSet.forEach(ltp -> {
+            if (!(ltpMap.keySet().contains(ltp.id()))) {
+                // Just add the LTP as it appears at the FC
+                addGlobalLtp(ltp);
+            } else {
+                // Add LTP resources (BWP, CE-VLAN ID, S-TAG) to existing global LTP
+                ltpMap.get(ltp.id()).ni().addEcNi(ltp.ni());
+                // Update config identifier
+                ltpMap.get(ltp.id()).ni().setCfgId(ltp.ni().cfgId());
+            }
+        });
+    }
+
+    /**
+     * Removes bandwidth profiles from the UNIs of an FC.
+     *
+     * @param fc the FC representation
+     */
+    // TODO: Remove LTPs if needed from the global LTP/UNI map
+    private void removeFcFromGlobalLtps(CarrierEthernetForwardingConstruct fc) {
+        // TODO: Check if the bandwidth profile really needs to be removed (e.g. may be CoS)
+       //// ceProvisioner.removeBandwidthProfiles(fc);
+        // Remove LTP resources (BWP, CE-VLAN ID, S-TAG) from corresponding global LTPs
+        fc.ltpSet().forEach(ltp -> ltpMap.get(ltp.id()).ni().removeEcNi(ltp.ni()));
+    }
+
+    @Override
+    public void removeAllEvcs() {
+        evcMap.keySet().forEach(this::removeEvc);
+    }
+
+    @Override
+    public void removeEvc(EvcConnId evcId) {
+        if (evcMap.containsKey(evcId)) {
+            CarrierEthernetVirtualConnection evc = evcMap.get(evcId);
+            evc.fcSet().forEach(fc -> {
+                // Decrement the FC refCount to make removal possible
+                fc.refCount().decrementAndGet();
+                removeFc(fc.id());
+            });
+            // Avoid excessively incrementing EVC ids
+            nextEvcShortId = evc.shortId() < nextEvcShortId ? evc.shortId() : nextEvcShortId;
+            evcMap.remove(evcId);
+        }
+    }
+
+    /**
+     * Verify the validity of an FC representation taking also into account current network status.
+     *
+     * @param fc the provided FC representation
+     * @return a valid, potentially modified FC representation, or null if the FC could not be validated
+     */
+    private CarrierEthernetForwardingConstruct validateFc(CarrierEthernetForwardingConstruct fc) {
+
+        // Try to set a unique VLAN id for the FC unless the EVC is being updated
+        // TODO: Add different connectivity types
+        // FIXME: This is an extra check to be able to generate/set VLAN id for FC before calling installFc
+        if (fc.vlanId() == null) {
+            fc.setVlanId(generateVlanId(usedVlans()));
+        }
+        if (fc.vlanId() == null) {
+            log.error("No available VLAN id found.");
+            return null;
+        }
+
+        // Generate and set unique FC id
+        fc.setId(EvcConnId.of(generateFcId(fc)));
+
+        Set<CarrierEthernetLogicalTerminationPoint> validatedLtpSet = new HashSet<>();
+
+        // Check the NIs of the FC, possibly removing NIs that are incompatible with existing ones
+        Iterator<CarrierEthernetLogicalTerminationPoint> ltpIt = fc.ltpSet().iterator();
+        while (ltpIt.hasNext()) {
+            CarrierEthernetLogicalTerminationPoint ltp = ltpIt.next();
+            boolean ltpValidated = true;
+            if (ltp.type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+                CarrierEthernetUni uni = (CarrierEthernetUni) ltp.ni();
+                // Change the name of the UNI's BWP to the FC name if it is an EVC BWP
+                if (uni.bwp().type().equals(CarrierEthernetBandwidthProfile.Type.EVC)) {
+                    // FIXME: Find a way to use the EVC name instead
+                    uni.bwp().setId(fc.id().id());
+                }
+            }
+            // Check first if LTP already exists by checking against the global LTP Map
+            if (ltpMap.keySet().contains(ltp.id())) {
+                CarrierEthernetNetworkInterface existingNi = ltpMap.get(ltp.id()).ni();
+                // Check if the FC-specific NI is compatible with the global one
+                if (!(existingNi.validateEcNi(ltp.ni()))) {
+                    ltpValidated = false;
+                }
+            }
+            if (!ltpValidated) {
+                // If EVC is of ROOT_MULTIPOINT type and we have removed the root, return null
+                if (fc.type() == CarrierEthernetForwardingConstruct.Type.ROOT_MULTIPOINT &&
+                        ltp.role() == Role.ROOT) {
+                    log.error("Root LTP could not be added to %s FC.", fc.type().name());
+                    return null;
+                }
+                log.warn("LTP {} could not be added to FC.", ltp.id());
+                continue;
+            } else {
+                // Add LTP to FC description
+                validatedLtpSet.add(ltp);
+            }
+        }
+
+        fc.setLtpSet(validatedLtpSet);
+
+        return fc;
+    }
+
+    @Override
+    public CarrierEthernetForwardingConstruct installFc(CarrierEthernetForwardingConstruct fc) {
+
+        // If FC already exists, remove it and reestablish with new parameters
+        if (fc.id() != null && fcMap.containsKey(fc.id())) {
+            return updateFc(fc);
+        } else {
+            fc.setId(null);
+        }
+
+        if (validateFc(fc) == null) {
+            log.error("FC could not be installed, please check log for details.");
+            return null;
+        }
+
+        // Create BW profiles first so that they will be available if needed during the connectivity phase
+        networkProvisionerService.createBandwidthProfiles(fc);
+
+        networkProvisionerService.setupConnectivity(fc);
+
+
+        // If connectivity was not successful, then do not register the FC and do not apply BW profiles
+        // If not, the BW profiles that were created earlier need to be removed
+        if (fc.state().equals(CarrierEthernetForwardingConstruct.State.ACTIVE)) {
+            // Apply BWP-related resources (e.g. Meters) to the packet switches
+            networkProvisionerService.applyBandwidthProfiles(fc);
+            // Apply the BWPs of the FC UNIs to the global UNIs, creating them if needed
+            //applyEvcToGlobalUnis(fc.uniSet());
+            applyFcToGlobalLtps(fc.ltpSet());
+            // Increment the global LTP and corresponding NI refCount
+            fc.ltpSet().forEach(ltp -> ltpMap.get(ltp.id()).refCount().incrementAndGet());
+            fcMap.put(fc.id(), fc);
+        } else {
+          networkProvisionerService.removeBandwidthProfiles(fc);
+        }
+
+        return fc;
+    }
+
+    @Override
+    public CarrierEthernetForwardingConstruct updateFc(CarrierEthernetForwardingConstruct fc) {
+        // Just checking again
+        if (fcMap.containsKey(fc.id())) {
+            log.info("Updating existing FC {}", fc.id());
+            // Keep the VLAN ID of the original FC
+            fc.setVlanId(fcMap.get(fc.id()).vlanId());
+            // FIXME: Currently FC update only possible for standalone FCs
+            removeFc(fc.id());
+        }
+        return installFc(fc);
+    }
+
+    @Override
+    public void removeAllFcs() {
+        fcMap.keySet().forEach(fcId -> removeFc(fcId));
+    }
+
+    @Override
+    public CarrierEthernetForwardingConstruct removeFc(EvcConnId fcId) {
+        if (fcMap.containsKey(fcId)) {
+            CarrierEthernetForwardingConstruct fc = fcMap.get(fcId);
+            if (fc.refCount().get() != 0) {
+                log.warn("Could not remove FC {}: RefCount is not zero", fc.id());
+                return null;
+            }
+            networkProvisionerService.removeConnectivity(fc);
+            networkProvisionerService.removeBandwidthProfiles(fc);
+            removeFcFromGlobalLtps(fc);
+            // Avoid excessively incrementing FC VLAN ids
+            nextVlanId = (fcMap.get(fcId).vlanId().toShort() < nextVlanId ?
+                    fcMap.get(fcId).vlanId().toShort() :
+                    nextVlanId);
+            // Decrement the global LTP and corresponding NI refCount
+            fcMap.get(fcId).ltpSet().forEach(ltp -> ltpMap.get(ltp.id()).refCount().decrementAndGet());
+            fcMap.remove(fcId);
+            return fc;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the unique S-TAGs currently used by FCs across the CE network.
+     *
+     * @return the S-TAGs currently used
+     */
+    private Set<VlanId> usedVlans() {
+        return fcMap.values().stream().map(CarrierEthernetForwardingConstruct::vlanId)
+                .collect(Collectors.toSet());
+    }
+
+    /**
+     * Generates a new vlanId excluding the provided ones.
+     *
+     * @param excludedVlans the vlanIds that are not allowed
+     * @return the generated vlanId; null if none found
+     */
+    private VlanId generateVlanId(Set<VlanId> excludedVlans) {
+        // If all vlanIds are being used return null, else try to find the next available one
+        if (excludedVlans.size() <  VlanId.MAX_VLAN - 1) {
+            while (excludedVlans.contains(VlanId.vlanId(nextVlanId))) {
+                // Get next valid short
+                nextVlanId = (nextVlanId >= VlanId.MAX_VLAN || nextVlanId <= 0 ?
+                        1 : (short) (nextVlanId + 1));
+            }
+        }
+        return excludedVlans.contains(VlanId.vlanId(nextVlanId)) ?
+                null : VlanId.vlanId(nextVlanId);
+    }
+
+    /**
+     * Generates a unique vlanId in the context of the CE app.
+     *
+     * @return the generated vlanId or null if none found
+     */
+    private Short generateEvcShortId() {
+
+        List<Short> evcShortIdList = evcMap.values()
+                .stream()
+                .map(evc -> evc.shortId())
+                .collect(Collectors.toList());
+
+        // If all vlanIds are being used return null, else try to find the next available one
+        if (evcShortIdList.size() <  Short.MAX_VALUE - 1) {
+            while (evcShortIdList.contains(nextEvcShortId)) {
+                // Get next valid short
+                nextEvcShortId =
+                        (nextEvcShortId >= Short.MAX_VALUE || nextEvcShortId <= 0 ? 1 : (short) (nextEvcShortId + 1));
+            }
+        }
+
+        return evcShortIdList.contains(nextEvcShortId) ? null : nextEvcShortId;
+    }
+
+    /**
+     * Generates a unique EVC id in the context of the CE app.
+     *
+     * @param evc the EVC representation
+     * @return the generated EVC id or null if none found
+     */
+    private String generateEvcId(CarrierEthernetVirtualConnection evc) {
+
+        // TODO: Add different connectivity types
+
+        String tmpType;
+
+        if (evc.type().equals(Type.POINT_TO_POINT)) {
+            tmpType = "Line";
+        } else if (evc.type().equals(Type.MULTIPOINT_TO_MULTIPOINT)) {
+            tmpType = "LAN";
+        } else {
+            tmpType = "Tree";
+        }
+
+        return "E" + (evc.isVirtual() ? "V" : "") + "P-" + tmpType + "-" +
+                evc.shortId().toString();
+    }
+
+    /**
+     * Generates a unique FC id in the context of the CE app.
+     *
+     * @param fc the FC representation
+     * @return the generated FC id or null if none found
+     */
+    private String generateFcId(CarrierEthernetForwardingConstruct fc) {
+
+        // TODO: Add different connectivity types
+
+        return "FC-" + fc.vlanId().toString();
+    }
+
+    @Override
+    public CarrierEthernetLogicalTerminationPoint removeGlobalLtp(String ltpId) {
+
+        if (!ltpMap.containsKey(ltpId)) {
+            log.warn("Could not remove LTP {}: Does not exist", ltpId);
+            return null;
+        }
+
+        if (ltpMap.get(ltpId).refCount().get() != 0) {
+            log.warn("Could not remove LTP {}: RefCount is not zero", ltpId);
+            return null;
+        }
+
+        // Remove LTP from ltpMap and (if needed) UNI from uniMap
+        CarrierEthernetLogicalTerminationPoint ltp = ltpMap.remove(ltpId);
+        // Add LTP to removed set
+        removedLtpSet.add(ltpId);
+        if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+            removeGlobalUni(ltp.ni().id());
+            // Add UNI to removed set
+            // TODO: Check if this is right
+            removedUniSet.add(ltp.ni().id());
+        }
+
+        // Find cp at other end of link and try to remove both LTPs - assuming LTP ids are the same as connect point ids
+        if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.INNI)) {
+            Link link = linkService.getEgressLinks(ltp.ni().cp()).iterator().next();
+            String pairLtpId = link.dst().deviceId().toString() + "/" + link.dst().port().toString();
+            ltpMap.remove(pairLtpId);
+            // Add LTP to removed set
+            removedLtpSet.add(pairLtpId);
+        }
+
+        return ltp;
+    }
+
+    @Override
+    public CarrierEthernetUni removeGlobalUni(String uniId) {
+
+        if (!uniMap.containsKey(uniId)) {
+            log.warn("Could not remove UNI {}: Does not exist", uniId);
+            return null;
+        }
+        if (uniMap.get(uniId).refCount().get() != 0) {
+            log.warn("Could not remove UNI {}: RefCount is not zero", uniId);
+            return null;
+        }
+
+        // Remove UNI from uniMap and corresponding LTP (if any) from ltpMp
+        CarrierEthernetUni uni = uniMap.remove(uniId);
+        // FIXME: For now, find LTP assuming ltpId is the same as uniId
+        // Note: If refCount for UNI is not zero, then it should be for the corresponding LTP as well
+        ltpMap.remove(uniId);
+
+        // Add UNI and LTP to removed set
+        removedUniSet.add(uniId);
+        removedLtpSet.add(uniId);
+
+        return uni;
+    }
+
+    @Override
+    public Set<CarrierEthernetUni> getUnisFromTopo(boolean excludeAdded, boolean includeRemoved) {
+
+        CarrierEthernetUni uni;
+        Set<CarrierEthernetUni> uniSet = new HashSet<>();
+        // Generate the device ID/port number identifiers
+        for (Device device : deviceService.getDevices()) {
+            for (Port port : deviceService.getPorts(device.id())) {
+                if (!port.number().isLogical()) {
+                    String cpString = device.id().toString() + "/" + port.number();
+                    ConnectPoint cp = ConnectPoint.deviceConnectPoint(cpString);
+                    uni = generateUni(cp);
+                    // Check if UNI was generated and whether it's currently removed
+                    if (uni != null
+                            && (includeRemoved || !removedUniSet.contains(uni.id()))
+                            && (!excludeAdded || !uniMap.containsKey(uni.id()))) {
+                        uniSet.add(uni);
+                    }
+                }
+            }
+        }
+        return uniSet;
+    }
+
+    @Override
+    public CarrierEthernetUni generateUni(ConnectPoint cp) {
+
+        String uniId = cp.deviceId().toString() + "/" + cp.port().toString();
+
+        if (deviceService.getDevice(cp.deviceId()) == null) {
+            log.error("Could not generate UNI {}: Invalid deviceId {}", uniId, cp.deviceId());
+            return null;
+        }
+        if (deviceService.getPort(cp.deviceId(), cp.port()) == null) {
+            log.error("Could not generate UNI {}: Invalid port {} at device {}", uniId, cp.port(), cp.deviceId());
+            return null;
+        }
+        if (!deviceService.getDevice(cp.deviceId()).type().equals(Device.Type.SWITCH)) {
+            log.debug("Could not generate UNI {}: Device {} is not a switch", uniId, cp.deviceId());
+            return null;
+        }
+
+        Port port = deviceService.getPort(cp.deviceId(), cp.port());
+
+        if (!port.isEnabled())  {
+            log.debug("Could not generate UNI {}: Port {} is not enabled", uniId, port.number().toString());
+            return null;
+        }
+
+        if (validateLtpType(cp, CarrierEthernetNetworkInterface.Type.UNI) == null) {
+            return null;
+        }
+
+        return CarrierEthernetUni.builder()
+                .cp(cp)
+                .cfgId(uniId)
+                .build();
+    }
+
+    @Override
+    public CarrierEthernetUni addGlobalUni(CarrierEthernetUni uni) {
+        // Add UNI only if it's not already there. If corresponding LTP already exists, link them, otherwise create it
+        if (!uniMap.containsKey(uni.id())) {
+            // Add LTP only if it's not already there
+            // FIXME: Assumes LTP and UNI id are the same
+            if (!ltpMap.containsKey(uni.id())) {
+                ltpMap.put(uni.id(), new CarrierEthernetLogicalTerminationPoint(uni.id(), uni));
+                // Remove LTP from deleted set
+                removedLtpSet.remove(uni.id());
+            }
+            uniMap.put(uni.id(), uni);
+            // Remove UNI from deleted set
+            removedUniSet.remove(uni.id());
+            return  uni;
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public Set<CarrierEthernetLogicalTerminationPoint> getLtpsFromTopo(boolean excludeAdded, boolean includeRemoved) {
+
+        CarrierEthernetLogicalTerminationPoint ltp;
+        Set<CarrierEthernetLogicalTerminationPoint> ltpSet = new HashSet<>();
+        // Generate the device ID/port number identifiers
+        for (Device device : deviceService.getDevices()) {
+            for (Port port : deviceService.getPorts(device.id())) {
+                if (!port.number().isLogical()) {
+                    String cpString = device.id().toString() + "/" + port.number();
+                    ConnectPoint cp = ConnectPoint.deviceConnectPoint(cpString);
+                    ltp = generateLtp(cp, null);
+                    // Check if LTP was generated and whether it's currently removed
+                    if (ltp != null
+                            && (includeRemoved || !removedLtpSet.contains(ltp.id()))
+                            && (!excludeAdded || !ltpMap.containsKey(ltp.id()))) {
+                        // Check additionally if associated UNI is currently removed
+                        if (!(ltp.ni() instanceof CarrierEthernetUni) || !removedUniSet.contains(ltp.ni().id())) {
+                            ltpSet.add(ltp);
+                        }
+                    }
+                }
+            }
+        }
+        return ltpSet;
+    }
+
+    @Override
+    public CarrierEthernetLogicalTerminationPoint generateLtp(ConnectPoint cp,
+                                                              CarrierEthernetNetworkInterface.Type ltpType) {
+
+        String ltpId = cp.deviceId().toString() + "/" + cp.port().toString();
+
+        if (deviceService.getDevice(cp.deviceId()) == null) {
+            log.error("Could not generate LTP {}: Invalid deviceId {}", ltpId, cp.deviceId());
+            return null;
+        }
+        if (deviceService.getPort(cp.deviceId(), cp.port()) == null) {
+            log.error("Could not generate LTP {}: Invalid port {} at device {}", ltpId, cp.port(), cp.deviceId());
+            return null;
+        }
+        if (!deviceService.getDevice(cp.deviceId()).type().equals(Device.Type.SWITCH)) {
+            log.debug("Could not generate LTP {}: Device {} is not a switch", ltpId, cp.deviceId());
+            return null;
+        }
+
+        Port port = deviceService.getPort(cp.deviceId(), cp.port());
+
+        if (!port.isEnabled())  {
+            log.debug("Could not generate LTP {}: Port {} is not enabled", ltpId, port.number().toString());
+            return null;
+        }
+
+        ltpType = validateLtpType(cp, ltpType);
+
+        if (ltpType == null) {
+            log.warn("Could not generate LTP {}: Type could not be validated", ltpId, port.number().toString());
+            return null;
+        }
+
+        return new CarrierEthernetLogicalTerminationPoint(cp, ltpId, ltpType, null);
+    }
+
+    /**
+     * Validates whether the provided connect point can be associated with an LTP of the provided type.
+     *
+     * Conditions for validating the LTP type:
+     * - If UNI: ConnectPoint is not associated with any link
+     * - If INNI/ENNI: ConnectPoint is associated with a link
+     *
+     * @param cp the connect point associated with the LTP to be validated
+     * @param ltpType the type of the LTP to be validated or null in case a type is to be decided by the method
+     * @return the ltpType if validation succeeded, a new type depending on cp and topo, or null if validation failed
+     */
+    private CarrierEthernetNetworkInterface.Type validateLtpType(
+            ConnectPoint cp, CarrierEthernetNetworkInterface.Type ltpType) {
+        if (linkService.getEgressLinks(cp).isEmpty() && linkService.getIngressLinks(cp).isEmpty()) {
+            // A connect point can be a UNI only if it doesn't belong to any link
+            if (ltpType == null) {
+                // If provided type is null, decide about the LTP type based on connectivity
+                return CarrierEthernetNetworkInterface.Type.UNI;
+            } else if (ltpType.equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+                // Validate type
+                return ltpType;
+            } else {
+                return null;
+            }
+        } else {
+            // A connect point can be an INNI or ENNI only if it belongs to a link
+            if (ltpType == null) {
+                // If provided type is null, decide about the LTP type based on connectivity
+                return CarrierEthernetNetworkInterface.Type.INNI;
+            } else if (ltpType.equals(CarrierEthernetNetworkInterface.Type.INNI) ||
+                    ltpType.equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
+                // Validate type
+                return ltpType;
+            } else {
+                return null;
+            }
+        }
+    }
+
+    @Override
+    public CarrierEthernetLogicalTerminationPoint addGlobalLtp(CarrierEthernetLogicalTerminationPoint ltp) {
+        // If LTP contains a UNI, add it only if it's not already there, else point to the existing UNI
+        // FIXME: Assumes LTP and UNI id are the same
+        if (ltp.ni() != null &&
+                ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+
+            if (!uniMap.containsKey(ltp.ni().id())) {
+                uniMap.put(ltp.ni().id(), (CarrierEthernetUni) ltp.ni());
+                // Remove UNI from deleted set
+                removedUniSet.remove(ltp.id());
+            } else {
+                ltp.setNi(uniMap.get(ltp.ni().id()));
+            }
+        }
+        // Add LTP only if it's not already there
+        if (!ltpMap.containsKey(ltp.id())) {
+            // Try to create and add INNI LTP at other end of link as well
+            if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.INNI)) {
+                Link link = linkService.getEgressLinks(ltp.ni().cp()).iterator().next();
+                CarrierEthernetLogicalTerminationPoint pairLtp =
+                        generateLtp(link.dst(), CarrierEthernetNetworkInterface.Type.INNI);
+                if (pairLtp == null) {
+                    return null;
+                }
+                if (!ltpMap.containsKey(pairLtp.id())) {
+                    ltpMap.put(pairLtp.id(), pairLtp);
+                } else {
+                    return null;
+                }
+            }
+            ltpMap.put(ltp.id(), ltp);
+            // Remove LTP from deleted set
+            removedLtpSet.remove(ltp.id());
+            return ltp;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Utility method to obtain an FC-specific LTP (UNI/INNI or ENNI) associated with a connect point.
+     *
+     * @param cp the connect point to check
+     * @return a new FC-specific LTP associated with cp if the corresponding global LTP exists or null otherwise
+     */
+    private CarrierEthernetLogicalTerminationPoint fcLtpFromCp(ConnectPoint cp,
+                                                               Role ltpRole) {
+        // Check first if cp is associated with a device
+        if (cp.deviceId() == null) {
+            return null;
+        }
+        // Assuming LTP id is the same as the connect point id
+        String cpId = cp.deviceId().toString() + "/" + cp.port().toString();
+        if (ltpMap.containsKey(cpId)) {
+            return new CarrierEthernetLogicalTerminationPoint(cp, cpId,
+                    ltpMap.get(cpId).type(), ltpRole);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Utility method to obtain the first FC in a set which contains the LTP with the provided id.
+     *
+     * @param ltpId the LTP id to search
+     * @param fcSet the FC set to search
+     * @return the first FC found in fcSet which contains an LTP with id ltpId, or null if no such FC is found
+     */
+    // FIXME: Find more efficient way to do that
+    private CarrierEthernetForwardingConstruct getFcFromLtpId(String ltpId,
+                                                              Set<CarrierEthernetForwardingConstruct> fcSet) {
+        // Get the first FC that contains the LTP with the provided id
+        for (CarrierEthernetForwardingConstruct fc : fcSet) {
+            if (!fc.ltpSet().stream().filter(ltp -> ltp.id().equals(ltpId)).collect(Collectors.toList()).isEmpty()) {
+                return fc;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public void setEvcFragmentation(boolean evcFragmentationEnabled) {
+        prevEvcFragmentationStatus = this.evcFragmentationEnabled;
+        this.evcFragmentationEnabled = evcFragmentationEnabled;
+    }
+
+    @Override
+    public boolean getEvcFragmentation() {
+        return evcFragmentationEnabled;
+    }
+
+    @Override
+    public void resetEvcFragmentation() {
+        this.evcFragmentationEnabled = prevEvcFragmentationStatus;
+    }
+
+    /**
+     * Returns the VLAN tag associated with an FC via network configuration.
+     *
+     * The VLAN tag to be selected should be configured in at least one of the
+     * FC LTPs and no different tag should be present in the rest of the FC LTPs.
+     *
+     * @param fc the FC to check
+     * @return an Optional object with the VLAN to be associated with the FC if
+     * one was found; an empty Optional object otherwise
+     */
+    private Optional<VlanId> getCfgVlan(CarrierEthernetForwardingConstruct fc) {
+        VlanId cfgVlan = null;
+        for (CarrierEthernetLogicalTerminationPoint ltp : fc.ltpSet()) {
+            VlanId tmpVlan = portVlanMap.get(ltp.cp());
+            if (tmpVlan == null) {
+                continue;
+            } else if (cfgVlan != null && cfgVlan != tmpVlan) {
+                log.warn("Multiple configured S-TAGs for the same FC");
+                return Optional.empty();
+            } else {
+                cfgVlan = tmpVlan;
+            }
+        }
+        return cfgVlan == null ? Optional.empty() : Optional.of(cfgVlan);
+    }
+
+    private class InternalNetworkConfigListener implements NetworkConfigListener {
+
+        /**
+         * Negative events.
+         */
+        private final EnumSet<NetworkConfigEvent.Type> negative
+                = EnumSet.of(NetworkConfigEvent.Type.CONFIG_UNREGISTERED,
+                NetworkConfigEvent.Type.CONFIG_REMOVED);
+
+        /**
+         * Actual configuration events.
+         */
+        private final EnumSet<NetworkConfigEvent.Type> actualConfig
+                = EnumSet.of(NetworkConfigEvent.Type.CONFIG_ADDED,
+                NetworkConfigEvent.Type.CONFIG_REMOVED,
+                NetworkConfigEvent.Type.CONFIG_UPDATED);
+
+        @Override
+        public boolean isRelevant(NetworkConfigEvent event) {
+            return event.configClass().equals(PortVlanConfig.class) &&
+                    actualConfig.contains(event.type());
+        }
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+
+            if (!isRelevant(event)) {
+                return;
+            }
+
+            ConnectPoint cp = (ConnectPoint) event.subject();
+            PortVlanConfig config = networkConfigService.getConfig(cp, PortVlanConfig.class);
+
+            if (config == null) {
+                log.info("VLAN tag config is removed from port {}", cp);
+                portVlanMap.remove(cp);
+                return;
+            }
+
+            if (config.portVlanId().isPresent() && !negative.contains(event.type())) {
+                VlanId assignedVlan = config.portVlanId().get();
+                if (usedVlans().contains(assignedVlan)) {
+                    log.warn("VLAN tag {} is already used in the CE network", assignedVlan);
+                } else {
+                    log.info("VLAN tag {} is assigned to port {}", assignedVlan, cp);
+                    portVlanMap.put(cp, assignedVlan);
+                }
+            } else {
+                log.info("VLAN tag is removed from port {}", cp);
+                portVlanMap.remove(cp);
+            }
+        }
+    }
+}
+
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/ControlChannelManager.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/ControlChannelManager.java
new file mode 100644
index 0000000..fc5bd84
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/ControlChannelManager.java
@@ -0,0 +1,70 @@
+/*
+ * 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.opencord.ce.global.orchestration.channel;
+
+import com.google.common.collect.ImmutableSet;
+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.Service;
+import org.opencord.ce.api.services.channel.ControlChannelListenerService;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+import org.slf4j.Logger;
+
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+
+/**
+ * Implementation o the {@link ControlChannelListenerService}.
+ */
+@Component(immediate = true)
+@Service
+public class ControlChannelManager implements ControlChannelListenerService {
+
+    private final Logger log = getLogger(getClass());
+    private Set<MetroNetworkVirtualNodeService> sbListeners = new CopyOnWriteArraySet<>();
+
+    @Activate
+    public void activate() {
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        log.info("Stopped");
+    }
+
+    @Override
+    public void addListener(MetroNetworkVirtualNodeService listener) {
+        log.debug("listener added");
+        sbListeners.add(listener);
+    }
+
+    @Override
+    public void removeListener(MetroNetworkVirtualNodeService listener) {
+        sbListeners.remove(listener);
+    }
+
+    @Override
+    public Set<MetroNetworkVirtualNodeService> listeners() {
+        return ImmutableSet.copyOf(sbListeners);
+    }
+
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/package-info.java
new file mode 100644
index 0000000..b2a17ef
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/channel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Communication channel APIs.
+ */
+package org.opencord.ce.global.orchestration.channel;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetCreateEvcCommand.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetCreateEvcCommand.java
new file mode 100644
index 0000000..6e52817
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetCreateEvcCommand.java
@@ -0,0 +1,84 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.commands;
+
+import com.google.common.collect.Lists;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+import java.util.List;
+
+import static org.opencord.ce.api.models.CarrierEthernetEvcUtils.generateEvcType;
+import static org.opencord.ce.api.models.CarrierEthernetEvcUtils.generateUniSet;
+import static org.opencord.ce.api.models.CarrierEthernetEvcUtils.generateMaxNumUni;
+
+/**
+ * CLI command for installing an Ethernet Virtual Connection.
+ */
+@Command(scope = "onos", name = "ce-evc-create",
+        description = "Carrier Ethernet EVC creation command.")
+public class CarrierEthernetCreateEvcCommand extends AbstractShellCommand {
+    @Argument(index = 0, name = "argEvcCfgId",
+            description = "EVC configuration ID", required = true, multiValued = false)
+    String argEvcCfgId = null;
+    @Argument(index = 1, name = "argEvcType", description =
+            "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 = "argUniList",
+            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)
+    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)
+    int argMaxNumUni = -1;
+    @Option(name = "-c", aliases = "--cir", description = "The CIR in Mbps", required = false, multiValued = false)
+    double argCir = 0;
+    @Option(name = "-e", aliases = "--eir", description = "The EIR in Mbps", required = false, multiValued = false)
+    double argEir = 0;
+    @Option(name = "-cbs", aliases = "--cbs", description = "The CBS in Bytes", required = false, multiValued = false)
+    long argCbs = 0;
+    @Option(name = "-ebs", aliases = "--ebs", description = "The EBS in Bytes", required = false, multiValued = false)
+    long argEbs = 0;
+
+    // TODO: Add further arguments for VLAN tag preservation, CoS preservation etc.
+
+    @Override
+    protected void execute() {
+        MetroOrchestrationService ceManager = get(MetroOrchestrationService.class);
+        ceManager.installEvc(CarrierEthernetVirtualConnection.builder()
+                .id(EvcConnId.of(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());
+    }
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListEvcsCommand.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListEvcsCommand.java
new file mode 100644
index 0000000..301e635
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListEvcsCommand.java
@@ -0,0 +1,43 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.commands;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+import java.util.Collection;
+
+
+/**
+ * CLI command for listing all installed CE services.
+ */
+@Command(scope = "onos", name = "ce-evc-list",
+        description = "Lists all installed EVCs.")
+public class CarrierEthernetListEvcsCommand extends AbstractShellCommand {
+
+    @Override
+    protected void execute() {
+        MetroOrchestrationService ceManager = get(MetroOrchestrationService.class);
+        printServices(ceManager.evcMap().values());
+    }
+
+    private void printServices(Collection<CarrierEthernetVirtualConnection> services) {
+        services.forEach(service -> print("  %s", service));
+    }
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListUnisCommand.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListUnisCommand.java
new file mode 100644
index 0000000..39931c3
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetListUnisCommand.java
@@ -0,0 +1,44 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.commands;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+import java.util.Collection;
+
+/**
+ * CLI command for listing all CE UNIs.
+ */
+@Command(scope = "onos", name = "ce-uni-list",
+        description = "Lists all Carrier Ethernet UNIs.")
+public class CarrierEthernetListUnisCommand extends AbstractShellCommand {
+
+    @Override
+    protected void execute() {
+        MetroOrchestrationService ceManager = get(MetroOrchestrationService.class);
+        // Populate global UNI map
+        ceManager.getUnisFromTopo(false, false).forEach(uni -> ceManager.addGlobalUni(uni));
+        printUnis(ceManager.getUniMap().values());
+    }
+
+    private void printUnis(Collection<CarrierEthernetUni> unis) {
+        unis.forEach(uni -> print("  %s", uni));
+    }
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/package-info.java
new file mode 100644
index 0000000..00b168a
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Command classes for the Carrier Ethernet app CLI.
+ */
+package org.opencord.ce.global.orchestration.cli.commands;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetEvcTypeCompleter.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetEvcTypeCompleter.java
new file mode 100644
index 0000000..b5e8503
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetEvcTypeCompleter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.completers;
+
+import org.apache.karaf.shell.console.Completer;
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+
+import java.util.List;
+import java.util.SortedSet;
+
+public class CarrierEthernetEvcTypeCompleter implements Completer {
+    @Override
+    public int complete(String buffer, int cursor, List<String> candidates) {
+
+        StringsCompleter delegate = new StringsCompleter();
+
+        SortedSet<String> strings = delegate.getStrings();
+
+        for (CarrierEthernetVirtualConnection.Type type : CarrierEthernetVirtualConnection.Type.values()) {
+            strings.add(type.name());
+        }
+
+        return delegate.complete(buffer, cursor, candidates);
+    }
+
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetUniCompleter.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetUniCompleter.java
new file mode 100644
index 0000000..de11682
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetUniCompleter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.completers;
+
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.onosproject.cli.AbstractCompleter;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+import java.util.List;
+import java.util.SortedSet;
+
+/**
+ * UNI id completer, including only UNIs that have been added to the UNI map.
+ */
+public class CarrierEthernetUniCompleter extends AbstractCompleter {
+
+    @Override
+    public int complete(String buffer, int cursor, List<String> candidates) {
+
+        StringsCompleter delegate = new UniqueStringsCompleter();
+        SortedSet<String> strings = delegate.getStrings();
+
+        MetroOrchestrationService ceManager = AbstractShellCommand.get(MetroOrchestrationService.class);
+        ceManager.getUniMap().keySet().forEach(uniId -> strings.add(uniId));
+
+        return delegate.complete(buffer, cursor, candidates);
+    }
+
+}
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetValidUniCompleter.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetValidUniCompleter.java
new file mode 100644
index 0000000..b4cea6c
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/CarrierEthernetValidUniCompleter.java
@@ -0,0 +1,43 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.completers;
+
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.onosproject.cli.AbstractCompleter;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+import java.util.List;
+import java.util.SortedSet;
+
+/**
+ * UNI id completer, not including UNIs that have been removed.
+ */
+public class CarrierEthernetValidUniCompleter extends AbstractCompleter {
+
+    @Override
+    public int complete(String buffer, int cursor, List<String> candidates) {
+
+        StringsCompleter delegate = new UniqueStringsCompleter();
+        SortedSet<String> strings = delegate.getStrings();
+
+        MetroOrchestrationService ceManager = AbstractShellCommand.get(MetroOrchestrationService.class);
+        ceManager.getUnisFromTopo(false, false).forEach(uni -> strings.add(uni.id()));
+
+        return delegate.complete(buffer, cursor, candidates);
+    }
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/UniqueStringsCompleter.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/UniqueStringsCompleter.java
new file mode 100644
index 0000000..f5f3b96
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/UniqueStringsCompleter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.opencord.ce.global.orchestration.cli.completers;
+
+import org.apache.felix.service.command.CommandSession;
+import org.apache.karaf.shell.console.CommandSessionHolder;
+import org.apache.karaf.shell.console.completer.ArgumentCompleter;
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * String completer which excludes strings already included in the preceding argument list.
+ */
+public class UniqueStringsCompleter extends StringsCompleter {
+
+    @Override
+    public int complete(String buffer, int cursor, List candidates) {
+
+        // Get all preceding arguments
+        CommandSession session = CommandSessionHolder.getSession();
+        List<String> prevArgsList = Arrays.asList(((ArgumentCompleter.ArgumentList) session
+                .get("ARGUMENTS_LIST")).getArguments());
+
+        super.complete(buffer, cursor, candidates);
+
+        // Remove from candidate list all strings included in preceding arguments
+        candidates.removeAll(prevArgsList);
+
+        return candidates.isEmpty() ? -1 : 0;
+    }
+
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/package-info.java
new file mode 100644
index 0000000..35248a8
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/completers/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Completer classes for the Carrier Ethernet app CLI.
+ */
+package org.opencord.ce.global.orchestration.cli.completers;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/package-info.java
new file mode 100644
index 0000000..bb4852f
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * CLI implementation for the Carrier Ethernet Application.
+ */
+package org.opencord.ce.global.orchestration.cli;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/package-info.java
new file mode 100644
index 0000000..0c891cb
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Global metro orchestration package.
+ */
+package org.opencord.ce.global.orchestration;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/CarrierEthernetWebApplication.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/CarrierEthernetWebApplication.java
new file mode 100644
index 0000000..3810ea6
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/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.opencord.ce.global.orchestration.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/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/CarrierEthernetWebResource.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/CarrierEthernetWebResource.java
new file mode 100644
index 0000000..9381cf0
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/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.opencord.ce.global.orchestration.rest;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+
+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("evc")
+public class CarrierEthernetWebResource extends AbstractWebResource {
+
+    private static final String EVCS = "evcs";
+    private final ObjectNode root = mapper().createObjectNode();
+    private final ArrayNode evcsNode = root.putArray(EVCS);
+
+    private MetroOrchestrationService ceManager = get(MetroOrchestrationService.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)
+    public Response getEvcs() {
+        ceManager.evcMap().values().forEach(evc -> evcsNode.add(
+                        codec(CarrierEthernetVirtualConnection.class)
+                                .encode(evc, this)));
+
+
+        return ok(root).build();
+    }
+
+    /**
+     * Gets an EVC entry by deviceId.
+     * @param evcId evc ID
+     * @return 200 OK with the requested Evc.
+     */
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("{evcId}")
+    public Response getEvc(@PathParam("evcId") String evcId) {
+        ObjectNode evc = codec(CarrierEthernetVirtualConnection.class)
+                .encode(ceManager.getEvc(EvcConnId.of(evcId)), this);
+        return ok(evc).build();
+    }
+
+    /**
+     * Install an EVC with given parameters.
+     *
+     * @param stream input stream
+     * @return 200 OK if the EVC was installed
+     */
+    @POST
+    @Produces(MediaType.APPLICATION_JSON)
+    @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().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)
+    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("{evcId}")
+    public Response removeEvcWithId(@PathParam("evcId") String evcId) {
+        ceManager.removeEvc(EvcConnId.of(evcId));
+        return Response.noContent().build();
+    }
+
+}
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/EvcCodec.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/EvcCodec.java
new file mode 100644
index 0000000..a87725f
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/EvcCodec.java
@@ -0,0 +1,113 @@
+/*
+ * 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.opencord.ce.global.orchestration.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.opencord.ce.api.models.CarrierEthernetBandwidthProfile;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.CarrierEthernetVirtualConnection;
+import org.opencord.ce.api.models.EvcConnId;
+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.opencord.ce.api.models.CarrierEthernetEvcUtils.generateEvcType;
+import static org.opencord.ce.api.models.CarrierEthernetEvcUtils.generateMaxNumUni;
+import static org.opencord.ce.api.models.CarrierEthernetEvcUtils.generateUniSet;
+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().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 CarrierEthernetVirtualConnection.builder().id(EvcConnId.of(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/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/package-info.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/package-info.java
new file mode 100644
index 0000000..547a6bb
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/rest/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * REST API to setup Carrier Ethernet circuits.
+ */
+package org.opencord.ce.global.orchestration.rest;
\ No newline at end of file
diff --git a/global/ce-orchestration/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/global/ce-orchestration/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..884297c
--- /dev/null
+++ b/global/ce-orchestration/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,41 @@
+<!--
+  ~ 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.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.opencord.ce.global.orchestration.cli.commands.CarrierEthernetListUnisCommand"/>
+        </command>
+        <command>
+            <action class="org.opencord.ce.global.orchestration.cli.commands.CarrierEthernetCreateEvcCommand"/>
+            <completers>
+                <ref component-id="placeholderCompleter"/>
+                <ref component-id="carrierEthernetEvcTypeCompleter"/>
+                <ref component-id="carrierEthernetValidUniCompleter"/>
+                <ref component-id="carrierEthernetValidUniCompleter"/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.opencord.ce.global.orchestration.cli.commands.CarrierEthernetListEvcsCommand"/>
+        </command>
+    </command-bundle>
+
+    <bean id="placeholderCompleter" class="org.onosproject.cli.PlaceholderCompleter"/>
+    <bean id="carrierEthernetEvcTypeCompleter" class="org.opencord.ce.global.orchestration.cli.completers.CarrierEthernetEvcTypeCompleter"/>
+    <bean id="carrierEthernetUniCompleter" class="org.opencord.ce.global.orchestration.cli.completers.CarrierEthernetUniCompleter"/>
+    <bean id="carrierEthernetValidUniCompleter" class="org.opencord.ce.global.orchestration.cli.completers.CarrierEthernetValidUniCompleter"/>
+
+</blueprint>
diff --git a/global/ce-orchestration/src/main/webapp/WEB-INF/web.xml b/global/ce-orchestration/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..cf45f69
--- /dev/null
+++ b/global/ce-orchestration/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"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         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>ECORD REST API v1.0</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.opencord.ce.global.orchestration.rest.CarrierEthernetWebApplication</param-value>
+        </init-param>
+        <load-on-startup>10</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/global/config-samples/ecord-global-config.json b/global/config-samples/ecord-global-config.json
new file mode 100644
index 0000000..9d41fb0
--- /dev/null
+++ b/global/config-samples/ecord-global-config.json
@@ -0,0 +1,46 @@
+{
+  "apps" : {
+    "org.opencord.ce.global.vprovider" : {
+      "xos" : {
+        "username" : "Alessandro",
+        "password" : "Lucrezia",
+        "address" : "127.0.0.1",
+        "resource" : "/xosapi/v1/metronet/usernetworkinterfaces/"
+      }
+    },
+    "org.opencord.ce.global.channel.http" : {
+      "endPoints" : {
+        "port" : "8181",
+        "topics" : [
+          "ecord-domains-topic-one",
+          "ecord-domains-topic-two",
+          "ecord-domains-topic-three"
+        ],
+        "domains" :
+        [
+          {
+            "domainId" : "10.128.14.50",
+            "clusterIps" : [
+              "10.128.14.50"
+            ],
+            "port" : "8181",
+            "username" : "sdn",
+            "password" : "rocks",
+            "topic" : "ecord-domains-topic-one"
+          },
+          {
+            "domainId" : "10.128.14.30",
+            "clusterIps" : [
+              "10.128.14.30"
+            ],
+            "port" : "8181",
+            "username" : "sdn",
+            "password" : "rocks",
+            "topic" : "ecord-domains-topic-one"
+          }
+        ]
+      }
+    }
+  }
+
+}
diff --git a/global/http-channel/pom.xml b/global/http-channel/pom.xml
new file mode 100644
index 0000000..1ff30e9
--- /dev/null
+++ b/global/http-channel/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>global</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>global-channel</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Http communication channel between hierarchic ONOS controllers</description>
+
+    <properties>
+        <web.context>/ecord/global</web.context>
+        <onos.app.name>org.opencord.ce.global.channel</onos.app.name>
+        <onos.version>1.10.3</onos.version>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <project.version>1.0.0</project.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>orchestration</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp/</_wab>
+                        <Bundle-SymbolicName>
+                            ${project.groupId}.${project.artifactId}
+                        </Bundle-SymbolicName>
+                        <Import-Package>
+                            *,org.glassfish.jersey.servlet
+                        </Import-Package>
+                        <Web-ContextPath>${web.context}</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/HttpClientComponent.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/HttpClientComponent.java
new file mode 100644
index 0000000..d470f9f
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/HttpClientComponent.java
@@ -0,0 +1,234 @@
+/*
+ * 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.opencord.ce.global.channel;
+
+
+import com.google.common.collect.Sets;
+
+import org.apache.commons.lang3.tuple.Pair;
+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.apache.felix.scr.annotations.Service;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.net.domain.DomainId;
+import org.onosproject.net.domain.DomainService;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.opencord.ce.api.services.channel.ConnectionService;
+import org.opencord.ce.api.services.channel.ControlChannelListenerService;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.global.channel.client.ConnectionConfig;
+import org.opencord.ce.global.channel.client.HttpClientInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+
+/**
+ * Southbound component that adds a listener to the
+ * {@link ControlChannelListenerService}.
+ *
+ * Accomplishes network tasks through HTTP requests,
+ * acting as a client that send {@link org.opencord.ce.api.models.CarrierEthernetForwardingConstruct}
+ * requests to the underlying domains
+ */
+@Component(immediate = true)
+@Service(ConnectionService.class)
+public class HttpClientComponent implements ConnectionService {
+    private static final String APP_NAME = "org.opencord.ce.global.channel.http";
+
+    // temporary
+    private static final String TOPIC_ONE = "ecord-domains-topic-one";
+    private static final String TOPIC_TWO = "ecord-domains-topic-two";
+    private static final String TOPIC_THREE = "ecord-domains-topic-three";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LeadershipService leadershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry configRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ControlChannelListenerService channelListenerService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DomainService domainService;
+
+    private final Set<EndPoint> endPoints = Sets.newHashSet();
+
+    private ConsistentMap<EndPoint, IpAddress> endPointMasterIpMap;
+
+    private final ExecutorService eventExecutor =
+            Executors.newSingleThreadExecutor();
+
+    private final ConfigFactory<ApplicationId, ConnectionConfig> configFactory =
+            new ConfigFactory<ApplicationId, ConnectionConfig>(SubjectFactories.APP_SUBJECT_FACTORY,
+                    ConnectionConfig.class, "endPoints") {
+                @Override
+                public ConnectionConfig createConfig() {
+                    return new ConnectionConfig();
+                }
+            };
+
+    private final NetworkConfigListener configListener = new InternalConfigListener();
+
+    @Activate
+    protected void activate() {
+        log.info("Started");
+
+        appId = coreService.registerApplication(APP_NAME);
+        endPointMasterIpMap = storageService.<EndPoint, IpAddress>consistentMapBuilder()
+                .withName("ecord-domain-endpoints")
+                .withSerializer(Serializer.using(
+                        new KryoNamespace.Builder()
+                                .register(KryoNamespaces.API)
+                                .register(DomainId.class)
+                                .register(EndPoint.class)
+                                .build()
+                )).build();
+        configRegistry.registerConfigFactory(configFactory);
+        configService.addListener(configListener);
+        channelListenerService.addListener(HttpClientInstance.INSTANCE);
+        leadershipService.runForLeadership(TOPIC_ONE);
+        leadershipService.runForLeadership(TOPIC_TWO);
+        leadershipService.runForLeadership(TOPIC_THREE);
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+
+        configService.removeListener(configListener);
+        configRegistry.unregisterConfigFactory(configFactory);
+        channelListenerService.removeListener(HttpClientInstance.INSTANCE);
+        leadershipService.withdraw(TOPIC_ONE);
+        leadershipService.withdraw(TOPIC_TWO);
+        leadershipService.withdraw(TOPIC_THREE);
+        HttpClientInstance.INSTANCE.stopNetworkTasks();
+    }
+
+    @Override
+    public IpAddress getLocalMasterIp(String domainId) {
+        synchronized (this) {
+            for (EndPoint ep : endPoints) {
+                if (ep.domainId().id().equals(domainId)) {
+                    String topic = ep.topic();
+                    String masterIp;
+                    String leaderId = leadershipService.getLeader(topic).id();
+                    log.info("local leaderId: " + leaderId);
+                    masterIp = clusterService.getNode(NodeId.nodeId(leaderId)).ip().toString();
+
+                    return IpAddress.valueOf(masterIp);
+                }
+            }
+        }
+        log.info("Found no leader for domain " + domainId +
+                "-- endPoints size: " + endPoints.size());
+        return null;
+    }
+
+    @Override
+    public IpAddress getRemoteMasterIp(String domainId) {
+        synchronized (this) {
+            for (EndPoint ep : endPoints) {
+                if (ep.domainId().id().equals(domainId)) {
+                    return HttpClientInstance.INSTANCE.getRemoteMasterIp(ep);
+                }
+            }
+        }
+        log.info("Found no master ip for domain {}", domainId);
+        return null;
+    }
+
+    @Override
+    public Pair<Client, IpAddress> getConnectionInfo(DomainId domainId) {
+        Client client = HttpClientInstance.INSTANCE
+                .getConnectionInfo(domainId);
+        return Pair.of(client, getRemoteMasterIp(domainId.id()));
+    }
+
+    private void readConfig() {
+        ConnectionConfig config = configRegistry.getConfig(appId, ConnectionConfig.class);
+        log.debug("Domains connections config received");
+
+        synchronized (this) {
+            endPoints.addAll(config.endPoints());
+        }
+
+        HttpClientInstance.INSTANCE.configure(clusterService, leadershipService, domainService,
+                endPointMasterIpMap, config);
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if (!event.configClass().equals(ConnectionConfig.class)) {
+                return;
+            }
+            switch (event.type()) {
+                case CONFIG_ADDED:
+                    log.info("Network configuration added");
+                    eventExecutor.execute(HttpClientComponent.this::readConfig);
+                    break;
+                case CONFIG_UPDATED:
+                    log.info("Network configuration updated");
+                    eventExecutor.execute(HttpClientComponent.this::readConfig);
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/ConnectionConfig.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/ConnectionConfig.java
new file mode 100644
index 0000000..c9c91f7
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/ConnectionConfig.java
@@ -0,0 +1,98 @@
+/*
+ * 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.opencord.ce.global.channel.client;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.domain.DomainId;
+import org.opencord.ce.api.services.channel.EndPoint;
+
+import java.util.ArrayList;
+import java.util.Set;
+
+/**
+ * Configuration class for this bundle.
+ *
+ * Look at /config-samples/ecord-global-config.json for a sample configuration
+ */
+public class ConnectionConfig extends Config<ApplicationId> {
+
+    private static final String PORT = "port";
+
+    private static final String TOPICS = "topics";
+
+    private static final String DOMAINS = "domains";
+    private static final String DOMAIN_ID = "domainId";
+    private static final String DOMAIN_IPS = "clusterIps";
+    private static final String USERNAME = "username";
+    private static final String PASSWD = "password";
+    private static final String TOPIC = "topic";
+
+
+
+    /**
+     * Gets listen port from configuration.
+     * @return port number
+     */
+    public int listenPort() {
+        return object.path(PORT).asInt();
+    }
+
+    /**
+     * List of topics to distribute network operations among ONOS instances.
+     * @return list of topics
+     */
+    public ArrayList<String> topics() {
+        ArrayList<String> topics = new ArrayList<>();
+        object.path(TOPICS).forEach(
+                topic -> topics.add(topic.asText())
+        );
+        return topics;
+    }
+
+    /**
+     * Returns set of domain end points.
+     * @return set of domain end points
+     */
+    public Set<EndPoint> endPoints() {
+        JsonNode peersNode = object.get(DOMAINS);
+        Set<EndPoint> endPoints = Sets.newHashSet();
+
+        peersNode.forEach(jsonNode -> {
+            DomainId domainId = DomainId.domainId(
+                    jsonNode.path(DOMAIN_ID).asText());
+            Set<IpAddress> ipAddresses = Sets.newHashSet();
+            jsonNode.path(DOMAIN_IPS).forEach(ipAddress -> ipAddresses.add(
+                    IpAddress.valueOf(ipAddress.asText())
+            ));
+            int port = jsonNode.path(PORT).asInt();
+
+            String username = jsonNode.path(USERNAME).asText();
+            String password = jsonNode.path(PASSWD).asText();
+
+            String topic = jsonNode.path(TOPIC).asText();
+
+            endPoints.add(new EndPoint(domainId, ipAddresses, port,
+                    username, password, topic));
+        });
+
+        return endPoints;
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/DomainMasterIpDiscoveryTask.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/DomainMasterIpDiscoveryTask.java
new file mode 100644
index 0000000..8638639
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/DomainMasterIpDiscoveryTask.java
@@ -0,0 +1,128 @@
+/*
+ * 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.opencord.ce.global.channel.client;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.jboss.netty.util.Timeout;
+import org.jboss.netty.util.TimerTask;
+import org.onlab.packet.IpAddress;
+import org.onlab.util.Timer;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.slf4j.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Executed periodically to find the leader node of a domain.
+ * Stops when the ip is found
+ */
+public class DomainMasterIpDiscoveryTask implements TimerTask {
+
+    private final Logger log = getLogger(getClass());
+
+    private Timeout timeout;
+    private volatile boolean isStopped;
+    private EndPoint endPoint;
+    private Client client;
+
+    ObjectMapper mapper;
+
+    public DomainMasterIpDiscoveryTask(EndPoint endPoint, Client client,
+                                       ObjectMapper mapper) {
+        this.endPoint = endPoint;
+        this.client = client;
+        this.mapper = mapper;
+
+        isStopped = true;
+        start();
+
+    }
+
+    public synchronized void stop() {
+        if (!isStopped) {
+            isStopped = true;
+            timeout.cancel();
+        } else {
+            log.warn("IpDiscovery stopped multiple times?");
+        }
+    }
+
+    public synchronized void start() {
+        if (isStopped) {
+            isStopped = false;
+            timeout = Timer.getTimer().newTimeout(this, 0, SECONDS);
+        } else {
+            log.warn("IpDiscovery started multiple times?");
+        }
+    }
+
+    public synchronized boolean isStopped() {
+        return isStopped || timeout.isCancelled();
+    }
+
+    @Override
+    public void run(Timeout t) {
+        if (isStopped()) {
+            return;
+        }
+        for (IpAddress ipAddress : endPoint.ipAddresses()) {
+            String url = HTTP + COLON + DOUBLESLASH + ipAddress.toString() + COLON +
+                    endPoint.port() + BASE_URL + MASTER;
+            log.info("masterIp url: " + url);
+            WebTarget wt = client.target(url);
+            Response response = wt.request(MediaType.APPLICATION_JSON)
+                    .get();
+            if (response.getStatus() != Response.Status.OK.getStatusCode()) {
+                continue;
+            }
+            String stringBody = response.readEntity(String.class);
+            log.info("getLocalMasterIp() response: " + stringBody);
+            try {
+                ObjectNode responseBody = (ObjectNode) mapper.readTree(stringBody);
+                if (responseBody.path(RESULT).asText().equals(OK)) {
+                    IpAddress masterIpAdress =  IpAddress.valueOf(responseBody.path(MASTER_IP).asText());
+                    HttpClientInstance.INSTANCE.setMasterIp(endPoint, masterIpAdress);
+                    this.stop();
+                    return;
+                }
+            } catch (IOException ex) {
+                log.info("getLocalMasterIp() IOException, try next endpoint ip");
+            }
+        }
+
+        if (!isStopped()) {
+            timeout = Timer.getTimer().newTimeout(this, 3, SECONDS);
+        }
+    }
+}
+
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
new file mode 100644
index 0000000..cf16ab5
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
@@ -0,0 +1,427 @@
+/*
+ * 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.opencord.ce.global.channel.client;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Maps;
+import org.apache.commons.lang3.tuple.Pair;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.domain.DomainId;
+import org.onosproject.net.domain.DomainService;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.rest.AbstractWebResource;
+import org.onosproject.store.service.ConsistentMap;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.api.services.channel.RequestCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DELETE;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.DST_NI_LIST;
+import static org.opencord.ce.api.services.channel.Symbols.FC;
+import static org.opencord.ce.api.services.channel.Symbols.GET;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.POST;
+import static org.opencord.ce.api.services.channel.Symbols.SRC_NI;
+import static org.opencord.ce.api.services.channel.Symbols.UNI;
+import static org.onosproject.net.domain.DomainId.LOCAL;
+
+/**
+ *  Implementation of the listener methods for requesting {@link
+ *  org.opencord.ce.api.models.CarrierEthernetForwardingConstruct} configuration.
+ */
+public enum HttpClientInstance
+        implements MetroNetworkVirtualNodeService {
+    INSTANCE;
+    private final Logger log =
+            LoggerFactory.getLogger(HttpClientInstance.class);
+
+    private static final int STATUS_OK = Response.Status.OK.getStatusCode();
+    private static final int STATUS_REQ_UNPROCESSABLE = Response.Status.NOT_ACCEPTABLE.getStatusCode();
+
+    private final Map<DomainId, Pair<Client, EndPoint>> domainsEndPointsMap = Maps.newConcurrentMap();
+
+    private ConsistentMap<EndPoint, IpAddress> endPointMasterIpMap;
+
+    protected final Map<EndPoint, DomainMasterIpDiscoveryTask> ipDiscoveryTaskMap = Maps.newConcurrentMap();
+
+    private final AbstractWebResource codecContext = new AbstractWebResource();
+
+    private boolean configured = false;
+
+    private ClusterService clusterService;
+    private LeadershipService leadershipService;
+    private DomainService domainService;
+
+    private final ExecutorService networkExecutor =
+            newSingleThreadExecutor();
+           // newFixedThreadPool(5, groupedThreads("opencord/ecord-http", "event-handler"));
+
+    public void configure(ClusterService clusterService, LeadershipService leadershipService,
+                          DomainService domainService, ConsistentMap<EndPoint,
+            IpAddress> endPointMasterIpMap, ConnectionConfig connConfig) {
+
+        if (!configured) {
+            this.clusterService = clusterService;
+            this.leadershipService = leadershipService;
+            this.domainService = domainService;
+            this.endPointMasterIpMap = endPointMasterIpMap;
+            configured = true;
+        }
+        connConfig.endPoints().forEach(siteConfig -> {
+            DomainId domainId = siteConfig.domainId();
+            synchronized (this) {
+                domainsEndPointsMap.putIfAbsent(domainId,
+                        Pair.of(createClient(), siteConfig));
+                notify();
+            }
+            String topic = siteConfig.topic();
+            // TODO: add leadership listeners to react to changes
+            if (isLeader(topic)) {
+                log.info("I am the leader for domain: {} ", domainId);
+                probeMasterIp(siteConfig, domainsEndPointsMap.get(domainId).getLeft());
+            } else {
+                log.info("I am NOT the leader for domain: {}", domainId);
+
+            }
+        });
+    }
+
+    private void probeMasterIp(EndPoint endPoint, Client client) {
+        ipDiscoveryTaskMap.putIfAbsent(endPoint,
+                new DomainMasterIpDiscoveryTask(endPoint, client, codecContext.mapper()));
+    }
+
+    protected void setMasterIp(EndPoint endPoint, IpAddress ipAddress) {
+        synchronized (this) {
+            endPointMasterIpMap.put(endPoint, ipAddress);
+            notify();
+        }
+    }
+
+    public IpAddress getRemoteMasterIp(EndPoint endPoint) {
+        synchronized (this) {
+            return endPointMasterIpMap.get(endPoint).value();
+        }
+    }
+
+    public Client getConnectionInfo(DomainId domainId) {
+        return domainsEndPointsMap.get(domainId).getLeft();
+    }
+
+    private boolean checkReply(Response response) {
+        if (response != null) {
+            return checkStatusCode(response.getStatus());
+        }
+        log.error("Null reply from end point");
+        return false;
+    }
+
+    private boolean checkStatusCode(int statusCode) {
+        if (statusCode == STATUS_OK) {
+            return true;
+        } else {
+            log.error("Failed request, HTTP error code : "
+                    + statusCode);
+            return false;
+        }
+    }
+
+    private boolean isLeader(String topic) {
+        return leadershipService.getLeader(topic).id()
+                .equals(clusterService.getLocalNode().id().id());
+    }
+
+    private String getTopic(DomainId domainId) {
+        return domainsEndPointsMap.get(domainId).getRight().topic();
+    }
+
+    private Client createClient() {
+        return ClientBuilder.newClient();
+    }
+
+    public void stopNetworkTasks() {
+        ipDiscoveryTaskMap.forEach((ep, task) -> task.stop());
+    }
+
+    @Override
+    public void setNodeForwarding(CarrierEthernetForwardingConstruct fc, CarrierEthernetNetworkInterface srcNi,
+                                  Set<CarrierEthernetNetworkInterface> dstNiSet) {
+
+        DomainId domainId = domainService.getDomain(srcNi.cp().deviceId());
+        if (domainId == LOCAL || !isLeader(getTopic(domainId))) {
+            return;
+        }
+        JsonCodec<CarrierEthernetForwardingConstruct> fcCodec =
+                codecContext.codec(CarrierEthernetForwardingConstruct.class);
+        JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+                codecContext.codec(CarrierEthernetNetworkInterface.class);
+        ObjectNode body = codecContext.mapper().createObjectNode();
+
+        body.set(FC, fcCodec.encode(fc, codecContext));
+        body.set(SRC_NI, niCodec.encode(srcNi, codecContext));
+        ArrayNode dstNiJsonArrayNode = codecContext.mapper().createArrayNode();
+        dstNiSet.forEach(dstNi ->
+                dstNiJsonArrayNode.add(niCodec.encode(dstNi, codecContext)));
+        body.set(DST_NI_LIST, dstNiJsonArrayNode);
+/*
+        String fcId = fc.id().id();
+        VlanId fcTag = fc.vlanId();
+        ConnectPoint ingressCp  = srcNi.cp();
+        CarrierEthernetNetworkInterface.Type srcType = srcNi.type();
+        VlanId sTag = srcNi.sVlanId();
+        VlanId ceTag = srcNi.ceVlanId();
+        CarrierEthernetForwardingConstruct.Type fcType = fc.type();
+        ArrayList<Pair<ConnectPoint, CarrierEthernetNetworkInterface.Type>> egressList =
+                new ArrayList<>();
+        dstNiSet.forEach(dstNi -> egressList.add(Pair.of(dstNi.cp(), dstNi.type())));
+
+        ObjectNode jsonBody = codecContext.mapper().createObjectNode()
+                .put(FC_ID, fcId)
+                .put(FC_TAG, fcTag.toShort())
+                .put(FC_TYPE, fcType.toString())
+                .put(INGRESS_NI_TYPE, srcType.toString());
+        JsonCodec<ConnectPoint> cpCodec = codecContext.codec(ConnectPoint.class);
+        jsonBody.set(FC_INGRESS_CP, cpCodec.encode(ingressCp, codecContext));
+        jsonBody.put(INGRESS_FC_TAG, sTag.toShort())
+                .put(CUSTOMER_TAG, ceTag.toShort());
+        ArrayNode egressListNode = codecContext.newArray(jsonBody, FC_EGRESS_LST);
+        dstNiSet.forEach(dstNi -> {
+            ObjectNode item = codecContext.mapper().createObjectNode()
+                    .put(FC_EGRESS_TYPE, dstNi.type().toString());
+            item.set(FC_EGRESS_CP, cpCodec.encode(dstNi.cp(), codecContext));
+            egressListNode.add(item);
+        });
+        */
+        String resource = "/ForwardingConstruct";
+        networkExecutor.execute(new NetworkTask(domainId, POST, resource, body.toString(),
+                new RequestCallback() {
+                    @Override
+                    public void onSuccess(Response response) {
+                        log.info("FC request submit to domain: {}", domainId);
+
+                    }
+
+                    @Override
+                    public void onError(Response response) {
+                        log.error("FC call failure reason: {}", response.getStatusInfo());
+
+                    }
+                }));
+    }
+
+    @Override
+    public void createBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        DomainId domainId = domainService.getDomain(uni.cp().deviceId());
+        if (domainId == LOCAL || !isLeader(getTopic(domainId))) {
+            return;
+        }
+        String resource = "/createBwp";
+        networkExecutor.execute(new NetworkTask(domainId, POST, resource,
+                fcUniToRestBody(fc, uni).toString(),
+                new RequestCallback() {
+                    @Override
+                    public void onSuccess(Response response) {
+                        log.info("BW profile creation request submitted to domain: {}", domainId);
+                    }
+
+                    @Override
+                    public void onError(Response response) {
+                        log.error("BwProfile creation call fail: {}", response.getStatusInfo());
+
+                    }
+                }));
+    }
+
+    @Override
+    public void applyBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        DomainId domainId = domainService.getDomain(uni.cp().deviceId());
+        if (domainId == LOCAL || !isLeader(getTopic(domainId))) {
+            return;
+        }
+        String resource = "/applyBwp";
+        networkExecutor.execute(new NetworkTask(domainId, POST, resource, fcUniToRestBody(fc, uni).toString(),
+                new RequestCallback() {
+                    @Override
+                    public void onSuccess(Response response) {
+                        log.info("BW profile activation request submitted to domain: {}", domainId);
+                    }
+
+                    @Override
+                    public void onError(Response response) {
+                        log.error("FAIL BW profile activation: {}", response.getStatusInfo());
+
+                    }
+                }));
+    }
+
+    @Override
+    public void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        DomainId domainId = domainService.getDomain(uni.cp().deviceId());
+        if (domainId == LOCAL || !isLeader(getTopic(domainId))) {
+            return;
+        }
+        String resource = "/deleteBwp";
+        networkExecutor.execute(new NetworkTask(domainId, POST, resource,
+                fcUniToRestBody(fc, uni).toString(),
+                new RequestCallback() {
+                    @Override
+                    public void onSuccess(Response response) {
+                        log.info("BW profile creation request submitted to domain: {}", domainId);
+                    }
+
+                    @Override
+                    public void onError(Response response) {
+                        log.info("FAIL BW profile creation: {}", response.getStatusInfo());
+
+                    }
+                }));
+    }
+
+    @Override
+    public void removeAllForwardingResources(EvcConnId fcId) {
+        Set<DomainId> domainIds = domainService.getDomainIds();
+        String resource = "/deleteFcResources/" + fcId.id();
+        domainIds.forEach(domainId -> {
+            if (isLeader(getTopic(domainId))) {
+                networkExecutor.execute(new NetworkTask(domainId, DELETE, resource,
+                        null, new RequestCallback() {
+                            @Override
+                            public void onSuccess(Response response) {
+
+                            }
+
+                            @Override
+                            public void onError(Response response) {
+
+                            }
+                }));
+            }
+        });
+
+    }
+
+    private ObjectNode fcUniToRestBody(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        JsonCodec<CarrierEthernetForwardingConstruct> fcCodec =
+                codecContext.codec(CarrierEthernetForwardingConstruct.class);
+        JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+                codecContext.codec(CarrierEthernetNetworkInterface.class);
+        ObjectNode body = codecContext.mapper().createObjectNode();
+        body.set(FC, fcCodec.encode(fc, codecContext));
+        body.set(UNI, niCodec.encode(uni, codecContext));
+        return body;
+    }
+
+    private class NetworkTask implements Runnable {
+        private String method;
+        private String resource;
+        private String body;
+        private DomainId domainId;
+        private RequestCallback callback;
+
+        NetworkTask(DomainId domainId, String method, String resource, String body,
+                    RequestCallback callback) {
+            this.domainId = domainId;
+            this.method = method;
+            this.resource = resource;
+            this.body = body;
+            this.callback = callback;
+        }
+        @Override
+        public void run() {
+
+            synchronized (this) {
+                while (domainsEndPointsMap.get(domainId) == null) {
+                    log.info("End point object missing for domain {}." +
+                            "\nPossibly the Bundle configuration is missing ", domainId);
+                    try {
+                        wait();
+                    } catch (InterruptedException ie) {
+                        log.info("Interrupted exception: " + ie.getMessage());
+                    }
+
+                }
+            }
+            EndPoint endPoint = domainsEndPointsMap.get(domainId).getRight();
+            IpAddress ipAddress;
+            synchronized (this) {
+                while (!endPointMasterIpMap.containsKey(endPoint) ||
+                        endPointMasterIpMap.get(endPoint).value() == null) {
+                    try {
+                        log.info("wait() master ip");
+                        wait();
+                    } catch (InterruptedException ie) {
+                        log.info("Interrupted exception: " + ie.getMessage());
+                    }
+                }
+                ipAddress = endPointMasterIpMap.get(endPoint).value();
+            }
+
+
+            Client client = domainsEndPointsMap.get(domainId).getLeft();
+
+            String url = HTTP + COLON + DOUBLESLASH + ipAddress.toString() + COLON +
+                    endPoint.port() + BASE_URL + "/carrierethernet" + resource;
+            log.info("DEBUG {}: Sending data via http: {}", url, body);
+
+            WebTarget webTarget = client.target(url);
+            Response response;
+            switch (method) {
+                case POST:
+                    response = webTarget.request(MediaType.APPLICATION_JSON)
+                            .post(Entity.entity(body, MediaType.APPLICATION_JSON));
+                    break;
+                case DELETE:
+                    response = webTarget.request(MediaType.APPLICATION_JSON).delete();
+                    break;
+                case GET:
+                default:
+                    response = webTarget.request(MediaType.APPLICATION_JSON).get();
+                    break;
+            }
+
+            if (!checkReply(response)) {
+                callback.onError(response);
+            } else {
+                callback.onSuccess(response);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/package-info.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/package-info.java
new file mode 100644
index 0000000..cf86254
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the client-side communication channel APIs.
+ */
+package org.opencord.ce.global.channel.client;
\ No newline at end of file
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/package-info.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/package-info.java
new file mode 100644
index 0000000..0645657
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the communication channel APIs.
+ */
+package org.opencord.ce.global.channel;
\ No newline at end of file
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DeviceResource.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DeviceResource.java
new file mode 100644
index 0000000..377abf0
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DeviceResource.java
@@ -0,0 +1,109 @@
+/*
+ * 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.opencord.ce.global.channel.server;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.opencord.ce.api.services.virtualprovider.DefaultDomainVirtualDevice;
+import org.opencord.ce.api.services.virtualprovider.DomainVirtualDevice;
+import org.opencord.ce.api.services.virtualprovider.EcordDeviceProviderService;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Consumes;
+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;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Remote device REST control.
+ */
+@Path("/topology/{domainId}")
+public class DeviceResource extends AbstractWebResource {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private EcordDeviceProviderService ecordDeviceProviderService =
+            get(EcordDeviceProviderService.class);
+
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("{deviceId}")
+    public Response postDevice(@PathParam("domainId") String domainId, @PathParam("deviceId") String deviceId,
+                               InputStream stream) {
+        log.info("Notified device from domainId {}", domainId);
+        try {
+            JsonNode responseBody = mapper().readTree(stream);
+            // the json body superfluous now. Can be used to add annotations to the device later
+            log.debug(responseBody.toString());
+            DomainVirtualDevice domainDevice = new DefaultDomainVirtualDevice(DeviceId.deviceId(deviceId),
+                    DomainId.domainId(domainId));
+            ecordDeviceProviderService.connectRemoteDevice(domainDevice);
+            return Response.status(200).build();
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+    }
+
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("{deviceId}/ports")
+    public Response postBigSwitchPorts(@PathParam("domainId") String domainId, @PathParam("deviceId") String deviceId,
+                                       InputStream stream) {
+        log.info("Notified device port from domainId {}", domainId);
+        try {
+            JsonNode responseBody = mapper().readTree(stream);
+            log.debug(responseBody.toString());
+            JsonCodec<Port> portCodec = codec(Port.class);
+            List<PortDescription> ports = new ArrayList<>();
+            responseBody.forEach(item -> {
+                Port port = portCodec.decode((ObjectNode) item, this);
+                DefaultAnnotations.Builder annot = DefaultAnnotations.builder();
+                port.annotations().keys()
+                        .forEach(k -> annot.set(k, port.annotations().value(k)));
+                ports.add(new DefaultPortDescription(port.number(), port.isEnabled(), port.type(),
+                        port.portSpeed(), annot.build()));
+            });
+
+            ecordDeviceProviderService.addOrUpdateRemotePorts(DomainId.domainId(domainId),
+                    DeviceId.deviceId(deviceId), ports);
+            return Response.status(200).build();
+
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DomainMasterIpResource.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DomainMasterIpResource.java
new file mode 100644
index 0000000..6ba8469
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/DomainMasterIpResource.java
@@ -0,0 +1,62 @@
+/*
+ * 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.opencord.ce.global.channel.server;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.IpAddress;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.services.channel.ConnectionService;
+import org.slf4j.Logger;
+
+import javax.ws.rs.GET;
+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 static org.opencord.ce.api.services.channel.Symbols.MASTER_API_NO_IP_BODY;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Gets the ip of the instance leader of the communication with the specified
+ * domainId.
+ */
+@Path("master/{domainId}")
+public class DomainMasterIpResource extends AbstractWebResource {
+    private final Logger log = getLogger(getClass());
+
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getMasterIp(@PathParam("domainId") String id) {
+        log.info("Domain {} asks who is the master for him", id);
+
+        IpAddress ip = get(ConnectionService.class).getLocalMasterIp(id);
+        if (ip != null) {
+            ObjectNode body = mapper().createObjectNode();
+            body.put(RESULT, OK);
+            body.put(MASTER_IP, ip.toString());
+
+            return ok(body.toString()).build();
+        } else {
+            return ok(MASTER_API_NO_IP_BODY).build();
+        }
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/EcordGlobalRestApp.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/EcordGlobalRestApp.java
new file mode 100644
index 0000000..bd0691f
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/EcordGlobalRestApp.java
@@ -0,0 +1,32 @@
+/*
+ * 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.opencord.ce.global.channel.server;
+
+import org.onlab.rest.AbstractWebApplication;
+
+import java.util.Set;
+
+/**
+ * Loader class for web resource APIs.
+ */
+public class EcordGlobalRestApp extends AbstractWebApplication {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return getClasses(DeviceResource.class, DomainMasterIpResource.class);
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/package-info.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/package-info.java
new file mode 100644
index 0000000..f75a73a
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the server-side communication channel APIs.
+ */
+package org.opencord.ce.global.channel.server;
\ No newline at end of file
diff --git a/global/http-channel/src/main/webapp/WEB-INF/web.xml b/global/http-channel/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..7155765
--- /dev/null
+++ b/global/http-channel/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         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>ECORD REST API v1.0</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.opencord.ce.global.channel.server.EcordGlobalRestApp</param-value>
+        </init-param>
+        <load-on-startup>10</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/global/pom.xml b/global/pom.xml
new file mode 100644
index 0000000..73f6798
--- /dev/null
+++ b/global/pom.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord</groupId>
+        <artifactId>ce</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>global</artifactId>
+    <packaging>pom</packaging>
+
+    <description>Orchestration logic of Carrier Ethernet Forwarding Constructs</description>
+
+    <properties>
+        <onos.version>1.10.3</onos.version>
+        <onos.app.title>ECORD global orchestrator</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <modules>
+        <module>ce-orchestration</module>
+        <module>virtualprovider</module>
+        <module>http-channel</module>
+        <module>app</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>ce-api</artifactId>
+            <version>${project.version}</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/global/virtualprovider/pom.xml b/global/virtualprovider/pom.xml
new file mode 100644
index 0000000..a995b1f
--- /dev/null
+++ b/global/virtualprovider/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>global</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>virtualprovider</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Topology provider in the global orchestrator</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.global.vprovider</onos.app.name>
+        <onos.version>1.10.3</onos.version>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <project.version>1.0.0</project.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualDomainDeviceProvider.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualDomainDeviceProvider.java
new file mode 100644
index 0000000..55d89c3
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualDomainDeviceProvider.java
@@ -0,0 +1,389 @@
+/*
+ * 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.opencord.ce.global.virtualdomain;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+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.apache.felix.scr.annotations.Service;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.opencord.ce.api.services.virtualprovider.DomainVirtualDevice;
+import org.opencord.ce.api.services.virtualprovider.EcordDeviceProviderService;
+import org.onlab.packet.ChassisId;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.mastership.MastershipAdminService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+import org.onosproject.net.provider.ProviderId;
+import org.opencord.ce.api.models.CarrierEthernetEnni;
+import org.opencord.ce.api.models.CarrierEthernetGenericNi;
+import org.opencord.ce.api.models.CarrierEthernetInni;
+import org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.services.MetroOrchestrationService;
+import org.opencord.ce.global.virtualdomain.config.EcordDriverConfig;
+import org.opencord.ce.global.virtualdomain.config.XosEndPointConfig;
+import org.slf4j.Logger;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+
+import static java.util.concurrent.Executors.newFixedThreadPool;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.net.AnnotationKeys.DRIVER;
+import static org.onosproject.net.AnnotationKeys.LATITUDE;
+import static org.onosproject.net.AnnotationKeys.LONGITUDE;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.api.models.CarrierEthernetNetworkInterface.Type;
+
+/**
+ * Exposes remote domain devices to the core.
+ */
+@Component(immediate = true)
+@Service(value = EcordDeviceProviderService.class)
+public class VirtualDomainDeviceProvider
+        implements DeviceProvider, EcordDeviceProviderService {
+    private final Logger log = getLogger(getClass());
+    public static final String PROVIDER_NAME = "org.opencord.ce.global.vprovider";
+    public static final ProviderId PROVIDER_ID = new ProviderId("domain", PROVIDER_NAME);
+    private static final String UNKNOWN = "unknown";
+    private static final String NO_LLDP = "no-lldp";
+    private static final String DOMAIN_ID = "domainId";
+    private static final String MEF_IF_TYPE = "mefIfType";
+
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry configRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceProviderRegistry deviceProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MastershipAdminService mastershipAdminService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MetroOrchestrationService metroOrchestrationService;
+
+    protected DeviceProviderService deviceProviderService;
+
+    private EcordDriverConfig ecordDriverConfig;
+    private XoSHttpClient xoSHttpClient;
+
+    private final NetworkConfigListener configListener = new InternalConfigListener();
+
+    /*
+    private final ConfigFactory<ApplicationId, EcordDriverConfig> diverConfigFactory =
+            new ConfigFactory<ApplicationId, EcordDriverConfig>(APP_SUBJECT_FACTORY,
+                    EcordDriverConfig.class, "driver") {
+                @Override
+                public EcordDriverConfig createConfig() {
+                    return new EcordDriverConfig();
+                }
+            };
+            */
+
+    private final ConfigFactory<ApplicationId, XosEndPointConfig> xosEndpointConfigFactory =
+            new ConfigFactory<ApplicationId, XosEndPointConfig>(SubjectFactories.APP_SUBJECT_FACTORY,
+                    XosEndPointConfig.class, "xos") {
+                @Override
+                public XosEndPointConfig createConfig() {
+                    return new XosEndPointConfig();
+                }
+            };
+
+    private final ExecutorService eventExecutor =
+            newFixedThreadPool(3,
+                    groupedThreads("onos/ecord-sb-manager", "event-handler-%d"));
+
+    @Activate
+    public void activate() {
+        appId = coreService.registerApplication(PROVIDER_NAME);
+       // configRegistry.registerConfigFactory(diverConfigFactory);
+        configRegistry.registerConfigFactory(xosEndpointConfigFactory);
+        configService.addListener(configListener);
+        deviceProviderService = deviceProviderRegistry.register(this);
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        //configRegistry.unregisterConfigFactory(diverConfigFactory);
+        configRegistry.unregisterConfigFactory(xosEndpointConfigFactory);
+        configService.removeListener(configListener);
+        deviceProviderRegistry.unregister(this);
+        log.info("Stopped");
+    }
+
+    @Override
+    public ProviderId id() {
+        return PROVIDER_ID;
+    }
+
+    // ==== DeviceProvider ====
+    @Override
+    public void triggerProbe(DeviceId deviceId) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void roleChanged(DeviceId deviceId, MastershipRole newRole) {
+
+    }
+
+    @Override
+    public boolean isReachable(DeviceId deviceId) {
+        // TODO
+        return true;
+    }
+
+    @Override
+    public void changePortState(DeviceId deviceId, PortNumber portNumber,
+                                boolean enable) {
+        // TODO
+    }
+
+    // ===== EcordDeviceProviderService =====
+    @Override
+    public void connectRemoteDevice(DomainVirtualDevice domainDevice) {
+        DomainId domainId = domainDevice.domainId();
+        DeviceId deviceId = domainDevice.deviceId();
+        advertiseDevice(deviceId, domainId);
+       // advertiseDevicePorts(deviceId, domainDevice.ports());
+    }
+
+    @Override
+    public void addOrUpdateRemotePorts(DomainId domainId, DeviceId deviceId,
+                                       List<PortDescription> ports) {
+        advertiseDevicePorts(deviceId, ports);
+    }
+
+    @Override
+    public void addRemotePort(DomainId domainId, DeviceId deviceId, Port newPort) {
+    }
+
+    @Override
+    public void updateRemotePortState(DomainId domainId, DeviceId deviceId, Port port) {
+        // TODO
+    }
+
+    @Override
+    public void disconnectRemoteDevice(DomainId domainId, DeviceId deviceId) {
+        disconnectDevice(deviceId);
+    }
+
+    @Override
+    public void removeRemotePort(DomainId domainId, DeviceId deviceId, PortNumber portNumber) {
+        // TODO
+    }
+
+    /**
+     * Notify the core system that a new domain device is on.
+     * @param deviceId remote device identifier
+     */
+    private void advertiseDevice(DeviceId deviceId, DomainId domainId) {
+        ChassisId chassisId = new ChassisId();
+        log.info("Notifying ecord virtual device...");
+        mastershipAdminService.setRole(clusterService.getLocalNode().id(), deviceId,
+                MastershipRole.MASTER);
+
+        // disable lldp for this virtual device and annotate it with the proper driver
+       // String driverKey = ecordDriverConfig.manufacturer() + "-" + ecordDriverConfig.hwVersion() + "-" +
+         //       ecordDriverConfig.swVersion();
+        String driverKey = "onLab-1.0.0-1.0.0";
+        SparseAnnotations annotations = DefaultAnnotations.builder()
+                .set(NO_LLDP, "any")
+                .set(DOMAIN_ID, domainId.id())
+                .set(DRIVER, driverKey)
+                .build();
+
+        DeviceDescription deviceDescription = new DefaultDeviceDescription(
+                deviceId.uri(),
+                Device.Type.SWITCH,
+                "onLab", "1.0.0",
+                "1.0.0", UNKNOWN,
+                chassisId,
+                annotations);
+        deviceProviderService.deviceConnected(deviceId, deviceDescription);
+    }
+
+    /**
+     * Notify the core system of all ports of a domain device.
+     * @param deviceId device identifier
+     * @param portDescriptions description of ports
+     */
+    private void advertiseDevicePorts(DeviceId deviceId, List<PortDescription> portDescriptions) {
+        log.info("Notifying ecord virtual ports...");
+        deviceProviderService.updatePorts(deviceId, portDescriptions);
+       // addGlobalMefLtp(deviceId, portDescriptions);
+        notifyXoS(deviceId, portDescriptions);
+    }
+
+    private void disconnectDevice(DeviceId deviceId) {
+        deviceProviderService.deviceDisconnected(deviceId);
+    }
+
+    private void notifyXoS(DeviceId deviceId, List<PortDescription> portDescriptions) {
+        portDescriptions.forEach(port -> {
+            if (port.annotations().keys().contains(MEF_IF_TYPE)) {
+                Type type = Type.valueOf(
+                        port.annotations().value(MEF_IF_TYPE));
+                ConnectPoint cp = new ConnectPoint(deviceId, port.portNumber());
+                switch (type) {
+                    case UNI:
+                        ObjectNode body = xoSHttpClient.mapper().createObjectNode();
+                        body.put("tenant", port.annotations().value(DOMAIN_ID));
+                        body.put("name", "UNI:" + cp.toString());
+                        body.put("latlng", "[" + port.annotations().value(LATITUDE) + "," +
+                                port.annotations().value(LONGITUDE) + "]");
+                        body.put("cpe_id", cp.toString());
+                        xoSHttpClient.restPut(body.toString(), cp.toString());
+                        break;
+                    case ENNI:
+
+                        break;
+                    case INNI:
+
+                        break;
+                    case GENERIC:
+
+                        break;
+                    default:
+                        return;
+                }
+            }
+        });
+    }
+
+    /**
+     * Adds global {@link CarrierEthernetLogicalTerminationPoint}
+     * to {@link MetroOrchestrationService}.
+     *
+     * @param deviceId subject device ID
+     * @param portDescriptions list of notified ports
+     */
+    private void addGlobalMefLtp(DeviceId deviceId, List<PortDescription> portDescriptions) {
+        portDescriptions.forEach(port -> {
+            if (port.annotations().keys().contains(MEF_IF_TYPE)) {
+                Type type = Type.valueOf(
+                        port.annotations().value(MEF_IF_TYPE));
+                CarrierEthernetNetworkInterface ni;
+                ConnectPoint cp = new ConnectPoint(deviceId, port.portNumber());
+                switch (type) {
+                    case UNI:
+                        ni = CarrierEthernetUni.builder()
+                                .cp(cp)
+                                .annotations(port.annotations())
+                                .build();
+                        break;
+                    case ENNI:
+                        ni = CarrierEthernetEnni.builder()
+                                .cp(cp)
+                                .build();
+                        break;
+                    case INNI:
+                        ni = CarrierEthernetInni.builder()
+                                .cp(cp)
+                                .annotations(port.annotations())
+                                .build();
+                        break;
+                    case GENERIC:
+                        ni = new CarrierEthernetGenericNi(cp, null, port.annotations());
+                        break;
+                    default:
+                            return;
+                }
+                metroOrchestrationService.addGlobalLtp(
+                        new CarrierEthernetLogicalTerminationPoint(null, ni));
+            }
+        });
+    }
+
+    private void readXoSEndPointConfig() {
+        xoSHttpClient =
+                new XoSHttpClient(configRegistry.getConfig(appId, XosEndPointConfig.class).xos());
+    }
+
+    private void readDriverFromConfig() {
+        ecordDriverConfig =
+                configRegistry.getConfig(appId, EcordDriverConfig.class);
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if (!event.configClass().equals(EcordDriverConfig.class) ||
+                    !event.configClass().equals(XosEndPointConfig.class)) {
+                return;
+            }
+            switch (event.type()) {
+                case CONFIG_ADDED:
+                    log.info("Network configuration added");
+                    if (event.configClass().equals(EcordDriverConfig.class)) {
+                        eventExecutor.execute(VirtualDomainDeviceProvider.this::readDriverFromConfig);
+                    } else {
+                        eventExecutor.execute(VirtualDomainDeviceProvider.this::readXoSEndPointConfig);
+                    }
+
+                    break;
+                case CONFIG_UPDATED:
+                    log.info("Network configuration updated");
+                    if (event.configClass().equals(EcordDriverConfig.class)) {
+                        eventExecutor.execute(VirtualDomainDeviceProvider.this::readDriverFromConfig);
+                    } else {
+                        eventExecutor.execute(VirtualDomainDeviceProvider.this::readXoSEndPointConfig);
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualLinkProvider.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualLinkProvider.java
new file mode 100644
index 0000000..b284a59
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualLinkProvider.java
@@ -0,0 +1,218 @@
+/*
+ * 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.opencord.ce.global.virtualdomain;
+
+import com.google.common.collect.Maps;
+import org.apache.commons.lang3.tuple.Pair;
+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.core.CoreService;
+import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.link.DefaultLinkDescription;
+import org.onosproject.net.link.LinkDescription;
+import org.onosproject.net.link.LinkEvent;
+import org.onosproject.net.link.LinkListener;
+import org.onosproject.net.link.LinkProvider;
+import org.onosproject.net.link.LinkProviderRegistry;
+import org.onosproject.net.link.LinkProviderService;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.net.provider.ProviderId;
+import org.opencord.ce.api.services.virtualprovider.LinkId;
+import org.slf4j.Logger;
+
+import java.util.Map;
+
+import static org.onosproject.net.Link.Type.INDIRECT;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.global.virtualdomain.VirtualDomainDeviceProvider.PROVIDER_NAME;
+
+/**
+ * Domain interlinks provider.
+ */
+@Component(immediate = true)
+public class VirtualLinkProvider implements LinkProvider {
+    public static final ProviderId PROVIDER_ID = new ProviderId("domain", PROVIDER_NAME);
+    public static final String INTERLINK_ID = "interlinkId";
+    private final Logger log = getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkProviderRegistry linkProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MastershipService mastershipService;
+
+    private final Map<LinkId, ConnectPoint> stagedInterlinks = Maps.newConcurrentMap();
+    private final Map<LinkId, Pair<ConnectPoint, ConnectPoint>>
+            committedInterlinks = Maps.newConcurrentMap();
+    private final DeviceListener deviceListener = new InternalDeviceListener();
+    private final LinkListener linkListener = new InternalLinkListener();
+
+    protected LinkProviderService linkProviderService;
+
+    @Activate
+    public void activate() {
+        coreService.registerApplication(PROVIDER_NAME);
+        linkProviderService = linkProviderRegistry.register(this);
+        deviceService.addListener(deviceListener);
+        linkService.addListener(linkListener);
+        log.info("Started");
+
+    }
+
+    @Deactivate
+    public void deactivate() {
+        linkProviderRegistry.unregister(this);
+        deviceService.removeListener(deviceListener);
+        linkService.removeListener(linkListener);
+        log.info("Stopped");
+    }
+
+
+    @Override
+    public ProviderId id() {
+        return PROVIDER_ID;
+    }
+
+    private void addInterLink(ConnectPoint point1, ConnectPoint point2, LinkId linkId) {
+        SparseAnnotations annotations = DefaultAnnotations.builder()
+                .set(INTERLINK_ID, linkId.id())
+                .build();
+        LinkDescription linkDescription = new DefaultLinkDescription(point1, point2,
+                INDIRECT, true, annotations);
+        linkProviderService.linkDetected(linkDescription);
+    }
+
+    private class InternalLinkListener implements LinkListener {
+
+        @Override
+        public void event(LinkEvent event) {
+            Link link = event.subject();
+            switch (event.type()) {
+                case LINK_REMOVED:
+                   if (link.annotations().keys().contains(INTERLINK_ID)) {
+                       committedInterlinks.remove(LinkId.linkId(
+                               link.annotations().value(INTERLINK_ID)
+                       ));
+                   }
+                case LINK_ADDED:
+                    // not relevant for now
+                default:
+            }
+        }
+    }
+
+
+    private class InternalDeviceListener implements DeviceListener {
+        @Override
+        public boolean isRelevant(DeviceEvent event) {
+            return (event.type().equals(DeviceEvent.Type.PORT_ADDED) ||
+                    event.type().equals(DeviceEvent.Type.PORT_REMOVED) ||
+                    event.type().equals(DeviceEvent.Type.PORT_UPDATED)) &&
+                    event.port().annotations().keys().contains(INTERLINK_ID);
+        }
+
+        @Override
+        public void event(DeviceEvent event) {
+
+            Port port = event.port();
+            DeviceId subjectDeviceId = event.subject().id();
+            LinkId linkId = LinkId.linkId(port.annotations().value(INTERLINK_ID));
+
+            switch (event.type()) {
+                case PORT_ADDED:
+                case PORT_UPDATED:
+                    if (committedInterlinks.containsKey(linkId)) {
+                        // !!!! ===== !!!! //
+                        // committed interlinks cannot be subject to changes
+                        // unless a port is removed.
+                        // Possibly this is an error condition
+                        log.info("notified interlinks cannot be subject to changes," +
+                                "unless a port of the link is removed. Possibly this is" +
+                                "an error condition");
+                        return;
+                    } else {
+                        log.info("Adding virtual inter-links...");
+                        if (stagedInterlinks.containsKey(linkId)) {
+                            ConnectPoint point1 =
+                                    stagedInterlinks.get(linkId);
+                            ConnectPoint point2 =
+                                    new ConnectPoint(subjectDeviceId, port.number());
+                            if (subjectDeviceId.equals(point1.deviceId())) {
+                                return;
+                            }
+
+                            committedInterlinks.put(linkId, Pair.of(point1, point2));
+                            stagedInterlinks.remove(linkId);
+
+                            // only the master instance of the destination link can notify the link
+                            if (mastershipService.getLocalRole(point2.deviceId())
+                                    .equals(MastershipRole.MASTER)) {
+                                addInterLink(point1, point2, linkId);
+                            }
+                            if (mastershipService.getLocalRole(point1.deviceId())
+                                    .equals(MastershipRole.MASTER)) {
+                                addInterLink(point2, point1, linkId);
+                            }
+                        } else {
+                            stagedInterlinks.put(linkId,
+                                    new ConnectPoint(subjectDeviceId, port.number()));
+                        }
+                    }
+                    break;
+                case PORT_REMOVED:
+                    if (committedInterlinks.containsKey(linkId)) {
+                        Pair<ConnectPoint, ConnectPoint> points =
+                                committedInterlinks.get(linkId);
+                        committedInterlinks.remove(linkId);
+                        if (points.getLeft().deviceId().equals(subjectDeviceId)) {
+                            linkProviderService.linksVanished(points.getLeft());
+                            stagedInterlinks.put(linkId, points.getRight());
+                        } else {
+                            linkProviderService.linksVanished(points.getRight());
+                            stagedInterlinks.put(linkId, points.getLeft());
+                        }
+                    } else if (stagedInterlinks.containsKey(linkId)) {
+                        stagedInterlinks.remove(linkId);
+                    }
+                    break;
+                default:
+            }
+        }
+    }
+}
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/XoSHttpClient.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/XoSHttpClient.java
new file mode 100644
index 0000000..7c80334
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/XoSHttpClient.java
@@ -0,0 +1,69 @@
+/*
+ * 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.opencord.ce.global.virtualdomain;
+
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.glassfish.jersey.client.ClientProperties;
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static java.net.HttpURLConnection.HTTP_OK;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.global.virtualdomain.config.XosEndPointConfig.XosEndPoint;
+
+/**
+ * Implementation of REST client for XOS Metro-net service.
+ */
+public class XoSHttpClient extends AbstractWebResource {
+    protected final Logger log = getLogger(getClass());
+
+    private static final int DEFAULT_TIMEOUT_MS = 2000;
+
+    private XosEndPoint xosEndPoint;
+    private final Client client = ClientBuilder.newClient();
+
+
+    public XoSHttpClient(XosEndPoint xosEndPoint) {
+        this.xosEndPoint = xosEndPoint;
+
+        client.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_TIMEOUT_MS);
+        client.property(ClientProperties.READ_TIMEOUT, DEFAULT_TIMEOUT_MS);
+        mapper().enable(SerializationFeature.INDENT_OUTPUT);
+    }
+
+    public void restPut(String body, String cpeId) {
+        WebTarget webTarget = client.target("http://" + xosEndPoint.ipAddress().toString() +
+                 xosEndPoint.resource() + "/" + cpeId);
+        Response response;
+        response = webTarget.request(MediaType.APPLICATION_JSON)
+                .put(Entity.entity(body, MediaType.APPLICATION_JSON));
+        try {
+            if (response.getStatus() != HTTP_OK) {
+                log.warn("Failed to put resource {}", xosEndPoint.resource());
+            }
+        } catch (javax.ws.rs.ProcessingException e) {
+            log.error("Javax process exception in XoSClientHttp: {}", e.getMessage());
+        }
+    }
+}
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/EcordDriverConfig.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/EcordDriverConfig.java
new file mode 100644
index 0000000..b47684d
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/EcordDriverConfig.java
@@ -0,0 +1,44 @@
+/*
+ * 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.opencord.ce.global.virtualdomain.config;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+
+/**
+ * ICONA driver configuration class.
+ */
+public class EcordDriverConfig extends Config<ApplicationId> {
+
+    private static final String MANUFACTURER = "manufacturer";
+    private static final String SW_VERSION = "swVersion";
+    private static final String HW_VERSION = "hwVersion";
+
+
+    public String manufacturer() {
+        return object.get(MANUFACTURER).asText();
+    }
+
+    public String swVersion() {
+        return object.get(SW_VERSION).asText();
+    }
+
+    public String hwVersion() {
+        return  object.get(HW_VERSION).asText();
+    }
+
+}
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/XosEndPointConfig.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/XosEndPointConfig.java
new file mode 100644
index 0000000..3ac0fcd
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/XosEndPointConfig.java
@@ -0,0 +1,74 @@
+/*
+ * 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.opencord.ce.global.virtualdomain.config;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+
+/**
+ * Global XoS endpoint.
+ */
+public class XosEndPointConfig extends Config<ApplicationId> {
+    private static final String USERNAME = "username";
+    private static final String PASSWD = "password";
+    private static final String XOS = "xos";
+    private static final String ADDRESS = "address";
+    private static final String RESOURCE = "resource";
+
+    public XosEndPoint xos() {
+        JsonNode xosNode = object.path(XOS);
+        IpAddress ipAddress = IpAddress.valueOf(xosNode.get(ADDRESS).asText());
+        String username = xosNode.get(USERNAME).asText();
+        String password = xosNode.get(PASSWD).asText();
+        String resource = xosNode.get(RESOURCE).asText();
+        return new XosEndPoint(ipAddress, username, password, resource);
+    }
+
+    public static class XosEndPoint {
+        private IpAddress ipAddress;
+        private String username;
+        private String password;
+        private String resource;
+
+        public XosEndPoint(IpAddress ipAddress, String username,
+                           String password, String resource) {
+            this.ipAddress = ipAddress;
+            this.username = username;
+            this.password = password;
+            this.resource = resource;
+        }
+
+        public IpAddress ipAddress() {
+            return ipAddress;
+        }
+
+        public String username() {
+            return username;
+        }
+
+        public String password() {
+            return password;
+        }
+
+        public String resource() {
+            return resource;
+        }
+    }
+
+}
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/package-info.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/package-info.java
new file mode 100644
index 0000000..e59159b
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/config/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Configuration classes.
+ */
+package org.opencord.ce.global.virtualdomain.config;
\ No newline at end of file
diff --git a/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/package-info.java b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/package-info.java
new file mode 100644
index 0000000..987a1b9
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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 for domain topology provider.
+ */
+package org.opencord.ce.global.virtualdomain;
\ No newline at end of file
diff --git a/local/bigswitch/pom.xml b/local/bigswitch/pom.xml
new file mode 100644
index 0000000..00baf3c
--- /dev/null
+++ b/local/bigswitch/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>bigswitch</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Big switch abstraction topology</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.bigswitch</onos.app.name>
+        <onos.app.title>ECORD-CE App</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <project.version>1.0.0</project.version>
+        <onos.version>1.10.3</onos.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-core-serializers</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-cli</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <version>3.0.5</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchEvent.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchEvent.java
new file mode 100644
index 0000000..6876ce1
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchEvent.java
@@ -0,0 +1,91 @@
+/*
+ * 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.opencord.ce.local.bigswitch;
+
+import com.google.common.collect.ImmutableList;
+import org.onosproject.event.AbstractEvent;
+import org.onosproject.net.device.PortDescription;
+
+import java.util.List;
+
+
+// TODO probably Event subject should contain Device info.
+//      e.g., (DeviceId, PortDescription)
+public class BigSwitchEvent extends AbstractEvent<BigSwitchEvent.Type, PortDescription> {
+    private List<PortDescription> allPorts;
+
+    public enum Type {
+
+        /**
+         * Signifies the Big Switch abstraction is created.
+         */
+        DEVICE_CREATED,
+
+        /**
+         * Signifies the Big Switch abstraction is finished.
+         */
+        DEVICE_REMOVED,
+
+        /**
+         * Signifies a port was added to the big switch.
+         */
+        PORT_ADDED,
+        /**
+         * Signifies a port was removed from the big switch.
+         */
+        PORT_REMOVED,
+        /**
+         * Signifies a port was updated in the big switch.
+         */
+        PORT_UPDATED
+    }
+
+    /**
+     * Creates a new big switch event.
+     *
+     * @param type event type
+     * @param subject the port description
+     * @param allPorts list of all switch ports
+     */
+    public BigSwitchEvent(Type type, PortDescription subject, List<PortDescription> allPorts) {
+        super(type, subject);
+        this.allPorts = allPorts;
+    }
+
+    /**
+     * Creates a new big switch event.
+     *
+     * @param type event type
+     * @param subject the port description
+     * @param allPorts list of all switch ports
+     * @param time occurence time
+     */
+    public BigSwitchEvent(Type type, PortDescription subject, List<PortDescription> allPorts,
+                          long time) {
+        super(type, subject, time);
+        this.allPorts = allPorts;
+    }
+
+    /**
+     * Returns list of ports known by this instance object.
+     *
+     * @return list of all ports
+     */
+    public List<PortDescription> allPorts() {
+        return ImmutableList.copyOf(allPorts);
+    }
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchListener.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchListener.java
new file mode 100644
index 0000000..5543553
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchListener.java
@@ -0,0 +1,25 @@
+/*
+ * 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.opencord.ce.local.bigswitch;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Component to inform about big switch updates.
+ */
+public interface BigSwitchListener extends EventListener<BigSwitchEvent> {
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchManager.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchManager.java
new file mode 100644
index 0000000..979cafb
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchManager.java
@@ -0,0 +1,488 @@
+/*
+ * 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.opencord.ce.local.bigswitch;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+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.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.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.event.AbstractListenerManager;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+import org.onosproject.net.edge.EdgePortEvent;
+import org.onosproject.net.edge.EdgePortListener;
+import org.onosproject.net.edge.EdgePortService;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.AtomicCounter;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.Versioned;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static org.onlab.util.Tools.get;
+import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
+import static org.opencord.ce.api.services.channel.Symbols.DOMAIN_ID;
+import static org.opencord.ce.api.services.channel.Symbols.MEF_PORT_TYPE;
+import static org.opencord.ce.local.bigswitch.MefPortsConfig.INTERLINK_ID;
+import static org.opencord.ce.local.bigswitch.MefPortsConfig.MEF_PORTS;
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.local.bigswitch.MefPortsConfig.MefPortConfig;
+
+/**
+ * Listens for edge and port changes in the underlying data path and
+ * exposes a big switch abstraction.
+ */
+@Component(immediate = true)
+@Service
+public class BigSwitchManager
+        extends AbstractListenerManager<BigSwitchEvent, BigSwitchListener>
+        implements BigSwitchService {
+    private static final Logger log = getLogger(BigSwitchManager.class);
+    private static final String APP_NAME = "org.opencord.ce.local.bigswitch";
+
+    public static final String REALIZED_BY = "bigswitch:realizedBy";
+    public static final String DEFAULT_DOMAIN_ID = "local-domain";
+
+    private static final String PORT_MAP = "ecord-port-map";
+    private static final String PORT_COUNTER = "ecord-port-counter";
+    private static final Serializer SERIALIZER = Serializer.using(KryoNamespaces.API);
+    private ApplicationId appId;
+    private final NetworkConfigListener configListener = new InternalConfigListener();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry configRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected EdgePortService edgePortService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected StorageService storageService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService networkConfigService;
+
+    @Property(name = DOMAIN_ID, value = DEFAULT_DOMAIN_ID, label = "Domain ID where this ONOS is running")
+    private String siteId = DEFAULT_DOMAIN_ID;
+
+    private static final String PROP_ENABLED = "enabled";
+    @Property(name = PROP_ENABLED, boolValue = true,
+            label = "If false, DEVICE_CREATED event is never triggered")
+    private boolean enabled = true;
+
+    private final ExecutorService executorService =
+            Executors.newSingleThreadExecutor();
+
+    // MEF ports given by configuration
+    private static List<MefPortConfig> mefPortConfigs;
+
+    /**
+     * Holds the physical port to virtual port number mapping.
+     */
+    private ConsistentMap<ConnectPoint, Long> portMap;
+
+    // Counter for virtual port numbers
+    private AtomicCounter portCounter;
+
+    // TODO listen to portMap event and populate Cache to properly deal with
+    // TODO distributed deployment.
+    /**
+     * History of physical port to virtual port number mapping.
+     * Intended to avoid virtual port number explosion.
+     */
+    private LoadingCache<ConnectPoint, Long> p2vMap;
+
+    // TODO: Add other listeners once we decide what an edge really is
+    private EdgePortListener edgeListener = new InternalEdgeListener();
+    private DeviceListener deviceListener = new InternalDeviceListener();
+
+    private final ConfigFactory<ApplicationId, MefPortsConfig> configFactory =
+            new ConfigFactory<ApplicationId, MefPortsConfig>(APP_SUBJECT_FACTORY,
+                    MefPortsConfig.class, MEF_PORTS, true) {
+        @Override
+        public MefPortsConfig createConfig() {
+            return new MefPortsConfig();
+        }
+    };
+
+    @Activate
+    public void activate() {
+        appId = coreService.getAppId(APP_NAME);
+        configRegistry.registerConfigFactory(configFactory);
+        networkConfigService.addListener(configListener);
+        //deviceService = opticalView(deviceService);
+        portMap = storageService.<ConnectPoint, Long>consistentMapBuilder()
+                .withName(PORT_MAP)
+                .withSerializer(SERIALIZER)
+                .build();
+        portCounter = storageService.atomicCounterBuilder()
+                .withName(PORT_COUNTER)
+                .withMeteringDisabled()
+                .build()
+                .asAtomicCounter();
+        p2vMap = CacheBuilder.newBuilder()
+                .build(CacheLoader.from(portCounter::getAndIncrement));
+
+        eventDispatcher.addSink(BigSwitchEvent.class, listenerRegistry);
+        portCounter.compareAndSet(0, 1);
+       // edgePortService.addListener(edgeListener);
+        deviceService.addListener(deviceListener);
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        networkConfigService.removeListener(configListener);
+        configRegistry.unregisterConfigFactory(configFactory);
+        //edgePortService.removeListener(edgeListener);
+        deviceService.removeListener(deviceListener);
+        log.info("Stopped");
+    }
+
+    @Modified
+    public void modified(ComponentContext context) {
+        Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
+
+        boolean newEnabled;
+        String newSiteId;
+
+        try {
+            String s = get(properties, PROP_ENABLED);
+            newEnabled = isNullOrEmpty(s) || Boolean.parseBoolean(s.trim());
+
+            s = get(properties, DOMAIN_ID);
+            newSiteId = s;
+
+        } catch (NumberFormatException e) {
+            log.warn("Component configuration had invalid values", e);
+
+            newEnabled = enabled;
+            newSiteId = siteId;
+        }
+
+        if (enabled && !newEnabled) {
+            disable();
+        } else if (!enabled && newEnabled) {
+            enable();
+        }
+        enabled = newEnabled;
+
+        // TODO: manage new site ID
+        siteId = newSiteId;
+    }
+
+    @Override
+    public List<PortDescription> getPorts() {
+        return portMap.keySet().stream()
+                .map(this::toVirtualPortDescription)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public PortNumber getPort(ConnectPoint port) {
+        // XXX error-check and seriously think about a better method definition.
+        Versioned<Long> portNo = portMap.get(port);
+        if (Versioned.valueOrNull(portNo) != null) {
+            return PortNumber.portNumber(portNo.value());
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public Optional<ConnectPoint> connectPointFromVirtPort(PortNumber portNumber) {
+        return portMap.asJavaMap().entrySet()
+                .stream()
+                .filter(entry -> Objects.equals(entry.getValue(), portNumber.toLong()))
+                .map(Map.Entry::getKey)
+                .findFirst();
+    }
+
+    @Override
+    public DomainId siteId() {
+        return DomainId.domainId(siteId);
+    }
+
+    /**
+     * Convert connect point to port description.
+     *
+     * @param cp connect point of physical port
+     * @return port description of virtual big switch port
+     */
+    private PortDescription toVirtualPortDescription(ConnectPoint cp) {
+        Port p = deviceService.getPort(cp.deviceId(), cp.port());
+        if (p == null) {
+            return null;
+        }
+        // copy annotation
+        DefaultAnnotations.Builder annot = DefaultAnnotations.builder();
+        p.annotations().keys()
+                .forEach(k -> annot.set(k, p.annotations().value(k)));
+        annot.set(DOMAIN_ID, siteId);
+        // add annotation about underlying physical connect-point
+        Device device = deviceService.getDevice(cp.deviceId());
+        if (device.annotations().keys()
+                .contains(AnnotationKeys.LONGITUDE) && device.annotations().keys()
+                .contains(AnnotationKeys.LATITUDE)) {
+            annot.set(AnnotationKeys.LONGITUDE,
+                    device.annotations().value(AnnotationKeys.LONGITUDE));
+            annot.set(AnnotationKeys.LATITUDE, device.annotations().value(AnnotationKeys.LATITUDE));
+        }
+
+        // this is not really efficient...
+        Optional<MefPortConfig> mefPortConfig =
+                mefPortConfigs.stream().filter(item -> item.cp().equals(cp)).findFirst();
+        if (mefPortConfig.isPresent()) {
+            annot.set(MEF_PORT_TYPE, mefPortConfig.get().mefType().toString());
+            if (!mefPortConfig.get().interlinkId().id().equals("internal")) {
+                annot.set(INTERLINK_ID, mefPortConfig.get().interlinkId().id());
+            }
+        } else {
+            annot.set(MEF_PORT_TYPE, CarrierEthernetNetworkInterface.Type.GENERIC.toString());
+        }
+
+        Long vPortNo = Versioned.valueOrNull(portMap.get(cp));
+        if (vPortNo == null) {
+            return null;
+        }
+        PortNumber portNumber = PortNumber.portNumber(vPortNo);
+
+        return new DefaultPortDescription(portNumber, p.isEnabled(), p.type(),
+                p.portSpeed(), annot.build());
+    }
+
+    private void buildPorts() {
+        /*
+        edgePortService.getEdgePoints()
+                .forEach(cp -> {
+                    log.info("DEBUG: {}", cp.toString());
+                    if (isPortRelevant(cp)) {
+                        portMap.put(cp, getVirtualPortNumber(cp));
+                    }
+                });
+                */
+        deviceService.getDevices().forEach(device ->
+            deviceService.getPorts(device.id()).forEach(port -> {
+                        ConnectPoint cp = new ConnectPoint(device.id(), port.number());
+                        if (isPortRelevant(cp)) {
+                            portMap.put(cp, getVirtualPortNumber(cp));
+                        }
+                    }
+            ));
+    }
+
+    private Long getVirtualPortNumber(ConnectPoint cp) {
+        return p2vMap.getUnchecked(cp);
+    }
+
+    private void readConfig() {
+        mefPortConfigs = configRegistry.getConfig(appId, MefPortsConfig.class).mefPortConfigs();
+
+        if (enabled && mefPortConfigs != null) {
+            buildPorts();
+            log.info("Notifying Bigswitch presence..");
+            if (portMap.size() > 0) {
+                post(new BigSwitchEvent(BigSwitchEvent.Type.DEVICE_CREATED, null, getPorts()));
+            }
+        }
+    }
+
+    private void disable() {
+       // TODO
+    }
+
+    private void enable() {
+        if (mefPortConfigs != null && portMap.size() > 0) {
+            post(new BigSwitchEvent(BigSwitchEvent.Type.DEVICE_CREATED, null, getPorts()));
+        }
+    }
+
+
+    private class InternalEdgeListener implements EdgePortListener {
+        @Override
+        public boolean isRelevant(EdgePortEvent event) {
+            // Only listen for real devices
+            Device d = deviceService.getDevice(event.subject().deviceId());
+
+            return d != null && !d.type().equals(Device.Type.VIRTUAL) &&
+                    isPortRelevant(event.subject());
+        }
+
+        @Override
+        public void event(EdgePortEvent event) {
+            log.info("Edge event {} {}", event.subject(), event.type());
+            BigSwitchEvent.Type bigSwitchEvent;
+
+            switch (event.type()) {
+                case EDGE_PORT_ADDED:
+                    portMap.put(event.subject(), getVirtualPortNumber(event.subject()));
+                    bigSwitchEvent = BigSwitchEvent.Type.PORT_ADDED;
+                    break;
+                case EDGE_PORT_REMOVED:
+                    portMap.remove(event.subject());
+                    bigSwitchEvent = BigSwitchEvent.Type.PORT_REMOVED;
+                    break;
+                default:
+                    return;
+            }
+
+            if (mefPortConfigs != null) {
+                PortDescription descr;
+                descr = toVirtualPortDescription(event.subject());
+                if (descr != null) {
+                    post(new BigSwitchEvent(bigSwitchEvent, descr, getPorts()));
+                }
+            }
+        }
+    }
+
+
+    private class InternalDeviceListener implements DeviceListener {
+        @Override
+        public boolean isRelevant(DeviceEvent event) {
+            // Only listen for real devices
+            return !event.subject().type().equals(Device.Type.VIRTUAL) &&
+                    (event.type().equals(DeviceEvent.Type.PORT_ADDED) ||
+                    event.type().equals(DeviceEvent.Type.PORT_UPDATED) ||
+                    event.type().equals(DeviceEvent.Type.PORT_REMOVED));
+        }
+
+        @Override
+        public void event(DeviceEvent event) {
+            log.debug("Device event {} {} {}", event.subject(), event.port(), event.type());
+            ConnectPoint cp = new ConnectPoint(event.subject().id(), event.port().number());
+            if (!isPortRelevant(cp)) {
+                return;
+            }
+            BigSwitchEvent.Type bigSwitchEvent = null;
+
+            switch (event.type()) {
+                // Ignore most of these for now
+                case DEVICE_ADDED:
+                case DEVICE_AVAILABILITY_CHANGED:
+                case DEVICE_REMOVED:
+                case DEVICE_SUSPENDED:
+                case DEVICE_UPDATED:
+                case PORT_ADDED:
+                    portMap.put(cp, getVirtualPortNumber(cp));
+                    bigSwitchEvent = BigSwitchEvent.Type.PORT_ADDED;
+                    break;
+                case PORT_REMOVED:
+                    portMap.remove(cp, getVirtualPortNumber(cp));
+                    bigSwitchEvent = BigSwitchEvent.Type.PORT_REMOVED;
+                    break;
+                case PORT_STATS_UPDATED:
+                    break;
+                case PORT_UPDATED:
+                    bigSwitchEvent = BigSwitchEvent.Type.PORT_UPDATED;
+                    // Update if state of existing edge changed
+                    break;
+                default:
+                    break;
+
+            }
+            if (bigSwitchEvent != null && portMap.containsKey(cp) && mefPortConfigs != null) {
+                PortDescription descr = toVirtualPortDescription(cp);
+                if (descr != null) {
+                    post(new BigSwitchEvent(bigSwitchEvent,
+                            descr, getPorts()));
+                }
+            }
+        }
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if (!event.configClass().equals(MefPortsConfig.class)) {
+                return;
+            }
+            switch (event.type()) {
+                case CONFIG_ADDED:
+                    log.info("Network configuration added");
+                    executorService.execute(BigSwitchManager.this::readConfig);
+                    break;
+                case CONFIG_UPDATED:
+                    log.info("Network configuration updated");
+                    executorService.execute(BigSwitchManager.this::readConfig);
+                    break;
+                case CONFIG_REMOVED:
+                    // TODO
+                    break;
+                default:
+                        break;
+            }
+        }
+    }
+
+    private boolean isPortRelevant(ConnectPoint cp) {
+        if (mefPortConfigs == null) {
+            return false;
+        }
+        for (MefPortConfig portConfig : mefPortConfigs) {
+            if (portConfig.cp().equals(cp)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchService.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchService.java
new file mode 100644
index 0000000..47880ff
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchService.java
@@ -0,0 +1,63 @@
+/*
+ * 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.opencord.ce.local.bigswitch;
+
+
+import org.onosproject.event.ListenerService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Service to interact with big switch abstraction.
+ */
+public interface BigSwitchService extends ListenerService<BigSwitchEvent, BigSwitchListener> {
+    /**
+     * Gets list of big switch ports.
+     *
+     * @return list of port descriptions
+     */
+    List<PortDescription> getPorts();
+
+    /**
+     * Gets the big switch port mapped to the physical port.
+     *
+     * @param port the physical port
+     * @return virtual port number
+     */
+    PortNumber getPort(ConnectPoint port);
+
+
+    /**
+     * Gets the local connect point mapped to the specified virtual port number.
+     * @param portNumber virtual port number
+     * @return optional local-site connect point
+     */
+    Optional<ConnectPoint> connectPointFromVirtPort(PortNumber portNumber);
+
+    /**
+     * Returns the local site/domain ID of this biw switch.
+     *
+     * @return domain/site ID
+     */
+    DomainId siteId();
+}
+
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/MefPortsConfig.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/MefPortsConfig.java
new file mode 100644
index 0000000..a88f8e6
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/MefPortsConfig.java
@@ -0,0 +1,77 @@
+/*
+ * 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.opencord.ce.local.bigswitch;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.config.Config;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.services.virtualprovider.LinkId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.opencord.ce.api.services.channel.Symbols.MEF_PORT_TYPE;
+import static org.opencord.ce.api.models.CarrierEthernetNetworkInterface.Type;
+
+/**
+ * See config-samples/ecord-local-config.json.
+ */
+public class MefPortsConfig extends Config<ApplicationId> {
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    public static final String MEF_PORTS = "mefPorts";
+    public static final String CONNECT_POINT = "connectPoint";
+    public static final String INTERLINK_ID = "interlinkId";
+
+    public List<MefPortConfig> mefPortConfigs() {
+        List<MefPortConfig> mefPortConfigs = new ArrayList<>();
+        array.forEach(item -> mefPortConfigs.add(new MefPortConfig(
+                ConnectPoint.deviceConnectPoint(item.path(CONNECT_POINT).asText()),
+                CarrierEthernetNetworkInterface.Type.valueOf(item.path(MEF_PORT_TYPE).asText()),
+                LinkId.linkId(item.path(INTERLINK_ID).isMissingNode() ? "internal" :
+                        item.path(INTERLINK_ID).asText())
+        )));
+        return mefPortConfigs;
+    }
+
+    public static class MefPortConfig {
+        private ConnectPoint cp;
+        private CarrierEthernetNetworkInterface.Type mefType;
+        private LinkId interlinkId;
+
+        public MefPortConfig(ConnectPoint cp, Type mefType,
+                              LinkId interlinkId) {
+            this.cp = cp;
+            this.mefType = mefType;
+            this.interlinkId = interlinkId;
+        }
+
+        public ConnectPoint cp() {
+            return cp;
+        }
+
+        public Type mefType() {
+            return mefType;
+        }
+
+        public LinkId interlinkId() {
+            return interlinkId;
+        }
+    }
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/BigSwitchPortsCommand.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/BigSwitchPortsCommand.java
new file mode 100644
index 0000000..1838055
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/BigSwitchPortsCommand.java
@@ -0,0 +1,38 @@
+/*
+ * 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.opencord.ce.local.bigswitch.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+
+/**
+ * Command to list the ports of the bigswitch.
+ */
+@Command(scope = "onos", name = "bigswitch-ports",
+        description = "Lists the bigswitch ports")
+public class BigSwitchPortsCommand extends AbstractShellCommand {
+
+    @Override
+    public void execute() {
+        BigSwitchService bigSwitchService = get(BigSwitchService.class);
+
+        bigSwitchService.getPorts().forEach(
+                portDescription -> print(portDescription.toString())
+        );
+    }
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/ConnectPointFromVirtPortCmd.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/ConnectPointFromVirtPortCmd.java
new file mode 100644
index 0000000..cec3225
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/ConnectPointFromVirtPortCmd.java
@@ -0,0 +1,44 @@
+/*
+ * 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.opencord.ce.local.bigswitch.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.PortNumber;
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+
+/**
+ * Returns the connect point associated to the specified port number of the bigswitch.
+ */
+@Command(scope = "onos", name = "bigswitch-port", description = "Returns the connect point" +
+        "associated with the specified virtual port of the bigswitch")
+public class ConnectPointFromVirtPortCmd extends AbstractShellCommand {
+
+    @Argument(index = 1, name = "port",
+            description = "Virtual bigswitch port",
+            required = true, multiValued = false)
+    String port = "0";
+
+
+    @Override
+    public void execute() {
+        BigSwitchService bigSwitchService = get(BigSwitchService.class);
+        print(bigSwitchService.connectPointFromVirtPort(PortNumber.fromString(port)).toString());
+
+    }
+}
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/package-info.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/package-info.java
new file mode 100644
index 0000000..f99e72b
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * CLI command to explore the bigswitch ports.
+ */
+package org.opencord.ce.local.bigswitch.cli;
\ No newline at end of file
diff --git a/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/package-info.java b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/package-info.java
new file mode 100644
index 0000000..06205cb
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Big switch abstraction package.
+ */
+package org.opencord.ce.local.bigswitch;
\ No newline at end of file
diff --git a/local/bigswitch/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/local/bigswitch/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..2a50a6a
--- /dev/null
+++ b/local/bigswitch/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,26 @@
+<!--
+  ~ 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.
+  -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.opencord.ce.local.bigswitch.cli.BigSwitchPortsCommand"/>
+        </command>
+        <command>
+            <action class="org.opencord.ce.local.bigswitch.cli.ConnectPointFromVirtPortCmd"/>
+        </command>
+    </command-bundle>
+</blueprint>
diff --git a/local/ce-central-office/pom.xml b/local/ce-central-office/pom.xml
new file mode 100644
index 0000000..d8536e7
--- /dev/null
+++ b/local/ce-central-office/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>co</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Central Office app for Carrier Ethernet Service</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.co</onos.app.name>
+        <onos.version>1.10.0</onos.version>
+        <onos.app.title>ECORD Central-Office Fabric config</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/local/ce-central-office/src/main/java/org/opencord/ce/local/co/package-info.java b/local/ce-central-office/src/main/java/org/opencord/ce/local/co/package-info.java
new file mode 100644
index 0000000..f4af694
--- /dev/null
+++ b/local/ce-central-office/src/main/java/org/opencord/ce/local/co/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Central Office CE app.
+ */
+package org.opencord.ce.local.co;
\ No newline at end of file
diff --git a/local/ce-transport/pom.xml b/local/ce-transport/pom.xml
new file mode 100644
index 0000000..edf24d8
--- /dev/null
+++ b/local/ce-transport/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>transport</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Transport network provisioner of Carrier Ethernet Service</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.transport</onos.app.name>
+        <onos.version>1.10.0</onos.version>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/local/ce-transport/src/main/java/org/opencord/ce/local/transport/package-info.java b/local/ce-transport/src/main/java/org/opencord/ce/local/transport/package-info.java
new file mode 100644
index 0000000..e58fb39
--- /dev/null
+++ b/local/ce-transport/src/main/java/org/opencord/ce/local/transport/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Transport network for Carrier Ethernet package.
+ */
+package org.opencord.ce.local.transport;
\ No newline at end of file
diff --git a/local/ce-vee/pom.xml b/local/ce-vee/pom.xml
new file mode 100644
index 0000000..8a416d4
--- /dev/null
+++ b/local/ce-vee/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+    	<version>1.0.0</version>
+    </parent>
+
+    <artifactId>vee</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Virtual ethernet edge service for CORD</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.vee</onos.app.name>
+        <onos.app.title>ECORD-CE App</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>bigswitch</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/local/ce-vee/src/main/java/org/opencord/ce/local/vee/VeeManager.java b/local/ce-vee/src/main/java/org/opencord/ce/local/vee/VeeManager.java
new file mode 100644
index 0000000..daf5614
--- /dev/null
+++ b/local/ce-vee/src/main/java/org/opencord/ce/local/vee/VeeManager.java
@@ -0,0 +1,730 @@
+/*
+ * 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.opencord.ce.local.vee;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+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.apache.felix.scr.annotations.Service;
+import org.onlab.packet.EthType;
+import org.onlab.packet.Ethernet;
+import org.onlab.packet.VlanId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.driver.Driver;
+import org.onosproject.net.driver.DriverService;
+import org.onosproject.net.flow.DefaultFlowRule;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.DefaultTrafficTreatment;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.flow.criteria.Criteria;
+import org.onosproject.net.flow.criteria.Criterion;
+import org.onosproject.net.flow.instructions.Instruction;
+import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.flow.instructions.L2ModificationInstruction;
+import org.onosproject.net.flowobjective.DefaultFilteringObjective;
+import org.onosproject.net.flowobjective.DefaultForwardingObjective;
+import org.onosproject.net.flowobjective.DefaultNextObjective;
+import org.onosproject.net.flowobjective.FilteringObjective;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
+import org.onosproject.net.flowobjective.ForwardingObjective;
+import org.onosproject.net.flowobjective.NextObjective;
+import org.onosproject.net.flowobjective.Objective;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.net.meter.Band;
+import org.onosproject.net.meter.DefaultBand;
+import org.onosproject.net.meter.DefaultMeterRequest;
+import org.onosproject.net.meter.Meter;
+import org.onosproject.net.meter.MeterId;
+import org.onosproject.net.meter.MeterRequest;
+import org.onosproject.net.meter.MeterService;
+import org.onosproject.net.topology.PathService;
+import org.opencord.ce.api.models.CarrierEthernetEnni;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetGenericNi;
+import org.opencord.ce.api.models.CarrierEthernetInni;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import static org.opencord.ce.api.models.CarrierEthernetNetworkInterface.Type;
+import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
+
+/**
+ * Class used to control Ethernet Edge nodes according to the OpenFlow (1.3 and above) protocol.
+ */
+@Component(immediate = true)
+@Service(value = MetroNetworkVirtualNodeService.class)
+public class VeeManager implements MetroNetworkVirtualNodeService {
+    private static final int PRIORITY = 50000;
+    public static final String APP_NAME = "org.opencord.ce.local.vee";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected FlowRuleService flowRuleService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected MeterService meterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected FlowObjectiveService flowObjectiveService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected BigSwitchService bigSwitchService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected PathService pathService;
+
+    // FIXME slightly better way to detect OF-DPA issues
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DriverService drivers;
+
+    private final Logger log = getLogger(getClass());
+
+    private ApplicationId appId;
+
+    // FIXME: We don't need to store the submitted meters as we can get them from the service
+    private Map<EvcConnId, Set<Pair<DeviceId, MeterId>>> fcMeterMap =
+            new ConcurrentHashMap<>();
+    // Store submitted flow objects as the service does not allow query operations
+    private final Map<EvcConnId, LinkedList<Pair<DeviceId, Objective>>> flowObjectiveMap =
+            new ConcurrentHashMap<>();
+
+    private final Map<EvcConnId, DeviceId> eeDeviceMap = new ConcurrentHashMap<>();
+
+    @Activate
+    protected void activate() {
+        appId = coreService.registerApplication(APP_NAME);
+
+        // TODO: start packet intercept for untagged traffic?
+        log.info("Started");
+
+       // testCentec();
+    }
+
+    @Deactivate
+    protected void deactivate() {
+
+        log.info("Stopped");
+    }
+
+
+    @Override
+    public void setNodeForwarding(CarrierEthernetForwardingConstruct fc, CarrierEthernetNetworkInterface ingressNi,
+                                  Set<CarrierEthernetNetworkInterface> egressNiSet) {
+
+        log.info("DEBUG: setForwarding method called..");
+        if (ingressNi == null || egressNiSet.isEmpty()) {
+            log.error("There needs to be at least one ingress and one egress NI to set forwarding.");
+            return;
+        }
+
+        flowObjectiveMap.putIfAbsent(fc.id(), new LinkedList<>());
+
+        CarrierEthernetNetworkInterface realIngressNi;
+        Optional<ConnectPoint> optCp =
+                bigSwitchService.connectPointFromVirtPort(ingressNi.cp().port());
+        if (optCp.isPresent()) {
+            realIngressNi = buildLocalNi(optCp.get(), ingressNi);
+        } else {
+            log.warn("Virtual ingress interface does not map to a local connect point");
+            return;
+        }
+
+        // real <-> virtual
+        final Map<ConnectPoint, CarrierEthernetNetworkInterface> realEgressNi = new HashMap<>();
+        egressNiSet.forEach(egressNi -> {
+            Optional<ConnectPoint> opt =
+                    bigSwitchService.connectPointFromVirtPort(egressNi.cp().port());
+            opt.ifPresent(connectPoint -> realEgressNi.put(connectPoint, egressNi));
+        });
+
+        // it is necessary to identify the number of egress devices in order to build the
+        // flow rules
+        Set<DeviceId> egressDevices = new HashSet<>();
+        realEgressNi.keySet().forEach(cp -> egressDevices.add(cp.deviceId()));
+
+        //for how it is made the CE app, egressNiSet contains only one item, but...
+        egressDevices.forEach(deviceId -> {
+            // group the egress NI per device
+            Set<CarrierEthernetNetworkInterface> perDeviceEgressNiSet = new HashSet<>();
+            realEgressNi.keySet().forEach(cp -> {
+                if (cp.deviceId().equals(deviceId)) {
+                    perDeviceEgressNiSet.add(buildLocalNi(cp, realEgressNi.get(cp)));
+                }
+            });
+            // if the egress device ID is equal to the ingress --> install rules
+            if (deviceId.equals(realIngressNi.cp().deviceId())) {
+                createFlowObjectives(fc, realIngressNi,
+                        perDeviceEgressNiSet);
+            } else {
+                Set<Path> paths = pathService.getPaths(realIngressNi.cp().deviceId(),
+                        deviceId);
+                Path path;
+                // TODO: Select path in more sophisticated way and return null if any of the constraints cannot be met
+                path = paths.iterator().hasNext() ? paths.iterator().next() : null;
+                if (path == null) {
+                    return;
+                }
+                // for each NI, add edge links ()
+                perDeviceEgressNiSet.forEach(egressNi -> {
+                    List<Link> links = new ArrayList<>();
+                    links.add(createEdgeLink(realIngressNi.cp(), true));
+                    links.addAll(path.links());
+                    links.add(createEdgeLink(egressNi.cp(), false));
+
+                    HashMap<CarrierEthernetNetworkInterface, HashSet<CarrierEthernetNetworkInterface>>
+                            ingressEgressNiMap = new HashMap<>();
+                    populateIngressEgressNiMap(realIngressNi, egressNi, links, ingressEgressNiMap);
+                    // Establish connectivity using the ingressEgressNiMap
+                    ingressEgressNiMap.keySet().forEach(srcNi ->
+                        createFlowObjectives(fc, srcNi, ingressEgressNiMap.get(srcNi)));
+                });
+            }
+        });
+    }
+
+    private void populateIngressEgressNiMap(CarrierEthernetNetworkInterface srcNi,
+                                            CarrierEthernetNetworkInterface dstNi,
+                                            List<Link> linkList,
+                                            HashMap<CarrierEthernetNetworkInterface,
+                                                    HashSet<CarrierEthernetNetworkInterface>> ingressEgressNiMap
+    ) {
+        // FIXME: Fix the method - avoid generating GENERIC NIs if not needed
+        // Add the src and destination NIs as well as the associated Generic NIs
+        ingressEgressNiMap.putIfAbsent(srcNi, new HashSet<>());
+        // Add last hop entry only if srcNi, dstNi aren't on same device (in which case srcNi, ingressNi would coincide)
+        if (!srcNi.cp().deviceId().equals(dstNi.cp().deviceId())) {
+            // If srcNi, dstNi are not on the same device, create mappings to/from new GENERIC NIs
+            ingressEgressNiMap.get(srcNi).add(new CarrierEthernetGenericNi(linkList.get(1).src(), null));
+            CarrierEthernetGenericNi ingressNi =
+                    new CarrierEthernetGenericNi(linkList.get(linkList.size() - 2).dst(), null);
+            ingressEgressNiMap.putIfAbsent(ingressNi, new HashSet<>());
+            ingressEgressNiMap.get(ingressNi).add(dstNi);
+        } else {
+            // If srcNi, dstNi are on the same device, this is the only mapping that will be created
+            ingressEgressNiMap.get(srcNi).add(dstNi);
+        }
+
+        // Go through the links and create/add the intermediate NIs
+        for (int i = 1; i < linkList.size() - 2; i++) {
+            CarrierEthernetGenericNi ingressNi = new CarrierEthernetGenericNi(linkList.get(i).dst(), null);
+            ingressEgressNiMap.putIfAbsent(ingressNi, new HashSet<>());
+            ingressEgressNiMap.get(ingressNi).add(new CarrierEthernetGenericNi(linkList.get(i + 1).src(), null));
+        }
+    }
+
+    private CarrierEthernetNetworkInterface buildLocalNi(ConnectPoint localCp, CarrierEthernetNetworkInterface
+                                                         virtualNi) {
+        CarrierEthernetNetworkInterface ni;
+        switch (virtualNi.type()) {
+            case UNI:
+                CarrierEthernetUni tmpUni = (CarrierEthernetUni) virtualNi;
+                ni = CarrierEthernetUni.builder()
+                        .cp(localCp)
+                        .role(tmpUni.role())
+                        .ceVlanId(tmpUni.ceVlanId())
+                        .bwp(tmpUni.bwp())
+                        .build();
+                break;
+            case ENNI:
+                CarrierEthernetEnni tmpEnni = (CarrierEthernetEnni) virtualNi;
+                ni = CarrierEthernetEnni.builder()
+                        .cp(localCp)
+                        .role(tmpEnni.role())
+                        .sVlanId(tmpEnni.sVlanId())
+                        .build();
+                break;
+            case INNI:
+                CarrierEthernetInni tmpInni = (CarrierEthernetInni) virtualNi;
+                ni = CarrierEthernetInni.builder()
+                        .cp(localCp)
+                        .role(tmpInni.role())
+                        .sVlanId(tmpInni.sVlanId())
+                        .build();
+                break;
+            case GENERIC:
+                ni = new CarrierEthernetGenericNi(localCp, null);
+                break;
+            default:
+                return null;
+        }
+        return ni;
+
+    }
+
+    /**
+     * Creates and submits FlowObjectives into the device vesting the role of Ethernet Edge.
+     *
+     * @param fc the FC representation
+     * @param ingressNi the ingress network interface
+     * @param  egressNiSet the set of egress NIs
+     */
+    private void createFlowObjectives(CarrierEthernetForwardingConstruct fc, CarrierEthernetNetworkInterface ingressNi,
+                                      Set<CarrierEthernetNetworkInterface> egressNiSet) {
+        DeviceId deviceId = ingressNi.cp().deviceId();
+        PortNumber portNumber = ingressNi.cp().port();
+
+        /////////////////////////////////////////
+        // Prepare and submit filtering objective
+        /////////////////////////////////////////
+
+        FilteringObjective.Builder filterObjBuilder = DefaultFilteringObjective.builder()
+                .permit().fromApp(appId)
+                .withPriority(PRIORITY)
+                .withKey(Criteria.matchInPort(portNumber));
+
+        TrafficTreatment.Builder filterTreatmentBuilder = DefaultTrafficTreatment.builder();
+        // In general, nodes would match on the VLAN tag assigned to the EVC/FC
+        Criterion filterVlanIdCriterion = Criteria.matchVlanId(fc.vlanId());
+
+        if ((ingressNi.type().equals(CarrierEthernetNetworkInterface.Type.INNI))
+                || (ingressNi.type().equals(CarrierEthernetNetworkInterface.Type.ENNI))) {
+            // TODO: Check TPID? Also: Is is possible to receive untagged pkts at an INNI/ENNI?
+            // Source node of an FC should match on S-TAG if it's an INNI/ENNI
+            filterVlanIdCriterion = Criteria.matchVlanId(ingressNi.sVlanId());
+            // Translate S-TAG to the one used in the current FC
+            filterTreatmentBuilder.setVlanId(fc.vlanId());
+        } else if (ingressNi.type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+            // Source node of an FC should match on CE-VLAN ID (if present) if it's a UNI
+            filterVlanIdCriterion = Criteria.matchVlanId(ingressNi.ceVlanId());
+            // Obtain related Meter (if it exists) and add it in the treatment in case it may be used
+            if (fcMeterMap.get(fc.id()) != null && !fcMeterMap.get(fc.id()).isEmpty()) {
+                fcMeterMap.get(fc.id()).forEach(devMeterPair -> {
+                    if (devMeterPair.getLeft().equals(deviceId)) {
+                        filterTreatmentBuilder.meter(devMeterPair.getRight());
+                    }
+                });
+            }
+            // If a CE-VLAN-ID exists on the incoming packet then push an S-TAG of current FC on top
+            // otherwise push it on as a C-tag
+            if (ingressNi.ceVlanId() != null && ingressNi.ceVlanId() != VlanId.NONE) {
+                filterTreatmentBuilder.pushVlan(EthType.EtherType.QINQ.ethType()).setVlanId(fc.vlanId());
+            } else {
+                filterTreatmentBuilder.pushVlan().setVlanId(fc.vlanId());
+            }
+        }
+
+        filterObjBuilder.addCondition(filterVlanIdCriterion);
+
+
+
+        // Do not add meta if there are no instructions (i.e. if not first)
+        if (!(ingressNi.type().equals(Type.GENERIC))) {
+            filterObjBuilder.withMeta(filterTreatmentBuilder.build());
+        }
+
+        flowObjectiveService.filter(deviceId, filterObjBuilder.add());
+        flowObjectiveMap.get(fc.id()).addFirst(Pair.of(deviceId, filterObjBuilder.add()));
+
+        ////////////////////////////////////////////////////
+        // Prepare and submit next and forwarding objectives
+        ////////////////////////////////////////////////////
+
+        TrafficSelector.Builder fwdSelectorBuilder = DefaultTrafficSelector.builder()
+                .matchVlanId(fc.vlanId())
+                .matchInPort(portNumber);
+
+        if (isOfDpa(deviceId)) {
+            // workaround for OF-DPA
+            fwdSelectorBuilder.matchEthType(Ethernet.TYPE_IPV4);
+        }
+
+        TrafficSelector fwdSelector = fwdSelectorBuilder.build();
+
+        Integer nextId = flowObjectiveService.allocateNextId();
+
+        NextObjective.Type nextType = egressNiSet.size() == 1 ?
+                NextObjective.Type.SIMPLE : NextObjective.Type.BROADCAST;
+
+        // Setting higher priority to fwd/next objectives to bypass filter in case of match conflict in OVS switches
+        NextObjective.Builder nextObjectiveBuider = DefaultNextObjective.builder()
+                .fromApp(appId)
+                .makePermanent()
+                .withType(nextType)
+                .withPriority(PRIORITY + 1)
+                .withMeta(fwdSelector)
+                .withId(nextId);
+
+        egressNiSet.forEach(egressNi -> {
+            // TODO: Check if ingressNi and egressNi are on the same device?
+            TrafficTreatment.Builder nextTreatmentBuilder = DefaultTrafficTreatment.builder();
+            // If last NI in FC is not UNI,
+            // keep the existing S-TAG - it will be translated at the entrance of the next FC
+            if (egressNi.type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
+                nextTreatmentBuilder.popVlan();
+            }
+            Instruction outInstruction = Instructions.createOutput(egressNi.cp().port());
+            nextTreatmentBuilder.add(outInstruction);
+            nextObjectiveBuider.addTreatment(nextTreatmentBuilder.build());
+        });
+
+        NextObjective nextObjective = nextObjectiveBuider.add();
+
+        // Setting higher priority to fwd/next objectives to bypass filter in case of match conflict in OVS switches
+        ForwardingObjective forwardingObjective = DefaultForwardingObjective.builder()
+                .fromApp(appId)
+                .makePermanent()
+                .withFlag(ForwardingObjective.Flag.VERSATILE)
+                .withPriority(PRIORITY + 1)
+                .withSelector(fwdSelector)
+                .nextStep(nextId)
+                .add();
+
+        flowObjectiveService.next(ingressNi.cp().deviceId(), nextObjective);
+        // Add all NextObjectives at the end of the list so that they will be removed last
+        flowObjectiveMap.get(fc.id()).addLast(Pair.of(ingressNi.cp().deviceId(), nextObjective));
+
+        flowObjectiveService.forward(ingressNi.cp().deviceId(), forwardingObjective);
+        flowObjectiveMap.get(fc.id()).addFirst(Pair.of(ingressNi.cp().deviceId(), forwardingObjective));
+    }
+
+    @Override
+    public void createBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        log.info("Creating BW profile...{}", uni.toString());
+        // Create meters and add them to global MeterId map
+        Set<Pair<DeviceId, MeterId>> meters;
+
+        DeviceId deviceId = getEEDevice(fc, uni);
+
+        if (fcMeterMap.containsKey(fc.id())) {
+            meters = fcMeterMap.get(fc.id());
+        } else {
+            meters = new HashSet<>();
+            if (deviceId == null) {
+                // no meters
+                return;
+            }
+        }
+        meters.addAll(submitMeters(fc, uni, deviceId));
+        fcMeterMap.put(fc.id(), meters);
+    }
+
+    private boolean isOfDpa(DeviceId deviceId) {
+        Driver driver = drivers.getDriver(deviceId);
+        return driver != null &&
+                driver.swVersion().contains("OF-DPA");
+    }
+
+    // Maybe we still need this method to later modify the QoS profile of an FC
+    @Override
+    public void applyBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        log.info("Applying BW profile...");
+
+        DeviceId deviceId = eeDeviceMap.get(fc.id());
+        if (deviceId == null) {
+            log.warn("Trying to apply bandwidth profile rules" +
+                    "to not existing device/meters map");
+            return;
+        }
+
+        // Do not apply meters to NETCONF-controlled switches here since they should have been applied in the pipeline
+        // FIXME: Is there a better way to check this?
+        if (deviceId.uri().getScheme().equals("netconf")) {
+            return;
+        }
+
+        // Do not apply meters to OFDPA 2.0 switches since they are not currently supported
+        if (isOfDpa(deviceId)) {
+            return;
+        }
+
+        // Get installed flows with the same appId/deviceId with IN_PORT = UNI port which push the FC vlanId
+        List<FlowRule> flowRuleList =
+                StreamSupport.stream(flowRuleService.getFlowEntries(deviceId).spliterator(), false)
+                        .filter(flowRule -> flowRule.appId() == appId.id())
+                        .collect(Collectors.toList());
+                                //&& getPushedVlanFromTreatment(flowRule.treatment()).equals(fc.vlanId()))
+
+
+        // Apply meters to flows
+        for (FlowRule flowRule : flowRuleList) {
+            // Need to add to the flow the meters associated with the same device
+            Set<Pair<DeviceId, MeterId>> deviceMeterIdSet = new HashSet<>();
+
+            if (fcMeterMap.get(fc.id()) != null && !fcMeterMap.get(fc.id()).isEmpty()) {
+                fcMeterMap.get(fc.id()).forEach(devMeterPair -> {
+                    if (devMeterPair.getLeft().equals(flowRule.deviceId())) {
+                        deviceMeterIdSet.add(devMeterPair);
+                    }
+                });
+            }
+            // Modify and submit flow rule only if there are meters to add
+            if (!deviceMeterIdSet.isEmpty()) {
+                log.info("Applying metered flow rules...");
+                FlowRule newFlowRule = addMetersToFlowRule(flowRule, deviceMeterIdSet);
+                flowRuleService.applyFlowRules(newFlowRule);
+            }
+        }
+    }
+
+    private VlanId getPushedVlanFromTreatment(TrafficTreatment treatment) {
+        boolean pushVlan = false;
+        VlanId pushedVlan = null;
+        for (Instruction instruction : treatment.allInstructions()) {
+            if (instruction.type().equals(Instruction.Type.L2MODIFICATION)) {
+                L2ModificationInstruction l2ModInstr = (L2ModificationInstruction) instruction;
+                if (l2ModInstr.subtype().equals(L2ModificationInstruction.L2SubType.VLAN_PUSH)) {
+                    pushVlan = true;
+                } else if (l2ModInstr.subtype().equals(L2ModificationInstruction.L2SubType.VLAN_ID) && pushVlan) {
+                    pushedVlan = ((L2ModificationInstruction.ModVlanIdInstruction) instruction).vlanId();
+                }
+            }
+        }
+        return pushedVlan != null ? pushedVlan : VlanId.NONE;
+    }
+
+
+    /**
+     * Creates and submits a meter with the required bands for a UNI.
+     *
+     * @param uni the UNI descriptor
+     * @return set of meter ids of the meters created
+     */
+    private Set<Pair<DeviceId, MeterId>> submitMeters(CarrierEthernetForwardingConstruct fc,
+                                                      CarrierEthernetUni uni, DeviceId deviceId) {
+        Set<Pair<DeviceId, MeterId>> meters = new HashSet<>();
+
+        uni.bwps().forEach(bwp -> {
+            log.info("bwp: {}", bwp.toString());
+
+            // KB_PER_SECOND
+            long longCir = (long) (bwp.cir().bps() / 8000);
+            long longEir = (long) (bwp.eir().bps() / 8000);
+            log.info("longCir: {}", longCir);
+            log.info("longEir: {}", longEir);
+
+            MeterRequest.Builder meterRequestBuilder;
+            Meter meter;
+            Band.Builder bandBuilder;
+
+            Set<Band> bandSet = new HashSet<>();
+
+            // If EIR is zero do not create the REMARK meter
+            /* === Centec v350 supports only DROP type! ===
+            if (longEir != 0) {
+                log.info("Enter here..");
+                // Mark frames that exceed CIR as Best Effort
+                bandBuilder = DefaultBand.builder()
+                        .ofType(Band.Type.REMARK)
+                        .withRate(longCir)
+                        .dropPrecedence((short) 0);
+
+                if (bwp.cbs() != 0) {
+                    bandBuilder.burstSize(bwp.cbs());
+                }
+
+                bandSet.add(bandBuilder.build());
+            }
+            */
+
+            // If CIR is zero do not create the DROP meter
+            if (longCir != 0) {
+                // Drop all frames that exceed CIR + EIR
+                bandBuilder = DefaultBand.builder()
+                        .ofType(Band.Type.DROP)
+                        .withRate(longCir + longEir);
+
+                if (bwp.cbs() != 0 || bwp.ebs() != 0) {
+                    // FIXME: Use CBS and EBS correctly according to MEF specs
+                    bandBuilder.burstSize(bwp.cbs() + bwp.ebs());
+                }
+
+                bandSet.add(bandBuilder.build());
+            }
+
+            // Create meter only if at least one band was created
+            if (!bandSet.isEmpty()) {
+                meterRequestBuilder = DefaultMeterRequest.builder()
+                        .forDevice(deviceId)
+                        .fromApp(appId)
+                        .withUnit(Meter.Unit.KB_PER_SEC)
+                        .withBands(bandSet);
+
+                if (bwp.cbs() != 0 || bwp.ebs() != 0) {
+                    meterRequestBuilder.burst();
+                }
+
+                // Submit meter request and store
+                meter = meterService.submit(meterRequestBuilder.add());
+                // FIXME: use correct device id
+                log.info("Adding meter...{}", meter.toString());
+
+                meters.add(new ImmutablePair<>(deviceId, meter.id()));
+            }
+        });
+
+        return meters;
+    }
+
+    private FlowRule addMetersToFlowRule(FlowRule flowRule,  Set<Pair<DeviceId, MeterId>> deviceMeterIdSet) {
+
+        TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment
+                .builder(flowRule.treatment());
+
+        deviceMeterIdSet.forEach(deviceMeterPair ->
+            tBuilder.meter(deviceMeterPair.getRight()));
+
+        return createFlowRule(flowRule.deviceId(), flowRule.priority(),
+                flowRule.selector(), tBuilder.build(), flowRule.tableId());
+    }
+
+    @Override
+    public void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        removeMeters(fc, uni);
+    }
+
+    /**
+     * Removes the meters associated with a specific UNI of an FC.
+     *
+     * @param fc the forwarding construct
+     * @param uni the UNI descriptor
+     * */
+    private void removeMeters(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+
+        if (!fcMeterMap.containsKey(fc.id())) {
+            return;
+        }
+
+        Set<Pair<DeviceId, MeterId>> ids = fcMeterMap.get(fc.id());
+
+        // Rebuild meter request based on existing meter, withdraw the request, and remove it from our internal storage
+        ids.stream()
+                .map(id -> meterService.getMeter(id.getLeft(), id.getRight()))
+                .filter(Objects::nonNull)
+                .forEach(meter -> {
+                    MeterRequest.Builder request = DefaultMeterRequest.builder()
+                            .fromApp(meter.appId())
+                            .forDevice(meter.deviceId())
+                            .withUnit(meter.unit())
+                            .withBands(meter.bands());
+                    if (uni.bwp().cbs() != 0 || uni.bwp().ebs() != 0) {
+                        request.burst();
+                    }
+                    meterService.withdraw(request.remove(), meter.id());
+
+                    ids.remove(new ImmutablePair<>(meter.deviceId(), meter.id()));
+                });
+    }
+
+    /**
+     * Removes all flow objectives installed by the application which are associated with a specific FC.
+     *
+     * @param fcId ForwardingConcrtuct object
+     */
+    @Override
+    public void removeAllForwardingResources(EvcConnId fcId) {
+        // Note: A Flow Rule cannot be shared by multiple FCs due to different VLAN or CE-VLAN ID match.
+        List<Pair<DeviceId, Objective>> flowObjectives = flowObjectiveMap.remove(fcId);
+        // NextObjectives will be removed after all other Objectives
+        // TODO: filter also on elements of pair
+        flowObjectives.stream()
+                .filter(Objects::nonNull)
+                .forEach(pair ->
+                        flowObjectiveService.apply(pair.getLeft(), pair.getRight().copy().remove()));
+    }
+
+    private FlowRule createFlowRule(DeviceId deviceId, int priority,
+                                    TrafficSelector selector, TrafficTreatment treatment, int tableId) {
+        return DefaultFlowRule.builder()
+                .fromApp(appId)
+                .forDevice(deviceId)
+                .makePermanent()
+                .withPriority(priority)
+                .withSelector(selector)
+                .withTreatment(treatment)
+                .forTable(tableId)
+                .build();
+    }
+
+    /**
+     * !! Caution !! This method is strictly tied to the expected topology
+     * view of this {@link MetroNetworkVirtualNodeService} implementation.
+     * The UNI is expected to be in the CPE and meters implementation in the EE.
+     * The CPE node shall be connected only
+     * with the EE device (exception are multi path home gateway).
+     *
+     * @param fc forwarding construct
+     * @param uni User to Network Interface
+     * @return the EE device ID
+     */
+    private DeviceId getEEDevice(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni)
+            throws IllegalStateException {
+        CarrierEthernetNetworkInterface realUni;
+        Optional<ConnectPoint> optCp =
+                bigSwitchService.connectPointFromVirtPort(uni.cp().port());
+        if (optCp.isPresent()) {
+            realUni = buildLocalNi(optCp.get(), uni);
+        } else {
+            log.info("Virtual ingress interface does not map to a local connect point");
+            throw new IllegalStateException("Virtual UNI interface does not map to a local connect point");
+        }
+        if (eeDeviceMap.get(fc.id()) != null) {
+            return eeDeviceMap.get(fc.id());
+        }
+        // find the (only) egress link of the UNI device
+        Optional<Link> optLink = linkService.getDeviceEgressLinks(realUni.cp().deviceId())
+                .stream().findFirst();
+        if (optLink.isPresent()) {
+
+            // the link destination should be our target EE device
+            DeviceId deviceId = optLink.get().dst().deviceId();
+            log.info("Adding EE device {} in memory...", deviceId.toString());
+            eeDeviceMap.put(fc.id(), deviceId);
+            return deviceId;
+        } else {
+            log.info("No EE device found for meters...uni: {}", realUni.cp().toString());
+            // in this case there is no EE upstream and so no meter will be installed
+            return null;
+        }
+    }
+}
\ No newline at end of file
diff --git a/local/ce-vee/src/main/java/org/opencord/ce/local/vee/package-info.java b/local/ce-vee/src/main/java/org/opencord/ce/local/vee/package-info.java
new file mode 100644
index 0000000..184f05a
--- /dev/null
+++ b/local/ce-vee/src/main/java/org/opencord/ce/local/vee/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Virtual Ethernet Edge implementation.
+ */
+package org.opencord.ce.local.vee;
\ No newline at end of file
diff --git a/local/common-component/app.xml b/local/common-component/app.xml
new file mode 100644
index 0000000..eea948b
--- /dev/null
+++ b/local/common-component/app.xml
@@ -0,0 +1,26 @@
+<?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.
+  -->
+<app name="org.opencord.ce.local.app" origin="ON.Lab" version="${project.version}"
+     category="Utility" url="http://opencord.org" title="Enterprise CORD"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/bigswitch/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/local-channel/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/vee/${project.version}</artifact>
+</app>
diff --git a/local/common-component/features.xml b/local/common-component/features.xml
new file mode 100644
index 0000000..6c5c6c3
--- /dev/null
+++ b/local/common-component/features.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+  ~ 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <bundle>mvn:${project.groupId}/bigswitch/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/local-channel/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/vee/${project.version}</bundle>
+    </feature>
+</features>
\ No newline at end of file
diff --git a/local/common-component/pom.xml b/local/common-component/pom.xml
new file mode 100644
index 0000000..336be69
--- /dev/null
+++ b/local/common-component/pom.xml
@@ -0,0 +1,58 @@
+<?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.
+  -->
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+        <version>1.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>ecord-local-app</artifactId>
+    <packaging>pom</packaging>
+
+    <description>java application bundling the bigswitch abstraction
+        and the http channel component
+    </description>
+
+    <properties>
+        <project.version>1.0.0</project.version>
+        <onos.app.name>org.opencord.ce.local.app</onos.app.name>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>bigswitch</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>local-channel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>vee</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/local/config-samples/co1-config.json b/local/config-samples/co1-config.json
new file mode 100644
index 0000000..1a1b169
--- /dev/null
+++ b/local/config-samples/co1-config.json
@@ -0,0 +1,29 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.10:830/1"
+        },
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.10:830/0",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "clusterIps" : [
+          "10.128.14.1"
+        ],
+        "port" : "8181",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
diff --git a/local/config-samples/co1-withEE-config.json b/local/config-samples/co1-withEE-config.json
new file mode 100644
index 0000000..2109145
--- /dev/null
+++ b/local/config-samples/co1-withEE-config.json
@@ -0,0 +1,43 @@
+{
+  "links": {
+    "netconf:10.0.0.10:830/0-of:0000001e08095936/49" : {
+      "basic" : {
+        "type" : "DIRECT"
+      }
+    },
+    "of:0000001e08095936/49-netconf:10.0.0.10:830/0" : {
+      "basic" : {
+        "type" : "DIRECT"
+      }
+    }
+  },
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.10:830/0"
+        },
+        {
+          "mefPortType" : "INNI",
+          "connectPoint" : "of:0000001e08095936/51",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "clusterIps" : [
+          "10.128.14.1"
+        ],
+        "port" : "8181",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
+
+
diff --git a/local/config-samples/co2-config.json b/local/config-samples/co2-config.json
new file mode 100644
index 0000000..4567139
--- /dev/null
+++ b/local/config-samples/co2-config.json
@@ -0,0 +1,29 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.20:830/1"
+        },
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.20:830/0",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "clusterIps" : [
+          "10.128.14.1"
+        ],
+        "port" : "8181",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
diff --git a/local/config-samples/co2-withEE-config.json b/local/config-samples/co2-withEE-config.json
new file mode 100644
index 0000000..8cc3fb9
--- /dev/null
+++ b/local/config-samples/co2-withEE-config.json
@@ -0,0 +1,43 @@
+{
+  "links": {
+    "netconf:10.0.0.20:830/0-of:0000001e08095936/50" : {
+      "basic" : {
+        "type" : "DIRECT"
+      }
+    },
+    "of:0000001e08095936/50-netconf:10.0.0.20:830/0" : {
+      "basic" : {
+        "type" : "DIRECT"
+      }
+    }
+  },
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.20:830/0"
+        },
+        {
+          "mefPortType" : "INNI",
+          "connectPoint" : "of:0000001e08095936/49",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "clusterIps" : [
+          "10.128.14.1"
+        ],
+        "port" : "8181",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
+
+
diff --git a/local/config-samples/co3-config.json b/local/config-samples/co3-config.json
new file mode 100644
index 0000000..e2bcb4f
--- /dev/null
+++ b/local/config-samples/co3-config.json
@@ -0,0 +1,28 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.30:830/0"
+        },
+        {
+          "mefPortType" : "GENERIC",
+          "connectPoint" : "netconf:10.0.0.30:830/1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "clusterIps" : [
+          "10.128.14.1"
+        ],
+        "port" : "8181",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
diff --git a/local/http-channel/pom.xml b/local/http-channel/pom.xml
new file mode 100644
index 0000000..e6a367e
--- /dev/null
+++ b/local/http-channel/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord.ce</groupId>
+        <artifactId>local</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>local-channel</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>Http communication channel between hierarchic ONOS controllers</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.channel.http</onos.app.name>
+        <web.context>/ecord</web.context>
+        <onos.app.title>ECORD-CE App</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <project.version>1.0.0</project.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>bigswitch</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <_wab>src/main/webapp/</_wab>
+                        <Bundle-SymbolicName>
+                            ${project.groupId}.${project.artifactId}
+                        </Bundle-SymbolicName>
+                        <Import-Package>
+                            *,org.glassfish.jersey.servlet
+                        </Import-Package>
+                        <Web-ContextPath>${web.context}</Web-ContextPath>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+</project>
\ No newline at end of file
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java
new file mode 100644
index 0000000..a98365b
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java
@@ -0,0 +1,57 @@
+/*
+ * 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.opencord.ce.local.channel.client;
+
+import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.domain.DomainId;
+import org.opencord.ce.api.services.channel.EndPoint;
+
+import java.util.Set;
+
+/**
+ * Configuration class for this bundle.
+ * Currently this configuration is simply the connection endpoint of the global ONOS.
+ *
+ * Look at config-samples/ecord-local-config.json for a sample configuration
+ */
+public class ConnectionConfig extends Config<ApplicationId> {
+
+    private static final String PORT = "port";
+    private static final String DOMAIN_IPS = "clusterIps";
+    private static final String USERNAME = "username";
+    private static final String PASSWD = "password";
+    private static final String TOPIC = "topic";
+
+    public EndPoint global() {
+        Set<IpAddress> ipAddresses = Sets.newHashSet();
+        object.path(DOMAIN_IPS).forEach(ipAddress -> ipAddresses.add(
+                IpAddress.valueOf(ipAddress.asText())
+        ));
+        int port = object.path(PORT).asInt();
+
+        String username = object.path(USERNAME).asText();
+        String password = object.path(PASSWD).asText();
+
+        String topic = object.path(TOPIC).asText();
+
+        return new EndPoint(DomainId.domainId("global"), ipAddresses, port,
+                username, password, topic);
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java
new file mode 100644
index 0000000..e93625a
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java
@@ -0,0 +1,131 @@
+/*
+ * 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.opencord.ce.local.channel.client;
+
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.jboss.netty.util.Timeout;
+import org.jboss.netty.util.TimerTask;
+import org.onlab.packet.IpAddress;
+import org.onlab.util.Timer;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.slf4j.Logger;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Executed periodically to find the leader node of a domain.
+ * Stops when the ip is found
+ */
+public class DomainMasterIpDiscoveryTask implements TimerTask {
+
+    private final Logger log = getLogger(getClass());
+
+    private Timeout timeout;
+    private volatile boolean isStopped;
+    private EndPoint endPoint;
+    private Client client;
+    private String localSiteId;
+
+    private ObjectMapper mapper;
+
+    public DomainMasterIpDiscoveryTask(EndPoint endPoint, Client client,
+                                       ObjectMapper mapper, String localSiteId) {
+        this.endPoint = endPoint;
+        this.client = client;
+        this.mapper = mapper;
+        this.localSiteId = localSiteId;
+
+        isStopped = true;
+        start();
+
+    }
+
+    public synchronized void stop() {
+        if (!isStopped) {
+            isStopped = true;
+            timeout.cancel();
+        } else {
+            log.warn("IpDiscovery stopped multiple times?");
+        }
+    }
+
+    public synchronized void start() {
+        if (isStopped) {
+            isStopped = false;
+            timeout = Timer.getTimer().newTimeout(this, 0, SECONDS);
+        } else {
+            log.warn("IpDiscovery started multiple times?");
+        }
+    }
+
+    public synchronized boolean isStopped() {
+        return isStopped || timeout.isCancelled();
+    }
+
+    @Override
+    public void run(Timeout t) {
+        if (isStopped()) {
+            return;
+        }
+        for (IpAddress ipAddress : endPoint.ipAddresses()) {
+            String url = HTTP + COLON + DOUBLESLASH + ipAddress.toString() + COLON +
+                    endPoint.port() + BASE_URL + "/global" + MASTER + "/" + localSiteId;
+            log.info("GET: " + url);
+            WebTarget wt = client.target(url);
+            Response response = wt.request(MediaType.APPLICATION_JSON)
+                    .get();
+            log.info("DEBUG response: " + response.toString());
+            if (response.getStatus() != Response.Status.OK.getStatusCode()) {
+
+                continue;
+            }
+            String stringBody = response.readEntity(String.class);
+            try {
+                ObjectNode responseBody = (ObjectNode) mapper.readTree(stringBody);
+                if (responseBody.path(RESULT).asText().equals(OK)) {
+                    IpAddress masterIpAdress =  IpAddress.valueOf(responseBody.path(MASTER_IP).asText());
+                    HttpClientInstance.INSTANCE.setMasterIp(endPoint, masterIpAdress);
+                    this.stop();
+                    return;
+                }
+            } catch (IOException ex) {
+                log.info("getLocalMasterIp() IOException, try next endpoint ip");
+            }
+        }
+
+        if (!isStopped()) {
+            timeout = Timer.getTimer().newTimeout(this, 3, SECONDS);
+        }
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java
new file mode 100644
index 0000000..99f0d3c
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java
@@ -0,0 +1,175 @@
+/*
+ * 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.opencord.ce.local.channel.client;
+
+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.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.net.device.PortDescription;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.local.bigswitch.BigSwitchEvent;
+import org.opencord.ce.local.bigswitch.BigSwitchListener;
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Component that reacts to the BigSwitch events by notifying the global ONOS orchestrator.
+ */
+// TODO: better name
+@Component(immediate = true)
+public class HttpClientComponent {
+    private static final String APP_NAME = "org.opencord.ce.local.channel.http";
+
+    // temporary
+    private static final String TOPIC_ONE = "ecord-domains-topic-one";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LeadershipService leadershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry configRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected BigSwitchService bigSwitchService;
+
+    private EndPoint globalOnos;
+
+    private final ExecutorService eventExecutor =
+            Executors.newSingleThreadExecutor();
+
+    private final ConfigFactory<ApplicationId, ConnectionConfig> configFactory =
+            new ConfigFactory<ApplicationId, ConnectionConfig>(SubjectFactories.APP_SUBJECT_FACTORY,
+                    ConnectionConfig.class, "global") {
+                @Override
+                public ConnectionConfig createConfig() {
+                    return new ConnectionConfig();
+                }
+            };
+
+    private final NetworkConfigListener configListener = new InternalConfigListener();
+    private final BigSwitchListener bigSwitchListener = new InternalBigSwitchListener();
+
+    @Activate
+    public void activate() {
+        log.info("Started");
+
+        appId = coreService.registerApplication(APP_NAME);
+        leadershipService.runForLeadership(TOPIC_ONE);
+        configRegistry.registerConfigFactory(configFactory);
+        configService.addListener(configListener);
+        bigSwitchService.addListener(bigSwitchListener);
+        HttpClientInstance.INSTANCE.configure(clusterService, leadershipService);
+    }
+
+    @Deactivate
+    public void deactivate() {
+        log.info("Stopped");
+
+        leadershipService.withdraw(TOPIC_ONE);
+        bigSwitchService.removeListener(bigSwitchListener);
+        configService.removeListener(configListener);
+        configRegistry.unregisterConfigFactory(configFactory);
+        HttpClientInstance.INSTANCE.stopNetworkTasks();
+    }
+
+    private void readConfig() {
+        globalOnos = configRegistry.getConfig(appId, ConnectionConfig.class)
+                        .global();
+        if (globalOnos == null) {
+            log.error("Configuration failure");
+            return;
+        }
+        HttpClientInstance.INSTANCE.setGlobalOnos(globalOnos);
+    }
+
+    private class InternalBigSwitchListener implements BigSwitchListener {
+
+        @Override
+        public void event(BigSwitchEvent event) {
+            log.info(event.toString());
+            switch (event.type()) {
+                case DEVICE_CREATED:
+                    log.info("DEBUG: DEV_CREATED event");
+                    HttpClientInstance.INSTANCE.notifyBigSwitch();
+                case PORT_ADDED:
+                case PORT_UPDATED:
+                case PORT_REMOVED:
+                    // the subject is port last updated / added port
+                    // but we are not interested in it now
+                    List<PortDescription> ports = event.allPorts();
+                    HttpClientInstance.INSTANCE.notifyBigSwitchPorts(ports);
+                    break;
+                case DEVICE_REMOVED:
+                    // TODO
+                    break;
+                default:
+                        break;
+            }
+        }
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if (!event.configClass().equals(ConnectionConfig.class)) {
+                return;
+            }
+            switch (event.type()) {
+                case CONFIG_ADDED:
+                    log.info("Network configuration added");
+                    eventExecutor.execute(HttpClientComponent.this::readConfig);
+                    break;
+                case CONFIG_UPDATED:
+                    log.info("Network configuration updated");
+                    eventExecutor.execute(HttpClientComponent.this::readConfig);
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java
new file mode 100644
index 0000000..0d831d9
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java
@@ -0,0 +1,247 @@
+/*
+ * 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.opencord.ce.local.channel.client;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.ChassisId;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DefaultDevice;
+import org.onosproject.net.DefaultPort;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.services.channel.EndPoint;
+import org.opencord.ce.api.services.channel.RequestCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.opencord.ce.api.services.channel.Symbols.BASE_URL;
+import static org.opencord.ce.api.services.channel.Symbols.COLON;
+import static org.opencord.ce.api.services.channel.Symbols.DELETE;
+import static org.opencord.ce.api.services.channel.Symbols.DOUBLESLASH;
+import static org.opencord.ce.api.services.channel.Symbols.GET;
+import static org.opencord.ce.api.services.channel.Symbols.HTTP;
+import static org.opencord.ce.api.services.channel.Symbols.POST;
+
+/**
+ * HTTP client instance used to communicate
+ * to the global ONOS events related to the big switch topology abstraction.
+ */
+public enum HttpClientInstance {
+    INSTANCE;
+    private final Logger log =
+            LoggerFactory.getLogger(HttpClientInstance.class);
+    private static final Object MONITOR = new Object();
+
+    private static final int STATUS_OK = Response.Status.OK.getStatusCode();
+    private static final int STATUS_REQ_UNPROCESSABLE = Response.Status.NOT_ACCEPTABLE.getStatusCode();
+
+    private final AbstractWebResource codecContext = new AbstractWebResource();
+    private final Client client = ClientBuilder.newClient();
+
+    private ClusterService clusterService;
+    private LeadershipService leadershipService;
+    private EndPoint globalOnos;
+    private IpAddress currentRemoteMasterIp;
+    private DomainMasterIpDiscoveryTask globalMasterIpDiscoveryTask;
+
+    private final ExecutorService networkExecutor =
+            newSingleThreadExecutor();
+
+    public void configure(ClusterService clusterService, LeadershipService leadershipService) {
+            this.clusterService = clusterService;
+            this.leadershipService = leadershipService;
+    }
+
+    protected void setGlobalOnos(EndPoint globalOnos) {
+        synchronized (MONITOR) {
+            this.globalOnos = globalOnos;
+        }
+        // TODO: add leadership listeners to react to changes
+        if (isLeader(globalOnos.topic())) {
+            globalMasterIpDiscoveryTask =
+                    new DomainMasterIpDiscoveryTask(globalOnos, client, codecContext.mapper(),
+                            clusterService.getLocalNode().id().id());
+        }  else {
+            log.info("I am NOT the leader for the communication with the global");
+        }
+    }
+
+    protected void setMasterIp(EndPoint endPoint, IpAddress ipAddress) {
+        synchronized (MONITOR) {
+            currentRemoteMasterIp = ipAddress;
+            MONITOR.notify();
+        }
+    }
+
+    private boolean isLeader(String topic) {
+        return leadershipService.getLeader(topic).id()
+                .equals(clusterService.getLocalNode().id().id());
+    }
+
+    private boolean checkReply(Response response) {
+        if (response != null) {
+            return checkStatusCode(response.getStatus());
+        }
+        log.error("Null reply from end point");
+        return false;
+    }
+
+    private boolean checkStatusCode(int statusCode) {
+        if (statusCode == STATUS_OK) {
+            return true;
+        } else {
+            log.error("Failed request, HTTP error code : "
+                    + statusCode);
+            return false;
+        }
+    }
+
+    public void stopNetworkTasks() {
+        globalMasterIpDiscoveryTask.stop();
+    }
+
+    public void notifyBigSwitch() {
+        String siteId = clusterService.getLocalNode().id().id();
+        String deviceId = "domain:" + siteId;
+        String resource = "/" + siteId + "/" + deviceId;
+        ObjectNode body = codecContext.mapper().createObjectNode();
+        // body is empty for now
+        networkExecutor.execute(new NetworkTask(POST, resource, body.toString(), new RequestCallback() {
+            @Override
+            public void onSuccess(Response response) {
+
+            }
+
+            @Override
+            public void onError(Response response) {
+
+            }
+        }));
+    }
+
+    public void notifyBigSwitchPorts(List<PortDescription> ports) {
+        String siteId = clusterService.getLocalNode().id().id();
+        JsonCodec<Port> portCodec = codecContext.codec(Port.class);
+        ArrayNode body = codecContext.mapper().createArrayNode();
+        DeviceId deviceId = DeviceId.deviceId("domain:" + siteId);
+        ports.forEach(portDescription ->
+            body.add(portCodec.encode(new DefaultPort(new DummyDevice(deviceId), portDescription.portNumber(),
+                    portDescription.isEnabled(), portDescription.type(),
+                    portDescription.portSpeed(), portDescription.annotations()), codecContext)));
+        String resource = "/" + siteId + "/" + deviceId + "/ports";
+        networkExecutor.execute(new NetworkTask(POST, resource, body.toString(), new RequestCallback() {
+            @Override
+            public void onSuccess(Response response) {
+
+            }
+
+            @Override
+            public void onError(Response response) {
+
+            }
+        }));
+
+    }
+
+    private class NetworkTask implements Runnable {
+        private String method;
+        private String resource;
+        private String body;
+        private RequestCallback callback;
+
+        NetworkTask(String method, String resource, String body,
+                    RequestCallback callback) {
+            this.method = method;
+            this.resource = resource;
+            this.body = body;
+            this.callback = callback;
+        }
+        @Override
+        public void run() {
+            synchronized (MONITOR) {
+                while (globalOnos == null || currentRemoteMasterIp == null) {
+                    try {
+                        log.info("wait() global-ONOS endpoint");
+                        MONITOR.wait();
+                    } catch (InterruptedException ie) {
+                        log.info("Interrupted exception: " + ie.getMessage());
+                    }
+                }
+            }
+            String url = HTTP + COLON + DOUBLESLASH + currentRemoteMasterIp + COLON +
+                    globalOnos.port() + BASE_URL + "/global/topology" + resource;
+
+            log.info("Sending data via http: url: {}\n body: {}", url, body);
+
+            WebTarget webTarget = client.target(url);
+            Response response;
+            switch (method) {
+                case POST:
+                    response = webTarget.request(MediaType.APPLICATION_JSON)
+                            .post(Entity.entity(body, MediaType.APPLICATION_JSON));
+                    break;
+                case DELETE:
+                    response = webTarget.request(MediaType.APPLICATION_JSON).delete();
+                    break;
+                case GET:
+                default:
+                    response = webTarget.request(MediaType.APPLICATION_JSON).get();
+                    break;
+            }
+
+            if (!checkReply(response)) {
+                callback.onError(response);
+            } else {
+                callback.onSuccess(response);
+            }
+        }
+    }
+
+    /**
+     * Dummy Device which only holds DeviceId.
+     */
+    private static final class DummyDevice extends DefaultDevice {
+        /**
+         * Constructs Dummy Device which only holds DeviceId.
+         *
+         * @param did device Id
+         */
+        public DummyDevice(DeviceId did) {
+            super(new ProviderId(did.uri().getScheme(), "PortCodec"), did,
+                    Type.SWITCH, "dummy", "0", "0", "0", new ChassisId(),
+                    DefaultAnnotations.EMPTY);
+        }
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java
new file mode 100644
index 0000000..725a3db
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/TestTopology.java
@@ -0,0 +1,211 @@
+/*
+ * 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.opencord.ce.local.channel.client;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.packet.ChassisId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Link;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.link.DefaultLinkDescription;
+import org.onosproject.net.link.LinkDescription;
+import org.onosproject.net.link.LinkProvider;
+import org.onosproject.net.link.LinkProviderRegistry;
+import org.onosproject.net.link.LinkProviderService;
+import org.onosproject.net.provider.ProviderId;
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Inject fake topology elements.
+ */
+//@Component(immediate = true)
+public class TestTopology implements DeviceProvider,
+        LinkProvider {
+    public static final String PROVIDER_NAME = "org.opencord.ce.local.test";
+    public static final ProviderId PROVIDER_ID = new ProviderId("test", PROVIDER_NAME);
+    private static final String UNKNOWN = "unknown";
+
+    private final Logger log = getLogger(getClass());
+    public static final String TEST_DEV_PREFIX = "test:0000";
+    public static final int NUM = 1;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceProviderRegistry deviceProviderRegistry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkProviderRegistry linkProviderRegistry;
+
+    protected DeviceProviderService deviceProviderService;
+    protected LinkProviderService linkProviderService;
+
+    @Override
+    public ProviderId id() {
+        return PROVIDER_ID;
+    }
+
+    @Activate
+    public void activate() {
+        coreService.registerApplication(PROVIDER_NAME);
+        deviceProviderService = deviceProviderRegistry.register(this);
+        linkProviderService = linkProviderRegistry.register(this);
+
+        new Thread(this::buildFakeNetwork).start();
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        deviceProviderRegistry.unregister(this);
+        linkProviderRegistry.unregister(this);
+        log.info("Stopped");
+    }
+
+    @Override
+    public void triggerProbe(DeviceId deviceId){
+
+    }
+
+    @Override
+    public void roleChanged(DeviceId deviceId, MastershipRole newRole) {
+
+    }
+
+    @Override
+    public boolean isReachable(DeviceId deviceId) {
+        return true;
+    }
+
+    @Override
+    public void changePortState(DeviceId deviceId, PortNumber portNumber,
+                                boolean enable) {
+
+    }
+
+    private void buildFakeNetwork() {
+        ChassisId chassisId = new ChassisId();
+        SparseAnnotations annotations = DefaultAnnotations.builder()
+                .set("no-lldp", "any")
+                .set("test", "test")
+                .build();
+        int i;
+        int j;
+        for (i = 1; i <= NUM; i++) {
+            DeviceId deviceId = DeviceId.deviceId(TEST_DEV_PREFIX + i);
+            DeviceDescription deviceDescription = new DefaultDeviceDescription(
+                    deviceId.uri(),
+                    Device.Type.SWITCH,
+                    UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN,
+                    chassisId, annotations);
+            deviceProviderService.deviceConnected(deviceId, deviceDescription);
+            List<PortDescription> ports = new ArrayList<>();
+            for (j = 1; j <= NUM; j++) {
+                ports.add(new DefaultPortDescription(PortNumber.portNumber(j),
+                        true, Port.Type.FIBER, 10000,
+                        annotations));
+
+            }
+            deviceProviderService.updatePorts(deviceId, ports);
+
+            String macString = randomMCAddress();
+            log.info("MacString: {}", macString);
+/*
+            HostDescription hostDescription = new DefaultHostDescription(MacAddress.valueOf(macString),
+                    VlanId.NONE,
+                    new HostLocation(deviceId, PortNumber.portNumber(1), 0),
+                    annotations);
+            hostProviderService.hostDetected(hostId, hostDescription, true);
+            */
+        }
+
+        long seed = (long) ThreadLocalRandom.current().nextDouble();
+        Random rand = new Random(seed);
+        for (i = 1; i <= NUM; i++) {
+            for (j = i + 1; j <= NUM; j++) {
+
+
+                if (rand.nextDouble() > 0.5) {
+                    continue;
+                }
+
+                LinkDescription linkDescription = new DefaultLinkDescription(
+                        ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + i + "/" + j),
+                        ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + j + "/" + (i + 1)),
+                        Link.Type.DIRECT,
+                        true,
+                        annotations
+                );
+                LinkDescription linkDescription1 = new DefaultLinkDescription(
+                        ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + j + "/" + (i + 1)),
+                        ConnectPoint.deviceConnectPoint(TEST_DEV_PREFIX + i + "/" + j),
+                        Link.Type.DIRECT,
+                        true,
+                        annotations
+                );
+                linkProviderService.linkDetected(linkDescription);
+                linkProviderService.linkDetected(linkDescription1);
+            }
+        }
+    }
+    private String randomMCAddress() {
+        Random rand = new Random();
+        byte[] macAddr = new byte[6];
+        rand.nextBytes(macAddr);
+
+        macAddr[0] = (byte) (macAddr[0] & (byte) 254);  //zeroing last 2
+        // bytes to make it unicast and locally adminstrated
+        StringBuilder sb = new StringBuilder(18);
+        for (byte b : macAddr) {
+
+            if (sb.length() > 0) {
+                sb.append(":");
+            }
+            sb.append(String.format("%02x", b));
+        }
+        return sb.toString();
+    }
+
+
+
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java
new file mode 100644
index 0000000..93ee03f
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the client-side communication channel APIs.
+ */
+package org.opencord.ce.local.channel.client;
\ No newline at end of file
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java
new file mode 100644
index 0000000..4f906c6
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/DomainMasterIpResource.java
@@ -0,0 +1,64 @@
+/*
+ * 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.opencord.ce.local.channel.server;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onlab.packet.IpAddress;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_API_NO_IP_BODY;
+import static org.opencord.ce.api.services.channel.Symbols.MASTER_IP;
+import static org.opencord.ce.api.services.channel.Symbols.OK;
+import static org.opencord.ce.api.services.channel.Symbols.RESULT;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Gets the ip of the instance leader of the communication with the specified
+ * domainId.
+ */
+@Path("master")
+public class DomainMasterIpResource extends AbstractWebResource {
+    private final Logger log = getLogger(getClass());
+
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getMasterIp() {
+        log.info("Global domain asks who is the master for him");
+
+        //IpAddress ip = get(ConnectionService.class).getLocalMasterIp(id);
+
+        // testing
+        IpAddress ip = get(ClusterService.class).getLocalNode().ip();
+        if (ip != null) {
+            ObjectNode body = mapper().createObjectNode();
+            body.put(RESULT, OK);
+            body.put(MASTER_IP, ip.toString());
+
+            return ok(body.toString()).build();
+        } else {
+            return ok(MASTER_API_NO_IP_BODY).build();
+        }
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java
new file mode 100644
index 0000000..810fa2d
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java
@@ -0,0 +1,33 @@
+/*
+ * 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.opencord.ce.local.channel.server;
+
+import org.onlab.rest.AbstractWebApplication;
+
+import java.util.Set;
+
+
+/**
+ * Loader class for web resource APIs.
+ */
+public class EcordLocalRestApp extends AbstractWebApplication {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return getClasses(MetroNetworkResource.class, DomainMasterIpResource.class);
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java
new file mode 100644
index 0000000..281315a
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/MetroNetworkResource.java
@@ -0,0 +1,176 @@
+/*
+ * 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.opencord.ce.local.channel.server;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.models.CarrierEthernetForwardingConstruct;
+import org.opencord.ce.api.models.CarrierEthernetNetworkInterface;
+import org.opencord.ce.api.models.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+import org.slf4j.Logger;
+
+import javax.ws.rs.Consumes;
+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;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Web resource for {@link MetroNetworkVirtualNodeService}
+ * APIs.
+ */
+@Path("carrierethernet")
+public class MetroNetworkResource extends AbstractWebResource {
+    private final Logger log = getLogger(getClass());
+    private static final String FC = "fc";
+    private static final String SRC_NI = "srcNi";
+    private static final String DST_NI_LIST = "dstNiList";
+    private static final String UNI = "uni";
+
+    private JsonCodec<CarrierEthernetForwardingConstruct> fcCodec =
+            codec(CarrierEthernetForwardingConstruct.class);
+    private JsonCodec<CarrierEthernetNetworkInterface> niCodec =
+            codec(CarrierEthernetNetworkInterface.class);
+
+    @Path("ForwardingConstruct")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @POST
+    public Response setNodeForwarding(InputStream stream) {
+        try {
+            JsonNode responseBody = mapper().readTree(stream);
+            log.info(responseBody.toString());
+            MetroNetworkVirtualNodeService localNodeService =
+                    get(MetroNetworkVirtualNodeService.class);
+
+            CarrierEthernetForwardingConstruct fc =
+                    fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+            CarrierEthernetNetworkInterface srcNi =
+                    niCodec.decode((ObjectNode) responseBody.path(SRC_NI), this);
+            Set<CarrierEthernetNetworkInterface> dstNiSet = new HashSet<>();
+            responseBody.path(DST_NI_LIST).forEach(jsonDstNi ->
+                dstNiSet.add(niCodec.decode((ObjectNode) jsonDstNi, this)));
+
+            localNodeService.setNodeForwarding(fc, srcNi, dstNiSet);
+            return Response.status(200).build();
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+    }
+
+    @Path("createBwp")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @POST
+    public Response createBandwidthProfileResources(InputStream stream) {
+        try {
+            MetroNetworkVirtualNodeService localNodeService =
+                    get(MetroNetworkVirtualNodeService.class);
+
+            JsonNode responseBody = mapper().readTree(stream);
+            log.info(responseBody.toString());
+
+            CarrierEthernetForwardingConstruct fc =
+                    fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+            CarrierEthernetUni uni = (CarrierEthernetUni)
+                    niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+            localNodeService.createBandwidthProfileResources(fc, uni);
+            return Response.status(200).build();
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+    }
+
+    @Path("applyBwp")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @POST
+    public Response applyBandwidthProfileResources(InputStream stream) {
+        try {
+            MetroNetworkVirtualNodeService localNodeService =
+                    get(MetroNetworkVirtualNodeService.class);
+
+            JsonNode responseBody = mapper().readTree(stream);
+            log.info(responseBody.toString());
+
+            CarrierEthernetForwardingConstruct fc =
+                fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+            CarrierEthernetUni uni = (CarrierEthernetUni)
+                niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+
+            localNodeService.applyBandwidthProfileResources(fc, uni);
+            return Response.status(200).build();
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+    }
+
+    @Path("deleteBwp")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @POST
+    public Response removeBandwidthProfileResources(InputStream stream) {
+        try {
+            MetroNetworkVirtualNodeService localNodeService =
+                    get(MetroNetworkVirtualNodeService.class);
+
+            JsonNode responseBody = mapper().readTree(stream);
+            log.info(responseBody.toString());
+
+            CarrierEthernetForwardingConstruct fc =
+                    fcCodec.decode((ObjectNode) responseBody.path(FC), this);
+
+            CarrierEthernetUni uni = (CarrierEthernetUni)
+                    niCodec.decode((ObjectNode) responseBody.path(UNI), this);
+
+            localNodeService.applyBandwidthProfileResources(fc, uni);
+            return Response.status(200).build();
+        } catch (IOException io) {
+            log.info("Json parse error");
+            return Response.status(Response.Status.NOT_ACCEPTABLE).build();
+        }
+    }
+
+    @Path("deleteFcResources/{fcId}")
+    @Produces(MediaType.APPLICATION_JSON)
+    @GET
+    public Response removeAllForwardingResources(@PathParam("{fcId}") String fcId) {
+        EvcConnId evcId = EvcConnId.of(fcId);
+        MetroNetworkVirtualNodeService localNodeService =
+                get(MetroNetworkVirtualNodeService.class);
+
+        localNodeService.removeAllForwardingResources(evcId);
+        return Response.status(200).build();
+    }
+}
diff --git a/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java
new file mode 100644
index 0000000..ab612ed
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the server-side communication channel APIs.
+ */
+package org.opencord.ce.local.channel.server;
\ No newline at end of file
diff --git a/local/http-channel/src/main/webapp/WEB-INF/web.xml b/local/http-channel/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..32cc06c
--- /dev/null
+++ b/local/http-channel/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         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>ICONA REST API v1.0</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.opencord.ce.local.channel.server.EcordLocalRestApp</param-value>
+        </init-param>
+        <load-on-startup>10</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>JAX-RS Service</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>
diff --git a/local/pom.xml b/local/pom.xml
new file mode 100644
index 0000000..c91f1b8
--- /dev/null
+++ b/local/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.opencord</groupId>
+        <artifactId>ce</artifactId>
+        <version>1.0.0</version>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>local</artifactId>
+    <version>1.0.0</version>
+    <packaging>pom</packaging>
+
+    <description>Local components of the Carrier Ethernet Metro application</description>
+
+    <properties>
+        <onos.version>1.10.3</onos.version>
+        <onos.app.title>ECORD Carrier Ethernet local site component</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <modules>
+        <module>bigswitch</module>
+        <module>http-channel</module>
+        <module>ce-transport</module>
+        <module>ce-vee</module>
+        <module>ce-central-office</module>
+        <module>common-component</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>ce-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..043f81a
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+<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>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-dependencies</artifactId>
+        <version>1.10.3</version>
+        <relativePath></relativePath>
+    </parent>
+
+    <groupId>org.opencord</groupId>
+    <artifactId>ce</artifactId>
+    <version>1.0.0</version>
+    <packaging>pom</packaging>
+
+    <description>Virtual ethernet edge service for CORD</description>
+
+    <properties>
+        <onos.app.category>Traffic Steering</onos.app.category>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </properties>
+
+    <modules>
+        <module>ce-api</module>
+        <module>local</module>
+        <module>global</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord</groupId>
+            <artifactId>cord-config</artifactId>
+            <version>1.2-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.onosproject</groupId>
+                <artifactId>onos-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshots</id>
+            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+            <releases><enabled>false</enabled></releases>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
