summaryrefslogtreecommitdiffstats
path: root/adapters/etsi-sol003-adapter/etsi-sol003-lcm
diff options
context:
space:
mode:
authorAndrewLamb <andrew.a.lamb@est.tech>2020-09-07 11:54:21 +0100
committerAndrewLamb <andrew.a.lamb@est.tech>2020-09-07 13:53:57 +0100
commit0205edd07828499839850893105131cd566b21e7 (patch)
treebe30aefe0210f8d0b071df1a60fe874a63f9d79a /adapters/etsi-sol003-adapter/etsi-sol003-lcm
parent34694adec31a273cdac4b7752c3bdd18f249f9c7 (diff)
Add support for Create Vnf Request with Package Id
Issue-ID: SO-3218 Change-Id: If5ca57ce94c0a735c5abf0a77db0e7d725763121 Signed-off-by: AndrewLamb <andrew.a.lamb@est.tech>
Diffstat (limited to 'adapters/etsi-sol003-adapter/etsi-sol003-lcm')
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java21
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml5
2 files changed, 20 insertions, 6 deletions
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
index 472b5176d5..a2af1a4580 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
@@ -48,6 +48,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Optional;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
/**
* Manages lifecycle operations towards the VNFMs.
@@ -152,15 +153,16 @@ public class LifecycleManager {
}
}
- private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
- final String vnfIdInAai, final EsrVnfm vnfm) {
- logger.debug("Sending a create request to SVNFM " + aaiRequest);
+ private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest createVnfRequest,
+ final GenericVnf genericVnf, final String vnfIdInAai, final EsrVnfm vnfm) {
+ logger.debug("Sending a create request to SVNFM {}", createVnfRequest);
final org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
new org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest();
- final String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId());
+ final String pkgId = getPackageId(createVnfRequest, genericVnf);
+ final String vnfdId = packageProvider.getVnfdId(pkgId);
vnfmRequest.setVnfdId(vnfdId);
- vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_"));
+ vnfmRequest.setVnfInstanceName(createVnfRequest.getName().replaceAll(" ", "_"));
vnfmRequest.setVnfInstanceDescription(vnfIdInAai);
final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfm, vnfmRequest);
@@ -174,6 +176,15 @@ public class LifecycleManager {
}
}
+ private String getPackageId(final CreateVnfRequest createVnfRequest, final GenericVnf genericVnf) {
+ if (isNotBlank(createVnfRequest.getPkgId())) {
+ logger.info("Found createVnfRequest pkgId: {}", createVnfRequest.getPkgId());
+ return createVnfRequest.getPkgId();
+ }
+ logger.info("Found genericVnf modelVersionId: {}", genericVnf.getModelVersionId());
+ return genericVnf.getModelVersionId();
+ }
+
private void createNotificationSubscription(final EsrVnfm vnfm, final String vnfId) {
try {
final LccnSubscriptionRequest subscriptionRequest = vnfmHelper.createNotificationSubscriptionRequest(vnfId);
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml
index 9d0a5283af..578708ded8 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml
@@ -168,6 +168,9 @@ definitions:
description: The name to be applied to the VNF.
tenant:
$ref: '#/definitions/Tenant'
+ pkgId:
+ type: string
+ description: An identifier for the vnf package.
additionalParams:
type: object
description: >-
@@ -519,4 +522,4 @@ definitions:
description: >
Type of the resource in the scope of the VIM or the resource
provider.
- type: string \ No newline at end of file
+ type: string