Sho SHIMIZU

Replace deprecated APIs with the alternatives

Change-Id: I2959554573e0561543ab5fd0b2bcc871b8a74f3d
......@@ -28,6 +28,7 @@ import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
......@@ -39,6 +40,7 @@ import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleService;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.Criteria;
import org.slf4j.Logger;
/**
......@@ -113,14 +115,14 @@ public class LambdaForwarding {
case 2:
inport = 21;
outport = 11;
sbuilder.matchLambda(lambda).
sbuilder.add(Criteria.matchLambda(new IndexedLambda(lambda))).
matchInPort(PortNumber.portNumber(inport)); // match sigtype
tbuilder.setOutput(PortNumber.portNumber(outport));
break;
case 3:
inport = 30;
outport = 31;
sbuilder.matchLambda(lambda).
sbuilder.add(Criteria.matchLambda(new IndexedLambda(lambda))).
matchInPort(PortNumber.portNumber(inport));
tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda);
break;
......
......@@ -22,6 +22,7 @@ import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
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;
......@@ -300,7 +301,7 @@ public final class DefaultTrafficSelector implements TrafficSelector {
@Deprecated
@Override
public Builder matchLambda(short lambda) {
return add(Criteria.matchLambda(lambda));
return add(Criteria.matchLambda(new IndexedLambda(lambda)));
}
@Deprecated
......
......@@ -22,6 +22,7 @@ import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.flow.criteria.Criterion;
......@@ -60,12 +61,15 @@ public class DefaultTrafficSelectorTest {
final short one = 1;
final short two = 2;
final TrafficSelector selector1 =
DefaultTrafficSelector.builder().matchLambda(one).build();
final TrafficSelector sameAsSelector1 =
DefaultTrafficSelector.builder().matchLambda(one).build();
final TrafficSelector selector2 =
DefaultTrafficSelector.builder().matchLambda(two).build();
final TrafficSelector selector1 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(one)))
.build();
final TrafficSelector sameAsSelector1 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(one)))
.build();
final TrafficSelector selector2 = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(two)))
.build();
new EqualsTester()
.addEqualityGroup(selector1, sameAsSelector1)
......@@ -260,11 +264,11 @@ public class DefaultTrafficSelectorTest {
assertThat(selector, hasCriterionWithType(Type.IPV6_EXTHDR));
selector = DefaultTrafficSelector.builder()
.matchLambda(shortValue).build();
.add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
selector = DefaultTrafficSelector.builder()
.matchOpticalSignalType(shortValue).build();
.add(Criteria.matchOpticalSignalType(shortValue)).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE));
}
......@@ -277,7 +281,7 @@ public class DefaultTrafficSelectorTest {
final short shortValue = 33;
final TrafficSelector baseSelector = DefaultTrafficSelector.builder()
.matchLambda(shortValue).build();
.add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
selector = DefaultTrafficSelector.builder(baseSelector)
.build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
......