Committed by
Gerrit Code Review
Remove LambdaConstraint as IndexLambda is soon removed
Change-Id: I1b0a2b3e09d87bb2b8cf39136de15d0f3368f589
Showing
13 changed files
with
6 additions
and
274 deletions
... | @@ -27,7 +27,6 @@ import org.onosproject.cli.AbstractShellCommand; | ... | @@ -27,7 +27,6 @@ import org.onosproject.cli.AbstractShellCommand; |
27 | import org.onosproject.core.ApplicationId; | 27 | import org.onosproject.core.ApplicationId; |
28 | import org.onosproject.core.CoreService; | 28 | import org.onosproject.core.CoreService; |
29 | import org.onosproject.net.EncapsulationType; | 29 | import org.onosproject.net.EncapsulationType; |
30 | -import org.onosproject.net.Link; | ||
31 | import org.onosproject.net.PortNumber; | 30 | import org.onosproject.net.PortNumber; |
32 | import org.onosproject.net.flow.DefaultTrafficSelector; | 31 | import org.onosproject.net.flow.DefaultTrafficSelector; |
33 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 32 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
... | @@ -38,8 +37,6 @@ import org.onosproject.net.intent.Intent; | ... | @@ -38,8 +37,6 @@ import org.onosproject.net.intent.Intent; |
38 | import org.onosproject.net.intent.Key; | 37 | import org.onosproject.net.intent.Key; |
39 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 38 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
40 | import org.onosproject.net.intent.constraint.EncapsulationConstraint; | 39 | import org.onosproject.net.intent.constraint.EncapsulationConstraint; |
41 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
42 | -import org.onosproject.net.intent.constraint.LinkTypeConstraint; | ||
43 | import org.onosproject.net.intent.constraint.PartialFailureConstraint; | 40 | import org.onosproject.net.intent.constraint.PartialFailureConstraint; |
44 | 41 | ||
45 | import java.util.LinkedList; | 42 | import java.util.LinkedList; |
... | @@ -171,10 +168,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -171,10 +168,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
171 | required = false, multiValued = false) | 168 | required = false, multiValued = false) |
172 | private String bandwidthString = null; | 169 | private String bandwidthString = null; |
173 | 170 | ||
174 | - @Option(name = "-l", aliases = "--lambda", description = "Lambda", | ||
175 | - required = false, multiValued = false) | ||
176 | - private boolean lambda = false; | ||
177 | - | ||
178 | @Option(name = "--partial", description = "Allow partial installation", | 171 | @Option(name = "--partial", description = "Allow partial installation", |
179 | required = false, multiValued = false) | 172 | required = false, multiValued = false) |
180 | private boolean partial = false; | 173 | private boolean partial = false; |
... | @@ -381,12 +374,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -381,12 +374,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
381 | constraints.add(new BandwidthConstraint(bandwidth)); | 374 | constraints.add(new BandwidthConstraint(bandwidth)); |
382 | } | 375 | } |
383 | 376 | ||
384 | - // Check for a lambda specification | ||
385 | - if (lambda) { | ||
386 | - constraints.add(new LambdaConstraint(null)); | ||
387 | - } | ||
388 | - constraints.add(new LinkTypeConstraint(lambda, Link.Type.OPTICAL)); | ||
389 | - | ||
390 | // Check for partial failure specification | 377 | // Check for partial failure specification |
391 | if (partial) { | 378 | if (partial) { |
392 | constraints.add(new PartialFailureConstraint()); | 379 | constraints.add(new PartialFailureConstraint()); | ... | ... |
core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014 Open Networking Laboratory | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.onosproject.net.intent.constraint; | ||
17 | - | ||
18 | -import com.google.common.annotations.Beta; | ||
19 | -import org.onosproject.net.IndexedLambda; | ||
20 | -import org.onosproject.net.Link; | ||
21 | -import org.onosproject.net.resource.link.LinkResourceService; | ||
22 | -import org.onosproject.net.resource.ResourceRequest; | ||
23 | -import org.onosproject.net.resource.ResourceType; | ||
24 | - | ||
25 | -import java.util.Objects; | ||
26 | - | ||
27 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
28 | - | ||
29 | -/** | ||
30 | - * Constraint that evaluates links based on available lambda. | ||
31 | - */ | ||
32 | -@Beta | ||
33 | -public class LambdaConstraint extends BooleanConstraint { | ||
34 | - | ||
35 | - private final IndexedLambda lambda; | ||
36 | - | ||
37 | - /** | ||
38 | - * Creates a new optical lambda constraint. | ||
39 | - * | ||
40 | - * @param lambda optional lambda to indicate a specific lambda | ||
41 | - */ | ||
42 | - public LambdaConstraint(IndexedLambda lambda) { | ||
43 | - this.lambda = lambda; | ||
44 | - } | ||
45 | - | ||
46 | - // Constructor for serialization | ||
47 | - private LambdaConstraint() { | ||
48 | - this.lambda = null; | ||
49 | - } | ||
50 | - | ||
51 | - @Override | ||
52 | - public boolean isValid(Link link, LinkResourceService resourceService) { | ||
53 | - for (ResourceRequest request : resourceService.getAvailableResources(link)) { | ||
54 | - if (request.type() == ResourceType.LAMBDA) { | ||
55 | - return true; | ||
56 | - } | ||
57 | - } | ||
58 | - return false; | ||
59 | - } | ||
60 | - | ||
61 | - /** | ||
62 | - * Returns the lambda required by this constraint. | ||
63 | - * | ||
64 | - * @return required lambda | ||
65 | - */ | ||
66 | - public IndexedLambda lambda() { | ||
67 | - return lambda; | ||
68 | - } | ||
69 | - | ||
70 | - @Override | ||
71 | - public int hashCode() { | ||
72 | - return Objects.hashCode(lambda); | ||
73 | - } | ||
74 | - | ||
75 | - @Override | ||
76 | - public boolean equals(Object obj) { | ||
77 | - if (this == obj) { | ||
78 | - return true; | ||
79 | - } | ||
80 | - if (obj == null || getClass() != obj.getClass()) { | ||
81 | - return false; | ||
82 | - } | ||
83 | - final LambdaConstraint other = (LambdaConstraint) obj; | ||
84 | - return Objects.equals(this.lambda, other.lambda); | ||
85 | - } | ||
86 | - | ||
87 | - @Override | ||
88 | - public String toString() { | ||
89 | - return toStringHelper(this).add("lambda", lambda).toString(); | ||
90 | - } | ||
91 | -} |
... | @@ -31,7 +31,6 @@ import org.onosproject.net.intent.Constraint; | ... | @@ -31,7 +31,6 @@ import org.onosproject.net.intent.Constraint; |
31 | import org.onosproject.net.intent.IntentId; | 31 | import org.onosproject.net.intent.IntentId; |
32 | 32 | ||
33 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 33 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
34 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
35 | import org.onosproject.net.resource.ResourceRequest; | 34 | import org.onosproject.net.resource.ResourceRequest; |
36 | import org.onosproject.net.resource.ResourceType; | 35 | import org.onosproject.net.resource.ResourceType; |
37 | 36 | ||
... | @@ -197,9 +196,7 @@ public final class DefaultLinkResourceRequest implements LinkResourceRequest { | ... | @@ -197,9 +196,7 @@ public final class DefaultLinkResourceRequest implements LinkResourceRequest { |
197 | 196 | ||
198 | @Override | 197 | @Override |
199 | public LinkResourceRequest.Builder addConstraint(Constraint constraint) { | 198 | public LinkResourceRequest.Builder addConstraint(Constraint constraint) { |
200 | - if (constraint instanceof LambdaConstraint) { | 199 | + if (constraint instanceof BandwidthConstraint) { |
201 | - return addLambdaRequest(); | ||
202 | - } else if (constraint instanceof BandwidthConstraint) { | ||
203 | BandwidthConstraint bw = (BandwidthConstraint) constraint; | 200 | BandwidthConstraint bw = (BandwidthConstraint) constraint; |
204 | return addBandwidthRequest(bw.bandwidth().bps()); | 201 | return addBandwidthRequest(bw.bandwidth().bps()); |
205 | } | 202 | } | ... | ... |
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.intent; | 16 | package org.onosproject.net.intent; |
17 | 17 | ||
18 | +import java.time.Duration; | ||
18 | import java.util.HashSet; | 19 | import java.util.HashSet; |
19 | import java.util.LinkedList; | 20 | import java.util.LinkedList; |
20 | import java.util.List; | 21 | import java.util.List; |
... | @@ -22,20 +23,19 @@ import java.util.Set; | ... | @@ -22,20 +23,19 @@ import java.util.Set; |
22 | 23 | ||
23 | import org.junit.Test; | 24 | import org.junit.Test; |
24 | import org.onosproject.net.ConnectPoint; | 25 | import org.onosproject.net.ConnectPoint; |
25 | -import org.onosproject.net.IndexedLambda; | ||
26 | import org.onosproject.net.Link; | 26 | import org.onosproject.net.Link; |
27 | import org.onosproject.net.NetTestTools; | 27 | import org.onosproject.net.NetTestTools; |
28 | import org.onosproject.net.flow.TrafficSelector; | 28 | import org.onosproject.net.flow.TrafficSelector; |
29 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
30 | 29 | ||
31 | import com.google.common.collect.ImmutableSet; | 30 | import com.google.common.collect.ImmutableSet; |
32 | import com.google.common.testing.EqualsTester; | 31 | import com.google.common.testing.EqualsTester; |
32 | +import org.onosproject.net.intent.constraint.LatencyConstraint; | ||
33 | 33 | ||
34 | import static org.hamcrest.MatcherAssert.assertThat; | 34 | import static org.hamcrest.MatcherAssert.assertThat; |
35 | import static org.hamcrest.Matchers.hasSize; | 35 | import static org.hamcrest.Matchers.hasSize; |
36 | +import static org.hamcrest.Matchers.instanceOf; | ||
36 | import static org.hamcrest.Matchers.is; | 37 | import static org.hamcrest.Matchers.is; |
37 | import static org.hamcrest.Matchers.nullValue; | 38 | import static org.hamcrest.Matchers.nullValue; |
38 | -import static org.hamcrest.Matchers.startsWith; | ||
39 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; | 39 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
40 | import static org.onosproject.net.NetTestTools.APP_ID; | 40 | import static org.onosproject.net.NetTestTools.APP_ID; |
41 | import static org.onosproject.net.NetTestTools.link; | 41 | import static org.onosproject.net.NetTestTools.link; |
... | @@ -132,7 +132,7 @@ public class LinkCollectionIntentTest extends IntentTest { | ... | @@ -132,7 +132,7 @@ public class LinkCollectionIntentTest extends IntentTest { |
132 | final LinkedList<Constraint> constraints = new LinkedList<>(); | 132 | final LinkedList<Constraint> constraints = new LinkedList<>(); |
133 | 133 | ||
134 | links1.add(link("src", 1, "dst", 2)); | 134 | links1.add(link("src", 1, "dst", 2)); |
135 | - constraints.add(new LambdaConstraint(new IndexedLambda(23))); | 135 | + constraints.add(new LatencyConstraint(Duration.ofMillis(100))); |
136 | final LinkCollectionIntent collectionIntent = | 136 | final LinkCollectionIntent collectionIntent = |
137 | LinkCollectionIntent.builder() | 137 | LinkCollectionIntent.builder() |
138 | .appId(APP_ID) | 138 | .appId(APP_ID) |
... | @@ -155,7 +155,7 @@ public class LinkCollectionIntentTest extends IntentTest { | ... | @@ -155,7 +155,7 @@ public class LinkCollectionIntentTest extends IntentTest { |
155 | 155 | ||
156 | final List<Constraint> createdConstraints = collectionIntent.constraints(); | 156 | final List<Constraint> createdConstraints = collectionIntent.constraints(); |
157 | assertThat(createdConstraints, hasSize(1)); | 157 | assertThat(createdConstraints, hasSize(1)); |
158 | - assertThat(createdConstraints.get(0).toString(), startsWith("LambdaConstraint")); | 158 | + assertThat(createdConstraints.get(0), instanceOf(LatencyConstraint.class)); |
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** | ... | ... |
... | @@ -17,7 +17,6 @@ package org.onosproject.net.intent.constraint; | ... | @@ -17,7 +17,6 @@ package org.onosproject.net.intent.constraint; |
17 | 17 | ||
18 | import org.junit.Test; | 18 | import org.junit.Test; |
19 | import org.onlab.util.Bandwidth; | 19 | import org.onlab.util.Bandwidth; |
20 | -import org.onosproject.net.IndexedLambda; | ||
21 | import org.onosproject.net.Link; | 20 | import org.onosproject.net.Link; |
22 | 21 | ||
23 | import com.google.common.testing.EqualsTester; | 22 | import com.google.common.testing.EqualsTester; |
... | @@ -63,36 +62,6 @@ public class ConstraintObjectsTest { | ... | @@ -63,36 +62,6 @@ public class ConstraintObjectsTest { |
63 | .testEquals(); | 62 | .testEquals(); |
64 | } | 63 | } |
65 | 64 | ||
66 | - // Lambda Constraint | ||
67 | - | ||
68 | - final LambdaConstraint lambdaConstraint1 = | ||
69 | - new LambdaConstraint(new IndexedLambda(100)); | ||
70 | - final LambdaConstraint lambdaConstraintSameAs1 = | ||
71 | - new LambdaConstraint(new IndexedLambda(100)); | ||
72 | - final LambdaConstraint lambdaConstraint2 = | ||
73 | - new LambdaConstraint(new IndexedLambda(200)); | ||
74 | - | ||
75 | - /** | ||
76 | - * Checks that the objects were created properly. | ||
77 | - */ | ||
78 | - @Test | ||
79 | - public void testLambdaConstraintCreation() { | ||
80 | - assertThat(lambdaConstraint1.lambda().index(), is(equalTo(100L))); | ||
81 | - assertThat(lambdaConstraintSameAs1.lambda().index(), is(equalTo(100L))); | ||
82 | - assertThat(lambdaConstraint2.lambda().index(), is(equalTo(200L))); | ||
83 | - } | ||
84 | - | ||
85 | - /** | ||
86 | - * Checks the correctness of the equals() method. | ||
87 | - */ | ||
88 | - @Test | ||
89 | - public void testLambdaConstraintEquals() { | ||
90 | - new EqualsTester() | ||
91 | - .addEqualityGroup(lambdaConstraint1, lambdaConstraintSameAs1) | ||
92 | - .addEqualityGroup(lambdaConstraint2) | ||
93 | - .testEquals(); | ||
94 | - } | ||
95 | - | ||
96 | // LinkType Constraint | 65 | // LinkType Constraint |
97 | 66 | ||
98 | final LinkTypeConstraint linkTypeConstraint1 = | 67 | final LinkTypeConstraint linkTypeConstraint1 = | ... | ... |
... | @@ -21,13 +21,11 @@ import java.util.stream.IntStream; | ... | @@ -21,13 +21,11 @@ import java.util.stream.IntStream; |
21 | 21 | ||
22 | import org.onlab.util.Bandwidth; | 22 | import org.onlab.util.Bandwidth; |
23 | import org.onosproject.net.DeviceId; | 23 | import org.onosproject.net.DeviceId; |
24 | -import org.onosproject.net.IndexedLambda; | ||
25 | import org.onosproject.net.Link; | 24 | import org.onosproject.net.Link; |
26 | import org.onosproject.net.intent.Constraint; | 25 | import org.onosproject.net.intent.Constraint; |
27 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 26 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
28 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; | 27 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; |
29 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 28 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
30 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
31 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 29 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
32 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 30 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
33 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 31 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -95,19 +93,6 @@ public final class DecodeConstraintCodecHelper { | ... | @@ -95,19 +93,6 @@ public final class DecodeConstraintCodecHelper { |
95 | } | 93 | } |
96 | 94 | ||
97 | /** | 95 | /** |
98 | - * Decodes a lambda constraint. | ||
99 | - * | ||
100 | - * @return lambda constraint object. | ||
101 | - */ | ||
102 | - private Constraint decodeLambdaConstraint() { | ||
103 | - long lambda = nullIsIllegal(json.get(ConstraintCodec.LAMBDA), | ||
104 | - ConstraintCodec.LAMBDA + ConstraintCodec.MISSING_MEMBER_MESSAGE) | ||
105 | - .asLong(); | ||
106 | - | ||
107 | - return new LambdaConstraint(new IndexedLambda(lambda)); | ||
108 | - } | ||
109 | - | ||
110 | - /** | ||
111 | * Decodes a latency constraint. | 96 | * Decodes a latency constraint. |
112 | * | 97 | * |
113 | * @return latency constraint object. | 98 | * @return latency constraint object. |
... | @@ -198,8 +183,6 @@ public final class DecodeConstraintCodecHelper { | ... | @@ -198,8 +183,6 @@ public final class DecodeConstraintCodecHelper { |
198 | 183 | ||
199 | if (type.equals(BandwidthConstraint.class.getSimpleName())) { | 184 | if (type.equals(BandwidthConstraint.class.getSimpleName())) { |
200 | return decodeBandwidthConstraint(); | 185 | return decodeBandwidthConstraint(); |
201 | - } else if (type.equals(LambdaConstraint.class.getSimpleName())) { | ||
202 | - return decodeLambdaConstraint(); | ||
203 | } else if (type.equals(LinkTypeConstraint.class.getSimpleName())) { | 186 | } else if (type.equals(LinkTypeConstraint.class.getSimpleName())) { |
204 | return decodeLinkTypeConstraint(); | 187 | return decodeLinkTypeConstraint(); |
205 | } else if (type.equals(AnnotationConstraint.class.getSimpleName())) { | 188 | } else if (type.equals(AnnotationConstraint.class.getSimpleName())) { | ... | ... |
... | @@ -21,7 +21,6 @@ import org.onosproject.net.Link; | ... | @@ -21,7 +21,6 @@ import org.onosproject.net.Link; |
21 | import org.onosproject.net.intent.Constraint; | 21 | import org.onosproject.net.intent.Constraint; |
22 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 22 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
23 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 23 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
24 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
25 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 24 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
26 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 25 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
27 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 26 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -132,20 +131,6 @@ public final class EncodeConstraintCodecHelper { | ... | @@ -132,20 +131,6 @@ public final class EncodeConstraintCodecHelper { |
132 | } | 131 | } |
133 | 132 | ||
134 | /** | 133 | /** |
135 | - * Encodes a lambda constraint. | ||
136 | - * | ||
137 | - * @return JSON ObjectNode representing the constraint | ||
138 | - */ | ||
139 | - private ObjectNode encodeLambdaConstraint() { | ||
140 | - checkNotNull(constraint, "Lambda constraint cannot be null"); | ||
141 | - final LambdaConstraint lambdaConstraint = | ||
142 | - (LambdaConstraint) constraint; | ||
143 | - | ||
144 | - return context.mapper().createObjectNode() | ||
145 | - .put("lambda", lambdaConstraint.lambda().index()); | ||
146 | - } | ||
147 | - | ||
148 | - /** | ||
149 | * Encodes a link type constraint. | 134 | * Encodes a link type constraint. |
150 | * | 135 | * |
151 | * @return JSON ObjectNode representing the constraint | 136 | * @return JSON ObjectNode representing the constraint |
... | @@ -179,8 +164,6 @@ public final class EncodeConstraintCodecHelper { | ... | @@ -179,8 +164,6 @@ public final class EncodeConstraintCodecHelper { |
179 | final ObjectNode result; | 164 | final ObjectNode result; |
180 | if (constraint instanceof BandwidthConstraint) { | 165 | if (constraint instanceof BandwidthConstraint) { |
181 | result = encodeBandwidthConstraint(); | 166 | result = encodeBandwidthConstraint(); |
182 | - } else if (constraint instanceof LambdaConstraint) { | ||
183 | - result = encodeLambdaConstraint(); | ||
184 | } else if (constraint instanceof LinkTypeConstraint) { | 167 | } else if (constraint instanceof LinkTypeConstraint) { |
185 | result = encodeLinkTypeConstraint(); | 168 | result = encodeLinkTypeConstraint(); |
186 | } else if (constraint instanceof AnnotationConstraint) { | 169 | } else if (constraint instanceof AnnotationConstraint) { | ... | ... |
... | @@ -28,7 +28,6 @@ import org.onosproject.net.intent.Constraint; | ... | @@ -28,7 +28,6 @@ import org.onosproject.net.intent.Constraint; |
28 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 28 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
29 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; | 29 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; |
30 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 30 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
31 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
32 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 31 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
33 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 32 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
34 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 33 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -138,18 +137,6 @@ public class ConstraintCodecTest { | ... | @@ -138,18 +137,6 @@ public class ConstraintCodecTest { |
138 | } | 137 | } |
139 | 138 | ||
140 | /** | 139 | /** |
141 | - * Tests lambda constraint. | ||
142 | - */ | ||
143 | - @Test | ||
144 | - public void lambdaConstraint() { | ||
145 | - Constraint constraint = getConstraint("LambdaConstraint.json"); | ||
146 | - assertThat(constraint, instanceOf(LambdaConstraint.class)); | ||
147 | - | ||
148 | - LambdaConstraint lambdaConstraint = (LambdaConstraint) constraint; | ||
149 | - assertThat(lambdaConstraint.lambda().index(), is(444L)); | ||
150 | - } | ||
151 | - | ||
152 | - /** | ||
153 | * Tests latency constraint. | 140 | * Tests latency constraint. |
154 | */ | 141 | */ |
155 | @Test | 142 | @Test | ... | ... |
... | @@ -59,7 +59,6 @@ import org.onosproject.net.intent.PointToPointIntent; | ... | @@ -59,7 +59,6 @@ import org.onosproject.net.intent.PointToPointIntent; |
59 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 59 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
60 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; | 60 | import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; |
61 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 61 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
62 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
63 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 62 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
64 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 63 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
65 | import org.onosproject.net.intent.constraint.WaypointConstraint; | 64 | import org.onosproject.net.intent.constraint.WaypointConstraint; |
... | @@ -180,7 +179,6 @@ public class IntentCodecTest extends AbstractIntentTest { | ... | @@ -180,7 +179,6 @@ public class IntentCodecTest extends AbstractIntentTest { |
180 | final List<Constraint> constraints = | 179 | final List<Constraint> constraints = |
181 | ImmutableList.of( | 180 | ImmutableList.of( |
182 | new BandwidthConstraint(Bandwidth.bps(1.0)), | 181 | new BandwidthConstraint(Bandwidth.bps(1.0)), |
183 | - new LambdaConstraint(new IndexedLambda(3)), | ||
184 | new AnnotationConstraint("key", 33.0), | 182 | new AnnotationConstraint("key", 33.0), |
185 | new AsymmetricPathConstraint(), | 183 | new AsymmetricPathConstraint(), |
186 | new LatencyConstraint(Duration.ofSeconds(2)), | 184 | new LatencyConstraint(Duration.ofSeconds(2)), | ... | ... |
... | @@ -35,7 +35,6 @@ import org.onosproject.net.intent.Intent; | ... | @@ -35,7 +35,6 @@ import org.onosproject.net.intent.Intent; |
35 | import org.onosproject.net.intent.PointToPointIntent; | 35 | import org.onosproject.net.intent.PointToPointIntent; |
36 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 36 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
37 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 37 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
38 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
39 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 38 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
40 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 39 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
41 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 40 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -145,22 +144,6 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> | ... | @@ -145,22 +144,6 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> |
145 | } | 144 | } |
146 | 145 | ||
147 | /** | 146 | /** |
148 | - * Matches a lamdba constraint against a JSON representation of the | ||
149 | - * constraint. | ||
150 | - * | ||
151 | - * @param lambdaConstraint constraint object to match | ||
152 | - * @param constraintJson JSON representation of the constraint | ||
153 | - * @return true if the constraint and JSON match, false otherwise. | ||
154 | - */ | ||
155 | - private boolean matchLambdaConstraint(LambdaConstraint lambdaConstraint, | ||
156 | - JsonNode constraintJson) { | ||
157 | - final JsonNode lambdaJson = constraintJson.get("lambda"); | ||
158 | - return lambdaJson != null | ||
159 | - && constraintJson.get("lambda").asInt() | ||
160 | - == lambdaConstraint.lambda().index(); | ||
161 | - } | ||
162 | - | ||
163 | - /** | ||
164 | * Matches a link type constraint against a JSON representation of the | 147 | * Matches a link type constraint against a JSON representation of the |
165 | * constraint. | 148 | * constraint. |
166 | * | 149 | * |
... | @@ -307,9 +290,6 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> | ... | @@ -307,9 +290,6 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> |
307 | if (constraint instanceof BandwidthConstraint) { | 290 | if (constraint instanceof BandwidthConstraint) { |
308 | return matchBandwidthConstraint((BandwidthConstraint) constraint, | 291 | return matchBandwidthConstraint((BandwidthConstraint) constraint, |
309 | constraintJson); | 292 | constraintJson); |
310 | - } else if (constraint instanceof LambdaConstraint) { | ||
311 | - return matchLambdaConstraint((LambdaConstraint) constraint, | ||
312 | - constraintJson); | ||
313 | } else if (constraint instanceof LinkTypeConstraint) { | 293 | } else if (constraint instanceof LinkTypeConstraint) { |
314 | return matchLinkTypeConstraint((LinkTypeConstraint) constraint, | 294 | return matchLinkTypeConstraint((LinkTypeConstraint) constraint, |
315 | constraintJson); | 295 | constraintJson); | ... | ... |
... | @@ -21,7 +21,6 @@ import org.onlab.util.Bandwidth; | ... | @@ -21,7 +21,6 @@ import org.onlab.util.Bandwidth; |
21 | import org.onosproject.TestApplicationId; | 21 | import org.onosproject.TestApplicationId; |
22 | import org.onosproject.core.ApplicationId; | 22 | import org.onosproject.core.ApplicationId; |
23 | import org.onosproject.net.ConnectPoint; | 23 | import org.onosproject.net.ConnectPoint; |
24 | -import org.onosproject.net.IndexedLambda; | ||
25 | import org.onosproject.net.Link; | 24 | import org.onosproject.net.Link; |
26 | import org.onosproject.net.Path; | 25 | import org.onosproject.net.Path; |
27 | import org.onosproject.net.flow.TrafficSelector; | 26 | import org.onosproject.net.flow.TrafficSelector; |
... | @@ -33,7 +32,6 @@ import org.onosproject.net.intent.IntentTestsMocks; | ... | @@ -33,7 +32,6 @@ import org.onosproject.net.intent.IntentTestsMocks; |
33 | import org.onosproject.net.intent.PathIntent; | 32 | import org.onosproject.net.intent.PathIntent; |
34 | import org.onosproject.net.intent.PointToPointIntent; | 33 | import org.onosproject.net.intent.PointToPointIntent; |
35 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 34 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
36 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
37 | import org.onosproject.net.intent.impl.PathNotFoundException; | 35 | import org.onosproject.net.intent.impl.PathNotFoundException; |
38 | import org.onosproject.net.resource.link.LinkResourceService; | 36 | import org.onosproject.net.resource.link.LinkResourceService; |
39 | 37 | ||
... | @@ -266,54 +264,4 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { | ... | @@ -266,54 +264,4 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { |
266 | assertThat(noPath.getMessage(), containsString("No path")); | 264 | assertThat(noPath.getMessage(), containsString("No path")); |
267 | } | 265 | } |
268 | } | 266 | } |
269 | - | ||
270 | - /** | ||
271 | - * Tests that requests for available lambdas are successful. | ||
272 | - */ | ||
273 | - @Test | ||
274 | - public void testLambdaConstrainedIntentSuccess() { | ||
275 | - | ||
276 | - final List<Constraint> constraints = | ||
277 | - Collections.singletonList(new LambdaConstraint(new IndexedLambda(1))); | ||
278 | - final LinkResourceService resourceService = | ||
279 | - IntentTestsMocks.MockResourceService.makeLambdaResourceService(1); | ||
280 | - | ||
281 | - final PointToPointIntent intent = makeIntent("s1", "s3", constraints); | ||
282 | - | ||
283 | - String[] hops = {"s1", "s2", "s3"}; | ||
284 | - final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService); | ||
285 | - | ||
286 | - final List<Intent> compiledIntents = | ||
287 | - compiler.compile(intent, null, null); | ||
288 | - | ||
289 | - assertThat(compiledIntents, Matchers.notNullValue()); | ||
290 | - assertThat(compiledIntents, hasSize(1)); | ||
291 | - } | ||
292 | - | ||
293 | - /** | ||
294 | - * Tests that requests for lambdas when there are no available lambdas | ||
295 | - * fail. | ||
296 | - */ | ||
297 | - @Test | ||
298 | - public void testLambdaConstrainedIntentFailure() { | ||
299 | - | ||
300 | - final List<Constraint> constraints = | ||
301 | - Collections.singletonList(new LambdaConstraint(new IndexedLambda(1))); | ||
302 | - final LinkResourceService resourceService = | ||
303 | - IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0); | ||
304 | - try { | ||
305 | - final PointToPointIntent intent = makeIntent("s1", "s3", constraints); | ||
306 | - | ||
307 | - String[] hops = {"s1", "s2", "s3"}; | ||
308 | - final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService); | ||
309 | - | ||
310 | - compiler.compile(intent, null, null); | ||
311 | - | ||
312 | - fail("Point to Point compilation with no available lambda does " | ||
313 | - + "not throw exception."); | ||
314 | - } catch (PathNotFoundException noPath) { | ||
315 | - assertThat(noPath.getMessage(), containsString("No path")); | ||
316 | - } | ||
317 | - } | ||
318 | - | ||
319 | } | 267 | } | ... | ... |
... | @@ -172,7 +172,6 @@ import org.onosproject.net.intent.SinglePointToMultiPointIntent; | ... | @@ -172,7 +172,6 @@ import org.onosproject.net.intent.SinglePointToMultiPointIntent; |
172 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 172 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
173 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 173 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
174 | import org.onosproject.net.intent.constraint.BooleanConstraint; | 174 | import org.onosproject.net.intent.constraint.BooleanConstraint; |
175 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
176 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 175 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
177 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 176 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
178 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 177 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -454,7 +453,6 @@ public final class KryoNamespaces { | ... | @@ -454,7 +453,6 @@ public final class KryoNamespaces { |
454 | ContinuousResourceId.class, | 453 | ContinuousResourceId.class, |
455 | ResourceAllocation.class, | 454 | ResourceAllocation.class, |
456 | // Constraints | 455 | // Constraints |
457 | - LambdaConstraint.class, | ||
458 | BandwidthConstraint.class, | 456 | BandwidthConstraint.class, |
459 | LinkTypeConstraint.class, | 457 | LinkTypeConstraint.class, |
460 | LatencyConstraint.class, | 458 | LatencyConstraint.class, | ... | ... |
... | @@ -44,7 +44,6 @@ import org.onosproject.net.Device; | ... | @@ -44,7 +44,6 @@ import org.onosproject.net.Device; |
44 | import org.onosproject.net.DeviceId; | 44 | import org.onosproject.net.DeviceId; |
45 | import org.onosproject.net.GridType; | 45 | import org.onosproject.net.GridType; |
46 | import org.onosproject.net.HostLocation; | 46 | import org.onosproject.net.HostLocation; |
47 | -import org.onosproject.net.IndexedLambda; | ||
48 | import org.onosproject.net.Link; | 47 | import org.onosproject.net.Link; |
49 | import org.onosproject.net.Link.Type; | 48 | import org.onosproject.net.Link.Type; |
50 | import org.onosproject.net.LinkKey; | 49 | import org.onosproject.net.LinkKey; |
... | @@ -76,7 +75,6 @@ import org.onosproject.net.resource.link.LinkResourceRequest; | ... | @@ -76,7 +75,6 @@ import org.onosproject.net.resource.link.LinkResourceRequest; |
76 | import org.onosproject.net.resource.ResourceAllocation; | 75 | import org.onosproject.net.resource.ResourceAllocation; |
77 | import org.onosproject.net.intent.constraint.AnnotationConstraint; | 76 | import org.onosproject.net.intent.constraint.AnnotationConstraint; |
78 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 77 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
79 | -import org.onosproject.net.intent.constraint.LambdaConstraint; | ||
80 | import org.onosproject.net.intent.constraint.LatencyConstraint; | 78 | import org.onosproject.net.intent.constraint.LatencyConstraint; |
81 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; | 79 | import org.onosproject.net.intent.constraint.LinkTypeConstraint; |
82 | import org.onosproject.net.intent.constraint.ObstacleConstraint; | 80 | import org.onosproject.net.intent.constraint.ObstacleConstraint; |
... | @@ -422,11 +420,6 @@ public class KryoSerializerTest { | ... | @@ -422,11 +420,6 @@ public class KryoSerializerTest { |
422 | } | 420 | } |
423 | 421 | ||
424 | @Test | 422 | @Test |
425 | - public void testLambdaConstraint() { | ||
426 | - testSerializable(new LambdaConstraint(new IndexedLambda(1))); | ||
427 | - } | ||
428 | - | ||
429 | - @Test | ||
430 | public void testBandwidthConstraint() { | 423 | public void testBandwidthConstraint() { |
431 | testSerializable(new BandwidthConstraint(Bandwidth.bps(1000.0))); | 424 | testSerializable(new BandwidthConstraint(Bandwidth.bps(1000.0))); |
432 | } | 425 | } | ... | ... |
-
Please register or login to post a comment