Add and fix Phosphorus lighty.io support
[transportpce.git] / lighty / src / main / java / io / lighty / controllers / tpce / module / TransportPCEImpl.java
index f0542376a91d7d4d80e34280dbf051bd24245ba1..7a8da833bf3117d0fc0355cd70958d30104c6f63 100644 (file)
@@ -141,9 +141,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
                 deviceTransactionManager, networkTransaction);
         TransportpceNetworkutilsService networkutilsServiceImpl = new NetworkUtilsImpl(
                 lightyServices.getBindingDataBroker());
-        MappingUtils mappingUtils = new MappingUtilsImpl(lightyServices.getBindingDataBroker());
-        OpenRoadmInterfaces openRoadmInterfaces = initOpenRoadmInterfaces(mappingUtils);
-        PortMapping portMapping = initPortMapping(lightyServices, openRoadmInterfaces);
+        PortMapping portMapping = initPortMapping(lightyServices);
         NetworkModelService networkModelService = new NetworkModelServiceImpl(networkTransaction, linkDiscoveryImpl,
                 portMapping, lightyServices.getBindingNotificationPublishService());
         FrequenciesService networkModelWavelengthService =
@@ -168,7 +166,9 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
         pceProvider = new PceProvider(lightyServices.getRpcProviderService(), pathComputationService);
 
         LOG.info("Creating OLM beans ...");
+        MappingUtils mappingUtils = new MappingUtilsImpl(lightyServices.getBindingDataBroker());
         CrossConnect crossConnect = initCrossConnect(mappingUtils);
+        OpenRoadmInterfaces openRoadmInterfaces = initOpenRoadmInterfaces(mappingUtils, portMapping);
         PowerMgmt powerMgmt = new PowerMgmtImpl(lightyServices.getBindingDataBroker(), openRoadmInterfaces,
                 crossConnect, deviceTransactionManager, olmtimer1, olmtimer2);
         OlmPowerService olmPowerService = new OlmPowerServiceImpl(lightyServices.getBindingDataBroker(), powerMgmt,
@@ -210,6 +210,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
                 networkModelListenerImpl, servicehandler);
 
         LOG.info("Creating tapi beans ...");
+        TapiLink tapiLink = new TapiLink(networkTransaction);
         R2RTapiLinkDiscovery tapilinkDiscoveryImpl = new R2RTapiLinkDiscovery(networkTransaction,
             deviceTransactionManager, tapiLink);
         TapiRendererListenerImpl tapiRendererListenerImpl = new TapiRendererListenerImpl(lightyServices
@@ -324,22 +325,22 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
             openRoadmInterface710, openRoadmOtnInterface221, openRoadmOtnInterface710);
     }
 
-    private PortMapping initPortMapping(LightyServices lightyServices, OpenRoadmInterfaces openRoadmInterfaces) {
+    private PortMapping initPortMapping(LightyServices lightyServices) {
         PortMappingVersion710 portMappingVersion710 = new PortMappingVersion710(lightyServices.getBindingDataBroker(),
-            deviceTransactionManager, openRoadmInterfaces);
+                deviceTransactionManager);
         PortMappingVersion221 portMappingVersion221 = new PortMappingVersion221(lightyServices.getBindingDataBroker(),
-                deviceTransactionManager, openRoadmInterfaces);
+                deviceTransactionManager);
         PortMappingVersion121 portMappingVersion121 = new PortMappingVersion121(lightyServices.getBindingDataBroker(),
-                deviceTransactionManager, openRoadmInterfaces);
+                deviceTransactionManager);
         return new PortMappingImpl(lightyServices.getBindingDataBroker(), portMappingVersion710,
             portMappingVersion221, portMappingVersion121);
     }
 
-    private OpenRoadmInterfaces initOpenRoadmInterfaces(MappingUtils mappingUtils) {
+    private OpenRoadmInterfaces initOpenRoadmInterfaces(MappingUtils mappingUtils, PortMapping portMapping) {
         OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(
                 deviceTransactionManager);
         OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(
-                deviceTransactionManager);
+                deviceTransactionManager, portMapping, portMapping.getPortMappingVersion221());
         OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710 = new OpenRoadmInterfacesImpl710(
             deviceTransactionManager);
         return new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils, openRoadmInterfacesImpl121,