mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-12-06 09:51:23 +01:00
Fix deleting VLANs on fabric
Change-Id: I980656b06c88c32551e549e8fd4b355ce9042a3e
This commit is contained in:
parent
4deb0e8de7
commit
ab8b0c075e
@ -49,6 +49,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -240,8 +241,13 @@ public class CordFabricManager implements FabricService {
|
||||
|
||||
@Override
|
||||
public void removeVlan(VlanId vlanId) {
|
||||
vlans.removeAll(vlanId)
|
||||
.forEach(cp -> removeForwarding(vlanId, cp.deviceId(), cp.port()));
|
||||
Collection<ConnectPoint> ports = vlans.removeAll(vlanId);
|
||||
|
||||
ports.forEach(cp -> removeForwarding(vlanId, cp.deviceId(), cp.port(),
|
||||
ports.stream()
|
||||
.filter(p -> p != cp)
|
||||
.map(ConnectPoint::port)
|
||||
.collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -287,19 +293,24 @@ public class CordFabricManager implements FabricService {
|
||||
flowObjectiveService.forward(deviceId, objective);
|
||||
}
|
||||
|
||||
private void removeForwarding(VlanId vlanId, DeviceId deviceId, PortNumber inPort) {
|
||||
private void removeForwarding(VlanId vlanId, DeviceId deviceId, PortNumber inPort,
|
||||
List<PortNumber> outPorts) {
|
||||
TrafficSelector selector = DefaultTrafficSelector.builder()
|
||||
.matchVlanId(vlanId)
|
||||
.matchInPort(inPort)
|
||||
.build();
|
||||
|
||||
TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
|
||||
|
||||
outPorts.forEach(p -> treatmentBuilder.setOutput(p));
|
||||
|
||||
ForwardingObjective objective = DefaultForwardingObjective.builder()
|
||||
.fromApp(appId)
|
||||
.makePermanent()
|
||||
.withFlag(ForwardingObjective.Flag.VERSATILE)
|
||||
.withPriority(PRIORITY)
|
||||
.withSelector(selector)
|
||||
.withTreatment(DefaultTrafficTreatment.builder().build())
|
||||
.withTreatment(treatmentBuilder.build())
|
||||
.remove(new ObjectiveHandler());
|
||||
|
||||
flowObjectiveService.forward(deviceId, objective);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user