VOL-540: REST interface for provisioning/removal of HSIA service - rebased
Change-Id: I7bcd8a85cab375786ec72620e5d0d06bce084ded
diff --git a/api/pom.xml b/api/pom.xml
index 3ee690d..74e93d8 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>olt</artifactId>
<groupId>org.opencord</groupId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/api/src/main/java/org/opencord/olt/AccessDeviceService.java b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
index 361a30d..9b1e574 100644
--- a/api/src/main/java/org/opencord/olt/AccessDeviceService.java
+++ b/api/src/main/java/org/opencord/olt/AccessDeviceService.java
@@ -35,22 +35,40 @@
* Provisions connectivity for a subscriber on an access device.
*
* @param port subscriber's connection point
+ * @return true if successful false otherwise
*/
- void provisionSubscriber(ConnectPoint port);
+ boolean provisionSubscriber(ConnectPoint port);
/**
* Removes provisioned connectivity for a subscriber from an access device.
*
* @param port subscriber's connection point
+ * @return true if successful false otherwise
*/
- void removeSubscriber(ConnectPoint port);
+ boolean removeSubscriber(ConnectPoint port);
+
+ /**
+ * Provisions flows for the specific subscriber.
+ *
+ * @param subscriberId Identification of the subscriber
+ * @return true if successful false otherwise
+ */
+ boolean provisionSubscriber(AccessSubscriberId subscriberId);
+
+ /**
+ * Removes flows for the specific subscriber.
+ *
+ * @param subscriberId Identification of the subscriber
+ * @return true if successful false otherwise
+ */
+ boolean removeSubscriber(AccessSubscriberId subscriberId);
/**
* Returns information about the provisioned subscribers.
*
* @return subscribers
*/
- Collection<Map.Entry<ConnectPoint, VlanId>> getSubscribers();
+ Collection<Map.Entry<ConnectPoint, Map.Entry<VlanId, VlanId>>> getSubscribers();
/**
* Returns the list of active OLTs.
diff --git a/api/src/main/java/org/opencord/olt/AccessSubscriberId.java b/api/src/main/java/org/opencord/olt/AccessSubscriberId.java
new file mode 100644
index 0000000..e998e67
--- /dev/null
+++ b/api/src/main/java/org/opencord/olt/AccessSubscriberId.java
@@ -0,0 +1,95 @@
+/*
+ * 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
+ * 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
+ *
+ * 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;
+ }
+}