Add portmapping methods to fill XpdR LCPs maps 81/94881/3
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 29 Jan 2021 12:45:55 +0000 (13:45 +0100)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 8 Feb 2021 14:35:19 +0000 (15:35 +0100)
JIRA: TRNSPRTPCE-354
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I81b1016b032cb540440bc353fcf848a666b85536

common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion221.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java

index 00b4ec1cdc54e320837ff5e38a875771fe2b0381..4fe79230c5022d972552e93125dfe63cd1b4c62d 100644 (file)
@@ -222,59 +222,11 @@ public class PortMappingVersion121 {
             List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
             portList.sort(Comparator.comparing(Ports::getPortName));
             for (Ports port : portList) {
             List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
             portList.sort(Comparator.comparing(Ports::getPortName));
             for (Ports port : portList) {
-                if (port.getPortQual() == null) {
-                    LOG.warn("{} : port {} on {} - PortQual was not found",
-                            nodeId, port.getPortName(), circuitPackName);
-                    continue;
-                }
-
-                switch (port.getPortQual()) {
-
-                    case XpdrClient:
-                        String lcp0 = createXpdrLogicalConnectionPort(1, client, StringConstants.CLIENT_TOKEN);
-                        lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
-                        mappingMap.put(lcp0,
-                            createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null));
-                        client++;
-                        //continue;
-                        break;
-
-                    case XpdrNetwork:
-                        switch (port.getPortDirection()) {
-
-                            case Bidirectional:
-                                String lcp = createXpdrLogicalConnectionPort(1, line, StringConstants.NETWORK_TOKEN);
-                                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
-                                mappingMap.put(lcp,
-                                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null));
-                                line++;
-                                break;
-
-                            case Rx:
-                            case Tx:
-                                StringBuilder circuitPackName2 = new StringBuilder();
-                                Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
-                                    circuitPackList, lcpMap);
-                                if (port2 == null) {
-                                    //key already present or an error occured and was logged
-                                    continue;
-                                }
-                                putXpdrLcpsInMaps(line, nodeId, 1,
-                                        circuitPackName, circuitPackName2.toString(), port, port2,
-                                        lcpMap, mappingMap);
-                                line += 2;
-                                break;
-
-                            default:
-                                LOG.error("{} : port {} on {} - unsupported Direction {}",
-                                    nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
-                        }
-                        break;
-
-                    default:
-                        LOG.error("{} : port {} on {} - unsupported PortQual {}",
-                                nodeId, port.getPortName(), circuitPackName, port.getPortQual());
-                }
+                int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
+                    1, circuitPackName, port,
+                    circuitPackList, lcpMap, mappingMap);
+                line = counters[0];
+                client = counters[1];
             }
         }
 
             }
         }
 
@@ -746,6 +698,81 @@ public class PortMappingVersion121 {
         return;
     }
 
         return;
     }
 
+    private int[] fillXpdrLcpsMaps(int line, int client, String nodeId,
+            Integer xponderNb,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
+
+        if (port.getPortQual() == null) {
+            LOG.warn("{} : port {} on {} - PortQual was not found",
+                    nodeId, port.getPortName(), circuitPackName);
+            return new int[] {line, client};
+        }
+
+        switch (port.getPortQual()) {
+
+            case XpdrClient:
+                String lcp0 = createXpdrLogicalConnectionPort(xponderNb, client, StringConstants.CLIENT_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
+                mappingMap.put(lcp0,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null));
+                client++;
+                break;
+
+            case XpdrNetwork:
+                line = fillXpdrNetworkLcpsMaps(line, nodeId,
+                        xponderNb,
+                        circuitPackName,  port,
+                        circuitPackList,  lcpMap, mappingMap);
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported PortQual {}",
+                        nodeId, port.getPortName(), circuitPackName, port.getPortQual());
+        }
+        return new int[] {line, client};
+    }
+
+    private int fillXpdrNetworkLcpsMaps(int line, String nodeId,
+            Integer xponderNb,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
+
+        switch (port.getPortDirection()) {
+
+            case Bidirectional:
+                String lcp = createXpdrLogicalConnectionPort(xponderNb, line, StringConstants.NETWORK_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
+                mappingMap.put(lcp,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null));
+                line++;
+                break;
+
+            case Rx:
+            case Tx:
+                StringBuilder circuitPackName2 = new StringBuilder();
+                Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
+                        circuitPackList, lcpMap);
+
+                if (port2 == null) {
+                     //key already present or an error occured and was logged
+                    return line;
+                }
+
+                putXpdrLcpsInMaps(line, nodeId, xponderNb,
+                        circuitPackName, circuitPackName2.toString(), port, port2,
+                        lcpMap, mappingMap);
+
+                line += 2;
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported Direction {}",
+                     nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
+        }
+
+        return line;
+    }
 
     private boolean createTtpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for degree TTP's
 
     private boolean createTtpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
         // Creating mapping data for degree TTP's
