diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..761323d
--- /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 2017 Open Networking Foundation
+
+  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..5ac4b5d
--- /dev/null
+++ b/ce-api/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+        <relativePath>../</relativePath>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>ce-api</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <description>Carrier Ethernet service API</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.api</onos.app.name>
+        <onos.app.title>Carrier Ethernet service API</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.6</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..3eeae81
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetBandwidthProfile.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..ce4b1ed
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetConnection.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..15659d6
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEnni.java
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..dd59c42
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetEvcUtils.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..e4e4ddc
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetForwardingConstruct.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..e543a07
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetGenericNi.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..ec49e88
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetInni.java
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..3e0e582
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetLogicalTerminationPoint.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..322e3a4
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetNetworkInterface.java
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.osgi.ServiceDirectory;
+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 static ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
+
+    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);
+        DeviceService deviceService = serviceDirectory.get(DeviceService.class);
+        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..5f480d6
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetSpanningTreeWeight.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..2e97c61
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetUni.java
@@ -0,0 +1,419 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..15686d9
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/CarrierEthernetVirtualConnection.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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/DomainEndPoint.java b/ce-api/src/main/java/org/opencord/ce/api/models/DomainEndPoint.java
new file mode 100644
index 0000000..f7d8375
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/DomainEndPoint.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.IpAddress;
+import org.onosproject.net.domain.DomainId;
+
+/**
+ * ONOS cluster endpoint for the communication between local and global.
+ */
+public class DomainEndPoint {
+    private DomainId domainId;
+    private IpAddress publicIp;
+    private int port;
+    private String username;
+    private String password;
+    private String topic;
+
+    public DomainEndPoint(DomainId domainId, IpAddress publicIp, int port,
+                    String username, String password, String topic) {
+        this.domainId = domainId;
+        this.publicIp = publicIp;
+        this.port = port;
+        this.username = username;
+        this.password = password;
+        this.topic = topic;
+    }
+
+    public DomainId domainId() {
+        return domainId;
+    }
+
+    public IpAddress publicIp() {
+        return publicIp;
+    }
+
+    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/models/EvcConnId.java b/ce-api/src/main/java/org/opencord/ce/api/models/EvcConnId.java
new file mode 100644
index 0000000..77de4a2
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/EvcConnId.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..be2e5ee
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/PortVlanConfig.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..1865ab3
--- /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 Foundation
+ *
+ * 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..093c373
--- /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 Foundation
+ *
+ * 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..89bc338
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/models/codecs/CarrierEthernetEvcCodec.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.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 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 CarrierEthernetVirtualConnection.builder()
+                .id(EvcConnId.of(argEvcId == null ? argEvcCfgId : 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/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..7395279
--- /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 Foundation
+ *
+ * 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..67b46ae
--- /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 Foundation
+ *
+ * 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..3c633fc
--- /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 Foundation
+ *
+ * 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..10061fd
--- /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 Foundation
+ *
+ * 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..060acc1
--- /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 Foundation
+ *
+ * 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..6d815fe
--- /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 Foundation
+ *
+ * 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..c57bccc
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkProvisionerService.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..2f1894d
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroNetworkVirtualNodeService.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..f0d158f
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/MetroOrchestrationService.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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/ControlChannelListenerService.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/ControlChannelListenerService.java
new file mode 100644
index 0000000..f85e13d
--- /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 Foundation
+ *
+ * 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/RequestCallback.java b/ce-api/src/main/java/org/opencord/ce/api/services/channel/RequestCallback.java
new file mode 100644
index 0000000..9d9b0e2
--- /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 Foundation
+ *
+ * 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..ea28756
--- /dev/null
+++ b/ce-api/src/main/java/org/opencord/ce/api/services/channel/Symbols.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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 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..d66fa7e
--- /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 Foundation
+ *
+ * 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..5f6a3a2
--- /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 Foundation
+ *
+ * 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..122c309
--- /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 Foundation
+ *
+ * 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..94e8367
--- /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 Foundation
+ *
+ * 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..acc1d06
--- /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 Foundation
+ *
+ * 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..1b099ed
--- /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 Foundation
+ *
+ * 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..cd51403
--- /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 Foundation
+ *
+ * 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..37711e3
--- /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 Foundation
+ *
+ * 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..37f2a35
--- /dev/null
+++ b/global/app/app.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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..bcc7471
--- /dev/null
+++ b/global/app/features.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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..0c6f282
--- /dev/null
+++ b/global/app/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>ecord-global-app</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <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..fb2ed3c
--- /dev/null
+++ b/global/ce-orchestration/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</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.6</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..99c7c05
--- /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 Foundation
+ *
+ * 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..fc118ed
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
@@ -0,0 +1,1327 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.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() {
+        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();
+    }
+
+    @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..4bce91f
--- /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 Foundation
+ *
+ * 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..9b98ec4
--- /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 Foundation
+ *
+ * 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..2fc97ec
--- /dev/null
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/cli/commands/CarrierEthernetCreateEvcCommand.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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 == null ? argEvcCfgId : 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..57fe6d5
--- /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 Foundation
+ *
+ * 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..bf92286
--- /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 Foundation
+ *
+ * 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..471a619
--- /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 Foundation
+ *
+ * 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..f5ad4bc
--- /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 Foundation
+ *
+ * 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..951acba
--- /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 Foundation
+ *
+ * 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..51182d4
--- /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 Foundation
+ *
+ * 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..21272be
--- /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 Foundation
+ *
+ * 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..9e95562
--- /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 Foundation
+ *
+ * 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..0a4cf4f
--- /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 Foundation
+ *
+ * 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..e68df70
--- /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 Foundation
+ *
+ * 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..85a480e
--- /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 Foundation
+ *
+ * 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..39234b8
--- /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 Foundation
+ *
+ * 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/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..d3a0873
--- /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 Foundation
+ *
+ * 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..ea08bbd
--- /dev/null
+++ b/global/ce-orchestration/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,41 @@
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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..99cfcf2
--- /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 Foundation
+  ~
+  ~ 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..5b9e72a
--- /dev/null
+++ b/global/config-samples/ecord-global-config.json
@@ -0,0 +1,57 @@
+{
+  "apps" : {
+    "org.opencord.ce.global.vprovider" : {
+      "xos" : {
+        "username" : "xosadmin@opencord.org",
+        "password" : "0Ui8QNJNCdXrjjLpF1U6",
+        "address" : "127.0.0.1",
+        "resource" : "/xosapi/v1/metronet/usernetworkinterfaces/"
+      }
+    },
+    "org.opencord.ce.global.channel.http" : {
+      "endPoints" : {
+        "port" : "8182",
+        "topics" : [
+          "ecord-domains-topic-one",
+          "ecord-domains-topic-two",
+          "ecord-domains-topic-three"
+        ],
+        "domains" :
+        [
+          {
+            "domainId" : "domain1-onos-fabric",
+            "publicIp" : "10.128.14.10",
+            "port" : "8181",
+            "username" : "sdn",
+            "password" : "rocks",
+            "topic" : "ecord-domains-topic-one"
+          },
+          {
+            "domainId" : "domain1-onos-cord",
+            "publicIp" : "10.128.14.10",
+            "port" : "8182",
+            "username" : "sdn",
+            "password" : "rocks",
+            "topic" : "ecord-domains-topic-one"
+          },
+          {
+            "domainId" : "domain2-onos-fabric",
+            "publicIp" : "10.128.14.20",
+            "port" : "8181",
+            "username" : "sdn",
+            "password" : "rocks",
+            "topic" : "ecord-domains-topic-one"
+          },
+          {
+            "domainId" : "domain2-onos-cord",
+            "publicIp" : "10.128.14.20",
+            "port" : "8182",
+            "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..76f81e5
--- /dev/null
+++ b/global/http-channel/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>global-channel</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <description>HTTP communication channel between hierarchical 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.6</onos.version>
+        <onos.app.url>http://opencord.org</onos.app.url>
+    </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/client/ConnectionConfig.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/ConnectionConfig.java
new file mode 100644
index 0000000..ca7388a
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/ConnectionConfig.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.models.DomainEndPoint;
+
+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 PUBLIC_IP = "publicIp";
+    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<DomainEndPoint> endPoints() {
+        JsonNode peersNode = object.get(DOMAINS);
+        Set<DomainEndPoint> endPoints = Sets.newHashSet();
+
+        peersNode.forEach(jsonNode -> {
+            DomainId domainId = DomainId.domainId(
+                    jsonNode.path(DOMAIN_ID).asText());
+            IpAddress publicIp = IpAddress.valueOf(jsonNode.path(PUBLIC_IP).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 DomainEndPoint(domainId, publicIp, port,
+                    username, password, topic));
+        });
+
+        return endPoints;
+    }
+}
diff --git a/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientComponent.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientComponent.java
new file mode 100644
index 0000000..3939ac4
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientComponent.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.google.common.collect.Sets;
+
+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.domain.DomainService;
+import org.opencord.ce.api.services.channel.ControlChannelListenerService;
+import org.opencord.ce.api.models.DomainEndPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+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)
+public class HttpClientComponent {
+    private static final String APP_NAME = "org.opencord.ce.global.channel.http";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    private ApplicationId appId;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LeadershipService leadershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ClusterService clusterService;
+
+    @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 static boolean isRunningForLeadership = false;
+
+    private final Set<DomainEndPoint> endPoints = Sets.newHashSet();
+    private final List<String> topics = new ArrayList<>();
+
+    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);
+        configRegistry.registerConfigFactory(configFactory);
+        configService.addListener(configListener);
+        channelListenerService.addListener(HttpClientInstance.INSTANCE);
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        log.info("Stopped");
+        configService.removeListener(configListener);
+        configRegistry.unregisterConfigFactory(configFactory);
+        channelListenerService.removeListener(HttpClientInstance.INSTANCE);
+        if (isRunningForLeadership) {
+            topics.forEach(topic -> leadershipService.withdraw(topic));
+        }
+    }
+
+    private void runForLeadership(List<String> topics) {
+        topics.forEach(topic ->
+            leadershipService.runForLeadership(topic));
+        isRunningForLeadership = true;
+    }
+
+
+    private void readConfig() {
+        ConnectionConfig config = configRegistry.getConfig(appId, ConnectionConfig.class);
+        log.debug("Domains connections config received");
+
+        endPoints.addAll(config.endPoints());
+        topics.addAll(config.topics());
+        runForLeadership(topics);
+        HttpClientInstance.INSTANCE.configure(clusterService, leadershipService, domainService, endPoints);
+    }
+
+    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/HttpClientInstance.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
new file mode 100644
index 0000000..a6687a1
--- /dev/null
+++ b/global/http-channel/src/main/java/org/opencord/ce/global/channel/client/HttpClientInstance.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+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.DomainEndPoint;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.api.services.MetroNetworkVirtualNodeService;
+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, DomainEndPoint>> domainsEndPointsMap = 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, Set<DomainEndPoint> endPoints) {
+
+        if (!configured) {
+            this.clusterService = clusterService;
+            this.leadershipService = leadershipService;
+            this.domainService = domainService;
+            configured = true;
+        }
+        endPoints.forEach(siteConfig -> {
+            DomainId domainId = siteConfig.domainId();
+            synchronized (this) {
+                domainsEndPointsMap.putIfAbsent(domainId,
+                        Pair.of(createClient(), siteConfig));
+                notify();
+            }
+        });
+    }
+
+    public Client getConnectionInfo(DomainId domainId) {
+        return domainsEndPointsMap.get(domainId).getLeft();
+    }
+
+    private boolean isLeader(String topic) {
+        return topic != null && 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;
+        }
+    }
+
+    private String getTopic(DomainId domainId) {
+        if (domainsEndPointsMap.get(domainId) != null) {
+            return domainsEndPointsMap.get(domainId).getRight().topic();
+        }
+        log.info("Domain ID {} not among configured domain IDs", domainId.id());
+        return null;
+    }
+
+    private Client createClient() {
+        return ClientBuilder.newClient();
+    }
+
+    @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 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());
+                    }
+
+                }
+            }
+            DomainEndPoint endPoint = domainsEndPointsMap.get(domainId).getRight();
+
+            Client client = domainsEndPointsMap.get(domainId).getLeft();
+
+            String url = HTTP + COLON + DOUBLESLASH + endPoint.publicIp().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..fd18189
--- /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 Foundation
+ *
+ * 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..a77b5a4
--- /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 Foundation
+ *
+ * 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..96e6714
--- /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 Foundation
+ *
+ * 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/EcordGlobalRestApp.java b/global/http-channel/src/main/java/org/opencord/ce/global/channel/server/EcordGlobalRestApp.java
new file mode 100644
index 0000000..c0d9afd
--- /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 Foundation
+ *
+ * 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);
+    }
+}
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..e82f4d2
--- /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 Foundation
+ *
+ * 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..07cceef
--- /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 2017-present Open Networking Foundation
+  ~
+  ~ 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..26f40d0
--- /dev/null
+++ b/global/pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>global</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <description>Multi-CORD orchestration of Carrier Ethernet services</description>
+
+    <properties>
+        <onos.version>1.10.6</onos.version>
+        <onos.app.title>E-CORD 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..0438e93
--- /dev/null
+++ b/global/virtualprovider/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</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.6</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>
+    </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..d1bdefb
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualDomainDeviceProvider.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..361d74c
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/VirtualLinkProvider.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..1d72b40
--- /dev/null
+++ b/global/virtualprovider/src/main/java/org/opencord/ce/global/virtualdomain/XoSHttpClient.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..1077993
--- /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 Foundation
+ *
+ * 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..df0c59e
--- /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 Foundation
+ *
+ * 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..62fbacc
--- /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 Foundation
+ *
+ * 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..c71407e
--- /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 Foundation
+ *
+ * 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..f11c4a6
--- /dev/null
+++ b/local/bigswitch/pom.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</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>E-CORD Carrier Ethernet bigswitch abstraction</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <onos.version>1.10.6</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>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </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..54fac26
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchEvent.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..2738916
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchListener.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..4629295
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchManager.java
@@ -0,0 +1,409 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.base.Strings;
+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.cfg.ComponentConfigService;
+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.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 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.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.opencord.ce.local.bigswitch.MefPortsConfig.MefPortConfig;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * 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 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 ComponentConfigService componentConfigService;
+
+    @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 StorageService storageService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService networkConfigService;
+
+    private static final String DOMAIN_ID = "domainId";
+    @Property(name = DOMAIN_ID, value = DEFAULT_DOMAIN_ID, label = "Domain ID where this ONOS is running")
+    private String domainId = DEFAULT_DOMAIN_ID;
+
+    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 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.registerApplication(APP_NAME);
+        componentConfigService.registerProperties(getClass());
+        configRegistry.registerConfigFactory(configFactory);
+        networkConfigService.addListener(configListener);
+        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);
+        deviceService.addListener(deviceListener);
+        log.info("Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        networkConfigService.removeListener(configListener);
+        configRegistry.unregisterConfigFactory(configFactory);
+        deviceService.removeListener(deviceListener);
+        componentConfigService.unregisterProperties(getClass(), false);
+        log.info("Stopped");
+    }
+
+    @Modified
+    public void modified(ComponentContext context) {
+        Dictionary<?, ?> properties = context != null ? context.getProperties() : new Properties();
+
+        String d = get(properties, DOMAIN_ID);
+        if (!Strings.isNullOrEmpty(d)) {
+            // TODO: signal new domain id to global
+            domainId = d;
+        }
+
+        log.info("Domain ID set to {}", domainId());
+    }
+
+    @Override
+    public List<PortDescription> getPorts() {
+        return portMap.keySet().stream()
+                .map(this::toVirtualPortDescription)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+    }
+
+    @Override
+    public PortNumber getPort(ConnectPoint port) {
+        // FIXME: 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 domainId() {
+        return DomainId.domainId(domainId);
+    }
+
+    /**
+     * 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, domainId);
+        // 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 (mefPortConfigs != null) {
+            buildPorts();
+            log.info("Notifying Bigswitch presence..");
+            if (portMap.size() > 0) {
+                post(new BigSwitchEvent(BigSwitchEvent.Type.DEVICE_CREATED, null, 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..02f82de
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/BigSwitchService.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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 domain ID of this bigswitch.
+     *
+     * @return domain ID
+     */
+    DomainId domainId();
+}
+
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..3932acb
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/MefPortsConfig.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..22af7db
--- /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 Foundation
+ *
+ * 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..b94fec5
--- /dev/null
+++ b/local/bigswitch/src/main/java/org/opencord/ce/local/bigswitch/cli/ConnectPointFromVirtPortCmd.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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..194fb9f
--- /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 Foundation
+ *
+ * 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..ca91d6a
--- /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 Foundation
+ *
+ * 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..2db5ad1
--- /dev/null
+++ b/local/bigswitch/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,26 @@
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-fabric/features.xml b/local/ce-fabric/features.xml
new file mode 100644
index 0000000..83ba135
--- /dev/null
+++ b/local/ce-fabric/features.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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:com.google.code.gson/gson/2.6.2</bundle>
+    </feature>
+</features>
diff --git a/local/ce-fabric/pom.xml b/local/ce-fabric/pom.xml
new file mode 100644
index 0000000..0e3bb75
--- /dev/null
+++ b/local/ce-fabric/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>fabric</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>CORD application for Carrier Ethernet Service</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.fabric</onos.app.name>
+        <onos.version>1.10.6</onos.version>
+        <onos.app.title>E-CORD Central Office fabric config</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <onos.app.requires>org.opencord.ce.local.bigswitch</onos.app.requires>
+        <onos.app.requires>org.opencord.ce.local.channel.http</onos.app.requires>
+    </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>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>bigswitch</artifactId>
+            <version>${parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-osgi</artifactId>
+            <version>${onos.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-json-jackson</artifactId>
+            <version>2.25.1</version>
+        </dependency>
+    </dependencies>
+
+    <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-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricConfig.java b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricConfig.java
new file mode 100644
index 0000000..2d8a9c1
--- /dev/null
+++ b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricConfig.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.fabric;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.Config;
+
+/**
+ * Configuration for single switch CORD fabric manager for Carrier Ethernet services.
+ */
+public class CarrierEthernetFabricConfig extends Config<ApplicationId> {
+    private static final int DEFAULT_PORT = 8181;
+    private static final String DEFAULT_USERNAME = "onos";
+    private static final String DEFAULT_PASSWORD = "rocks";
+
+    private static final String PUBLIC_IP = "publicIp";
+    private static final String PORT = "port";
+    private static final String USERNAME = "username";
+    private static final String PASSWORD = "password";
+    private static final String DEVICE_ID = "deviceId";
+
+    @Override
+    public boolean isValid() {
+        return hasOnlyFields(PUBLIC_IP, PORT, USERNAME, PASSWORD, DEVICE_ID) &&
+                publicIp() != null &&
+                deviceId() != null;
+    }
+
+    public IpAddress publicIp() {
+        String ip = get(PUBLIC_IP, null);
+        try {
+            return IpAddress.valueOf(ip);
+        } catch (IllegalArgumentException e) {
+            return null;
+        }
+    }
+
+    public Integer port() {
+        String port = get(PORT, String.valueOf(DEFAULT_PORT));
+        try {
+            return Integer.valueOf(port);
+        } catch (NumberFormatException e) {
+            return DEFAULT_PORT;
+        }
+    }
+
+    public String username() {
+        return get(USERNAME, String.valueOf(DEFAULT_USERNAME));
+    }
+
+    public String password() {
+        return get(PASSWORD, String.valueOf(DEFAULT_PASSWORD));
+    }
+
+    public DeviceId deviceId() {
+        String did = get(DEVICE_ID, null);
+        try {
+            return DeviceId.deviceId(did);
+        } catch (IllegalArgumentException e) {
+            return null;
+        }
+    }
+}
diff --git a/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricManager.java b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricManager.java
new file mode 100644
index 0000000..249031b
--- /dev/null
+++ b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/CarrierEthernetFabricManager.java
@@ -0,0 +1,312 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.fabric;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+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.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+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.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.local.bigswitch.BigSwitchService;
+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 java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Manages a single switch CORD fabric for Carrier Ethernet services.
+ *
+ * Receives forwarding constructs from global orchestrator,
+ * and generates VLAN cross connect configuration for the
+ * ONOS fabric controller.
+ *
+ * No resources are allocated so only the node forwarding API is implemented.
+ */
+@Component(immediate = true)
+@Service
+public class CarrierEthernetFabricManager implements MetroNetworkVirtualNodeService {
+    private static final Logger log = getLogger(CarrierEthernetFabricManager.class);
+    private static final String APP_NAME = "org.opencord.ce.local.fabric";
+    private static final String APPS = "apps";
+    private static final String SEGMENT_ROUTING = "org.onosproject.segmentrouting";
+    private static final String XCONNECT = "xconnect";
+    private static final String VLAN = "vlan";
+    private static final String PORTS = "ports";
+    private static final String NAME = "name";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected BigSwitchService bigSwitchService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry cfgService;
+
+    private final InternalConfigListener cfgListener = new InternalConfigListener();
+
+    private final ConfigFactory<ApplicationId, CarrierEthernetFabricConfig> configFactory =
+            new ConfigFactory<ApplicationId, CarrierEthernetFabricConfig>(APP_SUBJECT_FACTORY,
+                    CarrierEthernetFabricConfig.class, "segmentrouting_ctl", false) {
+                @Override
+                public CarrierEthernetFabricConfig createConfig() {
+                    return new CarrierEthernetFabricConfig();
+                }
+            };
+
+    private ApplicationId appId;
+    // TODO: use distributed maps via storage service
+    private Set<CarrierEthernetForwardingConstruct> forwardingConstructs = new LinkedHashSet<>();
+    private Map<EvcConnId, ConnectPoint> eePorts = new HashMap<>();
+    private Map<EvcConnId, ConnectPoint> upstreamPorts = new HashMap<>();
+    private IpAddress publicIp;
+    private Integer port;
+    private String username;
+    private String password;
+    private DeviceId deviceId;
+
+    @Activate
+    protected void activate() {
+        appId = coreService.registerApplication(APP_NAME);
+        cfgService.addListener(cfgListener);
+        cfgService.registerConfigFactory(configFactory);
+        cfgListener.doUpdate(cfgService.getConfig(appId, CarrierEthernetFabricConfig.class));
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        cfgService.removeListener(cfgListener);
+        cfgService.unregisterConfigFactory(configFactory);
+        log.info("Stopped");
+    }
+
+    @Override
+    public void setNodeForwarding(CarrierEthernetForwardingConstruct fc,
+                                  CarrierEthernetNetworkInterface srcNi,
+                                  Set<CarrierEthernetNetworkInterface> dstNiSet) {
+        addCrossconnect(fc, srcNi, dstNiSet);
+        postToSegmentRouting(buildConfig());
+    }
+
+    @Override
+    public void createBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        // No resources are allocated on the fabric
+        return;
+    }
+
+    @Override
+    public void applyBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        // No resources are allocated on the fabric
+        return;
+    }
+
+    @Override
+    public void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+        // No resources are allocated on the fabric
+        return;
+    }
+
+    @Override
+    public void removeAllForwardingResources(EvcConnId fcId) {
+        removeCrossconnect(fcId);
+        postToSegmentRouting(buildConfig());
+    }
+
+    /**
+     * Adds a fabric cross connect based on given Carrier Ethernet service.
+     *
+     * @param fc forwarding construct
+     * @param srcNi source network interface
+     * @param dstNiSet set of destination network interfaces
+     */
+    public void addCrossconnect(CarrierEthernetForwardingConstruct fc,
+                                CarrierEthernetNetworkInterface srcNi,
+                                Set<CarrierEthernetNetworkInterface> dstNiSet) {
+        // Store fc and extract physical fabric ports
+        Optional<ConnectPoint> eePort = bigSwitchService.connectPointFromVirtPort(srcNi.cp().port());
+        // Assume only a single upstream port is used, so we select randomly from set
+        CarrierEthernetNetworkInterface dstNi = dstNiSet.iterator().next();
+        Optional<ConnectPoint> upstreamPort = (dstNi == null) ? Optional.empty() :
+                bigSwitchService.connectPointFromVirtPort(dstNi.cp().port());
+        if (!eePort.isPresent() || !upstreamPort.isPresent()) {
+            log.error("Failed to install node forwarding, missing fabric ports: EE {} - upstream {}",
+                    eePort, upstreamPort);
+            return;
+        } else {
+            forwardingConstructs.add(fc);
+            eePorts.put(fc.id(), eePort.get());
+            upstreamPorts.put(fc.id(), upstreamPort.get());
+        }
+    }
+
+    /**
+     * Removes a fabric cross connect based on given forwarding construct.
+     *
+     * @param fcId forwarding construct id
+     */
+    public void removeCrossconnect(EvcConnId fcId) {
+        for (Iterator<CarrierEthernetForwardingConstruct> i = forwardingConstructs.iterator(); i.hasNext();) {
+            CarrierEthernetForwardingConstruct fc = i.next();
+            if (fcId.equals(fc.id())) {
+                forwardingConstructs.remove(fc);
+                break;
+            }
+        }
+        eePorts.remove(fcId);
+        upstreamPorts.remove(fcId);
+    }
+
+
+    /**
+     * All VLAN cross connects are rebuilt and pushed out since ONOS network config does not support updates.
+     *
+     * @return JSON with cross connect configuration for segment routing app
+     */
+    public JsonObject buildConfig() {
+        JsonArray xconnects = new JsonArray();
+        forwardingConstructs.stream()
+                .map(fc -> json(fc))
+                .forEach(fc -> xconnects.add(fc));
+
+        JsonObject dpid = new JsonObject();
+        dpid.add(deviceId.toString(), xconnects);
+
+        JsonObject xconnect = new JsonObject();
+        xconnect.add(XCONNECT, dpid);
+
+        JsonObject appName = new JsonObject();
+        appName.add(SEGMENT_ROUTING, xconnect);
+
+        JsonObject config = new JsonObject();
+        config.add(APPS, appName);
+
+        return config;
+    }
+
+    /**
+     * Execute REST POST to segment routing app with given VLAN cross connect config.
+     *
+     * @param json fabric VLAN cross connect configuration in json form
+     */
+    public void postToSegmentRouting(JsonObject json) {
+        // Setup credentials
+        HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
+                .nonPreemptive()
+                .credentials(username, password)
+                .build();
+        ClientConfig cfg = new ClientConfig();
+        cfg.register(feature);
+        Client client = ClientBuilder.newClient(cfg);
+
+        // Build URL and perform post
+        WebTarget target = client.target("http://" + publicIp + ":" + port + "/onos/v1/network/configuration/");
+        Response response = target.request().post(Entity.entity(json, MediaType.APPLICATION_JSON_TYPE));
+        response.close();
+    }
+
+    /**
+     * Build fabric config json from forwarding construct.
+     *
+     * Example VLAN cross connect configuration for fabric
+     * "apps": {
+     *    "org.onosproject.segmentrouting": {
+     *       "xconnect": {
+     *          "of:0000000000000001": [{
+     *             "vlan": 10,
+     *             "ports": [5, 73],
+     *             "name": "OLT1"
+     *          }]
+     *       }
+     *    }
+     * }
+     */
+    private JsonObject json(CarrierEthernetForwardingConstruct fc) {
+        JsonObject jo = new JsonObject();
+        jo.addProperty(VLAN, fc.vlanId().toShort());
+
+        // First port is EE -> fabric, second is fabric -> upstream / CO egress
+        JsonArray ports = new JsonArray();
+        // FIXME: need to be more careful of nulls here
+        ports.add(eePorts.get(fc.id()).port().toLong());
+        ports.add(upstreamPorts.get(fc.id()).port().toLong());
+        jo.add(PORTS, ports);
+
+        jo.addProperty(NAME, fc.id().id());
+
+        return jo;
+    }
+
+    private class InternalConfigListener implements NetworkConfigListener {
+        private void doUpdate(CarrierEthernetFabricConfig cfg) {
+            if (cfg == null) {
+                log.error("Fabric config for VLAN xconnect missing");
+                return;
+            }
+
+            publicIp = cfg.publicIp();
+            port = cfg.port();
+            username = cfg.username();
+            password = cfg.password();
+            deviceId = cfg.deviceId();
+            log.info("Reconfigured");
+        }
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            if ((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
+                    event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED) &&
+                    event.configClass().equals(CarrierEthernetFabricConfig.class)) {
+
+                if (event.config().isPresent()) {
+                    doUpdate((CarrierEthernetFabricConfig) event.config().get());
+                }
+            }
+        }
+    }
+}
diff --git a/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/package-info.java b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/package-info.java
new file mode 100644
index 0000000..0b030a4
--- /dev/null
+++ b/local/ce-fabric/src/main/java/org/opencord/ce/local/fabric/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+/**
+ * Single switch CORD fabric support for Carrier Ethernet services.
+ */
+package org.opencord.ce.local.fabric;
\ No newline at end of file
diff --git a/local/ce-fabric/src/test/java/org.opencord.ce.local.fabric/CarrierEthernetFabricManagerTest.java b/local/ce-fabric/src/test/java/org.opencord.ce.local.fabric/CarrierEthernetFabricManagerTest.java
new file mode 100644
index 0000000..cabcb77
--- /dev/null
+++ b/local/ce-fabric/src/test/java/org.opencord.ce.local.fabric/CarrierEthernetFabricManagerTest.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.fabric;
+
+import com.google.common.collect.Sets;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onlab.junit.TestUtils;
+import org.onlab.osgi.ServiceDirectory;
+import org.onlab.osgi.TestServiceDirectory;
+import org.onlab.packet.VlanId;
+import org.onosproject.core.CoreServiceAdapter;
+import org.onosproject.event.AbstractListenerManager;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.config.NetworkConfigRegistryAdapter;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.device.DeviceServiceAdapter;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.domain.DomainId;
+import org.opencord.ce.api.models.CarrierEthernetConnection;
+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.CarrierEthernetUni;
+import org.opencord.ce.api.models.EvcConnId;
+import org.opencord.ce.local.bigswitch.BigSwitchEvent;
+import org.opencord.ce.local.bigswitch.BigSwitchListener;
+import org.opencord.ce.local.bigswitch.BigSwitchService;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for {@link CarrierEthernetFabricManager}.
+ */
+public class CarrierEthernetFabricManagerTest {
+
+    private CarrierEthernetFabricManager target;
+    private static ServiceDirectory original;
+    private static TestServiceDirectory directory;
+
+    private CarrierEthernetLogicalTerminationPoint ltpSrc;
+    private CarrierEthernetLogicalTerminationPoint ltpDst;
+    // Physical connect points
+    private static ConnectPoint srcUniCp = ConnectPoint.deviceConnectPoint("netconf:10.0.0.10/1");
+    private ConnectPoint dstUniCp = ConnectPoint.deviceConnectPoint("netconf:10.0.0.20/1");
+    private ConnectPoint inniPhyCp = ConnectPoint.deviceConnectPoint("of:0000000000000001/1");
+    private ConnectPoint enni1PhyCp = ConnectPoint.deviceConnectPoint("of:0000000000000001/2");
+    private ConnectPoint enni2PhyCp = ConnectPoint.deviceConnectPoint("of:0000000000000001/3");
+    // Bigswitch (logical) connect points
+    private ConnectPoint inniBsCp = ConnectPoint.deviceConnectPoint("domain:0000000000000001/1");
+    private ConnectPoint enni1BsCp = ConnectPoint.deviceConnectPoint("domain:0000000000000001/2");
+    private ConnectPoint enni2BsCp = ConnectPoint.deviceConnectPoint("domain:0000000000000001/3");
+    // Carrier Ethernet models
+    private CarrierEthernetForwardingConstruct fc1;
+    private CarrierEthernetForwardingConstruct fc2;
+    private CarrierEthernetNetworkInterface srcUni;
+    private CarrierEthernetNetworkInterface dstUni;
+    private CarrierEthernetNetworkInterface inni;
+    private CarrierEthernetNetworkInterface enni1;
+    private CarrierEthernetNetworkInterface enni2;
+
+    private DeviceId deviceId = DeviceId.deviceId("of:0000000000000001");
+    private static VlanId vlan1 = VlanId.vlanId((short) 100);
+    private static VlanId vlan2 = VlanId.vlanId((short) 200);
+
+    @BeforeClass
+    public static void setUpBaseConfigClass() throws TestUtils.TestUtilsException {
+        directory = new TestServiceDirectory();
+        directory.add(DeviceService.class, new DeviceServiceAdapter(Collections.emptyList()));
+        original = TestUtils.getField(CarrierEthernetNetworkInterface.class, "serviceDirectory");
+        TestUtils.setField(CarrierEthernetNetworkInterface.class, "serviceDirectory", directory);
+    }
+
+    @AfterClass
+    public static void tearDownBaseConfigClass() throws TestUtils.TestUtilsException {
+        TestUtils.setField(CarrierEthernetNetworkInterface.class, "serviceDirectory", original);
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        // Initialize the fabric manager
+        target = new CarrierEthernetFabricManager();
+        target.bigSwitchService = new TestBigSwitchService();
+        target.cfgService = new NetworkConfigRegistryAdapter();
+        target.coreService = new CoreServiceAdapter();
+
+        // Build UNIs
+        srcUni = CarrierEthernetUni.builder()
+                .cp(srcUniCp)
+                .build();
+        dstUni = CarrierEthernetUni.builder()
+                .cp(dstUniCp)
+                .build();
+        ltpSrc = new CarrierEthernetLogicalTerminationPoint("srcUni", srcUni);
+        ltpDst = new CarrierEthernetLogicalTerminationPoint("dstUni", dstUni);
+
+        // Build FC connecting UNIs
+        fc1 = CarrierEthernetForwardingConstruct.builder()
+                .cfgId("test1")
+                .id(EvcConnId.of("test1"))
+                .type(CarrierEthernetConnection.Type.POINT_TO_POINT)
+                .ltpSet(Sets.newHashSet(ltpSrc, ltpDst))
+                .build();
+        fc1.setVlanId(vlan1);
+        fc2 = CarrierEthernetForwardingConstruct.builder()
+                .cfgId("test2")
+                .id(EvcConnId.of("test2"))
+                .type(CarrierEthernetConnection.Type.POINT_TO_POINT)
+                .ltpSet(Sets.newHashSet(ltpSrc, ltpDst))
+                .build();
+        fc2.setVlanId(vlan2);
+        inni = CarrierEthernetInni.builder()
+                .cp(inniBsCp)
+                .build();
+        enni1 = CarrierEthernetEnni.builder()
+                .cp(enni1BsCp)
+                .build();
+        enni2 = CarrierEthernetEnni.builder()
+                .cp(enni2BsCp)
+                .build();
+
+        target.activate();
+    }
+
+    @After
+    public void tearDown() {
+        target.deactivate();
+    }
+
+    @Test
+    public void testBuildConfig() {
+        TestUtils.setField(target, "deviceId", deviceId);
+        JsonParser parser = new JsonParser();
+        JsonObject json;
+        String expected;
+
+        // Add first fc
+        target.addCrossconnect(fc1, inni, Sets.newHashSet(enni1));
+        json = target.buildConfig();
+        expected =
+                "{\"apps\":{" +
+                        "\"org.onosproject.segmentrouting\":{" +
+                        "\"xconnect\":{" +
+                        "\"of:0000000000000001\":[{" +
+                        "\"vlan\":" + vlan1.toString() + "," +
+                        "\"ports\":[1, 2]," +
+                        "\"name\": \"" + fc1.id().id() + "\"}" +
+                        "]}}}}";
+        assertEquals(json, parser.parse(expected).getAsJsonObject());
+
+        // Add second fc
+        target.addCrossconnect(fc2, inni, Sets.newHashSet(enni2));
+        json = target.buildConfig();
+        expected =
+                "{\"apps\":{" +
+                        "\"org.onosproject.segmentrouting\":{" +
+                            "\"xconnect\":{" +
+                                "\"of:0000000000000001\":[{" +
+                                    "\"vlan\":" + vlan1.toString() + "," +
+                                    "\"ports\":[1, 2]," +
+                                    "\"name\": \"" + fc1.id().id() + "\"}," +
+                                    "{\"vlan\":" + vlan2.toString() + "," +
+                                    "\"ports\":[1, 3]," +
+                                    "\"name\": \"" + fc2.id().id() + "\"}" +
+                                    "]}}}}";
+        assertEquals(json, parser.parse(expected).getAsJsonObject());
+
+        // Remove first fc
+        target.removeCrossconnect(fc1.id());
+        json = target.buildConfig();
+        expected =
+                "{\"apps\":{" +
+                        "\"org.onosproject.segmentrouting\":{" +
+                        "\"xconnect\":{" +
+                        "\"of:0000000000000001\":[{" +
+                        "\"vlan\":" + vlan2.toString() + "," +
+                        "\"ports\":[1, 3]," +
+                        "\"name\": \"" + fc2.id().id() + "\"}" +
+                        "]}}}}";
+        assertEquals(json, parser.parse(expected).getAsJsonObject());
+    }
+
+    private class TestBigSwitchService
+            extends AbstractListenerManager<BigSwitchEvent, BigSwitchListener>
+            implements BigSwitchService {
+
+        @Override
+        public List<PortDescription> getPorts() {
+            return null;
+        }
+
+        @Override
+        public PortNumber getPort(ConnectPoint port) {
+            return null;
+        }
+
+        @Override
+        public Optional<ConnectPoint> connectPointFromVirtPort(PortNumber portNumber) {
+            if (portNumber.toLong() == 1) {
+                return Optional.of(inniPhyCp);
+            }
+            if (portNumber.toLong() == 2) {
+                return Optional.of(enni1PhyCp);
+            }
+            if (portNumber.toLong() == 3) {
+                return Optional.of(enni2PhyCp);
+            }
+
+            return Optional.empty();
+        }
+
+        @Override
+        public DomainId domainId() {
+            return null;
+        }
+    }
+}
diff --git a/local/ce-transport/pom.xml b/local/ce-transport/pom.xml
new file mode 100644
index 0000000..13203ba
--- /dev/null
+++ b/local/ce-transport/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</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.6</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..6da5261
--- /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 Foundation
+ *
+ * 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..5ac2ee6
--- /dev/null
+++ b/local/ce-vee/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>vee</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <description>Virtual Ethernet Edge service for CORD</description>
+
+    <properties>
+        <onos.app.name>org.opencord.ce.local.vee</onos.app.name>
+        <onos.app.title>E-CORD Ethernet Edge app</onos.app.title>
+        <onos.app.url>http://opencord.org</onos.app.url>
+        <onos.app.requires>org.opencord.ce.local.bigswitch</onos.app.requires>
+        <onos.app.requires>org.opencord.ce.local.channel.http</onos.app.requires>
+    </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..1ac2b21
--- /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 Foundation
+ *
+ * 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..c8ee47d
--- /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 Foundation
+ *
+ * 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..296464a
--- /dev/null
+++ b/local/common-component/app.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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>
+</app>
diff --git a/local/common-component/features.xml b/local/common-component/features.xml
new file mode 100644
index 0000000..839d7c3
--- /dev/null
+++ b/local/common-component/features.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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>
+    </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..057156a
--- /dev/null
+++ b/local/common-component/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>ecord-local-app</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <description>Java application bundling the bigswitch abstraction
+        and the HTTP channel component
+    </description>
+
+    <properties>
+        <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>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/local/config-samples/co1-onos-cord-cfg.json b/local/config-samples/co1-onos-cord-cfg.json
new file mode 100644
index 0000000..a908151
--- /dev/null
+++ b/local/config-samples/co1-onos-cord-cfg.json
@@ -0,0 +1,27 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.10:830/1"
+        },
+        {
+          "mefPortType" : "INNI",
+          "connectPoint" : "netconf:10.0.0.10:830/0",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "publicIp" : "10.128.14.1",
+        "port" : "8182",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
diff --git a/local/config-samples/co1-withEE-onos-cord-cfg.json b/local/config-samples/co1-withEE-onos-cord-cfg.json
new file mode 100644
index 0000000..e54cf63
--- /dev/null
+++ b/local/config-samples/co1-withEE-onos-cord-cfg.json
@@ -0,0 +1,41 @@
+{
+  "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" : {
+        "publicIp" : "10.128.14.1",
+        "port" : "8182",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
+
+
diff --git a/local/config-samples/co2-onos-cord-cfg.json b/local/config-samples/co2-onos-cord-cfg.json
new file mode 100644
index 0000000..210c7c5
--- /dev/null
+++ b/local/config-samples/co2-onos-cord-cfg.json
@@ -0,0 +1,27 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "UNI",
+          "connectPoint" : "netconf:10.0.0.20:830/1"
+        },
+        {
+          "mefPortType" : "INNI",
+          "connectPoint" : "netconf:10.0.0.20:830/0",
+          "interlinkId" : "cm-1"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "publicIp" : "10.128.14.1",
+        "port" : "8182",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
diff --git a/local/config-samples/co2-withEE-onos-cord-cfg.json b/local/config-samples/co2-withEE-onos-cord-cfg.json
new file mode 100644
index 0000000..78b14b5
--- /dev/null
+++ b/local/config-samples/co2-withEE-onos-cord-cfg.json
@@ -0,0 +1,41 @@
+{
+  "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" : {
+        "publicIp" : "10.128.14.1",
+        "port" : "8182",
+        "username" : "sdn",
+        "password" : "rocks",
+        "topic" : "ecord-domains-topic-one"
+      }
+    }
+  }
+}
+
+
diff --git a/local/config-samples/onos-fabric-cfg.json b/local/config-samples/onos-fabric-cfg.json
new file mode 100644
index 0000000..a9a6f6f
--- /dev/null
+++ b/local/config-samples/onos-fabric-cfg.json
@@ -0,0 +1,38 @@
+{
+  "apps" : {
+    "org.opencord.ce.local.fabric" : {
+      "segmentrouting_ctl": {
+        "publicIp": "127.0.0.1",
+        "port": "8181",
+        "username": "sdn",
+        "password": "rocks",
+        "deviceId": "of:0000001e08095936"
+      }
+    },
+    "org.opencord.ce.local.bigswitch" : {
+      "mefPorts" :
+      [
+        {
+          "mefPortType" : "INNI",
+          "connectPoint" : "of:0000001e08095936/1",
+          "interlinkId" : "EE-2-fabric"
+        },
+        {
+          "mefPortType" : "ENNI",
+          "connectPoint" : "of:0000001e08095936/49",
+          "interlinkId" : "fabric-upstream"
+        }
+      ]
+    },
+    "org.opencord.ce.local.channel.http" : {
+      "global" : {
+        "publicIp" : "10.128.14.1",
+        "port" : "8182",
+        "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..90e4c64
--- /dev/null
+++ b/local/http-channel/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>local-channel</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <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>E-CORD 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>
+                <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..2113862
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/ConnectionConfig.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.models.DomainEndPoint;
+
+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 PUBLIC_IP = "publicIp";
+    private static final String USERNAME = "username";
+    private static final String PASSWD = "password";
+    private static final String TOPIC = "topic";
+
+    public DomainEndPoint global() {
+        Set<IpAddress> ipAddresses = Sets.newHashSet();
+        IpAddress publicIp = IpAddress.valueOf(object.path(PUBLIC_IP).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 DomainEndPoint(DomainId.domainId("global"), publicIp, 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..e8513c9
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/DomainMasterIpDiscoveryTask.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.models.DomainEndPoint;
+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 DomainEndPoint endPoint;
+    private Client client;
+    private String localSiteId;
+
+    private ObjectMapper mapper;
+
+    public DomainMasterIpDiscoveryTask(DomainEndPoint 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;
+        }
+            String url = HTTP + COLON + DOUBLESLASH + endPoint.publicIp() + 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()) {
+                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());
+                        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..a29299b
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientComponent.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.models.DomainEndPoint;
+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 static DomainEndPoint 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);
+        if (globalOnos != null) {
+            leadershipService.withdraw(globalOnos.topic());
+        }
+    }
+
+    private void readConfig() {
+        globalOnos = configRegistry.getConfig(appId, ConnectionConfig.class)
+                        .global();
+        if (globalOnos == null) {
+            log.error("Configuration failure");
+            return;
+        }
+        leadershipService.runForLeadership(globalOnos.topic());
+        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(bigSwitchService.domainId());
+                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(bigSwitchService.domainId(), 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..132e648
--- /dev/null
+++ b/local/http-channel/src/main/java/org/opencord/ce/local/channel/client/HttpClientInstance.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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.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.domain.DomainId;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.rest.AbstractWebResource;
+import org.opencord.ce.api.models.DomainEndPoint;
+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 DomainEndPoint globalOnos;
+
+    private final ExecutorService networkExecutor =
+            newSingleThreadExecutor();
+
+    public void configure(ClusterService clusterService, LeadershipService leadershipService) {
+            this.clusterService = clusterService;
+            this.leadershipService = leadershipService;
+    }
+
+    protected void setGlobalOnos(DomainEndPoint globalOnos) {
+        synchronized (MONITOR) {
+            this.globalOnos = globalOnos;
+        }
+    }
+
+    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 notifyBigSwitch(DomainId siteId) {
+        String deviceId = "domain:" + siteId.id();
+        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(DomainId siteId, List<PortDescription> ports) {
+        JsonCodec<Port> portCodec = codecContext.codec(Port.class);
+        ArrayNode body = codecContext.mapper().createArrayNode();
+        DeviceId deviceId = DeviceId.deviceId("domain:" + siteId.id());
+        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) {
+                    try {
+                        log.info("wait() global ONOS endpoint");
+                        MONITOR.wait();
+                    } catch (InterruptedException ie) {
+                        log.info("Interrupted exception: " + ie.getMessage());
+                    }
+                }
+            }
+            if (!isLeader(globalOnos.topic())) {
+                return;
+            }
+            String url = HTTP + COLON + DOUBLESLASH + globalOnos.publicIp() + 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..23f1337
--- /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 Foundation
+ *
+ * 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..f961747
--- /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 Foundation
+ *
+ * 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/EcordLocalRestApp.java b/local/http-channel/src/main/java/org/opencord/ce/local/channel/server/EcordLocalRestApp.java
new file mode 100644
index 0000000..51b8b32
--- /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 Foundation
+ *
+ * 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);
+    }
+}
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..acd04cd
--- /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 Foundation
+ *
+ * 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..d2886b7
--- /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 Foundation
+ *
+ * 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..06ebfcd
--- /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 2017-present Open Networking Foundation
+  ~
+  ~ 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..ed76a1c
--- /dev/null
+++ b/local/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.opencord.ce</groupId>
+    <artifactId>local</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <description>Local components of the CORD Carrier Ethernet service</description>
+
+    <properties>
+        <onos.version>1.10.6</onos.version>
+        <onos.app.title>E-CORD 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-fabric</module>
+        <module>common-component</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opencord.ce</groupId>
+            <artifactId>ce-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <version>${onos.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </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..6082a61
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2017-present Open Networking Foundation
+  ~
+  ~ 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.6</version>
+        <relativePath></relativePath>
+    </parent>
+
+    <groupId>org.opencord</groupId>
+    <artifactId>ce</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <description>Carrier Ethernet 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.4.0-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>
