Sho SHIMIZU
Committed by Gerrit Code Review

Remove ModLambdaInstruction because we don't use indexed lambda

Change-Id: I6b9ec8f4bd4a6620ee87c11d1787a8f0c0c7fa7a
...@@ -41,52 +41,6 @@ public abstract class L0ModificationInstruction implements Instruction { ...@@ -41,52 +41,6 @@ public abstract class L0ModificationInstruction implements Instruction {
41 } 41 }
42 42
43 /** 43 /**
44 - * Represents a L0 lambda modification instruction.
45 - */
46 - public static final class ModLambdaInstruction extends L0ModificationInstruction {
47 -
48 - private final L0SubType subtype;
49 - private final short lambda;
50 -
51 - ModLambdaInstruction(L0SubType subType, short lambda) {
52 - this.subtype = subType;
53 - this.lambda = lambda;
54 - }
55 -
56 - @Override
57 - public L0SubType subtype() {
58 - return this.subtype;
59 - }
60 -
61 - public short lambda() {
62 - return this.lambda;
63 - }
64 -
65 - @Override
66 - public String toString() {
67 - return subtype().toString() + SEPARATOR + lambda;
68 - }
69 -
70 - @Override
71 - public int hashCode() {
72 - return Objects.hash(type(), subtype, lambda);
73 - }
74 -
75 - @Override
76 - public boolean equals(Object obj) {
77 - if (this == obj) {
78 - return true;
79 - }
80 - if (obj instanceof ModLambdaInstruction) {
81 - ModLambdaInstruction that = (ModLambdaInstruction) obj;
82 - return Objects.equals(lambda, that.lambda) &&
83 - Objects.equals(subtype, that.subtype);
84 - }
85 - return false;
86 - }
87 - }
88 -
89 - /**
90 * Represents an L0 OCh (Optical Channel) modification instruction. 44 * Represents an L0 OCh (Optical Channel) modification instruction.
91 */ 45 */
92 public static final class ModOchSignalInstruction extends L0ModificationInstruction { 46 public static final class ModOchSignalInstruction extends L0ModificationInstruction {
......
...@@ -101,7 +101,6 @@ public class InstructionsTest { ...@@ -101,7 +101,6 @@ public class InstructionsTest {
101 @Test 101 @Test
102 public void testImmutabilityOfInstructions() { 102 public void testImmutabilityOfInstructions() {
103 assertThatClassIsImmutable(Instructions.OutputInstruction.class); 103 assertThatClassIsImmutable(Instructions.OutputInstruction.class);
104 - assertThatClassIsImmutable(L0ModificationInstruction.ModLambdaInstruction.class);
105 assertThatClassIsImmutable(L0ModificationInstruction.ModOchSignalInstruction.class); 104 assertThatClassIsImmutable(L0ModificationInstruction.ModOchSignalInstruction.class);
106 assertThatClassIsImmutable(L1ModificationInstruction.ModOduSignalIdInstruction.class); 105 assertThatClassIsImmutable(L1ModificationInstruction.ModOduSignalIdInstruction.class);
107 assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class); 106 assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class);
......
...@@ -26,7 +26,6 @@ import org.onosproject.net.flow.instructions.Instructions.MeterInstruction; ...@@ -26,7 +26,6 @@ import org.onosproject.net.flow.instructions.Instructions.MeterInstruction;
26 import org.onosproject.net.flow.instructions.Instructions.NoActionInstruction; 26 import org.onosproject.net.flow.instructions.Instructions.NoActionInstruction;
27 import org.onosproject.net.flow.instructions.Instructions.OutputInstruction; 27 import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
28 import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction; 28 import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction;
29 -import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
30 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction; 29 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
31 import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction; 30 import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
32 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction; 31 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
...@@ -220,38 +219,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json ...@@ -220,38 +219,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
220 } 219 }
221 220
222 /** 221 /**
223 - * Matches the contents of a mod lambda instruction.
224 - *
225 - * @param instructionJson JSON instruction to match
226 - * @param description Description object used for recording errors
227 - * @return true if contents match, false otherwise
228 - */
229 - private boolean matchModLambdaInstruction(JsonNode instructionJson,
230 - Description description) {
231 - ModLambdaInstruction instructionToMatch =
232 - (ModLambdaInstruction) instruction;
233 - final String jsonSubtype = instructionJson.get("subtype").textValue();
234 - if (!instructionToMatch.subtype().name().equals(jsonSubtype)) {
235 - description.appendText("subtype was " + jsonSubtype);
236 - return false;
237 - }
238 -
239 - final String jsonType = instructionJson.get("type").textValue();
240 - if (!instructionToMatch.type().name().equals(jsonType)) {
241 - description.appendText("type was " + jsonType);
242 - return false;
243 - }
244 -
245 - final long jsonLambda = instructionJson.get("lambda").shortValue();
246 - if (instructionToMatch.lambda() != jsonLambda) {
247 - description.appendText("lambda was " + jsonLambda);
248 - return false;
249 - }
250 -
251 - return true;
252 - }
253 -
254 - /**
255 * Matches the contents of a mod OCh singal instruction. 222 * Matches the contents of a mod OCh singal instruction.
256 * 223 *
257 * @param instructionJson JSON instruction to match 224 * @param instructionJson JSON instruction to match
...@@ -556,8 +523,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json ...@@ -556,8 +523,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
556 return matchMeterInstruction(jsonInstruction, description); 523 return matchMeterInstruction(jsonInstruction, description);
557 } else if (instruction instanceof SetQueueInstruction) { 524 } else if (instruction instanceof SetQueueInstruction) {
558 return matchSetQueueInstruction(jsonInstruction, description); 525 return matchSetQueueInstruction(jsonInstruction, description);
559 - } else if (instruction instanceof ModLambdaInstruction) {
560 - return matchModLambdaInstruction(jsonInstruction, description);
561 } else if (instruction instanceof ModOchSignalInstruction) { 526 } else if (instruction instanceof ModOchSignalInstruction) {
562 return matchModOchSingalInstruction(jsonInstruction, description); 527 return matchModOchSingalInstruction(jsonInstruction, description);
563 } else if (instruction instanceof ModEtherInstruction) { 528 } else if (instruction instanceof ModEtherInstruction) {
......
...@@ -370,7 +370,6 @@ public final class KryoNamespaces { ...@@ -370,7 +370,6 @@ public final class KryoNamespaces {
370 Instructions.TableTypeTransition.class, 370 Instructions.TableTypeTransition.class,
371 L0ModificationInstruction.class, 371 L0ModificationInstruction.class,
372 L0ModificationInstruction.L0SubType.class, 372 L0ModificationInstruction.L0SubType.class,
373 - L0ModificationInstruction.ModLambdaInstruction.class,
374 L0ModificationInstruction.ModOchSignalInstruction.class, 373 L0ModificationInstruction.ModOchSignalInstruction.class,
375 L1ModificationInstruction.class, 374 L1ModificationInstruction.class,
376 L1ModificationInstruction.L1SubType.class, 375 L1ModificationInstruction.L1SubType.class,
......