Sho SHIMIZU
Committed by Gerrit Code Review

Remove optical related APIs deprecated in Cardinal

Change-Id: I0e428039cc99247d1bfe6493a926ebac0adb1ebc
......@@ -23,7 +23,6 @@ import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.TpPort;
import org.onlab.packet.VlanId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.flow.criteria.Criterion;
......@@ -352,18 +351,6 @@ public final class DefaultTrafficSelector implements TrafficSelector {
return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags));
}
@Deprecated
@Override
public Builder matchLambda(short lambda) {
return add(Criteria.matchLambda(new IndexedLambda(lambda)));
}
@Deprecated
@Override
public Builder matchOpticalSignalType(short signalType) {
return add(Criteria.matchOpticalSignalType(signalType));
}
@Override
public TrafficSelector build() {
return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values()));
......
......@@ -386,30 +386,6 @@ public interface TrafficSelector {
Builder matchIPv6ExthdrFlags(short exthdrFlags);
/**
* Matches an optical signal ID or lambda.
*
* @param lambda lambda
* @return a selection builder
* @deprecated in Cardinal Release.
* Use {@link #add(Criterion)} with an instance created
* by {@link org.onosproject.net.flow.criteria.Criteria#matchLambda(org.onosproject.net.Lambda)}.
*/
@Deprecated
Builder matchLambda(short lambda);
/**
* Matches an optical Signal Type.
*
* @param signalType signalType
* @return a selection builder
* @deprecated in Cardinal Release.
* Use {@link #add(Criterion)}} with an instance created
* by {@link org.onosproject.net.flow.criteria.Criteria#matchOchSignalType(org.onosproject.net.OchSignalType)}.
*/
@Deprecated
Builder matchOpticalSignalType(short signalType);
/**
* Builds an immutable traffic selector.
*
* @return traffic selector
......
......@@ -461,18 +461,6 @@ public final class Criteria {
}
/**
* Creates a match on lambda field using the specified value.
*
* @param lambda lambda to match on (16 bits unsigned integer)
* @return match criterion
* @deprecated in Cardinal Release. Use {@link #matchLambda(Lambda)} instead.
*/
@Deprecated
public static Criterion matchLambda(int lambda) {
return new LambdaCriterion(lambda, Type.OCH_SIGID);
}
/**
* Creates a match on lambda using the specified value.
*
* @param lambda lambda
......@@ -489,18 +477,6 @@ public final class Criteria {
}
/**
* Creates a match on optical signal type using the specified value.
*
* @param sigType optical signal type (8 bits unsigned integer)
* @return match criterion
* @deprecated in Cardinal Release
*/
@Deprecated
public static Criterion matchOpticalSignalType(short sigType) {
return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE);
}
/**
* Create a match on OCh (Optical Channel) signal type.
*
* @param signalType OCh signal type
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.net.flow.criteria;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Implementation of optical signal type criterion (8 bits unsigned
* integer).
*
* @deprecated in Cardinal Release
*/
@Deprecated
public final class OpticalSignalTypeCriterion implements Criterion {
private static final short MASK = 0xff;
private final short signalType; // Signal type value: 8 bits
private final Type type;
/**
* Constructor.
*
* @param signalType the optical signal type to match (8 bits unsigned
* integer)
* @param type the match type. Should be Type.OCH_SIGTYPE
*/
OpticalSignalTypeCriterion(short signalType, Type type) {
this.signalType = (short) (signalType & MASK);
this.type = type;
}
@Override
public Type type() {
return this.type;
}
/**
* Gets the optical signal type to match.
*
* @return the optical signal type to match (8 bits unsigned integer)
*/
public short signalType() {
return signalType;
}
@Override
public String toString() {
return toStringHelper(type().toString())
.add("signalType", signalType).toString();
}
@Override
public int hashCode() {
return Objects.hash(type().ordinal(), signalType);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OpticalSignalTypeCriterion) {
OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj;
return Objects.equals(signalType, that.signalType) &&
Objects.equals(type, that.type);
}
return false;
}
}
......@@ -89,19 +89,6 @@ public final class Instructions {
}
/**
* Creates a l0 modification.
*
* @param lambda the lambda to modify to
* @return a l0 modification
* @deprecated in Cardinal Release. Use {@link #modL0Lambda(Lambda)} instead.
*/
@Deprecated
public static L0ModificationInstruction modL0Lambda(short lambda) {
checkNotNull(lambda, "L0 lambda cannot be null");
return new ModLambdaInstruction(L0SubType.LAMBDA, lambda);
}
/**
* Creates an L0 modification with the specified OCh signal.
*
* @param lambda OCh signal
......
......@@ -267,29 +267,5 @@ public class DefaultTrafficSelectorTest {
selector = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
selector = DefaultTrafficSelector.builder()
.add(Criteria.matchOpticalSignalType(shortValue)).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE));
}
/**
* Tests the traffic selector builder.
*/
@Test
public void testTrafficSelectorBuilder() {
TrafficSelector selector;
final short shortValue = 33;
final TrafficSelector baseSelector = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
selector = DefaultTrafficSelector.builder(baseSelector)
.build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
final Criterion criterion = Criteria.matchLambda(shortValue);
selector = DefaultTrafficSelector.builder()
.add(criterion).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
}
}
......
......@@ -225,12 +225,6 @@ public class CriteriaTest {
Criterion matchIpv6ExthdrFlags2 =
Criteria.matchIPv6ExthdrFlags(ipv6ExthdrFlags2);
int lambda1 = 1;
int lambda2 = 2;
Criterion matchLambda1 = Criteria.matchLambda(lambda1);
Criterion sameAsMatchLambda1 = Criteria.matchLambda(lambda1);
Criterion matchLambda2 = Criteria.matchLambda(lambda2);
Criterion matchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
Criterion sameAsMatchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
Criterion matchOchSignalType2 = Criteria.matchOchSignalType(OchSignalType.FLEX_GRID);
......@@ -239,12 +233,6 @@ public class CriteriaTest {
Criterion sameAsMatchIndexedLambda1 = Criteria.matchLambda(Lambda.indexedLambda(1));
Criterion matchIndexedLambda2 = Criteria.matchLambda(Lambda.indexedLambda(2));
short signalLambda1 = 1;
short signalLambda2 = 2;
Criterion matchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
Criterion sameAsMatchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
Criterion matchSignalLambda2 = Criteria.matchOpticalSignalType(signalLambda2);
Criterion matchOchSignal1 =
Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8));
Criterion sameAsMatchOchSignal1 =
......@@ -306,7 +294,6 @@ public class CriteriaTest {
assertThatClassIsImmutable(MplsCriterion.class);
assertThatClassIsImmutable(IPv6ExthdrFlagsCriterion.class);
assertThatClassIsImmutable(LambdaCriterion.class);
assertThatClassIsImmutable(OpticalSignalTypeCriterion.class);
}
// PortCriterion class
......@@ -1057,32 +1044,6 @@ public class CriteriaTest {
.testEquals();
}
// LambdaCriterion class
/**
* Test the matchLambda method.
*/
@Test
public void testMatchLambdaMethod() {
Criterion matchLambda = Criteria.matchLambda(lambda1);
LambdaCriterion lambdaCriterion =
checkAndConvert(matchLambda,
Criterion.Type.OCH_SIGID,
LambdaCriterion.class);
assertThat(lambdaCriterion.lambda(), is(equalTo(lambda1)));
}
/**
* Test the equals() method of the LambdaCriterion class.
*/
@Test
public void testLambdaCriterionEquals() {
new EqualsTester()
.addEqualityGroup(matchLambda1, sameAsMatchLambda1)
.addEqualityGroup(matchLambda2)
.testEquals();
}
@Test
public void testIndexedLambdaCriterionEquals() {
new EqualsTester()
......@@ -1109,30 +1070,4 @@ public class CriteriaTest {
.addEqualityGroup(matchOchSignalType2)
.testEquals();
}
// OpticalSignalTypeCriterion class
/**
* Test the matchOpticalSignalType method.
*/
@Test
public void testMatchOpticalSignalTypeMethod() {
Criterion matchLambda = Criteria.matchOpticalSignalType(signalLambda1);
OpticalSignalTypeCriterion opticalSignalTypeCriterion =
checkAndConvert(matchLambda,
Criterion.Type.OCH_SIGTYPE,
OpticalSignalTypeCriterion.class);
assertThat(opticalSignalTypeCriterion.signalType(), is(equalTo(signalLambda1)));
}
/**
* Test the equals() method of the OpticalSignalTypeCriterion class.
*/
@Test
public void testOpticalSignalTypeCriterionEquals() {
new EqualsTester()
.addEqualityGroup(matchSignalLambda1, sameAsMatchSignalLambda1)
.addEqualityGroup(matchSignalLambda2)
.testEquals();
}
}
......
......@@ -38,10 +38,8 @@ import org.onosproject.net.flow.criteria.Criterion;
import com.fasterxml.jackson.databind.node.ObjectNode;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.onlab.junit.TestUtils.getField;
import static org.onlab.junit.TestUtils.setField;
import static org.onosproject.codec.impl.CriterionJsonMatcher.matchesCriterion;
/**
......@@ -429,17 +427,4 @@ public class CriterionCodecTest {
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
/**
* Tests that an unimplemented criterion type only returns the type and
* no other data.
*/
@Test
public void matchUnknownTypeTest() throws Exception {
Criterion criterion = Criteria.matchOpticalSignalType((byte) 250);
setField(criterion, "type", Criterion.Type.UNASSIGNED_40);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result.get("type").textValue(), is(criterion.type().toString()));
assertThat(result.size(), is(1));
}
}
......
......@@ -118,7 +118,6 @@ import org.onosproject.net.flow.criteria.MetadataCriterion;
import org.onosproject.net.flow.criteria.MplsCriterion;
import org.onosproject.net.flow.criteria.OchSignalCriterion;
import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion;
import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.SctpPortCriterion;
import org.onosproject.net.flow.criteria.TcpPortCriterion;
......@@ -339,7 +338,6 @@ public final class KryoNamespaces {
IndexedLambdaCriterion.class,
OchSignalCriterion.class,
OchSignalTypeCriterion.class,
OpticalSignalTypeCriterion.class,
Criterion.class,
Criterion.Type.class,
DefaultTrafficTreatment.class,
......