<properties>
<java.version>11</java.version>
<springfox.version>3.0.0</springfox.version>
- <immutable.version>2.8.2</immutable.version>
+ <immutable.version>2.9.0</immutable.version>
<swagger.version>2.1.13</swagger.version>
<json.version>20211205</json.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
<version>${swagger.version}</version>
</dependency>
- <dependency>
- <groupId>org.immutables</groupId>
- <artifactId>value</artifactId>
- <version>${immutable.version}</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>gson</artifactId>
</execution>
</executions>
</plugin>
- </plugins>
+ </plugins>
</build>
<issueManagement>
<system>JIRA</system>
<url>https://jira.o-ran-sc.org/</url>
</issueManagement>
-</project>
+</project>
\ No newline at end of file
}
private boolean isHttpProxyConfigured() {
- return httpProxyConfig != null && httpProxyConfig.httpProxyPort() > 0
- && !httpProxyConfig.httpProxyHost().isEmpty();
+ return httpProxyConfig != null && httpProxyConfig.getHttpProxyPort() > 0
+ && !httpProxyConfig.getHttpProxyHost().isEmpty();
}
private HttpClient buildHttpClient() {
if (isHttpProxyConfigured()) {
httpClient = httpClient.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP)
- .host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort()));
+ .host(httpProxyConfig.getHttpProxyHost()).port(httpProxyConfig.getHttpProxyPort()));
}
return httpClient;
}
public AsyncRestClientFactory(WebClientConfig clientConfig, SecurityContext securityContext) {
if (clientConfig != null) {
this.sslContextFactory = new CachingSslContextFactory(clientConfig);
- this.httpProxyConfig = clientConfig.httpProxyConfig();
+ this.httpProxyConfig = clientConfig.getHttpProxyConfig();
} else {
logger.warn("No configuration for web client defined, HTTPS will not work");
this.sslContextFactory = null;
private SslContext createSslContext(KeyManagerFactory keyManager)
throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
if (this.clientConfig.isTrustStoreUsed()) {
- return createSslContextRejectingUntrustedPeers(this.clientConfig.trustStore(),
- this.clientConfig.trustStorePassword(), keyManager);
+ return createSslContextRejectingUntrustedPeers(this.clientConfig.getTrustStore(),
+ this.clientConfig.getTrustStorePassword(), keyManager);
} else {
// Trust anyone
return SslContextBuilder.forClient() //
private KeyManagerFactory createKeyManager() throws NoSuchAlgorithmException, CertificateException, IOException,
UnrecoverableKeyException, KeyStoreException {
final KeyManagerFactory keyManager = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.keyStoreType());
- final String keyStoreFile = this.clientConfig.keyStore();
- final String keyStorePassword = this.clientConfig.keyStorePassword();
- final String keyPassword = this.clientConfig.keyPassword();
+ final KeyStore keyStore = KeyStore.getInstance(this.clientConfig.getKeyStoreType());
+ final String keyStoreFile = this.clientConfig.getKeyStore();
+ final String keyStorePassword = this.clientConfig.getKeyStorePassword();
+ final String keyPassword = this.clientConfig.getKeyPassword();
try (final InputStream inputStream = new FileInputStream(keyStoreFile)) {
keyStore.load(inputStream, keyStorePassword.toCharArray());
}
} else {
logger.info("Http proxy is used for RAN access {}:{}", httpProxyHost, httpProxyPort);
}
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost(this.httpProxyHost) //
.httpProxyPort(this.httpProxyPort) //
.build();
- this.webClientConfig = ImmutableWebClientConfig.builder() //
+ this.webClientConfig = WebClientConfig.builder() //
.keyStoreType(this.sslKeyStoreType) //
.keyStorePassword(this.sslKeyStorePassword) //
.keyStore(this.sslKeyStore) //
package org.oransc.ics.configuration;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.Getter;
+import reactor.netty.transport.ProxyProvider;
-@Value.Immutable
-@Value.Style(redactedMask = "####")
-public interface WebClientConfig {
- public String keyStoreType();
+@Builder
+@Getter
+public class WebClientConfig {
+ private String keyStoreType;
- @Value.Redacted
- public String keyStorePassword();
+ private String keyStorePassword;
- public String keyStore();
+ private String keyStore;
- @Value.Redacted
- public String keyPassword();
+ private String keyPassword;
- public boolean isTrustStoreUsed();
+ private boolean isTrustStoreUsed;
- @Value.Redacted
- public String trustStorePassword();
+ private String trustStorePassword;
- public String trustStore();
+ private String trustStore;
- @Value.Immutable
- public interface HttpProxyConfig {
- public String httpProxyHost();
+ @Builder
+ @Getter
+ public static class HttpProxyConfig {
+ private String httpProxyHost;
- public int httpProxyPort();
+ private int httpProxyPort;
+
+ private ProxyProvider.Proxy httpProxyType;
}
- public HttpProxyConfig httpProxyConfig();
+ private HttpProxyConfig httpProxyConfig;
}
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
-import org.immutables.gson.Gson;
import org.oransc.ics.repository.InfoJobs;
import org.oransc.ics.repository.InfoProducers;
import org.oransc.ics.repository.InfoTypes;
@Autowired
private InfoProducers infoProducers;
- @Gson.TypeAdapters
@Schema(name = "service_status_info")
public static class StatusInfo {
@Schema(name = "status", description = "status text")
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "Void", description = "Void/empty ")
public class VoidResponse {
private VoidResponse() {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "EiJobObject", description = "Information for an Enrichment Information Job")
public class A1eEiJobInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "EiJobStatusObject", description = "Status for an EI job")
public class A1eEiJobStatus {
- @Gson.TypeAdapters
@Schema(name = "EiJobStatusValues", description = OPERATIONAL_STATE_DESCRIPTION)
public enum EiJobStatusValues {
ENABLED, DISABLED
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "EiTypeObject", description = "Information for an EI type")
public class A1eEiTypeInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "consumer_information_type", description = "Information for an Information type")
public class ConsumerInfoTypeInfo {
@JsonProperty(value = "job_data_schema", required = true)
public Object jobDataSchema;
- @Gson.TypeAdapters
@Schema(name = "consumer_type_status_values", description = STATUS_DESCRIPTION)
public enum ConsumerTypeStatusValues {
ENABLED, DISABLED
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "consumer_job", description = "Information for an Information Job")
public class ConsumerJobInfo {
import java.util.Collection;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "consumer_job_status", description = "Status for an Information Job")
public class ConsumerJobStatus {
- @Gson.TypeAdapters
@Schema(name = "info_job_status_values", description = OPERATIONAL_STATE_DESCRIPTION)
public enum InfoJobStatusValues {
ENABLED, DISABLED
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "consumer_type_registration_info", description = "Information for an Information type")
public class ConsumerTypeRegistrationInfo {
@JsonProperty(value = "job_data_schema", required = true)
public Object jobDataSchema;
- @Gson.TypeAdapters
@Schema(name = "consumer_type_registration_values", description = REGISTRATION_DESCRIPTION)
public enum ConsumerTypeStatusValues {
REGISTERED, DEREGISTERED
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
-import org.immutables.gson.Gson;
@EqualsAndHashCode
-@Gson.TypeAdapters
@Schema(name = "consumer_type_subscription_info", description = "Information for an information type subscription")
public class ConsumerTypeSubscriptionInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "producer_info_type_info", description = "Information for an Information Type")
public class ProducerInfoTypeInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
import org.oransc.ics.repository.InfoJob;
-@Gson.TypeAdapters
@Schema(
name = "producer_info_job_request",
description = "The body of the Information Producer callbacks for Information Job creation and deletion")
import java.util.Collection;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "producer_registration_info", description = "Information for an Information Producer")
public class ProducerRegistrationInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-@Gson.TypeAdapters
@Schema(name = "producer_status", description = "Status for an Info Producer")
public class ProducerStatusInfo {
- @Gson.TypeAdapters
@Schema(name = "producer_operational_state", description = "Represents the operational states")
public enum OperationalState {
ENABLED, DISABLED
import org.oransc.ics.clients.AsyncRestClientFactory;
import org.oransc.ics.clients.SecurityContext;
import org.oransc.ics.configuration.ApplicationConfig;
-import org.oransc.ics.configuration.ImmutableHttpProxyConfig;
-import org.oransc.ics.configuration.ImmutableWebClientConfig;
import org.oransc.ics.configuration.WebClientConfig;
import org.oransc.ics.configuration.WebClientConfig.HttpProxyConfig;
import org.oransc.ics.controller.A1eCallbacksSimulatorController;
private AsyncRestClient restClient(boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost("") //
.httpProxyPort(0) //
.build();
- config = ImmutableWebClientConfig.builder() //
- .keyStoreType(config.keyStoreType()) //
- .keyStorePassword(config.keyStorePassword()) //
- .keyStore(config.keyStore()) //
- .keyPassword(config.keyPassword()) //
+ config = WebClientConfig.builder() //
+ .keyStoreType(config.getKeyStoreType()) //
+ .keyStorePassword(config.getKeyStorePassword()) //
+ .keyStore(config.getKeyStore()) //
+ .keyPassword(config.getKeyPassword()) //
.isTrustStoreUsed(useTrustValidation) //
- .trustStore(config.trustStore()) //
- .trustStorePassword(config.trustStorePassword()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
.httpProxyConfig(httpProxyConfig).build();
AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config, securityContext);