added javadocs and comments
diff --git a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
index af2a24a..a0a5809 100644
--- a/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/CellDeviceProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,24 @@
package org.onosproject.xran.providers;
-import org.apache.felix.scr.annotations.*;
+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.onlab.packet.ChassisId;
-import org.onosproject.net.*;
-import org.onosproject.net.device.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceProvider;
+import org.onosproject.net.device.DeviceProviderRegistry;
+import org.onosproject.net.device.DeviceProviderService;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.xran.controller.XranController;
@@ -27,14 +41,12 @@
import org.slf4j.Logger;
import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.xran.entities.RnibCell.uri;
import static org.slf4j.LoggerFactory.getLogger;
-
/**
- * Created by dimitris on 7/27/17.
+ * Cell device provider.
*/
-
@Component(immediate = true)
public class CellDeviceProvider extends AbstractProvider implements DeviceProvider {
@@ -87,6 +99,9 @@
}
+ /**
+ * Internal device listener.
+ */
private class InternalDeviceListener implements XranDeviceListener {
@Override
@@ -95,6 +110,7 @@
return;
}
+ // use ECGI as device ID URI
DeviceId id = deviceId(uri(cell.getEcgi()));
ChassisId cId = new ChassisId(id.hashCode());
diff --git a/src/main/java/org.onosproject.xran/providers/UeProvider.java b/src/main/java/org.onosproject.xran/providers/UeProvider.java
index 435c78a..e84deb2 100644
--- a/src/main/java/org.onosproject.xran/providers/UeProvider.java
+++ b/src/main/java/org.onosproject.xran/providers/UeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,19 @@
package org.onosproject.xran.providers;
import com.google.common.collect.Sets;
-import org.apache.felix.scr.annotations.*;
+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.onlab.packet.VlanId;
-import org.onosproject.net.*;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
import org.onosproject.net.host.DefaultHostDescription;
import org.onosproject.net.host.HostProvider;
import org.onosproject.net.host.HostProviderRegistry;
@@ -33,14 +43,13 @@
import java.util.Set;
-import static org.onosproject.net.DeviceId.*;
-import static org.onosproject.xran.entities.RnibCell.*;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.xran.entities.RnibCell.uri;
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Created by dimitris on 7/28/17.
+ * UE Provider.
*/
-
@Component(immediate = true)
public class UeProvider extends AbstractProvider implements HostProvider {
@@ -78,6 +87,9 @@
}
+ /**
+ * Internal host listener.
+ */
class InternalHostListener implements XranHostListener {
@Override
@@ -94,12 +106,15 @@
try {
Set<HostLocation> hostLocations = Sets.newConcurrentHashSet();
- ecgiSet.forEach(ecgi -> hostLocations.add(new HostLocation(deviceId(uri(ecgi)), PortNumber.portNumber(0), 0)));
+ ecgiSet.forEach(ecgi -> hostLocations
+ .add(new HostLocation(deviceId(uri(ecgi)),
+ PortNumber.portNumber(0), 0)));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set(AnnotationKeys.NAME, "UE " + ue.getId())
.build();
+ // Host ID is calculated from UE ID with some hacky function to represent a MAC address.
DefaultHostDescription desc = new DefaultHostDescription(
ue.getHostId().mac(),
VlanId.vlanId(VlanId.UNTAGGED),
diff --git a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
index 01f0e95..10da57e 100644
--- a/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranDeviceListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,21 @@
import org.onosproject.xran.entities.RnibCell;
/**
- * Created by dimitris on 7/27/17.
+ * Xran Device Listener.
*/
public interface XranDeviceListener {
+ /**
+ * Add new CELL as a device.
+ *
+ * @param id CELL entity
+ */
void deviceAdded(RnibCell id);
+ /**
+ * Remove CELL.
+ *
+ * @param id CELL ECGI as device 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
index 79676e3..d545018 100644
--- a/src/main/java/org.onosproject.xran/providers/XranHostListener.java
+++ b/src/main/java/org.onosproject.xran/providers/XranHostListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,22 @@
import java.util.Set;
/**
- * Created by dimitris on 7/28/17.
+ * Xran Host Listener.
*/
public interface XranHostListener {
+ /**
+ * Add UE as a host with location the primary link.
+ *
+ * @param ue UE entity
+ * @param ecgiSet All connected CELLs to this UE
+ */
void hostAdded(RnibUe ue, Set<ECGI> ecgiSet);
+ /**
+ * Remove UE based on Host Id.
+ *
+ * @param id Host Id generated from UE id
+ */
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
index a3ee964..608d5f6 100644
--- a/src/main/java/org.onosproject.xran/providers/package-info.java
+++ b/src/main/java/org.onosproject.xran/providers/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2015-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.