From 534795bb0ae26e969639d4f0e1cf74658ec2146e Mon Sep 17 00:00:00 2001 From: "Balagangadhar (Bala) Bathula" Date: Wed, 19 Jul 2023 13:37:27 -0400 Subject: [PATCH] Add if-cap-support for If-OTU4-ODU4 ports (7.1) - 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 --- .../transportpce/common/mapping/MappingUtilsImpl.java | 3 +++ .../transportpce/common/mapping/PortMappingVersion710.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java b/common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java index 28e485848..c764e37c9 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java @@ -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 CAP_TYPE_MAP = ImmutableMap.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) diff --git a/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java b/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java index 567a6f994..46b1047bb 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java @@ -1054,7 +1054,11 @@ public class PortMappingVersion710 { Set 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) { -- 2.36.6