This commit is basically a revert of this change:
https://git.opendaylight.org/gerrit/#/c/27521/
With that change the cache cleanup in fact never ran because the
port is removed before the code is actually run.
The bug for which that commit was a fix is resolved
with this code new commit as well.
In addition, updateL3ForNeutronPort() now allows
deleting flows even when networkId is not found
in networkIdToRouterMacCache. This takes care of
some of the DHCP issues.
Change-Id: Idc3c1ff4b57f5471615ccc6c627ca8f411c37db2
Signed-off-by: Josh <jhershbe@redhat.com>
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
(cherry picked from commit
5824899205c6eb36b45064a3a3f54668e1117a40)
this.updateL3ForNeutronPort(neutronPort, currPortShouldBeDeleted);
}
this.updateL3ForNeutronPort(neutronPort, currPortShouldBeDeleted);
}
- if (isDelete) {
- /*
- * Bug 4277: Remove the router interface cache only after deleting the neutron port l3 flows.
- */
- this.cleanupRouterCache(neutronRouterInterface);
- }
final String networkUUID = neutronPort.getNetworkUUID();
final String routerMacAddress = networkIdToRouterMacCache.get(networkUUID);
final String networkUUID = neutronPort.getNetworkUUID();
final String routerMacAddress = networkIdToRouterMacCache.get(networkUUID);
- // If there is no router interface handling the networkUUID, we are done
- if (routerMacAddress == null || routerMacAddress.isEmpty()) {
- return;
- }
+ if(!isDelete) {
+ // If there is no router interface handling the networkUUID, we are done
+ if (routerMacAddress == null || routerMacAddress.isEmpty()) {
+ return;
+ }
- // If this is the neutron port for the router interface itself, ignore it as well. Ports that represent the
- // router interface are handled via handleNeutronRouterInterfaceEvent.
- if (routerMacAddress.equalsIgnoreCase(neutronPort.getMacAddress())) {
- return;
+ // If this is the neutron port for the router interface itself, ignore it as well. Ports that represent the
+ // router interface are handled via handleNeutronRouterInterfaceEvent.
+ if (routerMacAddress.equalsIgnoreCase(neutronPort.getMacAddress())) {
+ return;
+ }
}
final NeutronNetwork neutronNetwork = neutronNetworkCache.getNetwork(networkUUID);
}
final NeutronNetwork neutronNetwork = neutronNetworkCache.getNetwork(networkUUID);
- // Keep cache for finding router's mac from network uuid -- NOTE: remove is done later, via cleanupRouterCache()
+ if (isDelete) {
+ networkIdToRouterMacCache.remove(neutronNetwork.getNetworkUUID());
+ networkIdToRouterIpListCache.remove(neutronNetwork.getNetworkUUID());
+ subnetIdToRouterInterfaceCache.remove(subnet.getSubnetUUID());
+ }
}
private void programFlowForNetworkFromExternal(final Node node,
}
private void programFlowForNetworkFromExternal(final Node node,
- private void cleanupRouterCache(final NeutronRouter_Interface neutronRouterInterface) {
- /*
- * Fix for 4277
- * Remove the router cache only after deleting the neutron
- * port l3 flows.
- */
- final NeutronPort neutronPort = neutronPortCache.getPort(neutronRouterInterface.getPortUUID());
-
- if (neutronPort != null) {
- networkIdToRouterMacCache.remove(neutronPort.getNetworkUUID());
- networkIdToRouterIpListCache.remove(neutronPort.getNetworkUUID());
- subnetIdToRouterInterfaceCache.remove(neutronRouterInterface.getSubnetUUID());
- }
- }
-
private void cleanupFloatingIPRules(final NeutronPort neutronPort) {
List<NeutronFloatingIP> neutronFloatingIps = neutronFloatingIpCache.getAllFloatingIPs();
private void cleanupFloatingIPRules(final NeutronPort neutronPort) {
List<NeutronFloatingIP> neutronFloatingIps = neutronFloatingIpCache.getAllFloatingIPs();
}
public void removePortFromCleanupCache(NeutronPort port) {
}
public void removePortFromCleanupCache(NeutronPort port) {
- this.portCleanupCache.remove(port.getPortUUID());
+ if(port != null) {
+ this.portCleanupCache.remove(port.getPortUUID());
+ }
}
public Map<String, NeutronPort> getPortCleanupCache() {
}
public Map<String, NeutronPort> getPortCleanupCache() {