- private Flux<String> getPolicyIds() {
- SdncOscAdapterInput inputParams = ImmutableSdncOscAdapterInput.builder() //
- .nearRtRicUrl(ricConfig.baseUrl()) //
- .build();
- String inputJsonString = createInputJsonString(inputParams);
- logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString);
-
- return restClient
- .postWithAuthHeader("/A1-ADAPTER-API:getPolicyIdentities", inputJsonString, a1ControllerUsername,
- a1ControllerPassword) //
- .flatMap(response -> getValueFromResponse(response, "policy-id-list")) //
- .flatMapMany(this::parseJsonArrayOfString);
- }
-
- private Mono<String> getValueFromResponse(String response, String key) {
- logger.debug("A1 client: response = {}", response);
- try {
- JSONObject outputJson = new JSONObject(response);
- JSONObject responseParams = outputJson.getJSONObject("output");
- if (!responseParams.has(key)) {
- return Mono.just("");
- }
- String value = responseParams.get(key).toString();
- return Mono.just(value);
- } catch (JSONException ex) { // invalid json
- return Mono.error(ex);
+ private Mono<A1UriBuilder> getUriBuilder() {
+ if (protocolType == A1ProtocolType.SDNC_OSC_STD_V1_1) {
+ return Mono.just(new StdA1ClientVersion1.UriBuilder(ricConfig));
+ } else if (this.protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ return Mono.just(new OscA1Client.UriBuilder(ricConfig));
+ } else {
+ return Mono.error(createIllegalProtocolException());