diff options
author | 2018-07-09 11:46:10 +0200 | |
---|---|---|
committer | 2018-07-09 11:46:10 +0200 | |
commit | 89e09af4b56c883059378623d67e3b514e42fb76 (patch) | |
tree | ea20786492fc13276a2c42f2ff1a204e05070489 /src/main/java | |
parent | a42cd685193bd9156a25fe0708ba8c4a30664137 (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: I014e8731079134dae8754900b00f71f48dd530aa
Issue-ID: EXTAPI-117
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java')
8 files changed, 125 insertions, 3 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 c973f32..68e4aea 100644 --- a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java @@ -34,6 +34,10 @@ public abstract class BaseClient { protected ResponseEntity<Object> callApiGet(String callURL, HttpHeaders httpHeaders) { + if(LOGGER.isDebugEnabled()){ + LOGGER.debug("log request : "+callURL+ " "+httpHeaders); + } + ResponseEntity<Object> response = restTemplate.exchange(callURL, HttpMethod.GET, new HttpEntity<>("parameters", httpHeaders), Object.class); 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 a7e3356..ccf6423 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java @@ -61,6 +61,9 @@ public class MultiClient { @Value("${onap.cloudOwner}") private String cloudOwner; + @Value("${aai.header.transaction.id}") + private String aaiTransactionId; + @Autowired private ServiceCatalogUrl serviceCatalogUrl; @@ -70,6 +73,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); @@ -99,6 +103,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 24e137b..dde740f 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 @@ -48,6 +48,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 ServiceOrderRepository serviceOrderRepository; @@ -275,6 +284,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; } |