Tunnel Service extenstion to support to create tunnel from APP and also to carry Label stack as network resource
Change-Id: Ie69fd2d824bd40a14012406be3eea5b1449b5cf2
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
index 077c0d9..62f7646 100755
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java
@@ -18,6 +18,7 @@
import com.google.common.annotations.Beta;
import org.onosproject.core.DefaultGroupId;
import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.NetworkResource;
import org.onosproject.net.Path;
import org.onosproject.net.SparseAnnotations;
import org.onosproject.net.provider.ProviderId;
@@ -41,6 +42,7 @@
private final ProviderId producerName; // tunnel producer name
private final TunnelName tunnelName; // name of a tunnel
private final Path path;
+ private final NetworkResource networkRes;
/**
* Creates a tunnel description using the supplied information.
@@ -71,6 +73,41 @@
this.producerName = producerName;
this.tunnelName = tunnelName;
this.path = path;
+ this.networkRes = null;
+ }
+
+ /**
+ * Creates a tunnel description using the supplied information.
+ *
+ * @param id TunnelId
+ * @param src TunnelPoint source
+ * @param dst TunnelPoint destination
+ * @param type tunnel type
+ * @param groupId groupId
+ * @param producerName tunnel producer
+ * @param tunnelName tunnel name
+ * @param path the path of tunnel
+ * @param networkRes network resource of tunnel
+ * @param annotations optional key/value annotations
+ */
+ public DefaultTunnelDescription(TunnelId id, TunnelEndPoint src,
+ TunnelEndPoint dst, Tunnel.Type type,
+ DefaultGroupId groupId,
+ ProviderId producerName,
+ TunnelName tunnelName,
+ Path path,
+ NetworkResource networkRes,
+ SparseAnnotations... annotations) {
+ super(annotations);
+ this.tunnelId = id;
+ this.src = src;
+ this.dst = dst;
+ this.type = type;
+ this.groupId = groupId;
+ this.producerName = producerName;
+ this.tunnelName = tunnelName;
+ this.path = path;
+ this.networkRes = networkRes;
}
@Override
@@ -115,6 +152,11 @@
}
@Override
+ public NetworkResource resource() {
+ return networkRes;
+ }
+
+ @Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("tunnelId", id())
@@ -125,6 +167,7 @@
.add("producerName", producerName())
.add("groupId", groupId())
.add("path", path)
+ .add("resource", networkRes)
.toString();
}
}