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>
