External networks have no tenant segmentation id. Because of that, code
must not assume that field is non-null.
Change-Id: Ifaebe02c76c1a769cee79f54e11233dae2dcce6d
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
Preconditions.checkNotNull(neutronNetworkCache);
List <NeutronNetwork> networks = neutronNetworkCache.getAllNetworks();
for (NeutronNetwork network : networks) {
- if (network.getProviderSegmentationID().equalsIgnoreCase(segmentationId)) return network.getNetworkUUID();
+ if (network.getProviderSegmentationID() != null &&
+ network.getProviderSegmentationID().equalsIgnoreCase(segmentationId)) {
+ return network.getNetworkUUID();
+ }
}
return null;
}