aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java20
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java1
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java37
4 files changed, 32 insertions, 28 deletions
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
index 20093be6a4..1da6fc096f 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
@@ -52,7 +52,6 @@ import org.onap.appc.client.lcm.model.ZULU;
@Component
public class ApplicationControllerClient {
-
@Autowired
public Environment env;
@@ -117,6 +116,7 @@ public class ApplicationControllerClient {
controllerType = DEFAULT_CONTROLLER_TYPE;
}
controllerType = controllerType.toUpperCase();
+
return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
.createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
} catch (AppcClientException e) {
@@ -128,7 +128,7 @@ public class ApplicationControllerClient {
}
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
- Optional<String> request, String controllerType, ApplicationControllerCallback listener)
+ Optional<String> request, String controllerType, ApplicationControllerCallback listener, String requestorId)
throws ApplicationControllerOrchestratorException {
this.setControllerType(controllerType);
Status status;
@@ -142,7 +142,7 @@ public class ApplicationControllerClient {
payload = new Payload(request.get());
}
- status = runCommand(action, actionIdentifiers, payload, requestId, listener);
+ status = runCommand(action, actionIdentifiers, payload, requestId, listener, requestorId);
if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
@@ -152,11 +152,11 @@ public class ApplicationControllerClient {
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers,
- org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener)
- throws ApplicationControllerOrchestratorException {
+ org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener,
+ String requestorId) throws ApplicationControllerOrchestratorException {
Status status;
Object requestObject;
- requestObject = createRequest(action, actionIdentifiers, payload, requestID);
+ requestObject = createRequest(action, actionIdentifiers, payload, requestID, requestorId);
appCSupport.logLCMMessage(requestObject);
LifeCycleManagerStateful client = getAppCClient();
Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
@@ -194,12 +194,13 @@ public class ApplicationControllerClient {
return properties;
}
- public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
+ public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId,
+ String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
- CommonHeader commonHeader = buildCommonHeader(requestId);
+ CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject,
commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
@@ -215,12 +216,13 @@ public class ApplicationControllerClient {
return requestObject;
}
- private CommonHeader buildCommonHeader(String requestId) {
+ private CommonHeader buildCommonHeader(String requestId, String requestorId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
+ commonHeader.setXOnapRequestorid(requestorId);
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index 8e38935441..e61053d043 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -111,7 +111,7 @@ public class ApplicationControllerTaskImpl {
status = appcClient.vnfCommand(request.getAction(), msoRequestId,
request.getApplicationControllerVnf().getVnfId(), vserverId, payload, request.getControllerType(),
- listener);
+ listener, request.getRequestorId());
return status;
}
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
index 82b0695ed9..cac8e9e16a 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
@@ -63,6 +63,7 @@ public class ApplicationControllerTaskImplITTest {
@Before
public void setup() {
request = new ApplicationControllerTaskRequest();
+ request.setRequestorId("testRequestorId");
request.setBookName("testBookName");
request.setControllerType("testControllerType");
request.setFileParameters("testFileParams");
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index ff979acf7b..fe2b4f84b5 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -52,6 +52,7 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ request.setRequestorId("testRequestorId");
Map<String, String> reqConfigParams = new HashMap<>();
reqConfigParams.put("name1", "value1");
reqConfigParams.put("name2", "value2");
@@ -77,13 +78,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@@ -99,13 +100,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -118,13 +119,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -133,13 +134,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener)).thenReturn(new Status());
+ "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener);
+ "testControllerType", listener, "testRequestorId");
}
@Test
@@ -154,13 +155,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -179,13 +180,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -204,13 +205,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -224,13 +225,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -251,13 +252,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test