Merge "Portmapping for SRGs with multiple circuit packs"
authorGuillaume Lambert <guillaume.lambert@orange.com>
Mon, 7 Feb 2022 08:35:42 +0000 (08:35 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 7 Feb 2022 08:35:42 +0000 (08:35 +0000)
1  2 
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion221.java

index 75cdf8d48a2c5b82e435426d14283a3f507a15ad,58ea3e154365a7d4845570355915b62704962edc..3c0f3a9f0c648f332a27bb824f1549691be98b30
@@@ -422,12 -422,12 +422,12 @@@ public class PortMappingVersion221 
          for (Entry<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.srg.CircuitPacks>>
                  srgCpEntry : getSrgCps(nodeId, deviceInfo).entrySet()) {
              List<String> keys = new ArrayList<>();
+             int portIndex = 1;
              for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.srg.CircuitPacks
                      cp : srgCpEntry.getValue()) {
                  String circuitPackName = cp.getCircuitPackName();
                  List<Ports> portList = getPortList(circuitPackName, nodeId);
                  Collections.sort(portList, new SortPort221ByName());
-                 int portIndex = 1;
                  for (Ports port : portList) {
                      if (!checkPortQual(port, circuitPackName, nodeId)) {
                          continue;
          nodesList.put(nodes.key(),nodes);
  
          Network network = new NetworkBuilder().setNodes(nodesList).build();
 -
          final WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
          InstanceIdentifier<Network> nodesIID = InstanceIdentifier.builder(Network.class).build();
          writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, nodesIID, network);
              List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327
                  .SupportedIfCapability>> supportedIntf = new ArrayList<>();
              for (Class<? extends SupportedIfCapability> sup: port.getSupportedInterfaceCapability()) {
 -                supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup.getSimpleName()));
 +                if (MappingUtilsImpl.convertSupIfCapa(sup.getSimpleName()) != null) {
 +                    supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup.getSimpleName()));
 +                }
              }
              mpBldr.setSupportedInterfaceCapability(supportedIntf);
          }