diff options
author | AndrewLamb <andrew.a.lamb@est.tech> | 2020-09-07 11:54:21 +0100 |
---|---|---|
committer | AndrewLamb <andrew.a.lamb@est.tech> | 2020-09-07 13:53:57 +0100 |
commit | 0205edd07828499839850893105131cd566b21e7 (patch) | |
tree | be30aefe0210f8d0b071df1a60fe874a63f9d79a /adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src | |
parent | 34694adec31a273cdac4b7752c3bdd18f249f9c7 (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/etsi-sol003-lcm-adapter/src')
-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.java | 21 |
1 files changed, 16 insertions, 5 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); |