aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2020-05-26 10:02:57 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2020-05-27 13:29:32 +0000
commit616a4dd89a17312193044b59370c9f03df93762c (patch)
treefbde4d1204f02ba42c55cf9c2633e0abb317c64f
parent487dc2996c12c7854f2b12d1e42e47033e8a1332 (diff)
Fix for NPE in Heatbridge
Null is checked for network type which can be unknown. Issue-ID: SO-2953 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: Iccf724eed5ec7d69b70eabbcf25bfafe1e8fe12b (cherry picked from commit 7c35f6dd4fd4b227f063036280a7f24728a198d8)
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index a00b9f9002..bbabd7fab8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -338,7 +338,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
- if (network.getNetworkType().equals(NetworkType.VLAN)) {
+ if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
vlan.setVlanInterface(network.getName() + network.getProviderSegID());
vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
@@ -352,7 +352,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lIf.setVlans(vlans);
}
// Build sriov-vf to the l-interface
- if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
+ if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
SriovVfs sriovVfs = new SriovVfs();
// JAXB does not generate setters for list, however getter ensures its creation.
// Thus, all list manipulations must be made on live list.