index 1d0d767e03171e3f7ad4654a777c305fe2736ecb..cf144749fb56e60eed5a5fc0855946c66e7d480e 100644 (file)
@@ -247,66 +247,11 @@ public class PortMappingVersion221 {
                 List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
                 portList.sort(Comparator.comparing(Ports::getPortName));
                 for (Ports port : portList) {
                 List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
                 portList.sort(Comparator.comparing(Ports::getPortName));
                 for (Ports port : portList) {
-                    if (port.getPortQual() == null) {
-                        LOG.warn("{} : port {} on {} - PortQual was not found",
-                                nodeId, port.getPortName(), circuitPackName);
-                        continue;
-                    }
-
-                    switch (port.getPortQual()) {
-
-                        case XpdrClient:
-                        case SwitchClient:
-                            String lcp0 = createXpdrLogicalConnectionPort(1, client, StringConstants.CLIENT_TOKEN);
-                            lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
-                            mappingMap.put(lcp0,
-                                createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
-                            client++;
-                            //continue;
-                            break;
-
-                        case XpdrNetwork:
-                        case SwitchNetwork:
-                            switch (port.getPortDirection()) {
-
-                                case Bidirectional:
-                                    String lcp =
-                                        createXpdrLogicalConnectionPort(1, line, StringConstants.NETWORK_TOKEN);
-                                    lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
-                                    mappingMap.put(lcp,
-                                        createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null,
-                                            null)
-                                    );
-                                    line++;
-                                    break;
-
-                                case Rx:
-                                case Tx:
-                                    StringBuilder circuitPackName2 = new StringBuilder();
-                                    Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
-                                        circuitPackList, lcpMap);
-
-                                    if (port2 == null) {
-                                        //key already present or an error occured and was logged
-                                        continue;
-                                    }
-
-                                    putXpdrLcpsInMaps(line, nodeId, 1, null,
-                                            circuitPackName, circuitPackName2.toString(), port, port2,
-                                            lcpMap, mappingMap);
-                                    line += 2;
-                                    break;
-
-                                default:
-                                    LOG.error("{} : port {} on {} - unsupported Direction {}",
-                                        nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
-                            }
-                            break;
-
-                        default:
-                            LOG.error("{} : port {} on {} - unsupported PortQual {}",
-                                nodeId, port.getPortName(), circuitPackName, port.getPortQual());
-                    }
+                    int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
+                        1, null, circuitPackName, port,
+                        circuitPackList, lcpMap, mappingMap);
+                    line = counters[0];
+                    client = counters[1];
                 }
             }
         } else {
                 }
             }
         } else {
@@ -343,66 +288,11 @@ public class PortMappingVersion221 {
                             .findFirst().get().nonnullPorts().values().stream()
                             .filter(p -> p.getPortName().equals(portName))
                             .findFirst().get();
                             .findFirst().get().nonnullPorts().values().stream()
                             .filter(p -> p.getPortName().equals(portName))
                             .findFirst().get();
-                    if (port.getPortQual() == null) {
-                        LOG.warn("{} : port {} on {} - PortQual was not found",
-                                nodeId, port.getPortName(), circuitPackName);
-                        continue;
-                    }
-
-                    switch (port.getPortQual()) {
-
-                        case XpdrClient:
-                        case SwitchClient:
-                            String lcp0 =
-                                    createXpdrLogicalConnectionPort(xponderNb, client, StringConstants.CLIENT_TOKEN);
-                            lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
-                            mappingMap.put(lcp0,
-                                createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
-                            client++;
-                            //continue;
-                            break;
-
-                        case XpdrNetwork:
-                        case SwitchNetwork:
-                            switch (port.getPortDirection()) {
-
-                                case Bidirectional:
-                                    String lcp =
-                                        createXpdrLogicalConnectionPort(xponderNb, line, StringConstants.NETWORK_TOKEN);
-                                    lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
-                                    mappingMap.put(lcp,
-                                        createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null,
-                                            xponderType));
-                                    line++;
-                                    break;
-
-                                case Rx:
-                                case Tx:
-                                    StringBuilder circuitPackName2 = new StringBuilder();
-                                    Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
-                                        circuitPackList, lcpMap);
-
-                                    if (port2 == null) {
-                                        //key already present or an error occured and was logged
-                                        continue;
-                                    }
-
-                                    putXpdrLcpsInMaps(line, nodeId, xponderNb, xponderType,
-                                            circuitPackName, circuitPackName2.toString(), port, port2,
-                                            lcpMap, mappingMap);
-                                    line += 2;
-                                    break;
-
-                                default:
-                                    LOG.error("{} : port {} on {} - unsupported Direction {}",
-                                        nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
-                            }
-                            break;
-
-                        default:
-                            LOG.error("{} : port {} on {} - unsupported PortQual {}",
-                                nodeId, port.getPortName(), circuitPackName, port.getPortQual());
-                    }
+                    int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
+                        xponderNb, xponderType, circuitPackName, port,
+                        circuitPackList, lcpMap, mappingMap);
+                    line = counters[0];
+                    client = counters[1];
                 }
             }
         }
                 }
             }
         }
