Set push to s-tag and remove IPv4 from packet match
Change-Id: I8eaee994278ea3bf94f8af0e4431ee795b04d3cb
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
index fd5bd42..294e54b 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
@@ -22,7 +22,7 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.onlab.packet.Ethernet;
+import org.onlab.packet.EthType.EtherType;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -175,8 +175,13 @@
filterTreatmentBuilder.meter(deviceMeterId.meterId());
}
});
- // Push S-TAG of current FC on top of existing CE-VLAN ID
- filterTreatmentBuilder.pushVlan().setVlanId(fc.vlanId());
+ // If a CE-VLAN-ID exists on the incoming packet then push an S-TAG of current FC on top
+ // otherwise push it on as a C-tag
+ if (ingressNi.ceVlanId() != null && ingressNi.ceVlanId() != VlanId.NONE) {
+ filterTreatmentBuilder.pushVlan(EtherType.QINQ.ethType()).setVlanId(fc.vlanId());
+ } else {
+ filterTreatmentBuilder.pushVlan().setVlanId(fc.vlanId());
+ }
}
filteringObjectiveBuilder.addCondition(filterVlanIdCriterion);
@@ -196,7 +201,6 @@
TrafficSelector fwdSelector = DefaultTrafficSelector.builder()
.matchVlanId(fc.vlanId())
.matchInPort(ingressNi.cp().port())
- .matchEthType(Ethernet.TYPE_IPV4)
.build();
Integer nextId = flowObjectiveService.allocateNextId();