initial commit
diff --git a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
new file mode 100644
index 0000000..f89fe09
--- /dev/null
+++ b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.xran.providers;
+
+import org.apache.felix.scr.annotations.*;
+import org.onlab.packet.ChassisId;
+import org.onosproject.net.*;
+import org.onosproject.net.device.*;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.xran.controller.XranController;
+import org.onosproject.xran.entities.RnibCell;
+import org.slf4j.Logger;
+
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.xran.entities.RnibCell.*;
+import static org.slf4j.LoggerFactory.getLogger;
+
+
+/**
+ * Created by dimitris on 7/27/17.
+ */
+
+@Component(immediate = true)
+public class CellDeviceProvider extends AbstractProvider implements DeviceProvider {
+
+    private static final Logger log = getLogger(CellDeviceProvider.class);
+    private final InternalDeviceListener listener = new InternalDeviceListener();
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceProviderRegistry providerRegistry;
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected XranController controller;
+    private DeviceProviderService providerService;
+
+    public CellDeviceProvider() {
+        super(new ProviderId("xran", "org.onosproject.provider.xran"));
+    }
+
+    @Activate
+    public void activate() {
+        providerService = providerRegistry.register(this);
+        controller.addListener(listener);
+
+        log.info("XRAN Device Provider Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        controller.removeListener(listener);
+        providerRegistry.unregister(this);
+
+        providerService = null;
+        log.info("XRAN Device Provider 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 class InternalDeviceListener implements XranDeviceListener {
+
+        @Override
+        public void deviceAdded(RnibCell cell) {
+            if (providerService == null) {
+                return;
+            }
+
+            DeviceId id = deviceId(uri(cell.getEcgi()));
+
+            ChassisId cId = new ChassisId(id.hashCode());
+
+            Device.Type type = Device.Type.OTHER;
+            SparseAnnotations annotations = DefaultAnnotations.builder()
+                    .set(AnnotationKeys.NAME, "eNodeB #" + cell.getEcgi().getEUTRANcellIdentifier())
+                    .set(AnnotationKeys.PROTOCOL, "SCTP")
+                    .set(AnnotationKeys.CHANNEL_ID, "xxx")
+                    .set(AnnotationKeys.MANAGEMENT_ADDRESS, "127.0.0.1")
+                    .build();
+
+            DeviceDescription descBase =
+                    new DefaultDeviceDescription(id.uri(), type,
+                            "xran", "0.1", "0.1", id.uri().toString(),
+                            cId);
+            DeviceDescription desc = new DefaultDeviceDescription(descBase, annotations);
+
+            providerService.deviceConnected(id, desc);
+        }
+
+        @Override
+        public void deviceRemoved(DeviceId id) {
+            providerService.deviceDisconnected(id);
+        }
+    }
+}
diff --git a/src/main/java/org.onosproject.xran/providers/UeProvider.java b/src/main/java/org.onosproject.xran/providers/UeProvider.java
new file mode 100644
index 0000000..c7a76b9
--- /dev/null
+++ b/src/main/java/org.onosproject.xran/providers/UeProvider.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.xran.providers;
+
+import com.google.common.collect.Sets;
+import org.apache.felix.scr.annotations.*;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.*;
+import org.onosproject.net.host.DefaultHostDescription;
+import org.onosproject.net.host.HostProvider;
+import org.onosproject.net.host.HostProviderRegistry;
+import org.onosproject.net.host.HostProviderService;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.xran.codecs.api.ECGI;
+import org.onosproject.xran.controller.XranController;
+import org.onosproject.xran.entities.RnibUe;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static org.onosproject.net.DeviceId.*;
+import static org.onosproject.xran.entities.RnibCell.*;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Created by dimitris on 7/28/17.
+ */
+
+@Component(immediate = true)
+public class UeProvider extends AbstractProvider implements HostProvider {
+
+    private static final Logger log = getLogger(UeProvider.class);
+    private final InternalHostListener listener = new InternalHostListener();
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private HostProviderRegistry providerRegistry;
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private XranController controller;
+    private HostProviderService providerService;
+
+    public UeProvider() {
+        super(new ProviderId("xran", "org.onosproject.providers.cell"));
+    }
+
+    @Activate
+    public void activate() {
+        providerService = providerRegistry.register(this);
+        controller.addListener(listener);
+
+        log.info("XRAN Host Provider Started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        controller.removeListener(listener);
+        providerRegistry.unregister(this);
+
+        providerService = null;
+        log.info("XRAN Host Provider Stopped");
+    }
+
+    @Override
+    public void triggerProbe(Host host) {
+
+    }
+
+    class InternalHostListener implements XranHostListener {
+
+        @Override
+        public void hostAdded(RnibUe ue, Set<ECGI> ecgiSet) {
+            if (providerService == null) {
+                return;
+            }
+
+            if (ue == null) {
+                log.error("UE {} is not found", ue);
+                return;
+            }
+
+            try {
+                Set<HostLocation> hostLocations = Sets.newConcurrentHashSet();
+
+                ecgiSet.forEach(ecgi -> hostLocations.add(new HostLocation(deviceId(uri(ecgi)), PortNumber.portNumber(0), 0)));
+
+                SparseAnnotations annotations = DefaultAnnotations.builder()
+                        .set(AnnotationKeys.NAME, "UE #" + ue.getMmeS1apId())
+                        .build();
+
+                DefaultHostDescription desc = new DefaultHostDescription(
+                        ue.getHostId().mac(),
+                        VlanId.vlanId(VlanId.UNTAGGED),
+                        hostLocations,
+                        Sets.newConcurrentHashSet(),
+                        true,
+                        annotations
+                );
+
+                providerService.hostDetected(ue.getHostId(), desc, false);
+            } catch (Exception e) {
+                log.warn(e.getMessage());
+                e.printStackTrace();
+            }
+        }
+
+        @Override
+        public void hostRemoved(HostId id) {
+            providerService.hostVanished(id);
+        }
+    }
+}
diff --git a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
new file mode 100644
index 0000000..01f0e95
--- /dev/null
+++ b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.xran.providers;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.xran.entities.RnibCell;
+
+/**
+ * Created by dimitris on 7/27/17.
+ */
+public interface XranDeviceListener {
+
+    void deviceAdded(RnibCell id);
+
+    void deviceRemoved(DeviceId id);
+}
diff --git a/src/main/java/org.onosproject.xran/providers/XranHostListener.java b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
new file mode 100644
index 0000000..79676e3
--- /dev/null
+++ b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.xran.providers;
+
+import org.onosproject.net.HostId;
+import org.onosproject.xran.codecs.api.ECGI;
+import org.onosproject.xran.entities.RnibUe;
+
+import java.util.Set;
+
+/**
+ * Created by dimitris on 7/28/17.
+ */
+public interface XranHostListener {
+
+    void hostAdded(RnibUe ue, Set<ECGI> ecgiSet);
+
+    void hostRemoved(HostId id);
+}
diff --git a/src/main/java/org.onosproject.xran/providers/package-info.java b/src/main/java/org.onosproject.xran/providers/package-info.java
new file mode 100644
index 0000000..a3ee964
--- /dev/null
+++ b/src/main/java/org.onosproject.xran/providers/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Created by dimitris on 7/27/17.
+ */
+package org.onosproject.xran.providers;
\ No newline at end of file