From 36982a7db770806b0a3e12d07686b4e3a72a0871 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 8 Sep 2020 14:15:20 +0100 Subject: Adding NS instantiation Change-Id: I41d32ddab1ba1e4eea42129a5918bdea3312de94 Issue-ID: SO-2868 Signed-off-by: waqas.ikram --- .../onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java | 2 +- .../org/onap/so/etsi/nfvo/ns/lcm/database/beans/State.java | 2 +- .../ns/lcm/database/service/DatabaseServiceProvider.java | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service') diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java index 7549b49264..cb8f92070a 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java @@ -65,7 +65,7 @@ public class NsLcmOpOcc { @Column(name = "IS_AUTO_INNOVATION") private boolean isAutoInnovation; - @Column(name = "OPERATION_PARAMS") + @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT") private String operationParams; @Column(name = "IS_CANCEL_PENDING") diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/State.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/State.java index 08dbef3866..390c7fd776 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/State.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/State.java @@ -24,6 +24,6 @@ package org.onap.so.etsi.nfvo.ns.lcm.database.beans; * */ public enum State { - NOT_INSTANTIATED, INSTANTIATED; + NOT_INSTANTIATED, INSTANTIATING, INSTANTIATED, FAILED; } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java index 254a3698c9..368242515b 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java @@ -81,6 +81,12 @@ public class DatabaseServiceProvider { return nfvoNsInstRepository.existsNfvoNsInstByName(name); } + public boolean isNsInstExists(final String nsInstId, final String nfName) { + logger.info("Checking if NfvoNfInst entry exists in database using nsInstId: {} and nfName: {}", nsInstId, + nfName); + return nfvoNfInstRepository.findByNsInstNsInstIdAndName(nsInstId, nfName).isEmpty(); + } + public boolean saveNfvoNsInst(final NfvoNsInst nfvoNsInst) { logger.info("Saving NfvoNsInst: {} to database", nfvoNsInst); return nfvoNsInstRepository.save(nfvoNsInst) != null; @@ -116,6 +122,11 @@ public class DatabaseServiceProvider { return nfvoNfInstRepository.findByNsInstNsInstIdAndName(nsInstId, name); } + public Optional getNfvoNfInst(final String nfInstId) { + logger.info("Querying database for NfvoNfInst using nfInstId: {}", nfInstId); + return nfvoNfInstRepository.findByNfInstId(nfInstId); + } + public boolean addNSLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) { logger.info("Adding NSLcmOpOcc: {} to database", nsLcmOpOcc); return nsLcmOpOccRepository.save(nsLcmOpOcc) != null; @@ -127,5 +138,4 @@ public class DatabaseServiceProvider { } - } -- cgit 1.2.3-korg