summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-07-06 11:54:49 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-07-06 12:26:03 +0200
commit7f3ac1ec967c0768c3807c1d980e4b6b658d7ec0 (patch)
tree6c876ff62b462eecac5ed989198c49fe164e90ef /src
parent41c7f9dab184a49808104b308a57409f4ee8a1b1 (diff)
adapt NBI to Beijing
-change SO Url to "v6" -add xtransactionid in AAI request header -add fields Project and OwningEntity in SO request -fix tests Change-Id: I61f3ef9f99f4d200cc8f04e7f4929dc1fddf130a Issue-ID: EXTAPI-117 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java14
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java38
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java29
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java19
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java22
-rw-r--r--src/main/resources/application.properties6
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java8
-rw-r--r--src/test/resources/application.properties4
-rw-r--r--src/test/resources/mappings/so_delete_service_instance.json2
-rw-r--r--src/test/resources/mappings/so_get_.json2
-rw-r--r--src/test/resources/mappings/so_post_create_service_instance.json2
14 files changed, 152 insertions, 13 deletions
diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
index 67c72e3..69cc5be 100644
--- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
+++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
@@ -42,7 +42,7 @@ public final class OnapComponentsUrlPaths {
"/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
// MSO
- public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/ecomp/mso/infra/serviceInstances/v4";
- public static final String MSO_GET_REQUEST_STATUS_PATH = "/ecomp/mso/infra/orchestrationRequests/v4/";
- public static final String MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/v4/";
+ public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/ecomp/mso/infra/serviceInstances/v6";
+ public static final String MSO_GET_REQUEST_STATUS_PATH = "/ecomp/mso/infra/orchestrationRequests/v6/";
+ public static final String MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/v6/";
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
index 5cd4c35..a09917c 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
@@ -41,9 +41,13 @@ public class AaiClient extends BaseClient {
@Value("${aai.api.id}")
private String aaiApiId;
+ @Value("${aai.header.transaction.id}")
+ private String aaiTransactionId;
+
private static final String HEADER_AUTHORIZATION = "Authorization";
private static final String X_FROM_APP_ID = "X-FromAppId";
private static final Logger LOGGER = LoggerFactory.getLogger(AaiClient.class);
+ private static final String X_TRANSACTION_ID = "X-TransactionId";
private HttpHeaders buildRequestHeaderForAAI() {
@@ -52,6 +56,8 @@ public class AaiClient extends BaseClient {
httpHeaders.add(X_FROM_APP_ID, aaiApiId);
httpHeaders.add("Accept", "application/json");
httpHeaders.add("Content-Type", "application/json");
+ httpHeaders.add(X_TRANSACTION_ID, aaiTransactionId);
+
return httpHeaders;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
index 4c9d8e5..72ee99e 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java
@@ -29,13 +29,23 @@ public abstract class BaseClient {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseClient.class);
+
@Autowired
private RestTemplate restTemplate;
+
+
protected ResponseEntity<Object> callApiGet(String callURL, HttpHeaders httpHeaders) {
- ResponseEntity<Object> response = restTemplate.exchange(callURL, HttpMethod.GET,
- new HttpEntity<>("parameters", httpHeaders), Object.class);
+
+ if(LOGGER.isDebugEnabled()){
+ LOGGER.debug("log request : "+callURL+ " "+httpHeaders);
+ }
+
+ ResponseEntity<Object> response = null;
+ response = restTemplate.exchange(callURL, HttpMethod.GET,
+ new HttpEntity<>("parameters", httpHeaders), Object.class);
+
if(LOGGER.isDebugEnabled()){
LOGGER.debug("response body : {}",response.getBody().toString());
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
index 5e4668a..4884485 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
@@ -53,6 +53,10 @@ public class MultiClient {
@Value("${aai.api.id}")
private String aaiApiId;
+ @Value("${aai.header.transaction.id}")
+ private String aaiTransactionId;
+
+
@Value("${onap.lcpCloudRegionId}")
private String lcpCloudRegionId;
@@ -71,6 +75,7 @@ public class MultiClient {
private static final String HEADER_AUTHORIZATION = "Authorization";
private static final String X_FROM_APP_ID = "X-FromAppId";
+ private static final String X_TRANSACTION_ID = "X-TransactionId";
private static final Logger LOGGER = LoggerFactory.getLogger(MultiClient.class);
@@ -96,6 +101,8 @@ public class MultiClient {
httpHeaders.add(X_FROM_APP_ID, aaiApiId);
httpHeaders.add("Accept", "application/json");
httpHeaders.add("Content-Type", "application/json");
+ httpHeaders.add(X_TRANSACTION_ID, aaiTransactionId);
+
return httpHeaders;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java
new file mode 100644
index 0000000..fb80d2d
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/OwningEntity.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2018 Orange
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class OwningEntity {
+
+ private String owningEntityId;
+ private String owningEntityName;
+
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+
+ public void setOwningEntityId(String owningEntityId) {
+ this.owningEntityId = owningEntityId;
+ }
+
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+
+ public void setOwningEntityName(String owningEntityName) {
+ this.owningEntityName = owningEntityName;
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java
new file mode 100644
index 0000000..fca5391
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Project.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2018 Orange
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class Project {
+
+ private String projectName;
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
index da5b1ad..2354b39 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
@@ -27,6 +27,25 @@ public class RequestDetails {
private CloudConfiguration cloudConfiguration;
+ private OwningEntity owningEntity;
+
+ private Project project;
+
+ public Project getProject() {
+ return project;
+ }
+
+ public void setProject(Project project) {
+ this.project = project;
+ }
+
+ public OwningEntity getOwningEntity() {
+ return owningEntity;
+ }
+
+ public void setOwningEntity(OwningEntity owningEntity) {
+ this.owningEntity = owningEntity;
+ }
public CloudConfiguration getCloudConfiguration() {
return cloudConfiguration;
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
index 66bb408..def4fe0 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -28,6 +28,8 @@ import org.onap.nbi.apis.serviceorder.model.consumer.CreateServiceInstanceRespon
import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
import org.onap.nbi.apis.serviceorder.model.consumer.MSOPayload;
import org.onap.nbi.apis.serviceorder.model.consumer.ModelInfo;
+import org.onap.nbi.apis.serviceorder.model.consumer.OwningEntity;
+import org.onap.nbi.apis.serviceorder.model.consumer.Project;
import org.onap.nbi.apis.serviceorder.model.consumer.RequestDetails;
import org.onap.nbi.apis.serviceorder.model.consumer.RequestInfo;
import org.onap.nbi.apis.serviceorder.model.consumer.RequestParameters;
@@ -60,6 +62,15 @@ public class SOTaskProcessor {
@Value("${onap.tenantId}")
private String tenantId;
+ @Value("${so.owning.entity.id}")
+ private String soOwningEntityId;
+
+ @Value("${so.owning.entity.name}")
+ private String soOwningEntityName;
+
+ @Value("${so.project.name}")
+ private String soProjectName;
+
@Autowired
private ServiceOrderService serviceOrderService;
@@ -289,6 +300,17 @@ public class SOTaskProcessor {
CloudConfiguration cloudConfiguration = new CloudConfiguration(lcpCloudRegionId, tenantId);
requestDetails.setCloudConfiguration(cloudConfiguration);
+
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId(soOwningEntityId);
+ owningEntity.setOwningEntityName(soOwningEntityName);
+ requestDetails.setOwningEntity(owningEntity);
+
+ Project project = new Project();
+ project.setProjectName(soProjectName);
+
+ requestDetails.setProject(project);
+
return requestDetails;
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 4e45084..7c9975f 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -38,12 +38,16 @@ sdc.header.authorization=Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2Y
# AAI
aai.host=https://10.0.1.1:8443
aai.header.authorization=Basic QUFJOkFBSQ==
-aai.api.id=AAI
+aai.api.id=NBI
+aai.header.transaction.id=808b54e3-e563-4144-a1b9-e24e2ed93d4f
# SO
so.host=http://10.0.5.1:8080
so.header.authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==
so.api.id=SO
+so.owning.entity.id=6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e
+so.owning.entity.name=OE-generic
+so.project.name=Project-generic
# MONGO
spring.data.mongodb.host=localhost
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
index 35e89c2..78d5b2a 100644
--- a/src/test/java/org/onap/nbi/apis/ApiTest.java
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -665,7 +665,7 @@ public class ApiTest {
ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
executionTaskRepository, ActionType.ADD);
- removeWireMockMapping("/ecomp/mso/infra/orchestrationRequests/v4/requestId");
+ removeWireMockMapping("/ecomp/mso/infra/orchestrationRequests/v6/requestId");
SoTaskProcessor.processOrderItem(executionTaskA);
@@ -707,7 +707,7 @@ public class ApiTest {
ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
executionTaskRepository, ActionType.ADD);
- removeWireMockMapping("/ecomp/mso/infra/serviceInstances/v4");
+ removeWireMockMapping("/ecomp/mso/infra/serviceInstances/v6");
SoTaskProcessor.processOrderItem(executionTaskA);
@@ -729,8 +729,8 @@ public class ApiTest {
ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
executionTaskRepository, ActionType.ADD);
- removeWireMockMapping("/ecomp/mso/infra/serviceInstances/v4");
- removeWireMockMapping("/ecomp/mso/infra/orchestrationRequests/v4/requestId");
+ removeWireMockMapping("/ecomp/mso/infra/serviceInstances/v6");
+ removeWireMockMapping("/ecomp/mso/infra/orchestrationRequests/v6/requestId");
SoTaskProcessor.processOrderItem(executionTaskA);
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index f6df654..1361d42 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -39,11 +39,15 @@ sdc.header.authorization=Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2Y
aai.host=http://127.0.0.1:8091
aai.header.authorization=Basic QUFJOkFBSQ==
aai.api.id=AAI
+aai.header.transaction.id=808b54e3-e563-4144-a1b9-e24e2ed93d4f
# SO
so.host=http://127.0.0.1:8091
so.header.authorization=
so.api.id=SO
+so.owning.entity.id=6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e
+so.owning.entity.name=OE-generic
+so.project.name=Project-generic
# H2
spring.datasource.url=jdbc:h2:mem:~/db;DB_CLOSE_ON_EXIT=false
diff --git a/src/test/resources/mappings/so_delete_service_instance.json b/src/test/resources/mappings/so_delete_service_instance.json
index b294d0b..141b877 100644
--- a/src/test/resources/mappings/so_delete_service_instance.json
+++ b/src/test/resources/mappings/so_delete_service_instance.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "DELETE",
- "url": "/ecomp/mso/infra/serviceInstances/v4/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
+ "url": "/ecomp/mso/infra/serviceInstances/v6/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
},
"response": {
"status": 202,
diff --git a/src/test/resources/mappings/so_get_.json b/src/test/resources/mappings/so_get_.json
index 5d4148f..6fc9c9c 100644
--- a/src/test/resources/mappings/so_get_.json
+++ b/src/test/resources/mappings/so_get_.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
- "url": "/ecomp/mso/infra/orchestrationRequests/v4/requestId"
+ "url": "/ecomp/mso/infra/orchestrationRequests/v6/requestId"
},
"response": {
"status": 200,
diff --git a/src/test/resources/mappings/so_post_create_service_instance.json b/src/test/resources/mappings/so_post_create_service_instance.json
index f5aaa90..7724860 100644
--- a/src/test/resources/mappings/so_post_create_service_instance.json
+++ b/src/test/resources/mappings/so_post_create_service_instance.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "POST",
- "url": "/ecomp/mso/infra/serviceInstances/v4"
+ "url": "/ecomp/mso/infra/serviceInstances/v6"
},
"response": {
"status": 201,