},
"keep_alive_interval_seconds": {
"format": "int64",
- "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intervals must invoke a 'keepalive' REST call. When a service does not invoke this call within the given time, it is considered unavailable. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
+ "description": "keep alive interval for the service. This is used to enable optional heartbeat supervision of the service. If set (> 0) the registered service should regularly invoke a 'keepalive' REST call. When a service fails to invoke this 'keepalive' call within the configured time, the service is considered unavailable. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means timeout supervision is disabled.",
"type": "integer"
}
}
},
"/a1-policy/v2/services/{service_id}/keepalive": {"put": {
"summary": "Heartbeat indicates that the service is running",
- "description": "A registered service must call this in regular intervals to indicate that it is in operation. Absence of this call will lead to that the service will be deregistered and all its policies are removed.",
+ "description": "A registered service should invoke this operation regularly to indicate that it is still alive. If a registered service fails to invoke this operation before the end of a timeout period the service will be deregistered and all its A1 policies wil be removed. (This timeout can be set or disabled when each service is initially registered)",
"operationId": "keepAliveService",
"responses": {
"200": {
"url": "http://www.apache.org/licenses/LICENSE-2.0"
},
"description": "<h2>General<\/h2><p>The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policies. <br/>The main tasks of the service are:<\/p><ul><li>A1 Policy creation, modification and deletion.<\/li><li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs<\/li><li>Maintaining a view of supported Near-RT RIC policy types<\/li><li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.<\/li><\/ul><h2>APIs provided by the service<\/h2><h3>A1 Policy Management<\/h3><p>This is an API for management of A1 Policies.<\/p><ul><li>A1 Policy retrieval, creation, modification and deletion.<\/li><li>Retrieval of supported A1 Policy types for a Near-RT RIC<\/li><li>Retrieval of status for existing A1 policies<\/li><\/ul><h3>Management of configuration<\/h3><p>API for updating and retrieval of the component configuration. Note that there other ways to maintain the configuration.<\/p><h3>Callbacks<\/h3><p>These are endpoints that are invoked by this service. The callbacks are registered in this service at service registration.<\/p><h3>NearRT-RIC Repository<\/h3><p>This is an API that provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one Near-RT RIC.<\/p><h3>Health Check<\/h3><p>API used for supervision of the PMS component.<\/p><h3>Service Registry and Supervision<\/h3><p>API used for registering services that uses PMS. Each A1 policy is owned by a service. PMS can supervise each registered service and will automatically remove policies for unavailable services.<\/p>",
- "title": "A1 Policy management service",
+ "title": "A1 Policy Management Service",
"version": "1.1.0"
},
"tags": [
openapi: 3.0.1
info:
- title: A1 Policy management service
+ title: A1 Policy Management Service
description: <h2>General</h2><p>The O-RAN Non-RT RIC Policy Management Service provides
a REST API for management of A1 policies. <br/>The main tasks of the service are:</p><ul><li>A1
Policy creation, modification and deletion.</li><li>Monitoring and maintaining
tags:
- Service Registry and Supervision
summary: Heartbeat indicates that the service is running
- description: A registered service must call this in regular intervals to indicate
- that it is in operation. Absence of this call will lead to that the service
- will be deregistered and all its policies are removed.
+ description: A registered service should invoke this operation regularly to
+ indicate that it is still alive. If a registered service fails to invoke this
+ operation before the end of a timeout period the service will be deregistered
+ and all its A1 policies wil be removed. (This timeout can be set or disabled
+ when each service is initially registered)
operationId: keepAliveService
parameters:
- name: service_id
description: identity of the service
keep_alive_interval_seconds:
type: integer
- description: keep alive interval for the service. This is a heartbeat supervision
- of the service, which in regular intervals must invoke a 'keepalive' REST
- call. When a service does not invoke this call within the given time,
- it is considered unavailable. An unavailable service will be automatically
- deregistered and its policies will be deleted. Value 0 means no timeout
- supervision.
+ description: keep alive interval for the service. This is used to enable
+ optional heartbeat supervision of the service. If set (> 0) the registered
+ service should regularly invoke a 'keepalive' REST call. When a service
+ fails to invoke this 'keepalive' call within the configured time, the
+ service is considered unavailable. An unavailable service will be automatically
+ deregistered and its policies will be deleted. Value 0 means timeout supervision
+ is disabled.
format: int64
description: Information for one service
policy_info_list_v2:
"<li>A1 Policy creation, modification and deletion.</li>" + //
"<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs</li>" + //
"<li>Maintaining a view of supported Near-RT RIC policy types</li>" + //
- "<li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.</li>" + //
+ "<li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.</li>"
+ + //
"</ul>" + //
"<h2>APIs provided by the service</h2>" + //
H3 + PolicyController.API_NAME + H3_END + //
}
private ControllerConfig getControllerConfig(Ric ric) throws ServiceException {
- String controllerName = ric.getConfig().controllerName();
+ String controllerName = ric.getConfig().getControllerName();
if (controllerName.isEmpty()) {
ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
throw new ServiceException("No controller configured for Near-RT RIC: " + ric.id());
private A1Client createCustomAdapter(Ric ric) throws ServiceException {
try {
- Class<?> clazz = Class.forName(ric.getConfig().customAdapterClass());
+ Class<?> clazz = Class.forName(ric.getConfig().getCustomAdapterClass());
if (A1Client.class.isAssignableFrom(clazz)) {
Constructor<?> constructor = clazz.getConstructor(RicConfig.class, AsyncRestClientFactory.class);
return (A1Client) constructor.newInstance(ric.getConfig(), this.restClientFactory);
throw new ServiceException("The custom class must either implement A1Client.Factory or A1Client");
}
} catch (ClassNotFoundException e) {
- throw new ServiceException("Could not find class: " + ric.getConfig().customAdapterClass(), e);
+ throw new ServiceException("Could not find class: " + ric.getConfig().getCustomAdapterClass(), e);
} catch (Exception e) {
- throw new ServiceException("Cannot create custom adapter: " + ric.getConfig().customAdapterClass(), e);
+ throw new ServiceException("Cannot create custom adapter: " + ric.getConfig().getCustomAdapterClass(), e);
}
}
private void assertNoControllerConfig(Ric ric, A1ProtocolType version) throws ServiceException {
- if (!ric.getConfig().controllerName().isEmpty()) {
+ if (!ric.getConfig().getControllerName().isEmpty()) {
ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
throw new ServiceException(
"Controller config should be empty, ric: " + ric.id() + " when using protocol version: " + version);
.doOnNext(ric::setProtocolVersion)
.doOnNext(version -> logger.debug("Established protocol version:{} for Near-RT RIC: {}", version,
ric.id())) //
- .doOnError(notUsed -> logger.warn("Could not get protocol version from Near-RT RIC: {}", ric.id())) //
- .onErrorResume(
- notUsed -> Mono.error(new ServiceException("Protocol negotiation failed for " + ric.id())));
+ .doOnError(notUsed -> logger.warn("Could not get protocol version from Near-RT RIC: {}", ric.id()));
} else {
return Mono.just(ric.getProtocolVersion());
}
}
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());
}
import java.util.List;
import java.util.Optional;
-import org.immutables.value.Value;
+import lombok.Getter;
+
import org.json.JSONObject;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
static final int CONCURRENCY_RIC = 1; // How many paralell requests that is sent to one NearRT RIC
- @Value.Immutable
- @org.immutables.gson.Gson.TypeAdapters
- public interface AdapterRequest {
- public String nearRtRicUrl();
+ @Getter
+ public static class AdapterRequest {
+ private String nearRtRicUrl = null;
+ private String body = null;
+
+ public AdapterRequest(String url, String body) {
+ this.nearRtRicUrl = url;
+ this.body = body;
+ }
- public Optional<String> body();
+ public AdapterRequest() {}
}
- @Value.Immutable
- @org.immutables.gson.Gson.TypeAdapters
- public interface AdapterOutput {
- public Optional<String> body();
+ @Getter
+ public static class AdapterOutput {
+ private String body = null;
+ private int httpStatus = 0;
- public int httpStatus();
+ public AdapterOutput(int status, String body) {
+ this.httpStatus = status;
+ this.body = body;
+ }
+
+ public AdapterOutput() {}
}
static com.google.gson.Gson gson = new GsonBuilder() //
public CcsdkA1AdapterClient(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClientFactory restClientFactory) {
this(protocolType, ricConfig, controllerConfig,
- restClientFactory.createRestClientNoHttpProxy(controllerConfig.baseUrl() + "/restconf/operations"));
+ restClientFactory.createRestClientNoHttpProxy(controllerConfig.getBaseUrl() + "/restconf/operations"));
}
/**
this.ricConfig = ricConfig;
this.protocolType = protocolType;
this.controllerConfig = controllerConfig;
- logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.ricId(), controllerConfig);
+ logger.debug("CcsdkA1AdapterClient for ric: {}, a1Controller: {}", ricConfig.getRicId(), controllerConfig);
} else {
throw new IllegalArgumentException("Not handeled protocolversion: " + protocolType);
}
}
private Mono<String> post(String rpcName, String ricUrl, Optional<String> body) {
- AdapterRequest inputParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(ricUrl) //
- .body(body) //
- .build();
+ AdapterRequest inputParams = new AdapterRequest(ricUrl, body.isPresent() ? body.get() : null);
+
final String inputJsonString = A1AdapterJsonHelper.createInputJsonString(inputParams);
logger.debug("POST inputJsonString = {}", inputJsonString);
return restClient
- .postWithAuthHeader(controllerUrl(rpcName), inputJsonString, this.controllerConfig.userName(),
- this.controllerConfig.password()) //
+ .postWithAuthHeader(controllerUrl(rpcName), inputJsonString, this.controllerConfig.getUserName(),
+ this.controllerConfig.getPassword()) //
.flatMap(this::extractResponseBody);
}
private Mono<String> extractResponse(JSONObject responseOutput) {
- AdapterOutput output = gson.fromJson(responseOutput.toString(), ImmutableAdapterOutput.class);
- Optional<String> optionalBody = output.body();
- String body = optionalBody.isPresent() ? optionalBody.get() : "";
- if (HttpStatus.valueOf(output.httpStatus()).is2xxSuccessful()) {
+ AdapterOutput output = gson.fromJson(responseOutput.toString(), AdapterOutput.class);
+
+ String body = output.body == null ? "" : output.body;
+ if (HttpStatus.valueOf(output.httpStatus).is2xxSuccessful()) {
return Mono.just(body);
} else {
- logger.debug("Error response: {} {}", output.httpStatus(), body);
+ logger.debug("Error response: {} {}", output.httpStatus, body);
byte[] responseBodyBytes = body.getBytes(StandardCharsets.UTF_8);
- HttpStatus httpStatus = HttpStatus.valueOf(output.httpStatus());
+ HttpStatus httpStatus = HttpStatus.valueOf(output.httpStatus);
WebClientResponseException responseException = new WebClientResponseException(httpStatus.value(),
httpStatus.getReasonPhrase(), null, responseBodyBytes, StandardCharsets.UTF_8, null);
}
private String baseUri() {
- return ricConfig.baseUrl() + "/a1-p";
+ return ricConfig.getBaseUrl() + "/a1-p";
}
}
public OscA1Client(RicConfig ricConfig, AsyncRestClient restClient) {
this.restClient = restClient;
- logger.debug("OscA1Client for ric: {}", ricConfig.ricId());
+ logger.debug("OscA1Client for ric: {}", ricConfig.getRicId());
uri = new UriBuilder(ricConfig);
}
}
private String baseUri() {
- return ricConfig.baseUrl() + "/A1-P/v1";
+ return ricConfig.getBaseUrl() + "/A1-P/v1";
}
private String policiesBaseUri() {
}
private String baseUri() {
- return ricConfig.baseUrl() + "/A1-P/v2";
+ return ricConfig.getBaseUrl() + "/A1-P/v2";
}
}
public StdA1ClientVersion2(RicConfig ricConfig, AsyncRestClient restClient) {
this.restClient = restClient;
- logger.debug("OscA1Client for ric: {}", ricConfig.ricId());
+ logger.debug("OscA1Client for ric: {}", ricConfig.getRicId());
uriBuiler = new OranV2UriBuilder(ricConfig);
}
public WebClientConfig getWebClientConfig() {
if (this.webClientConfig == null) {
- HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+ HttpProxyConfig httpProxyConfig = HttpProxyConfig.builder() //
.httpProxyHost(this.httpProxyHost) //
.httpProxyPort(this.httpProxyPort) //
.httpProxyType(ProxyProvider.Proxy.valueOf(this.httpProxyType)) //
.build();
- this.webClientConfig = ImmutableWebClientConfig.builder() //
+ this.webClientConfig = WebClientConfig.builder() //
.keyStoreType(this.sslKeyStoreType) //
.keyStorePassword(this.sslKeyStorePassword) //
.keyStore(this.sslKeyStore) //
ApplicationConfigParser.ConfigParserResult parserResult) {
Collection<RicConfigUpdate> modifications = new ArrayList<>();
- this.controllerConfigs = parserResult.controllerConfigs();
+ this.controllerConfigs = parserResult.getControllerConfigs();
- this.dmaapConsumerTopicUrl = parserResult.dmaapConsumerTopicUrl();
- this.dmaapProducerTopicUrl = parserResult.dmaapProducerTopicUrl();
+ this.dmaapConsumerTopicUrl = parserResult.getDmaapConsumerTopicUrl();
+ this.dmaapProducerTopicUrl = parserResult.getDmaapProducerTopicUrl();
Map<String, RicConfig> newRicConfigs = new HashMap<>();
- for (RicConfig newConfig : parserResult.ricConfigs()) {
- RicConfig oldConfig = this.ricConfigs.get(newConfig.ricId());
- this.ricConfigs.remove(newConfig.ricId());
+ for (RicConfig newConfig : parserResult.getRicConfigs()) {
+ RicConfig oldConfig = this.ricConfigs.get(newConfig.getRicId());
+ this.ricConfigs.remove(newConfig.getRicId());
if (oldConfig == null) {
- newRicConfigs.put(newConfig.ricId(), newConfig);
+ newRicConfigs.put(newConfig.getRicId(), newConfig);
modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.ADDED));
} else if (!newConfig.equals(oldConfig)) {
modifications.add(new RicConfigUpdate(newConfig, RicConfigUpdate.Type.CHANGED));
- newRicConfigs.put(newConfig.ricId(), newConfig);
+ newRicConfigs.put(newConfig.getRicId(), newConfig);
} else {
- newRicConfigs.put(oldConfig.ricId(), oldConfig);
+ newRicConfigs.put(oldConfig.getRicId(), oldConfig);
}
}
for (RicConfig deletedConfig : this.ricConfigs.values()) {
import javax.validation.constraints.NotNull;
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.Getter;
+
import org.json.JSONObject;
import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
import org.slf4j.Logger;
this.applicationConfig = applicationConfig;
}
- @Value.Immutable
- @Gson.TypeAdapters
- public interface ConfigParserResult {
- List<RicConfig> ricConfigs();
+ @Builder
+ @Getter
+ public static class ConfigParserResult {
+ private List<RicConfig> ricConfigs;
- Map<String, ControllerConfig> controllerConfigs();
+ @Builder.Default
+ private Map<String, ControllerConfig> controllerConfigs = new HashMap<>();
- String dmaapConsumerTopicUrl();
+ @Builder.Default
+ private String dmaapConsumerTopicUrl = "";
- String dmaapProducerTopicUrl();
+ @Builder.Default
+ private String dmaapProducerTopicUrl = "";
}
Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(pmsConfigJson);
checkConfigurationConsistency(ricConfigs, controllerConfigs);
- return ImmutableConfigParserResult.builder() //
+ return ConfigParserResult.builder() //
.dmaapConsumerTopicUrl(dmaapConsumerTopicUrl) //
.dmaapProducerTopicUrl(dmaapProducerTopicUrl) //
.ricConfigs(ricConfigs) //
Set<String> ricUrls = new HashSet<>();
Set<String> ricNames = new HashSet<>();
for (RicConfig ric : ricConfigs) {
- if (!ricUrls.add(ric.baseUrl())) {
- throw new ServiceException("Configuration error, more than one RIC URL: " + ric.baseUrl());
+ if (!ricUrls.add(ric.getBaseUrl())) {
+ throw new ServiceException("Configuration error, more than one RIC URL: " + ric.getBaseUrl());
}
- if (!ricNames.add(ric.ricId())) {
- throw new ServiceException("Configuration error, more than one RIC with name: " + ric.ricId());
+ if (!ricNames.add(ric.getRicId())) {
+ throw new ServiceException("Configuration error, more than one RIC with name: " + ric.getRicId());
}
- if (!ric.controllerName().isEmpty() && controllerConfigs.get(ric.controllerName()) == null) {
+ if (!ric.getControllerName().isEmpty() && controllerConfigs.get(ric.getControllerName()) == null) {
throw new ServiceException(
- "Configuration error, controller configuration not found: " + ric.controllerName());
+ "Configuration error, controller configuration not found: " + ric.getControllerName());
}
}
}
List<RicConfig> result = new ArrayList<>();
for (JsonElement ricElem : getAsJsonArray(config, "ric")) {
JsonObject ricJsonObj = ricElem.getAsJsonObject();
- RicConfig ricConfig = ImmutableRicConfig.builder() //
+ RicConfig ricConfig = RicConfig.builder() //
.ricId(get(ricJsonObj, "name", "id", "ricId").getAsString()) //
.baseUrl(get(ricJsonObj, "baseUrl").getAsString()) //
.managedElementIds(parseManagedElementIds(get(ricJsonObj, "managedElementIds").getAsJsonArray())) //
.controllerName(getString(ricJsonObj, CONTROLLER, ""))
.customAdapterClass(getString(ricJsonObj, "customAdapterClass", "")) //
.build();
- if (!ricConfig.baseUrl().isEmpty()) {
+ if (!ricConfig.getBaseUrl().isEmpty()) {
result.add(ricConfig);
} else {
- logger.error("RIC configuration error {}, baseUrl is empty", ricConfig.ricId());
+ logger.error("RIC configuration error {}, baseUrl is empty", ricConfig.getRicId());
}
}
return result;
Map<String, ControllerConfig> result = new HashMap<>();
for (JsonElement element : getAsJsonArray(config, CONTROLLER)) {
JsonObject controllerAsJson = element.getAsJsonObject();
- ImmutableControllerConfig controllerConfig = ImmutableControllerConfig.builder() //
+ ControllerConfig controllerConfig = ControllerConfig.builder() //
.name(get(controllerAsJson, "name").getAsString()) //
.baseUrl(get(controllerAsJson, "baseUrl").getAsString()) //
.password(get(controllerAsJson, "password").getAsString()) //
.userName(get(controllerAsJson, "userName").getAsString()) // )
.build();
- if (result.put(controllerConfig.name(), controllerConfig) != null) {
+ if (result.put(controllerConfig.getName(), controllerConfig) != null) {
throw new ServiceException(
- "Configuration error, more than one controller with name: " + controllerConfig.name());
+ "Configuration error, more than one controller with name: " + controllerConfig.getName());
}
}
return result;
package org.onap.ccsdk.oran.a1policymanagementservice.configuration;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
-@Value.Immutable
-@Value.Style(redactedMask = "####")
+@Builder
+@Getter
+@EqualsAndHashCode
+@ToString
+public class ControllerConfig {
+ private String name;
-public interface ControllerConfig {
- public String name();
+ private String baseUrl;
- public String baseUrl();
-
- public String userName();
-
- @Value.Redacted
- public String password();
+ private String userName;
+ @ToString.Exclude
+ private String password;
}
package org.onap.ccsdk.oran.a1policymanagementservice.configuration;
-import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.Collection;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
-@Value.Immutable
-public interface RicConfig {
- public String ricId();
+@Builder
+@Getter
+@EqualsAndHashCode
+@ToString
+public class RicConfig {
+ private String ricId;
- public String controllerName();
+ @Builder.Default
+ private String controllerName = "";
- public String baseUrl();
+ private String baseUrl;
- public ImmutableList<String> managedElementIds();
-
- public String customAdapterClass();
+ @Builder.Default
+ private Collection<String> managedElementIds = new ArrayList<>();
+ @Builder.Default
+ private String customAdapterClass = "";
}
package org.onap.ccsdk.oran.a1policymanagementservice.configuration;
-import org.immutables.value.Value;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.ToString;
import reactor.netty.transport.ProxyProvider;
-@Value.Immutable
-@Value.Style(redactedMask = "####")
-public interface WebClientConfig {
- public String keyStoreType();
+@Builder
+@Getter
+@ToString
+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();
+ @ToString.Exclude
+ 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
+ @ToString
+ public static class HttpProxyConfig {
+ private String httpProxyHost;
- public int httpProxyPort();
+ private int httpProxyPort;
- public ProxyProvider.Proxy httpProxyType();
+ private ProxyProvider.Proxy httpProxyType;
}
- public HttpProxyConfig httpProxyConfig();
+ private HttpProxyConfig httpProxyConfig;
}
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "service_callback_info_v2",
description = "Information transferred as in Service callbacks (callback_url)")
public class ServiceCallbackInfo {
private static final String EVENT_TYPE_DESCRIPTION = "values:\n" //
+ "AVAILABLE: the Near-RT RIC has become available for A1 Policy management";
- @Gson.TypeAdapters
@Schema(name = "event_type_v2", description = EVENT_TYPE_DESCRIPTION)
public enum EventType {
AVAILABLE
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 java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policy_id_list_v2", description = "A list of policy identities")
public class PolicyIdList {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policy_info_v2", description = "Information for one A1-P Policy")
public class PolicyInfo {
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policy_info_list_v2", description = "List of policy information")
public class PolicyInfoList {
import java.time.Instant;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policy_status_info_v2", description = "Status for one A1-P Policy")
public class PolicyStatusInfo {
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policytype_id_list_v2", description = "Information about policy types")
public class PolicyTypeIdList {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "policytype_v2", description = "Policy type")
public class PolicyTypeInfo {
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "ric_info_v2", description = "Information for a Near-RT RIC")
public class RicInfo {
- @Gson.TypeAdapters
@Schema(name = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
public enum RicState {
UNAVAILABLE, AVAILABLE, SYNCHRONIZING, CONSISTENCY_CHECK
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "ric_info_list_v2", description = "List of Near-RT RIC information")
public class RicInfoList {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "service_registration_info_v2", description = "Information for one service")
public class ServiceRegistrationInfo {
import io.swagger.v3.oas.annotations.media.Schema;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "service_status_v2")
public class ServiceStatus {
import java.util.Collection;
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
@Schema(name = "service_list_v2", description = "List of service information")
public class ServiceStatusList {
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
-import org.immutables.gson.Gson;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
public static final String API_NAME = "Health Check";
public static final String API_DESCRIPTION = "";
- @Gson.TypeAdapters
@Schema(name = "status_info_v2")
class StatusInfo {
@Schema(description = "status text")
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Holds information about a Near-RT RIC.
*/
public class Ric {
+ private static final Logger logger = LoggerFactory.getLogger(Ric.class);
@Setter
private RicConfig ricConfig;
*/
public Ric(RicConfig ricConfig) {
this.ricConfig = ricConfig;
- this.lock = new Lock(ricConfig.ricId());
+ this.lock = new Lock(ricConfig.getRicId());
}
public String id() {
- return ricConfig.ricId();
+ return ricConfig.getRicId();
}
public RicConfig getConfig() {
}
public synchronized void setState(RicState state) {
+ logger.debug("Ric {} state set to {}", getConfig().getRicId(), state);
this.state = state;
}
public synchronized A1ProtocolType getProtocolVersion() {
- if (this.ricConfig.customAdapterClass().isEmpty()) {
+ if (this.ricConfig.getCustomAdapterClass().isEmpty()) {
return this.protocolVersion;
} else {
return A1ProtocolType.CUSTOM_PROTOCOL;
* @return a vector containing the nodes managed by this Ric.
*/
public synchronized Collection<String> getManagedElementIds() {
- return new Vector<>(ricConfig.managedElementIds());
+ return new Vector<>(ricConfig.getManagedElementIds());
}
/**
* @return true if the given node is managed by this Ric.
*/
public synchronized boolean isManaging(String managedElementId) {
- return ricConfig.managedElementIds().contains(managedElementId);
+ return ricConfig.getManagedElementIds().contains(managedElementId);
}
/**
@Override
public synchronized String toString() {
return Ric.class.getSimpleName() + ": " + "name: " + id() + ", state: " + state + ", baseUrl: "
- + ricConfig.baseUrl() + ", managedNodes: " + ricConfig.managedElementIds();
+ + ricConfig.getBaseUrl() + ", managedNodes: " + ricConfig.getManagedElementIds();
}
/**
public Mono<RicConfigUpdate.Type> handleUpdatedRicConfig(RicConfigUpdate updatedInfo) {
synchronized (this.rics) {
- String ricId = updatedInfo.getRicConfig().ricId();
+ String ricId = updatedInfo.getRicConfig().getRicId();
RicConfigUpdate.Type event = updatedInfo.getType();
if (event == RicConfigUpdate.Type.ADDED) {
logger.debug("RIC added {}", ricId);
private final Services services;
private final AsyncRestClientFactory restClientFactory;
- private static class SynchStartedException extends ServiceException {
+ private static class SynchNeededException extends ServiceException {
private static final long serialVersionUID = 1L;
- public SynchStartedException(String message) {
- super(message);
+ public SynchNeededException(RicData ric) {
+ super("SynchNeededException for " + ric.ric.id());
}
}
}
private Mono<RicData> checkOneRic(RicData ricData) {
- return checkRicState(ricData) //
- .flatMap(x -> ricData.ric.getLock().lock(LockType.EXCLUSIVE, "checkOneRic")) //
- .flatMap(notUsed -> setRicState(ricData)) //
+ if (ricData.ric.getState() == RicState.CONSISTENCY_CHECK || ricData.ric.getState() == RicState.SYNCHRONIZING) {
+ return Mono.empty(); // Skip, already in progress
+ }
+ return ricData.ric.getLock().lock(LockType.EXCLUSIVE, "checkOneRic") //
+ .flatMap(lock -> synchIfUnavailable(ricData)) //
+ .doOnNext(ric -> ric.ric.setState(RicState.CONSISTENCY_CHECK)) //
.flatMap(x -> checkRicPolicies(ricData)) //
.flatMap(x -> checkRicPolicyTypes(ricData)) //
.doOnNext(x -> onRicCheckedOk(ricData)) //
- .doOnError(t -> onRicCheckedError(t, ricData)) //
+ .onErrorResume(t -> onRicCheckedError(t, ricData)) //
+ .doFinally(sig -> ricData.ric.getLock().unlockBlocking()) //
.onErrorResume(throwable -> Mono.empty());
}
- private void onRicCheckedError(Throwable t, RicData ricData) {
+ private Mono<RicData> onRicCheckedError(Throwable t, RicData ricData) {
logger.debug("Ric: {} check stopped, exception: {}", ricData.ric.id(), t.getMessage());
- if (!(t instanceof SynchStartedException)) {
- // If synch is started, the synch will set the final state
- ricData.ric.setState(RicState.UNAVAILABLE);
+ ricData.ric.setState(RicState.UNAVAILABLE);
+ if ((t instanceof SynchNeededException)) {
+ return startSynchronization(ricData);
+ } else {
+ logger.warn("RicSupervision, ric: {}, exception: {}", ricData.ric.id(), t.getMessage());
+ return Mono.empty();
}
- ricData.ric.getLock().unlockBlocking();
}
private void onRicCheckedOk(RicData ricData) {
logger.debug("Ric: {} checked OK", ricData.ric.id());
ricData.ric.setState(RicState.AVAILABLE);
- ricData.ric.getLock().unlockBlocking();
- }
-
- @SuppressWarnings("squid:S2445") // Blocks should be synchronized on "private final" fields
- private Mono<RicData> setRicState(RicData ric) {
- synchronized (ric) {
- if (ric.ric.getState() == RicState.CONSISTENCY_CHECK) {
- logger.debug("Ric: {} is already being checked", ric.ric.getConfig().ricId());
- return Mono.empty();
- }
- ric.ric.setState(RicState.CONSISTENCY_CHECK);
- return Mono.just(ric);
- }
}
private Mono<RicData> createRicData(Ric ric) {
.map(a1Client -> new RicData(ric, a1Client));
}
- private Mono<RicData> checkRicState(RicData ric) {
+ private Mono<RicData> synchIfUnavailable(RicData ric) {
if (ric.ric.getState() == RicState.UNAVAILABLE) {
- logger.debug("RicSupervision, starting ric: {} synchronization (state == UNAVAILABLE)", ric.ric.id());
- return startSynchronization(ric) //
- .onErrorResume(t -> Mono.empty());
- } else if (ric.ric.getState() == RicState.SYNCHRONIZING || ric.ric.getState() == RicState.CONSISTENCY_CHECK) {
- return Mono.empty();
+ return Mono.error(new SynchNeededException(ric));
} else {
return Mono.just(ric);
}
if (ricPolicies.size() != policies.getForRic(ric.ric.id()).size()) {
logger.debug("RicSupervision, starting ric: {} synchronization (noOfPolicices == {}, expected == {})",
ric.ric.id(), ricPolicies.size(), policies.getForRic(ric.ric.id()).size());
- return startSynchronization(ric);
+ return Mono.error(new SynchNeededException(ric));
}
for (String policyId : ricPolicies) {
if (!policies.containsPolicy(policyId)) {
logger.debug("RicSupervision, starting ric: {} synchronization (unexpected policy in RIC: {})",
ric.ric.id(), policyId);
- return startSynchronization(ric);
+ return Mono.error(new SynchNeededException(ric));
}
}
return Mono.just(ric);
logger.debug(
"RicSupervision, starting ric: {} synchronization (unexpected numer of policy types in RIC: {}, expected: {})",
ric.ric.id(), ricTypes.size(), ric.ric.getSupportedPolicyTypes().size());
- return startSynchronization(ric);
+ return Mono.error(new SynchNeededException(ric));
}
for (String typeName : ricTypes) {
if (!ric.ric.isSupportingType(typeName)) {
logger.debug("RicSupervision, starting ric: {} synchronization (unexpected policy type: {})",
ric.ric.id(), typeName);
- return startSynchronization(ric);
+ return Mono.error(new SynchNeededException(ric));
}
}
return Mono.just(ric);
}
private Mono<RicData> startSynchronization(RicData ric) {
+ logger.debug("RicSupervision, starting ric: {} synchronization, state: {}", ric.ric.id(), ric.ric.getState());
RicSynchronizationTask synchronizationTask = createSynchronizationTask();
return synchronizationTask.synchronizeRic(ric.ric) //
- .flatMap(notUsed -> Mono.error(new SynchStartedException("Syncronization started")));
+ .flatMap(notUsed -> Mono.just(ric));
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
-import reactor.core.publisher.SignalType;
/**
* Synchronizes the content of a Near-RT RIC with the content in the repository.
}
public void run(Ric ric) {
- logger.debug("Ric synchronization task created: {}", ric.getConfig().ricId());
+ logger.debug("Ric synchronization task created: {}", ric.getConfig().getRicId());
if (ric.getState() == RicState.SYNCHRONIZING) {
- logger.debug("Ric: {} is already being synchronized", ric.getConfig().ricId());
+ logger.debug("Ric: {} is already being synchronized", ric.getConfig().getRicId());
return;
}
ric.getLock().lock(LockType.EXCLUSIVE, "RicSynchronizationTask") //
.flatMap(notUsed -> synchronizeRic(ric)) //
- .subscribe(new BaseSubscriber<Object>() {
-
- @Override
- protected void hookFinally(SignalType type) {
- ric.getLock().unlockBlocking();
- }
- });
+ .doFinally(sig -> ric.getLock().unlockBlocking()) //
+ .subscribe();
}
public Mono<Ric> synchronizeRic(Ric ric) {
- return setRicState(ric) //
- .flatMap(lock -> this.a1ClientFactory.createA1Client(ric)) //
+ return this.a1ClientFactory.createA1Client(ric) //
+ .doOnNext(client -> ric.setState(RicState.SYNCHRONIZING)) //
.flatMapMany(client -> runSynchronization(ric, client)) //
.onErrorResume(throwable -> deleteAllPolicyInstances(ric, throwable)) //
.collectList() //
return a1Client.getPolicyTypeIdentities() //
.doOnNext(x -> ric.clearSupportedPolicyTypes()) //
.flatMapMany(Flux::fromIterable) //
- .doOnNext(typeId -> logger.debug("For ric: {}, handling type: {}", ric.getConfig().ricId(), typeId)) //
+ .doOnNext(typeId -> logger.debug("For ric: {}, handling type: {}", ric.getConfig().getRicId(), typeId)) //
.flatMap(policyTypeId -> getPolicyType(policyTypeId, a1Client), CONCURRENCY_RIC) //
.doOnNext(ric::addSupportedPolicyType); //
}
- @SuppressWarnings("squid:S2445") // Blocks should be synchronized on "private final" fields
- private Mono<Ric> setRicState(Ric ric) {
- synchronized (ric) {
- if (ric.getState() == RicState.SYNCHRONIZING) {
- logger.debug("Ric: {} is already being synchronized", ric.getConfig().ricId());
- return Mono.empty();
- }
- logger.debug("Ric state set to SYNCHRONIZING: {}", ric.getConfig().ricId());
- ric.setState(RicState.SYNCHRONIZING);
- return Mono.just(ric);
- }
- }
-
private Flux<Object> runSynchronization(Ric ric, A1Client a1Client) {
Flux<PolicyType> synchronizedTypes = synchronizePolicyTypes(ric, a1Client);
Flux<?> policiesDeletedInRic = a1Client.deleteAllPolicies();
}
private Flux<Policy> putPolicy(Policy policy, Ric ric, A1Client a1Client) {
- logger.trace("Recreating policy: {}, for ric: {}", policy.getId(), ric.getConfig().ricId());
+ logger.trace("Recreating policy: {}, for ric: {}", policy.getId(), ric.getConfig().getRicId());
return a1Client.putPolicy(policy) //
.flatMapMany(notUsed -> Flux.just(policy));
}
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import java.util.Vector;
-
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableControllerConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Ric;
private Ric ric;
private A1ClientFactory factoryUnderTest;
- private static ImmutableRicConfig ricConfig(String controllerName, String customAdapter) {
- return ImmutableRicConfig.builder() //
+ private static RicConfig ricConfig(String controllerName, String customAdapter) {
+ return RicConfig.builder() //
.ricId(RIC_NAME) //
.baseUrl("baseUrl") //
- .managedElementIds(new Vector<>()) //
.controllerName(controllerName) //
.customAdapterClass(customAdapter) //
.build();
}
- private static ImmutableRicConfig ricConfig(String controllerName) {
+ private static RicConfig ricConfig(String controllerName) {
return ricConfig(controllerName, "");
}
}
private void whenGetGetControllerConfigReturn() throws ServiceException {
- ControllerConfig controllerCfg = ImmutableControllerConfig.builder() //
+ ControllerConfig controllerCfg = ControllerConfig.builder() //
.name("name") //
.baseUrl("baseUrl") //
.password("pass") //
import java.util.Vector;
import org.json.JSONObject;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyType;
}
protected static Ric createRic(String url) {
- RicConfig cfg = ImmutableRicConfig.builder().ricId("ric") //
+ RicConfig cfg = RicConfig.builder().ricId("ric") //
.baseUrl(url) //
.managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
return new Ric(cfg);
}
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
-import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client.A1ProtocolType;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.CcsdkA1AdapterClient.AdapterOutput;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.CcsdkA1AdapterClient.AdapterRequest;
-import org.onap.ccsdk.oran.a1policymanagementservice.clients.ImmutableAdapterOutput.Builder;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ControllerConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableControllerConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.client.WebClientResponseException;
AsyncRestClient asyncRestClientMock;
private ControllerConfig controllerConfig() {
- return ImmutableControllerConfig.builder() //
+ return ControllerConfig.builder() //
.name("name") //
.baseUrl("baseUrl") //
.password(CONTROLLER_PASSWORD) //
assertEquals(1, policyTypeIds.size());
assertEquals(POLICY_TYPE_1_ID, policyTypeIds.get(0));
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
+ AdapterRequest expectedParams = new AdapterRequest(expUrl, null);
+
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
CONTROLLER_PASSWORD);
assertEquals(policyTypeId, respJson.getAsJsonObject().get("title").getAsString(),
"title should be updated to contain policyType ID");
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
+ AdapterRequest expectedParams = new AdapterRequest(expUrl, null);
+
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
assertEquals(1, returned.size());
for (String expUrl : expUrls) {
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
+ AdapterRequest expectedParams = new AdapterRequest(expUrl, null);
+
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
CONTROLLER_PASSWORD);
.block();
assertEquals("OK", returned);
- AdapterRequest expectedInputParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .body(POLICY_JSON_VALID) //
- .build();
+ AdapterRequest expectedInputParams = new AdapterRequest(expUrl, POLICY_JSON_VALID);
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedInputParams);
verify(asyncRestClientMock).postWithAuthHeader(PUT_A1_URL, expInput, CONTROLLER_USERNAME, CONTROLLER_PASSWORD);
controllerConfig(), asyncRestClientMock);
final String policyJson = "{}";
- AdapterOutput adapterOutput = ImmutableAdapterOutput.builder() //
- .body("NOK") //
- .httpStatus(HttpStatus.BAD_REQUEST.value()) // ERROR
- .build();
+ AdapterOutput adapterOutput = new AdapterOutput(HttpStatus.BAD_REQUEST.value(), "NOK");
String resp = A1AdapterJsonHelper.createOutputJsonString(adapterOutput);
whenAsyncPostThenReturn(Mono.just(resp));
clientUnderTest.deleteAllPolicies().blockLast();
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
+ AdapterRequest expectedParams = new AdapterRequest(expUrl, null);
+
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(DELETE_A1_URL, expInput, CONTROLLER_USERNAME,
CONTROLLER_PASSWORD);
assertEquals("OK", response);
String expUrl = RIC_1_URL + "/A1-P/v2/policytypes/type1/policies/policy1/status";
- ImmutableAdapterRequest expectedParams = ImmutableAdapterRequest.builder() //
- .nearRtRicUrl(expUrl) //
- .build();
+ AdapterRequest expectedParams = new AdapterRequest(expUrl, null);
+
String expInput = A1AdapterJsonHelper.createInputJsonString(expectedParams);
verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_STATUS_URL, expInput, CONTROLLER_USERNAME,
CONTROLLER_PASSWORD);
}
private String createOkResponseWithBody(Object body) {
- AdapterOutput output = ImmutableAdapterOutput.builder() //
- .body(gson().toJson(body)) //
- .httpStatus(HttpStatus.OK.value()) //
- .build();
+ AdapterOutput output = new AdapterOutput(HttpStatus.OK.value(), gson().toJson(body));
return A1AdapterJsonHelper.createOutputJsonString(output);
}
private String createOkResponseString(boolean withBody) {
- Builder responseBuilder = ImmutableAdapterOutput.builder().httpStatus(HttpStatus.OK.value());
- if (withBody) {
- responseBuilder.body(HttpStatus.OK.name());
- } else {
- responseBuilder.body(Optional.empty());
- }
- return A1AdapterJsonHelper.createOutputJsonString(responseBuilder.build());
+ String body = withBody ? HttpStatus.OK.name() : null;
+ AdapterOutput output = new AdapterOutput(HttpStatus.OK.value(), body);
+ return A1AdapterJsonHelper.createOutputJsonString(output);
}
private OngoingStubbing<Mono<String>> whenAsyncPostThenReturn(Mono<String> response) {
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import reactor.core.publisher.Flux;
@BeforeEach
void init() {
- RicConfig ricConfig = ImmutableRicConfig.builder() //
+ RicConfig ricConfig = RicConfig.builder() //
.ricId("name") //
.baseUrl("RicBaseUrl") //
- .managedElementIds(new ArrayList<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
asyncRestClientMock = mock(AsyncRestClient.class);
clientUnderTest = new OscA1Client(ricConfig, asyncRestClientMock);
@Test
void testGetPolicyIdentities() {
- doReturn(RIC_URL).when(ricConfigMock).baseUrl();
+ doReturn(RIC_URL).when(ricConfigMock).getBaseUrl();
Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString());
when(asyncRestClientMock.get(anyString())).thenReturn(policyIds);
@Test
void testPutPolicyValidResponse() {
- doReturn(RIC_URL).when(ricConfigMock).baseUrl();
+ doReturn(RIC_URL).when(ricConfigMock).getBaseUrl();
when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.just(POLICY_JSON));
Mono<String> policyMono =
@Test
void testDeletePolicy() {
- doReturn(RIC_URL).when(ricConfigMock).baseUrl();
+ doReturn(RIC_URL).when(ricConfigMock).getBaseUrl();
final String url = policiesBaseUrl() + POLICY_1_ID;
when(asyncRestClientMock.delete(url)).thenReturn(Mono.empty());
@Test
void testDeleteAllPolicies() {
- doReturn(RIC_URL).when(ricConfigMock).baseUrl();
+ doReturn(RIC_URL).when(ricConfigMock).getBaseUrl();
Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString());
when(asyncRestClientMock.get(policiesUrl())).thenReturn(policyIds);
when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty());
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.junit.jupiter.MockitoExtension;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import reactor.core.publisher.Flux;
@BeforeEach
void init() {
- RicConfig ricConfig = ImmutableRicConfig.builder() //
+ RicConfig ricConfig = RicConfig.builder() //
.ricId("name") //
.baseUrl(RIC_URL) //
- .managedElementIds(new ArrayList<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
asyncRestClientMock = mock(AsyncRestClient.class);
clientUnderTest = new StdA1ClientVersion2(ricConfig, asyncRestClientMock);
ApplicationConfigParser.ConfigParserResult result = parserUnderTest.parse(jsonRootObject);
- String topicUrl = result.dmaapProducerTopicUrl();
+ String topicUrl = result.getDmaapProducerTopicUrl();
assertEquals("http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE", topicUrl, "controller contents");
- topicUrl = result.dmaapConsumerTopicUrl();
+ topicUrl = result.getDmaapConsumerTopicUrl();
assertEquals(
"http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100",
topicUrl, "controller contents");
- Map<String, ControllerConfig> controllers = result.controllerConfigs();
+ Map<String, ControllerConfig> controllers = result.getControllerConfigs();
assertEquals(1, controllers.size(), "size");
- ImmutableControllerConfig expectedControllerConfig = ImmutableControllerConfig.builder() //
+ ControllerConfig expectedControllerConfig = ControllerConfig.builder() //
.baseUrl("http://localhost:8083/") //
.name("controller1") //
.userName("user") //
.password("password") //
.build(); //
- assertEquals(expectedControllerConfig, controllers.get("controller1"), "controller contents");
- assertEquals(2, result.ricConfigs().size());
+ ControllerConfig actual = controllers.get("controller1");
+ assertEquals(expectedControllerConfig, actual, "controller contents");
+
+ assertEquals(2, result.getRicConfigs().size());
}
private JsonObject getJsonRootObject() throws JsonIOException, JsonSyntaxException, IOException {
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
-import java.util.Vector;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(MockitoExtension.class)
class ApplicationConfigTest {
- private static final ImmutableRicConfig RIC_CONFIG_1 = ImmutableRicConfig.builder() //
+ private static final RicConfig RIC_CONFIG_1 = RicConfig.builder() //
.ricId("ric1") //
.baseUrl("ric1_url") //
- .managedElementIds(new Vector<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
- private static final ImmutableRicConfig RIC_CONFIG_2 = ImmutableRicConfig.builder() //
+ private static final RicConfig RIC_CONFIG_2 = RicConfig.builder() //
.ricId("ric2") //
.baseUrl("ric1_url") //
- .managedElementIds(new Vector<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
- private static final ImmutableRicConfig RIC_CONFIG_3 = ImmutableRicConfig.builder() //
+ private static final RicConfig RIC_CONFIG_3 = RicConfig.builder() //
.ricId("ric3") //
.baseUrl("ric1_url") //
- .managedElementIds(new Vector<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
ConfigParserResult configParserResult(RicConfig... rics) {
- return ImmutableConfigParserResult.builder() //
+ return ConfigParserResult.builder() //
.ricConfigs(Arrays.asList(rics)) //
.dmaapConsumerTopicUrl("dmaapConsumerTopicUrl") //
.dmaapProducerTopicUrl("dmaapProducerTopicUrl") //
assertEquals(RicConfigUpdate.Type.ADDED, update.get(0).getType());
assertTrue(appConfigUnderTest.getRicConfigs().contains(RIC_CONFIG_1), "Ric not added to configurations.");
- assertEquals(RIC_CONFIG_1, appConfigUnderTest.getRic(RIC_CONFIG_1.ricId()),
+ assertEquals(RIC_CONFIG_1, appConfigUnderTest.getRic(RIC_CONFIG_1.getRicId()),
"Not correct Ric retrieved from configurations.");
update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).collectList().block();
.setConfiguration(configParserResult(RIC_CONFIG_1, RIC_CONFIG_2, RIC_CONFIG_3)).collectList().block();
assertEquals(3, update.size());
- ImmutableRicConfig changedRicConfig = ImmutableRicConfig.builder() //
- .ricId(RIC_CONFIG_1.ricId()) //
+ RicConfig changedRicConfig = RicConfig.builder() //
+ .ricId(RIC_CONFIG_1.getRicId()) //
.baseUrl("changed_ric1_url") //
- .managedElementIds(new Vector<>()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
update = appConfigUnderTest.setConfiguration(configParserResult(changedRicConfig, RIC_CONFIG_2, RIC_CONFIG_3))
assertEquals(1, update.size());
assertEquals(RicConfigUpdate.Type.CHANGED, update.get(0).getType());
- assertEquals(changedRicConfig, appConfigUnderTest.getRic(RIC_CONFIG_1.ricId()),
+ assertEquals(changedRicConfig, appConfigUnderTest.getRic(RIC_CONFIG_1.getRicId()),
"Changed Ric not retrieved from configurations.");
}
import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig.RicConfigUpdate;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableWebClientConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.WebClientConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.controllers.ServiceCallbackInfo;
private AsyncRestClient restClient(String baseUrl, boolean useTrustValidation) {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- 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()) //
- .httpProxyConfig(config.httpProxyConfig()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
+ .httpProxyConfig(config.getHttpProxyConfig()) //
.build();
AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext(""));
if (managedElement != null) {
mes.add(managedElement);
}
- return ImmutableRicConfig.builder() //
+ return RicConfig.builder() //
.ricId(ricId) //
.baseUrl(ricId) //
.managedElementIds(mes) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
}
import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableWebClientConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.WebClientConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Rics;
import org.onap.ccsdk.oran.a1policymanagementservice.tasks.RefreshConfigTask;
private AsyncRestClient restClient() {
WebClientConfig config = this.applicationConfig.getWebClientConfig();
- 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(false) //
- .trustStore(config.trustStore()) //
- .trustStorePassword(config.trustStorePassword()) //
- .httpProxyConfig(config.httpProxyConfig()) //
+ .trustStore(config.getTrustStore()) //
+ .trustStorePassword(config.getTrustStorePassword()) //
+ .httpProxyConfig(config.getHttpProxyConfig()) //
.build();
AsyncRestClientFactory f = new AsyncRestClientFactory(config, new SecurityContext(""));
import java.net.URL;
import java.time.Duration;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Optional;
import java.util.Properties;
import java.util.Vector;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser.ConfigParserResult;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ConfigurationFile;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableConfigParserResult;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyTypes;
ConfigurationFile configurationFileMock;
private static final String RIC_1_NAME = "ric1";
- private static final RicConfig CORRECT_RIC_CONIFG = ImmutableRicConfig.builder() //
+ private static final RicConfig CORRECT_RIC_CONIFG = RicConfig.builder() //
.ricId(RIC_1_NAME) //
.baseUrl("http://localhost:8080/") //
.managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
private RefreshConfigTask createTestObject(boolean configFileExists) {
}
ConfigParserResult configParserResult(RicConfig... rics) {
- return ImmutableConfigParserResult.builder() //
+ return ConfigParserResult.builder() //
.ricConfigs(Arrays.asList(rics)) //
- .dmaapConsumerTopicUrl("") //
- .dmaapProducerTopicUrl("") //
- .controllerConfigs(new HashMap<>()) //
.build();
}
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
+import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Lock.LockType;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies;
.schema("") //
.build();
- private static final Ric RIC_1 = new Ric(ImmutableRicConfig.builder() //
+ private static final Ric RIC_1 = new Ric(RicConfig.builder() //
.ricId("ric_1") //
.baseUrl("baseUrl1") //
.managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
.controllerName("controllerName") //
- .customAdapterClass("") //
.build());
private static final String POLICY_1_ID = "policyId1";
verify(supervisorUnderTest).checkAllRics();
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.AVAILABLE);
}
@Test
verify(supervisorUnderTest).createSynchronizationTask();
verify(synchronizationTaskMock).synchronizeRic(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@Test
verify(supervisorUnderTest).checkAllRics();
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.SYNCHRONIZING);
}
@Test
verify(supervisorUnderTest).createSynchronizationTask();
verify(synchronizationTaskMock).synchronizeRic(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@Test
verify(supervisorUnderTest).createSynchronizationTask();
verify(synchronizationTaskMock).synchronizeRic(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
+
}
@Test
verify(supervisorUnderTest).checkAllRics();
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@Test
verify(supervisorUnderTest).createSynchronizationTask();
verify(synchronizationTaskMock).synchronizeRic(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@Test
verify(supervisorUnderTest).createSynchronizationTask();
verify(synchronizationTaskMock).synchronizeRic(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@SuppressWarnings("unchecked")
import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.SecurityContext;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
+import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyType;
@BeforeEach
void init() {
- ric1 = new Ric(ImmutableRicConfig.builder() //
+ ric1 = new Ric(RicConfig.builder() //
.ricId(RIC_1_NAME) //
.baseUrl("baseUrl1") //
- .managedElementIds(Collections.emptyList()) //
.controllerName("controllerName") //
- .customAdapterClass("") //
.build());
policy1 = createPolicy("policyId1", false);
policyTypes = new PolicyTypes(appConfig);
import java.time.Duration;
import java.time.Instant;
-import java.util.Collections;
import org.awaitility.Durations;
import org.junit.jupiter.api.Test;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1Client;
import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig;
-import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies;
import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policy;
private Services services;
private Service service;
private Policies policies;
- private RicConfig ricConfig = ImmutableRicConfig.builder() //
+ private RicConfig ricConfig = RicConfig.builder() //
.ricId(RIC_NAME) //
.baseUrl("baseUrl") //
- .managedElementIds(Collections.emptyList()) //
- .controllerName("") //
- .customAdapterClass("") //
.build();
private Ric ric = new Ric(ricConfig);
private PolicyType policyType = PolicyType.builder() //
},
"keep_alive_interval_seconds": {
"format": "int64",
- "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intervals must invoke a 'keepalive' REST call. When a service does not invoke this call within the given time, it is considered unavailable. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
+ "description": "keep alive interval for the service. This is used to enable optional heartbeat supervision of the service. If set (> 0) the registered service should regularly invoke a 'keepalive' REST call. When a service fails to invoke this 'keepalive' call within the configured time, the service is considered unavailable. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means timeout supervision is disabled.",
"type": "integer"
}
}
},
"/a1-policy/v2/services/{service_id}/keepalive": {"put": {
"summary": "Heartbeat indicates that the service is running",
- "description": "A registered service must call this in regular intervals to indicate that it is in operation. Absence of this call will lead to that the service will be deregistered and all its policies are removed.",
+ "description": "A registered service should invoke this operation regularly to indicate that it is still alive. If a registered service fails to invoke this operation before the end of a timeout period the service will be deregistered and all its A1 policies wil be removed. (This timeout can be set or disabled when each service is initially registered)",
"operationId": "keepAliveService",
"responses": {
"200": {
"url": "http://www.apache.org/licenses/LICENSE-2.0"
},
"description": "<h2>General<\/h2><p>The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policies. <br/>The main tasks of the service are:<\/p><ul><li>A1 Policy creation, modification and deletion.<\/li><li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs<\/li><li>Maintaining a view of supported Near-RT RIC policy types<\/li><li>Supervision of using services (R-APPs). When a service is unavailable, its policies are removed.<\/li><\/ul><h2>APIs provided by the service<\/h2><h3>A1 Policy Management<\/h3><p>This is an API for management of A1 Policies.<\/p><ul><li>A1 Policy retrieval, creation, modification and deletion.<\/li><li>Retrieval of supported A1 Policy types for a Near-RT RIC<\/li><li>Retrieval of status for existing A1 policies<\/li><\/ul><h3>Management of configuration<\/h3><p>API for updating and retrieval of the component configuration. Note that there other ways to maintain the configuration.<\/p><h3>Callbacks<\/h3><p>These are endpoints that are invoked by this service. The callbacks are registered in this service at service registration.<\/p><h3>NearRT-RIC Repository<\/h3><p>This is an API that provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one Near-RT RIC.<\/p><h3>Health Check<\/h3><p>API used for supervision of the PMS component.<\/p><h3>Service Registry and Supervision<\/h3><p>API used for registering services that uses PMS. Each A1 policy is owned by a service. PMS can supervise each registered service and will automatically remove policies for unavailable services.<\/p>",
- "title": "A1 Policy management service",
+ "title": "A1 Policy Management Service",
"version": "1.1.0"
},
"tags": [
openapi: 3.0.1
info:
- title: A1 Policy management service
+ title: A1 Policy Management Service
description: <h2>General</h2><p>The O-RAN Non-RT RIC Policy Management Service provides
a REST API for management of A1 policies. <br/>The main tasks of the service are:</p><ul><li>A1
Policy creation, modification and deletion.</li><li>Monitoring and maintaining
tags:
- Service Registry and Supervision
summary: Heartbeat indicates that the service is running
- description: A registered service must call this in regular intervals to indicate
- that it is in operation. Absence of this call will lead to that the service
- will be deregistered and all its policies are removed.
+ description: A registered service should invoke this operation regularly to
+ indicate that it is still alive. If a registered service fails to invoke this
+ operation before the end of a timeout period the service will be deregistered
+ and all its A1 policies wil be removed. (This timeout can be set or disabled
+ when each service is initially registered)
operationId: keepAliveService
parameters:
- name: service_id
description: identity of the service
keep_alive_interval_seconds:
type: integer
- description: keep alive interval for the service. This is a heartbeat supervision
- of the service, which in regular intervals must invoke a 'keepalive' REST
- call. When a service does not invoke this call within the given time,
- it is considered unavailable. An unavailable service will be automatically
- deregistered and its policies will be deleted. Value 0 means no timeout
- supervision.
+ description: keep alive interval for the service. This is used to enable
+ optional heartbeat supervision of the service. If set (> 0) the registered
+ service should regularly invoke a 'keepalive' REST call. When a service
+ fails to invoke this 'keepalive' call within the configured time, the
+ service is considered unavailable. An unavailable service will be automatically
+ deregistered and its policies will be deleted. Value 0 means timeout supervision
+ is disabled.
format: int64
description: Information for one service
policy_info_list_v2: