summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java3
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java12
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql9
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java23
15 files changed, 224 insertions, 10 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index 3deabb3ce1..24dab2fc5b 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -145,6 +145,8 @@ public class ArchiveInfraRequestsScheduler {
archivedInfra.setVnfType(iar.getVnfType());
archivedInfra.setVolumeGroupId(iar.getVolumeGroupId());
archivedInfra.setVolumeGroupName(iar.getVolumeGroupName());
+ archivedInfra.setProductFamilyName(iar.getProductFamilyName());
+ archivedInfra.setTenantName(iar.getTenantName());
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
new file mode 100644
index 0000000000..a79b1a86c1
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
@@ -0,0 +1,7 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200); \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index c2c8e933b1..db541f7f7f 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -58,6 +58,7 @@ import org.onap.aai.domain.yang.PortGroup;
import org.onap.aai.domain.yang.Project;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceSubscription;
import org.onap.aai.domain.yang.SpPartner;
@@ -122,6 +123,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
+ public static final AAIObjectType SERVICE = new AAIObjectType(
+ AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
public static final AAIObjectType SERVICE_INSTANCE =
new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index 4a284b55ec..777dcc6171 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
@@ -37,6 +37,8 @@ public class CloudConfiguration implements Serializable {
protected String aicNodeClli;
@JsonProperty("tenantId")
protected String tenantId;
+ @JsonProperty("tenantName")
+ protected String tenantName;
@JsonProperty("cloudOwner")
protected String cloudOwner = Defaults.CLOUD_OWNER.toString();
@JsonProperty("lcpCloudRegionId")
@@ -82,6 +84,13 @@ public class CloudConfiguration implements Serializable {
this.tenantId = value;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
public String getLcpCloudRegionId() {
return lcpCloudRegionId;
@@ -102,7 +111,8 @@ public class CloudConfiguration implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
- .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
+ .append("tenantName", getTenantName()).append("cloudOwner", getCloudOwner())
+ .append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index 250c5df5ce..026db1e644 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
@@ -43,6 +43,8 @@ public class RequestInfo implements Serializable {
protected String orderNumber;
@JsonProperty("productFamilyId")
protected String productFamilyId;
+ @JsonProperty("productFamilyName")
+ protected String productFamilyName;
@JsonProperty("orderVersion")
protected Integer orderVersion;
@JsonSerialize(include = Inclusion.ALWAYS)
@@ -180,6 +182,14 @@ public class RequestInfo implements Serializable {
public void setProductFamilyId(String productFamilyId) {
this.productFamilyId = productFamilyId;
+ };
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
}
/**
@@ -215,9 +225,9 @@ public class RequestInfo implements Serializable {
public String toString() {
return "RequestInfo [billingAccountNumber=" + billingAccountNumber + ", callbackUrl=" + callbackUrl
+ ", correlator=" + correlator + ", orderNumber=" + orderNumber + ", productFamilyId=" + productFamilyId
- + ", orderVersion=" + orderVersion + ", source=" + source + ", instanceName=" + instanceName
- + ", suppressRollback=" + suppressRollback + ", requestorId=" + requestorId + ", applicationId="
- + applicationId + "]";
+ + ", productFamilyName=" + productFamilyName + ", orderVersion=" + orderVersion + ", source=" + source
+ + ", instanceName=" + instanceName + ", suppressRollback=" + suppressRollback + ", requestorId="
+ + requestorId + ", applicationId=" + applicationId + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 31e026b332..ce371203ab 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -42,7 +42,11 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation;
import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation;
@@ -97,7 +101,6 @@ import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class MsoRequest {
@@ -107,6 +110,9 @@ public class MsoRequest {
@Autowired
private ResponseBuilder builder;
+ @Autowired
+ private AAIDataRetrieval aaiDataRet;
+
@Value("${mso.enforceDLP:false}")
private boolean enforceDLP;
@@ -316,6 +322,25 @@ public class MsoRequest {
aq.setPnfName(servInsReq.getPnfName());
}
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ logger.debug("Retrieving productFamilyName to put into requests db");
+
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ logger.debug("Found service by service-id");
+ String productFamilyName = service.getServiceDescription();
+ if (productFamilyName != null) {
+ aq.setProductFamilyName(productFamilyName);
+ }
+ }
+ }
+
+ aq.setProductFamilyName(getProductFamilyNameFromAAI(servInsReq));
+
+ aq.setTenantName(getTenantNameFromAAI(servInsReq));
+
if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
if (servInsReq.getRequestDetails().getRequestInfo() != null) {
if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) {
@@ -683,4 +708,31 @@ public class MsoRequest {
return vnfType;
}
+ protected String getTenantNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String tenantName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getCloudConfiguration() != null
+ && servInsReq.getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ Tenant tenant = aaiDataRet.getTenant(servInsReq.getRequestDetails().getCloudConfiguration().getCloudOwner(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getTenantId());
+ if (tenant != null) {
+ tenantName = tenant.getTenantName();
+ }
+ }
+ return tenantName;
+ }
+
+ protected String getProductFamilyNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String productFamilyName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ productFamilyName = service.getServiceDescription();
+ }
+ }
+ return productFamilyName;
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index ae68cc6032..fec93f72e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -347,6 +347,13 @@ public class OrchestrationRequests {
} else {
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
}
+ if (requestDetails.getRequestInfo() != null && iar.getProductFamilyName() != null) {
+ requestDetails.getRequestInfo().setProductFamilyName(iar.getProductFamilyName());
+ }
+ if (requestDetails.getCloudConfiguration() != null && iar.getTenantName() != null) {
+ requestDetails.getCloudConfiguration().setTenantName(iar.getTenantName());
+ }
+
} catch (IOException e) {
logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 344e5438c9..fee7a3a8f4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -3,7 +3,9 @@ package org.onap.so.apihandlerinfra.infra.rest;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
@@ -34,7 +36,6 @@ public class AAIDataRetrieval {
});
}
-
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
return this.getAaiResourcesClient()
.get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
@@ -75,6 +76,24 @@ public class AAIDataRetrieval {
});
}
+ public Service getService(String serviceId) {
+ return this.getAaiResourcesClient()
+ .get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
+ logger.debug("No Service found in A&AI ServiceId: {}", serviceId);
+ return null;
+ });
+ }
+
+ public Tenant getTenant(String cloudOwner, String cloudRegion, String tenantId) {
+ return this.getAaiResourcesClient()
+ .get(Tenant.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ .orElseGet(() -> {
+ logger.debug("No Tenant found in A&AI TenantId: {}", tenantId);
+ return null;
+ });
+ }
+
protected AAIResourcesClient getAaiResourcesClient() {
if (aaiResourcesClient == null) {
aaiResourcesClient = new AAIResourcesClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index f1d5a5487f..d1e5dc717e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
@@ -34,12 +35,19 @@ import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.domain.yang.Service;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.test.context.junit4.rules.SpringClassRule;
@@ -75,6 +83,17 @@ public class MsoRequestTest extends BaseTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Mock
+ private AAIDataRetrieval aaiDataRet;
+
+ @InjectMocks
+ private MsoRequest msoRequestMock;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
public String inputStream(String JsonInput) throws IOException {
JsonInput = "src/test/resources/MsoRequestTest" + JsonInput;
String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
@@ -1056,5 +1075,37 @@ public class MsoRequestTest extends BaseTest {
assertNotNull(result);
}
+ @Test
+ public void getTenantNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String tenantId = "88a6ca3ee0394ade9403f075db23167e";
+ String tenantNameFromAAI = "testTenantName";
+ String cloudRegion = "mdt1";
+ String cloudOwner = "cloudOwner";
+ this.sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(tenantId);
+ tenant.setTenantName(tenantNameFromAAI);
+ doReturn(tenant).when(aaiDataRet).getTenant(cloudOwner, cloudRegion, tenantId);
+ String tenantName = msoRequestMock.getTenantNameFromAAI(this.sir);
+ assertEquals(tenantNameFromAAI, tenantName);
+ }
+
+
+ @Test
+ public void getProductFamilyNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceDescription = "testServiceDescription";
+ Service service = new Service();
+ service.setServiceId(serviceId);
+ service.setServiceDescription(serviceDescription);
+ doReturn(service).when(aaiDataRet).getService(serviceId);
+ String productFamilyName = msoRequestMock.getProductFamilyNameFromAAI(this.sir);
+ assertEquals(serviceDescription, productFamilyName);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index f566628ee3..1332ffd913 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -441,6 +441,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -483,6 +487,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -524,6 +532,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -1939,6 +1951,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
@@ -2114,6 +2130,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
new file mode 100644
index 0000000000..f0d511789f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
@@ -0,0 +1,4 @@
+{
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "service-description": "testServiceDescription"
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 1a1e9bec79..85a17dd369 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1297,6 +1297,8 @@ CREATE TABLE `infra_active_requests` (
`ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
`EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
`ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
+ `TENANT_NAME` varchar(200) DEFAULT NULL,
+ `PRODUCT_FAMILY_NAME` varchar(200) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 1efd125c2b..c6d22f5402 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -100,7 +100,10 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
REQUEST_URL VARCHAR SELECTIVITY 1,
ORIGINAL_REQUEST_ID VARCHAR SELECTIVITY 1,
EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
- ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
+ ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1
+
);
INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
@@ -169,7 +172,9 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_ID VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_NAME VARCHAR SELECTIVITY 1,
- REQUEST_URL VARCHAR SELECTIVITY 1
+ REQUEST_URL VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1
);
CREATE TABLE IF NOT EXISTS cloud_api_requests(
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index 9b246460b8..750fa13c77 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -89,6 +89,7 @@ public class InfraActiveRequests extends InfraRequests {
.append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", getOriginalRequestId())
.append("extSystemErrorSource", getExtSystemErrorSource())
- .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource()).toString();
+ .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource())
+ .append("tenantName", getTenantName()).append("productFamilyName", getProductFamilyName()).toString();
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 6d6b5a825e..66768ea349 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -149,6 +149,10 @@ public abstract class InfraRequests implements java.io.Serializable {
private String extSystemErrorSource;
@Column(name = "ROLLBACK_EXT_SYSTEM_ERROR_SOURCE", length = 80)
private String rollbackExtSystemErrorSource;
+ @Column(name = "TENANT_NAME", length = 80)
+ private String tenantName;
+ @Column(name = "PRODUCT_FAMILY_NAME", length = 80)
+ private String productFamilyName;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
@@ -550,6 +554,22 @@ public abstract class InfraRequests implements java.io.Serializable {
this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
+ }
+
@PrePersist
protected void onCreate() {
if (requestScope == null)
@@ -609,6 +629,7 @@ public abstract class InfraRequests implements java.io.Serializable {
.append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
.append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)
- .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).toString();
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("tenantName", tenantName)
+ .append("productFamilyName", productFamilyName).toString();
}
}