[VOL-3660] Adding support to VLAN and PCP treatment on PPPoED flows.
Signed-off-by: Gustavo Silva <gsilva@furukawalatam.com>
Change-Id: Ib62a2b3b9cca18e2dacab9851b16672a5eb73047
(cherry picked from commit 0433adade09c5abb7f834b5c1db42563b413c4c3)
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
index 8db8bd5..574098f 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
@@ -214,10 +214,10 @@
provisionEthTypeBasedFilter(filter, ethType, output,
(L2ModificationInstruction) vlanId.get(),
(L2ModificationInstruction) vlanPush.get());
- } else if (ethType.ethType().equals(EthType.EtherType.LLDP.ethType()) ||
- ethType.ethType().equals(EthType.EtherType.PPPoED.ethType())) {
+ } else if (ethType.ethType().equals(EthType.EtherType.PPPoED.ethType())) {
+ provisionPPPoED(filter, ethType, vlanId.orElse(null), vlanPcp.orElse(null), output);
+ } else if (ethType.ethType().equals(EthType.EtherType.LLDP.ethType())) {
provisionEthTypeBasedFilter(filter, ethType, output, null, null);
-
} else if (ethType.ethType().equals(EthType.EtherType.IPV4.ethType())) {
IPProtocolCriterion ipProto = (IPProtocolCriterion)
filterForCriterion(filter.conditions(), Criterion.Type.IP_PROTO);
@@ -978,6 +978,30 @@
buildAndApplyRule(filter, selector, treatment);
}
+ private void provisionPPPoED(FilteringObjective filter, EthTypeCriterion ethType,
+ Instruction vlanIdInstruction,
+ Instruction vlanPcpInstruction,
+ Instructions.OutputInstruction output) {
+ Instruction meter = filter.meta().metered();
+ Instruction writeMetadata = filter.meta().writeMetadata();
+
+ VlanIdCriterion matchVlanId = (VlanIdCriterion)
+ filterForCriterion(filter.conditions(), Criterion.Type.VLAN_VID);
+
+ TrafficSelector selector;
+ TrafficTreatment treatment;
+
+ if (matchVlanId != null) {
+ log.debug("Building pppoed selector with match VLAN {}.", matchVlanId);
+ } else {
+ log.debug("Building pppoed selector without match VLAN.");
+ }
+
+ selector = buildSelector(filter.key(), ethType, matchVlanId);
+ treatment = buildTreatment(output, meter, writeMetadata, vlanIdInstruction, vlanPcpInstruction);
+ buildAndApplyRule(filter, selector, treatment);
+ }
+
private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector,
TrafficTreatment treatment) {
FlowRule rule = DefaultFlowRule.builder()