Fix output response for 400GE device renderer 43/100643/4
authorBalagangadhar Bathula <bb4341@att.com>
Tue, 19 Apr 2022 03:31:02 +0000 (23:31 -0400)
committerBalagangadhar Bathula <bb4341@att.com>
Wed, 27 Apr 2022 11:36:13 +0000 (07:36 -0400)
- Output indicates all the interfaces created,
  OTSI, OTSI-group, OTUC4, ODUC4, ODUFlex and
  Ethernet-client

JIRA: TRNSPRTPCE-606
Change-Id: Ic336a6223b4adc23e0f61b4bc33114af950ddcd9
Signed-off-by: Balagangadhar Bathula <bb4341@att.com>
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java
tests/transportpce_tests/7.1/test02_otn_renderer.py

index 1d72b2552f3f0647cf4c502e946db38046a3bea3..7fa28d5f540f2b0af70899e21b9943051c473005 100644 (file)
@@ -365,9 +365,11 @@ public class OpenRoadmInterface710 {
             // create OCH interface
             interfaceOchOtsiOtsigroup = createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
         } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
-            // Create OTSi and OTSi-group
+            // Create OTSi and OTSi-group and concat the names of the interface
             String interfaceOtsiName = createOpenRoadmOtsiInterface(nodeId, logicalConnPoint, spectrumInformation);
-            interfaceOchOtsiOtsigroup = createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint, interfaceOtsiName,
+            // Concat the two names for this interface
+            interfaceOchOtsiOtsigroup = interfaceOtsiName
+                + "#" + createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint, interfaceOtsiName,
                 spectrumInformation);
         }
 
@@ -877,17 +879,19 @@ public class OpenRoadmInterface710 {
         }
         // Depending on OTU4 or OTUCn, supporting interface should
         // reflect that
-        String interfaceOdu4Oducn = null;
+        String interfaceOdu4OducnOduflex = null;
         if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
             // create OTU4 interface
-            interfaceOdu4Oducn = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
+            interfaceOdu4OducnOduflex = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
         } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
             // Create ODUCn and ODUFlex interface.
             String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
-            interfaceOdu4Oducn = createOpenRoadmOduflexInterface(nodeId, logicalConnPoint, interfaceOducn);
+            // Here we concat the two interfaces
+            interfaceOdu4OducnOduflex = interfaceOducn + "#"
+                + createOpenRoadmOduflexInterface(nodeId, logicalConnPoint, interfaceOducn);
         }
 
-        return interfaceOdu4Oducn;
+        return interfaceOdu4OducnOduflex;
     }
 
     public String createOpenRoadmOtnOducnInterface(String nodeId, String logicalConnPoint,
index fba0a588c94d81cfb4f7cb19d69df8ac8d69bd57..aae347bc25350459005b822edbc461674ed8d11e 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.transportpce.renderer.provisiondevice;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -158,15 +159,23 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
                         crossConnectFlag++;
                         String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
                                 nodeId, destTp, spectrumInformation);
-                        createdOchInterfaces.add(supportingOchInterface);
+                        // Split the string based on # pass the last element as the supported Interface
+                        // This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH
+                        String[] listOfSuppOchInf = supportingOchInterface.split("#");
+                        createdOchInterfaces = Arrays.asList(listOfSuppOchInf);
+                        // Taking the last element
+                        supportingOchInterface = createdOchInterfaces.get(createdOchInterfaces.size() - 1);
                         String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
                                 nodeId, destTp, supportingOchInterface, apiInfoA, apiInfoZ);
                         createdOtuInterfaces.add(supportingOtuInterface);
                         if (srcTp == null) {
                             otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(destTp).build());
                         } else {
-                            createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
-                                    nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07));
+                            // This is needed for 7.1 device models for 400GE, since we have ODUC4 and ODUflex
+                            // are combined
+                            createdOduInterfaces = Arrays.asList(this.openRoadmInterfaceFactory
+                                .createOpenRoadmOdu4HOInterface(
+                                    nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07).split("#"));
                         }
                     }
                     if ((srcTp != null) && srcTp.contains(StringConstants.CLIENT_TOKEN)) {
index 4337f7e695e3748cea80247b512b29944b38e23e..5ca29f374da94767d533484e6b0c5692b7e53d9b 100644 (file)
@@ -86,7 +86,9 @@ class TransportPCE400GPortMappingTesting(unittest.TestCase):
         self.assertIn(
             {'node-id': 'XPDR-A2',
              'otu-interface-id': ['XPDR2-NETWORK1-OTUC2'],
-             'och-interface-id': ['XPDR2-NETWORK1-OTSIGROUP-200G']}, response['output']['node-interface'])
+             'och-interface-id': ['XPDR2-NETWORK1-OTSIGROUP-200G',
+                                  'XPDR2-NETWORK1-755:768']},
+            response['output']['node-interface'])
 
     def test_03_get_portmapping_network1(self):
         response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
@@ -454,7 +456,9 @@ class TransportPCE400GPortMappingTesting(unittest.TestCase):
         self.assertIn(
             {'node-id': 'XPDR-A2',
              'otu-interface-id': ['XPDR2-NETWORK1-OTUC3'],
-             'och-interface-id': ['XPDR2-NETWORK1-OTSIGROUP-300G']}, response['output']['node-interface'])
+             'och-interface-id': ['XPDR2-NETWORK1-755:768',
+                                  'XPDR2-NETWORK1-OTSIGROUP-300G']},
+            response['output']['node-interface'])
 
     def test_27_get_portmapping_network1(self):
         response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
@@ -674,7 +678,9 @@ class TransportPCE400GPortMappingTesting(unittest.TestCase):
         self.assertIn(
             {'node-id': 'XPDR-A2',
              'otu-interface-id': ['XPDR2-NETWORK1-OTUC4'],
-             'och-interface-id': ['XPDR2-NETWORK1-OTSIGROUP-400G']}, response['output']['node-interface'])
+             'och-interface-id': ['XPDR2-NETWORK1-755:768',
+                                  'XPDR2-NETWORK1-OTSIGROUP-400G']},
+            response['output']['node-interface'])
 
     def test_41_get_portmapping_network1(self):
         response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")