Sho SHIMIZU

Remove method Lambda.indexedLambda() deprecated in Emu

Change-Id: Ie5a50d9d3df7b4af7af2d42edef3a63d622a721c
......@@ -29,8 +29,6 @@ public class IndexedLambda implements Lambda {
/**
* Creates an instance representing the wavelength specified by the given index number.
* It is recommended to use {@link Lambda#indexedLambda(long)} unless you want to use the
* concrete type, IndexedLambda, directly.
*
* @param index index number of wavelength
*/
......
......@@ -20,19 +20,6 @@ package org.onosproject.net;
*/
public interface Lambda {
/**
* Create an Lambda instance with the specified wavelength index number.
*
* @param lambda index number
* @return an instance
*
* @deprecated in Emu (1.4.0)
*/
@Deprecated
static Lambda indexedLambda(long lambda) {
return new IndexedLambda(lambda);
}
/**
* Creates a Lambda instance with the specified arguments.
*
* @param gridType grid type
......
/*
* 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.testing.EqualsTester;
import org.junit.Test;
/**
* Test for IndexedLambda.
*/
public class IndexedLambdaTest {
/**
* Tests equality of IndexedLambda instances.
*/
@Test
public void testEquality() {
new EqualsTester()
.addEqualityGroup(Lambda.indexedLambda(10), Lambda.indexedLambda(10))
.addEqualityGroup(Lambda.indexedLambda(11), Lambda.indexedLambda(11), Lambda.indexedLambda(11))
.testEquals();
}
}
......@@ -422,29 +422,23 @@ public final class DecodeCriterionCodecHelper {
private class OchSigIdDecoder implements CriterionDecoder {
@Override
public Criterion decodeCriterion(ObjectNode json) {
if (json.get(CriterionCodec.LAMBDA) != null) {
Lambda lambda = Lambda.indexedLambda(nullIsIllegal(json.get(CriterionCodec.LAMBDA),
CriterionCodec.LAMBDA + MISSING_MEMBER_MESSAGE).asInt());
return Criteria.matchLambda(lambda);
} else {
JsonNode ochSignalId = nullIsIllegal(json.get(CriterionCodec.OCH_SIGNAL_ID),
CriterionCodec.GRID_TYPE + MISSING_MEMBER_MESSAGE);
GridType gridType =
GridType.valueOf(
nullIsIllegal(ochSignalId.get(CriterionCodec.GRID_TYPE),
CriterionCodec.GRID_TYPE + MISSING_MEMBER_MESSAGE).asText());
ChannelSpacing channelSpacing =
ChannelSpacing.valueOf(
nullIsIllegal(ochSignalId.get(CriterionCodec.CHANNEL_SPACING),
CriterionCodec.CHANNEL_SPACING + MISSING_MEMBER_MESSAGE).asText());
int spacingMultiplier = nullIsIllegal(ochSignalId.get(CriterionCodec.SPACING_MULIPLIER),
CriterionCodec.SPACING_MULIPLIER + MISSING_MEMBER_MESSAGE).asInt();
int slotGranularity = nullIsIllegal(ochSignalId.get(CriterionCodec.SLOT_GRANULARITY),
CriterionCodec.SLOT_GRANULARITY + MISSING_MEMBER_MESSAGE).asInt();
return Criteria.matchLambda(
Lambda.ochSignal(gridType, channelSpacing,
spacingMultiplier, slotGranularity));
}
JsonNode ochSignalId = nullIsIllegal(json.get(CriterionCodec.OCH_SIGNAL_ID),
CriterionCodec.GRID_TYPE + MISSING_MEMBER_MESSAGE);
GridType gridType =
GridType.valueOf(
nullIsIllegal(ochSignalId.get(CriterionCodec.GRID_TYPE),
CriterionCodec.GRID_TYPE + MISSING_MEMBER_MESSAGE).asText());
ChannelSpacing channelSpacing =
ChannelSpacing.valueOf(
nullIsIllegal(ochSignalId.get(CriterionCodec.CHANNEL_SPACING),
CriterionCodec.CHANNEL_SPACING + MISSING_MEMBER_MESSAGE).asText());
int spacingMultiplier = nullIsIllegal(ochSignalId.get(CriterionCodec.SPACING_MULIPLIER),
CriterionCodec.SPACING_MULIPLIER + MISSING_MEMBER_MESSAGE).asInt();
int slotGranularity = nullIsIllegal(ochSignalId.get(CriterionCodec.SLOT_GRANULARITY),
CriterionCodec.SLOT_GRANULARITY + MISSING_MEMBER_MESSAGE).asInt();
return Criteria.matchLambda(
Lambda.ochSignal(gridType, channelSpacing,
spacingMultiplier, slotGranularity));
}
}
......
......@@ -26,7 +26,6 @@ import org.onosproject.core.DefaultGroupId;
import org.onosproject.core.GroupId;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.GridType;
import org.onosproject.net.Lambda;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
......@@ -147,12 +146,7 @@ public final class DecodeInstructionCodecHelper {
private Instruction decodeL0() {
String subType = json.get(InstructionCodec.SUBTYPE).asText();
if (subType.equals(L0ModificationInstruction.L0SubType.LAMBDA.name())) {
int lambda = nullIsIllegal(json.get(InstructionCodec.LAMBDA),
InstructionCodec.LAMBDA + InstructionCodec.MISSING_MEMBER_MESSAGE).asInt();
return Instructions.modL0Lambda(Lambda.indexedLambda(lambda));
} else if (subType.equals(L0ModificationInstruction.L0SubType.OCH.name())) {
if (subType.equals(L0ModificationInstruction.L0SubType.OCH.name())) {
String gridTypeString = nullIsIllegal(json.get(InstructionCodec.GRID_TYPE),
InstructionCodec.GRID_TYPE + InstructionCodec.MISSING_MEMBER_MESSAGE).asText();
GridType gridType = GridType.valueOf(gridTypeString);
......
......@@ -214,7 +214,7 @@ public class FlowRuleCodecTest {
instruction.type().name() + "/" + subType, instruction);
});
assertThat(rule.treatment().allInstructions().size(), is(24));
assertThat(rule.treatment().allInstructions().size(), is(23));
Instruction instruction;
......@@ -320,13 +320,6 @@ public class FlowRuleCodecTest {
is(8));
instruction = getInstruction(Instruction.Type.L0MODIFICATION,
L0ModificationInstruction.L0SubType.LAMBDA.name());
assertThat(instruction.type(), is(Instruction.Type.L0MODIFICATION));
assertThat(((L0ModificationInstruction.ModLambdaInstruction) instruction)
.lambda(),
is((short) 7));
instruction = getInstruction(Instruction.Type.L0MODIFICATION,
L0ModificationInstruction.L0SubType.OCH.name());
assertThat(instruction.type(), is(Instruction.Type.L0MODIFICATION));
L0ModificationInstruction.ModOchSignalInstruction och =
......
......@@ -26,7 +26,6 @@
{"type":"L3MODIFICATION","subtype":"IPV6_SRC", "ip":"1.2.3.2"},
{"type":"L3MODIFICATION","subtype":"IPV6_DST", "ip":"1.2.3.1"},
{"type":"L3MODIFICATION","subtype":"IPV6_FLABEL", "flowLabel":8},
{"type":"L0MODIFICATION","subtype":"LAMBDA","lambda":7},
{"type":"L0MODIFICATION","subtype":"OCH","gridType":"DWDM",
"channelSpacing":"CHL_100GHZ","spacingMultiplier":4,"slotGranularity":8},
{"type":"L4MODIFICATION","subtype":"TCP_DST","tcpPort":40001},
......
......@@ -344,11 +344,6 @@ public class KryoSerializerTest {
}
@Test
public void testIndexedLambda() {
testSerializedEquals(org.onosproject.net.Lambda.indexedLambda(10L));
}
@Test
public void testOchSignal() {
testSerializedEquals(org.onosproject.net.Lambda.ochSignal(
GridType.DWDM, ChannelSpacing.CHL_100GHZ, 1, 1
......
......@@ -25,7 +25,6 @@ import org.onlab.packet.VlanId;
import org.onosproject.core.DefaultGroupId;
import org.onosproject.core.GroupId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Lambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.driver.DefaultDriverData;
import org.onosproject.net.driver.DefaultDriverHandler;
......@@ -34,7 +33,6 @@ import org.onosproject.net.driver.DriverHandler;
import org.onosproject.net.driver.DriverService;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.group.DefaultGroupBucket;
import org.onosproject.net.group.GroupBucket;
import org.onosproject.net.group.GroupBuckets;
......@@ -43,7 +41,6 @@ import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
import org.projectfloodlight.openflow.protocol.OFBucket;
import org.projectfloodlight.openflow.protocol.OFGroupType;
import org.projectfloodlight.openflow.protocol.action.OFAction;
import org.projectfloodlight.openflow.protocol.action.OFActionCircuit;
import org.projectfloodlight.openflow.protocol.action.OFActionCopyTtlIn;
import org.projectfloodlight.openflow.protocol.action.OFActionCopyTtlOut;
import org.projectfloodlight.openflow.protocol.action.OFActionDecMplsTtl;
......@@ -61,7 +58,6 @@ import org.projectfloodlight.openflow.protocol.action.OFActionSetNwSrc;
import org.projectfloodlight.openflow.protocol.action.OFActionSetVlanPcp;
import org.projectfloodlight.openflow.protocol.action.OFActionSetVlanVid;
import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic;
import org.projectfloodlight.openflow.types.IPv4Address;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.U32;
......@@ -199,14 +195,7 @@ public class GroupBucketEntryBuilder {
break;
case EXPERIMENTER:
OFActionExperimenter exp = (OFActionExperimenter) act;
if (exp.getExperimenter() == 0x80005A06 ||
exp.getExperimenter() == 0x748771) {
OFActionCircuit ct = (OFActionCircuit) exp;
short lambda = ((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber();
builder.add(Instructions.modL0Lambda(Lambda.indexedLambda(lambda)));
} else {
log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter());
}
log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter());
break;
case SET_FIELD:
OFActionSetField setField = (OFActionSetField) act;
......