@@ -1023,9 +913,84 @@ public class PortMappingVersion221 {
         return;
     }
 
         return;
     }
 
-    private boolean createMcCapabilitiesList(String nodeId, Info deviceInfo,
-        Map<McCapabilitiesKey, McCapabilities> mcCapabilitiesMap) {
+    private int[] fillXpdrLcpsMaps(int line, int client, String nodeId,
+            Integer xponderNb, XpdrNodeTypes xponderType,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
+        if (port.getPortQual() == null) {
+            LOG.warn("{} : port {} on {} - PortQual was not found",
+                    nodeId, port.getPortName(), circuitPackName);
+            return new int[] {line, client};
+        }
+
+        switch (port.getPortQual()) {
+
+            case XpdrClient:
+            case SwitchClient:
+                String lcp0 = createXpdrLogicalConnectionPort(xponderNb, client, StringConstants.CLIENT_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
+                mappingMap.put(lcp0,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
+                client++;
+                break;
+
+            case XpdrNetwork:
+            case SwitchNetwork:
+                line = fillXpdrNetworkLcpsMaps(line, nodeId,
+                        xponderNb, xponderType,
+                        circuitPackName,  port,
+                        circuitPackList,  lcpMap, mappingMap);
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported PortQual {}",
+                        nodeId, port.getPortName(), circuitPackName, port.getPortQual());
+        }
+        return new int[] {line, client};
+    }
+
+    private int fillXpdrNetworkLcpsMaps(int line, String nodeId,
+            Integer xponderNb, XpdrNodeTypes xponderType,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
+
+        switch (port.getPortDirection()) {
 
 
+            case Bidirectional:
+                String lcp = createXpdrLogicalConnectionPort(xponderNb, line, StringConstants.NETWORK_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
+                mappingMap.put(lcp,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null, xponderType));
+                line++;
+                break;
+
+            case Rx:
+            case Tx:
+                StringBuilder circuitPackName2 = new StringBuilder();
+                Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
+                        circuitPackList, lcpMap);
+
+                if (port2 == null) {
+                     //key already present or an error occured and was logged
+                    return line;
+                }
+
+                putXpdrLcpsInMaps(line, nodeId, xponderNb, xponderType,
+                        circuitPackName, circuitPackName2.toString(), port, port2,
+                        lcpMap, mappingMap);
+                line += 2;
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported Direction {}",
+                     nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
+        }
+
+        return line;
+    }
+
+    private boolean createMcCapabilitiesList(String nodeId, Info deviceInfo,
+            Map<McCapabilitiesKey, McCapabilities> mcCapabilitiesMap) {
         Map<Integer, Degree> degrees = getDegreesMap(nodeId, deviceInfo);
         List<SharedRiskGroup> srgs = getSrgs(nodeId, deviceInfo);
         mcCapabilitiesMap.putAll(getMcCapabilities(degrees, srgs, nodeId));
         Map<Integer, Degree> degrees = getDegreesMap(nodeId, deviceInfo);
         List<SharedRiskGroup> srgs = getSrgs(nodeId, deviceInfo);
         mcCapabilitiesMap.putAll(getMcCapabilities(degrees, srgs, nodeId));
index a7b7cba01362b055d4e007884bdd0db88e3babd7..ddd698a6c422efc98a43ee9d750a01fb768252b5 100644 (file)
@@ -246,66 +246,11 @@ public class PortMappingVersion710 {
                 List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
                 portList.sort(Comparator.comparing(Ports::getPortName));
                 for (Ports port : portList) {
                 List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
                 portList.sort(Comparator.comparing(Ports::getPortName));
                 for (Ports port : portList) {
-                    if (port.getPortQual() == null) {
-                        LOG.warn("{} : port {} on {} - PortQual was not found",
-                                nodeId, port.getPortName(), circuitPackName);
-                        continue;
-                    }
-
-                    switch (port.getPortQual()) {
-
-                        case XpdrClient:
-                        case SwitchClient:
-                            String lcp0 = createXpdrLogicalConnectionPort(1, client, StringConstants.CLIENT_TOKEN);
-                            lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
-                            mappingMap.put(lcp0,
-                                createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
-                            client++;
-                            //continue;
-                            break;
-
-                        case XpdrNetwork:
-                        case SwitchNetwork:
-                            switch (port.getPortDirection()) {
-
-                                case Bidirectional:
-                                    String lcp =
-                                        createXpdrLogicalConnectionPort(1, line, StringConstants.NETWORK_TOKEN);
-                                    lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
-                                    mappingMap.put(lcp,
-                                        createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null,
-                                            null)
-                                    );
-                                    line++;
-                                    break;
-
-                                case Rx:
-                                case Tx:
-                                    StringBuilder circuitPackName2 = new StringBuilder();
-                                    Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
-                                        circuitPackList, lcpMap);
-
-                                    if (port2 == null) {
-                                        //key already present or an error occured and was logged
-                                        continue;
-                                    }
-
-                                    putXpdrLcpsInMaps(line, nodeId, 1, null,
-                                            circuitPackName, circuitPackName2.toString(), port, port2,
-                                            lcpMap, mappingMap);
-                                    line += 2;
-                                    break;
-
-                                default:
-                                    LOG.error("{} : port {} on {} - unsupported Direction {}",
-                                        nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
-                            }
-                            break;
-
-                        default:
-                            LOG.error("{} : port {} on {} - unsupported PortQual {}",
-                                nodeId, port.getPortName(), circuitPackName, port.getPortQual());
-                    }
+                    int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
+                        1, null, circuitPackName, port,
+                        circuitPackList, lcpMap, mappingMap);
+                    line = counters[0];
+                    client = counters[1];
                 }
             }
         } else {
                 }
             }
         } else {
@@ -342,66 +287,11 @@ public class PortMappingVersion710 {
                             .findFirst().get().nonnullPorts().values().stream()
                             .filter(p -> p.getPortName().equals(portName))
                             .findFirst().get();
                             .findFirst().get().nonnullPorts().values().stream()
                             .filter(p -> p.getPortName().equals(portName))
                             .findFirst().get();
-                    if (port.getPortQual() == null) {
-                        LOG.warn("{} : port {} on {} - PortQual was not found",
-                                nodeId, port.getPortName(), circuitPackName);
-                        continue;
-                    }
-
-                    switch (port.getPortQual()) {
-
-                        case XpdrClient:
-                        case SwitchClient:
-                            String lcp0 =
-                                createXpdrLogicalConnectionPort(xponderNb , client, StringConstants.CLIENT_TOKEN);
-                            lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
-                            mappingMap.put(lcp0,
-                                createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
-                            client++;
-                            //continue;
-                            break;
-
-                        case XpdrNetwork:
-                        case SwitchNetwork:
-                            switch (port.getPortDirection()) {
-
-                                case Bidirectional:
-                                    String lcp =
-                                        createXpdrLogicalConnectionPort(xponderNb, line, StringConstants.NETWORK_TOKEN);
-                                    lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
-                                    mappingMap.put(lcp,
-                                        createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null,
-                                            xponderType));
-                                    line++;
-                                    break;
-
-                                case Rx:
-                                case Tx:
-                                    StringBuilder circuitPackName2 = new StringBuilder();
-                                    Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
-                                        circuitPackList, lcpMap);
-
-                                    if (port2 == null) {
-                                        //key already present or an error occured and was logged
-                                        continue;
-                                    }
-
-                                    putXpdrLcpsInMaps(line, nodeId, xponderNb, xponderType,
-                                            circuitPackName, circuitPackName2.toString(), port, port2,
-                                            lcpMap, mappingMap);
-                                    line += 2;
-                                    break;
-
-                                default:
-                                    LOG.error("{} : port {} on {} - unsupported Direction {}",
-                                        nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
-                            }
-                            break;
-
-                        default:
-                            LOG.error("{} : port {} on {} - unsupported PortQual {}",
-                                nodeId, port.getPortName(), circuitPackName, port.getPortQual());
-                    }
+                    int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
+                        xponderNb, xponderType, circuitPackName, port,
+                        circuitPackList, lcpMap, mappingMap);
+                    line = counters[0];
+                    client = counters[1];
                 }
             }
         }
                 }
             }
         }
