Committed by
Charles Chan
Deprecate PushHeaderInstructions and PopVlanInstruction
PushHeaderInstruction is used by mpls header push, pop, vlan header push. Also PopVlanInstruction should be augmented to cover vlan header push case. Change-Id: Ic0da77b1f86e1e4a396080caa463d1d727b4c7dd (cherry picked from commit ddfd2eba)
Showing
1 changed file
with
102 additions
and
1 deletions
... | @@ -148,7 +148,11 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -148,7 +148,11 @@ public abstract class L2ModificationInstruction implements Instruction { |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | - // TODO This instruction is reused for Pop-Mpls. Consider renaming. | 151 | + /** |
152 | + * @deprecated 1.6.0 Goldeneye release. | ||
153 | + * Recommended to use ModMplsHeaderInstruction or ModVlanHeaderInstruction instead. | ||
154 | + */ | ||
155 | + @Deprecated | ||
152 | public static final class PushHeaderInstructions extends | 156 | public static final class PushHeaderInstructions extends |
153 | L2ModificationInstruction { | 157 | L2ModificationInstruction { |
154 | 158 | ||
... | @@ -194,7 +198,51 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -194,7 +198,51 @@ public abstract class L2ModificationInstruction implements Instruction { |
194 | } | 198 | } |
195 | } | 199 | } |
196 | 200 | ||
201 | + /** | ||
202 | + * Represents a MPLS header modification instruction. | ||
203 | + */ | ||
204 | + public static final class ModMplsHeaderInstruction extends L2ModificationInstruction { | ||
205 | + | ||
206 | + private final L2SubType subtype; | ||
207 | + private final EthType ethernetType; // Ethernet type value: 16 bits | ||
208 | + | ||
209 | + ModMplsHeaderInstruction(L2SubType subType, EthType ethernetType) { | ||
210 | + this.subtype = subType; | ||
211 | + this.ethernetType = ethernetType; | ||
212 | + } | ||
213 | + | ||
214 | + public EthType ethernetType() { | ||
215 | + return ethernetType; | ||
216 | + } | ||
197 | 217 | ||
218 | + @Override | ||
219 | + public L2SubType subtype() { | ||
220 | + return subtype; | ||
221 | + } | ||
222 | + | ||
223 | + @Override | ||
224 | + public String toString() { | ||
225 | + return subtype().toString() + SEPARATOR + ethernetType; | ||
226 | + } | ||
227 | + | ||
228 | + @Override | ||
229 | + public int hashCode() { | ||
230 | + return Objects.hash(type(), subtype, ethernetType); | ||
231 | + } | ||
232 | + | ||
233 | + @Override | ||
234 | + public boolean equals(Object obj) { | ||
235 | + if (this == obj) { | ||
236 | + return true; | ||
237 | + } | ||
238 | + if (obj instanceof ModMplsHeaderInstruction) { | ||
239 | + ModMplsHeaderInstruction that = (ModMplsHeaderInstruction) obj; | ||
240 | + return Objects.equals(subtype, that.subtype) && | ||
241 | + Objects.equals(this.ethernetType, that.ethernetType); | ||
242 | + } | ||
243 | + return false; | ||
244 | + } | ||
245 | + } | ||
198 | 246 | ||
199 | /** | 247 | /** |
200 | * Represents a VLAN id modification instruction. | 248 | * Represents a VLAN id modification instruction. |
... | @@ -285,7 +333,10 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -285,7 +333,10 @@ public abstract class L2ModificationInstruction implements Instruction { |
285 | 333 | ||
286 | /** | 334 | /** |
287 | * Represents a VLAN POP modification instruction. | 335 | * Represents a VLAN POP modification instruction. |
336 | + * @deprecated 1.6.0 Goldeneye release. | ||
337 | + * Recommended to use ModVlanHeaderInstruction instead. | ||
288 | */ | 338 | */ |
339 | + @Deprecated | ||
289 | public static final class PopVlanInstruction extends L2ModificationInstruction { | 340 | public static final class PopVlanInstruction extends L2ModificationInstruction { |
290 | private final L2SubType subtype; | 341 | private final L2SubType subtype; |
291 | 342 | ||
... | @@ -322,6 +373,56 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -322,6 +373,56 @@ public abstract class L2ModificationInstruction implements Instruction { |
322 | } | 373 | } |
323 | 374 | ||
324 | /** | 375 | /** |
376 | + * Represents a VLAN Header modification instruction. | ||
377 | + */ | ||
378 | + public static final class ModVlanHeaderInstruction extends L2ModificationInstruction { | ||
379 | + | ||
380 | + private final L2SubType subtype; | ||
381 | + private EthType ethernetType; // Ethernet type value: 16 bits | ||
382 | + | ||
383 | + ModVlanHeaderInstruction(L2SubType subType, EthType ethernetType) { | ||
384 | + this.subtype = subType; | ||
385 | + this.ethernetType = ethernetType; | ||
386 | + } | ||
387 | + | ||
388 | + ModVlanHeaderInstruction(L2SubType subType) { | ||
389 | + this(subType, EthType.EtherType.UNKNOWN.ethType()); | ||
390 | + } | ||
391 | + | ||
392 | + public EthType ethernetType() { | ||
393 | + return ethernetType; | ||
394 | + } | ||
395 | + | ||
396 | + @Override | ||
397 | + public L2SubType subtype() { | ||
398 | + return subtype; | ||
399 | + } | ||
400 | + | ||
401 | + @Override | ||
402 | + public String toString() { | ||
403 | + return subtype().toString() + SEPARATOR + ethernetType; | ||
404 | + } | ||
405 | + | ||
406 | + @Override | ||
407 | + public int hashCode() { | ||
408 | + return Objects.hash(type(), subtype, ethernetType); | ||
409 | + } | ||
410 | + | ||
411 | + @Override | ||
412 | + public boolean equals(Object obj) { | ||
413 | + if (this == obj) { | ||
414 | + return true; | ||
415 | + } | ||
416 | + if (obj instanceof ModVlanHeaderInstruction) { | ||
417 | + ModVlanHeaderInstruction that = (ModVlanHeaderInstruction) obj; | ||
418 | + return Objects.equals(subtype, that.subtype) && | ||
419 | + Objects.equals(this.ethernetType, that.ethernetType); | ||
420 | + } | ||
421 | + return false; | ||
422 | + } | ||
423 | + } | ||
424 | + | ||
425 | + /** | ||
325 | * Represents a MPLS label modification. | 426 | * Represents a MPLS label modification. |
326 | */ | 427 | */ |
327 | public static final class ModMplsLabelInstruction | 428 | public static final class ModMplsLabelInstruction | ... | ... |
-
Please register or login to post a comment