Lighty refactor 79/90379/7
authormanuedelf <emmanuelle.delfour@gmail.com>
Wed, 10 Jun 2020 14:25:49 +0000 (16:25 +0200)
committermanuedelf <emmanuelle.delfour@gmail.com>
Thu, 11 Jun 2020 13:25:52 +0000 (15:25 +0200)
- clean pom
- add unit test
- add TpceBanner class to print banner
- add possibility to pass a config file for restconf at startup
- add technicalException to exit application if startup failed
- split TransportPCEImpl constructor
- add checkstyle from odl parent
- fix checkstyle violations

JIRA: TRNSPRTPCE-237
Change-Id: I3956d83ab6f0dfafa57e26058d275c4448a8c95c

lighty/pom.xml
lighty/src/main/java/io/lighty/controllers/tpce/Main.java
lighty/src/main/java/io/lighty/controllers/tpce/exception/TechnicalException.java [new file with mode: 0644]
lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java
lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java
lighty/src/main/java/io/lighty/controllers/tpce/utils/TpceBanner.java [new file with mode: 0644]
lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java [new file with mode: 0644]
lighty/src/test/resources/config.json [new file with mode: 0644]

index a8757eabfaa49296056161be8825a41a4ccebb55..898e445fb2ff289357287ca04e7b1193b5e6b5d3 100644 (file)
             <artifactId>transportpce-api</artifactId>
             <version>${transportpce.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.transportpce.ordmodels</groupId>
-            <artifactId>transportpce-ordmodels-common</artifactId>
-            <version>${transportpce.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.transportpce.ordmodels</groupId>
-            <artifactId>transportpce-ordmodels-device</artifactId>
-            <version>${transportpce.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.transportpce.ordmodels</groupId>
-            <artifactId>transportpce-ordmodels-network</artifactId>
-            <version>${transportpce.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.transportpce.ordmodels</groupId>
-            <artifactId>transportpce-ordmodels-service</artifactId>
-            <version>${transportpce.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.transportpce</groupId>
             <artifactId>transportpce-networkmodel</artifactId>
             <version>${transportpce.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.transportpce</groupId>
-            <artifactId>transportpce-tapimodels</artifactId>
-            <version>${transportpce.version}</version>
-        </dependency>
         <!-- TPCE Models - END -->
 
         <!-- TPCE bundles - BEGIN -->
             <artifactId>lighty-restconf-nb-community</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
     <build>
         <finalName>tpce</finalName>
+        <plugins>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                            <addDefaultSpecificationEntries>True</addDefaultSpecificationEntries>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <configLocation>odl_checks.xml</configLocation>
+                    <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+                    <!-- <sourceDirectories> are needed so that checkstyle
+                        ignores the generated sources directory -->
+                    <sourceDirectories>
+                        <directory>${project.build.sourceDirectory}</directory>
+                    </sourceDirectories>
+                    <includeResources>true</includeResources>
+                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                    <includeTestResources>true</includeTestResources>
+                    <includes>**\/*.java</includes>
+                    <excludes>
+                        **/protobuff/messages/**,
+                        **/thrift/gen/*.java,
+                        **/module-info.java
+                    </excludes>
+                    <consoleOutput>true</consoleOutput>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>validate</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
     </build>
 </project>
index 19316784bd168584053537c4ae31a5be562023bc..7ad45575fb4e009a093299ea3f46dfb81b6e064a 100644 (file)
@@ -7,9 +7,11 @@
  */
 package io.lighty.controllers.tpce;
 
+import io.lighty.controllers.tpce.exception.TechnicalException;
 import io.lighty.controllers.tpce.module.TransportPCE;
 import io.lighty.controllers.tpce.module.TransportPCEImpl;
 import io.lighty.controllers.tpce.utils.TPCEUtils;
+import io.lighty.controllers.tpce.utils.TpceBanner;
 import io.lighty.core.controller.api.LightyController;
 import io.lighty.core.controller.api.LightyModule;
 import io.lighty.core.controller.impl.LightyControllerBuilder;
@@ -26,7 +28,11 @@ import io.lighty.modules.southbound.netconf.impl.NetconfTopologyPluginBuilder;
 import io.lighty.modules.southbound.netconf.impl.config.NetconfConfiguration;
 import io.lighty.modules.southbound.netconf.impl.util.NetconfConfigUtils;
 import io.lighty.server.LightyServerBuilder;
+import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.concurrent.ExecutionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,79 +47,84 @@ public class Main {
         start(new String[] {}, false);
     }
 
+    @SuppressWarnings("checkstyle:Illegalcatch")
     public void start(String[] args, boolean registerShutdownHook) {
         long startTime = System.nanoTime();
-        LOG.info(" ___________     ___________________ ___________");
-        LOG.info(" \\__    ___/     \\______   \\_   ___ \\\\_   _____/");
-        LOG.info("   |    |  ______ |     ___/    \\  \\/ |    __)_");
-        LOG.info("   |    | /_____/ |    |   \\     \\____|        \\");
-        LOG.info("   |____|         |____|    \\______  /_______  /");
-        LOG.info("                                   \\/        \\/");
-        LOG.info(".__  .__       .__     __              .__          ");
-        LOG.info("|  | |__| ____ |  |___/  |_ ___.__.    |__| ____    ");
-        LOG.info("|  | |  |/ ___\\|  |  \\   __<   |  |    |  |/  _ \\");
-        LOG.info("|  |_|  / /_/  >   Y  \\  |  \\___  |    |  (  <_> )");
-        LOG.info("|____/__\\___  /|___|  /__|  / ____| /\\ |__|\\____/");
-        LOG.info("        /_____/     \\/      \\/      \\/           ");
-        LOG.info("Starting lighty.io TransportPCE application ...");
-        LOG.info("https://lighty.io/");
-        LOG.info("https://github.com/PantheonTechnologies/lighty-core");
+        TpceBanner.print();
+        RestConfConfiguration restConfConfig = null;
         try {
-            LOG.info("using default configuration ...");
-            //1. get controller configuration
-            ControllerConfiguration defaultSingleNodeConfiguration =
-                    ControllerConfigUtils.getDefaultSingleNodeConfiguration(TPCEUtils.yangModels);
-            //2. get RESTCONF NBP configuration
-            RestConfConfiguration restConfConfig =
-                    RestConfConfigUtils.getDefaultRestConfConfiguration();
+            // 1. get controller configuration
+            ControllerConfiguration singleNodeConfiguration = ControllerConfigUtils
+                    .getDefaultSingleNodeConfiguration(TPCEUtils.getYangModels());
+            // 2. get RESTCONF NBP configuration
+            if (args.length == 1) {
+                Path configPath = Paths.get(args[0]);
+                LOG.info("Using restconf configuration from file {} ...", configPath);
+                restConfConfig = RestConfConfigUtils.getRestConfConfiguration(Files.newInputStream(configPath));
+
+            } else {
+                LOG.info("Using default restconf configuration with http port 8181 ...");
+
+                restConfConfig = RestConfConfigUtils.getDefaultRestConfConfiguration();
+                restConfConfig.setHttpPort(8181);
+
+            }
             restConfConfig.setJsonRestconfServiceType(JsonRestConfServiceType.DRAFT_02);
-            restConfConfig.setHttpPort(8181);
-            //3. NETCONF SBP configuration
+            // 3. NETCONF SBP configuration
             NetconfConfiguration netconfSBPConfig = NetconfConfigUtils.createDefaultNetconfConfiguration();
-            startLighty(defaultSingleNodeConfiguration, restConfConfig, netconfSBPConfig, registerShutdownHook);
+            startLighty(singleNodeConfiguration, restConfConfig, netconfSBPConfig, registerShutdownHook);
             float duration = (System.nanoTime() - startTime) / 1_000_000f;
             LOG.info("lighty.io and RESTCONF-NETCONF started in {}ms", duration);
+        } catch (ConfigurationException | ExecutionException | IOException e) {
+            LOG.error("An error occured while starting application: ", e);
+            throw new TechnicalException("An error occured while starting application", e);
+        } catch (InterruptedException e) {
+            LOG.error("Application start interrupted : ", e);
+            Thread.currentThread().interrupt();
+            throw new TechnicalException("Application start interrupted", e);
+          //CHECKSTYLE:OFF
         } catch (Exception e) {
-            LOG.error("Main RESTCONF-NETCONF application exception: ", e);
+          //CHECKSTYLE:ON
+            LOG.error("Application start unmanaged exception : ", e);
+            throw new TechnicalException("Application start unmanaged exception", e);
+
         }
     }
 
     private void startLighty(ControllerConfiguration controllerConfiguration,
-                             RestConfConfiguration restConfConfiguration,
-                             NetconfConfiguration netconfSBPConfiguration, boolean registerShutdownHook)
-            throws ConfigurationException, ExecutionException, InterruptedException {
+            RestConfConfiguration restConfConfiguration, NetconfConfiguration netconfSBPConfiguration,
+            boolean registerShutdownHook) throws ConfigurationException, ExecutionException, InterruptedException {
 
-        //1. initialize and start Lighty controller (MD-SAL, Controller, YangTools, Akka)
+        // 1. initialize and start Lighty controller (MD-SAL, Controller, YangTools,
+        // Akka)
         LightyControllerBuilder lightyControllerBuilder = new LightyControllerBuilder();
         LightyController lightyController = lightyControllerBuilder.from(controllerConfiguration).build();
         lightyController.start().get();
 
-        //2. start RestConf server
+        // 2. start RestConf server
         CommunityRestConfBuilder communityRestConfBuilder = new CommunityRestConfBuilder();
-        LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(new InetSocketAddress(
-                restConfConfiguration.getInetAddress(), restConfConfiguration.getHttpPort()));
-        CommunityRestConf communityRestConf = communityRestConfBuilder.from(RestConfConfigUtils
-                .getRestConfConfiguration(restConfConfiguration, lightyController.getServices()))
-                .withLightyServer(jettyServerBuilder)
-                .build();
+        LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(
+                new InetSocketAddress(restConfConfiguration.getInetAddress(), restConfConfiguration.getHttpPort()));
+        CommunityRestConf communityRestConf = communityRestConfBuilder.from(
+                RestConfConfigUtils.getRestConfConfiguration(restConfConfiguration, lightyController.getServices()))
+                .withLightyServer(jettyServerBuilder).build();
         communityRestConf.start().get();
         communityRestConf.startServer();
 
-        //3. start NetConf SBP
+        // 3. start NetConf SBP
         NetconfSBPlugin netconfSouthboundPlugin;
-        netconfSBPConfiguration = NetconfConfigUtils.injectServicesToTopologyConfig(
-                netconfSBPConfiguration, lightyController.getServices());
+        netconfSBPConfiguration = NetconfConfigUtils.injectServicesToTopologyConfig(netconfSBPConfiguration,
+                lightyController.getServices());
         NetconfTopologyPluginBuilder netconfSBPBuilder = new NetconfTopologyPluginBuilder();
-        netconfSouthboundPlugin = netconfSBPBuilder
-                .from(netconfSBPConfiguration, lightyController.getServices())
+        netconfSouthboundPlugin = netconfSBPBuilder.from(netconfSBPConfiguration, lightyController.getServices())
                 .build();
         netconfSouthboundPlugin.start().get();
 
-        //4. start TransportPCE beans
+        // 4. start TransportPCE beans
         TransportPCE transportPCE = new TransportPCEImpl(lightyController.getServices());
         transportPCE.start().get();
 
-        //5. Register shutdown hook for graceful shutdown.
+        // 5. Register shutdown hook for graceful shutdown.
         shutdownHook = new ShutdownHook(lightyController, communityRestConf, netconfSouthboundPlugin, transportPCE);
         if (registerShutdownHook) {
             Runtime.getRuntime().addShutdownHook(shutdownHook);
@@ -138,7 +149,7 @@ public class Main {
         private final TransportPCE transportPCE;
 
         ShutdownHook(LightyController lightyController, CommunityRestConf communityRestConf,
-                     LightyModule netconfSouthboundPlugin, TransportPCE transportPCE) {
+                LightyModule netconfSouthboundPlugin, TransportPCE transportPCE) {
             this.lightyController = lightyController;
             this.communityRestConf = communityRestConf;
             this.netconfSouthboundPlugin = netconfSouthboundPlugin;
@@ -146,6 +157,7 @@ public class Main {
         }
 
         @Override
+        @SuppressWarnings({"checkstyle:Illegalcatch", "checkstyle:VariableDeclarationUsageDistance"})
         public void run() {
             LOG.info("lighty.io and RESTCONF-NETCONF shutting down ...");
             long startTime = System.nanoTime();
@@ -169,7 +181,7 @@ public class Main {
             } catch (Exception e) {
                 LOG.error("Exception while shutting down lighty.io controller:", e);
             }
-            float duration = (System.nanoTime() - startTime)/1_000_000f;
+            float duration = (System.nanoTime() - startTime) / 1_000_000f;
             LOG.info("lighty.io and RESTCONF-NETCONF stopped in {}ms", duration);
         }
 
diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/exception/TechnicalException.java b/lighty/src/main/java/io/lighty/controllers/tpce/exception/TechnicalException.java
new file mode 100644 (file)
index 0000000..4fa2f93
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package io.lighty.controllers.tpce.exception;
+
+public class TechnicalException extends RuntimeException {
+
+    /**
+     * serial id.
+     */
+    private static final long serialVersionUID = 1359762809539335449L;
+
+    /**
+     * Default constructor.
+     */
+    public TechnicalException() {
+        super();
+    }
+
+    /**
+     * Constructor with message.
+     * @param message error message
+     * @param cause root cause
+     */
+    public TechnicalException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
index 675c5bb16a3cad83a9d939077ccd596756279513..7555aad808aaf709ab5f69578b9208d7e2fb1899 100644 (file)
@@ -5,20 +5,26 @@
  * 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.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.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.common.network.RequestProcessor;
+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;
@@ -26,14 +32,18 @@ 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.service.NetworkModelService;
 import org.opendaylight.transportpce.networkmodel.service.NetworkModelServiceImpl;
 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.OlmPowerService;
 import org.opendaylight.transportpce.olm.service.OlmPowerServiceImpl;
 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.NetworkModelWavelengthService;
 import org.opendaylight.transportpce.renderer.NetworkModelWavelengthServiceImpl;
 import org.opendaylight.transportpce.renderer.RendererProvider;
 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
@@ -41,9 +51,12 @@ import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterf
 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
 // Adding OTN interface
 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOtnInterface221;
+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.servicehandler.impl.ServicehandlerProvider;
@@ -55,150 +68,107 @@ import org.opendaylight.transportpce.servicehandler.service.ServiceHandlerOperat
 import org.opendaylight.transportpce.servicehandler.service.ServiceHandlerOperationsImpl;
 import org.opendaylight.transportpce.tapi.impl.TapiProvider;
 import org.opendaylight.transportpce.tapi.utils.TapiListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.TransportpceOlmService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.lighty.core.controller.api.AbstractLightyModule;
-import io.lighty.core.controller.api.LightyServices;
 
 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_DURATION_TO_SUBMIT_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;
+    // T-api
     private final TapiProvider tapiProvider;
-
     // service-handler beans
     private final ServicehandlerProvider servicehandlerProvider;
 
     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());
+        LOG.info("Initializing transaction providers ...");
+        deviceTransactionManager = new DeviceTransactionManagerImpl(lightyServices.getBindingMountPointService(),
+                MAX_DURATION_TO_SUBMIT_TRANSACTION);
+        RequestProcessor 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());
+        PathComputationService pathComputationService = new PathComputationServiceImpl(networkTransaction,
+                lightyServices.getBindingNotificationPublishService());
         pceProvider = new PceProvider(lightyServices.getRpcProviderService(), pathComputationService);
 
         LOG.info("Creating network-model beans ...");
-        // TODO: Need to look into it
-
-
-
-        // 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);
+        R2RLinkDiscovery linkDiscoveryImpl = new R2RLinkDiscovery(lightyServices.getBindingDataBroker(),
+                deviceTransactionManager, networkTransaction);
+        TransportpceNetworkutilsService networkutilsServiceImpl = new NetworkUtilsImpl(
+                lightyServices.getBindingDataBroker());
+        MappingUtils mappingUtils = new MappingUtilsImpl(lightyServices.getBindingDataBroker());
+        OpenRoadmInterfaces openRoadmInterfaces = initOpenRoadmInterfaces(mappingUtils);
+        PortMapping portMapping = initPortMapping(lightyServices, openRoadmInterfaces);
+        NetworkModelService networkModelService = new NetworkModelServiceImpl(networkTransaction, linkDiscoveryImpl,
+                portMapping);
+        NetConfTopologyListener netConfTopologyListener = new NetConfTopologyListener(networkModelService,
+                lightyServices.getBindingDataBroker(), deviceTransactionManager);
         networkModelProvider = new NetworkModelProvider(networkTransaction, lightyServices.getBindingDataBroker(),
-            lightyServices.getRpcProviderService(), networkutilsServiceImpl, netConfTopologyListener);
+                lightyServices.getRpcProviderService(), networkutilsServiceImpl, netConfTopologyListener);
 
         LOG.info("Creating OLM beans ...");
-        powerMgmt = new PowerMgmtImpl(lightyServices.getBindingDataBroker(), openRoadmInterfaces, crossConnect, deviceTransactionManager);
-        olmPowerService = new OlmPowerServiceImpl(lightyServices.getBindingDataBroker(), powerMgmt, deviceTransactionManager, portMapping, mappingUtils, openRoadmInterfaces);
+        CrossConnect crossConnect = initCrossConnect(mappingUtils);
+        PowerMgmt powerMgmt = new PowerMgmtImpl(lightyServices.getBindingDataBroker(), openRoadmInterfaces,
+                crossConnect, deviceTransactionManager);
+        OlmPowerService olmPowerService = new OlmPowerServiceImpl(lightyServices.getBindingDataBroker(), powerMgmt,
+                deviceTransactionManager, portMapping, mappingUtils, openRoadmInterfaces);
         olmProvider = new OlmProvider(lightyServices.getRpcProviderService(), olmPowerService);
-        olmPowerServiceRpc = new OlmPowerServiceRpcImpl(olmPowerService);
+        TransportpceOlmService olmPowerServiceRpc = new OlmPowerServiceRpcImpl(olmPowerService);
 
         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);
+        OpenRoadmInterfaceFactory openRoadmInterfaceFactory = initOpenRoadmFactory(mappingUtils, openRoadmInterfaces,
+                portMapping);
+        DeviceRendererService deviceRendererService = new DeviceRendererServiceImpl(
+                lightyServices.getBindingDataBroker(), deviceTransactionManager, openRoadmInterfaceFactory,
+                openRoadmInterfaces, crossConnect, portMapping, networkModelService);
+        OtnDeviceRendererService otnDeviceRendererService = new OtnDeviceRendererServiceImpl(openRoadmInterfaceFactory,
+                crossConnect, openRoadmInterfaces, deviceTransactionManager, networkModelService);
+        NetworkModelWavelengthService networkModelWavelengthService = new NetworkModelWavelengthServiceImpl(
+                lightyServices.getBindingDataBroker());
+        rendererProvider = initRenderer(lightyServices, olmPowerServiceRpc, networkModelWavelengthService,
+                deviceRendererService, otnDeviceRendererService);
 
         LOG.info("Creating service-handler beans ...");
-        servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
-                pathComputationService, rendererServiceOperations, networkModelWavelengthService, lightyServices.getBindingNotificationPublishService());
-        tapiProvider = initTapi(lightyServices);
-
+        RendererServiceOperations rendererServiceOperations = new RendererServiceOperationsImpl(deviceRendererService,
+                olmPowerServiceRpc, lightyServices.getBindingDataBroker(), networkModelWavelengthService,
+                lightyServices.getBindingNotificationPublishService());
+        servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
+                lightyServices.getRpcProviderService(), lightyServices.getNotificationService(), pathComputationService,
+                rendererServiceOperations, networkModelWavelengthService,
+                lightyServices.getBindingNotificationPublishService());
+        tapiProvider = initTapi(lightyServices, rendererServiceOperations, networkModelWavelengthService,
+                pathComputationService);
     }
 
     @Override
     protected boolean initProcedure() {
-        LOG.info("Initializing common beans ...");
-        LOG.info("Initializing PCE beans ...");
-        pathComputationService.init();
+        LOG.info("Initializing PCE provider ...");
         pceProvider.init();
-        LOG.info("Initializing network-model beans ...");
+        LOG.info("Initializing network-model provider ...");
         networkModelProvider.init();
-        LOG.info("Initializing OLM beans ...");
-        olmPowerService.init();
+        LOG.info("Initializing OLM provider ...");
         olmProvider.init();
-        LOG.info("Initializing renderer beans ...");
+        LOG.info("Initializing renderer provider ...");
         rendererProvider.init();
-        LOG.info("Initializing service-handler beans ...");
+        LOG.info("Initializing service-handler provider ...");
         servicehandlerProvider.init();
-        LOG.info("Initializing tapi beans ...");
+        LOG.info("Initializing tapi provider ...");
         tapiProvider.init();
         LOG.info("Init done.");
         return true;
@@ -207,19 +177,17 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
     @Override
     protected boolean stopProcedure() {
         tapiProvider.close();
-        LOG.info("Shutting down service-handler beans ...");
+        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 ...");
+        LOG.info("Shutting down transaction providers ...");
         networkTransaction.close();
         deviceTransactionManager.preDestroy();
         LOG.info("Shutdown done.");
@@ -227,34 +195,110 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
     }
 
     /**
-     * Init tapi provider beans
-     * @param lightyServices
-     * @return TapiProvider
+     * Init tapi provider beans.
+     *
+     * @param lightyServices LightyServices
+     * @param rendererServiceOperations RendererServiceOperations
+     * @param networkModelWavelengthService NetworkModelWavelengthService
+     * @return TapiProvider instance
      */
-    private TapiProvider initTapi(LightyServices lightyServices) {
-        RendererListenerImpl rendererListenerImpl = new RendererListenerImpl(
-                pathComputationService,
+    private TapiProvider initTapi(LightyServices lightyServices, RendererServiceOperations rendererServiceOperations,
+            NetworkModelWavelengthService networkModelWavelengthService,
+            PathComputationService pathComputationService) {
+        RendererListenerImpl rendererListenerImpl = new RendererListenerImpl(pathComputationService,
                 lightyServices.getBindingNotificationPublishService());
         ServiceDataStoreOperations serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(
                 lightyServices.getBindingDataBroker());
-        PceListenerImpl pceListenerImpl  = new PceListenerImpl(
-                rendererServiceOperations,
-                pathComputationService,
-                lightyServices.getBindingNotificationPublishService(),
-                serviceDataStoreOperations ) ;
+        PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations, pathComputationService,
+                lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
         ServiceHandlerOperations serviceHandlerOperations = new ServiceHandlerOperationsImpl(
-                lightyServices.getBindingDataBroker(),
-                pathComputationService,
-                rendererServiceOperations,
-                lightyServices.getBindingNotificationPublishService(),
-                pceListenerImpl,
-                rendererListenerImpl,
+                lightyServices.getBindingDataBroker(), pathComputationService, rendererServiceOperations,
+                lightyServices.getBindingNotificationPublishService(), pceListenerImpl, rendererListenerImpl,
                 networkModelWavelengthService);
-        return new TapiProvider(
-                lightyServices.getBindingDataBroker(),
-                lightyServices.getRpcProviderService(),
-                serviceHandlerOperations,
-                new TapiListener());
+        return new TapiProvider(lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(),
+                serviceHandlerOperations, new TapiListener());
+    }
+
+    /**
+     * Init renderer provider beans.
+     *
+     * @param lightyServices LightyServices
+     * @param olmPowerServiceRpc TransportpceOlmService
+     * @param networkModelWavelengthService NetworkModelWavelengthService
+     * @param deviceRendererService DeviceRendererService
+     * @param otnDeviceRendererService OtnDeviceRendererService
+     * @return RendererProvider instance
+     */
+    private RendererProvider initRenderer(LightyServices lightyServices, TransportpceOlmService olmPowerServiceRpc,
+            NetworkModelWavelengthService networkModelWavelengthService, DeviceRendererService deviceRendererService,
+            OtnDeviceRendererService otnDeviceRendererService) {
+        DeviceRendererRPCImpl deviceRendererRPC = new DeviceRendererRPCImpl(deviceRendererService,
+                otnDeviceRendererService);
+        RendererServiceOperationsImpl rendererServiceOperations = new RendererServiceOperationsImpl(
+                deviceRendererService, olmPowerServiceRpc, lightyServices.getBindingDataBroker(),
+                networkModelWavelengthService, lightyServices.getBindingNotificationPublishService());
+        return new RendererProvider(lightyServices.getRpcProviderService(), deviceRendererRPC,
+                rendererServiceOperations);
     }
 
-}
+    /**
+     * Init OpenRoadmInterfaceFactory.
+     *
+     * @param mappingUtils MappingUtils
+     * @param openRoadmInterfaces OpenRoadmInterfaces
+     * @param portMapping PortMapping
+     * @return OpenRoadmInterfaceFactory instance
+     */
+    private OpenRoadmInterfaceFactory initOpenRoadmFactory(MappingUtils mappingUtils,
+            OpenRoadmInterfaces openRoadmInterfaces, PortMapping portMapping) {
+        OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping, openRoadmInterfaces);
+        OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping, openRoadmInterfaces,
+                new FixedFlexImpl());
+        OpenRoadmOtnInterface221 openRoadmOtnInterface221 = new OpenRoadmOtnInterface221(portMapping,
+                openRoadmInterfaces);
+        return new OpenRoadmInterfaceFactory(mappingUtils, openRoadmInterface121, openRoadmInterface221,
+                openRoadmOtnInterface221);
+    }
+
+    /**
+     * Init PortMapping.
+     *
+     * @param lightyServices LightyServices
+     * @param openRoadmInterfaces OpenRoadmInterfaces
+     * @return PortMapping instance
+     */
+    private PortMapping initPortMapping(LightyServices lightyServices, OpenRoadmInterfaces openRoadmInterfaces) {
+        PortMappingVersion221 portMappingVersion221 = new PortMappingVersion221(lightyServices.getBindingDataBroker(),
+                deviceTransactionManager, openRoadmInterfaces);
+        PortMappingVersion121 portMappingVersion121 = new PortMappingVersion121(lightyServices.getBindingDataBroker(),
+                deviceTransactionManager, openRoadmInterfaces);
+        return new PortMappingImpl(lightyServices.getBindingDataBroker(), portMappingVersion221, portMappingVersion121);
+    }
+
+    /**
+     * Init OpenRoadmInterfaces.
+     *
+     * @param mappingUtils MappingUtils
+     * @return OpenRoadmInterfaces instance
+     */
+    private OpenRoadmInterfaces initOpenRoadmInterfaces(MappingUtils mappingUtils) {
+        OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121 = new OpenRoadmInterfacesImpl121(
+                deviceTransactionManager);
+        OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221 = new OpenRoadmInterfacesImpl221(
+                deviceTransactionManager);
+        return new OpenRoadmInterfacesImpl(deviceTransactionManager, mappingUtils, openRoadmInterfacesImpl121,
+                openRoadmInterfacesImpl221);
+    }
+
+    /**
+     * Init CrossConnect.
+     *
+     * @param mappingUtils MappingUtils
+     * @return CrossConnect instance
+     */
+    private CrossConnect initCrossConnect(MappingUtils mappingUtils) {
+        CrossConnectImpl121 crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
+        CrossConnectImpl221 crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
+        return new CrossConnectImpl(deviceTransactionManager, mappingUtils, crossConnectImpl121, crossConnectImpl221);
+    }
+}
\ No newline at end of file
index b75f7ad5fa1fd6ebd25be020a343a4e076e0f4ab..83a491166fd2d986646a5596e0ca397f67825095 100644 (file)
@@ -11,38 +11,49 @@ package io.lighty.controllers.tpce.utils;
 import com.google.common.collect.ImmutableSet;
 import io.lighty.modules.northbound.restconf.community.impl.util.RestConfConfigUtils;
 import io.lighty.modules.southbound.netconf.impl.util.NetconfConfigUtils;
-import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 
 public final class TPCEUtils {
 
-    public static final Set<YangModuleInfo> TPCE_MODELS = ImmutableSet.of(
+    private static final Set<YangModuleInfo> TPCE_MODELS = ImmutableSet.of(
 
             // common models
             org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.amplifier.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.equipment.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.amplifier.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.equipment.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev170929.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.layerrate.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev170929.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev170929.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev161014.$YangModuleInfoImpl.getInstance(),
@@ -56,8 +67,10 @@ public final class TPCEUtils {
             org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev171215.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev171215.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.user.mgmt.rev161014.$YangModuleInfoImpl.getInstance(),
@@ -66,15 +79,18 @@ public final class TPCEUtils {
             // device models
             org.opendaylight.yang.gen.v1.http.org.openroadm.database.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.database.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.de.device.resource.types.rev161014.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.de.device.resource.types.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.de.swdl.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.de.swdl.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.file.transfer.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.file.transfer.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.fwdl.rev161014.$YangModuleInfoImpl.getInstance(),
@@ -83,27 +99,44 @@ public final class TPCEUtils {
             org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev170626.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev171215.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev171215.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.multiplex.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev171215.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev171215.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019
+            .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.multiplex.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.rev170626.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.physical.types.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.physical.types.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.pluggable.optics.holder.capability.rev181019.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.pluggable.optics.holder.capability.rev181019
+            .$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.prot.otn.linear.aps.rev181019.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.prot.otn.linear.aps.rev181019.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev161014.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.rstp.rev181019.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.syslog.rev161014.$YangModuleInfoImpl.getInstance(),
@@ -116,78 +149,114 @@ public final class TPCEUtils {
             org.opendaylight.yang.gen.v1.http.org.openroadm.clli.network.rev181130.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.external.pluggable.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.external.pluggable.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.network.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.roadm.rev181130.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev181130.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev181130.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.$YangModuleInfoImpl
+                    .getInstance(),
 
             // service models
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev190531.$YangModuleInfoImpl.getInstance(),
 
-            //tapi models
+            // tapi models
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.oam.rev181210.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.path.computation.rev181210.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.path.computation.rev181210.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.eth.rev181210.$YangModuleInfoImpl.getInstance(),
 
             // API models / opendaylight
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200429.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102
+            .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200429.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.$YangModuleInfoImpl.getInstance(),
-
             org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.gnpy.path.rev200202.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200429.$YangModuleInfoImpl.getInstance(),
-
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200429
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.$YangModuleInfoImpl
+                    .getInstance(),
             org.opendaylight.yang.gen.v1.http.transportpce.topology.rev200129.$YangModuleInfoImpl.getInstance(),
 
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.afn.safi.rev130704.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.$YangModuleInfoImpl.getInstance(),
-            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl.getInstance()
-    );
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana.afn.safi.rev130704.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160621.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.extension.rev131210
+                    .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004
+                     .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206
+                     .$YangModuleInfoImpl.getInstance(),
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.$YangModuleInfoImpl
+                    .getInstance(),
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl
+                    .getInstance());
 
-    public static final Set<YangModuleInfo> yangModels = Stream.concat(
+    private static final Set<YangModuleInfo> TPCE_YANG_MODEL = Stream.concat(
             Stream.concat(
                     RestConfConfigUtils.YANG_MODELS.stream(),
                     NetconfConfigUtils.NETCONF_TOPOLOGY_MODELS.stream())
-                    .collect(Collectors.toSet()).stream(), TPCE_MODELS.stream())
-            .collect(Collectors.toSet());
+            .collect(Collectors.toSet()).stream(),
+            TPCE_MODELS.stream()).collect(Collectors.toSet());
+
+    public static Set<YangModuleInfo> getYangModels() {
+        return TPCE_YANG_MODEL;
+    }
 
     private TPCEUtils() {
         throw new UnsupportedOperationException("Please do not instantiate utility class.");
diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/utils/TpceBanner.java b/lighty/src/main/java/io/lighty/controllers/tpce/utils/TpceBanner.java
new file mode 100644 (file)
index 0000000..373ffe4
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package io.lighty.controllers.tpce.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class TpceBanner {
+
+    private static final String[] BANNER = {
+        " ___________     ___________________ ___________",
+        " \\__    ___/     \\______   \\_   ___ \\\\_   _____/",
+        "   |    |  ______ |     ___/    \\  \\/ |    __)_",
+        "   |    | /_____/ |    |   \\     \\____|        \\",
+        "   |____|         |____|    \\______  /_______  /",
+        "                                   \\/        \\/",
+        ".__  .__       .__     __              .__          ",
+        "|  | |__| ____ |  |___/  |_ ___.__.    |__| ____    ",
+        "|  | |  |/ ___\\|  |  \\   __<   |  |    |  |/  _ \\",
+        "|  |_|  / /_/  >   Y  \\  |  \\___  |    |  (  <_> )",
+        "|____/__\\___  /|___|  /__|  / ____| /\\ |__|\\____/",
+        "/_____/     \\/      \\/      \\/           ",
+        "Starting lighty.io TransportPCE application ...",
+        "https://lighty.io/",
+        "https://github.com/PantheonTechnologies/lighty-core" };
+
+    private static final Logger LOG = LoggerFactory.getLogger(TpceBanner.class);
+
+    /**
+     * Private constructor.
+     */
+    private TpceBanner() {
+
+    }
+
+    public static void print() {
+        for (String line : BANNER) {
+            LOG.info(line);
+        }
+        LOG.info(":: Version :: {}", getVersion());
+    }
+
+    private static String getVersion() {
+        Package tpcePackage = TpceBanner.class.getPackage();
+        if (tpcePackage != null && tpcePackage.getImplementationVersion() != null) {
+            return tpcePackage.getImplementationVersion();
+        }
+        return "not defined";
+    }
+
+}
diff --git a/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java b/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java
new file mode 100644 (file)
index 0000000..bbeb8c2
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package io.lighty.controllers.tpce;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.ContentResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MaintTest {
+    private static final Logger LOG = LoggerFactory.getLogger(MaintTest.class);
+    private Main main = new Main();
+    private HttpClient client = new HttpClient();
+
+    @Before
+    @SuppressWarnings("checkstyle:Illegalcatch")
+    public void init() {
+        try {
+            client.start();
+        } catch (Exception e) {
+            LOG.error("An error occured during test init", e);
+            fail("cannot init test ");
+        }
+    }
+
+    @After
+    @SuppressWarnings("checkstyle:Illegalcatch")
+    public void stop() {
+        try {
+            main.shutdown();
+            client.stop();
+        } catch (Exception e) {
+            LOG.error("An error occured during test shutdown", e);
+        }
+    }
+
+    @Test
+    public void startNoConfigFileTest() throws Exception {
+        main.start(new String[0], true);
+        ContentResponse response = client.GET("http://localhost:8181/restconf/config/ietf-network:networks/network/openroadm-topology");
+        assertEquals("Response code should be 200", 200, response.getStatus());
+    }
+
+    @Test
+    public void startConfigFileTest() throws Exception {
+        File configFile = new File("src/test/resources/config.json");
+        String[] args = {configFile.getAbsolutePath()};
+        main.start(args, true);
+        ContentResponse response = client.GET("http://localhost:8888/restconfCustom/config/ietf-network:networks/network/openroadm-topology");
+        assertEquals("Response code should be 200", 200, response.getStatus());
+    }
+}
\ No newline at end of file
diff --git a/lighty/src/test/resources/config.json b/lighty/src/test/resources/config.json
new file mode 100644 (file)
index 0000000..761c4ee
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "restconf":{
+        "inetAddress": "127.0.0.1",
+        "httpPort":8888,
+        "webSocketPort": 8185,
+        "restconfServletContextPath":"/restconfCustom",
+        "jsonRestconfServiceType": "DRAFT_18"
+    }
+}