Workaround for PathIntent serialization issue
Change-Id: Ic0a36391ff22247d20d3e2b185c4d867a4e81780
diff --git a/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java b/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
index 0789db0..60ba70c 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
@@ -15,7 +15,11 @@
*/
package org.onlab.onos.net.intent;
+import java.util.List;
+
import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableList;
+
import org.onlab.onos.core.ApplicationId;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.flow.TrafficSelector;
@@ -28,7 +32,7 @@
public class PathIntent extends ConnectivityIntent {
private final Path path;
- private final LinkResourceRequest[] resourceRequests;
+ private final List<LinkResourceRequest> resourceRequests;
/**
* Creates a new point-to-point intent with the supplied ingress/egress
@@ -45,7 +49,7 @@
super(id(PathIntent.class, selector, treatment, path), appId,
resources(path.links()), selector, treatment);
this.path = path;
- this.resourceRequests = resourceRequests;
+ this.resourceRequests = ImmutableList.copyOf(resourceRequests);
}
/**
@@ -54,7 +58,7 @@
protected PathIntent() {
super();
this.path = null;
- this.resourceRequests = new LinkResourceRequest[0];
+ this.resourceRequests = ImmutableList.of();
}
/**
@@ -71,8 +75,9 @@
return true;
}
+ // TODO: consider changing return type
public LinkResourceRequest[] resourceRequests() {
- return resourceRequests;
+ return resourceRequests.toArray(new LinkResourceRequest[resourceRequests.size()]);
}
@Override