Sho SHIMIZU

Remove IndexedLambdaCriterion deprecated in Emu

Change-Id: If1976963b49d28139d0002d9cd44414e4a8d9d50
...@@ -24,7 +24,6 @@ import org.onlab.packet.MplsLabel; ...@@ -24,7 +24,6 @@ import org.onlab.packet.MplsLabel;
24 import org.onlab.packet.TpPort; 24 import org.onlab.packet.TpPort;
25 import org.onlab.packet.VlanId; 25 import org.onlab.packet.VlanId;
26 import org.onosproject.net.DeviceId; 26 import org.onosproject.net.DeviceId;
27 -import org.onosproject.net.IndexedLambda;
28 import org.onosproject.net.Lambda; 27 import org.onosproject.net.Lambda;
29 import org.onosproject.net.OchSignal; 28 import org.onosproject.net.OchSignal;
30 import org.onosproject.net.OchSignalType; 29 import org.onosproject.net.OchSignalType;
...@@ -460,9 +459,7 @@ public final class Criteria { ...@@ -460,9 +459,7 @@ public final class Criteria {
460 * @return match criterion 459 * @return match criterion
461 */ 460 */
462 public static Criterion matchLambda(Lambda lambda) { 461 public static Criterion matchLambda(Lambda lambda) {
463 - if (lambda instanceof IndexedLambda) { 462 + if (lambda instanceof OchSignal) {
464 - return new IndexedLambdaCriterion((IndexedLambda) lambda);
465 - } else if (lambda instanceof OchSignal) {
466 return new OchSignalCriterion((OchSignal) lambda); 463 return new OchSignalCriterion((OchSignal) lambda);
467 } else { 464 } else {
468 throw new UnsupportedOperationException(String.format("Unsupported type of Lambda: %s", lambda)); 465 throw new UnsupportedOperationException(String.format("Unsupported type of Lambda: %s", lambda));
......
1 -/*
2 - * Copyright 2015 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.flow.criteria;
17 -
18 -import org.onosproject.net.IndexedLambda;
19 -
20 -import java.util.Objects;
21 -
22 -import static com.google.common.base.Preconditions.checkNotNull;
23 -
24 -/**
25 - * Implementation of indexed lambda criterion.
26 - *
27 - * @deprecated in Emu (ONOS 1.4).
28 - */
29 -@Deprecated
30 -public class IndexedLambdaCriterion implements Criterion {
31 -
32 - private final IndexedLambda lambda;
33 -
34 - /**
35 - * Creates a criterion with the specified value.
36 - *
37 - * @param lambda lambda index number
38 - */
39 - IndexedLambdaCriterion(IndexedLambda lambda) {
40 - this.lambda = checkNotNull(lambda);
41 - }
42 -
43 - @Override
44 - public Type type() {
45 - // TODO: consider defining a new specific type
46 - // Now OCH_SIGID is used due to compatibility concerns
47 - return Type.OCH_SIGID;
48 - }
49 -
50 - /**
51 - * Returns the indexed lambda to match.
52 - *
53 - * @return the indexed lambda to match
54 - */
55 - public IndexedLambda lambda() {
56 - return lambda;
57 - }
58 -
59 - @Override
60 - public int hashCode() {
61 - return Objects.hash(type().ordinal(), lambda);
62 - }
63 -
64 - @Override
65 - public boolean equals(Object obj) {
66 - if (this == obj) {
67 - return true;
68 - }
69 - if (!(obj instanceof IndexedLambdaCriterion)) {
70 - return false;
71 - }
72 - final IndexedLambdaCriterion that = (IndexedLambdaCriterion) obj;
73 - return Objects.equals(this.lambda, that.lambda);
74 - }
75 -
76 - @Override
77 - public String toString() {
78 - return type().toString() + SEPARATOR + lambda;
79 - }
80 -}
...@@ -28,7 +28,9 @@ import org.onlab.packet.MacAddress; ...@@ -28,7 +28,9 @@ import org.onlab.packet.MacAddress;
28 import org.onlab.packet.MplsLabel; 28 import org.onlab.packet.MplsLabel;
29 import org.onlab.packet.TpPort; 29 import org.onlab.packet.TpPort;
30 import org.onlab.packet.VlanId; 30 import org.onlab.packet.VlanId;
31 -import org.onosproject.net.IndexedLambda; 31 +import org.onosproject.net.ChannelSpacing;
32 +import org.onosproject.net.GridType;
33 +import org.onosproject.net.OchSignal;
32 import org.onosproject.net.PortNumber; 34 import org.onosproject.net.PortNumber;
33 import org.onosproject.net.flow.criteria.Criteria; 35 import org.onosproject.net.flow.criteria.Criteria;
34 import org.onosproject.net.flow.criteria.Criterion; 36 import org.onosproject.net.flow.criteria.Criterion;
...@@ -59,17 +61,14 @@ public class DefaultTrafficSelectorTest { ...@@ -59,17 +61,14 @@ public class DefaultTrafficSelectorTest {
59 */ 61 */
60 @Test 62 @Test
61 public void testEquals() { 63 public void testEquals() {
62 - final short one = 1;
63 - final short two = 2;
64 -
65 final TrafficSelector selector1 = DefaultTrafficSelector.builder() 64 final TrafficSelector selector1 = DefaultTrafficSelector.builder()
66 - .add(Criteria.matchLambda(new IndexedLambda(one))) 65 + .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1)))
67 .build(); 66 .build();
68 final TrafficSelector sameAsSelector1 = DefaultTrafficSelector.builder() 67 final TrafficSelector sameAsSelector1 = DefaultTrafficSelector.builder()
69 - .add(Criteria.matchLambda(new IndexedLambda(one))) 68 + .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1)))
70 .build(); 69 .build();
71 final TrafficSelector selector2 = DefaultTrafficSelector.builder() 70 final TrafficSelector selector2 = DefaultTrafficSelector.builder()
72 - .add(Criteria.matchLambda(new IndexedLambda(two))) 71 + .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_50GHZ, 1, 1)))
73 .build(); 72 .build();
74 73
75 new EqualsTester() 74 new EqualsTester()
...@@ -265,7 +264,7 @@ public class DefaultTrafficSelectorTest { ...@@ -265,7 +264,7 @@ public class DefaultTrafficSelectorTest {
265 assertThat(selector, hasCriterionWithType(Type.IPV6_EXTHDR)); 264 assertThat(selector, hasCriterionWithType(Type.IPV6_EXTHDR));
266 265
267 selector = DefaultTrafficSelector.builder() 266 selector = DefaultTrafficSelector.builder()
268 - .add(Criteria.matchLambda(new IndexedLambda(shortValue))).build(); 267 + .add(Criteria.matchLambda(new OchSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 1, 1))).build();
269 assertThat(selector, hasCriterionWithType(Type.OCH_SIGID)); 268 assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
270 } 269 }
271 } 270 }
......
...@@ -256,10 +256,6 @@ public class CriteriaTest { ...@@ -256,10 +256,6 @@ public class CriteriaTest {
256 Criterion sameAsMatchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID); 256 Criterion sameAsMatchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
257 Criterion matchOchSignalType2 = Criteria.matchOchSignalType(OchSignalType.FLEX_GRID); 257 Criterion matchOchSignalType2 = Criteria.matchOchSignalType(OchSignalType.FLEX_GRID);
258 258
259 - Criterion matchIndexedLambda1 = Criteria.matchLambda(Lambda.indexedLambda(1));
260 - Criterion sameAsMatchIndexedLambda1 = Criteria.matchLambda(Lambda.indexedLambda(1));
261 - Criterion matchIndexedLambda2 = Criteria.matchLambda(Lambda.indexedLambda(2));
262 -
263 Criterion matchOchSignal1 = 259 Criterion matchOchSignal1 =
264 Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8)); 260 Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8));
265 Criterion sameAsMatchOchSignal1 = 261 Criterion sameAsMatchOchSignal1 =
...@@ -1147,14 +1143,6 @@ public class CriteriaTest { ...@@ -1147,14 +1143,6 @@ public class CriteriaTest {
1147 } 1143 }
1148 1144
1149 @Test 1145 @Test
1150 - public void testIndexedLambdaCriterionEquals() {
1151 - new EqualsTester()
1152 - .addEqualityGroup(matchIndexedLambda1, sameAsMatchIndexedLambda1)
1153 - .addEqualityGroup(matchIndexedLambda2)
1154 - .testEquals();
1155 - }
1156 -
1157 - @Test
1158 public void testOchSignalCriterionEquals() { 1146 public void testOchSignalCriterionEquals() {
1159 new EqualsTester() 1147 new EqualsTester()
1160 .addEqualityGroup(matchOchSignal1, sameAsMatchOchSignal1) 1148 .addEqualityGroup(matchOchSignal1, sameAsMatchOchSignal1)
......
...@@ -51,7 +51,6 @@ import org.onosproject.net.flow.criteria.IcmpCodeCriterion; ...@@ -51,7 +51,6 @@ import org.onosproject.net.flow.criteria.IcmpCodeCriterion;
51 import org.onosproject.net.flow.criteria.IcmpTypeCriterion; 51 import org.onosproject.net.flow.criteria.IcmpTypeCriterion;
52 import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; 52 import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion;
53 import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; 53 import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion;
54 -import org.onosproject.net.flow.criteria.IndexedLambdaCriterion;
55 import org.onosproject.net.flow.criteria.MplsCriterion; 54 import org.onosproject.net.flow.criteria.MplsCriterion;
56 import org.onosproject.net.flow.criteria.OchSignalCriterion; 55 import org.onosproject.net.flow.criteria.OchSignalCriterion;
57 import org.onosproject.net.flow.criteria.OchSignalTypeCriterion; 56 import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
...@@ -387,7 +386,7 @@ public class FlowRuleCodecTest { ...@@ -387,7 +386,7 @@ public class FlowRuleCodecTest {
387 386
388 checkCommonData(rule); 387 checkCommonData(rule);
389 388
390 - assertThat(rule.selector().criteria().size(), is(36)); 389 + assertThat(rule.selector().criteria().size(), is(35));
391 390
392 rule.selector().criteria() 391 rule.selector().criteria()
393 .stream() 392 .stream()
...@@ -516,10 +515,6 @@ public class FlowRuleCodecTest { ...@@ -516,10 +515,6 @@ public class FlowRuleCodecTest {
516 assertThat(((IPv6ExthdrFlagsCriterion) criterion).exthdrFlags(), 515 assertThat(((IPv6ExthdrFlagsCriterion) criterion).exthdrFlags(),
517 is(99)); 516 is(99));
518 517
519 - criterion = getCriterion(Criterion.Type.OCH_SIGID);
520 - assertThat(((IndexedLambdaCriterion) criterion).lambda(),
521 - is(Lambda.indexedLambda(122)));
522 -
523 criterion = getCriterion(Criterion.Type.TUNNEL_ID); 518 criterion = getCriterion(Criterion.Type.TUNNEL_ID);
524 assertThat(((TunnelIdCriterion) criterion).tunnelId(), 519 assertThat(((TunnelIdCriterion) criterion).tunnelId(),
525 is(100L)); 520 is(100L));
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
38 {"type":"IPV6_ND_TLL", "mac":"00:11:22:33:44:57"}, 38 {"type":"IPV6_ND_TLL", "mac":"00:11:22:33:44:57"},
39 {"type":"MPLS_LABEL", "label":123}, 39 {"type":"MPLS_LABEL", "label":123},
40 {"type":"IPV6_EXTHDR", "exthdrFlags":99}, 40 {"type":"IPV6_EXTHDR", "exthdrFlags":99},
41 - {"type":"OCH_SIGID", "lambda":122},
42 {"type":"TUNNEL_ID", "tunnelId":100}, 41 {"type":"TUNNEL_ID", "tunnelId":100},
43 {"type":"OCH_SIGTYPE", "ochSignalType":"FIXED_GRID"}, 42 {"type":"OCH_SIGTYPE", "ochSignalType":"FIXED_GRID"},
44 {"type":"ODU_SIGTYPE", "oduSignalType":"ODU4"}, 43 {"type":"ODU_SIGTYPE", "oduSignalType":"ODU4"},
......
...@@ -126,7 +126,6 @@ import org.onosproject.net.flow.criteria.IcmpCodeCriterion; ...@@ -126,7 +126,6 @@ import org.onosproject.net.flow.criteria.IcmpCodeCriterion;
126 import org.onosproject.net.flow.criteria.IcmpTypeCriterion; 126 import org.onosproject.net.flow.criteria.IcmpTypeCriterion;
127 import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; 127 import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion;
128 import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; 128 import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion;
129 -import org.onosproject.net.flow.criteria.IndexedLambdaCriterion;
130 import org.onosproject.net.flow.criteria.LambdaCriterion; 129 import org.onosproject.net.flow.criteria.LambdaCriterion;
131 import org.onosproject.net.flow.criteria.MetadataCriterion; 130 import org.onosproject.net.flow.criteria.MetadataCriterion;
132 import org.onosproject.net.flow.criteria.MplsBosCriterion; 131 import org.onosproject.net.flow.criteria.MplsBosCriterion;
...@@ -356,7 +355,6 @@ public final class KryoNamespaces { ...@@ -356,7 +355,6 @@ public final class KryoNamespaces {
356 TunnelIdCriterion.class, 355 TunnelIdCriterion.class,
357 IPv6ExthdrFlagsCriterion.class, 356 IPv6ExthdrFlagsCriterion.class,
358 LambdaCriterion.class, 357 LambdaCriterion.class,
359 - IndexedLambdaCriterion.class,
360 OchSignalCriterion.class, 358 OchSignalCriterion.class,
361 OchSignalTypeCriterion.class, 359 OchSignalTypeCriterion.class,
362 OduSignalIdCriterion.class, 360 OduSignalIdCriterion.class,
......