diff options
Diffstat (limited to 'nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc')
5 files changed, 21 insertions, 24 deletions
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcExternalSystemInfoProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcExternalSystemInfoProvider.java index eb8e1f65..a93b97a0 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcExternalSystemInfoProvider.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcExternalSystemInfoProvider.java @@ -15,16 +15,18 @@ */ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc; +import java.util.Set; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.GenericExternalSystemInfoProvider; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions; import org.onap.vnfmdriver.model.VimInfo; import org.onap.vnfmdriver.model.VnfmInfo; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Conditional; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import static com.google.common.collect.Sets.newHashSet; import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.buildFatalFailure; import static org.slf4j.LoggerFactory.getLogger; @@ -32,10 +34,12 @@ import static org.slf4j.LoggerFactory.getLogger; * Responsible for providing information related to the VNFM from VF-C source */ @Component -@Conditional(value = Conditions.UseForVfc.class) +@Qualifier("vfc") public class VfcExternalSystemInfoProvider extends GenericExternalSystemInfoProvider { private static Logger logger = getLogger(VfcExternalSystemInfoProvider.class); private final VfcRestApiProvider vfcRestApiProvider; + @Value("${vnfmId}") + private String vnfmId; @Autowired VfcExternalSystemInfoProvider(Environment environment, VfcRestApiProvider vfcRestApiProvider) { @@ -60,4 +64,10 @@ public class VfcExternalSystemInfoProvider extends GenericExternalSystemInfoProv throw buildFatalFailure(logger, "Unable to query VIM from VF-C with " + vimId + " identifier", e); } } + + @Override + public Set<String> getVnfms() { + //FIXME in the Casablanca release add API to VF-C to be able to list VNFMs VFC-886 task + return newHashSet(vnfmId); + } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java index 7b985c84..c2ba4642 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java @@ -25,13 +25,13 @@ import com.nokia.cbam.lcm.v32.model.VnfInfo; import com.nokia.cbam.lcm.v32.model.VnfcResourceInfo; import java.util.*; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IGrantManager; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManager; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CatalogManagerForVfc; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProvider; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProviderForVfc; import org.onap.vnfmdriver.model.*; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; @@ -46,7 +46,6 @@ import static org.slf4j.LoggerFactory.getLogger; * Responsible for handling granting before the execution of a VNF operation */ @Component -@Conditional(value = Conditions.UseForVfc.class) public class VfcGrantManager implements IGrantManager { private static Logger logger = getLogger(VfcGrantManager.class); private final CatalogManager catalogManager; @@ -54,7 +53,7 @@ public class VfcGrantManager implements IGrantManager { private final VfcRestApiProvider vfcRestApiProvider; @Autowired - VfcGrantManager(CatalogManager catalogManager, CbamRestApiProvider cbamRestApiProvider, VfcRestApiProvider vfcRestApiProvider) { + VfcGrantManager(CatalogManagerForVfc catalogManager, CbamRestApiProviderForVfc cbamRestApiProvider, VfcRestApiProvider vfcRestApiProvider) { this.catalogManager = catalogManager; this.cbamRestApiProvider = cbamRestApiProvider; this.vfcRestApiProvider = vfcRestApiProvider; diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java index 65cef408..b44c1531 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcNotificationSender.java @@ -22,15 +22,12 @@ import com.nokia.cbam.lcm.v32.model.VnfLifecycleChangeNotification; import java.util.ArrayList; import java.util.Optional; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.INotificationSender; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.LifecycleChangeNotificationManager; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.ReportedAffectedConnectionPoints; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.ReportedAffectedCp; import org.onap.vnfmdriver.model.*; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Component; import static java.util.Optional.of; @@ -46,20 +43,17 @@ import static org.slf4j.LoggerFactory.getLogger; * Responsible for sending notifications to VF-C */ @Component -@Conditional(value = Conditions.UseForVfc.class) public class VfcNotificationSender implements INotificationSender { private static Logger logger = getLogger(VfcNotificationSender.class); - private final DriverProperties driverProperties; private final VfcRestApiProvider vfcRestApiProvider; @Autowired - VfcNotificationSender(DriverProperties driverProperties, VfcRestApiProvider vfcRestApiProvider) { - this.driverProperties = driverProperties; + VfcNotificationSender(VfcRestApiProvider vfcRestApiProvider) { this.vfcRestApiProvider = vfcRestApiProvider; } @Override - public void processNotification(VnfLifecycleChangeNotification recievedNotification, OperationExecution operationExecution, Optional<ReportedAffectedConnectionPoints> affectedCps, String vimId) { + public void processNotification(VnfLifecycleChangeNotification recievedNotification, OperationExecution operationExecution, Optional<ReportedAffectedConnectionPoints> affectedCps, String vimId, String vnfmId) { VNFLCMNotification notificationToSend = new VNFLCMNotification(); notificationToSend.setJobId(extractOnapJobId(operationExecution.getOperationParams())); notificationToSend.setOperation(getOperation(operationExecution, recievedNotification.getOperation())); @@ -72,15 +66,15 @@ public class VfcNotificationSender implements INotificationSender { } else { notificationToSend.setStatus(VnfLcmNotificationStatus.START); } - sendNotification(notificationToSend); + sendNotification(vnfmId, notificationToSend); } - private void sendNotification(VNFLCMNotification notification) { + private void sendNotification(String vnfmId, VNFLCMNotification notification) { try { if (logger.isInfoEnabled()) { logger.info("Sending LCN: {}", new Gson().toJson(notification)); } - vfcRestApiProvider.getNsLcmApi().vNFLCMNotification(driverProperties.getVnfmId(), notification.getVnfInstanceId(), notification); + vfcRestApiProvider.getNsLcmApi().vNFLCMNotification(vnfmId, notification.getVnfInstanceId(), notification); } catch (Exception e) { throw buildFatalFailure(logger, "Unable to send LCN to VF-C", e); } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcPackageProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcPackageProvider.java index 5831d9b5..03fa3f18 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcPackageProvider.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcPackageProvider.java @@ -28,12 +28,10 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IPackageProvider; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.IpMappingProvider; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions; import org.onap.vfccatalog.api.VnfpackageApi; import org.onap.vfccatalog.model.VnfPkgDetailInfo; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Component; import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.buildFatalFailure; @@ -45,7 +43,6 @@ import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE; * Retrieves a package from VF-C */ @Component -@Conditional(value = Conditions.UseForVfc.class) public class VfcPackageProvider implements IPackageProvider { private static Logger logger = getLogger(VfcPackageProvider.class); private final VfcRestApiProvider restApiProvider; diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java index c2473aae..5c9dc543 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java @@ -17,19 +17,16 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc; import com.google.common.annotations.VisibleForTesting; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.MsbApiProvider; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.spring.Conditions; import org.onap.vfccatalog.api.VnfpackageApi; import org.onap.vnfmdriver.ApiClient; import org.onap.vnfmdriver.api.NslcmApi; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Component; /** * Responsible for providing access to VF-C REST APIs */ @Component -@Conditional(value = Conditions.UseForVfc.class) public class VfcRestApiProvider { static final String NSLCM_API_SERVICE_NAME = "nslcm"; static final String NSLCM_API_VERION = "v1"; |