Migrate RpcService usage in TapiNetworkUtilsImpl
[transportpce.git] / lighty / src / main / java / io / lighty / controllers / tpce / Main.java
index 043f37f9657f7cfbc738100e8b24d3ce6ed91a6f..f7521205a17ed8320d52c1c19574060079c7222b 100644 (file)
@@ -20,13 +20,13 @@ import io.lighty.core.controller.impl.config.ControllerConfiguration;
 import io.lighty.core.controller.impl.util.ControllerConfigUtils;
 import io.lighty.modules.northbound.restconf.community.impl.CommunityRestConf;
 import io.lighty.modules.northbound.restconf.community.impl.CommunityRestConfBuilder;
-import io.lighty.modules.northbound.restconf.community.impl.config.JsonRestConfServiceType;
 import io.lighty.modules.northbound.restconf.community.impl.config.RestConfConfiguration;
 import io.lighty.modules.northbound.restconf.community.impl.util.RestConfConfigUtils;
 import io.lighty.modules.southbound.netconf.impl.NetconfSBPlugin;
 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.openapi.OpenApiLighty;
 import io.lighty.server.LightyServerBuilder;
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -82,7 +82,6 @@ public class Main {
                 restConfConfig.setHttpPort(8181);
 
             }
-            restConfConfig.setJsonRestconfServiceType(JsonRestConfServiceType.DRAFT_02);
             // 3. NETCONF SBP configuration
             NetconfConfiguration netconfSBPConfig = NetconfConfigUtils.createDefaultNetconfConfiguration();
             startLighty(singleNodeConfiguration, restConfConfig, netconfSBPConfig, registerShutdownHook,
@@ -159,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()));
+        OpenApiLighty swagger = new OpenApiLighty(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());
@@ -178,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);