Merge "Activate Swagger for Lighty"
authorGilles Thouenon <gilles.thouenon@orange.com>
Mon, 3 Apr 2023 10:50:10 +0000 (10:50 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 3 Apr 2023 10:50:10 +0000 (10:50 +0000)
lighty/pom.xml
lighty/src/main/java/io/lighty/controllers/tpce/Main.java

index 182a3f211ae85616c91027661a126f6e018b20f5..6ae7b33b4a885963ecbc3f6f89276b1d190beafd 100644 (file)
       <groupId>io.lighty.modules</groupId>
       <artifactId>lighty-restconf-nb-community</artifactId>
     </dependency>
+    <dependency>
+      <groupId>io.lighty.modules</groupId>
+      <artifactId>lighty-swagger</artifactId>
+    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
index 9c068143a5a4b1a531558deba2fade6775569e27..49108c73d3f5161ec60b196cc9fde2f6739678fc 100644 (file)
@@ -27,6 +27,7 @@ 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 io.lighty.swagger.SwaggerLighty;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.nio.file.Files;
@@ -157,16 +158,21 @@ public class Main {
         LightyController lightyController = lightyControllerBuilder.from(controllerConfiguration).build();
         lightyController.start().get();
 
-        // 2. start RestConf server
+        // 2. Start swagger server
         LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(
                 new InetSocketAddress(restConfConfiguration.getInetAddress(), restConfConfiguration.getHttpPort()));
         CommunityRestConfBuilder communityRestConfBuilder = CommunityRestConfBuilder.from(
                 RestConfConfigUtils.getRestConfConfiguration(restConfConfiguration, lightyController.getServices()));
+        SwaggerLighty swagger = new SwaggerLighty(restConfConfiguration, jettyServerBuilder,
+                lightyController.getServices());
+        swagger.start().get();
+
+        // 3. start RestConf server
         CommunityRestConf communityRestConf = communityRestConfBuilder.withLightyServer(jettyServerBuilder).build();
         communityRestConf.start().get();
         communityRestConf.startServer();
 
-        // 3. start NetConf SBP
+        // 4. start NetConf SBP
         NetconfSBPlugin netconfSouthboundPlugin;
         netconfSBPConfiguration = NetconfConfigUtils.injectServicesToTopologyConfig(netconfSBPConfiguration,
                 lightyController.getServices());
@@ -176,12 +182,12 @@ public class Main {
                 .build();
         netconfSouthboundPlugin.start().get();
 
-        // 4. start TransportPCE beans
+        // 5. start TransportPCE beans
         TransportPCE transportPCE = new TransportPCEImpl(lightyController.getServices(), activateNbiNotification,
             activateTapi, olmtimer1, olmtimer2);
         transportPCE.start().get();
 
-        // 5. Register shutdown hook for graceful shutdown.
+        // 6. Register shutdown hook for graceful shutdown.
         shutdownHook = new ShutdownHook(lightyController, communityRestConf, netconfSouthboundPlugin, transportPCE);
         if (registerShutdownHook) {
             Runtime.getRuntime().addShutdownHook(shutdownHook);