TUNNEL_ID field support in flow matching and actions
Change-Id: I886123a7c8d57dc4a3e12727ec8a9be4920da79e
Showing
13 changed files
with
232 additions
and
5 deletions
... | @@ -294,6 +294,11 @@ public final class DefaultTrafficSelector implements TrafficSelector { | ... | @@ -294,6 +294,11 @@ public final class DefaultTrafficSelector implements TrafficSelector { |
294 | } | 294 | } |
295 | 295 | ||
296 | @Override | 296 | @Override |
297 | + public TrafficSelector.Builder matchTunnelId(long tunnelId) { | ||
298 | + return add(Criteria.matchTunnelId(tunnelId)); | ||
299 | + } | ||
300 | + | ||
301 | + @Override | ||
297 | public Builder matchIPv6ExthdrFlags(short exthdrFlags) { | 302 | public Builder matchIPv6ExthdrFlags(short exthdrFlags) { |
298 | return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); | 303 | return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); |
299 | } | 304 | } | ... | ... |
... | @@ -385,6 +385,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -385,6 +385,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
385 | } | 385 | } |
386 | 386 | ||
387 | @Override | 387 | @Override |
388 | + public Builder setTunnelId(long tunnelId) { | ||
389 | + return add(Instructions.modTunnelId(tunnelId)); | ||
390 | + } | ||
391 | + | ||
392 | + @Override | ||
388 | public TrafficTreatment build() { | 393 | public TrafficTreatment build() { |
389 | //Don't add DROP instruction by default when instruction | 394 | //Don't add DROP instruction by default when instruction |
390 | //set is empty. This will be handled in DefaultSingleTablePipeline | 395 | //set is empty. This will be handled in DefaultSingleTablePipeline | ... | ... |
... | @@ -301,6 +301,14 @@ public interface TrafficSelector { | ... | @@ -301,6 +301,14 @@ public interface TrafficSelector { |
301 | Builder matchMplsLabel(MplsLabel mplsLabel); | 301 | Builder matchMplsLabel(MplsLabel mplsLabel); |
302 | 302 | ||
303 | /** | 303 | /** |
304 | + * Matches a tunnel id. | ||
305 | + * | ||
306 | + * @param tunnelId a tunnel id | ||
307 | + * @return a selection builder | ||
308 | + */ | ||
309 | + Builder matchTunnelId(long tunnelId); | ||
310 | + | ||
311 | + /** | ||
304 | * Matches on IPv6 Extension Header pseudo-field flags. | 312 | * Matches on IPv6 Extension Header pseudo-field flags. |
305 | * | 313 | * |
306 | * @param exthdrFlags the IPv6 Extension Header pseudo-field flags | 314 | * @param exthdrFlags the IPv6 Extension Header pseudo-field flags | ... | ... |
... | @@ -311,6 +311,14 @@ public interface TrafficTreatment { | ... | @@ -311,6 +311,14 @@ public interface TrafficTreatment { |
311 | Builder writeMetadata(long value, long mask); | 311 | Builder writeMetadata(long value, long mask); |
312 | 312 | ||
313 | /** | 313 | /** |
314 | + * Sets the tunnel id. | ||
315 | + * | ||
316 | + * @param tunnelId a tunnel id. | ||
317 | + * @return a treatment builder. | ||
318 | + */ | ||
319 | + Builder setTunnelId(long tunnelId); | ||
320 | + | ||
321 | + /** | ||
314 | * Builds an immutable traffic treatment descriptor. | 322 | * Builds an immutable traffic treatment descriptor. |
315 | * <p> | 323 | * <p> |
316 | * If the treatment is empty when build() is called, it will add a default | 324 | * If the treatment is empty when build() is called, it will add a default | ... | ... |
... | @@ -356,6 +356,16 @@ public final class Criteria { | ... | @@ -356,6 +356,16 @@ public final class Criteria { |
356 | } | 356 | } |
357 | 357 | ||
358 | /** | 358 | /** |
359 | + * Creates a match on Tunnel ID. | ||
360 | + * | ||
361 | + * @param tunnelId Tunnel ID (64 bits) | ||
362 | + * @return match criterion | ||
363 | + */ | ||
364 | + public static Criterion matchTunnelId(long tunnelId) { | ||
365 | + return new TunnelIdCriterion(tunnelId); | ||
366 | + } | ||
367 | + | ||
368 | + /** | ||
359 | * Creates a match on IPv6 Extension Header pseudo-field fiags. | 369 | * Creates a match on IPv6 Extension Header pseudo-field fiags. |
360 | * Those are defined in Criterion.IPv6ExthdrFlags. | 370 | * Those are defined in Criterion.IPv6ExthdrFlags. |
361 | * | 371 | * | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.flow.criteria; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | +/** | ||
22 | + * Implementation of Tunnel ID criterion. | ||
23 | + */ | ||
24 | +public class TunnelIdCriterion implements Criterion { | ||
25 | + private final long tunnelId; | ||
26 | + | ||
27 | + /** | ||
28 | + * Constructor. | ||
29 | + * | ||
30 | + * @param tunnelId a Tunnel ID to match(64 bits) | ||
31 | + */ | ||
32 | + TunnelIdCriterion(long tunnelId) { | ||
33 | + this.tunnelId = tunnelId; | ||
34 | + } | ||
35 | + | ||
36 | + @Override | ||
37 | + public Type type() { | ||
38 | + return Type.TUNNEL_ID; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * Gets the Tunnel ID to match. | ||
43 | + * | ||
44 | + * @return the Tunnel ID to match (64 bits) | ||
45 | + */ | ||
46 | + public long tunnelId() { | ||
47 | + return tunnelId; | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public String toString() { | ||
52 | + return toStringHelper(type().toString()) | ||
53 | + .add("tunnelId", Long.toHexString(tunnelId)) | ||
54 | + .toString(); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public int hashCode() { | ||
59 | + return Objects.hash(type().ordinal(), tunnelId); | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public boolean equals(Object obj) { | ||
64 | + if (this == obj) { | ||
65 | + return true; | ||
66 | + } | ||
67 | + if (obj instanceof TunnelIdCriterion) { | ||
68 | + TunnelIdCriterion that = (TunnelIdCriterion) obj; | ||
69 | + return Objects.equals(tunnelId, that.tunnelId) && | ||
70 | + Objects.equals(this.type(), that.type()); | ||
71 | + } | ||
72 | + return false; | ||
73 | + } | ||
74 | +} |
... | @@ -350,6 +350,17 @@ public final class Instructions { | ... | @@ -350,6 +350,17 @@ public final class Instructions { |
350 | } | 350 | } |
351 | 351 | ||
352 | /** | 352 | /** |
353 | + * Creates a Tunnel ID modification. | ||
354 | + * | ||
355 | + * @param tunnelId the Tunnel ID to modify to | ||
356 | + * @return a L2 modification | ||
357 | + */ | ||
358 | + public static L2ModificationInstruction modTunnelId(long tunnelId) { | ||
359 | + checkNotNull(tunnelId, "Tunnel id cannot be null"); | ||
360 | + return new L2ModificationInstruction.ModTunnelIdInstruction(tunnelId); | ||
361 | + } | ||
362 | + | ||
363 | + /** | ||
353 | * Drop instruction. | 364 | * Drop instruction. |
354 | */ | 365 | */ |
355 | public static final class DropInstruction implements Instruction { | 366 | public static final class DropInstruction implements Instruction { | ... | ... |
... | @@ -81,7 +81,12 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -81,7 +81,12 @@ public abstract class L2ModificationInstruction implements Instruction { |
81 | /** | 81 | /** |
82 | * VLAN Push modification. | 82 | * VLAN Push modification. |
83 | */ | 83 | */ |
84 | - VLAN_PUSH | 84 | + VLAN_PUSH, |
85 | + | ||
86 | + /** | ||
87 | + * Tunnle id modification. | ||
88 | + */ | ||
89 | + TUNNEL_ID | ||
85 | } | 90 | } |
86 | 91 | ||
87 | // TODO: Create factory class 'Instructions' that will have various factory | 92 | // TODO: Create factory class 'Instructions' that will have various factory |
... | @@ -401,4 +406,50 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -401,4 +406,50 @@ public abstract class L2ModificationInstruction implements Instruction { |
401 | return false; | 406 | return false; |
402 | } | 407 | } |
403 | } | 408 | } |
409 | + | ||
410 | + /** | ||
411 | + * Represents a Tunnel id modification. | ||
412 | + */ | ||
413 | + public static final class ModTunnelIdInstruction | ||
414 | + extends L2ModificationInstruction { | ||
415 | + | ||
416 | + private final long tunnelId; | ||
417 | + | ||
418 | + ModTunnelIdInstruction(long tunnelId) { | ||
419 | + this.tunnelId = tunnelId; | ||
420 | + } | ||
421 | + | ||
422 | + public long tunnelId() { | ||
423 | + return this.tunnelId; | ||
424 | + } | ||
425 | + | ||
426 | + @Override | ||
427 | + public L2SubType subtype() { | ||
428 | + return L2SubType.TUNNEL_ID; | ||
429 | + } | ||
430 | + | ||
431 | + @Override | ||
432 | + public String toString() { | ||
433 | + return toStringHelper(subtype().toString()) | ||
434 | + .add("id", Long.toHexString(tunnelId)) | ||
435 | + .toString(); | ||
436 | + } | ||
437 | + | ||
438 | + @Override | ||
439 | + public int hashCode() { | ||
440 | + return Objects.hash(type(), subtype(), tunnelId); | ||
441 | + } | ||
442 | + | ||
443 | + @Override | ||
444 | + public boolean equals(Object obj) { | ||
445 | + if (this == obj) { | ||
446 | + return true; | ||
447 | + } | ||
448 | + if (obj instanceof ModTunnelIdInstruction) { | ||
449 | + ModTunnelIdInstruction that = (ModTunnelIdInstruction) obj; | ||
450 | + return Objects.equals(tunnelId, that.tunnelId); | ||
451 | + } | ||
452 | + return false; | ||
453 | + } | ||
454 | + } | ||
404 | } | 455 | } | ... | ... |
... | @@ -198,6 +198,12 @@ public class CriteriaTest { | ... | @@ -198,6 +198,12 @@ public class CriteriaTest { |
198 | Criterion sameAsMatchMpls1 = Criteria.matchMplsLabel(mpls1); | 198 | Criterion sameAsMatchMpls1 = Criteria.matchMplsLabel(mpls1); |
199 | Criterion matchMpls2 = Criteria.matchMplsLabel(mpls2); | 199 | Criterion matchMpls2 = Criteria.matchMplsLabel(mpls2); |
200 | 200 | ||
201 | + long tunnelId1 = 1; | ||
202 | + long tunnelId2 = 2; | ||
203 | + Criterion matchTunnelId1 = Criteria.matchTunnelId(tunnelId1); | ||
204 | + Criterion sameAsMatchTunnelId1 = Criteria.matchTunnelId(tunnelId1); | ||
205 | + Criterion matchTunnelId2 = Criteria.matchTunnelId(tunnelId2); | ||
206 | + | ||
201 | int ipv6ExthdrFlags1 = | 207 | int ipv6ExthdrFlags1 = |
202 | Criterion.IPv6ExthdrFlags.NONEXT.getValue() | | 208 | Criterion.IPv6ExthdrFlags.NONEXT.getValue() | |
203 | Criterion.IPv6ExthdrFlags.ESP.getValue() | | 209 | Criterion.IPv6ExthdrFlags.ESP.getValue() | |
... | @@ -992,6 +998,33 @@ public class CriteriaTest { | ... | @@ -992,6 +998,33 @@ public class CriteriaTest { |
992 | .testEquals(); | 998 | .testEquals(); |
993 | } | 999 | } |
994 | 1000 | ||
1001 | + // TunnelIdCriterion class | ||
1002 | + | ||
1003 | + /** | ||
1004 | + * Test the matchTunnelId method. | ||
1005 | + */ | ||
1006 | + @Test | ||
1007 | + public void testMatchTunnelIdMethod() { | ||
1008 | + Criterion matchTunnelId = Criteria.matchTunnelId(tunnelId1); | ||
1009 | + TunnelIdCriterion tunnelIdCriterion = | ||
1010 | + checkAndConvert(matchTunnelId, | ||
1011 | + Criterion.Type.TUNNEL_ID, | ||
1012 | + TunnelIdCriterion.class); | ||
1013 | + assertThat(tunnelIdCriterion.tunnelId(), is(equalTo(tunnelId1))); | ||
1014 | + | ||
1015 | + } | ||
1016 | + | ||
1017 | + /** | ||
1018 | + * Test the equals() method of the TunnelIdCriterion class. | ||
1019 | + */ | ||
1020 | + @Test | ||
1021 | + public void testTunnelIdCriterionEquals() { | ||
1022 | + new EqualsTester() | ||
1023 | + .addEqualityGroup(matchTunnelId1, sameAsMatchTunnelId1) | ||
1024 | + .addEqualityGroup(matchTunnelId2) | ||
1025 | + .testEquals(); | ||
1026 | + } | ||
1027 | + | ||
995 | // IPv6ExthdrFlagsCriterion class | 1028 | // IPv6ExthdrFlagsCriterion class |
996 | 1029 | ||
997 | /** | 1030 | /** | ... | ... |
... | @@ -119,6 +119,7 @@ import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; | ... | @@ -119,6 +119,7 @@ import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; |
119 | import org.onosproject.net.flow.criteria.PortCriterion; | 119 | import org.onosproject.net.flow.criteria.PortCriterion; |
120 | import org.onosproject.net.flow.criteria.SctpPortCriterion; | 120 | import org.onosproject.net.flow.criteria.SctpPortCriterion; |
121 | import org.onosproject.net.flow.criteria.TcpPortCriterion; | 121 | import org.onosproject.net.flow.criteria.TcpPortCriterion; |
122 | +import org.onosproject.net.flow.criteria.TunnelIdCriterion; | ||
122 | import org.onosproject.net.flow.criteria.UdpPortCriterion; | 123 | import org.onosproject.net.flow.criteria.UdpPortCriterion; |
123 | import org.onosproject.net.flow.criteria.VlanIdCriterion; | 124 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
124 | import org.onosproject.net.flow.criteria.VlanPcpCriterion; | 125 | import org.onosproject.net.flow.criteria.VlanPcpCriterion; |
... | @@ -320,6 +321,7 @@ public final class KryoNamespaces { | ... | @@ -320,6 +321,7 @@ public final class KryoNamespaces { |
320 | IPv6NDTargetAddressCriterion.class, | 321 | IPv6NDTargetAddressCriterion.class, |
321 | IPv6NDLinkLayerAddressCriterion.class, | 322 | IPv6NDLinkLayerAddressCriterion.class, |
322 | MplsCriterion.class, | 323 | MplsCriterion.class, |
324 | + TunnelIdCriterion.class, | ||
323 | IPv6ExthdrFlagsCriterion.class, | 325 | IPv6ExthdrFlagsCriterion.class, |
324 | LambdaCriterion.class, | 326 | LambdaCriterion.class, |
325 | IndexedLambdaCriterion.class, | 327 | IndexedLambdaCriterion.class, |
... | @@ -346,6 +348,7 @@ public final class KryoNamespaces { | ... | @@ -346,6 +348,7 @@ public final class KryoNamespaces { |
346 | L2ModificationInstruction.PopVlanInstruction.class, | 348 | L2ModificationInstruction.PopVlanInstruction.class, |
347 | L2ModificationInstruction.ModMplsLabelInstruction.class, | 349 | L2ModificationInstruction.ModMplsLabelInstruction.class, |
348 | L2ModificationInstruction.ModMplsTtlInstruction.class, | 350 | L2ModificationInstruction.ModMplsTtlInstruction.class, |
351 | + L2ModificationInstruction.ModTunnelIdInstruction.class, | ||
349 | L3ModificationInstruction.class, | 352 | L3ModificationInstruction.class, |
350 | L3ModificationInstruction.L3SubType.class, | 353 | L3ModificationInstruction.L3SubType.class, |
351 | L3ModificationInstruction.ModIPInstruction.class, | 354 | L3ModificationInstruction.ModIPInstruction.class, | ... | ... |
... | @@ -72,6 +72,7 @@ import org.projectfloodlight.openflow.types.IPv6Address; | ... | @@ -72,6 +72,7 @@ import org.projectfloodlight.openflow.types.IPv6Address; |
72 | import org.projectfloodlight.openflow.types.Masked; | 72 | import org.projectfloodlight.openflow.types.Masked; |
73 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; | 73 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
74 | import org.projectfloodlight.openflow.types.U32; | 74 | import org.projectfloodlight.openflow.types.U32; |
75 | +import org.projectfloodlight.openflow.types.U64; | ||
75 | import org.projectfloodlight.openflow.types.U8; | 76 | import org.projectfloodlight.openflow.types.U8; |
76 | import org.projectfloodlight.openflow.types.VlanPcp; | 77 | import org.projectfloodlight.openflow.types.VlanPcp; |
77 | import org.slf4j.Logger; | 78 | import org.slf4j.Logger; |
... | @@ -402,6 +403,11 @@ public class FlowEntryBuilder { | ... | @@ -402,6 +403,11 @@ public class FlowEntryBuilder { |
402 | OFOxm<U32> labelId = (OFOxm<U32>) oxm; | 403 | OFOxm<U32> labelId = (OFOxm<U32>) oxm; |
403 | builder.setMpls(MplsLabel.mplsLabel((int) labelId.getValue().getValue())); | 404 | builder.setMpls(MplsLabel.mplsLabel((int) labelId.getValue().getValue())); |
404 | break; | 405 | break; |
406 | + case TUNNEL_ID: | ||
407 | + @SuppressWarnings("unchecked") | ||
408 | + OFOxm<U64> tunnelId = (OFOxm<U64>) oxm; | ||
409 | + builder.setTunnelId(tunnelId.getValue().getValue()); | ||
410 | + break; | ||
405 | case ARP_OP: | 411 | case ARP_OP: |
406 | case ARP_SHA: | 412 | case ARP_SHA: |
407 | case ARP_SPA: | 413 | case ARP_SPA: |
... | @@ -451,7 +457,6 @@ public class FlowEntryBuilder { | ... | @@ -451,7 +457,6 @@ public class FlowEntryBuilder { |
451 | case SCTP_SRC: | 457 | case SCTP_SRC: |
452 | case TCP_DST: | 458 | case TCP_DST: |
453 | case TCP_SRC: | 459 | case TCP_SRC: |
454 | - case TUNNEL_ID: | ||
455 | case UDP_DST: | 460 | case UDP_DST: |
456 | case UDP_SRC: | 461 | case UDP_SRC: |
457 | default: | 462 | default: |
... | @@ -640,7 +645,7 @@ public class FlowEntryBuilder { | ... | @@ -640,7 +645,7 @@ public class FlowEntryBuilder { |
640 | break; | 645 | break; |
641 | case IPV6_EXTHDR: | 646 | case IPV6_EXTHDR: |
642 | builder.matchIPv6ExthdrFlags((short) match.get(MatchField.IPV6_EXTHDR) | 647 | builder.matchIPv6ExthdrFlags((short) match.get(MatchField.IPV6_EXTHDR) |
643 | - .getValue()); | 648 | + .getValue()); |
644 | break; | 649 | break; |
645 | case OCH_SIGID: | 650 | case OCH_SIGID: |
646 | CircuitSignalID sigId = match.get(MatchField.OCH_SIGID); | 651 | CircuitSignalID sigId = match.get(MatchField.OCH_SIGID); |
... | @@ -653,13 +658,16 @@ public class FlowEntryBuilder { | ... | @@ -653,13 +658,16 @@ public class FlowEntryBuilder { |
653 | U8 sigType = match.get(MatchField.OCH_SIGTYPE); | 658 | U8 sigType = match.get(MatchField.OCH_SIGTYPE); |
654 | builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue()))); | 659 | builder.add(matchOchSignalType(lookupOchSignalType((byte) sigType.getValue()))); |
655 | break; | 660 | break; |
661 | + case TUNNEL_ID: | ||
662 | + long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); | ||
663 | + builder.matchTunnelId(tunnelId); | ||
664 | + break; | ||
656 | case ARP_OP: | 665 | case ARP_OP: |
657 | case ARP_SHA: | 666 | case ARP_SHA: |
658 | case ARP_SPA: | 667 | case ARP_SPA: |
659 | case ARP_THA: | 668 | case ARP_THA: |
660 | case ARP_TPA: | 669 | case ARP_TPA: |
661 | case MPLS_TC: | 670 | case MPLS_TC: |
662 | - case TUNNEL_ID: | ||
663 | default: | 671 | default: |
664 | log.warn("Match type {} not yet implemented.", field.id); | 672 | log.warn("Match type {} not yet implemented.", field.id); |
665 | } | 673 | } | ... | ... |
... | @@ -44,6 +44,7 @@ import org.onosproject.net.flow.criteria.OchSignalTypeCriterion; | ... | @@ -44,6 +44,7 @@ import org.onosproject.net.flow.criteria.OchSignalTypeCriterion; |
44 | import org.onosproject.net.flow.criteria.PortCriterion; | 44 | import org.onosproject.net.flow.criteria.PortCriterion; |
45 | import org.onosproject.net.flow.criteria.SctpPortCriterion; | 45 | import org.onosproject.net.flow.criteria.SctpPortCriterion; |
46 | import org.onosproject.net.flow.criteria.TcpPortCriterion; | 46 | import org.onosproject.net.flow.criteria.TcpPortCriterion; |
47 | +import org.onosproject.net.flow.criteria.TunnelIdCriterion; | ||
47 | import org.onosproject.net.flow.criteria.UdpPortCriterion; | 48 | import org.onosproject.net.flow.criteria.UdpPortCriterion; |
48 | import org.onosproject.net.flow.criteria.VlanIdCriterion; | 49 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
49 | import org.onosproject.net.flow.criteria.VlanPcpCriterion; | 50 | import org.onosproject.net.flow.criteria.VlanPcpCriterion; |
... | @@ -72,6 +73,7 @@ import org.projectfloodlight.openflow.types.OFVlanVidMatch; | ... | @@ -72,6 +73,7 @@ import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
72 | import org.projectfloodlight.openflow.types.TransportPort; | 73 | import org.projectfloodlight.openflow.types.TransportPort; |
73 | import org.projectfloodlight.openflow.types.U16; | 74 | import org.projectfloodlight.openflow.types.U16; |
74 | import org.projectfloodlight.openflow.types.U32; | 75 | import org.projectfloodlight.openflow.types.U32; |
76 | +import org.projectfloodlight.openflow.types.U64; | ||
75 | import org.projectfloodlight.openflow.types.U8; | 77 | import org.projectfloodlight.openflow.types.U8; |
76 | import org.projectfloodlight.openflow.types.VlanPcp; | 78 | import org.projectfloodlight.openflow.types.VlanPcp; |
77 | import org.projectfloodlight.openflow.types.VlanVid; | 79 | import org.projectfloodlight.openflow.types.VlanVid; |
... | @@ -392,6 +394,11 @@ public abstract class FlowModBuilder { | ... | @@ -392,6 +394,11 @@ public abstract class FlowModBuilder { |
392 | byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType()); | 394 | byte signalType = OpenFlowValueMapper.lookupOchSignalType(sc.signalType()); |
393 | mBuilder.setExact(MatchField.OCH_SIGTYPE, U8.of(signalType)); | 395 | mBuilder.setExact(MatchField.OCH_SIGTYPE, U8.of(signalType)); |
394 | break; | 396 | break; |
397 | + case TUNNEL_ID: | ||
398 | + TunnelIdCriterion tunnelId = (TunnelIdCriterion) c; | ||
399 | + mBuilder.setExact(MatchField.TUNNEL_ID, | ||
400 | + U64.of(tunnelId.tunnelId())); | ||
401 | + break; | ||
395 | case ARP_OP: | 402 | case ARP_OP: |
396 | case ARP_SHA: | 403 | case ARP_SHA: |
397 | case ARP_SPA: | 404 | case ARP_SPA: |
... | @@ -400,7 +407,6 @@ public abstract class FlowModBuilder { | ... | @@ -400,7 +407,6 @@ public abstract class FlowModBuilder { |
400 | case MPLS_BOS: | 407 | case MPLS_BOS: |
401 | case MPLS_TC: | 408 | case MPLS_TC: |
402 | case PBB_ISID: | 409 | case PBB_ISID: |
403 | - case TUNNEL_ID: | ||
404 | default: | 410 | default: |
405 | log.warn("Match type {} not yet implemented.", c.type()); | 411 | log.warn("Match type {} not yet implemented.", c.type()); |
406 | } | 412 | } | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
... | @@ -35,6 +35,7 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLa | ... | @@ -35,6 +35,7 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLa |
35 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; | 35 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; |
36 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction; | 36 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction; |
37 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions; | 37 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions; |
38 | +import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModTunnelIdInstruction; | ||
38 | import org.onosproject.net.flow.instructions.L3ModificationInstruction; | 39 | import org.onosproject.net.flow.instructions.L3ModificationInstruction; |
39 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; | 40 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; |
40 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction; | 41 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction; |
... | @@ -336,6 +337,10 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -336,6 +337,10 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
336 | PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m; | 337 | PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m; |
337 | return factory().actions().pushVlan( | 338 | return factory().actions().pushVlan( |
338 | EthType.of(pushVlanInstruction.ethernetType().toShort())); | 339 | EthType.of(pushVlanInstruction.ethernetType().toShort())); |
340 | + case TUNNEL_ID: | ||
341 | + ModTunnelIdInstruction tunnelId = (ModTunnelIdInstruction) l2m; | ||
342 | + oxm = factory().oxms().tunnelId(U64.of(tunnelId.tunnelId())); | ||
343 | + break; | ||
339 | default: | 344 | default: |
340 | log.warn("Unimplemented action type {}.", l2m.subtype()); | 345 | log.warn("Unimplemented action type {}.", l2m.subtype()); |
341 | break; | 346 | break; | ... | ... |
-
Please register or login to post a comment