Add if-cap-support for If-OTU4-ODU4 ports (7.1)
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / mapping / PortMappingVersion710.java
index 567a6f9949d389d94f793f69dbe375b9616c14b2..46b1047bba14d969d1ca0e4fc4ace03e76cca467 100644 (file)
@@ -1054,7 +1054,11 @@ public class PortMappingVersion710 {
             Set<String> regenProfiles = new HashSet<>();
             SupportedInterfaceCapability sic1 = null;
             for (SupportedInterfaceCapability sic : supIntfCapaList) {
-                supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().toString()));
+                // Here it could add null values and cause a null pointer exception
+                // Especially when the MappingUtilsImpl does not contain required supported-if-cap
+                if (MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().toString()) != null) {
+                    supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().toString()));
+                }
                 LOG.debug("This the xpdr-type {}", xpdrNodeType.getName());
                 // Here we use both types of Regen (bi/uni). Though initial support is only for bi-directional regen
                 if (xpdrNodeType == XpdrNodeTypes.Regen || xpdrNodeType == XpdrNodeTypes.RegenUni) {