Fix: allow to specify duplicated gateways for different subnets

Change-Id: I846b045c346ca328744803c2e72a5a549a95f860
This commit is contained in:
Jian Li 2018-10-12 22:09:03 +09:00
parent 581f21a1c0
commit 8e365bdab1

View File

@ -277,6 +277,21 @@ public final class OpenstackSwitchingArpHandler {
private void setFakeGatewayArpRule(Subnet osSubnet, boolean install, OpenstackNode osNode) {
if (ARP_BROADCAST_MODE.equals(getArpMode())) {
// do not remove fake gateway ARP rules, if there is another gateway
// which has the same subnet that to be removed
// this only occurs if we have duplicated subnets associated with
// different networks
if (!install) {
long numOfDupGws = osNetworkService.subnets().stream()
.filter(s -> !s.getId().equals(osSubnet.getId()))
.filter(s -> s.getGateway().equals(osSubnet.getGateway()))
.count();
if (numOfDupGws > 0) {
return;
}
}
String gateway = osSubnet.getGateway();
TrafficSelector selector = DefaultTrafficSelector.builder()