Do not use RpcService in TPCE networkmodel module
[transportpce.git] / lighty / src / main / java / io / lighty / controllers / tpce / module / TransportPCEImpl.java
index 883b5b42d7e82b25dae03b2302363fc18e749152..f0f17c0a74011d303db83b4eda3499da448d547c 100644 (file)
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at https://www.eclipse.org/legal/epl-v10.html
  */
-
 package io.lighty.controllers.tpce.module;
 
 import io.lighty.core.controller.api.AbstractLightyModule;
 import io.lighty.core.controller.api.LightyServices;
+import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221;
+import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl710;
 import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
-import org.opendaylight.transportpce.common.fixedflex.FixedFlexImpl;
+import org.opendaylight.transportpce.common.mapping.MappingUtils;
 import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl;
+import org.opendaylight.transportpce.common.mapping.PortMapping;
 import org.opendaylight.transportpce.common.mapping.PortMappingImpl;
 import org.opendaylight.transportpce.common.mapping.PortMappingVersion121;
 import org.opendaylight.transportpce.common.mapping.PortMappingVersion221;
+import org.opendaylight.transportpce.common.mapping.PortMappingVersion710;
 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
-import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl121;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl221;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl710;
+import org.opendaylight.transportpce.nbinotifications.impl.NbiNotificationsProvider;
 import org.opendaylight.transportpce.networkmodel.NetConfTopologyListener;
 import org.opendaylight.transportpce.networkmodel.NetworkModelProvider;
 import org.opendaylight.transportpce.networkmodel.NetworkUtilsImpl;
-import org.opendaylight.transportpce.networkmodel.R2RLinkDiscovery;
+import org.opendaylight.transportpce.networkmodel.listeners.PortMappingListener;
+import org.opendaylight.transportpce.networkmodel.service.FrequenciesServiceImpl;
+import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
 import org.opendaylight.transportpce.networkmodel.service.NetworkModelServiceImpl;
-// OpenRoadmFctory and OpenRoadmTopology22 has been deleted
-import org.opendaylight.transportpce.networkmodel.util.OpenRoadmTopology;
-
 import org.opendaylight.transportpce.olm.OlmPowerServiceRpcImpl;
 import org.opendaylight.transportpce.olm.OlmProvider;
-import org.opendaylight.transportpce.olm.power.PowerMgmt;
 import org.opendaylight.transportpce.olm.power.PowerMgmtImpl;
 import org.opendaylight.transportpce.olm.service.OlmPowerServiceImpl;
+import org.opendaylight.transportpce.pce.gnpy.consumer.GnpyConsumerImpl;
 import org.opendaylight.transportpce.pce.impl.PceProvider;
+import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
-import org.opendaylight.transportpce.renderer.NetworkModelWavelengthServiceImpl;
 import org.opendaylight.transportpce.renderer.RendererProvider;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
-// Adding OTN interface
-import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface221;
-
 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
+// Adding OTN interface
+import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
 import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererServiceImpl;
+import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
 // Add OTN
 import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererServiceImpl;
-
+import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperationsImpl;
 import org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl;
