From f4e178b85f154d6ca8bad12280d70ce5aa043dd9 Mon Sep 17 00:00:00 2001 From: "Balagangadhar (Bala) Bathula" Date: Mon, 30 Oct 2023 15:09:03 -0400 Subject: [PATCH] Fix port-mapping bug for 7.1 device-models - For switch-client ports that have supported-interface-capabilties such as if-100GE, that does not contain otn-capabilities JIRA: TRNSPRTPCE-771 Signed-off-by: Balagangadhar (Bala) Bathula Change-Id: I785d251889b7ae5b5eb7d08f6ba7929342260481 --- .../common/mapping/PortMappingVersion710.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) 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 699870f52..22eff15d1 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 @@ -1053,7 +1053,6 @@ public class PortMappingVersion710 { Set supportedIntf = new HashSet<>(); Set regenProfiles = new HashSet<>(); - SupportedInterfaceCapability sic1 = null; for (SupportedInterfaceCapability sic : supIntfCapaList) { // Here it could add null values and cause a null pointer exception // Especially when the MappingUtilsImpl does not contain required supported-if-cap @@ -1070,26 +1069,25 @@ public class PortMappingVersion710 { LOG.info("Regen-profiles {}", sic.getOtsigroupCapabilityProfileName()); regenProfiles.addAll(sic.getOtsigroupCapabilityProfileName()); } - sic1 = sic; + if (port.getPortQual() == PortQual.SwitchClient + && sic.getOtnCapability() != null) { + // Here we assume all the supported-interfaces has the support same rates, and the + // trib-slot numbers are assumed to be the same + String mxpProfileName = sic.getOtnCapability().getMpdrClientRestriction().get(0) + .getMuxpProfileName().stream().findFirst().orElseThrow(); + // From this muxponder-profile get the min-trib-slot and the max-trib-slot + LOG.info("{}: Muxp-profile used for trib information {}", nodeId, mxpProfileName); + // This provides the tribSlot information from muxProfile + List minMaxOpucnTribSlots = getOpucnTribSlots(nodeId, mxpProfileName); + mpBldr.setMpdrRestrictions( + new MpdrRestrictionsBuilder() + .setMinTribSlot(minMaxOpucnTribSlots.get(0)) + .setMaxTribSlot(minMaxOpucnTribSlots.get(1)) + .build()); + } } mpBldr.setRegenProfiles(new RegenProfilesBuilder().setRegenProfile(regenProfiles).build()) .setSupportedInterfaceCapability(supportedIntf); - if (port.getPortQual() == PortQual.SwitchClient - && !sic1.getOtnCapability().getMpdrClientRestriction().isEmpty()) { - // Here we assume all the supported-interfaces has the support same rates, and the - // trib-slot numbers are assumed to be the same - String mxpProfileName = sic1.getOtnCapability().getMpdrClientRestriction().get(0).getMuxpProfileName() - .stream().findFirst().orElseThrow(); - // From this muxponder-profile get the min-trib-slot and the max-trib-slot - LOG.info("{}: Muxp-profile used for trib information {}", nodeId, mxpProfileName); - // This provides the tribSlot information from muxProfile - List minMaxOpucnTribSlots = getOpucnTribSlots(nodeId, mxpProfileName); - mpBldr.setMpdrRestrictions( - new MpdrRestrictionsBuilder() - .setMinTribSlot(minMaxOpucnTribSlots.get(0)) - .setMaxTribSlot(minMaxOpucnTribSlots.get(1)) - .build()); - } } if (port.getAdministrativeState() != null) { mpBldr.setPortAdminState(port.getAdministrativeState().name()); -- 2.36.6