Committed by
Gerrit Code Review
Make TrafficTreatment.Builder.setLambda() deprecated
It is recommended to avoid to use a raw integer value to specify a lambda. Replace uses of the deprecated method with the alternative Change-Id: I108f0d15f4503df2a6a75c4f7c77aa0c678ff541
Showing
7 changed files
with
19 additions
and
6 deletions
... | @@ -41,6 +41,7 @@ import org.onosproject.net.flow.FlowRuleService; | ... | @@ -41,6 +41,7 @@ import org.onosproject.net.flow.FlowRuleService; |
41 | import org.onosproject.net.flow.TrafficSelector; | 41 | import org.onosproject.net.flow.TrafficSelector; |
42 | import org.onosproject.net.flow.TrafficTreatment; | 42 | import org.onosproject.net.flow.TrafficTreatment; |
43 | import org.onosproject.net.flow.criteria.Criteria; | 43 | import org.onosproject.net.flow.criteria.Criteria; |
44 | +import org.onosproject.net.flow.instructions.Instructions; | ||
44 | import org.slf4j.Logger; | 45 | import org.slf4j.Logger; |
45 | 46 | ||
46 | /** | 47 | /** |
... | @@ -110,7 +111,8 @@ public class LambdaForwarding { | ... | @@ -110,7 +111,8 @@ public class LambdaForwarding { |
110 | inport = 10; | 111 | inport = 10; |
111 | outport = 20; | 112 | outport = 20; |
112 | sbuilder.matchInPort(PortNumber.portNumber(inport)); | 113 | sbuilder.matchInPort(PortNumber.portNumber(inport)); |
113 | - tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda); | 114 | + tbuilder.setOutput(PortNumber.portNumber(outport)) |
115 | + .add(Instructions.modL0Lambda(new IndexedLambda(lambda))); | ||
114 | break; | 116 | break; |
115 | case 2: | 117 | case 2: |
116 | inport = 21; | 118 | inport = 21; |
... | @@ -124,7 +126,8 @@ public class LambdaForwarding { | ... | @@ -124,7 +126,8 @@ public class LambdaForwarding { |
124 | outport = 31; | 126 | outport = 31; |
125 | sbuilder.add(Criteria.matchLambda(new IndexedLambda(lambda))). | 127 | sbuilder.add(Criteria.matchLambda(new IndexedLambda(lambda))). |
126 | matchInPort(PortNumber.portNumber(inport)); | 128 | matchInPort(PortNumber.portNumber(inport)); |
127 | - tbuilder.setOutput(PortNumber.portNumber(outport)).setLambda(lambda); | 129 | + tbuilder.setOutput(PortNumber.portNumber(outport)) |
130 | + .add(Instructions.modL0Lambda(new IndexedLambda(lambda))); | ||
128 | break; | 131 | break; |
129 | default: | 132 | default: |
130 | } | 133 | } | ... | ... |
... | @@ -330,6 +330,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -330,6 +330,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
330 | return add(Instructions.decMplsTtl()); | 330 | return add(Instructions.decMplsTtl()); |
331 | } | 331 | } |
332 | 332 | ||
333 | + @Deprecated | ||
333 | @Override | 334 | @Override |
334 | public Builder setLambda(short lambda) { | 335 | public Builder setLambda(short lambda) { |
335 | return add(Instructions.modL0Lambda(new IndexedLambda(lambda))); | 336 | return add(Instructions.modL0Lambda(new IndexedLambda(lambda))); | ... | ... |
... | @@ -230,7 +230,9 @@ public interface TrafficTreatment { | ... | @@ -230,7 +230,9 @@ public interface TrafficTreatment { |
230 | * | 230 | * |
231 | * @param lambda optical channel ID | 231 | * @param lambda optical channel ID |
232 | * @return a treatment builder | 232 | * @return a treatment builder |
233 | + * @deprecated in Drake Release | ||
233 | */ | 234 | */ |
235 | + @Deprecated | ||
234 | Builder setLambda(short lambda); | 236 | Builder setLambda(short lambda); |
235 | 237 | ||
236 | /** | 238 | /** | ... | ... |
... | @@ -69,7 +69,7 @@ public class DefaultTrafficTreatmentTest { | ... | @@ -69,7 +69,7 @@ public class DefaultTrafficTreatmentTest { |
69 | .setEthSrc(MacAddress.BROADCAST) | 69 | .setEthSrc(MacAddress.BROADCAST) |
70 | .setIpDst(IpAddress.valueOf("1.1.1.1")) | 70 | .setIpDst(IpAddress.valueOf("1.1.1.1")) |
71 | .setIpSrc(IpAddress.valueOf("2.2.2.2")) | 71 | .setIpSrc(IpAddress.valueOf("2.2.2.2")) |
72 | - .setLambda((short) 4) | 72 | + .add(Instructions.modL0Lambda(new IndexedLambda(4))) |
73 | .setOutput(PortNumber.portNumber(2)) | 73 | .setOutput(PortNumber.portNumber(2)) |
74 | .setVlanId(VlanId.vlanId((short) 4)) | 74 | .setVlanId(VlanId.vlanId((short) 4)) |
75 | .setVlanPcp((byte) 3); | 75 | .setVlanPcp((byte) 3); | ... | ... |
... | @@ -32,6 +32,7 @@ import org.onosproject.net.ConnectPoint; | ... | @@ -32,6 +32,7 @@ import org.onosproject.net.ConnectPoint; |
32 | import org.onosproject.net.DeviceId; | 32 | import org.onosproject.net.DeviceId; |
33 | import org.onosproject.net.GridType; | 33 | import org.onosproject.net.GridType; |
34 | import org.onosproject.net.HostId; | 34 | import org.onosproject.net.HostId; |
35 | +import org.onosproject.net.IndexedLambda; | ||
35 | import org.onosproject.net.Lambda; | 36 | import org.onosproject.net.Lambda; |
36 | import org.onosproject.net.NetTestTools; | 37 | import org.onosproject.net.NetTestTools; |
37 | import org.onosproject.net.OchSignalType; | 38 | import org.onosproject.net.OchSignalType; |
... | @@ -41,6 +42,7 @@ import org.onosproject.net.flow.DefaultTrafficTreatment; | ... | @@ -41,6 +42,7 @@ import org.onosproject.net.flow.DefaultTrafficTreatment; |
41 | import org.onosproject.net.flow.TrafficSelector; | 42 | import org.onosproject.net.flow.TrafficSelector; |
42 | import org.onosproject.net.flow.TrafficTreatment; | 43 | import org.onosproject.net.flow.TrafficTreatment; |
43 | import org.onosproject.net.flow.criteria.Criteria; | 44 | import org.onosproject.net.flow.criteria.Criteria; |
45 | +import org.onosproject.net.flow.instructions.Instructions; | ||
44 | import org.onosproject.net.intent.AbstractIntentTest; | 46 | import org.onosproject.net.intent.AbstractIntentTest; |
45 | import org.onosproject.net.intent.Constraint; | 47 | import org.onosproject.net.intent.Constraint; |
46 | import org.onosproject.net.intent.HostToHostIntent; | 48 | import org.onosproject.net.intent.HostToHostIntent; |
... | @@ -151,7 +153,7 @@ public class IntentCodecTest extends AbstractIntentTest { | ... | @@ -151,7 +153,7 @@ public class IntentCodecTest extends AbstractIntentTest { |
151 | .matchIPDst(IpPrefix.valueOf("1.2.3.4/24")) | 153 | .matchIPDst(IpPrefix.valueOf("1.2.3.4/24")) |
152 | .build(); | 154 | .build(); |
153 | final TrafficTreatment treatment = DefaultTrafficTreatment.builder() | 155 | final TrafficTreatment treatment = DefaultTrafficTreatment.builder() |
154 | - .setLambda((short) 33) | 156 | + .add(Instructions.modL0Lambda(new IndexedLambda(33))) |
155 | .setMpls(MplsLabel.mplsLabel(44)) | 157 | .setMpls(MplsLabel.mplsLabel(44)) |
156 | .setOutput(PortNumber.CONTROLLER) | 158 | .setOutput(PortNumber.CONTROLLER) |
157 | .setEthDst(MacAddress.BROADCAST) | 159 | .setEthDst(MacAddress.BROADCAST) | ... | ... |
... | @@ -37,6 +37,7 @@ import org.onosproject.net.flow.FlowEntry.FlowEntryState; | ... | @@ -37,6 +37,7 @@ import org.onosproject.net.flow.FlowEntry.FlowEntryState; |
37 | import org.onosproject.net.flow.FlowRule; | 37 | import org.onosproject.net.flow.FlowRule; |
38 | import org.onosproject.net.flow.TrafficSelector; | 38 | import org.onosproject.net.flow.TrafficSelector; |
39 | import org.onosproject.net.flow.TrafficTreatment; | 39 | import org.onosproject.net.flow.TrafficTreatment; |
40 | +import org.onosproject.net.flow.instructions.Instructions; | ||
40 | import org.onosproject.openflow.controller.Dpid; | 41 | import org.onosproject.openflow.controller.Dpid; |
41 | import org.projectfloodlight.openflow.protocol.OFFlowMod; | 42 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
42 | import org.projectfloodlight.openflow.protocol.OFFlowRemoved; | 43 | import org.projectfloodlight.openflow.protocol.OFFlowRemoved; |
... | @@ -301,7 +302,8 @@ public class FlowEntryBuilder { | ... | @@ -301,7 +302,8 @@ public class FlowEntryBuilder { |
301 | if (exp.getExperimenter() == 0x80005A06 || | 302 | if (exp.getExperimenter() == 0x80005A06 || |
302 | exp.getExperimenter() == 0x748771) { | 303 | exp.getExperimenter() == 0x748771) { |
303 | OFActionCircuit ct = (OFActionCircuit) exp; | 304 | OFActionCircuit ct = (OFActionCircuit) exp; |
304 | - builder.setLambda(((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber()); | 305 | + short lambda = ((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber(); |
306 | + builder.add(Instructions.modL0Lambda(Lambda.indexedLambda(lambda))); | ||
305 | } else { | 307 | } else { |
306 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); | 308 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); |
307 | } | 309 | } | ... | ... |
... | @@ -23,9 +23,11 @@ import org.onlab.packet.MplsLabel; | ... | @@ -23,9 +23,11 @@ import org.onlab.packet.MplsLabel; |
23 | import org.onlab.packet.VlanId; | 23 | import org.onlab.packet.VlanId; |
24 | import org.onosproject.core.DefaultGroupId; | 24 | import org.onosproject.core.DefaultGroupId; |
25 | import org.onosproject.core.GroupId; | 25 | import org.onosproject.core.GroupId; |
26 | +import org.onosproject.net.Lambda; | ||
26 | import org.onosproject.net.PortNumber; | 27 | import org.onosproject.net.PortNumber; |
27 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 28 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
28 | import org.onosproject.net.flow.TrafficTreatment; | 29 | import org.onosproject.net.flow.TrafficTreatment; |
30 | +import org.onosproject.net.flow.instructions.Instructions; | ||
29 | import org.onosproject.net.group.DefaultGroupBucket; | 31 | import org.onosproject.net.group.DefaultGroupBucket; |
30 | import org.onosproject.net.group.GroupBucket; | 32 | import org.onosproject.net.group.GroupBucket; |
31 | import org.onosproject.net.group.GroupBuckets; | 33 | import org.onosproject.net.group.GroupBuckets; |
... | @@ -177,7 +179,8 @@ public class GroupBucketEntryBuilder { | ... | @@ -177,7 +179,8 @@ public class GroupBucketEntryBuilder { |
177 | if (exp.getExperimenter() == 0x80005A06 || | 179 | if (exp.getExperimenter() == 0x80005A06 || |
178 | exp.getExperimenter() == 0x748771) { | 180 | exp.getExperimenter() == 0x748771) { |
179 | OFActionCircuit ct = (OFActionCircuit) exp; | 181 | OFActionCircuit ct = (OFActionCircuit) exp; |
180 | - builder.setLambda(((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber()); | 182 | + short lambda = ((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber(); |
183 | + builder.add(Instructions.modL0Lambda(Lambda.indexedLambda(lambda))); | ||
181 | } else { | 184 | } else { |
182 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); | 185 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); |
183 | } | 186 | } | ... | ... |
-
Please register or login to post a comment