Workaround for PathIntent serialization issue
Change-Id: Ic0a36391ff22247d20d3e2b185c4d867a4e81780
Showing
1 changed file
with
9 additions
and
4 deletions
... | @@ -15,7 +15,11 @@ | ... | @@ -15,7 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onlab.onos.net.intent; | 16 | package org.onlab.onos.net.intent; |
17 | 17 | ||
18 | +import java.util.List; | ||
19 | + | ||
18 | import com.google.common.base.MoreObjects; | 20 | import com.google.common.base.MoreObjects; |
21 | +import com.google.common.collect.ImmutableList; | ||
22 | + | ||
19 | import org.onlab.onos.core.ApplicationId; | 23 | import org.onlab.onos.core.ApplicationId; |
20 | import org.onlab.onos.net.Path; | 24 | import org.onlab.onos.net.Path; |
21 | import org.onlab.onos.net.flow.TrafficSelector; | 25 | import org.onlab.onos.net.flow.TrafficSelector; |
... | @@ -28,7 +32,7 @@ import org.onlab.onos.net.resource.LinkResourceRequest; | ... | @@ -28,7 +32,7 @@ import org.onlab.onos.net.resource.LinkResourceRequest; |
28 | public class PathIntent extends ConnectivityIntent { | 32 | public class PathIntent extends ConnectivityIntent { |
29 | 33 | ||
30 | private final Path path; | 34 | private final Path path; |
31 | - private final LinkResourceRequest[] resourceRequests; | 35 | + private final List<LinkResourceRequest> resourceRequests; |
32 | 36 | ||
33 | /** | 37 | /** |
34 | * Creates a new point-to-point intent with the supplied ingress/egress | 38 | * Creates a new point-to-point intent with the supplied ingress/egress |
... | @@ -45,7 +49,7 @@ public class PathIntent extends ConnectivityIntent { | ... | @@ -45,7 +49,7 @@ public class PathIntent extends ConnectivityIntent { |
45 | super(id(PathIntent.class, selector, treatment, path), appId, | 49 | super(id(PathIntent.class, selector, treatment, path), appId, |
46 | resources(path.links()), selector, treatment); | 50 | resources(path.links()), selector, treatment); |
47 | this.path = path; | 51 | this.path = path; |
48 | - this.resourceRequests = resourceRequests; | 52 | + this.resourceRequests = ImmutableList.copyOf(resourceRequests); |
49 | } | 53 | } |
50 | 54 | ||
51 | /** | 55 | /** |
... | @@ -54,7 +58,7 @@ public class PathIntent extends ConnectivityIntent { | ... | @@ -54,7 +58,7 @@ public class PathIntent extends ConnectivityIntent { |
54 | protected PathIntent() { | 58 | protected PathIntent() { |
55 | super(); | 59 | super(); |
56 | this.path = null; | 60 | this.path = null; |
57 | - this.resourceRequests = new LinkResourceRequest[0]; | 61 | + this.resourceRequests = ImmutableList.of(); |
58 | } | 62 | } |
59 | 63 | ||
60 | /** | 64 | /** |
... | @@ -71,8 +75,9 @@ public class PathIntent extends ConnectivityIntent { | ... | @@ -71,8 +75,9 @@ public class PathIntent extends ConnectivityIntent { |
71 | return true; | 75 | return true; |
72 | } | 76 | } |
73 | 77 | ||
78 | + // TODO: consider changing return type | ||
74 | public LinkResourceRequest[] resourceRequests() { | 79 | public LinkResourceRequest[] resourceRequests() { |
75 | - return resourceRequests; | 80 | + return resourceRequests.toArray(new LinkResourceRequest[resourceRequests.size()]); |
76 | } | 81 | } |
77 | 82 | ||
78 | @Override | 83 | @Override | ... | ... |
-
Please register or login to post a comment