Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ public boolean initModules() {

this.lightyRestconf = initRestconf(this.appModuleConfig.getRestconfConfig(),
this.lightyController.getServices());
lightyController.getServices().withJaxRsEndpoint(lightyRestconf.getJaxRsEndpoint());
startAndWaitLightyModule(this.lightyRestconf);

final AAAEncryptionService encryptionService = createEncryptionServiceWithErrorHandling();
this.gnmiSouthboundModule = initGnmiModule(this.lightyController.getServices(),
this.gnmiExecutorService, this.appModuleConfig.getGnmiConfiguration(), encryptionService,
this.customReactor);
startAndWaitLightyModule(this.gnmiSouthboundModule);
lightyRestconf.startServer();

} catch (RcGnmiAppException e) {
LOG.error("Unable to initialize and start RCgNMI lighty.io module!", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
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.Http2LightyServerBuilder;
import io.lighty.server.HttpsLightyServerBuilder;
import io.lighty.server.LightyServerBuilder;
import io.lighty.server.Http2LightyServerProvider;
import io.lighty.server.HttpsLightyServerProvider;
import io.lighty.server.LightyJettyServerProvider;
import io.lighty.server.config.LightyServerConfig;
import java.net.InetSocketAddress;
import java.security.Security;
Expand All @@ -52,7 +52,7 @@ public class RncLightyModule {
private CommunityRestConf lightyRestconf;
private NetconfSBPlugin lightyNetconf;
private AAALighty aaaLighty;
private LightyServerBuilder jettyServerBuilder;
private LightyJettyServerProvider jettyServerBuilder;
private OpenApiLighty openApi;

public RncLightyModule(final RncLightyModuleConfiguration rncModuleConfig) {
Expand Down Expand Up @@ -123,11 +123,11 @@ private CommunityRestConf initRestconf(final RestConfConfiguration rcConfig, fin
final var inetSocketAddress = new InetSocketAddress(rcConfig.getInetAddress(), rcConfig.getHttpPort());

if (serverConfig.isUseHttp2()) {
jettyServerBuilder = new Http2LightyServerBuilder(inetSocketAddress, serverConfig.getSecurityConfig());
jettyServerBuilder = new Http2LightyServerProvider(inetSocketAddress, serverConfig.getSecurityConfig());
} else if (serverConfig.isUseHttps()) {
jettyServerBuilder = new HttpsLightyServerBuilder(inetSocketAddress, serverConfig.getSecurityConfig());
jettyServerBuilder = new HttpsLightyServerProvider(inetSocketAddress, serverConfig.getSecurityConfig());
} else {
jettyServerBuilder = new LightyServerBuilder(inetSocketAddress);
jettyServerBuilder = new LightyJettyServerProvider(inetSocketAddress);
}

return CommunityRestConfBuilder.from(restConfConfiguration)
Expand All @@ -143,8 +143,8 @@ private AAALighty initAAA(final AAAConfiguration config, final LightyServices se
}

private OpenApiLighty initOpenApiLighty(final RestConfConfiguration config,
final LightyServerBuilder serverBuilder, final LightyServices services) {
return new OpenApiLighty(config, serverBuilder, services);
final LightyJettyServerProvider serverBuilder, final LightyServices services) {
return new OpenApiLighty(config, serverBuilder, services, null);
}

private void startAndWaitLightyModule(final LightyModule lightyModule) throws RncLightyAppStartException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import io.lighty.modules.northbound.restconf.community.impl.CommunityRestConfBuilder;
import io.lighty.modules.northbound.restconf.community.impl.config.RestConfConfiguration;
import io.lighty.modules.northbound.restconf.community.impl.util.RestConfConfigUtils;
import io.lighty.server.LightyServerBuilder;
import io.lighty.server.LightyJettyServerProvider;
import java.net.InetSocketAddress;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -107,21 +107,10 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
throw new ModuleStartupException("Lighty.io Controller startup failed!");
}

// 2. Initialize and start Restconf server
final LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(new InetSocketAddress(
final LightyJettyServerProvider jettyServerBuilder = new LightyJettyServerProvider(new InetSocketAddress(
restconfConfiguration.getInetAddress(), restconfConfiguration.getHttpPort()));
this.restconf = CommunityRestConfBuilder
.from(RestConfConfigUtils.getRestConfConfiguration(restconfConfiguration,
this.lightyController.getServices()))
.withLightyServer(jettyServerBuilder)
.build();
final boolean restconfStartOk = this.restconf.start()
.get(modulesConfig.getModuleTimeoutSeconds(), TimeUnit.SECONDS);
if (!restconfStartOk) {
throw new ModuleStartupException("Community Restconf startup failed!");
}

// 3. Initialize and start Lighty AAA
// 2. Initialize and start Lighty AAA
final DataBroker bindingDataBroker = this.lightyController.getServices().getBindingDataBroker();
Security.addProvider(new BouncyCastleProvider());
aaaConfiguration.setCertificateManager(
Expand All @@ -134,6 +123,19 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
throw new ModuleStartupException("AAA module startup failed!");
}

// 3. Initialize and start Restconf server
this.restconf = CommunityRestConfBuilder
.from(RestConfConfigUtils.getRestConfConfiguration(restconfConfiguration,
this.lightyController.getServices()))
.withLightyServer(jettyServerBuilder)
.withWebSecurer(aaaLighty.webContextSecurer())
.build();
final boolean restconfStartOk = this.restconf.start()
.get(modulesConfig.getModuleTimeoutSeconds(), TimeUnit.SECONDS);
if (!restconfStartOk) {
throw new ModuleStartupException("Community Restconf startup failed!");
}

// 4. Start Lighty jetty server
this.restconf.startServer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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 io.lighty.server.LightyJettyServerProvider;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.file.Files;
Expand Down Expand Up @@ -150,7 +150,7 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
}

//2. build RestConf server
LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(new InetSocketAddress(
final LightyJettyServerProvider jettyServerBuilder = new LightyJettyServerProvider(new InetSocketAddress(
restconfConfiguration.getInetAddress(), restconfConfiguration.getHttpPort()));
this.restconf = CommunityRestConfBuilder
.from(RestConfConfigUtils.getRestConfConfiguration(restconfConfiguration,
Expand All @@ -167,7 +167,7 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,

//3. start openApi and RestConf server
this.openApi =
new OpenApiLighty(restconfConfiguration, jettyServerBuilder, this.lightyController.getServices());
new OpenApiLighty(restconfConfiguration, jettyServerBuilder, this.lightyController.getServices(), null);
final boolean openApiStartOk = this.openApi.start()
.get(modulesConfig.getModuleTimeoutSeconds(), TimeUnit.SECONDS);
if (!openApiStartOk) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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 io.lighty.server.LightyJettyServerProvider;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.file.Files;
Expand Down Expand Up @@ -143,7 +143,7 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
}

//2. build RestConf server
LightyServerBuilder jettyServerBuilder = new LightyServerBuilder(new InetSocketAddress(
final LightyJettyServerProvider jettyServerBuilder = new LightyJettyServerProvider(new InetSocketAddress(
restconfConfiguration.getInetAddress(), restconfConfiguration.getHttpPort()));
this.restconf = CommunityRestConfBuilder
.from(RestConfConfigUtils.getRestConfConfiguration(restconfConfiguration,
Expand All @@ -160,7 +160,7 @@ private void startLighty(final ControllerConfiguration controllerConfiguration,
lightyController.getServices().withJaxRsEndpoint(restconf.getJaxRsEndpoint());

this.openApi =
new OpenApiLighty(restconfConfiguration, jettyServerBuilder, this.lightyController.getServices());
new OpenApiLighty(restconfConfiguration, jettyServerBuilder, this.lightyController.getServices(), null);
final boolean openApiStartOk = this.openApi.start()
.get(modulesConfig.getModuleTimeoutSeconds(), TimeUnit.SECONDS);
if (!openApiStartOk) {
Expand Down
4 changes: 4 additions & 0 deletions lighty-modules/lighty-aaa-aggregator/lighty-aaa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>servlet-jersey2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@

import io.lighty.aaa.config.AAAConfiguration;
import io.lighty.core.controller.api.AbstractLightyModule;
import io.lighty.server.LightyServerBuilder;
import io.lighty.server.LightyJettyServerProvider;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import org.opendaylight.aaa.api.CredentialAuth;
import org.opendaylight.aaa.api.PasswordCredentials;
import org.opendaylight.aaa.web.WebContextSecurer;
import org.opendaylight.mdsal.binding.api.DataBroker;

public final class AAALighty extends AbstractLightyModule {

private final AAAShiroProviderHandler aaaShiroProviderHandler;
private final LightyServerBuilder server;
private final LightyJettyServerProvider server;
private final CredentialAuth<PasswordCredentials> credentialAuth;
private final DataBroker dataBroker;

private final AAAConfiguration aaaConfiguration;

public AAALighty(final DataBroker dataBroker, final CredentialAuth<PasswordCredentials> credentialAuth,
final LightyServerBuilder server, final AAAConfiguration config) {
final LightyJettyServerProvider server, final AAAConfiguration config) {
this.dataBroker = dataBroker;
this.aaaConfiguration = config;
this.credentialAuth = credentialAuth;
Expand Down Expand Up @@ -70,4 +71,8 @@ AAALightyShiroProvider getAaaLightyShiroProvider() {
return this.aaaLightyShiroProvider;
}
}

public WebContextSecurer webContextSecurer() {
return aaaShiroProviderHandler.getAaaLightyShiroProvider().webContextSecurer();
}
}
Loading
Loading