Committed by
Ray Milkey
Deprecate ModMplsLabelInstruction#label()
Change-Id: I1324747adaa8ccb28077aa14b208df1083f39a3f
Showing
8 changed files
with
17 additions
and
12 deletions
... | @@ -342,7 +342,13 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -342,7 +342,13 @@ public abstract class L2ModificationInstruction implements Instruction { |
342 | this.mplsLabel = mplsLabel; | 342 | this.mplsLabel = mplsLabel; |
343 | } | 343 | } |
344 | 344 | ||
345 | - // might want to deprecate this in the long run | 345 | + /** |
346 | + * @deprecated in Drake Release. | ||
347 | + */ | ||
348 | + // Consider changing return value to MplsLabel | ||
349 | + // after deprecation process so that it'll be symmetric to | ||
350 | + // MplsCriterion#label() | ||
351 | + @Deprecated | ||
346 | public Integer label() { | 352 | public Integer label() { |
347 | return mplsLabel.toInt(); | 353 | return mplsLabel.toInt(); |
348 | } | 354 | } | ... | ... |
... | @@ -577,12 +577,13 @@ public class InstructionsTest { | ... | @@ -577,12 +577,13 @@ public class InstructionsTest { |
577 | */ | 577 | */ |
578 | @Test | 578 | @Test |
579 | public void testModMplsMethod() { | 579 | public void testModMplsMethod() { |
580 | - final Instruction instruction = Instructions.modMplsLabel(MplsLabel.mplsLabel(33)); | 580 | + final MplsLabel mplsLabel = MplsLabel.mplsLabel(33); |
581 | + final Instruction instruction = Instructions.modMplsLabel(mplsLabel); | ||
581 | final L2ModificationInstruction.ModMplsLabelInstruction modMplsLabelInstruction = | 582 | final L2ModificationInstruction.ModMplsLabelInstruction modMplsLabelInstruction = |
582 | checkAndConvert(instruction, | 583 | checkAndConvert(instruction, |
583 | Instruction.Type.L2MODIFICATION, | 584 | Instruction.Type.L2MODIFICATION, |
584 | L2ModificationInstruction.ModMplsLabelInstruction.class); | 585 | L2ModificationInstruction.ModMplsLabelInstruction.class); |
585 | - assertThat(modMplsLabelInstruction.label(), is(equalTo(33))); | 586 | + assertThat(modMplsLabelInstruction.mplsLabel(), is(equalTo(mplsLabel))); |
586 | assertThat(modMplsLabelInstruction.subtype(), | 587 | assertThat(modMplsLabelInstruction.subtype(), |
587 | is(equalTo(L2ModificationInstruction.L2SubType.MPLS_LABEL))); | 588 | is(equalTo(L2ModificationInstruction.L2SubType.MPLS_LABEL))); |
588 | } | 589 | } | ... | ... |
... | @@ -113,7 +113,7 @@ public final class EncodeInstructionCodecHelper { | ... | @@ -113,7 +113,7 @@ public final class EncodeInstructionCodecHelper { |
113 | case MPLS_LABEL: | 113 | case MPLS_LABEL: |
114 | final L2ModificationInstruction.ModMplsLabelInstruction modMplsLabelInstruction = | 114 | final L2ModificationInstruction.ModMplsLabelInstruction modMplsLabelInstruction = |
115 | (L2ModificationInstruction.ModMplsLabelInstruction) instruction; | 115 | (L2ModificationInstruction.ModMplsLabelInstruction) instruction; |
116 | - result.put(InstructionCodec.MPLS_LABEL, modMplsLabelInstruction.label()); | 116 | + result.put(InstructionCodec.MPLS_LABEL, modMplsLabelInstruction.mplsLabel().toInt()); |
117 | break; | 117 | break; |
118 | 118 | ||
119 | case MPLS_PUSH: | 119 | case MPLS_PUSH: | ... | ... |
... | @@ -246,8 +246,8 @@ public class FlowRuleCodecTest { | ... | @@ -246,8 +246,8 @@ public class FlowRuleCodecTest { |
246 | L2ModificationInstruction.L2SubType.MPLS_LABEL.name()); | 246 | L2ModificationInstruction.L2SubType.MPLS_LABEL.name()); |
247 | assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION)); | 247 | assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION)); |
248 | assertThat(((L2ModificationInstruction.ModMplsLabelInstruction) instruction) | 248 | assertThat(((L2ModificationInstruction.ModMplsLabelInstruction) instruction) |
249 | - .label().shortValue(), | 249 | + .mplsLabel().toInt(), |
250 | - is((short) 777)); | 250 | + is(MplsLabel.MAX_MPLS)); |
251 | 251 | ||
252 | instruction = getInstruction(Instruction.Type.L2MODIFICATION, | 252 | instruction = getInstruction(Instruction.Type.L2MODIFICATION, |
253 | L2ModificationInstruction.L2SubType.MPLS_PUSH.name()); | 253 | L2ModificationInstruction.L2SubType.MPLS_PUSH.name()); | ... | ... |
... | @@ -372,7 +372,7 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json | ... | @@ -372,7 +372,7 @@ public final class InstructionJsonMatcher extends TypeSafeDiagnosingMatcher<Json |
372 | } | 372 | } |
373 | 373 | ||
374 | final int jsonLabel = instructionJson.get("label").intValue(); | 374 | final int jsonLabel = instructionJson.get("label").intValue(); |
375 | - final int label = instructionToMatch.label(); | 375 | + final int label = instructionToMatch.mplsLabel().toInt(); |
376 | if (label != jsonLabel) { | 376 | if (label != jsonLabel) { |
377 | description.appendText("MPLS label was " + jsonLabel); | 377 | description.appendText("MPLS label was " + jsonLabel); |
378 | return false; | 378 | return false; | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | {"type":"L2MODIFICATION","subtype":"ETH_DST","mac":"98:76:54:32:01:00"}, | 13 | {"type":"L2MODIFICATION","subtype":"ETH_DST","mac":"98:76:54:32:01:00"}, |
14 | {"type":"L2MODIFICATION","subtype":"VLAN_ID","vlanId":22}, | 14 | {"type":"L2MODIFICATION","subtype":"VLAN_ID","vlanId":22}, |
15 | {"type":"L2MODIFICATION","subtype":"VLAN_PCP","vlanPcp":1}, | 15 | {"type":"L2MODIFICATION","subtype":"VLAN_PCP","vlanPcp":1}, |
16 | - {"type":"L2MODIFICATION","subtype":"MPLS_LABEL","label":777}, | 16 | + {"type":"L2MODIFICATION","subtype":"MPLS_LABEL","label":1048575}, |
17 | {"type":"L2MODIFICATION","subtype":"MPLS_PUSH"}, | 17 | {"type":"L2MODIFICATION","subtype":"MPLS_PUSH"}, |
18 | {"type":"L2MODIFICATION","subtype":"MPLS_POP"}, | 18 | {"type":"L2MODIFICATION","subtype":"MPLS_POP"}, |
19 | {"type":"L2MODIFICATION","subtype":"DEC_MPLS_TTL"}, | 19 | {"type":"L2MODIFICATION","subtype":"DEC_MPLS_TTL"}, | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
... | @@ -342,8 +342,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -342,8 +342,7 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
342 | case MPLS_LABEL: | 342 | case MPLS_LABEL: |
343 | ModMplsLabelInstruction mplsLabel = | 343 | ModMplsLabelInstruction mplsLabel = |
344 | (ModMplsLabelInstruction) l2m; | 344 | (ModMplsLabelInstruction) l2m; |
345 | - oxm = factory().oxms().mplsLabel(U32.of(mplsLabel.label() | 345 | + oxm = factory().oxms().mplsLabel(U32.of(mplsLabel.mplsLabel().toInt())); |
346 | - .longValue())); | ||
347 | break; | 346 | break; |
348 | case MPLS_BOS: | 347 | case MPLS_BOS: |
349 | ModMplsBosInstruction mplsBos = (ModMplsBosInstruction) l2m; | 348 | ModMplsBosInstruction mplsBos = (ModMplsBosInstruction) l2m; | ... | ... |
... | @@ -284,8 +284,7 @@ public final class GroupModBuilder { | ... | @@ -284,8 +284,7 @@ public final class GroupModBuilder { |
284 | case MPLS_LABEL: | 284 | case MPLS_LABEL: |
285 | L2ModificationInstruction.ModMplsLabelInstruction mplsLabel = | 285 | L2ModificationInstruction.ModMplsLabelInstruction mplsLabel = |
286 | (L2ModificationInstruction.ModMplsLabelInstruction) l2m; | 286 | (L2ModificationInstruction.ModMplsLabelInstruction) l2m; |
287 | - oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label() | 287 | + oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.mplsLabel().toInt())); |
288 | - .longValue())); | ||
289 | break; | 288 | break; |
290 | case MPLS_BOS: | 289 | case MPLS_BOS: |
291 | L2ModificationInstruction.ModMplsBosInstruction mplsBos = | 290 | L2ModificationInstruction.ModMplsBosInstruction mplsBos = | ... | ... |
-
Please register or login to post a comment