-
+import org.opendaylight.transportpce.renderer.rpcs.TransportPCEServicePathRPCImpl;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperationsImpl;
+import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerProvider;
+import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.ServiceListener;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
+import org.opendaylight.transportpce.tapi.impl.TapiProvider;
+import org.opendaylight.transportpce.tapi.listeners.TapiNetworkModelListenerImpl;
+import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelService;
+import org.opendaylight.transportpce.tapi.topology.TapiNetworkModelServiceImpl;
+import org.opendaylight.transportpce.tapi.topology.TapiNetworkUtilsImpl;
+import org.opendaylight.transportpce.tapi.utils.TapiLink;
+import org.opendaylight.transportpce.tapi.utils.TapiLinkImpl;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TransportPCEImpl extends AbstractLightyModule implements TransportPCE {
 
+public class TransportPCEImpl extends AbstractLightyModule implements TransportPCE {
     private static final Logger LOG = LoggerFactory.getLogger(TransportPCEImpl.class);
-    private static final long MaxDurationToSubmitTransaction = 1500;
-
-    // common beans
+    private static final long MAX_TIME_FOR_TRANSACTION = 1500;
+    // transaction beans
+    // cannot use interface for DeviceTransactionManagerImpl
+    // because implementation has additional public methods ...
     private final DeviceTransactionManagerImpl deviceTransactionManager;
-    private final MappingUtilsImpl mappingUtils;
-    private final OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
-    private final OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
-    private final OpenRoadmInterfacesImpl openRoadmInterfaces;
-    private final PortMappingVersion221 portMappingVersion221;
-    private final RequestProcessor requestProcessor;
-    private final NetworkTransactionImpl networkTransaction;
-    private final PortMappingVersion121 portMappingVersion121;
-    private final PortMappingImpl portMapping;
-    private final CrossConnectImpl121 crossConnectImpl121;
-    private final CrossConnectImpl221 crossConnectImpl221;
-    private final CrossConnectImpl crossConnect;
-    private final FixedFlexImpl fixedFlex;
-
+    private final NetworkTransactionService networkTransaction;
     // pce beans
-    private final PathComputationServiceImpl pathComputationService;
     private final PceProvider pceProvider;
-
     // network model beans
-    // private final OpenRoadmTopology22 openRoadmTopology22;
-    // private final OpenRoadmFactory openRoadmFactory;
-    // private final OpenRoadmTopology openRoadmTopology;
-
-    private final R2RLinkDiscovery linkDiscoveryImpl;
-    private final NetworkUtilsImpl networkutilsServiceImpl;
-    private final NetworkModelServiceImpl networkModelService;
-    private final NetConfTopologyListener netConfTopologyListener;
     private final NetworkModelProvider networkModelProvider;
-
     // OLM beans
-    private final PowerMgmt powerMgmt;
-    private final OlmPowerServiceImpl olmPowerService;
     private final OlmProvider olmProvider;
-    private final OlmPowerServiceRpcImpl olmPowerServiceRpc;
-
     // renderer beans
-    private final OpenRoadmInterface121 openRoadmInterface121;
-    private final OpenRoadmInterface221 openRoadmInterface221;
-    private final OpenRoadmOtnInterface221 openRoadmOtnInterface221;
-
-    private final OpenRoadmInterfaceFactory openRoadmInterfaceFactory;
-    private final DeviceRendererServiceImpl deviceRendererService;
-    private final OtnDeviceRendererServiceImpl otnDeviceRendererService;
-    private final DeviceRendererRPCImpl deviceRendererRPC;
-    private final NetworkModelWavelengthServiceImpl networkModelWavelengthService;
-    private final RendererServiceOperationsImpl rendererServiceOperations;
     private final RendererProvider rendererProvider;
-
     // service-handler beans
     private final ServicehandlerProvider servicehandlerProvider;
+    // T-api
+    private TapiProvider tapiProvider;
+    // nbi-notifications beans
+    private NbiNotificationsProvider nbiNotificationsProvider;
 
-    public TransportPCEImpl(LightyServices lightyServices) {
-        LOG.info("Creating common beans ...");
-        deviceTransactionManager = new DeviceTransactionManagerImpl(lightyServices.getBindingMountPointService(), MaxDurationToSubmitTransaction);
-        mappingUtils = new MappingUtilsImpl(lightyServices.getBindingDataBroker());
-        openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(deviceTransactionManager);
-        openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(deviceTransactionManager);
-        openRoadmInterfaces = new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils, openRoadmInterfacesImpl121, openRoadmInterfacesImpl221);
-        portMappingVersion221 = new PortMappingVersion221(lightyServices.getBindingDataBroker(), deviceTransactionManager, openRoadmInterfaces);
-        requestProcessor = new RequestProcessor(lightyServices.getBindingDataBroker());
-        networkTransaction = new NetworkTransactionImpl(requestProcessor);
-        portMappingVersion121 = new PortMappingVersion121(lightyServices.getBindingDataBroker(), deviceTransactionManager, openRoadmInterfaces);
-        portMapping = new PortMappingImpl(lightyServices.getBindingDataBroker(), portMappingVersion221, portMappingVersion121);
-        crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
-        crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
-        crossConnect = new CrossConnectImpl(deviceTransactionManager, mappingUtils, crossConnectImpl121, crossConnectImpl221);
-        fixedFlex = new FixedFlexImpl();
-
-        LOG.info("Creating PCE beans ...");
-        pathComputationService = new PathComputationServiceImpl(networkTransaction, lightyServices.getBindingNotificationPublishService());
-        pceProvider = new PceProvider(lightyServices.getRpcProviderService(), pathComputationService);
+    public TransportPCEImpl(
+            LightyServices lightyServices, boolean activateNbiNotification, boolean activateTapi,
+            String olmtimer1, String olmtimer2) {
+        LOG.info("Initializing transaction providers ...");
+        deviceTransactionManager =
+            new DeviceTransactionManagerImpl(lightyServices.getBindingMountPointService(), MAX_TIME_FOR_TRANSACTION);
+        var lgServBDB = lightyServices.getBindingDataBroker();
+        networkTransaction = new NetworkTransactionImpl(lgServBDB);
 
         LOG.info("Creating network-model beans ...");
-        // TODO: Need to look into it
+        PortMapping portMapping = initPortMapping(lightyServices);
+        var lgServBNPS = lightyServices.getBindingNotificationPublishService();
+        NetworkModelService networkModelService = new NetworkModelServiceImpl(
+                lgServBDB,
+                deviceTransactionManager, networkTransaction, portMapping,
+                lgServBNPS);
+        new NetConfTopologyListener(
+                networkModelService, lgServBDB, deviceTransactionManager, portMapping);
+        new PortMappingListener(networkModelService);
+        var lgServRPS = lightyServices.getRpcProviderService();
+        var lgServNS = lightyServices.getNotificationService();
+        new NetworkUtilsImpl(lgServBDB, lgServRPS);
+        networkModelProvider = new NetworkModelProvider(
+                networkTransaction,
+                lgServBDB,
+                networkModelService, deviceTransactionManager, portMapping,
+                lgServNS,
+                new FrequenciesServiceImpl(lgServBDB));
 
-
-
-        // TODO: Add OTN network model
-        //
-        linkDiscoveryImpl = new R2RLinkDiscovery(lightyServices.getBindingDataBroker(), deviceTransactionManager, networkTransaction);
-        networkutilsServiceImpl = new NetworkUtilsImpl(lightyServices.getBindingDataBroker());
-        networkModelService = new NetworkModelServiceImpl(networkTransaction, linkDiscoveryImpl, portMapping);
-        netConfTopologyListener = new NetConfTopologyListener(networkModelService, lightyServices.getBindingDataBroker(), deviceTransactionManager);
-        networkModelProvider = new NetworkModelProvider(networkTransaction, lightyServices.getBindingDataBroker(),
-            lightyServices.getRpcProviderService(), networkutilsServiceImpl, netConfTopologyListener);
+        LOG.info("Creating PCE beans ...");
+        // TODO: pass those parameters through command line
+        PathComputationService pathComputationService = new PathComputationServiceImpl(
+                networkTransaction,
+                lgServBNPS,
+                new GnpyConsumerImpl(
+                    "http://127.0.0.1:8008", "gnpy", "gnpy", lightyServices.getAdapterContext().currentSerializer()),
+                portMapping);
+        pceProvider = new PceProvider(lgServRPS, pathComputationService);
 
         LOG.info("Creating OLM beans ...");
-        powerMgmt = new PowerMgmtImpl(lightyServices.getBindingDataBroker(), openRoadmInterfaces, crossConnect, deviceTransactionManager);
-        olmPowerService = new OlmPowerServiceImpl(lightyServices.getBindingDataBroker(), powerMgmt, deviceTransactionManager, portMapping, mappingUtils, openRoadmInterfaces);
-        olmProvider = new OlmProvider(lightyServices.getRpcProviderService(), olmPowerService);
-        olmPowerServiceRpc = new OlmPowerServiceRpcImpl(olmPowerService);
-
+        MappingUtils mappingUtils = new MappingUtilsImpl(lgServBDB);
+        CrossConnect crossConnect = initCrossConnect(mappingUtils);
+        OpenRoadmInterfaces openRoadmInterfaces = initOpenRoadmInterfaces(mappingUtils, portMapping);
+        TransportpceOlmService olmPowerServiceRpc = new OlmPowerServiceRpcImpl(
+            new OlmPowerServiceImpl(
+                lgServBDB,
+                new PowerMgmtImpl(
+                    openRoadmInterfaces, crossConnect, deviceTransactionManager,
+                    portMapping, Long.valueOf(olmtimer1).longValue(), Long.valueOf(olmtimer2).longValue()),
+                deviceTransactionManager, portMapping, mappingUtils, openRoadmInterfaces));
+        olmProvider = new OlmProvider(lgServRPS, olmPowerServiceRpc);
         LOG.info("Creating renderer beans ...");
-        openRoadmInterface121 = new OpenRoadmInterface121(portMapping, openRoadmInterfaces);
-        openRoadmInterface221 = new OpenRoadmInterface221(portMapping, openRoadmInterfaces, fixedFlex);
-        openRoadmOtnInterface221 = new OpenRoadmOtnInterface221(portMapping, openRoadmInterfaces);
-        openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(mappingUtils, openRoadmInterface121,
-            openRoadmInterface221, openRoadmOtnInterface221);
-        deviceRendererService = new DeviceRendererServiceImpl(lightyServices.getBindingDataBroker(), deviceTransactionManager,
-            openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect, portMapping, networkModelService);
-        otnDeviceRendererService = new OtnDeviceRendererServiceImpl(openRoadmInterfaceFactory, crossConnect, openRoadmInterfaces,
-            deviceTransactionManager, networkModelService);
-        deviceRendererRPC = new DeviceRendererRPCImpl(deviceRendererService, otnDeviceRendererService);
-        networkModelWavelengthService = new NetworkModelWavelengthServiceImpl(lightyServices.getBindingDataBroker());
-        rendererServiceOperations = new RendererServiceOperationsImpl(deviceRendererService, olmPowerServiceRpc, lightyServices.getBindingDataBroker(), networkModelWavelengthService, lightyServices.getBindingNotificationPublishService());
-        rendererProvider = new RendererProvider(lightyServices.getRpcProviderService(), deviceRendererRPC, rendererServiceOperations);
+        initOpenRoadmFactory(mappingUtils, openRoadmInterfaces, portMapping);
+        DeviceRendererService deviceRendererService = new DeviceRendererServiceImpl(
+                lgServBDB,
+                deviceTransactionManager, openRoadmInterfaces, crossConnect,
+                mappingUtils, portMapping);
+        OtnDeviceRendererService otnDeviceRendererService = new OtnDeviceRendererServiceImpl(
+                crossConnect, openRoadmInterfaces, deviceTransactionManager, mappingUtils, portMapping);
+        rendererProvider = initRenderer(
+                lightyServices, olmPowerServiceRpc, deviceRendererService, otnDeviceRendererService, portMapping);
 
         LOG.info("Creating service-handler beans ...");
-        servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
-                pathComputationService, rendererServiceOperations, networkModelWavelengthService, lightyServices.getBindingNotificationPublishService());
-
+        RendererServiceOperations rendererServiceOperations = new RendererServiceOperationsImpl(
+                deviceRendererService, otnDeviceRendererService, olmPowerServiceRpc,
+                lgServBDB,
+                lgServBNPS,
+                portMapping);
+        ServiceDataStoreOperations serviceDataStoreOperations =
+            new ServiceDataStoreOperationsImpl(lgServBDB);
+        RendererListenerImpl rendererListenerImpl =
+            new RendererListenerImpl(pathComputationService, lgServBNPS, networkModelService);
+        PceListenerImpl pceListenerImpl = new PceListenerImpl(
+                rendererServiceOperations, pathComputationService,
+                lgServBNPS, serviceDataStoreOperations);
+        NetworkModelListenerImpl networkModelListenerImpl = new NetworkModelListenerImpl(
+                lgServBNPS, serviceDataStoreOperations);
+        OrgOpenroadmServiceService servicehandler = new ServicehandlerImpl(
+                pathComputationService, rendererServiceOperations,
+                lgServBNPS, pceListenerImpl,
+                rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations,
+                new CatalogDataStoreOperationsImpl(networkTransaction));
+        servicehandlerProvider = new ServicehandlerProvider(
+                lgServBDB, lgServRPS,
+                lgServNS, serviceDataStoreOperations, pceListenerImpl,
+                rendererListenerImpl, networkModelListenerImpl, lgServBNPS,
+                servicehandler,
+                new ServiceListener(
+                    servicehandler, serviceDataStoreOperations, lgServBNPS));
+        if (activateTapi) {
+            LOG.info("Creating tapi beans ...");
+            TapiLink tapiLink = new TapiLinkImpl(networkTransaction);
+            new TapiNetworkUtilsImpl(networkTransaction, tapiLink);
+            tapiProvider = initTapi(
+                    lightyServices, servicehandler, networkTransaction, serviceDataStoreOperations,
+                    new TapiNetworkModelListenerImpl(
+                        networkTransaction, lgServBNPS),
+                    tapiLink,
+                    new TapiNetworkModelServiceImpl(
+                        networkTransaction, deviceTransactionManager, tapiLink,
+                        lgServBNPS));
+        }
+        if (activateNbiNotification) {
+            LOG.info("Creating nbi-notifications beans ...");
+            nbiNotificationsProvider = new NbiNotificationsProvider(
+                    null, null, lgServRPS,
+                    lgServNS, lightyServices.getAdapterContext().currentSerializer(),
+                    networkTransaction);
+        }
     }
 
     @Override
     protected boolean initProcedure() {
-        LOG.info("Initializing common beans ...");
-        LOG.info("Initializing PCE beans ...");
-        pathComputationService.init();
-        pceProvider.init();
-        LOG.info("Initializing network-model beans ...");
-        networkModelProvider.init();
-        LOG.info("Initializing OLM beans ...");
-        olmPowerService.init();
-        olmProvider.init();
-        LOG.info("Initializing renderer beans ...");
-        rendererProvider.init();
-        LOG.info("Initializing service-handler beans ...");
-        servicehandlerProvider.init();
+        if (tapiProvider != null) {
+            LOG.info("Initializing tapi provider ...");
+        }
+        if (nbiNotificationsProvider != null) {
+            LOG.info("Initializing nbi-notifications provider ...");
+        }
         LOG.info("Init done.");
         return true;
     }
 
     @Override
     protected boolean stopProcedure() {
-        LOG.info("Shutting down service-handler beans ...");
+        if (nbiNotificationsProvider != null) {
+            nbiNotificationsProvider.close();
+            LOG.info("Shutting down nbi-notifications provider ...");
+        }
+        if (tapiProvider != null) {
+            tapiProvider.close();
+            LOG.info("Shutting down service-handler provider ...");
+        }
         servicehandlerProvider.close();
-        LOG.info("Shutting down renderer beans ...");
+        LOG.info("Shutting down renderer provider ...");
         rendererProvider.close();
-        LOG.info("Shutting down OLM beans ...");
+        LOG.info("Shutting down OLM provider ...");
         olmProvider.close();
-        olmPowerService.close();
-        LOG.info("Shutting down network-model beans ...");
+        LOG.info("Shutting down network-model provider ...");
         networkModelProvider.close();
-        LOG.info("Shutting down PCE beans ...");
-        pathComputationService.close();
+        LOG.info("Shutting down PCE provider ...");
         pceProvider.close();
-        LOG.info("Shutting down common beans ...");
-        networkTransaction.close();
+        LOG.info("Shutting down transaction providers ...");
         deviceTransactionManager.preDestroy();
         LOG.info("Shutdown done.");
         return true;
     }
 
+    private TapiProvider initTapi(
+            LightyServices lightyServices, OrgOpenroadmServiceService servicehandler,
+            NetworkTransactionService networkTransactionService, ServiceDataStoreOperations serviceDataStoreOperations,
+            TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl, TapiLink tapiLink,
+            TapiNetworkModelService tapiNetworkModelService) {
+        return new TapiProvider(
+            lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(),
+            lightyServices.getNotificationService(), lightyServices.getBindingNotificationPublishService(),
+            networkTransactionService, servicehandler, serviceDataStoreOperations,
+            new TapiNetworkUtilsImpl(networkTransactionService, tapiLink),
+            tapiNetworkModelListenerImpl, tapiNetworkModelService);
+    }
+
+    private RendererProvider initRenderer(
+            LightyServices lightyServices, TransportpceOlmService olmPowerServiceRpc,
+            DeviceRendererService deviceRendererService, OtnDeviceRendererService otnDeviceRendererService,
+            PortMapping portMapping) {
+        return new RendererProvider(
+            lightyServices.getRpcProviderService(), deviceRendererService,
+            otnDeviceRendererService,
+            new DeviceRendererRPCImpl(deviceRendererService, otnDeviceRendererService),
+            new TransportPCEServicePathRPCImpl(
+                new RendererServiceOperationsImpl(
+                    deviceRendererService, otnDeviceRendererService, olmPowerServiceRpc,
+                    lightyServices.getBindingDataBroker(), lightyServices.getBindingNotificationPublishService(),
+                    portMapping)));
+    }
+
+    private OpenRoadmInterfaceFactory initOpenRoadmFactory(
+            MappingUtils mappingUtils, OpenRoadmInterfaces openRoadmInterfaces, PortMapping portMapping) {
+        return new OpenRoadmInterfaceFactory(mappingUtils, portMapping, openRoadmInterfaces);
+    }
+
+    private PortMapping initPortMapping(LightyServices lightyServices) {
+        PortMappingVersion710 portMappingVersion710 =
+            new PortMappingVersion710(lightyServices.getBindingDataBroker(), deviceTransactionManager);
+        PortMappingVersion221 portMappingVersion221 =
+            new PortMappingVersion221(lightyServices.getBindingDataBroker(), deviceTransactionManager);
+        PortMappingVersion121 portMappingVersion121 =
+            new PortMappingVersion121(lightyServices.getBindingDataBroker(), deviceTransactionManager);
+        return new PortMappingImpl(
+            lightyServices.getBindingDataBroker(), portMappingVersion710, portMappingVersion221, portMappingVersion121);
+    }
+
+    private OpenRoadmInterfaces initOpenRoadmInterfaces(MappingUtils mappingUtils, PortMapping portMapping) {
+        OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121 =
+            new OpenRoadmInterfacesImpl121(deviceTransactionManager);
+        OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221 =
+            new OpenRoadmInterfacesImpl221(deviceTransactionManager, portMapping);
+        OpenRoadmInterfacesImpl710 openRoadmInterfacesImpl710 =
+            new OpenRoadmInterfacesImpl710(deviceTransactionManager, portMapping);
+        return new OpenRoadmInterfacesImpl(
+            deviceTransactionManager, mappingUtils,
+            openRoadmInterfacesImpl121, openRoadmInterfacesImpl221, openRoadmInterfacesImpl710);
+
+    }
+
+    private CrossConnect initCrossConnect(MappingUtils mappingUtils) {
+        CrossConnectImpl121 crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
+        CrossConnectImpl221 crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
+        CrossConnectImpl710 crossConnectImpl710 = new CrossConnectImpl710(deviceTransactionManager);
+        return new CrossConnectImpl(
+            deviceTransactionManager, mappingUtils,
+            crossConnectImpl121, crossConnectImpl221, crossConnectImpl710);
+    }
 }