mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-22 21:01:00 +02:00
fix on VLAN intent encapsulation ONOS-3467
Change-Id: Ia0a72d13a551fd4183531d35c04ca19d87b85280
This commit is contained in:
parent
6b045587c9
commit
0ff59c27e4
@ -172,12 +172,20 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> {
|
|||||||
}
|
}
|
||||||
VlanId prevVlanId = vlanId;
|
VlanId prevVlanId = vlanId;
|
||||||
|
|
||||||
//Tag the traffic with the new VLAN
|
Optional<VlanIdCriterion> vlanCriterion = intent.selector().criteria()
|
||||||
TrafficTreatment treat = DefaultTrafficTreatment.builder()
|
.stream().filter(criterion -> criterion.type() == Criterion.Type.VLAN_VID)
|
||||||
.setVlanId(vlanId)
|
.map(criterion -> (VlanIdCriterion) criterion)
|
||||||
.build();
|
.findAny();
|
||||||
|
|
||||||
rules.add(createFlowRule(intent.selector(), treat, srcLink.dst(), link.src(), intent.priority(), true));
|
//Push VLAN if selector does not include VLAN
|
||||||
|
TrafficTreatment.Builder treatBuilder = DefaultTrafficTreatment.builder();
|
||||||
|
if (!vlanCriterion.isPresent()) {
|
||||||
|
treatBuilder.pushVlan();
|
||||||
|
}
|
||||||
|
//Tag the traffic with the new encapsulation VLAN
|
||||||
|
treatBuilder.setVlanId(vlanId);
|
||||||
|
rules.add(createFlowRule(intent.selector(), treatBuilder.build(),
|
||||||
|
srcLink.dst(), link.src(), intent.priority(), true));
|
||||||
|
|
||||||
ConnectPoint prev = link.dst();
|
ConnectPoint prev = link.dst();
|
||||||
|
|
||||||
@ -211,15 +219,9 @@ public class PathIntentCompiler implements IntentCompiler<PathIntent> {
|
|||||||
TrafficSelector egressSelector = DefaultTrafficSelector.builder()
|
TrafficSelector egressSelector = DefaultTrafficSelector.builder()
|
||||||
.matchInPort(prev.port())
|
.matchInPort(prev.port())
|
||||||
.matchVlanId(prevVlanId).build();
|
.matchVlanId(prevVlanId).build();
|
||||||
|
|
||||||
//TODO: think to other cases for egress packet restoration
|
|
||||||
Optional<VlanIdCriterion> vlanCriteria = intent.selector().criteria()
|
|
||||||
.stream().filter(criteria -> criteria.type() == Criterion.Type.VLAN_VID)
|
|
||||||
.map(criteria -> (VlanIdCriterion) criteria)
|
|
||||||
.findAny();
|
|
||||||
TrafficTreatment.Builder egressTreat = DefaultTrafficTreatment.builder(intent.treatment());
|
TrafficTreatment.Builder egressTreat = DefaultTrafficTreatment.builder(intent.treatment());
|
||||||
if (vlanCriteria.isPresent()) {
|
if (vlanCriterion.isPresent()) {
|
||||||
egressTreat.setVlanId(vlanCriteria.get().vlanId());
|
egressTreat.setVlanId(vlanCriterion.get().vlanId());
|
||||||
} else {
|
} else {
|
||||||
egressTreat.popVlan();
|
egressTreat.popVlan();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user