Ray Milkey

Remove deprecated Lambda instruction builder method

Change-Id: I77dba40e174308744617e413cb517de440f1093e
......@@ -24,6 +24,7 @@ import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import org.onosproject.core.GroupId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
......@@ -323,7 +324,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
@Override
public Builder setLambda(short lambda) {
return add(Instructions.modL0Lambda(lambda));
return add(Instructions.modL0Lambda(new IndexedLambda(lambda)));
}
@Override
......
......@@ -20,6 +20,7 @@ import org.junit.Test;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
......@@ -46,7 +47,7 @@ public class DefaultTrafficTreatmentTest {
public void testTreatmentBuilderConstructors() {
final TrafficTreatment treatment1 =
DefaultTrafficTreatment.builder()
.add(Instructions.modL0Lambda((short) 4))
.add(Instructions.modL0Lambda(new IndexedLambda(4)))
.build();
final TrafficTreatment treatment2 =
DefaultTrafficTreatment.builder(treatment1).build();
......@@ -59,7 +60,7 @@ public class DefaultTrafficTreatmentTest {
@Test
public void testBuilderMethods() {
final Instruction instruction1 =
Instructions.modL0Lambda((short) 4);
Instructions.modL0Lambda(new IndexedLambda(4));
final TrafficTreatment.Builder builder1 =
DefaultTrafficTreatment.builder()
......@@ -101,17 +102,19 @@ public class DefaultTrafficTreatmentTest {
*/
@Test
public void testEquals() {
final IndexedLambda lambda1 = new IndexedLambda(4);
final IndexedLambda lambda2 = new IndexedLambda(5);
final TrafficTreatment treatment1 =
DefaultTrafficTreatment.builder()
.add(Instructions.modL0Lambda((short) 4))
.add(Instructions.modL0Lambda(lambda1))
.build();
final TrafficTreatment sameAsTreatment1 =
DefaultTrafficTreatment.builder()
.add(Instructions.modL0Lambda((short) 4))
.add(Instructions.modL0Lambda(lambda1))
.build();
final TrafficTreatment treatment2 =
DefaultTrafficTreatment.builder()
.add(Instructions.modL0Lambda((short) 2))
.add(Instructions.modL0Lambda(lambda2))
.build();
new EqualsTester()
.addEqualityGroup(treatment1, sameAsTreatment1)
......
......@@ -18,6 +18,7 @@ package org.onosproject.net.flow.instructions;
import org.junit.Test;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.GridType;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.PortNumber;
import org.onlab.packet.IpAddress;
......@@ -180,8 +181,8 @@ public class InstructionsTest {
// ModLambdaInstruction
private final short lambda1 = 1;
private final short lambda2 = 2;
private final IndexedLambda lambda1 = new IndexedLambda(1);
private final IndexedLambda lambda2 = new IndexedLambda(2);
private final Instruction lambdaInstruction1 = Instructions.modL0Lambda(lambda1);
private final Instruction sameAsLambdaInstruction1 = Instructions.modL0Lambda(lambda1);
private final Instruction lambdaInstruction2 = Instructions.modL0Lambda(lambda2);
......@@ -196,7 +197,7 @@ public class InstructionsTest {
checkAndConvert(instruction,
Instruction.Type.L0MODIFICATION,
L0ModificationInstruction.ModLambdaInstruction.class);
assertThat(lambdaInstruction.lambda(), is(equalTo(lambda1)));
assertThat(lambdaInstruction.lambda(), is(equalTo((short) lambda1.index())));
}
/**
......
......@@ -26,6 +26,7 @@ import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.GridType;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.instructions.Instruction;
......@@ -101,7 +102,7 @@ public class InstructionCodecTest {
public void modLambdaInstructionTest() {
final L0ModificationInstruction.ModLambdaInstruction instruction =
(L0ModificationInstruction.ModLambdaInstruction)
Instructions.modL0Lambda((short) 55);
Instructions.modL0Lambda(new IndexedLambda(55));
final ObjectNode instructionJson =
instructionCodec.encode(instruction, context);
assertThat(instructionJson, matchesInstruction(instruction));
......