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 {
}
/**
* Represents a L0 lambda modification instruction.
*/
public static final class ModLambdaInstruction extends L0ModificationInstruction {
private final L0SubType subtype;
private final short lambda;
ModLambdaInstruction(L0SubType subType, short lambda) {
this.subtype = subType;
this.lambda = lambda;
}
@Override
public L0SubType subtype() {
return this.subtype;
}
public short lambda() {
return this.lambda;
}
@Override
public String toString() {
return subtype().toString() + SEPARATOR + lambda;
}
@Override
public int hashCode() {
return Objects.hash(type(), subtype, lambda);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ModLambdaInstruction) {
ModLambdaInstruction that = (ModLambdaInstruction) obj;
return Objects.equals(lambda, that.lambda) &&
Objects.equals(subtype, that.subtype);
}
return false;
}
}
/**
* Represents an L0 OCh (Optical Channel) modification instruction.
*/
public static final class ModOchSignalInstruction extends L0ModificationInstruction {
......
......@@ -101,7 +101,6 @@ public class InstructionsTest {
@Test
public void testImmutabilityOfInstructions() {
assertThatClassIsImmutable(Instructions.OutputInstruction.class);
assertThatClassIsImmutable(L0ModificationInstruction.ModLambdaInstruction.class);
assertThatClassIsImmutable(L0ModificationInstruction.ModOchSignalInstruction.class);
assertThatClassIsImmutable(L1ModificationInstruction.ModOduSignalIdInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class);
......
......@@ -26,7 +26,6 @@ import org.onosproject.net.flow.instructions.Instructions.MeterInstruction;
import org.onosproject.net.flow.instructions.Instructions.NoActionInstruction;
import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
......@@ -220,38 +219,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
}
/**
* Matches the contents of a mod lambda instruction.
*
* @param instructionJson JSON instruction to match
* @param description Description object used for recording errors
* @return true if contents match, false otherwise
*/
private boolean matchModLambdaInstruction(JsonNode instructionJson,
Description description) {
ModLambdaInstruction instructionToMatch =
(ModLambdaInstruction) instruction;
final String jsonSubtype = instructionJson.get("subtype").textValue();
if (!instructionToMatch.subtype().name().equals(jsonSubtype)) {
description.appendText("subtype was " + jsonSubtype);
return false;
}
final String jsonType = instructionJson.get("type").textValue();
if (!instructionToMatch.type().name().equals(jsonType)) {
description.appendText("type was " + jsonType);
return false;
}
final long jsonLambda = instructionJson.get("lambda").shortValue();
if (instructionToMatch.lambda() != jsonLambda) {
description.appendText("lambda was " + jsonLambda);
return false;
}
return true;
}
/**
* Matches the contents of a mod OCh singal instruction.
*
* @param instructionJson JSON instruction to match
......@@ -556,8 +523,6 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json
return matchMeterInstruction(jsonInstruction, description);
} else if (instruction instanceof SetQueueInstruction) {
return matchSetQueueInstruction(jsonInstruction, description);
} else if (instruction instanceof ModLambdaInstruction) {
return matchModLambdaInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOchSignalInstruction) {
return matchModOchSingalInstruction(jsonInstruction, description);
} else if (instruction instanceof ModEtherInstruction) {
......
......@@ -370,7 +370,6 @@ public final class KryoNamespaces {
Instructions.TableTypeTransition.class,
L0ModificationInstruction.class,
L0ModificationInstruction.L0SubType.class,
L0ModificationInstruction.ModLambdaInstruction.class,
L0ModificationInstruction.ModOchSignalInstruction.class,
L1ModificationInstruction.class,
L1ModificationInstruction.L1SubType.class,
......