diff options
Diffstat (limited to 'vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository')
-rw-r--r-- | vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java (renamed from vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java) | 4 | ||||
-rw-r--r-- | vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java | 31 |
2 files changed, 25 insertions, 10 deletions
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java index b3b39bfdf1..43c201734f 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java @@ -20,7 +20,7 @@ package org.onap.svnfm.simulator.repository; -import org.onap.svnfm.simulator.model.VnfJob; +import org.onap.svnfm.simulator.model.VnfOperation; import org.springframework.data.repository.CrudRepository; /** @@ -28,6 +28,6 @@ import org.springframework.data.repository.CrudRepository; * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ -public interface VnfJobRepository extends CrudRepository<VnfJob, String> { +public interface VnfOperationRepository extends CrudRepository<VnfOperation, String> { } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java index e41cbe1e3a..030b073da4 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java @@ -20,15 +20,21 @@ package org.onap.svnfm.simulator.repository; +import java.util.List; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; +import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.services.SvnfmService; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; /** - * + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ @@ -38,12 +44,21 @@ public class VnfmCacheRepository { @Autowired private SvnfmService svnfmService; - @Cacheable(value = "inlineResponse201", key = "#createVnfRequest.vnfdId") - public InlineResponse201 createVnf(final CreateVnfRequest createVnfRequest) { - return svnfmService.createVnf(createVnfRequest); + @Cacheable(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public InlineResponse201 createVnf(final CreateVnfRequest createVnfRequest, final String id) { + return svnfmService.createVnf(createVnfRequest, id); + } + + @CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public InlineResponse201 updateVnf(final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id, + final List<InlineResponse201VimConnectionInfo> vimConnectionInfo) { + final InlineResponse201 vnf = getVnf(id); + vnf.setInstantiatedVnfInfo(instantiatedVnfInfo); + vnf.setInstantiationState(InstantiationStateEnum.INSTANTIATED); + vnf.setVimConnectionInfo(vimConnectionInfo); + return vnf; } - @Cacheable(value = "inlineResponse201", key = "#id") public InlineResponse201 getVnf(final String id) { return svnfmService.getVnf(id); } @@ -52,7 +67,7 @@ public class VnfmCacheRepository { * @param vnfId * @return */ - public InlineResponse201 deleteVnf(String vnfId) { + public InlineResponse201 deleteVnf(final String vnfId) { // TODO return null; } |