Committed by
Yuta HIGUCHI
Using vlan extension in ofdpa for versatile objectives
Change-Id: I11f35eccd0c103df02ffddb3060fffd5bc13c44f
Showing
1 changed file
with
19 additions
and
13 deletions
... | @@ -632,10 +632,9 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline | ... | @@ -632,10 +632,9 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline |
632 | */ | 632 | */ |
633 | private Collection<FlowRule> processVersatile(ForwardingObjective fwd) { | 633 | private Collection<FlowRule> processVersatile(ForwardingObjective fwd) { |
634 | log.info("Processing versatile forwarding objective"); | 634 | log.info("Processing versatile forwarding objective"); |
635 | - TrafficSelector selector = fwd.selector(); | ||
636 | 635 | ||
637 | EthTypeCriterion ethType = | 636 | EthTypeCriterion ethType = |
638 | - (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); | 637 | + (EthTypeCriterion) fwd.selector().getCriterion(Criterion.Type.ETH_TYPE); |
639 | if (ethType == null) { | 638 | if (ethType == null) { |
640 | log.error("Versatile forwarding objective must include ethType"); | 639 | log.error("Versatile forwarding objective must include ethType"); |
641 | fail(fwd, ObjectiveError.BADPARAMS); | 640 | fail(fwd, ObjectiveError.BADPARAMS); |
... | @@ -647,6 +646,23 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline | ... | @@ -647,6 +646,23 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline |
647 | return Collections.emptySet(); | 646 | return Collections.emptySet(); |
648 | } | 647 | } |
649 | 648 | ||
649 | + TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder(); | ||
650 | + fwd.selector().criteria().forEach(criterion -> { | ||
651 | + if (criterion instanceof VlanIdCriterion) { | ||
652 | + VlanId vlanId = ((VlanIdCriterion) criterion).vlanId(); | ||
653 | + // ensure that match does not include vlan = NONE as OF-DPA does not | ||
654 | + // match untagged packets this way in the ACL table. | ||
655 | + if (vlanId.equals(VlanId.NONE)) { | ||
656 | + return; | ||
657 | + } | ||
658 | + OfdpaMatchVlanVid ofdpaMatchVlanVid = | ||
659 | + new OfdpaMatchVlanVid(vlanId); | ||
660 | + sbuilder.extension(ofdpaMatchVlanVid, deviceId); | ||
661 | + } else { | ||
662 | + sbuilder.add(criterion); | ||
663 | + } | ||
664 | + }); | ||
665 | + | ||
650 | // XXX driver does not currently do type checking as per Tables 65-67 in | 666 | // XXX driver does not currently do type checking as per Tables 65-67 in |
651 | // OFDPA 2.0 spec. The only allowed treatment is a punt to the controller. | 667 | // OFDPA 2.0 spec. The only allowed treatment is a punt to the controller. |
652 | TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder(); | 668 | TrafficTreatment.Builder ttBuilder = DefaultTrafficTreatment.builder(); |
... | @@ -679,22 +695,12 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline | ... | @@ -679,22 +695,12 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline |
679 | } | 695 | } |
680 | ttBuilder.deferred().group(group.id()); | 696 | ttBuilder.deferred().group(group.id()); |
681 | } | 697 | } |
682 | - // ensure that match does not include vlan = NONE as OF-DPA does not | ||
683 | - // match untagged packets this way in the ACL table. | ||
684 | - TrafficSelector.Builder selBuilder = DefaultTrafficSelector.builder(); | ||
685 | - for (Criterion criterion : fwd.selector().criteria()) { | ||
686 | - if (criterion instanceof VlanIdCriterion && | ||
687 | - ((VlanIdCriterion) criterion).vlanId() == VlanId.NONE) { | ||
688 | - continue; | ||
689 | - } | ||
690 | - selBuilder.add(criterion); | ||
691 | - } | ||
692 | 698 | ||
693 | FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() | 699 | FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() |
694 | .fromApp(fwd.appId()) | 700 | .fromApp(fwd.appId()) |
695 | .withPriority(fwd.priority()) | 701 | .withPriority(fwd.priority()) |
696 | .forDevice(deviceId) | 702 | .forDevice(deviceId) |
697 | - .withSelector(selBuilder.build()) | 703 | + .withSelector(sbuilder.build()) |
698 | .withTreatment(ttBuilder.build()) | 704 | .withTreatment(ttBuilder.build()) |
699 | .makePermanent() | 705 | .makePermanent() |
700 | .forTable(ACL_TABLE); | 706 | .forTable(ACL_TABLE); | ... | ... |
-
Please register or login to post a comment