Remove IndexedLambda deprecated in Emu
Change-Id: I3dc3ea90049dd3331090472f8c4a0e83d430ba37
diff --git a/core/api/src/main/java/org/onosproject/net/IndexedLambda.java b/core/api/src/main/java/org/onosproject/net/IndexedLambda.java
deleted file mode 100644
index 4dc5a79..0000000
--- a/core/api/src/main/java/org/onosproject/net/IndexedLambda.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Implementation of Lambda simply designated by an index number of wavelength.
- *
- * @deprecated in Emu (ONOS 1.4).
- */
-@Deprecated
-public class IndexedLambda implements Lambda {
-
- private final long index;
-
- /**
- * Creates an instance representing the wavelength specified by the given index number.
- *
- * @param index index number of wavelength
- */
- public IndexedLambda(long index) {
- this.index = index;
- }
-
- /**
- * Returns the index number of lambda.
- *
- * @return the index number of lambda
- */
- public long index() {
- return index;
- }
-
- @Override
- public int hashCode() {
- return Long.hashCode(index);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof IndexedLambda)) {
- return false;
- }
-
- final IndexedLambda that = (IndexedLambda) obj;
- return this.index == that.index;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("lambda", index)
- .toString();
- }
-}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 3e2335b..91b094a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -24,13 +24,10 @@
import org.onlab.packet.VlanId;
import org.onosproject.core.GroupId;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.instructions.L0ModificationInstruction.L0SubType;
-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.L3ModificationInstruction.L3SubType;
@@ -123,9 +120,7 @@
public static L0ModificationInstruction modL0Lambda(Lambda lambda) {
checkNotNull(lambda, "L0 OCh signal cannot be null");
- if (lambda instanceof IndexedLambda) {
- return new ModLambdaInstruction(L0SubType.LAMBDA, (short) ((IndexedLambda) lambda).index());
- } else if (lambda instanceof OchSignal) {
+ if (lambda instanceof OchSignal) {
return new ModOchSignalInstruction((OchSignal) lambda);
} else {
throw new UnsupportedOperationException(String.format("Unsupported type: %s", lambda));
diff --git a/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficTreatmentTest.java b/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficTreatmentTest.java
index 288f5f2..6a6c600 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficTreatmentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficTreatmentTest.java
@@ -15,22 +15,17 @@
*/
package org.onosproject.net.flow;
-import com.google.common.testing.EqualsTester;
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;
import java.util.List;
-import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.is;
/**
* Unit tests for the DefaultTrafficTreatment class.
@@ -40,36 +35,16 @@
// Tests for the nested Builder class
/**
- * Tests that the Builder constructors return equivalent objects
- * when given the same data.
- */
- @Test
- public void testTreatmentBuilderConstructors() {
- final TrafficTreatment treatment1 =
- DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(new IndexedLambda(4)))
- .build();
- final TrafficTreatment treatment2 =
- DefaultTrafficTreatment.builder(treatment1).build();
- assertThat(treatment1, is(equalTo(treatment2)));
- }
-
- /**
* Tests methods defined on the Builder.
*/
@Test
public void testBuilderMethods() {
- final Instruction instruction1 =
- Instructions.modL0Lambda(new IndexedLambda(4));
-
final TrafficTreatment.Builder builder1 =
DefaultTrafficTreatment.builder()
- .add(instruction1)
.setEthDst(MacAddress.BROADCAST)
.setEthSrc(MacAddress.BROADCAST)
.setIpDst(IpAddress.valueOf("1.1.1.1"))
.setIpSrc(IpAddress.valueOf("2.2.2.2"))
- .add(Instructions.modL0Lambda(new IndexedLambda(4)))
.setOutput(PortNumber.portNumber(2))
.setVlanId(VlanId.vlanId((short) 4))
.setVlanPcp((byte) 3);
@@ -77,13 +52,12 @@
final TrafficTreatment treatment1 = builder1.build();
final List<Instruction> instructions1 = treatment1.immediate();
- assertThat(instructions1, hasSize(9));
+ assertThat(instructions1, hasSize(7));
builder1.drop();
- builder1.add(instruction1);
final List<Instruction> instructions2 = builder1.build().immediate();
- assertThat(instructions2, hasSize(11));
+ assertThat(instructions2, hasSize(8));
builder1.deferred()
.popVlan()
@@ -91,34 +65,8 @@
.setVlanId(VlanId.vlanId((short) 5));
final List<Instruction> instructions3 = builder1.build().immediate();
- assertThat(instructions3, hasSize(11));
+ assertThat(instructions3, hasSize(8));
final List<Instruction> instructions4 = builder1.build().deferred();
assertThat(instructions4, hasSize(3));
}
-
- /**
- * Tests equals(), hashCode() and toString() methods of
- * DefaultTrafficTreatment.
- */
- @Test
- public void testEquals() {
- final IndexedLambda lambda1 = new IndexedLambda(4);
- final IndexedLambda lambda2 = new IndexedLambda(5);
- final TrafficTreatment treatment1 =
- DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(lambda1))
- .build();
- final TrafficTreatment sameAsTreatment1 =
- DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(lambda1))
- .build();
- final TrafficTreatment treatment2 =
- DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(lambda2))
- .build();
- new EqualsTester()
- .addEqualityGroup(treatment1, sameAsTreatment1)
- .addEqualityGroup(treatment2)
- .testEquals();
- }
}
diff --git a/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java b/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
index 591a73b..965a8cd 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
@@ -29,7 +29,6 @@
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.DeviceId;
import org.onosproject.net.GridType;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
@@ -197,48 +196,6 @@
// ModLambdaInstruction
- 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);
-
- /**
- * Test the modL0Lambda method.
- */
- @Test
- public void testCreateLambdaMethod() {
- final Instruction instruction = Instructions.modL0Lambda(lambda1);
- final L0ModificationInstruction.ModLambdaInstruction lambdaInstruction =
- checkAndConvert(instruction,
- Instruction.Type.L0MODIFICATION,
- L0ModificationInstruction.ModLambdaInstruction.class);
- assertThat(lambdaInstruction.lambda(), is(equalTo((short) lambda1.index())));
- }
-
- /**
- * Test the equals() method of the ModLambdaInstruction class.
- */
-
- @Test
- public void testModLambdaInstructionEquals() throws Exception {
- checkEqualsAndToString(lambdaInstruction1,
- sameAsLambdaInstruction1,
- lambdaInstruction2);
- }
-
- /**
- * Test the hashCode() method of the ModLambdaInstruction class.
- */
-
- @Test
- public void testModLambdaInstructionHashCode() {
- assertThat(lambdaInstruction1.hashCode(),
- is(equalTo(sameAsLambdaInstruction1.hashCode())));
- assertThat(lambdaInstruction1.hashCode(),
- is(not(equalTo(lambdaInstruction2.hashCode()))));
- }
-
private final Lambda och1 = Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
private final Lambda och2 = Lambda.ochSignal(GridType.CWDM, ChannelSpacing.CHL_100GHZ, 4, 8);
private final Instruction ochInstruction1 = Instructions.modL0Lambda(och1);
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
index 1b7a501..9472e1d 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
@@ -30,7 +30,6 @@
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.OduSignalId;
import org.onosproject.net.PortNumber;
@@ -85,19 +84,6 @@
}
/**
- * Tests the encoding of mod lambda instructions.
- */
- @Test
- public void modLambdaInstructionTest() {
- final L0ModificationInstruction.ModLambdaInstruction instruction =
- (L0ModificationInstruction.ModLambdaInstruction)
- Instructions.modL0Lambda(new IndexedLambda(55));
- final ObjectNode instructionJson =
- instructionCodec.encode(instruction, context);
- assertThat(instructionJson, matchesInstruction(instruction));
- }
-
- /**
* Tests the encoding of mod OCh signal instructions.
*/
@Test
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
index f16f272d..af1db6e 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
@@ -35,7 +35,6 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.GridType;
import org.onosproject.net.HostId;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.NetTestTools;
import org.onosproject.net.OchSignalType;
@@ -45,7 +44,6 @@
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.criteria.EthCriterion;
import org.onosproject.net.flow.instructions.Instruction;
@@ -170,7 +168,6 @@
.matchIPDst(IpPrefix.valueOf("1.2.3.4/24"))
.build();
final TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(new IndexedLambda(33)))
.setMpls(MplsLabel.mplsLabel(44))
.setOutput(PortNumber.CONTROLLER)
.setEthDst(MacAddress.BROADCAST)
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 7c556cd..e57fd75 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -67,7 +67,6 @@
import org.onosproject.net.GridType;
import org.onosproject.net.HostId;
import org.onosproject.net.HostLocation;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Link;
import org.onosproject.net.LinkKey;
import org.onosproject.net.OchPort;
@@ -485,7 +484,6 @@
.register(ChannelSpacing.class)
.register(OduCltPort.class)
.register(CltSignalType.class)
- .register(IndexedLambda.class)
.register(OchSignal.class)
.register(OduSignalId.class)
.register(OduCltPortDescription.class)
diff --git a/web/api/src/test/java/org/onosproject/rest/resources/FlowsResourceTest.java b/web/api/src/test/java/org/onosproject/rest/resources/FlowsResourceTest.java
index 5d9231d..a13f9ac 100644
--- a/web/api/src/test/java/org/onosproject/rest/resources/FlowsResourceTest.java
+++ b/web/api/src/test/java/org/onosproject/rest/resources/FlowsResourceTest.java
@@ -38,7 +38,6 @@
import org.onosproject.net.DefaultDevice;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.NetTestTools;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -52,7 +51,6 @@
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.instructions.Instruction;
-import org.onosproject.net.flow.instructions.Instructions;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.Entity;
@@ -225,8 +223,6 @@
*/
private void setupMockFlows() {
flow2.treatment = DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(new IndexedLambda((short) 4)))
- .add(Instructions.modL0Lambda(new IndexedLambda((short) 5)))
.setEthDst(MacAddress.BROADCAST)
.build();
flow2.selector = DefaultTrafficSelector.builder()
@@ -234,7 +230,6 @@
.matchIPProtocol((byte) 9)
.build();
flow4.treatment = DefaultTrafficTreatment.builder()
- .add(Instructions.modL0Lambda(new IndexedLambda((short) 6)))
.build();
final Set<FlowEntry> flows1 = new HashSet<>();
flows1.add(flow1);