ONOS-1930 : Tunnel and policy failover with multi-instances
- Prevents tunnel delete from removing groups used for default flows
- Removes SegmentRoutingManager reference from Tunnel and Policy class
- Adds some error checks such as duplicates tunnel IDs or duplicate polices
Change-Id: I0e7d5e2eff0aea6dad13137a872fee58e083b11c
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/Tunnel.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/Tunnel.java
index 0c35fba..c56ae70 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/Tunnel.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/Tunnel.java
@@ -16,8 +16,6 @@
package org.onosproject.segmentrouting;
-import org.onosproject.net.DeviceId;
-
import java.util.List;
/**
@@ -40,20 +38,6 @@
List<Integer> labelIds();
/**
- * Creates a tunnel.
- *
- * @return true if succeeds, false otherwise
- */
- boolean create();
-
- /**
- * Removes the tunnel.
- *
- * @return true if succeeds, false otherwise.
- */
- boolean remove();
-
- /**
* Returns the group ID for the tunnel.
*
* @return group ID
@@ -61,9 +45,22 @@
int groupId();
/**
- * Returns the source device Id of the tunnel.
+ * Sets group ID for the tunnel.
*
- * @return source device Id
*/
- DeviceId source();
+ void setGroupId(int groupId);
+
+ /**
+ * Sets the flag to allow to remove the group or not.
+ *
+ * @param ok the flag; true - allow to remove
+ */
+ void allowToRemoveGroup(boolean ok);
+
+ /**
+ * Checks if it is allowed to remove the group for the tunnel.
+ *
+ * @return true if allowed, false otherwise
+ */
+ boolean isAllowedToRemoveGroup();
}