[SEBA-815]Multi Tcont support by OLT app.
[VOL-2525] Fixing the OLT app meter removal and optimizing the bandwith profile to meter map with a Multimap
Change-Id: I024ef2fcb3d3e59cc86bd2088726ae513fcff796
diff --git a/api/src/main/java/org/opencord/olt/AccessDeviceEvent.java b/api/src/main/java/org/opencord/olt/AccessDeviceEvent.java
index 3c189dd..3a4146c 100644
--- a/api/src/main/java/org/opencord/olt/AccessDeviceEvent.java
+++ b/api/src/main/java/org/opencord/olt/AccessDeviceEvent.java
@@ -29,21 +29,12 @@
private final Optional<VlanId> sVlan;
private final Optional<VlanId> cVlan;
+ private final Optional<Integer> tpId;
private final Optional<Port> port;
public enum Type {
/**
- * A subscriber was registered and provisioned.
- */
- SUBSCRIBER_REGISTERED,
-
- /**
- * A subscriber was unregistered and deprovisioned.
- */
- SUBSCRIBER_UNREGISTERED,
-
- /**
* An access device connected.
*/
DEVICE_CONNECTED,
@@ -61,55 +52,87 @@
/**
* An existing UNI port was removed.
*/
- UNI_REMOVED
+ UNI_REMOVED,
+
+ /**
+ * A uniTag (one service) was registered and provisioned.
+ */
+ SUBSCRIBER_UNI_TAG_REGISTERED,
+
+ /**
+ * A uniTag (one service) was unregistered and deprovisioned.
+ */
+ SUBSCRIBER_UNI_TAG_UNREGISTERED,
+
+ /**
+ * A uniTag (one service) was failed while registration.
+ */
+ SUBSCRIBER_UNI_TAG_REGISTRATION_FAILED,
+
+ /**
+ * A uniTag (one service) was failed while unregistration.
+ */
+ SUBSCRIBER_UNI_TAG_UNREGISTRATION_FAILED
}
/**
+ * Creates an event of a given type and for the specified device, port,
+ * along with the cVlanId, sVlanId, and tpId. The vlan fields may not be provisioned
+ * if the event is related to the access device (dis)connection.
*
+ * @param type the event type
+ * @param deviceId the device id
+ * @param port the device port
+ * @param sVlanId the service vlan
+ * @param cVlanId the customer vlan
+ * @param tpId the technology profile
+ */
+ public AccessDeviceEvent(Type type, DeviceId deviceId,
+ Port port,
+ VlanId sVlanId,
+ VlanId cVlanId,
+ Integer tpId) {
+ super(type, deviceId);
+ this.port = Optional.ofNullable(port);
+ this.sVlan = Optional.ofNullable(sVlanId);
+ this.cVlan = Optional.ofNullable(cVlanId);
+ this.tpId = Optional.ofNullable(tpId);
+ }
+
+ /**
* Creates an event of a given type and for the specified device,
* along with the cVlanId and sVlanId. The vlan fields may not be provisioned
* if the event is related to the access device (dis)connection.
*
- * @param type the event type
+ * @param type the event type
* @param deviceId the device id
- * @param sVlanId the service vlan
- * @param cVlanId the customer vlan
+ * @param sVlanId the service vlan
+ * @param cVlanId the customer vlan
+ * @param tpId the technology profile id
*/
public AccessDeviceEvent(Type type, DeviceId deviceId,
VlanId sVlanId,
- VlanId cVlanId) {
+ VlanId cVlanId,
+ Integer tpId) {
super(type, deviceId);
this.sVlan = Optional.ofNullable(sVlanId);
this.cVlan = Optional.ofNullable(cVlanId);
+ this.tpId = Optional.ofNullable(tpId);
this.port = Optional.empty();
}
/**
+ * Creates an event of a given type and for the specified device and port.
*
- * Creates an event of a given type and for the specified device, and timestamp
- * along with the cVlanId and sVlanId. The vlan fields may not be provisioned
- * if the event is related to the access device (dis)connection.
- *
- * @param type the event type
+ * @param type the event type
* @param deviceId the device id
- * @param time a timestamp
- * @param sVlanId the service vlan
- * @param cVlanId the customer vlan
+ * @param port the device port
*/
- protected AccessDeviceEvent(Type type, DeviceId deviceId, long time,
- VlanId sVlanId,
- VlanId cVlanId) {
- super(type, deviceId, time);
- this.sVlan = Optional.ofNullable(sVlanId);
- this.cVlan = Optional.ofNullable(cVlanId);
- this.port = Optional.empty();
-
- }
-
public AccessDeviceEvent(Type type, DeviceId deviceId, Port port) {
super(type, deviceId);
this.sVlan = Optional.empty();
this.cVlan = Optional.empty();
+ this.tpId = Optional.empty();
this.port = Optional.ofNullable(port);
}
@@ -125,4 +148,8 @@
return port;
}
+ public Optional<Integer> tpId() {
+ return tpId;
+ }
+
}
diff --git a/api/src/main/java/org/opencord/olt/AccessDeviceService.java b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
index 32c2ed0..06c5188 100644
--- a/api/src/main/java/org/opencord/olt/AccessDeviceService.java
+++ b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
@@ -16,20 +16,17 @@
package org.opencord.olt;
-import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
+import java.util.Set;
-import com.google.common.collect.ImmutableSet;
import org.onlab.packet.VlanId;
import org.onosproject.event.ListenerService;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.meter.MeterKey;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
import com.google.common.collect.ImmutableMap;
+import org.opencord.sadis.UniTagInformation;
/**
* Service for interacting with an access device (OLT).
@@ -39,6 +36,7 @@
/**
* Provisions connectivity for a subscriber on an access device.
+ * Installs flows for all uni tag information
*
* @param port subscriber's connection point
* @return true if successful false otherwise
@@ -47,6 +45,7 @@
/**
* Removes provisioned connectivity for a subscriber from an access device.
+ * Removes flows for all uni tag information
*
* @param port subscriber's connection point
* @return true if successful false otherwise
@@ -54,31 +53,32 @@
boolean removeSubscriber(ConnectPoint port);
/**
- * Provisions flows for the specific subscriber.
+ * Provisions a uni tag information for the specific subscriber.
+ * It finds the related uni tag information from the subscriber uni tag list
+ * and installs it
*
* @param subscriberId Identification of the subscriber
- * @param sTag additional outer tag on this port
- * @param cTag additional inner tag on this port
+ * @param sTag additional outer tag on this port
+ * @param cTag additional inner tag on this port
+ * @param tpId additional technology profile id
* @return true if successful false otherwise
*/
- boolean provisionSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag, Optional<VlanId> cTag);
+ boolean provisionSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag,
+ Optional<VlanId> cTag, Optional<Integer> tpId);
/**
- * Removes flows for the specific subscriber.
+ * Removes a uni tag information for the specific subscriber.
+ * It finds the related uni tag information from the subscriber uni tag list
+ * and remove it
*
* @param subscriberId Identification of the subscriber
- * @param sTag additional outer tag on this port
- * @param cTag additional inner tag on this port
+ * @param sTag additional outer tag on this port
+ * @param cTag additional inner tag on this port
+ * @param tpId additional technology profile id
* @return true if successful false otherwise
*/
- boolean removeSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag, Optional<VlanId> cTag);
-
- /**
- * Returns information about the provisioned subscribers.
- *
- * @return subscribers
- */
- Collection<Map.Entry<ConnectPoint, Map.Entry<VlanId, VlanId>>> getSubscribers();
+ boolean removeSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag,
+ Optional<VlanId> cTag, Optional<Integer> tpId);
/**
* Returns the list of active OLTs.
@@ -89,26 +89,11 @@
/**
* Returns information about subscribers that have been programmed in the
- * data-plane.
+ * data-plane. It shows all uni tag information list of the subscribers even if
+ * these have not been programmed.
*
* @return an immutable map of locations and subscriber information
*/
- ImmutableMap<ConnectPoint, SubscriberAndDeviceInformation> getProgSubs();
-
- /**
- * Returns information about device-meter mappings that have been programmed in the
- * data-plane.
- *
- * @return an immutable set of device-meter mappings
- */
- ImmutableSet<MeterKey> getProgMeters();
-
- /**
- * Returns information about bandwidthProfile-meterKey (device / meter) mappings
- * that have been programmed in the data-plane.
- *
- * @return an immutable map of bandwidthProfile-meterKey (device / meter) mappings
- */
- ImmutableMap<String, List<MeterKey>> getBpMeterMappings();
+ ImmutableMap<ConnectPoint, Set<UniTagInformation>> getProgSubs();
}