summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-moi
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-moi')
-rw-r--r--bpmn/so-bpmn-moi/pom.xml173
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasks.java335
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTask.java73
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTask.java208
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTask.java186
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/AAISliceProfileUtil.java279
-rw-r--r--bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/SliceProfileAaiToMoiMapperUtil.java94
-rw-r--r--bpmn/so-bpmn-moi/src/main/resources/process/ActivateRANNssiBB.bpmn39
-rw-r--r--bpmn/so-bpmn-moi/src/main/resources/process/AssignRANNssiBB.bpmn99
-rw-r--r--bpmn/so-bpmn-moi/src/main/resources/process/DeleteRANNssiBB.bpmn39
-rw-r--r--bpmn/so-bpmn-moi/src/main/resources/process/EnrichGBB.bpmn74
-rw-r--r--bpmn/so-bpmn-moi/src/main/resources/process/ModifyRANNssiBB.bpmn39
-rw-r--r--bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasksTest.java162
-rw-r--r--bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTaskTest.java101
-rw-r--r--bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTaskTest.java41
-rw-r--r--bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTaskTest.java121
16 files changed, 2063 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-moi/pom.xml b/bpmn/so-bpmn-moi/pom.xml
new file mode 100644
index 0000000000..4f1d777766
--- /dev/null
+++ b/bpmn/so-bpmn-moi/pom.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>bpmn</artifactId>
+ <groupId>org.onap.so</groupId>
+ <version>1.12.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-moi</artifactId>
+ <name>SO BPMN MOI</name>
+ <packaging>jar</packaging>
+
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.extension.mockito</groupId>
+ <artifactId>camunda-bpm-mockito</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.connect</groupId>
+ <artifactId>camunda-connect-connectors-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
+ <dependency>
+ <!-- Needed for InMemoryH2Test -->
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-jsr223</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCoreBPMN</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-catalog-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-adapters-rest-interface</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-lib</artifactId>
+ <version>${appc.client.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-kit</artifactId>
+ <version>${appc.client.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ <version>2.26</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>uk.co.blackpepper.bowman</groupId>
+ <artifactId>bowman-client</artifactId>
+ <version>${bowman.client.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>pl.pragmatists</groupId>
+ <artifactId>JUnitParams</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.11.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasks.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasks.java
new file mode 100644
index 0000000000..1ef073ca68
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasks.java
@@ -0,0 +1,335 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.aai.domain.yang.*;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.moi.util.AAISliceProfileUtil;
+import org.onap.so.bpmn.moi.util.SliceProfileAaiToMoiMapperUtil;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.moi.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Component
+public class AssignRANNssiBBTasks {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AssignRANNssiBBTasks.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+ @Autowired
+ AAISliceProfileUtil aaiSliceProfileUtil;
+
+ @Autowired
+ private SliceProfileAaiToMoiMapperUtil mapperUtil;
+
+ public void createNssi(BuildingBlockExecution execution) throws Exception {
+
+
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+
+ ModelInfoServiceInstance modelInfoServiceInstance = gBB.getServiceInstance().getModelInfoServiceInstance();
+
+ // for NON-SHARED check if its Already present
+ if (checkNSSI(execution)) {
+ if (aaiSliceProfileUtil.getServiceInstance(execution).isPresent()) {
+ throw new RuntimeException("Invalid NSSI, Slice subnet already exists");
+ }
+ }
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(serviceInstanceId);
+ serviceInstance.setServiceInstanceName("ran_" + serviceInstanceId);
+ serviceInstance.setOrchestrationStatus("Assigned");
+ serviceInstance.setServiceType("nssi");
+ serviceInstance.setModelInvariantId(modelInfoServiceInstance.getModelInvariantUuid());
+ serviceInstance.setModelVersionId(modelInfoServiceInstance.getModelUuid());
+ serviceInstance.setOperationalStatus("LOCKED");
+
+ Customer customer = getCustomer(execution);
+
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(serviceInstance.getServiceInstanceId()));
+
+ injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(serviceInstance));
+
+ }
+
+ private boolean checkNSSI(BuildingBlockExecution execution) {
+
+ Optional<ServiceInstance> serviceInstance = aaiSliceProfileUtil.getServiceInstance(execution);
+
+
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+
+ List<Map<String, Object>> mapUserParams = gBB.getRequestContext().getRequestParameters().getUserParams();
+
+
+ Attributes attributes = null;
+
+ for (Map<String, Object> userParamData : mapUserParams) {
+ if (userParamData.get("nssi") != null) {
+ Map<String, Object> mapParam = (Map<String, Object>) userParamData.get("nssi");
+ attributes = mapper.convertValue(mapParam, Attributes.class);
+ }
+ }
+ if (attributes.getSliceProfileList().get(0).getRANSliceSubnetProfile().getResourceSharingLevel()
+ .equalsIgnoreCase("NON-SHARED"))
+ return true;
+ else
+ return false;
+ }
+
+
+ public void createSliceProfileInstance(BuildingBlockExecution execution) {
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+
+ Customer customer = getCustomer(execution);
+
+ List<Map<String, Object>> mapUserParams = gBB.getRequestContext().getRequestParameters().getUserParams();
+
+
+ Attributes attributes = null;
+
+ for (Map<String, Object> userParamData : mapUserParams) {
+ if (userParamData.get("nssi") != null) {
+ Map<String, Object> mapParam = (Map<String, Object>) userParamData.get("nssi");
+ attributes = mapper.convertValue(mapParam, Attributes.class);
+ }
+ }
+ // Create SliceProfile Instance
+ ServiceInstance sliceProfileServiceInstance = new ServiceInstance();
+ String sliceProfileInstanceId = UUID.randomUUID().toString();
+ sliceProfileServiceInstance.setServiceInstanceId(sliceProfileInstanceId);
+ sliceProfileServiceInstance.setServiceInstanceName("slice-profile-" + serviceInstanceId);
+ sliceProfileServiceInstance.setServiceRole("slice-profile");
+
+ sliceProfileServiceInstance =
+ mapperUtil.fillSliceProfileInstanceFromMoiRequest(attributes, sliceProfileServiceInstance);
+
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileServiceInstance.getServiceInstanceId()));
+
+ injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(sliceProfileServiceInstance));
+
+ List<Map<String, Object>> sliceProfilesData = gBB.getRequestContext().getRequestParameters().getUserParams();
+
+ // sliceProfile
+ SliceProfile sliceProfile = mapperUtil.extractAaiSliceProfileFromMoiRequest(attributes);
+ String sliceProfileId = UUID.randomUUID().toString();
+ sliceProfile.setProfileId(sliceProfileId);
+
+ AAIResourceUri sliceProfileURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileInstanceId).sliceProfile(sliceProfile.getProfileId()));
+
+ injectionHelper.getAaiClient().createIfNotExists(sliceProfileURI, Optional.of(sliceProfile));
+
+ execution.setVariable("sliceProfileServiceInstanceId", sliceProfileServiceInstance.getServiceInstanceId());
+ }
+
+ public void allotResources(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String sliceProfileServiceInstanceId = execution.getVariable("sliceProfileServiceInstanceId");
+
+ LOGGER.debug("sliceProfileServiceInstanceId: {}", sliceProfileServiceInstanceId);
+
+ Customer customer = getCustomer(execution);
+
+ org.onap.aai.domain.yang.v23.AllottedResource allottedResource =
+ new org.onap.aai.domain.yang.v23.AllottedResource();
+
+ UUID allottedResourceUuid = UUID.randomUUID();
+ allottedResource.setId(allottedResourceUuid.toString());
+
+ AAIResourceUri allotedResourceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileServiceInstanceId).allottedResource(allottedResource.getId()));
+
+ injectionHelper.getAaiClient().createIfNotExists(allotedResourceURI, Optional.of(allottedResource));
+
+ execution.setVariable("allottedResourceUuid", allottedResource.getId());
+
+ }
+
+
+ public void addSliceProfileToNssi(BuildingBlockExecution execution) {
+ LOGGER.info("Entering into addSliceProfileToNssi");
+
+ String sliceProfileServiceInstanceId = execution.getVariable("sliceProfileServiceInstanceId");
+ String allottedResourceUuid = execution.getVariable("allottedResourceUuid");
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+
+ Customer customer = getCustomer(execution);
+
+
+ AAIResourceUri nssiUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(serviceInstanceId));
+
+ AAIResourceUri allotedResourceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileServiceInstanceId).allottedResource(allottedResourceUuid));
+
+ try {
+ injectionHelper.getAaiClient().connect(allotedResourceURI, nssiUri);
+ } catch (Exception e) {
+ LOGGER.error(">>>>> Error in creating Relationship: {} ", e);
+ }
+ }
+
+ public void activateNssi(BuildingBlockExecution execution) {
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+
+ Customer customer = getCustomer(execution);
+
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(serviceInstanceId));
+
+ Optional<ServiceInstance> serviceInstanceReturned =
+ injectionHelper.getAaiClient().get(ServiceInstance.class, serviceInstanceURI);
+
+ ServiceInstance serviceInstance = null;
+ if (serviceInstanceReturned.isPresent()) {
+ serviceInstance = serviceInstanceReturned.get();
+ serviceInstance.setOperationalStatus("UNLOCKED");
+ serviceInstance.setOrchestrationStatus("Active");
+
+ try {
+ injectionHelper.getAaiClient().update(serviceInstanceURI, serviceInstance);
+ } catch (Exception e) {
+ LOGGER.error("Nssi couldnot be activated: {}", e);
+ }
+ } else {
+ LOGGER.debug("Service Instance not present with Id: {}", serviceInstanceId);
+ }
+
+ // SliceProfile
+ List<org.onap.so.moi.SliceProfile> sliceProfileList = new ArrayList<org.onap.so.moi.SliceProfile>();
+ ServiceInstance serviceInstanceObj;
+ List<Relationship> listOfNssiRelationship = serviceInstance.getRelationshipList().getRelationship();
+
+ List<Relationship> listOfNssiRelationshipAR = listOfNssiRelationship.stream()
+ .filter(relationship -> relationship.getRelatedTo().equalsIgnoreCase("allotted-resource"))
+ .collect(Collectors.toList());
+
+ for (Relationship relationship : listOfNssiRelationshipAR) {
+ org.onap.so.moi.SliceProfile sliceProfile = new org.onap.so.moi.SliceProfile();
+ for (RelationshipData relationshipData : relationship.getRelationshipData()) {
+ if (relationshipData.getRelationshipKey().equalsIgnoreCase("service-instance.service-instance-id")) {
+ String sliceProfileInstanceId = relationshipData.getRelationshipValue();
+
+ Optional<ServiceInstance> sliceProfileServiceInstance =
+ aaiRestClient.getServiceInstanceById(sliceProfileInstanceId, "5G", "5GCustomer");
+ if (sliceProfileServiceInstance.isPresent()) {
+ ServiceInstance sliceProflieInstance = sliceProfileServiceInstance.get();
+ sliceProflieInstance.setOperationalStatus("UNLOCKED");
+ sliceProflieInstance.setOrchestrationStatus("ACTIVE");
+
+ AAIResourceUri sliceProfileInstanceURI = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(customer.getServiceSubscriptions().getServiceSubscription()
+ .get(0).getServiceType())
+ .serviceInstance(sliceProflieInstance.getServiceInstanceId()));
+ try {
+ injectionHelper.getAaiClient().update(sliceProfileInstanceURI, sliceProflieInstance);
+ } catch (Exception e) {
+ LOGGER.error("SliceProfile couldnot be activated: {}", e);
+ }
+ } else {
+ LOGGER.debug("Slice Profile Instance not present with Id: {}", serviceInstanceId);
+ }
+
+
+ }
+ }
+
+ }
+ }
+
+
+ private Customer getCustomer(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceType = gBB.getCustomer().getServiceSubscription().getServiceType();
+
+ String globalCustomerId = gBB.getCustomer().getGlobalCustomerId();
+
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType(serviceType);
+
+ ServiceSubscriptions serviceSubscriptions = new ServiceSubscriptions();
+ serviceSubscriptions.getServiceSubscription().add(serviceSubscription);
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId(globalCustomerId);
+ customer.setServiceSubscriptions(serviceSubscriptions);
+
+ return customer;
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTask.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTask.java
new file mode 100644
index 0000000000..f464ed23f3
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTask.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.moi.util.AAISliceProfileUtil;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+
+@Component
+public class DeleteRANNssiBBTask {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteRANNssiBBTask.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ AAISliceProfileUtil aaiSliceProfileUtil;
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+
+ public void deleteNssi(BuildingBlockExecution execution) throws JsonProcessingException {
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> sliceProfilesData = gBB.getRequestContext().getRequestParameters().getUserParams();
+ String sliceProfileIdFromRequest = mapUserParamsToSliceProfile(sliceProfilesData);
+ aaiSliceProfileUtil.deleteSliceProfile(execution, sliceProfileIdFromRequest);
+ }
+
+
+
+ private String mapUserParamsToSliceProfile(List<Map<String, Object>> sliceProfilesData)
+ throws JsonProcessingException {
+ Map<String, Object> mapParam = (Map<String, Object>) sliceProfilesData.get(0).get("nssi");
+ List<Object> list = (ArrayList<Object>) mapParam.get("sliceProfileList");
+ Map<String, Object> idMap = (Map<String, Object>) list.get(0);
+ String sliceProfileId = (String) idMap.get("sliceProfileId");
+ return sliceProfileId;
+ }
+
+}
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTask.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTask.java
new file mode 100644
index 0000000000..4247b242bf
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTask.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.common.InjectExecution;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.common.scripts.OofUtils;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.moi.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class EnrichGBBTask {
+
+ private static final String EXECUTE_BB_VAR_NAME = "buildingBlock";
+ private static final String GBB_INPUT_VAR_NAME = "gBBInput";
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+ JsonUtils jsonUtil = new JsonUtils();
+
+ @Autowired
+ CatalogDbClient catalogDbClient;
+
+ InjectExecution injectExecution = new InjectExecution();
+
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(EnrichGBBTask.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+ OofUtils oofUtils = new OofUtils(null);
+
+ public void prepareOofRequest(DelegateExecution execution) throws Exception {
+
+ String msoReqId = (String) execution.getVariable("mso-request-id");
+
+
+ BuildingBlockExecution gBuildingBlockExecution =
+ (BuildingBlockExecution) execution.getVariable("gBuildingBlockExecution");
+
+ DelegateExecutionImpl gbbEx = injectExecution.execute(execution,
+ (DelegateExecutionImpl) execution.getVariable("gBuildingBlockExecution"));
+
+
+ GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput");
+
+ List<Map<String, Object>> mapUserParams =
+ generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams();
+
+ Attributes attributes = null;
+
+ for (Map<String, Object> userParamData : mapUserParams) {
+ if (userParamData.get("nssi") != null) {
+ Map<String, Object> mapParam = (Map<String, Object>) userParamData.get("nssi");
+ LOGGER.info(">>> mapParam: {}", mapParam);
+ attributes = mapper.convertValue(mapParam, Attributes.class);
+ }
+ }
+ // Attributes attributes = new ObjectMapper().convertValue(attrMap, Attributes.class);
+ Integer latency = attributes.getSliceProfileList().get(0).getRANSliceSubnetProfile().getLatency();
+ Integer areaTrafficCapDL =
+ attributes.getSliceProfileList().get(0).getRANSliceSubnetProfile().getAreaTrafficCapDL();
+
+
+ String requestId = generalBuildingBlock.getRequestContext().getMsoRequestId();
+
+ // API Path
+ String apiPath = "/api/oof/v1/selection/nsst";
+ LOGGER.debug("API path for NSST Selection: " + apiPath);
+ execution.setVariable("NSST_apiPath", apiPath);
+
+ // Setting correlator as requestId
+ execution.setVariable("NSST_correlator", requestId);
+
+ // Setting messageType for all Core slice as an
+ String messageType = "an";
+ execution.setVariable("NSST_messageType", messageType);
+
+ String timeout = "PT30M";
+ execution.setVariable("NSST_timeout", timeout);
+
+ Map<String, Object> profileInfo = new HashMap<>();
+ profileInfo.put("latency", latency);
+ profileInfo.put("areaTrafficCapDL", areaTrafficCapDL);
+
+ String oofRequest = oofUtils.buildSelectNSTRequest(requestId, messageType, profileInfo);
+ LOGGER.debug("**** OOfRequest for NSST Selection: " + oofRequest);
+ execution.setVariable("NSST_oofRequest", oofRequest);
+ }
+
+
+ public void processOOFAsyncResponse(DelegateExecution execution) {
+ GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput");
+
+ LOGGER.debug(">>>> generalBuildingBlock Initial: {}", generalBuildingBlock);
+
+ LOGGER.debug(" **** Enter EnrichGBB ::: processOOFAsyncResponse ****");
+ String OOFResponse = (String) execution.getVariable("NSST_asyncCallbackResponse");
+ String requestStatus = jsonUtil.getJsonValue(OOFResponse, "requestStatus");
+ LOGGER.debug("NSST OOFResponse is: " + OOFResponse);
+ execution.setVariable("OOFResponse", OOFResponse);
+ String solutions = "";
+ if (requestStatus.equals("completed")) {
+ List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions"));
+ if (solutionsList != null && !solutionsList.isEmpty()) {
+ solutions = (String) solutionsList.get(0);
+ }
+ } else {
+ String statusMessage = jsonUtil.getJsonValue(OOFResponse, "statusMessage");
+ LOGGER.error("received failed status from oof " + statusMessage);
+ LOGGER.debug("received failed status from oof " + statusMessage);
+ }
+
+ LOGGER.debug(">>>>>> solutions: {}", solutions);
+
+ String nsstId = jsonUtil.getJsonValue(solutions, "UUID");
+ LOGGER.info(">>> nsstId:{} ", nsstId);
+
+ Service service = catalogDbClient.getServiceByModelUUID(nsstId);
+
+ LOGGER.info("Service from CatalogDB: {}", service);
+
+ LOGGER.debug(">>> Map Incoming Values to GBB");
+
+ ServiceInstance serviceInstance = generalBuildingBlock.getServiceInstance();
+
+ ModelInfoServiceInstance modelInfoServiceInstanceFromGBB = serviceInstance.getModelInfoServiceInstance();
+
+ if (modelInfoServiceInstanceFromGBB == null) {
+ String modelInvariantId = service.getModelInvariantUUID();
+ String modelVersion = service.getModelVersion();
+ String serviceType = service.getServiceType();
+ String serviceRole = service.getServiceRole();
+ String controllerActor = service.getControllerActor();
+ String blueprintName = service.getBlueprintName();
+ String blueprintVersion = service.getBlueprintVersion();
+
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid("ad2233a2-6e3f-42cf-8c60-04e614031383");
+ modelInfoServiceInstance.setModelInvariantUuid("38730fb9-bfbb-4a78-88f8-b4f6823197b6");
+ modelInfoServiceInstance.setModelVersion("1.0");
+ modelInfoServiceInstance.setServiceRole("AN");
+ modelInfoServiceInstance.setServiceType("eMBB");
+ modelInfoServiceInstance.setBlueprintVersion("1.0.0");
+ modelInfoServiceInstance.setControllerActor("CDS");
+ modelInfoServiceInstance.setBlueprintName("Hello_World_CBA");
+ modelInfoServiceInstance.setServiceType(serviceType);
+ modelInfoServiceInstance.setServiceRole(serviceRole);
+ modelInfoServiceInstance.setControllerActor(controllerActor);
+ modelInfoServiceInstance.setBlueprintName(blueprintName);
+ modelInfoServiceInstance.setBlueprintVersion(blueprintVersion);
+ modelInfoServiceInstance.setModelInvariantUuid(modelInvariantId);
+ modelInfoServiceInstance.setModelUuid(nsstId);
+ modelInfoServiceInstance.setModelVersion(modelVersion);
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+
+ }
+
+ LOGGER.info(">>> ServiceInstance: {}", serviceInstance);
+
+ generalBuildingBlock.setServiceInstance(serviceInstance);
+
+ LOGGER.debug("generalBuildingBlock: {}", generalBuildingBlock);
+
+ execution.setVariable(GBB_INPUT_VAR_NAME, generalBuildingBlock);
+ BuildingBlockExecution gBuildingBlockExecution1 = new DelegateExecutionImpl(execution);
+ execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution1);
+
+ // execution.setVariable("gBuildingBlockExecution", gBBExecution);
+ LOGGER.debug(" **** Exit EnrichBB ::: processOOFAsyncResponse ****");
+ }
+}
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTask.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTask.java
new file mode 100644
index 0000000000..eba35673e1
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTask.java
@@ -0,0 +1,186 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.moi.util.AAISliceProfileUtil;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.moi.PlmnInfo;
+import org.onap.so.moi.RANSliceSubnetProfile;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+
+@Component
+public class ModifyRANNssiBBTask {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModifyRANNssiBBTask.class);
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Autowired
+ private AAISliceProfileUtil aaiSliceProfileUtil;
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+
+ public void modifyNssi(BuildingBlockExecution execution) throws JsonProcessingException {
+ LOGGER.info("Modify NSSI");
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+ List<Map<String, Object>> sliceProfilesData = gBB.getRequestContext().getRequestParameters().getUserParams();
+
+ SliceProfile updatedSliceProfile = mapUserParamsToSliceProfile(sliceProfilesData);
+ String sliceProfileIdFromRequest = getSliceProfileIdFromReq(sliceProfilesData);
+ aaiSliceProfileUtil.updateSliceProfile(execution, sliceProfileIdFromRequest, updatedSliceProfile);
+
+
+
+ }
+
+ private ServiceInstance mapUserParamsToServiceInstance(ServiceInstance sliceProfileServiceInstanceObj,
+ List<Map<String, Object>> sliceProfilesData) {
+ Map<String, Object> mapParam = (Map<String, Object>) sliceProfilesData.get(0).get("nssi");
+ LOGGER.info(">>> mapParam: {}", mapParam);
+
+ // update administrative State
+ String administrativeState = (String) mapParam.get("administrativeState");
+ LOGGER.info(">>> administrativeState: {}", administrativeState);
+ sliceProfileServiceInstanceObj.setOperationalStatus(administrativeState);
+
+ List<Object> list = (ArrayList<Object>) mapParam.get("sliceProfileList");
+ LOGGER.info(">>> sliceProfile List: {}", list);
+ Map<String, Object> idMap = (Map<String, Object>) list.get(0);
+ LOGGER.info("Keys of Id Map {} ", idMap.keySet());
+
+ // PlmnInfoList
+ for (String key : idMap.keySet()) {
+ if (key.equalsIgnoreCase("plmnInfoList")) {
+ PlmnInfo plmnInfo = mapper.convertValue(mapParam, PlmnInfo.class);
+ LOGGER.info("PlmnInfo {}", plmnInfo.getPlmnId().getMcc() + "-" + plmnInfo.getPlmnId().getMnc());
+ LOGGER.info("Snssai {} ", plmnInfo.getSnssai().getSst() + "-" + plmnInfo.getSnssai().getSd());
+ sliceProfileServiceInstanceObj.setServiceInstanceLocationId(
+ plmnInfo.getPlmnId().getMcc() + "-" + plmnInfo.getPlmnId().getMnc());
+ sliceProfileServiceInstanceObj
+ .setEnvironmentContext(plmnInfo.getSnssai().getSst() + "-" + plmnInfo.getSnssai().getSd());
+ }
+ }
+ return sliceProfileServiceInstanceObj;
+ }
+
+ SliceProfile mapUserParamsToSliceProfile(List<Map<String, Object>> sliceProfilesData)
+ throws JsonProcessingException {
+ SliceProfile sliceProfile = new SliceProfile();
+ Map<String, Object> mapParam = (Map<String, Object>) sliceProfilesData.get(0).get("nssi");
+ LOGGER.info(">>> mapParam in map: {}", mapParam);
+
+ List<Object> list = (ArrayList<Object>) mapParam.get("sliceProfileList");
+
+ Map<String, Object> idMap = (Map<String, Object>) list.get(0);
+
+ String sliceProfileId = (String) idMap.get("sliceProfileId");
+
+ sliceProfile.setProfileId(sliceProfileId);
+ RANSliceSubnetProfile ranSliceSubnetProfile = mapper.convertValue(mapParam, RANSliceSubnetProfile.class);
+
+
+ for (String key : idMap.keySet()) {
+ if (key.equalsIgnoreCase("RANSliceSubnetProfile")) {
+ RANSliceSubnetProfile RANSliceSubnetProfile =
+ mapper.convertValue(mapParam, RANSliceSubnetProfile.class);
+ LOGGER.info("RANSliceSubnetProfile inside {}", RANSliceSubnetProfile);
+ Map<String, Object> ranMap = (Map<String, Object>) idMap.get(key);
+ ranMap.forEach((k, v) -> {
+ LOGGER.info("Key : {}", k);
+ switch (k) {
+ case "coverageAreaTAList":
+ Integer coverageAreaTAList = (Integer) ranMap.get(k);
+ LOGGER.info("coverageAreaTAList {}", coverageAreaTAList);
+ sliceProfile.setCoverageAreaTAList(coverageAreaTAList.toString());
+ break;
+
+ case "latency":
+ Integer latency = (Integer) ranMap.get(k);
+ LOGGER.info("latency {}", latency);
+ sliceProfile.setLatency(latency);
+ break;
+
+ case "dLLatency":
+ Integer dLLatency = (Integer) ranMap.get(k);
+ LOGGER.info("dLLatency {}", dLLatency);
+ sliceProfile.setLatency(dLLatency);
+ break;
+
+ case "areaTrafficCapDL":
+ Integer areaTrafficCapDL = (Integer) ranMap.get(k);
+ LOGGER.info("areaTrafficCapDL {}", areaTrafficCapDL);
+ sliceProfile.setAreaTrafficCapDL(areaTrafficCapDL);
+ break;
+
+ case "resourceSharingLevel":
+ String resourceSharingLevel = (String) ranMap.get(k);
+ LOGGER.info("resourceSharingLevel {}", resourceSharingLevel);
+ sliceProfile.setResourceSharingLevel(resourceSharingLevel);
+ break;
+
+ case "maxNumberofUEs":
+ Integer maxNumberofUEs = (Integer) ranMap.get(k);
+ LOGGER.info("maxNumberofUEs {}", maxNumberofUEs);
+ sliceProfile.setMaxNumberOfUEs(maxNumberofUEs);
+ break;
+
+ }
+ });
+ }
+ }
+ return sliceProfile;
+ }
+
+ private String getSliceProfileIdFromReq(List<Map<String, Object>> sliceProfilesData)
+ throws JsonProcessingException {
+ Map<String, Object> mapParam = (Map<String, Object>) sliceProfilesData.get(0).get("nssi");
+
+ List<Object> list = (ArrayList<Object>) mapParam.get("sliceProfileList");
+
+ Map<String, Object> idMap = (Map<String, Object>) list.get(0);
+ String sliceProfileId = (String) idMap.get("sliceProfileId");
+
+ return sliceProfileId;
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/AAISliceProfileUtil.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/AAISliceProfileUtil.java
new file mode 100644
index 0000000000..a23fec8cc7
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/AAISliceProfileUtil.java
@@ -0,0 +1,279 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.aai.domain.yang.*;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Component
+public class AAISliceProfileUtil {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AAISliceProfileUtil.class);
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+
+ public Optional<ServiceInstance> getServiceInstance(BuildingBlockExecution execution) {
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+ String serviceInstanceId = gBB.getServiceInstance().getServiceInstanceId();
+ Customer customer = getCustomer(execution);
+
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(serviceInstanceId));
+ return injectionHelper.getAaiClient().get(ServiceInstance.class, serviceInstanceURI);
+ }
+
+ public void deleteSliceProfile(BuildingBlockExecution execution, String profileId) {
+ Optional<ServiceInstance> getServiceInstance = getServiceInstance(execution);
+ if (getServiceInstance.isPresent()) {
+ ServiceInstance serviceInstance = getServiceInstance.get();
+ String NssiId = serviceInstance.getServiceInstanceId();
+ LOGGER.info("NSSID {}", NssiId);
+ List<Relationship> listOfNssiRelationship = serviceInstance.getRelationshipList().getRelationship();
+
+ List<Relationship> listOfNssiRelationshipAR = listOfNssiRelationship.stream()
+ .filter(relationship -> relationship.getRelatedTo().equalsIgnoreCase("allotted-resource"))
+ .collect(Collectors.toList());
+ int size = listOfNssiRelationshipAR.size();
+
+ List<SliceProfile> sliceProfileList;
+ LOGGER.info("ProfileID from Request: {}", profileId);
+ boolean isDeleted = false;
+ for (Relationship relationship : listOfNssiRelationshipAR) {
+ for (RelationshipData relationshipData : relationship.getRelationshipData()) {
+ if (relationshipData.getRelationshipKey()
+ .equalsIgnoreCase("service-instance.service-instance-id")) {
+ String sliceProfileInstanceId = relationshipData.getRelationshipValue();
+ LOGGER.debug(">>> sliceProfileInstance: {}", sliceProfileInstanceId);
+ Optional<ServiceInstance> sliceProfile1 = aaiRestClient
+ .getServiceInstanceByIdWithDepth(sliceProfileInstanceId, "5G", "5GCustomer");
+ if (sliceProfile1.isPresent()) {
+ sliceProfileList = sliceProfile1.get().getSliceProfiles().getSliceProfile();
+ LOGGER.info("sliceProfileList {}", sliceProfileList);
+ for (SliceProfile slice : sliceProfileList) {
+ if (slice.getProfileId().equalsIgnoreCase(profileId)) {
+ LOGGER.info("ProfileID matched Deleting slice profile");
+ deleteSliceProfileFromAAI(sliceProfileInstanceId, size, execution, NssiId);
+ isDeleted = true;
+ break;
+ }
+ }
+ }
+ }
+ if (isDeleted)
+ break;
+ }
+ if (isDeleted)
+ break;
+ }
+ }
+ }
+
+ public void updateSliceProfile(BuildingBlockExecution execution, String profileId, SliceProfile updatedSlice) {
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> sliceProfilesData = gBB.getRequestContext().getRequestParameters().getUserParams();
+ LOGGER.info(">>> mapParam: {}", sliceProfilesData);
+
+ Optional<ServiceInstance> getServiceInstance = getServiceInstance(execution);
+ if (getServiceInstance.isPresent()) {
+ ServiceInstance serviceInstance = getServiceInstance.get();
+ List<Relationship> listOfNssiRelationship = serviceInstance.getRelationshipList().getRelationship();
+
+ List<Relationship> listOfNssiRelationshipAR = listOfNssiRelationship.stream()
+ .filter(relationship -> relationship.getRelatedTo().equalsIgnoreCase("allotted-resource"))
+ .collect(Collectors.toList());
+
+ List<SliceProfile> sliceProfileList;
+ LOGGER.info("ProfileID : {}", profileId);
+ for (Relationship relationship : listOfNssiRelationshipAR) {
+ for (RelationshipData relationshipData : relationship.getRelationshipData()) {
+ if (relationshipData.getRelationshipKey()
+ .equalsIgnoreCase("service-instance.service-instance-id")) {
+ String sliceProfileInstanceId = relationshipData.getRelationshipValue();
+ LOGGER.debug(">>> sliceProfileInstance: {}", sliceProfileInstanceId);
+
+ Optional<ServiceInstance> sliceProfile1 = aaiRestClient
+ .getServiceInstanceByIdWithDepth(sliceProfileInstanceId, "5G", "5GCustomer");
+
+ Optional<ServiceInstance> sliceProfileInstanceNodepth =
+ aaiRestClient.getServiceInstanceById(sliceProfileInstanceId, "5G", "5GCustomer");
+
+ if (sliceProfile1.isPresent()) {
+ sliceProfileList = sliceProfile1.get().getSliceProfiles().getSliceProfile();
+ int size = sliceProfileList.size();
+ ServiceInstance updatedSliceInstance = sliceProfileInstanceNodepth.get();
+
+ for (SliceProfile slice : sliceProfileList) {
+ if (slice.getProfileId().equalsIgnoreCase(profileId)) {
+ LOGGER.info("Profile ID matched... updating slice profile");
+ updateSliceProfileInAAI(execution, sliceProfileInstanceId, updatedSlice);
+
+ // for update in administrativeState
+ updatedSliceInstance =
+ mapUserParamsToServiceInstance(updatedSliceInstance, sliceProfilesData);
+ LOGGER.info(("Updating Slice-profile Instance"));
+ updateSliceProfileInstance(execution, updatedSliceInstance);
+ }
+
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ public void updateSliceProfileInAAI(BuildingBlockExecution execution, String sliceProfileInstanceId,
+ SliceProfile sliceProfile1) {
+ Customer customer = getCustomer(execution);
+ AAIResourceUri updateSliceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileInstanceId).sliceProfile(sliceProfile1.getProfileId()));
+ try {
+ injectionHelper.getAaiClient().update(updateSliceURI, sliceProfile1);
+ } catch (Exception e) {
+ LOGGER.info("Error in updating Slice Profile {}", e);
+ }
+ }
+
+ public void updateSliceProfileInstance(BuildingBlockExecution execution, ServiceInstance sliceProfileinstance) {
+ Customer customer = getCustomer(execution);
+ AAIResourceUri updateSliceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(sliceProfileinstance.getServiceInstanceId()));
+ try {
+ injectionHelper.getAaiClient().update(updateSliceURI, sliceProfileinstance);
+ } catch (Exception e) {
+ LOGGER.info("Error in updating Slice Profile instance {}", e);
+ }
+ }
+
+ public void deleteSliceProfileFromAAI(String serviceInstanceID, int size, BuildingBlockExecution execution,
+ String NssiId) {
+ Customer customer = getCustomer(execution);
+
+ AAIResourceUri deleteInstanceURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(serviceInstanceID));
+ try {
+ injectionHelper.getAaiClient().delete(deleteInstanceURI);
+ LOGGER.info("Slice Profile Instance with ID {} deleted", serviceInstanceID);
+ } catch (Exception e) {
+ LOGGER.info("Error in deleting Slice Profile instace {}", e);
+ }
+ LOGGER.info(">>>> Size : {}", size);
+ if (size == 1) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+ .serviceSubscription(
+ customer.getServiceSubscriptions().getServiceSubscription().get(0).getServiceType())
+ .serviceInstance(NssiId));
+ // Delete NSSI
+ try {
+ injectionHelper.getAaiClient().delete(serviceInstanceURI);
+ LOGGER.info("deleted Slice Prfile as well ass NSSI {}", NssiId);
+ } catch (Exception e) {
+ LOGGER.info("Error in deleting NSSI {}", e);
+ }
+
+ }
+
+ }
+
+ private Customer getCustomer(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBB = execution.getGeneralBuildingBlock();
+
+ String serviceType = gBB.getCustomer().getServiceSubscription().getServiceType();
+
+ String globalCustomerId = gBB.getCustomer().getGlobalCustomerId();
+
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType(serviceType);
+
+ ServiceSubscriptions serviceSubscriptions = new ServiceSubscriptions();
+ serviceSubscriptions.getServiceSubscription().add(serviceSubscription);
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId(globalCustomerId);
+ customer.setServiceSubscriptions(serviceSubscriptions);
+
+ return customer;
+
+ }
+
+ private ServiceInstance mapUserParamsToServiceInstance(ServiceInstance sliceProfileServiceInstanceObj,
+ List<Map<String, Object>> sliceProfilesData) {
+ Map<String, Object> mapParam = (Map<String, Object>) sliceProfilesData.get(0).get("nssi");
+ LOGGER.info(">>> mapParam: {}", mapParam);
+
+ // update administrative State
+ String administrativeState = (String) mapParam.get("administrativeState");
+ if (administrativeState != null) {
+ LOGGER.info(">>> administrativeState: {}", administrativeState);
+ sliceProfileServiceInstanceObj.setOperationalStatus(administrativeState);
+ }
+
+ String operationalState = (String) mapParam.get("operationalState");
+ if (operationalState != null) {
+ LOGGER.info(">>> operationalState: {}", operationalState);
+ sliceProfileServiceInstanceObj.setOrchestrationStatus(operationalState);
+ }
+ List<Object> list = (ArrayList<Object>) mapParam.get("sliceProfileList");
+ LOGGER.info(">>> sliceProfile List: {}", list);
+ Map<String, Object> idMap = (Map<String, Object>) list.get(0);
+ LOGGER.info("Keys of Id Map {} ", idMap.keySet());
+
+ return sliceProfileServiceInstanceObj;
+ }
+}
diff --git a/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/SliceProfileAaiToMoiMapperUtil.java b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/SliceProfileAaiToMoiMapperUtil.java
new file mode 100644
index 0000000000..1cbdabf9c4
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/java/org/onap/so/bpmn/moi/util/SliceProfileAaiToMoiMapperUtil.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.util;
+
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.so.moi.Attributes;
+import org.onap.so.moi.PlmnId;
+import org.onap.so.moi.Snssai;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SliceProfileAaiToMoiMapperUtil {
+
+ public ServiceInstance fillSliceProfileInstanceFromMoiRequest(Attributes moiRequestAttributes,
+ ServiceInstance serviceInstance) {
+
+ // org.onap.so.moi.SliceProfile moiSliceProfile = null;
+
+ String serviceInstanceLocationId = null;
+ String environmentContext = null;
+ String serviceType = null;
+ String operationalState = "LOCKED";
+ String orchistrationStatus = "Assigned";
+
+ for (org.onap.so.moi.SliceProfile moiSliceProfile : moiRequestAttributes.getSliceProfileList()) {
+ serviceInstanceLocationId = getPlmnId(moiSliceProfile.getPlmnInfoList().get(0).getPlmnId());
+ environmentContext = getSnssai(moiSliceProfile.getPlmnInfoList().get(0).getSnssai());
+ serviceType = moiSliceProfile.getRANSliceSubnetProfile().getServiceType();
+ }
+
+ serviceInstance.setServiceInstanceLocationId(serviceInstanceLocationId);
+ serviceInstance.setEnvironmentContext(environmentContext);
+ serviceInstance.setServiceType(serviceType);
+ serviceInstance.setOperationalStatus(operationalState);
+ return serviceInstance;
+ }
+
+ String getSnssai(Snssai snssai) {
+ return snssai.getSst() + "-" + snssai.getSd();
+ }
+
+ String getPlmnId(PlmnId plmnId) {
+ return plmnId.getMcc() + "-" + plmnId.getMnc();
+ }
+
+ public SliceProfile extractAaiSliceProfileFromMoiRequest(Attributes moiRequestAttributes) {
+
+ SliceProfile aaiSLiceProfile = null;
+
+ for (org.onap.so.moi.SliceProfile sliceProfileMoi : moiRequestAttributes.getSliceProfileList()) {
+ aaiSLiceProfile = mapMoiSliceProfileToAaiSliceProfile(sliceProfileMoi);
+ }
+
+ return aaiSLiceProfile;
+ }
+
+ private SliceProfile mapMoiSliceProfileToAaiSliceProfile(org.onap.so.moi.SliceProfile moiSliceProfile) {
+ SliceProfile aaiSliceProfile = new SliceProfile();
+
+ Integer latency = moiSliceProfile.getRANSliceSubnetProfile().getLatency();
+ Integer areaTrafficCapDL = moiSliceProfile.getRANSliceSubnetProfile().getAreaTrafficCapDL();
+ Integer maxNumberOfUEs = moiSliceProfile.getRANSliceSubnetProfile().getMaxNumberofUEs();
+ String resourceSharingLevel = moiSliceProfile.getRANSliceSubnetProfile().getResourceSharingLevel();
+ Integer coverageAreaTAList = moiSliceProfile.getRANSliceSubnetProfile().getCoverageAreaTAList();
+
+ aaiSliceProfile.setLatency(latency);
+ aaiSliceProfile.setMaxNumberOfUEs(maxNumberOfUEs);
+ aaiSliceProfile.setResourceSharingLevel(resourceSharingLevel);
+ aaiSliceProfile.setCoverageAreaTAList(String.valueOf(coverageAreaTAList));
+ aaiSliceProfile.setAreaTrafficCapDL(areaTrafficCapDL);
+
+ return aaiSliceProfile;
+ }
+}
diff --git a/bpmn/so-bpmn-moi/src/main/resources/process/ActivateRANNssiBB.bpmn b/bpmn/so-bpmn-moi/src/main/resources/process/ActivateRANNssiBB.bpmn
new file mode 100644
index 0000000000..8e5c2d18b6
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/resources/process/ActivateRANNssiBB.bpmn
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_10wwk7p" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.1.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
+ <bpmn:process id="ActivateRANNssiBB" name="ActivateRANNssiBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_05e75ml</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1ydoy4n">
+ <bpmn:incoming>Flow_1wiu58e</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_05e75ml" sourceRef="StartEvent_1" targetRef="Activity_0xvx6k0" />
+ <bpmn:serviceTask id="Activity_0xvx6k0" name="Activate Nssi" camunda:expression="${AssignRANNssiBBTasks.activateNssi(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_05e75ml</bpmn:incoming>
+ <bpmn:outgoing>Flow_1wiu58e</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1wiu58e" sourceRef="Activity_0xvx6k0" targetRef="Event_1ydoy4n" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateRANNssiBB">
+ <bpmndi:BPMNEdge id="Flow_1wiu58e_di" bpmnElement="Flow_1wiu58e">
+ <di:waypoint x="370" y="100" />
+ <di:waypoint x="452" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_05e75ml_di" bpmnElement="Flow_05e75ml">
+ <di:waypoint x="188" y="100" />
+ <di:waypoint x="270" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1ydoy4n_di" bpmnElement="Event_1ydoy4n">
+ <dc:Bounds x="452" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0a88ka0_di" bpmnElement="Activity_0xvx6k0">
+ <dc:Bounds x="270" y="60" width="100" height="80" />
+ <bpmndi:BPMNLabel />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-moi/src/main/resources/process/AssignRANNssiBB.bpmn b/bpmn/so-bpmn-moi/src/main/resources/process/AssignRANNssiBB.bpmn
new file mode 100644
index 0000000000..c452c6d0e7
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/resources/process/AssignRANNssiBB.bpmn
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_18uqst7" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.1.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
+ <bpmn:process id="AssignRANNssiBB" name="AssignRANNssiBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_07dyds8</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1u6nifv">
+ <bpmn:incoming>Flow_1jwhdm2</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_07dyds8" sourceRef="StartEvent_1" targetRef="Tast_PrepareOOFrequest" />
+ <bpmn:serviceTask id="Tast_PrepareOOFrequest" name="Prepare OOF request" camunda:expression="${AssignRANNssiBBTasks.helloWorld(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_07dyds8</bpmn:incoming>
+ <bpmn:outgoing>Flow_1erbnfk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1erbnfk" sourceRef="Tast_PrepareOOFrequest" targetRef="Activity_0crrz1x" />
+ <bpmn:sequenceFlow id="Flow_1trcgyv" sourceRef="Task_createNSSIinAAI" targetRef="Task_CreateSliceProfileInstance" />
+ <bpmn:serviceTask id="Task_createNSSIinAAI" name="Create NSSI in AAI" camunda:expression="${AssignRANNssiBBTasks.createNssi(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_1svksq9</bpmn:incoming>
+ <bpmn:outgoing>Flow_1trcgyv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_08asmxy" sourceRef="Task_Createallotted-resourcesinAAI" targetRef="Task_AddSlice-profilerelationshipwithNSSI" />
+ <bpmn:sequenceFlow id="Flow_1ut0avh" sourceRef="Task_CreateSliceProfileInstance" targetRef="Task_Createallotted-resourcesinAAI" />
+ <bpmn:sequenceFlow id="Flow_1jwhdm2" sourceRef="Task_AddSlice-profilerelationshipwithNSSI" targetRef="Event_1u6nifv" />
+ <bpmn:serviceTask id="Task_Createallotted-resourcesinAAI" name="Create allotted-resources in AAI" camunda:expression="${AssignRANNssiBBTasks.allotResources(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_1ut0avh</bpmn:incoming>
+ <bpmn:outgoing>Flow_08asmxy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_CreateSliceProfileInstance" name="Create Slice Profile Instance" camunda:expression="${AssignRANNssiBBTasks.createSliceProfileInstance(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_1trcgyv</bpmn:incoming>
+ <bpmn:outgoing>Flow_1ut0avh</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_AddSlice-profilerelationshipwithNSSI" name="Add Slice-profile relationship with NSSI" camunda:expression="${AssignRANNssiBBTasks.addSliceProfileToNssi(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_08asmxy</bpmn:incoming>
+ <bpmn:outgoing>Flow_1jwhdm2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1svksq9" sourceRef="Activity_0crrz1x" targetRef="Task_createNSSIinAAI" />
+ <bpmn:serviceTask id="Activity_0crrz1x" name="Process OOF response" camunda:expression="${AssignRANNssiBBTasks.processOof(execution, InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_1erbnfk</bpmn:incoming>
+ <bpmn:outgoing>Flow_1svksq9</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignRANNssiBB">
+ <bpmndi:BPMNEdge id="Flow_1svksq9_di" bpmnElement="Flow_1svksq9">
+ <di:waypoint x="530" y="100" />
+ <di:waypoint x="590" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jwhdm2_di" bpmnElement="Flow_1jwhdm2">
+ <di:waypoint x="1150" y="100" />
+ <di:waypoint x="1202" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1ut0avh_di" bpmnElement="Flow_1ut0avh">
+ <di:waypoint x="840" y="100" />
+ <di:waypoint x="890" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_08asmxy_di" bpmnElement="Flow_08asmxy">
+ <di:waypoint x="990" y="100" />
+ <di:waypoint x="1050" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1trcgyv_di" bpmnElement="Flow_1trcgyv">
+ <di:waypoint x="690" y="100" />
+ <di:waypoint x="740" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1erbnfk_di" bpmnElement="Flow_1erbnfk">
+ <di:waypoint x="360" y="100" />
+ <di:waypoint x="430" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_07dyds8_di" bpmnElement="Flow_07dyds8">
+ <di:waypoint x="188" y="100" />
+ <di:waypoint x="260" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1u6nifv_di" bpmnElement="Event_1u6nifv">
+ <dc:Bounds x="1202" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0m2rb7h_di" bpmnElement="Task_createNSSIinAAI">
+ <dc:Bounds x="590" y="60" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_15uwt50_di" bpmnElement="Task_AddSlice-profilerelationshipwithNSSI">
+ <dc:Bounds x="1050" y="60" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_182lm7y_di" bpmnElement="Task_Createallotted-resourcesinAAI">
+ <dc:Bounds x="890" y="60" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0a88ka0_di" bpmnElement="Tast_PrepareOOFrequest">
+ <dc:Bounds x="260" y="60" width="100" height="80" />
+ <bpmndi:BPMNLabel />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ornhso_di" bpmnElement="Activity_0crrz1x">
+ <dc:Bounds x="430" y="60" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1p2gzmo_di" bpmnElement="Task_CreateSliceProfileInstance">
+ <dc:Bounds x="740" y="60" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-moi/src/main/resources/process/DeleteRANNssiBB.bpmn b/bpmn/so-bpmn-moi/src/main/resources/process/DeleteRANNssiBB.bpmn
new file mode 100644
index 0000000000..6b84a55551
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/resources/process/DeleteRANNssiBB.bpmn
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_18uqst7" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.2.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
+ <bpmn:process id="DeleteRANNssiBB" name="DeleteRANNssiBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_07dyds8</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1u6nifv">
+ <bpmn:incoming>Flow_1trcgyv</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_07dyds8" sourceRef="StartEvent_1" targetRef="DeleteSliceProfileList" />
+ <bpmn:sequenceFlow id="Flow_1trcgyv" sourceRef="DeleteSliceProfileList" targetRef="Event_1u6nifv" />
+ <bpmn:serviceTask id="DeleteSliceProfileList" name="Delete Slice Profile List" camunda:expression="${DeleteRANNssiBBTask.deleteNssi(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_07dyds8</bpmn:incoming>
+ <bpmn:outgoing>Flow_1trcgyv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteRANNssiBB">
+ <bpmndi:BPMNEdge id="Flow_1trcgyv_di" bpmnElement="Flow_1trcgyv">
+ <di:waypoint x="470" y="100" />
+ <di:waypoint x="552" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_07dyds8_di" bpmnElement="Flow_07dyds8">
+ <di:waypoint x="188" y="100" />
+ <di:waypoint x="370" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_1u6nifv_di" bpmnElement="Event_1u6nifv">
+ <dc:Bounds x="552" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0m2rb7h_di" bpmnElement="DeleteSliceProfileList">
+ <dc:Bounds x="370" y="60" width="100" height="80" />
+ <bpmndi:BPMNLabel />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-moi/src/main/resources/process/EnrichGBB.bpmn b/bpmn/so-bpmn-moi/src/main/resources/process/EnrichGBB.bpmn
new file mode 100644
index 0000000000..63ef7d4cfd
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/resources/process/EnrichGBB.bpmn
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_042zahe" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.1.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
+ <bpmn:process id="EnrichGBB" name="EnrichGBB" isExecutable="true" camunda:versionTag="1">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_00l5u3m</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:callActivity id="Activity_0sqn8c7" name="Call DoHandleOofRequest" calledElement="DoHandleOofRequest">
+ <bpmn:extensionElements>
+ <camunda:in source="NSST_apiPath" target="apiPath" />
+ <camunda:in source="NSST_correlator" target="correlator" />
+ <camunda:in source="NSST_messageType" target="messageType" />
+ <camunda:in source="NSST_timeout" target="timeout" />
+ <camunda:in source="NSST_oofRequest" target="oofRequest" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="asyncCallbackResponse" target="NSST_asyncCallbackResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1r5aycw</bpmn:incoming>
+ <bpmn:outgoing>Flow_1navrbe</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1r5aycw" sourceRef="ScriptTask_0ybe0w9" targetRef="Activity_0sqn8c7" />
+ <bpmn:sequenceFlow id="Flow_1navrbe" sourceRef="Activity_0sqn8c7" targetRef="ScriptTask_1bg09vu" />
+ <bpmn:sequenceFlow id="Flow_00l5u3m" sourceRef="StartEvent_1" targetRef="ScriptTask_0ybe0w9" />
+ <bpmn:endEvent id="Event_1itf4bg">
+ <bpmn:incoming>Flow_1xiq8re</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1xiq8re" sourceRef="ScriptTask_1bg09vu" targetRef="Event_1itf4bg" />
+ <bpmn:serviceTask id="ScriptTask_0ybe0w9" name="Prepare OOF request" camunda:expression="${EnrichGBBTask.prepareOofRequest(execution)}">
+ <bpmn:incoming>Flow_00l5u3m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1r5aycw</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ScriptTask_1bg09vu" name="Process OOF Async&#10;ressponse" camunda:expression="${EnrichGBBTask.processOOFAsyncResponse(execution)}">
+ <bpmn:incoming>Flow_1navrbe</bpmn:incoming>
+ <bpmn:outgoing>Flow_1xiq8re</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EnrichGBB">
+ <bpmndi:BPMNEdge id="Flow_1xiq8re_di" bpmnElement="Flow_1xiq8re">
+ <di:waypoint x="760" y="120" />
+ <di:waypoint x="832" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_00l5u3m_di" bpmnElement="Flow_00l5u3m">
+ <di:waypoint x="158" y="120" />
+ <di:waypoint x="310" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1navrbe_di" bpmnElement="Flow_1navrbe">
+ <di:waypoint x="580" y="116" />
+ <di:waypoint x="660" y="116" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1r5aycw_di" bpmnElement="SequenceFlow_1r5aycw">
+ <di:waypoint x="410" y="120" />
+ <di:waypoint x="480" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="470.5" y="163" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="BPMNShape_1aru9st" bpmnElement="Activity_0sqn8c7">
+ <dc:Bounds x="480" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1itf4bg_di" bpmnElement="Event_1itf4bg">
+ <dc:Bounds x="832" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1wzhzok_di" bpmnElement="ScriptTask_0ybe0w9">
+ <dc:Bounds x="310" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1t8o2pj_di" bpmnElement="ScriptTask_1bg09vu">
+ <dc:Bounds x="660" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="122" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-moi/src/main/resources/process/ModifyRANNssiBB.bpmn b/bpmn/so-bpmn-moi/src/main/resources/process/ModifyRANNssiBB.bpmn
new file mode 100644
index 0000000000..5e138ec8c5
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/main/resources/process/ModifyRANNssiBB.bpmn
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_18uqst7" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.2.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
+ <bpmn:process id="Task_ModifyRANNssiBB" name="ModifyRANNssiBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_07dyds8</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1u6nifv">
+ <bpmn:incoming>Flow_1trcgyv</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_07dyds8" sourceRef="StartEvent_1" targetRef="Task_ModifyDetailsinAAI" />
+ <bpmn:sequenceFlow id="Flow_1trcgyv" sourceRef="Task_ModifyDetailsinAAI" targetRef="Event_1u6nifv" />
+ <bpmn:serviceTask id="Task_ModifyDetailsinAAI" name="Modify Details in AAI" camunda:expression="${ModifyRANNssiBBTask.modifyNssi(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_07dyds8</bpmn:incoming>
+ <bpmn:outgoing>Flow_1trcgyv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Task_ModifyRANNssiBB">
+ <bpmndi:BPMNEdge id="Flow_1trcgyv_di" bpmnElement="Flow_1trcgyv">
+ <di:waypoint x="460" y="100" />
+ <di:waypoint x="682" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_07dyds8_di" bpmnElement="Flow_07dyds8">
+ <di:waypoint x="188" y="100" />
+ <di:waypoint x="360" y="100" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1u6nifv_di" bpmnElement="Event_1u6nifv">
+ <dc:Bounds x="682" y="82" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0m2rb7h_di" bpmnElement="Task_ModifyDetailsinAAI">
+ <dc:Bounds x="360" y="60" width="100" height="80" />
+ <bpmndi:BPMNLabel />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasksTest.java b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasksTest.java
new file mode 100644
index 0000000000..aaf0b8901a
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/AssignRANNssiBBTasksTest.java
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.aai.domain.yang.Customer;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.moi.util.SliceProfileAaiToMoiMapperUtil;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import java.util.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.times;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+
+public class AssignRANNssiBBTasksTest {
+ @Mock
+ protected InjectionHelper injectionHelper;
+ @Mock
+ protected ObjectMapper mapper = new ObjectMapper();
+ @Mock
+ protected AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+ @Mock
+ protected SliceProfileAaiToMoiMapperUtil mapperUtil;
+ @Mock
+ GeneralBuildingBlock gBB;
+ @Mock
+ ServiceInstance serviceInstance;
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ AssignRANNssiBBTasks assignRANNssiBBTasks;
+ @Mock
+ private BuildingBlockExecution execution;
+ @Mock
+ private ModelInfoServiceInstance modelInfoServiceInstance;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
+
+
+ private String operationalState;
+ private String administrativeState;
+
+ private String sliceProfileServiceInstanceId = "215";
+
+ private String serviceInstanceId = "123";
+
+ Customer customerA = new Customer();
+
+ @Mock
+ private AAIResourceUri allotedResourceURI;
+ String serviceType;
+
+ String globalCustomerId;
+
+ private UUID allottedResourceUuidUuid = UUID.randomUUID();
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+ private ServiceSubscription serviceSubscription;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+
+ serviceInstance.setServiceInstanceId("123");
+ modelInfoServiceInstance.setModelUuid("235");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstanceId);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ServiceInstance))).thenReturn(serviceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ModelInfoServiceInstance)))
+ .thenReturn(modelInfoServiceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.operationalState))).thenReturn(operationalState);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.administrativeState)))
+ .thenReturn(administrativeState);
+ serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType(serviceType);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
+
+ @Test
+ public void createNssiTest() throws Exception {
+ doNothing().when(assignRANNssiBBTasks).createNssi(execution);
+ assignRANNssiBBTasks.createNssi(execution);
+ verify(assignRANNssiBBTasks, times(1)).createNssi(execution);
+ System.out.println("sucess");
+ }
+
+ @Test
+ public void createSliceProfileInstanceTest() {
+ doNothing().when(assignRANNssiBBTasks).createSliceProfileInstance(execution);
+ assignRANNssiBBTasks.createSliceProfileInstance(execution);
+ verify(assignRANNssiBBTasks, times(1)).createSliceProfileInstance(execution);
+ System.out.println("sucess");
+ }
+
+ @Test
+ public void allotResourcesTest() {
+ doNothing().when(assignRANNssiBBTasks).allotResources(execution);
+ assignRANNssiBBTasks.allotResources(execution);
+ verify(assignRANNssiBBTasks, times(1)).allotResources(execution);
+ }
+
+ @Test
+ public void addSliceProfileToNssiTest() {
+ doNothing().when(assignRANNssiBBTasks).addSliceProfileToNssi(execution);
+ assignRANNssiBBTasks.addSliceProfileToNssi(execution);
+ verify(assignRANNssiBBTasks, times(1)).addSliceProfileToNssi(execution);
+ System.out.println("sucess");
+ }
+
+ @Test
+ public void activateNssiTest() {
+ doNothing().when(assignRANNssiBBTasks).activateNssi(execution);
+ assignRANNssiBBTasks.activateNssi(execution);
+ verify(assignRANNssiBBTasks, times(1)).activateNssi(execution);
+ }
+
+}
diff --git a/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTaskTest.java b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTaskTest.java
new file mode 100644
index 0000000000..5dd0f340ba
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/DeleteRANNssiBBTaskTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.times;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+
+public class DeleteRANNssiBBTaskTest {
+
+ @Mock
+ BuildingBlockExecution execution;
+ @Mock
+ ModelInfoServiceInstance modelInfoServiceInstance;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ ServiceInstance serviceInstance;
+ private String operationalState;
+ private String administrativeState;
+ private String serviceInstanceId = "123";
+
+ private String sliceProfileServiceInstanceId = "123";
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+ private GeneralBuildingBlock gBB = new GeneralBuildingBlock();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+ @Mock
+ DeleteRANNssiBBTask deleteRANNssiBBTask;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+
+ serviceInstance.setServiceInstanceId("123");
+ modelInfoServiceInstance.setModelUuid("231");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstanceId);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ServiceInstance))).thenReturn(serviceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ModelInfoServiceInstance)))
+ .thenReturn(modelInfoServiceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.operationalState))).thenReturn(operationalState);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.administrativeState)))
+ .thenReturn(administrativeState);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ }
+
+ @Test
+ public void deleteNssiTest() throws JsonProcessingException {
+ doNothing().when(deleteRANNssiBBTask).deleteNssi(execution);
+ deleteRANNssiBBTask.deleteNssi(execution);
+ verify(deleteRANNssiBBTask, times(1)).deleteNssi(execution);
+
+ }
+}
diff --git a/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTaskTest.java b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTaskTest.java
new file mode 100644
index 0000000000..b48bb8cdee
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/EnrichGBBTaskTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.moi.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import static org.junit.Assert.*;
+
+public class EnrichGBBTaskTest {
+ @Mock
+ DelegateExecution execution;
+
+ @Before
+ public void setUp() throws Exception {}
+
+ @Test
+ public void prepareOofRequest() {}
+
+ @Test
+ public void processOOFAsyncResponse() {}
+}
diff --git a/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTaskTest.java b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTaskTest.java
new file mode 100644
index 0000000000..c946d3b56c
--- /dev/null
+++ b/bpmn/so-bpmn-moi/src/test/java/org/onap/so/bpmn/moi/tasks/ModifyRANNssiBBTaskTest.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.moi.tasks;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import junit.framework.TestCase;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import java.util.*;
+import static org.junit.Assert.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.times;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+
+public class ModifyRANNssiBBTaskTest {
+ @Mock
+ BuildingBlockExecution execution;
+ @Mock
+ ServiceInstance serviceInstance;
+ @Mock
+ private AAIResourceUri allotedResourceURI;
+ private org.onap.aai.domain.yang.Customer customer = new org.onap.aai.domain.yang.Customer();
+ @Mock
+ private ModelInfoServiceInstance modelInfoServiceInstance;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
+
+ @Mock
+ protected InjectionHelper injectionHelper;
+
+ private String operationalState = "ENABLED";
+ private String administrativeState = "UNLOCKED";
+ private String serviceInstanceId = "123";
+ private ServiceSubscription serviceSubscription;
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ String serviceType;
+
+ private String sliceProfileServiceInstanceId = "123";
+
+ private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+ @Mock
+ private GeneralBuildingBlock gBB = new GeneralBuildingBlock();
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+ @Mock
+ ModifyRANNssiBBTask modifyRANNssiBBTask = new ModifyRANNssiBBTask();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance.setServiceInstanceId("123");
+ modelInfoServiceInstance.setModelUuid("235");
+ ServiceInstance serviceInstance = new ServiceInstance();
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstanceId);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ServiceInstance))).thenReturn(serviceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.ModelInfoServiceInstance)))
+ .thenReturn(modelInfoServiceInstance);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.operationalState))).thenReturn(operationalState);
+ when(extractPojosForBBMock.extractByKey(any(), eq(ResourceKey.administrativeState)))
+ .thenReturn(administrativeState);
+ serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType(serviceType);
+ }
+
+ @Test
+ public void modifyNssiTest() throws JsonProcessingException {
+
+ doNothing().when(modifyRANNssiBBTask).modifyNssi(execution);
+ modifyRANNssiBBTask.modifyNssi(execution);
+ verify(modifyRANNssiBBTask, times(1)).modifyNssi(execution);
+ }
+}
+
+