Activate Swagger for Lighty 90/105090/1
authorChristophe Betoule <christophe.betoule@orange.com>
Tue, 28 Mar 2023 14:07:55 +0000 (16:07 +0200)
committerChristophe Betoule <christophe.betoule@orange.com>
Tue, 28 Mar 2023 14:07:55 +0000 (16:07 +0200)
JIRA: TRNSPRTPCE-738
Signed-off-by: Christophe Betoule <christophe.betoule@orange.com>
Change-Id: Ifb7095f045a72286417719d9a709d89a874b3efc

lighty/pom.xml
lighty/src/main/java/io/lighty/controllers/tpce/Main.java

index f599e6ae19787b21efb3b6728ebfec9d78b99e89..9f5fd0e634f2ac5b772d7e20f9e4fc6a1c757b20 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);