Ray Milkey

Remove deprecated Lambda instruction builder method

Change-Id: I77dba40e174308744617e413cb517de440f1093e
...@@ -24,6 +24,7 @@ import org.onlab.packet.MacAddress; ...@@ -24,6 +24,7 @@ import org.onlab.packet.MacAddress;
24 import org.onlab.packet.MplsLabel; 24 import org.onlab.packet.MplsLabel;
25 import org.onlab.packet.VlanId; 25 import org.onlab.packet.VlanId;
26 import org.onosproject.core.GroupId; 26 import org.onosproject.core.GroupId;
27 +import org.onosproject.net.IndexedLambda;
27 import org.onosproject.net.PortNumber; 28 import org.onosproject.net.PortNumber;
28 import org.onosproject.net.flow.instructions.Instruction; 29 import org.onosproject.net.flow.instructions.Instruction;
29 import org.onosproject.net.flow.instructions.Instructions; 30 import org.onosproject.net.flow.instructions.Instructions;
...@@ -323,7 +324,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { ...@@ -323,7 +324,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
323 324
324 @Override 325 @Override
325 public Builder setLambda(short lambda) { 326 public Builder setLambda(short lambda) {
326 - return add(Instructions.modL0Lambda(lambda)); 327 + return add(Instructions.modL0Lambda(new IndexedLambda(lambda)));
327 } 328 }
328 329
329 @Override 330 @Override
......
...@@ -20,6 +20,7 @@ import org.junit.Test; ...@@ -20,6 +20,7 @@ import org.junit.Test;
20 import org.onlab.packet.IpAddress; 20 import org.onlab.packet.IpAddress;
21 import org.onlab.packet.MacAddress; 21 import org.onlab.packet.MacAddress;
22 import org.onlab.packet.VlanId; 22 import org.onlab.packet.VlanId;
23 +import org.onosproject.net.IndexedLambda;
23 import org.onosproject.net.PortNumber; 24 import org.onosproject.net.PortNumber;
24 import org.onosproject.net.flow.instructions.Instruction; 25 import org.onosproject.net.flow.instructions.Instruction;
25 import org.onosproject.net.flow.instructions.Instructions; 26 import org.onosproject.net.flow.instructions.Instructions;
...@@ -46,7 +47,7 @@ public class DefaultTrafficTreatmentTest { ...@@ -46,7 +47,7 @@ public class DefaultTrafficTreatmentTest {
46 public void testTreatmentBuilderConstructors() { 47 public void testTreatmentBuilderConstructors() {
47 final TrafficTreatment treatment1 = 48 final TrafficTreatment treatment1 =
48 DefaultTrafficTreatment.builder() 49 DefaultTrafficTreatment.builder()
49 - .add(Instructions.modL0Lambda((short) 4)) 50 + .add(Instructions.modL0Lambda(new IndexedLambda(4)))
50 .build(); 51 .build();
51 final TrafficTreatment treatment2 = 52 final TrafficTreatment treatment2 =
52 DefaultTrafficTreatment.builder(treatment1).build(); 53 DefaultTrafficTreatment.builder(treatment1).build();
...@@ -59,7 +60,7 @@ public class DefaultTrafficTreatmentTest { ...@@ -59,7 +60,7 @@ public class DefaultTrafficTreatmentTest {
59 @Test 60 @Test
60 public void testBuilderMethods() { 61 public void testBuilderMethods() {
61 final Instruction instruction1 = 62 final Instruction instruction1 =
62 - Instructions.modL0Lambda((short) 4); 63 + Instructions.modL0Lambda(new IndexedLambda(4));
63 64
64 final TrafficTreatment.Builder builder1 = 65 final TrafficTreatment.Builder builder1 =
65 DefaultTrafficTreatment.builder() 66 DefaultTrafficTreatment.builder()
...@@ -101,17 +102,19 @@ public class DefaultTrafficTreatmentTest { ...@@ -101,17 +102,19 @@ public class DefaultTrafficTreatmentTest {
101 */ 102 */
102 @Test 103 @Test
103 public void testEquals() { 104 public void testEquals() {
105 + final IndexedLambda lambda1 = new IndexedLambda(4);
106 + final IndexedLambda lambda2 = new IndexedLambda(5);
104 final TrafficTreatment treatment1 = 107 final TrafficTreatment treatment1 =
105 DefaultTrafficTreatment.builder() 108 DefaultTrafficTreatment.builder()
106 - .add(Instructions.modL0Lambda((short) 4)) 109 + .add(Instructions.modL0Lambda(lambda1))
107 - .build(); 110 + .build();
108 final TrafficTreatment sameAsTreatment1 = 111 final TrafficTreatment sameAsTreatment1 =
109 DefaultTrafficTreatment.builder() 112 DefaultTrafficTreatment.builder()
110 - .add(Instructions.modL0Lambda((short) 4)) 113 + .add(Instructions.modL0Lambda(lambda1))
111 .build(); 114 .build();
112 final TrafficTreatment treatment2 = 115 final TrafficTreatment treatment2 =
113 DefaultTrafficTreatment.builder() 116 DefaultTrafficTreatment.builder()
114 - .add(Instructions.modL0Lambda((short) 2)) 117 + .add(Instructions.modL0Lambda(lambda2))
115 .build(); 118 .build();
116 new EqualsTester() 119 new EqualsTester()
117 .addEqualityGroup(treatment1, sameAsTreatment1) 120 .addEqualityGroup(treatment1, sameAsTreatment1)
......
...@@ -18,6 +18,7 @@ package org.onosproject.net.flow.instructions; ...@@ -18,6 +18,7 @@ package org.onosproject.net.flow.instructions;
18 import org.junit.Test; 18 import org.junit.Test;
19 import org.onosproject.net.ChannelSpacing; 19 import org.onosproject.net.ChannelSpacing;
20 import org.onosproject.net.GridType; 20 import org.onosproject.net.GridType;
21 +import org.onosproject.net.IndexedLambda;
21 import org.onosproject.net.Lambda; 22 import org.onosproject.net.Lambda;
22 import org.onosproject.net.PortNumber; 23 import org.onosproject.net.PortNumber;
23 import org.onlab.packet.IpAddress; 24 import org.onlab.packet.IpAddress;
...@@ -180,8 +181,8 @@ public class InstructionsTest { ...@@ -180,8 +181,8 @@ public class InstructionsTest {
180 181
181 // ModLambdaInstruction 182 // ModLambdaInstruction
182 183
183 - private final short lambda1 = 1; 184 + private final IndexedLambda lambda1 = new IndexedLambda(1);
184 - private final short lambda2 = 2; 185 + private final IndexedLambda lambda2 = new IndexedLambda(2);
185 private final Instruction lambdaInstruction1 = Instructions.modL0Lambda(lambda1); 186 private final Instruction lambdaInstruction1 = Instructions.modL0Lambda(lambda1);
186 private final Instruction sameAsLambdaInstruction1 = Instructions.modL0Lambda(lambda1); 187 private final Instruction sameAsLambdaInstruction1 = Instructions.modL0Lambda(lambda1);
187 private final Instruction lambdaInstruction2 = Instructions.modL0Lambda(lambda2); 188 private final Instruction lambdaInstruction2 = Instructions.modL0Lambda(lambda2);
...@@ -196,7 +197,7 @@ public class InstructionsTest { ...@@ -196,7 +197,7 @@ public class InstructionsTest {
196 checkAndConvert(instruction, 197 checkAndConvert(instruction,
197 Instruction.Type.L0MODIFICATION, 198 Instruction.Type.L0MODIFICATION,
198 L0ModificationInstruction.ModLambdaInstruction.class); 199 L0ModificationInstruction.ModLambdaInstruction.class);
199 - assertThat(lambdaInstruction.lambda(), is(equalTo(lambda1))); 200 + assertThat(lambdaInstruction.lambda(), is(equalTo((short) lambda1.index())));
200 } 201 }
201 202
202 /** 203 /**
......
...@@ -26,6 +26,7 @@ import org.onosproject.codec.CodecContext; ...@@ -26,6 +26,7 @@ import org.onosproject.codec.CodecContext;
26 import org.onosproject.codec.JsonCodec; 26 import org.onosproject.codec.JsonCodec;
27 import org.onosproject.net.ChannelSpacing; 27 import org.onosproject.net.ChannelSpacing;
28 import org.onosproject.net.GridType; 28 import org.onosproject.net.GridType;
29 +import org.onosproject.net.IndexedLambda;
29 import org.onosproject.net.Lambda; 30 import org.onosproject.net.Lambda;
30 import org.onosproject.net.PortNumber; 31 import org.onosproject.net.PortNumber;
31 import org.onosproject.net.flow.instructions.Instruction; 32 import org.onosproject.net.flow.instructions.Instruction;
...@@ -101,7 +102,7 @@ public class InstructionCodecTest { ...@@ -101,7 +102,7 @@ public class InstructionCodecTest {
101 public void modLambdaInstructionTest() { 102 public void modLambdaInstructionTest() {
102 final L0ModificationInstruction.ModLambdaInstruction instruction = 103 final L0ModificationInstruction.ModLambdaInstruction instruction =
103 (L0ModificationInstruction.ModLambdaInstruction) 104 (L0ModificationInstruction.ModLambdaInstruction)
104 - Instructions.modL0Lambda((short) 55); 105 + Instructions.modL0Lambda(new IndexedLambda(55));
105 final ObjectNode instructionJson = 106 final ObjectNode instructionJson =
106 instructionCodec.encode(instruction, context); 107 instructionCodec.encode(instruction, context);
107 assertThat(instructionJson, matchesInstruction(instruction)); 108 assertThat(instructionJson, matchesInstruction(instruction));
......