summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-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