Merge "Fix bug in A1 clients"
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
index dba6c91..113abcb 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
@@ -75,9 +75,10 @@
assertNoControllerConfig(ric, version);
return new OscA1Client(ric.getConfig(), this.appConfig.getWebClientConfig());
} else if (version == A1ProtocolType.SDNC_OSC_STD_V1_1 || version == A1ProtocolType.SDNC_OSC_OSC_V1) {
- return new SdncOscA1Client(version, ric.getConfig(), getControllerConfig(ric));
+ return new SdncOscA1Client(version, ric.getConfig(), getControllerConfig(ric),
+ this.appConfig.getWebClientConfig());
} else if (version == A1ProtocolType.SDNC_ONAP) {
- return new SdncOnapA1Client(ric.getConfig(), getControllerConfig(ric));
+ return new SdncOnapA1Client(ric.getConfig(), getControllerConfig(ric), this.appConfig.getWebClientConfig());
} else {
logger.error("Unhandled protocol: {}", version);
throw new ServiceException("Unhandled protocol");
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
index a10decd..37e0303 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
@@ -29,6 +29,7 @@
import org.immutables.value.Value;
import org.oransc.policyagent.configuration.ControllerConfig;
import org.oransc.policyagent.configuration.RicConfig;
+import org.oransc.policyagent.configuration.WebClientConfig;
import org.oransc.policyagent.repository.Policy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,8 +64,9 @@
private final RicConfig ricConfig;
private final AsyncRestClient restClient;
- public SdncOnapA1Client(RicConfig ricConfig, ControllerConfig controllerConfig) {
- this(ricConfig, controllerConfig, new AsyncRestClient(controllerConfig.baseUrl() + "/restconf/operations"));
+ public SdncOnapA1Client(RicConfig ricConfig, ControllerConfig controllerConfig, WebClientConfig clientConfig) {
+ this(ricConfig, controllerConfig,
+ new AsyncRestClient(controllerConfig.baseUrl() + "/restconf/operations", clientConfig));
logger.debug("SdncOnapA1Client for ric: {}, a1ControllerBaseUrl: {}", ricConfig.name(),
controllerConfig.baseUrl());
}
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
index 2763ab9..79a2a5e 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
@@ -33,6 +33,7 @@
import org.json.JSONObject;
import org.oransc.policyagent.configuration.ControllerConfig;
import org.oransc.policyagent.configuration.RicConfig;
+import org.oransc.policyagent.configuration.WebClientConfig;
import org.oransc.policyagent.repository.Policy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -87,9 +88,10 @@
*
* @throws IllegalArgumentException when the protocolType is wrong.
*/
- public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig) {
+ public SdncOscA1Client(A1ProtocolType protocolType, RicConfig ricConfig, ControllerConfig controllerConfig,
+ WebClientConfig clientConfig) {
this(protocolType, ricConfig, controllerConfig,
- new AsyncRestClient(controllerConfig.baseUrl() + "/restconf/operations"));
+ new AsyncRestClient(controllerConfig.baseUrl() + "/restconf/operations", clientConfig));
logger.debug("SdncOscA1Client for ric: {}, a1Controller: {}", ricConfig.name(), controllerConfig);
}
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java b/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
index 8a2f044..a6f6187 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
@@ -96,7 +96,7 @@
@Test
void createClientWithWrongProtocol_thenErrorIsThrown() {
try {
- new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, null);
+ new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, new AsyncRestClient("", null));
fail("Should have thrown exception.");
} catch (IllegalArgumentException e) {
return;