Add if-cap-support for If-OTU4-ODU4 ports (7.1) 95/107395/1
authorBalagangadhar (Bala) Bathula <bb4341@att.com>
Wed, 19 Jul 2023 17:37:27 +0000 (13:37 -0400)
committerGilles Thouenon <gilles.thouenon@orange.com>
Fri, 11 Aug 2023 15:26:26 +0000 (17:26 +0200)
- Currently the if-capability support is missing for IfOTU4ODU4
  type ports for 7.1 devices.
- Port-mapping fails to mount the NE with a null pointer expection when
  the supporting-interface-capabilities are not present in MappingUtilImpl.
- Add code to avoid null-pointer expection, even when the MappingUtilImpl
  does not contain required supported-if-cap.

JIRA: TRNSPRTPCE-747

Change-Id: I0270f99a93a02107a7c9a66f49e9825c65b06242
Signed-off-by: Balagangadhar (Bala) Bathula <bb4341@att.com>
common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java

index 28e485848eae9dd7f144f7056e166d60b397018a..c764e37c960eabc7e9eac95a72616a6b847d1f9e 100644 (file)
@@ -32,6 +32,7 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If1G
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If400GE;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCH;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOTU4ODU4;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOtsiOtsigroup;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -49,6 +50,8 @@ public final class MappingUtilsImpl implements MappingUtils {
     private static final ImmutableMap<String, SupportedIfCapability> CAP_TYPE_MAP =
         ImmutableMap.<String, SupportedIfCapability>builder()
             .put("If400GE{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-400GE}", If400GE.VALUE)
+            .put("IfOTU4ODU4{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-OTU4-ODU4}",
+                    IfOTU4ODU4.VALUE)
             .put("IfOtsiOtsigroup{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-otsi-otsigroup}",
                 IfOtsiOtsigroup.VALUE)
             .put("IfOCH{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-OCH}", IfOCH.VALUE)
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) {