summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java19
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java32
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java7
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java19
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java)40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java100
-rw-r--r--common/pom.xml9
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java23
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java11
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateNssi.java4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java89
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java31
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java33
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java17
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ModifyAction.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NetworkSliceInfo.java16
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java8
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java9
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java32
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java54
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java31
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceProfile.java30
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java2
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java11
38 files changed, 629 insertions, 245 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
index 59c6becfbd..fa5c57f447 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
@@ -89,4 +89,23 @@ public final class AuthenticationMethodFactory {
v3Auth.setScope(scope);
return v3Auth;
}
+
+ public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(
+ CloudIdentity cloudIdentity) {
+ Identity identity = new Identity();
+ Password password = new Password();
+ User user = new User();
+ Domain userDomain = new Domain();
+ userDomain.setName(cloudIdentity.getUserDomainName());
+ user.setName(cloudIdentity.getMsoId());
+ user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
+ user.setDomain(userDomain);
+ password.setUser(user);
+ identity.setPassword(password);
+ identity.setMethods(Collections.singletonList("password"));
+ com.woorea.openstack.keystone.v3.model.Authentication v3Auth =
+ new com.woorea.openstack.keystone.v3.model.Authentication();
+ v3Auth.setIdentity(identity);
+ return v3Auth;
+ }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index 16906957a7..3564b8f0a7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -107,7 +107,7 @@ public class KeystoneV3Authentication {
return policy;
}
- protected String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) {
+ public String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) {
for (Service service : serviceCatalog) {
if (type.equals(service.getType())) {
for (Service.Endpoint endpoint : service.getEndpoints()) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java
index 63bc235363..072ab5a8d0 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java
@@ -21,15 +21,29 @@
package org.onap.so.openstack.utils;
import java.util.Map;
+import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.woorea.openstack.keystone.v3.model.Token;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.v3.Keystone;
+import com.woorea.openstack.keystone.v3.api.TokensResource.Authenticate;
+import com.woorea.openstack.keystone.v3.model.Authentication;
+import com.woorea.openstack.keystone.v3.model.Authentication.Identity;
@Component
public class MsoKeystoneV3Utils extends MsoTenantUtils {
+ @Autowired
+ private AuthenticationMethodFactory authenticationMethodFactory;
+
@Override
public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
throws MsoException {
@@ -57,4 +71,22 @@ public class MsoKeystoneV3Utils extends MsoTenantUtils {
return cloudIdentity.getIdentityUrl();
}
+ public Token getKeystoneToken(CloudSite cloudSite) throws MsoException {
+ try {
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+
+ Keystone keystone = new Keystone(cloudIdentity.getIdentityUrl());
+
+ Authentication auth = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity);
+
+ Authenticate authenticate = keystone.tokens().authenticate(auth);
+ return executeAndRecordOpenstackRequest(authenticate);
+
+ } catch (OpenStackResponseException e) {
+ throw keystoneErrorToMsoException(e, "TokenAuth");
+ } catch (OpenStackConnectException e) {
+ throw keystoneErrorToMsoException(e, "TokenAuth");
+ }
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java
index c5eeb34157..968e7864b3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java
@@ -49,4 +49,6 @@ public class NovaClient extends MsoCommonUtils {
novaClient.token(keystone.getId());
return novaClient;
}
+
+
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java
index 0e25729610..00e5c4aaec 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java
@@ -127,13 +127,6 @@ public class NssmfManager {
break;
case TRANSPORT:
- AllocateTnNssi tn = nssmiAllocate.getAllocateTnNssi();
- assertObjectNotNull(tn);
- assertObjectNotNull(tn.getNsiInfo());
- assertObjectNotNull(tn.getNsiInfo().getNsiId());
- nsiId = tn.getNsiInfo().getNsiId();
- allocateReq = marshal(tn);
- allocateUrl = AllocateTnNssi.URL;
break;
}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index ad41b0f050..eb6cba5510 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -298,7 +298,7 @@
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
- <version>1.4.0</version>
+ <version>1.4.1</version>
</dependency>
<!-- added for unit testing -->
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index ef2577d6fe..10f39f717f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -49,6 +49,7 @@ import org.apache.commons.validator.routines.InetAddressValidator;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
import org.onap.aai.domain.yang.L3InterfaceIpv4AddressList;
+import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
@@ -303,6 +304,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
List<String> portIds =
extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
+ if (portIds == null)
+ return;
for (String portId : portIds) {
Port port = osClient.getPortById(portId);
Network network = osClient.getNetworkById(port.getNetworkId());
@@ -320,7 +323,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lIf.setInterfaceRole(port.getvNicType());
}
boolean isL2Multicast = false;
- if (port.getProfile().get("trusted") != null) {
+ if (port.getProfile() != null && port.getProfile().get("trusted") != null) {
String trusted = port.getProfile().get("trusted").toString();
if (Boolean.parseBoolean(trusted)) {
isL2Multicast = true;
@@ -522,6 +525,20 @@ public class HeatBridgeImpl implements HeatBridgeApi {
.cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
.lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)),
Optional.of(lInterfaceIp));
+ } else if (InetAddressValidator.getInstance().isValidInet6Address(ipAddress)) {
+ Subnet subnet = osClient.getSubnetById(ip.getSubnetId());
+ IPAddressString cidr = new IPAddressString(subnet.getCidr());
+ L3InterfaceIpv6AddressList ipv6 = new L3InterfaceIpv6AddressList();
+ ipv6.setL3InterfaceIpv6Address(ipAddress);
+ ipv6.setNeutronNetworkId(port.getNetworkId());
+ ipv6.setNeutronSubnetId(ip.getSubnetId());
+ ipv6.setL3InterfaceIpv6PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString()));
+
+ transaction.createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).l3InterfaceIpv6AddressList(ipAddress)),
+ Optional.of(ipv6));
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 8c21e3f7f7..03f6c737f3 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -423,6 +423,18 @@ public class HeatBridgeImplTest {
when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+ IP ip = mock(IP.class);
+
+ Set<IP> ipSet = new HashSet<>();
+ ipSet.add(ip);
+ when(ip.getIpAddress()).thenReturn("2606:ae00:2e60:100::226");
+ when(ip.getSubnetId()).thenReturn("testSubnetId");
+ when(port.getFixedIps()).thenAnswer(x -> ipSet);
+
+ Subnet subnet = mock(Subnet.class);
+ when(subnet.getCidr()).thenReturn("169.254.100.0/24");
+ when(osClient.getSubnetById("testSubnetId")).thenReturn(subnet);
+
Network network = mock(Network.class);
when(network.getId()).thenReturn("test-network-id");
when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
@@ -446,8 +458,9 @@ public class HeatBridgeImplTest {
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(transaction, times(20)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
+ verify(osClient, times(5)).getSubnetById("testSubnetId");
verify(osClient, times(10)).getNetworkById(anyString());
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
index 805597cd12..00dda299b6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
@@ -20,7 +20,19 @@
package org.onap.so.bpmn.infrastructure.process;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import com.google.protobuf.Struct;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
@@ -35,14 +47,6 @@ import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.assertj.core.api.Assertions.fail;
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
/**
* Basic Integration test for ServiceLevelUpgrade.bpmn workflow.
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java
index 0671354bd6..e26195158d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java
@@ -20,32 +20,58 @@
package org.onap.so.bpmn.infrastructure.service.level;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.List;
/**
- * Abstract class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
+ * Parent class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
*/
-public abstract class AbstractServiceLevelPreparable {
+public class ServiceLevelPreparable {
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractServiceLevelPreparable.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevelPreparable.class);
@Autowired
protected ExceptionBuilder exceptionBuilder;
+ @Autowired
+ protected CatalogDbClient catalogDbClient;
+
/**
- * This method fetches workflow names to be invoked based on the controller scope .
+ * Fetches workflow names based on the controller scope and operation name.
*
* @param scope Controller scope
+ * @param operationName healthcheck/softwareUpgrade
* @return String value of Workflow name
*/
- protected abstract String fetchWorkflowUsingScope(DelegateExecution execution, final String scope);
+ protected String fetchWorkflowUsingScope(final String scope, String operationName) {
+ Optional<String> wflName = Optional.empty();
+ try {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByOperationName(operationName);
+ if (!workflows.isEmpty()) {
+ wflName = Optional.ofNullable(
+ workflows.stream().filter(workflow -> workflow.getResourceTarget().equalsIgnoreCase(scope))
+ .findFirst().get().getName());
+ }
+ } catch (Exception e) {
+ // do nothing and assign the default workflow in finally
+ LOG.error("Error occurred while fetching workflow name from CatalogDb {}", e);
+ } finally {
+ if (wflName.isEmpty()) {
+ wflName = Optional.of(ServiceLevelConstants.WORKFLOW_OPERATIONS_MAP.get(operationName).get(scope));
+ }
+ }
+ return wflName.get();
+
+ }
/**
* This method validates the execution parameters to be passed for health check workflow.
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
index 34ebb308c3..d94641846d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
@@ -1,5 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
public class ServiceLevelConstants {
public static final String BPMN_REQUEST = "bpmnRequest";
public static final String RESOURCE_TYPE = "resourceType";
@@ -8,13 +32,27 @@ public class ServiceLevelConstants {
public static final String PNF = "pnf";
public static final String VNF = "vnf";
public static final String EMPTY_STRING = "";
- public static final String WORKFLOW_TO_INVOKE = "healthCheckWorkflow";
+ public static final String HEALTH_CHECK_WORKFLOW_TO_INVOKE = "healthCheckWorkflow";
public static final String SOFTWARE_WORKFLOW_TO_INVOKE = "softwareUpgradeWorkflow";
- public static final String GENERIC_PNF_HEALTH_CHECK_WORKFLOW = "GenericPnfHealthCheck";
- public static final String PNF_SOFTWARE_UPGRADE_WORKFLOW = "PNFSoftwareUpgrade";
+ public static final String HEALTH_CHECK_OPERATION = "ResourceHealthCheck";
+ public static final String SW_UP_OPERATION = "ResourceSoftwareUpgrade";
public static final String CONTROLLER_STATUS = "ControllerStatus";
public static final int ERROR_CODE = 601;
- // TODO This value needs to be updated once vnf health check workflow is available
- protected static final String GENERIC_VNF_HEALTH_CHECK_WORKFLOW = "GenericVNFHealthCheck";
+
+ // TODO GenericVNFHealthCheck and GenericVnfSoftwareUpgrade workflow names should be updated once the workflow is
+ // implemented.
+ public static final Map<String, String> DEFAULT_HEALTH_CHECK_WORKFLOWS =
+ Map.of(PNF, "GenericPnfHealthCheck", VNF, "GenericVNFHealthCheck");
+
+ public static final Map<String, String> DEFAULT_SOFTWARE_UP_WORKFLOWS =
+ Map.of(PNF, "PNFSoftwareUpgrade", VNF, "GenericVnfSoftwareUpgrade");
+
+ // Maps operation name with workflows
+ public static final Map<String, Map<String, String>> WORKFLOW_OPERATIONS_MAP = Map.of(HEALTH_CHECK_OPERATION,
+ DEFAULT_HEALTH_CHECK_WORKFLOWS, SW_UP_OPERATION, DEFAULT_SOFTWARE_UP_WORKFLOWS);
+
+ public static final List<String> VALID_CONTROLLER_SCOPE = Arrays.asList(PNF, VNF);
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
index 5b772760f0..59884ecbc2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
@@ -20,59 +20,54 @@
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
-import java.util.List;
+
/**
* Fetches health check workflow based on the controller_scope. Invoke the corresponding health check workflow after
* validation.
*/
@Component("ServiceLevelPreparation")
-public class ServiceLevelPreparation extends AbstractServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelPreparation extends ServiceLevelPreparable implements JavaDelegate {
- private static final List<String> PNF_HC_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
+ private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+ // TODO Update the list with vnf health check parameters if any validation needed
+ private static final List<String> VNF_HEALTH_CHECK_PARAMS = Collections.emptyList();
+
+ private static final Map<String, List<String>> HEALTH_CHECK_PARAMS_MAP = Map.of(ServiceLevelConstants.PNF,
+ PNF_HEALTH_CHECK_PARAMS, ServiceLevelConstants.VNF, VNF_HEALTH_CHECK_PARAMS);
+
@Override
public void execute(DelegateExecution execution) throws Exception {
if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
&& execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
LOG.debug("Scope retrieved from delegate execution: " + controllerScope);
- final String wflName = fetchWorkflowUsingScope(execution, controllerScope);
- LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
-
- if (ServiceLevelConstants.PNF.equalsIgnoreCase(controllerScope)) {
- validateParamsWithScope(execution, controllerScope, PNF_HC_PARAMS);
+ if (ServiceLevelConstants.VALID_CONTROLLER_SCOPE.contains(controllerScope)) {
+ final String wflName =
+ fetchWorkflowUsingScope(controllerScope, ServiceLevelConstants.HEALTH_CHECK_OPERATION);
+ LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
+ validateParamsWithScope(execution, controllerScope, HEALTH_CHECK_PARAMS_MAP.get(controllerScope));
LOG.info("Parameters validated successfully for {}", wflName);
+ execution.setVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE, wflName);
+ execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
+ "Invalid Controller scope to prepare resource level health check");
}
- execution.setVariable(ServiceLevelConstants.WORKFLOW_TO_INVOKE, wflName);
- execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
} else {
exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "Controller scope not found to invoke resource level health check");
- }
- }
-
- @Override
- public String fetchWorkflowUsingScope(DelegateExecution execution, final String scope) {
- String wflName = null;
- switch (scope.toLowerCase()) {
- case ServiceLevelConstants.PNF:
- wflName = ServiceLevelConstants.GENERIC_PNF_HEALTH_CHECK_WORKFLOW;
- break;
- case ServiceLevelConstants.VNF:
- wflName = ServiceLevelConstants.GENERIC_VNF_HEALTH_CHECK_WORKFLOW;
- break;
- default:
- exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "No valid health check work flow retrieved for the scope: " + scope);
+ "Resource type not found in the execution to invoke resource level health check");
}
- return wflName;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
index dfc77d6f0c..9d7d8efb65 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
@@ -1,34 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
-import java.util.List;
@Component
-public class ServiceLevelUpgrade extends AbstractServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaDelegate {
- private static final List<String> PNF_SWU_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
+ private static final List<String> PNF_SOFTWARE_UP_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
- @Override
- protected String fetchWorkflowUsingScope(DelegateExecution execution, String scope) {
- String wflName = null;
- switch (scope.toLowerCase()) {
- case ServiceLevelConstants.PNF:
- wflName = ServiceLevelConstants.PNF_SOFTWARE_UPGRADE_WORKFLOW;
- break;
- case ServiceLevelConstants.VNF:
- wflName = ServiceLevelConstants.GENERIC_VNF_HEALTH_CHECK_WORKFLOW;
- break;
- default:
- exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "No valid health check work flow retrieved for the scope: " + scope);
- }
- return wflName;
- }
+ // TODO Update the list with vnf software upgrade parameters if any validation needed
+ private static final List<String> VNF_SOFTWARE_UP_PARAMS = Collections.emptyList();
+
+ private static final Map<String, List<String>> SOFTWARE_UP_PARAMS_MAP = Map.of(ServiceLevelConstants.PNF,
+ PNF_SOFTWARE_UP_PARAMS, ServiceLevelConstants.VNF, VNF_SOFTWARE_UP_PARAMS);
+
@Override
public void execute(DelegateExecution execution) throws Exception {
@@ -36,19 +48,20 @@ public class ServiceLevelUpgrade extends AbstractServiceLevelPreparable implemen
&& execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
LOG.debug("Scope retrieved from delegate execution: " + controllerScope);
- final String wflName = fetchWorkflowUsingScope(execution, controllerScope);
- LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
-
- if ("pnf".equalsIgnoreCase(controllerScope)) {
- validateParamsWithScope(execution, controllerScope, PNF_SWU_PARAMS);
+ if (ServiceLevelConstants.VALID_CONTROLLER_SCOPE.contains(controllerScope)) {
+ final String wflName = fetchWorkflowUsingScope(controllerScope, ServiceLevelConstants.SW_UP_OPERATION);
+ LOG.debug("Software Upgrade workflow fetched for the scope: {} is: {}", controllerScope, wflName);
+ validateParamsWithScope(execution, controllerScope, SOFTWARE_UP_PARAMS_MAP.get(controllerScope));
LOG.info("Parameters validated successfully for {}", wflName);
execution.setVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE, wflName);
execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, "");
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
+ "Invalid Controller scope for resource level software upgrade");
}
-
} else {
exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "Controller scope not found to invoke resource level health check");
+ "Resource type not found in the execution to invoke resource level software upgrade");
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
index 340b2776a4..0b1c5b0f5e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
@@ -20,6 +20,13 @@
package org.onap.so.bpmn.infrastructure.service.level;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -27,23 +34,16 @@ 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.InjectMocks;
+import org.mockito.Spy;
+import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelPreparation;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.assertj.core.api.Assertions.assertThat;
+import org.onap.so.db.catalog.beans.Workflow;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {ServiceLevelPreparation.class, ExceptionBuilder.class})
-public class ServiceLevelPreparationTest {
+public class ServiceLevelPreparationTest extends BaseTaskTest {
private static final String TEST_PNF_SCOPE = "pnf";
private static final String TEST_PROCESS_KEY = "testProcessKey";
@@ -52,42 +52,29 @@ public class ServiceLevelPreparationTest {
private static final String RESOURCE_TYPE = "resourceType";
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
private static final String PNF_NAME = "pnfName";
- private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
- ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+ private static final String HEALTH_CHECK_OPERATION = "ResourceHealthCheck";
+ private static final String PNF_HEALTH_CHECK_WORKFLOW = "PNFHealthCheck";
+ private static final Map<String, List<String>> HEALTH_CHECK_PARAMS_MAP = Map.of(TEST_PNF_SCOPE,
+ Arrays.asList(SERVICE_INSTANCE_ID, RESOURCE_TYPE, BPMN_REQUEST, PNF_NAME), "vnf", Collections.emptyList());
+
+ private List<Workflow> workflowList = new ArrayList<>();
- private Map<String, String> pnfHealthCheckTestParams = new HashMap<>();
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
- @Autowired
+ @InjectMocks
private ServiceLevelPreparation serviceLevelPrepare;
- @Autowired
+ @InjectMocks
+ @Spy
private ExceptionBuilder exceptionBuilder;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private DelegateExecution execution = new DelegateExecutionFake();
private DelegateExecution invalidExecution = new DelegateExecutionFake();
@Before
public void setUpPnfUpgradeTest() {
- pnfHealthCheckTestParams.put("TEST_SERVICE_MODEL_INFO", "d4c6855e-3be2-5dtu-9390-c999a38829bc");
- pnfHealthCheckTestParams.put("TEST_SERVICE_INSTANCE_NAME", "test_service_id");
- pnfHealthCheckTestParams.put("TEST_PNF_CORRELATION_ID", "pnfCorrelationId");
- pnfHealthCheckTestParams.put("TEST_MODEL_UUID", "6bc0b04d-1873-4721-b53d-6615225b2a28");
- pnfHealthCheckTestParams.put("TEST_PNF_UUID", "c93g70d9-8de3-57f1-7de1-f5690ac2b005");
- pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_NAME", "serviceUpgrade");
- pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_VERSION", "1.0.2");
- pnfHealthCheckTestParams.put("TEST_PRC_CUSTOMIZATION_UUID", "PRC_customizationUuid");
- pnfHealthCheckTestParams.put("TEST_RESOURCE_CUSTOMIZATION_UUID_PARAM", "9acb3a83-8a52-412c-9a45-901764938144");
- pnfHealthCheckTestParams.put("TEST_PRC_INSTANCE_NAME", "Demo_pnf");
- pnfHealthCheckTestParams.put("TEST_PRC_CONTROLLER_ACTOR", "cds");
- pnfHealthCheckTestParams.put("TEST_REQUEST_PAYLOAD", "test_payload");
-
- for (String param : PNF_HEALTH_CHECK_PARAMS) {
- execution.setVariable(param, pnfHealthCheckTestParams.get("TEST_" + param));
- }
execution.setVariable(RESOURCE_TYPE, TEST_PNF_SCOPE);
execution.setVariable(TEST_PROCESS_KEY, PROCESS_KEY_VALUE);
execution.setVariable(BPMN_REQUEST, "bpmnRequestValue");
@@ -95,14 +82,22 @@ public class ServiceLevelPreparationTest {
execution.setVariable(PNF_NAME, "PnfDemo");
invalidExecution.setVariables(execution.getVariables());
+
+ Workflow pnfWorkflow = new Workflow();
+ pnfWorkflow.setName(PNF_HEALTH_CHECK_WORKFLOW);
+ pnfWorkflow.setOperationName(HEALTH_CHECK_OPERATION);
+ pnfWorkflow.setResourceTarget(TEST_PNF_SCOPE);
+ workflowList.add(pnfWorkflow);
+
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(workflowList);
}
@Test
public void executePnfUpgradeSuccessTest() throws Exception {
serviceLevelPrepare.execute(execution);
// Expect the pnf health check workflow to be set in to execution if validation is successful
- assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.WORKFLOW_TO_INVOKE)))
- .isEqualTo("GenericPnfHealthCheck");
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo("PNFHealthCheck");
}
@Test
@@ -110,7 +105,8 @@ public class ServiceLevelPreparationTest {
invalidExecution.removeVariable(BPMN_REQUEST);
// BPMN exception is thrown in case of validation failure or invalid execution
thrown.expect(BpmnError.class);
- serviceLevelPrepare.validateParamsWithScope(invalidExecution, TEST_PNF_SCOPE, PNF_HEALTH_CHECK_PARAMS);
+ serviceLevelPrepare.validateParamsWithScope(invalidExecution, TEST_PNF_SCOPE,
+ HEALTH_CHECK_PARAMS_MAP.get(TEST_PNF_SCOPE));
}
@Test
@@ -129,6 +125,32 @@ public class ServiceLevelPreparationTest {
}
+ @Test
+ public void validateDefaultWorkflowIsSetWithoutDBData() throws Exception {
+ // Mock empty workflow list in db response
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(new ArrayList<Workflow>());
+ serviceLevelPrepare.execute(execution);
+ // Expect default workflow gets assigned when workflow name not found in db.
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo(ServiceLevelConstants.DEFAULT_HEALTH_CHECK_WORKFLOWS.get(TEST_PNF_SCOPE));
+ }
+
+ @Test
+ public void validateWorkflowSetFromDb() throws Exception {
+ Workflow vnfWorkflow = new Workflow();
+ vnfWorkflow.setName("VNFHealthCheck");
+ vnfWorkflow.setOperationName(HEALTH_CHECK_OPERATION);
+ vnfWorkflow.setResourceTarget("vnf");
+ workflowList.add(vnfWorkflow);
+ // Mock db response with multiple worklfows mapped with same operation name
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(workflowList);
+ serviceLevelPrepare.execute(execution);
+
+ // Expect right workflow gets assigned from db based on the controller scope.
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo(PNF_HEALTH_CHECK_WORKFLOW);
+ }
+
}
diff --git a/common/pom.xml b/common/pom.xml
index 08554480c3..ff13da4ee6 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -271,6 +271,15 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java b/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java
new file mode 100644
index 0000000000..64f1df2590
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java
@@ -0,0 +1,23 @@
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
+public class AdditionalProperties implements Serializable {
+
+ private static final long serialVersionUID = -4020397418955518175L;
+
+ private SliceProfile sliceProfile;
+
+ private List<EndPoint> endPoints;
+
+ private NsiInfo nsiInfo;
+
+ private String scriptName;
+
+ private ModifyAction modifyAction;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
index 484f5b42b1..156f999773 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
@@ -25,12 +25,11 @@ import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AllocateAnNssi {
+ @Deprecated
public final static String URL = "/api/rest/provMns/v1/an/NSS" + "/SliceProfiles";
private String nsstId;
- private String flavorId;
-
private String nssiId;
private String nssiName;
@@ -51,14 +50,6 @@ public class AllocateAnNssi {
this.nsstId = nsstId;
}
- public String getFlavorId() {
- return flavorId;
- }
-
- public void setFlavorId(String flavorId) {
- this.flavorId = flavorId;
- }
-
public String getNssiId() {
return nssiId;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
index d03673368c..1d8b15e69a 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
@@ -27,6 +27,7 @@ import java.io.Serializable;
public class AllocateCnNssi implements Serializable {
public final static String URL = "/api/rest/provMns/v1/NSS/SliceProfiles";
+ private static final long serialVersionUID = 4909074863148869163L;
private String nsstId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateNssi.java
new file mode 100644
index 0000000000..1dc6d0f1c5
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateNssi.java
@@ -0,0 +1,4 @@
+package org.onap.so.beans.nsmf;
+
+public class AllocateNssi {
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
index b66fb133d2..f85cb0cd85 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
@@ -20,90 +20,17 @@
package org.onap.so.beans.nsmf;
-import com.fasterxml.jackson.annotation.JsonInclude;
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class AllocateTnNssi {
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
- public final static String URL = "/api/rest/provMns/v1/tn/NSS" + "/SliceProfiles";
+@Data
+public class AllocateTnNssi implements Serializable {
- private String nsstId;
+ private static final long serialVersionUID = -7069801712339914746L;
- private String flavorId;
+ private List<NetworkSliceInfo> networkSliceInfos;
- private String nssiId;
-
- private String nssiName;
-
- private TnSliceProfile sliceProfile;
-
- private String scriptName;
-
- private Object extension;
-
- private NsiInfo nsiInfo;
-
- public String getNsstId() {
- return nsstId;
- }
-
- public void setNsstId(String nsstId) {
- this.nsstId = nsstId;
- }
-
- public String getFlavorId() {
- return flavorId;
- }
-
- public void setFlavorId(String flavorId) {
- this.flavorId = flavorId;
- }
-
- public String getNssiId() {
- return nssiId;
- }
-
- public void setNssiId(String nssiId) {
- this.nssiId = nssiId;
- }
-
- public String getNssiName() {
- return nssiName;
- }
-
- public void setNssiName(String nssiName) {
- this.nssiName = nssiName;
- }
-
- public TnSliceProfile getSliceProfile() {
- return sliceProfile;
- }
-
- public void setSliceProfile(TnSliceProfile sliceProfile) {
- this.sliceProfile = sliceProfile;
- }
-
- public String getScriptName() {
- return scriptName;
- }
-
- public void setScriptName(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public Object getExtension() {
- return extension;
- }
-
- public void setExtension(Object extension) {
- this.extension = extension;
- }
-
- public NsiInfo getNsiInfo() {
- return nsiInfo;
- }
-
- public void setNsiInfo(NsiInfo nsiInfo) {
- this.nsiInfo = nsiInfo;
- }
+ private List<TransportSliceNetwork> transportSliceNetworks;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index 3d60949385..653f9ac495 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -22,40 +22,31 @@ package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
public class AnSliceProfile {
- @JsonProperty("5QI")
- private String qi;
+ private List<String> sNSSAIList;
+
+ private String sliceProfileId;
private List<String> coverageAreaTAList;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int latency;
- public String getQi() {
- return qi;
- }
+ private List<String> pLMNIdList;
- public void setQi(String qi) {
- this.qi = qi;
- }
+ private PerfReq perfReq;
- public List<String> getCoverageAreaTAList() {
- return coverageAreaTAList;
- }
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int maxNumberofUEs;
- public void setCoverageAreaTAList(List<String> coverageAreaTAList) {
- this.coverageAreaTAList = coverageAreaTAList;
- }
+ private UeMobilityLevel uEMobilityLevel;
- public int getLatency() {
- return latency;
- }
+ private ResourceSharingLevel resourceSharingLevel;
- public void setLatency(int latency) {
- this.latency = latency;
- }
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java b/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java
new file mode 100644
index 0000000000..ca0c684779
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java
@@ -0,0 +1,33 @@
+package org.onap.so.beans.nsmf;
+
+
+import java.io.Serializable;
+
+
+public class ConnectionLink implements Serializable {
+ private static final long serialVersionUID = -1834584960407180427L;
+
+ private String transportEndpointA;
+
+ private String transportEndpointB;
+
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+ public String getTransportEndpointA() {
+ return transportEndpointA;
+ }
+
+ public void setTransportEndpointA(String transportEndpointA) {
+ this.transportEndpointA = transportEndpointA;
+ }
+
+ public String getTransportEndpointB() {
+ return transportEndpointB;
+ }
+
+ public void setTransportEndpointB(String transportEndpointB) {
+ this.transportEndpointB = transportEndpointB;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
index 648fd4985f..1ee83c7db0 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
@@ -26,6 +26,7 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeAllocateNssi {
+ @Deprecated
public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
private String nsiId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java b/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java
new file mode 100644
index 0000000000..a55672f37f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java
@@ -0,0 +1,17 @@
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
+public class EndPoint implements Serializable {
+
+ private static final long serialVersionUID = 2479795890807020491L;
+
+ private String nodeId;
+
+ private Map<String, Object> additionalInfo;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java
index d720399293..f8ff5be70e 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java
@@ -26,6 +26,7 @@ import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EsrInfo implements Serializable {
+ private static final long serialVersionUID = -7696600990607396263L;
private String vendor;
private NetworkType networkType;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ModifyAction.java b/common/src/main/java/org/onap/so/beans/nsmf/ModifyAction.java
new file mode 100644
index 0000000000..8206b527cd
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ModifyAction.java
@@ -0,0 +1,5 @@
+package org.onap.so.beans.nsmf;
+
+public enum ModifyAction {
+ allocate, deallocate
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NetworkSliceInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NetworkSliceInfo.java
new file mode 100644
index 0000000000..67701a1922
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NetworkSliceInfo.java
@@ -0,0 +1,16 @@
+package org.onap.so.beans.nsmf;
+
+
+import lombok.Data;
+import java.io.Serializable;
+
+@Data
+public class NetworkSliceInfo implements Serializable {
+ private static final long serialVersionUID = 4401921718259398587L;
+
+ private String snssai;
+
+ private String customer;
+
+ private String serviceType;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
index 0ff554d10d..d1679c6dfa 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
@@ -37,11 +37,11 @@ public class NsiInfo {
this.nsiName = nsiName;
}
- public void setNsiId(String nsiId) {
- this.nsiId = nsiId;
- }
-
public String getNsiId() {
return nsiId;
}
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java
index f72a74a063..9a25d6fea3 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java
@@ -21,10 +21,15 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class NssiAllocateRequest {
+public class NssiAllocateRequest implements Serializable {
+ private static final long serialVersionUID = -454145891489457960L;
+
+ @NotNull
private EsrInfo esrInfo;
private AllocateCnNssi allocateCnNssi;
@@ -33,6 +38,8 @@ public class NssiAllocateRequest {
private AllocateAnNssi allocateAnNssi;
+ private ServiceInfo serviceInfo;
+
public EsrInfo getEsrInfo() {
return esrInfo;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
new file mode 100644
index 0000000000..e421df456b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
@@ -0,0 +1,32 @@
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.io.Serializable;
+
+
+@Data
+public class NssmfAdapterNBIRequest implements Serializable {
+
+ private static final long serialVersionUID = -454145891489457960L;
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private EsrInfo esrInfo;
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private ServiceInfo serviceInfo;
+
+ private AllocateCnNssi allocateCnNssi;
+
+ private AllocateTnNssi allocateTnNssi;
+
+ private AllocateAnNssi allocateAnNssi;
+
+ private ActDeActNssi actDeActNssi;
+
+ private DeAllocateNssi deAllocateNssi;
+
+ private String subnetCapabilityQuery;
+
+ private String responseId;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java
new file mode 100644
index 0000000000..5a1393376f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfRequest.java
@@ -0,0 +1,54 @@
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
+public class NssmfRequest implements Serializable {
+
+ private static final long serialVersionUID = 3313218757241310655L;
+
+ private String name;
+
+ private String modelInvariantUuid;
+
+ private String modelUuid;
+
+ private String globalSubscriberId;
+
+ private String serviceInstanceId;
+
+ private String subscriptionServiceType;
+
+ private NetworkType networkType;
+
+ private Object additionalProperties;
+
+ public NssmfRequest() {}
+
+ public NssmfRequest(ServiceInfo serviceInfo, NetworkType networkType, Object additionalProperties) {
+ this.modelInvariantUuid = serviceInfo.getServiceInvariantUuid();
+ this.modelUuid = serviceInfo.getServiceUuid();
+ this.globalSubscriberId = serviceInfo.getGlobalSubscriberId();
+ this.subscriptionServiceType = serviceInfo.getSubscriptionServiceType();
+ this.networkType = networkType;
+ this.additionalProperties = additionalProperties;
+ this.serviceInstanceId = serviceInfo.getNssiId();
+ this.name = serviceInfo.getNssiName();
+ }
+
+}
+
+
+/**
+ * { "name": "eMBB-001", "modelInvariantUuid": "NSST-C-001-HDBNJ-NSSMF-01-A-ZX", "modelUuid":
+ * "NSST-C-001-HDBNJ-NSSMF-01-A-ZX-UUID", "globalSubscriberId": "5GCustomer", "subscriptionServiceType": "5G",
+ * "networkType": "AN/CN/TN", "additionalProperties": { "sliceProfile": { "snssaiList": [ "001-100001" ],
+ * "sliceProfileId": "ab9af40f13f721b5f13539d87484098", "plmnIdList": [ "460-00", "460-01" ], "perfReq": {
+ * "perfReqEmbbList ": [ { "activityFactor": 50 } ] }, "maxNumberofUEs": 200, "coverageAreaTAList": [ "1", "2", "3", "4"
+ * ], "latency": 2, "resourceSharingLevel": "non-shared" }, "endPoints": [ { "nodeId": "", "additionalInfo": { "xxx":
+ * "xxx" } }, { "nodeId": "", "additionalInfo": { "xxx": "xxx" } } ], "nsiInfo": { "nsiId":
+ * "NSI-M-001-HDBNJ-NSMF-01-A-ZX", "nsiName": "eMBB-001" }, "scriptName": "AN1" } }
+ */
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
new file mode 100644
index 0000000000..f87c032096
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
@@ -0,0 +1,31 @@
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class ServiceInfo implements Serializable {
+
+ private static final long serialVersionUID = 7895110339097615695L;
+
+ private String serviceInvariantUuid;
+
+ private String serviceUuid;
+
+ private String globalSubscriberId;
+
+ private String subscriptionServiceType;
+
+ private String serviceType;
+
+ private String nsiId;
+
+ private String nssiId;
+
+ private String sST;
+
+ private String nssiName;
+
+ private String pLMNIdList;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java
index 6c5d9c6909..cc6c9bbb82 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java
@@ -21,7 +21,11 @@
package org.onap.so.beans.nsmf;
import java.io.Serializable;
+import java.util.HashMap;
import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfile.java
new file mode 100644
index 0000000000..62077050ce
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfile.java
@@ -0,0 +1,30 @@
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
+public class SliceProfile implements Serializable {
+
+ private static final long serialVersionUID = 7924389625656716814L;
+
+ private List<String> snssaiList;
+
+ private String sliceProfileId;
+
+ private List<String> plmnIdList;
+
+ private PerfReq perfReq;
+
+ private Integer maxNumberofUEs;
+
+ private List<String> coverageAreaTAList;
+
+ private Integer latency;
+
+ private String resourceSharingLevel;
+
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java b/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java
new file mode 100644
index 0000000000..bfbbbd3bda
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java
@@ -0,0 +1,12 @@
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class TransportSliceNetwork implements Serializable {
+ private static final long serialVersionUID = 809947462399806990L;
+
+ private List<ConnectionLink> connectionLinks;
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 8d342b673d..ef90dd6984 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -20,6 +20,7 @@
package org.onap.so.db.catalog.client;
+import com.google.common.base.Strings;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
@@ -83,7 +84,6 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
-import com.google.common.base.Strings;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -162,6 +162,7 @@ public class CatalogDbClient {
protected static final String SOURCE = "source";
protected static final String RESOURCE_TARGET = "resourceTarget";
protected static final String FLAG = "flag";
+ protected static final String OPERATION_NAME = "operationName";
private static final String TARGET_ENTITY = "SO:CatalogDB";
private static final String ASTERISK = "*";
@@ -215,6 +216,7 @@ public class CatalogDbClient {
"/findBBNameSelectionReferenceByControllerActorAndScopeAndAction";
private String findWorkflowByResourceTarget = "/findByResourceTarget";
private String findProcessingFlagsByFlag = "/findByFlag";
+ private String findWorkflowByOperationName = "/findByOperationName";
private String serviceURI;
private String vfModuleURI;
@@ -365,6 +367,7 @@ public class CatalogDbClient {
+ findBBNameSelectionReferenceByControllerActorAndScopeAndAction;
findProcessingFlagsByFlag = endpoint + PROCESSING_FLAGS + SEARCH + findProcessingFlagsByFlag;
+ findWorkflowByOperationName = endpoint + WORKFLOW + SEARCH + findWorkflowByOperationName;
serviceURI = endpoint + SERVICE + URI_SEPARATOR;
vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
@@ -1106,6 +1109,11 @@ public class CatalogDbClient {
.queryParam(RESOURCE_TARGET, resourceTarget).build().toString()));
}
+ public List<Workflow> findWorkflowByOperationName(String operationName) {
+ return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByOperationName)
+ .queryParam(OPERATION_NAME, operationName).build().toString()));
+ }
+
public ProcessingFlags findProcessingFlagsByFlag(String flag) {
return this.getSingleResource(processingFlagsClient,
getUri(UriBuilder.fromUri(findProcessingFlagsByFlag).queryParam(FLAG, flag).build().toString()));
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
index 93ec54a2eb..74843e5531 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
@@ -35,6 +35,8 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
List<Workflow> findByResourceTarget(String resourceTarget);
+ List<Workflow> findByOperationName(String operationName);
+
/**
* Used to fetch the @{link Workflow} by the Model UUID.
*
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 79e3cbcc08..6a5daa601a 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -204,4 +204,15 @@ public class CatalogDbClientTest {
.queryParam(CatalogDbClient.RESOURCE_TARGET, pnf_resource).build()));
}
+ @Test
+ public final void testFindWorkFlowByOperationName() {
+ final String operationName = "PNFSoftwareUpgrade";
+ doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any());
+ catalogDbClient.findWorkflowByOperationName(operationName);
+
+ // verify
+ verify(catalogDbClient).getMultipleResources(any(Client.class), eq(UriBuilder.fromUri("/findByOperationName")
+ .queryParam(CatalogDbClient.OPERATION_NAME, operationName).build()));
+ }
+
}