[VOL-4246] Feature parity with the previous implementation
Change-Id: I3741edb3c1b88b1cf8b5e6d4ff0900132e2e5e6a
diff --git a/api/pom.xml b/api/pom.xml
index 522aed0..34d69e0 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2016-present Open Networking Foundation
+ ~ Copyright 2021 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,32 +17,21 @@
<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>
<artifactId>olt</artifactId>
<groupId>org.opencord</groupId>
- <version>4.6.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
+ <version>5.0.0-SNAPSHOT</version>
</parent>
+ <modelVersion>4.0.0</modelVersion>
<version>${olt.api.version}</version>
<artifactId>olt-api</artifactId>
<packaging>bundle</packaging>
- <url>http://opencord.org</url>
-
- <description>OLT application API</description>
-
- <dependencies>
- <dependency>
- <groupId>org.opencord</groupId>
- <artifactId>sadis-api</artifactId>
- <version>${sadis.api.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ </properties>
<build>
<plugins>
<plugin>
@@ -51,4 +40,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
diff --git a/api/src/main/java/org/opencord/olt/AccessDevicePort.java b/api/src/main/java/org/opencord/olt/AccessDevicePort.java
deleted file mode 100644
index 8a1665d..0000000
--- a/api/src/main/java/org/opencord/olt/AccessDevicePort.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2021-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.olt;
-
-import org.onosproject.net.AnnotationKeys;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-
-/**
- * OLT device port.
- */
-public class AccessDevicePort {
-
- Port port;
- Type type;
-
- /**
- * OLT Port Type.
- */
- public enum Type {
- NNI,
- UNI,
- }
-
- /**
- * Creates an AccessDevicePort with given ONOS port object and OLT port type.
- *
- * @param port ONOS port
- * @param type OLT port type
- */
- public AccessDevicePort(Port port, Type type) {
- this.port = port;
- this.type = type;
- }
-
- /**
- * Get ONOS Port object.
- *
- * @return ONOS port
- */
- public Port port() {
- return this.port;
- }
-
- /**
- * Get OLT port Type.
- *
- * @return OLT port type
- */
- public Type type() {
- return this.type;
- }
-
- /**
- * Check port is enabled state on ONOS.
- *
- * @return is Access Device Port enabled
- */
- public boolean isEnabled() {
- return this.port.isEnabled();
- }
-
- /**
- * Get Device ID of OLT which the port is connected.
- *
- * @return OLT Device ID
- */
- public DeviceId deviceId() {
- return (DeviceId) this.port.element().id();
- }
-
- /**
- * Get port number.
- *
- * @return port number
- */
- public PortNumber number() {
- return this.port.number();
- }
-
- /**
- * Get port name which is combination of serial number and uni index.
- *
- * @return port name (ex: BBSM00010001-1)
- */
- public String name() {
- return this.port.annotations().value(AnnotationKeys.PORT_NAME);
- }
-
- @Override
- public String toString() {
- return deviceId().toString() + '/' + number() + '[' + name() + ']';
- }
-
-}
diff --git a/api/src/main/java/org/opencord/olt/AccessDeviceService.java b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
index 4878d97..9f39715 100644
--- a/api/src/main/java/org/opencord/olt/AccessDeviceService.java
+++ b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Foundation
+ * Copyright 2021-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,93 +16,62 @@
package org.opencord.olt;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-
import org.onlab.packet.VlanId;
import org.onosproject.event.ListenerService;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
-import com.google.common.collect.ImmutableMap;
-import org.opencord.sadis.UniTagInformation;
+import java.util.List;
-/**
- * Service for interacting with an access device (OLT).
- */
-public interface AccessDeviceService
- extends ListenerService<AccessDeviceEvent, AccessDeviceListener> {
-
+public interface AccessDeviceService extends ListenerService<AccessDeviceEvent, AccessDeviceListener> {
/**
* Provisions connectivity for a subscriber on an access device.
- * Installs flows for all uni tag information
+ * It installs flows for all uni tag information
*
- * @param port subscriber's connection point
- * @return true if successful false otherwise
+ * @param cp subscriber's connection point
+ * @return true if the request is accepted (does not guarantee the subscriber is provisioned)
*/
- boolean provisionSubscriber(ConnectPoint port);
+ boolean provisionSubscriber(ConnectPoint cp);
/**
- * 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
+ * Removes subscriber flows from a given ConnectPoint.
+ * @param cp subscriber's connect point
+ * @return true if the request is accepted (does not guarantee the subscriber is removed)
*/
- boolean removeSubscriber(ConnectPoint port);
+ boolean removeSubscriber(ConnectPoint cp);
/**
- * 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 tpId additional technology profile id
- * @return true if successful false otherwise
+ * Provisions connectivity for a particular service for a subscriber.
+ * @param cp subscriber's connect point
+ * @param cTag service's cTag
+ * @param sTag service's sTag
+ * @param tpId service's Technology Profile ID
+ * @return true if the request is accepted (does not guarantee the subscriber is provisioned)
*/
- boolean provisionSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag,
- Optional<VlanId> cTag, Optional<Integer> tpId);
+ boolean provisionSubscriber(ConnectPoint cp, VlanId cTag, VlanId sTag, Integer tpId);
/**
- * 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 tpId additional technology profile id
- * @return true if successful false otherwise
+ * Removes connectivity for a particular service for a subscriber.
+ * @param cp subscriber's connect point
+ * @param cTag service's cTag
+ * @param sTag service's sTag
+ * @param tpId service's Technology Profile ID
+ * @return true if the request is accepted (does not guarantee the subscriber is removed)
*/
- boolean removeSubscriber(AccessSubscriberId subscriberId, Optional<VlanId> sTag,
- Optional<VlanId> cTag, Optional<Integer> tpId);
+ boolean removeSubscriber(ConnectPoint cp, VlanId cTag, VlanId sTag, Integer tpId);
/**
- * Returns the list of active OLTs.
- *
- * @return a List
+ * Returns a list of connected OLT devices ID.
+ * @return a list of devices
*/
- List<DeviceId> fetchOlts();
+ List<DeviceId> getConnectedOlts();
/**
- * Returns information about subscribers that have been programmed in the
- * data-plane. It shows all uni tag information list of the subscribers even if
- * these have not been programmed.
+ * Finds the ConnectPoint to which a subscriber is connected.
*
- * @return an immutable map of locations and subscriber information
+ * @param id The id of the subscriber, this is the same ID as in Sadis
+ * @return Subscribers ConnectPoint if found else null
*/
- ImmutableMap<ConnectPoint, Set<UniTagInformation>> getProgSubs();
-
- /**
- * Returns information about subscribers that have NOT been programmed in the
- * data-plane. It shows all uni tag information list of the subscribers even if
- * these have not been programmed, meaning no flows have been sent to the device.
- *
- * @return an immutable map of locations and subscriber information
- */
- ImmutableMap<ConnectPoint, Set<UniTagInformation>> getFailedSubs();
+ ConnectPoint findSubscriberConnectPoint(String id);
}
diff --git a/api/src/main/java/org/opencord/olt/AccessSubscriberId.java b/api/src/main/java/org/opencord/olt/AccessSubscriberId.java
deleted file mode 100644
index f85ea0f..0000000
--- a/api/src/main/java/org/opencord/olt/AccessSubscriberId.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.olt;
-
-/**
- * Class representing the identifier for a subscriber.
- * It encapsulates the name of the logical port for the subscriber in
- * ONOS.
- * For e.g. if in ONOS you see
- * <pre>
- * onos> ports
- * id=of:00000000c0a83264, available=true, local-status=connected 3m48s ago, role=MASTER, mfr=VOLTHA Projectd,...
- * port=32, state=enabled, type=fiber, speed=0 , adminState=enabled, portMac=08:00:00:00:00:20, portName=TWSH80808082
- * </pre>
- * the subscriber id would encapsulate the string "TWSH80808082"
- */
-public class AccessSubscriberId {
- // string representing the identifier
- String id;
-
- /**
- * Creates an AccessSubscriberId with the passed id.
- *
- * @param id identifier of the subscriber
- */
- public AccessSubscriberId(String id) {
- this.id = id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (this.id == null ? 0 : this.id.hashCode());
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (this.getClass() != obj.getClass()) {
- return false;
- }
-
- final AccessSubscriberId other = (AccessSubscriberId) obj;
- if (this.id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!this.id.equals(other.id)) {
- return false;
- }
-
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return id;
- }
-}
diff --git a/api/src/main/java/org/opencord/olt/package-info.java b/api/src/main/java/org/opencord/olt/package-info.java
index f48f829..d6cff7d 100644
--- a/api/src/main/java/org/opencord/olt/package-info.java
+++ b/api/src/main/java/org/opencord/olt/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Foundation
+ * Copyright 2021-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.
@@ -15,6 +15,6 @@
*/
/**
- * OLT application api.
+ * OLT App APIs.
*/
-package org.opencord.olt;
+package org.opencord.olt;
\ No newline at end of file