* @param ricConfig the configuration of the Ric to communicate with
* @param controllerConfig the configuration of the SDNC controller to use
* @param ricConfig the configuration of the Ric to communicate with
* @param controllerConfig the configuration of the SDNC controller to use
*/
public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig) {
this(protocolType, ricConfig, controllerConfig,
*/
public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig) {
this(protocolType, ricConfig, controllerConfig,
* @param ricConfig the configuration of the Ric to communicate with
* @param controllerConfig the configuration of the SDNC controller to use
* @param restClient the REST client to use
* @param ricConfig the configuration of the Ric to communicate with
* @param controllerConfig the configuration of the SDNC controller to use
* @param restClient the REST client to use
*/
public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClient restClient) {
*/
public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
AsyncRestClient restClient) {
+ if (!(A1ProtocolType.SDNC_OSC_STD_V1_1.equals(protocolType)
+ || A1ProtocolType.SDNC_OSC_OSC_V1.equals(protocolType))) {
+ throw new IllegalArgumentException("Protocol type must be " + A1ProtocolType.SDNC_OSC_STD_V1_1 + " or "
+ + A1ProtocolType.SDNC_OSC_OSC_V1 + ", was: " + protocolType);
+ }
this.restClient = restClient;
this.ricConfig = ricConfig;
this.protocolType = protocolType;
this.restClient = restClient;
this.ricConfig = ricConfig;
this.protocolType = protocolType;
public Mono<List<String>> getPolicyTypeIdentities() {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just(Arrays.asList(""));
public Mono<List<String>> getPolicyTypeIdentities() {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just(Arrays.asList(""));
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
final String ricUrl = uri.createPolicyTypesUri();
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString) //
.collectList();
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
final String ricUrl = uri.createPolicyTypesUri();
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString) //
.collectList();
public Mono<String> getPolicyTypeSchema(String policyTypeId) {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just("{}");
public Mono<String> getPolicyTypeSchema(String policyTypeId) {
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just("{}");
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
final String ricUrl = uri.createGetSchemaUri(policyTypeId);
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMap(response -> OscA1Client.extractCreateSchema(response, policyTypeId));
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
final String ricUrl = uri.createGetSchemaUri(policyTypeId);
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMap(response -> OscA1Client.extractCreateSchema(response, policyTypeId));
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return getPolicyIds() //
.flatMap(policyId -> deletePolicyById("", policyId), CONCURRENCY_RIC); //
if (this.protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return getPolicyIds() //
.flatMap(policyId -> deletePolicyById("", policyId), CONCURRENCY_RIC); //
OscA1Client.UriBuilder uriBuilder = new OscA1Client.UriBuilder(ricConfig);
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable) //
.flatMap(type -> oscDeleteInstancesForType(uriBuilder, type), CONCURRENCY_RIC);
OscA1Client.UriBuilder uriBuilder = new OscA1Client.UriBuilder(ricConfig);
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable) //
.flatMap(type -> oscDeleteInstancesForType(uriBuilder, type), CONCURRENCY_RIC);
private Mono<A1UriBuilder> getUriBuilder() {
if (protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just(new StdA1ClientVersion1.UriBuilder(ricConfig));
private Mono<A1UriBuilder> getUriBuilder() {
if (protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
return Mono.just(new StdA1ClientVersion1.UriBuilder(ricConfig));
final String ricUrl = uri.createGetPolicyIdsUri();
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
final String ricUrl = uri.createGetPolicyIdsUri();
return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
.flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable)
.flatMap(type -> post(GET_POLICY_RPC, uri.createGetPolicyIdsUri(type), Optional.empty())) //
.flatMap(SdncJsonHelper::parseJsonArrayOfString);
OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
return getPolicyTypeIdentities() //
.flatMapMany(Flux::fromIterable)
.flatMap(type -> post(GET_POLICY_RPC, uri.createGetPolicyIdsUri(type), Optional.empty())) //
.flatMap(SdncJsonHelper::parseJsonArrayOfString);
} else {
logger.debug("Error response: {} {}", output.httpStatus(), body);
byte[] responseBodyBytes = body.getBytes(StandardCharsets.UTF_8);
} else {
logger.debug("Error response: {} {}", output.httpStatus(), body);
byte[] responseBodyBytes = body.getBytes(StandardCharsets.UTF_8);
- WebClientResponseException e = new WebClientResponseException(output.httpStatus(), "statusText", null,
- responseBodyBytes, StandardCharsets.UTF_8, null);
+ WebClientResponseException responseException = new WebClientResponseException(output.httpStatus(),
+ "statusText", null, responseBodyBytes, StandardCharsets.UTF_8, null);