@@ -1062,9 +952,85 @@ public class PortMappingVersion710 {
         return;
     }
 
         return;
     }
 
-    private boolean createMcCapabilitiesList(String nodeId, Info deviceInfo,
-        Map<McCapabilitiesKey, McCapabilities> mcCapabilitiesMap) {
+    private int[] fillXpdrLcpsMaps(int line, int client, String nodeId,
+            Integer xponderNb, XpdrNodeTypes xponderType,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
 
 
+        if (port.getPortQual() == null) {
+            LOG.warn("{} : port {} on {} - PortQual was not found",
+                    nodeId, port.getPortName(), circuitPackName);
+            return new int[] {line, client};
+        }
+
+        switch (port.getPortQual()) {
+
+            case XpdrClient:
+            case SwitchClient:
+                String lcp0 = createXpdrLogicalConnectionPort(xponderNb, client, StringConstants.CLIENT_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
+                mappingMap.put(lcp0,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
+                client++;
+                break;
+
+            case XpdrNetwork:
+            case SwitchNetwork:
+                line = fillXpdrNetworkLcpsMaps(line, nodeId,
+                        xponderNb, xponderType,
+                        circuitPackName,  port,
+                        circuitPackList,  lcpMap, mappingMap);
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported PortQual {}",
+                        nodeId, port.getPortName(), circuitPackName, port.getPortQual());
+        }
+        return new int[] {line, client};
+    }
+
+    private int fillXpdrNetworkLcpsMaps(int line, String nodeId,
+            Integer xponderNb, XpdrNodeTypes xponderType,
+            String circuitPackName,  Ports port,
+            List<CircuitPacks> circuitPackList, Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
+
+        switch (port.getPortDirection()) {
+
+            case Bidirectional:
+                String lcp = createXpdrLogicalConnectionPort(xponderNb, line, StringConstants.NETWORK_TOKEN);
+                lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
+                mappingMap.put(lcp,
+                    createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null, xponderType));
+                line++;
+                break;
+
+            case Rx:
+            case Tx:
+                StringBuilder circuitPackName2 = new StringBuilder();
+                Ports port2 = getPort2(port, nodeId, circuitPackName, circuitPackName2,
+                        circuitPackList, lcpMap);
+
+                if (port2 == null) {
+                     //key already present or an error occured and was logged
+                    return line;
+                }
+
+                putXpdrLcpsInMaps(line, nodeId, xponderNb, xponderType,
+                        circuitPackName, circuitPackName2.toString(), port, port2,
+                        lcpMap, mappingMap);
+                line += 2;
+                break;
+
+            default:
+                LOG.error("{} : port {} on {} - unsupported Direction {}",
+                     nodeId, port.getPortName(), circuitPackName, port.getPortDirection());
+        }
+
+        return line;
+    }
+
+    private boolean createMcCapabilitiesList(String nodeId, Info deviceInfo,
+            Map<McCapabilitiesKey, McCapabilities> mcCapabilitiesMap) {
         Map<Integer, Degree> degrees = getDegreesMap(nodeId, deviceInfo);
         List<SharedRiskGroup> srgs = getSrgs(nodeId, deviceInfo);
         mcCapabilitiesMap.putAll(getMcCapabilities(degrees, srgs, deviceInfo, nodeId));
         Map<Integer, Degree> degrees = getDegreesMap(nodeId, deviceInfo);
         List<SharedRiskGroup> srgs = getSrgs(nodeId, deviceInfo);
         mcCapabilitiesMap.putAll(getMcCapabilities(degrees, srgs, deviceInfo, nodeId));