Duplicated flow obj requests are sent in occasion of ROUTE_REMOVED event

Change-Id: I7ad9aa8f27203684921356689805b4092f138d78
This commit is contained in:
Charles Chan 2018-03-15 16:41:10 -07:00 committed by Charles Chan
parent 4d5c5c3fab
commit f433f95e1b
4 changed files with 9 additions and 6 deletions

View File

@ -222,9 +222,8 @@ public class RouteHandler {
locations.forEach(location -> {
log.debug("RouteRemoved. removeSubnet {}, {}", location, prefix);
srManager.deviceConfiguration.removeSubnet(location, prefix);
log.debug("RouteRemoved. revokeRoute {}, {}, {}, {}", location, prefix, nextHopMac, nextHopVlan);
srManager.defaultRoutingHandler.revokeRoute(location.deviceId(), prefix,
nextHopMac, nextHopVlan, location.port());
// We don't need to call revokeRoute again since revokeSubnet will remove the prefix
// from all devices, including the ones that next hop attaches to.
// Also remove redirection flows on the pair device if exists.
Optional<DeviceId> pairDeviceId = srManager.getPairDeviceId(location.deviceId());

View File

@ -205,7 +205,7 @@ public class HostHandlerTest {
srManager.deviceConfiguration = new DeviceConfiguration(srManager);
srManager.flowObjectiveService = new MockFlowObjectiveService(BRIDGING_TABLE, NEXT_TABLE);
srManager.routingRulePopulator = new MockRoutingRulePopulator(srManager, ROUTING_TABLE);
srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE);
srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE, ROUTING_TABLE);
srManager.interfaceService = new MockInterfaceService(INTERFACES);
srManager.mastershipService = new MockMastershipService(LOCAL_DEVICES);
srManager.hostService = new MockHostService(HOSTS);

View File

@ -27,11 +27,14 @@ import java.util.Set;
*/
public class MockDefaultRoutingHandler extends DefaultRoutingHandler {
private Map<ConnectPoint, Set<IpPrefix>> subnetTable;
private Map<MockRoutingTableKey, MockRoutingTableValue> routingTable;
MockDefaultRoutingHandler(SegmentRoutingManager srManager,
Map<ConnectPoint, Set<IpPrefix>> subnetTable) {
Map<ConnectPoint, Set<IpPrefix>> subnetTable,
Map<MockRoutingTableKey, MockRoutingTableValue> routingTable) {
super(srManager);
this.subnetTable = subnetTable;
this.routingTable = routingTable;
}
@Override
@ -56,6 +59,7 @@ public class MockDefaultRoutingHandler extends DefaultRoutingHandler {
subnetTable.remove(entry.getKey());
}
}
routingTable.entrySet().removeIf(e -> subnets.contains(e.getKey().ipPrefix));
return true;
}
}

View File

@ -145,7 +145,7 @@ public class RouteHandlerTest {
srManager.deviceConfiguration = createMock(DeviceConfiguration.class);
srManager.flowObjectiveService = new MockFlowObjectiveService(BRIDGING_TABLE, NEXT_TABLE);
srManager.routingRulePopulator = new MockRoutingRulePopulator(srManager, ROUTING_TABLE);
srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE);
srManager.defaultRoutingHandler = new MockDefaultRoutingHandler(srManager, SUBNET_TABLE, ROUTING_TABLE);
srManager.interfaceService = new MockInterfaceService(INTERFACES);
srManager.mastershipService = new MockMastershipService(LOCAL_DEVICES);
hostService = new MockHostService(HOSTS);