Bugfix: resolve a NPE caused by quering a non-existing router MAC

Change-Id: Ie059690efd697341b7c9de4a61a1ce8b20e9734f
This commit is contained in:
Jian Li 2018-06-07 01:44:45 +09:00
parent de67978884
commit d4066ea7fc
2 changed files with 7 additions and 7 deletions

View File

@ -442,12 +442,12 @@ public class OpenstackNetworkManager
try {
externalPeerRouterMap.computeIfPresent(ipAddress.toString(), (id, existing) ->
new DefaultExternalPeerRouter(ipAddress, macAddress, existing.externalPeerRouterVlanId()));
log.info("Updated external peer router map {}",
externalPeerRouterMap.get(ipAddress.toString()).value().toString());
} catch (Exception e) {
log.error("Exception occurred because of {}", e.toString());
}
log.info("Updated external peer router map {}",
externalPeerRouterMap.get(ipAddress.toString()).value().toString());
}

View File

@ -278,11 +278,11 @@ public class OpenstackRoutingArpHandler {
try {
Set<String> fipSet = osRouterService.floatingIps().stream()
.map(NetFloatingIP::getFloatingIpAddress).collect(Collectors.toSet());
Set<String> extRouterIps = osNetworkService.externalPeerRouters().
stream().map(r -> r.externalPeerRouterIp().toString()).collect(Collectors.toSet());
// if the SPA is floating IP, we simply ignores it
if (fipSet.contains(spa.toString())) {
// if SPA is NOT contained in existing external router IP set, we ignore it
if (!extRouterIps.contains(spa.toString())) {
return;
}