summaryrefslogtreecommitdiffstats
path: root/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm
diff options
context:
space:
mode:
Diffstat (limited to 'nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm')
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java4
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForSo.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForVfc.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProvider.java23
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForSo.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForVfc.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProvider.java36
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForSo.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForVfc.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java28
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/DriverProperties.java107
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManager.java4
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForSo.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForVfc.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java4
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForSo.java37
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForVfc.java37
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java21
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForSo.java31
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForVfc.java31
20 files changed, 442 insertions, 169 deletions
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
index 6283cfbc..7908d2e4 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
@@ -30,8 +30,6 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IPackageProvider;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
import static com.google.common.base.Splitter.on;
import static com.google.common.collect.Iterables.filter;
@@ -47,7 +45,6 @@ import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM;
* - the VNF package is uploaded as part of the instantiation
* - the VNF package is not deleted after VNF deletion
*/
-@Component
public class CatalogManager {
/**
* The location of the CBAM package within the ONAP package
@@ -59,7 +56,6 @@ public class CatalogManager {
private final CbamRestApiProvider cbamRestApiProvider;
private final IPackageProvider packageProvider;
- @Autowired
CatalogManager(CbamRestApiProvider cbamRestApiProvider, IPackageProvider packageProvider) {
this.cbamRestApiProvider = cbamRestApiProvider;
this.packageProvider = packageProvider;
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForSo.java
new file mode 100644
index 00000000..93d6d03a
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForSo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.SdcPackageProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class CatalogManagerForSo extends CatalogManager {
+
+ @Autowired
+ CatalogManagerForSo(CbamRestApiProviderForSo cbamRestApiProvider, SdcPackageProvider packageProvider) {
+ super(cbamRestApiProvider, packageProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForVfc.java
new file mode 100644
index 00000000..e28dfb4f
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManagerForVfc.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc.VfcPackageProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class CatalogManagerForVfc extends CatalogManager {
+
+ @Autowired
+ CatalogManagerForVfc(CbamRestApiProviderForVfc cbamRestApiProvider, VfcPackageProvider packageProvider) {
+ super(cbamRestApiProvider, packageProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProvider.java
index de850da6..cda091c0 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProvider.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProvider.java
@@ -23,32 +23,21 @@ import com.nokia.cbam.lcm.v32.api.VnfsApi;
import com.nokia.cbam.lcn.v32.api.SubscriptionsApi;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.VnfmInfoProvider;
import org.onap.vnfmdriver.model.VnfmInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
+
+import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.GenericExternalSystemInfoProvider.convert;
/**
* Responsible for providing client to access CBAM REST API
*/
-@Component
public class CbamRestApiProvider {
public static final String NOKIA_LCN_API_VERSION = "3.2";
public static final String NOKIA_LCM_API_VERSION = "3.2";
public static final String AUTH_NAME = "test";
- private final DriverProperties driverProperties;
private final CbamTokenProvider tokenProvider;
private final VnfmInfoProvider vnfmInfoProvider;
private final CbamSecurityProvider cbamSecurityProvider;
- @Value("${cbamKeyCloakBaseUrl}")
- private String cbamKeyCloakBaseUrl;
- @Value("${cbamUsername}")
- private String username;
- @Value("${cbamPassword}")
- private String password;
- @Autowired
- public CbamRestApiProvider(DriverProperties driverProperties, CbamTokenProvider cbamTokenProvider, VnfmInfoProvider vnfmInfoProvider, CbamSecurityProvider cbamSecurityProvider) {
- this.driverProperties = driverProperties;
+ CbamRestApiProvider(CbamTokenProvider cbamTokenProvider, VnfmInfoProvider vnfmInfoProvider, CbamSecurityProvider cbamSecurityProvider) {
this.tokenProvider = cbamTokenProvider;
this.vnfmInfoProvider = vnfmInfoProvider;
this.cbamSecurityProvider = cbamSecurityProvider;
@@ -92,7 +81,7 @@ public class CbamRestApiProvider {
apiClient.getOkBuilder().sslSocketFactory(cbamSecurityProvider.buildSSLSocketFactory(), cbamSecurityProvider.buildTrustManager());
apiClient.getOkBuilder().hostnameVerifier(cbamSecurityProvider.buildHostnameVerifier());
apiClient.addAuthorization(AUTH_NAME, tokenProvider.getToken(vnfmId));
- apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(driverProperties.getCbamLcnUrl()));
+ apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(convert(vnfmInfoProvider.getVnfmInfo(vnfmId)).getLcnUrl()));
return apiClient;
}
@@ -102,7 +91,7 @@ public class CbamRestApiProvider {
apiClient.getOkBuilder().sslSocketFactory(cbamSecurityProvider.buildSSLSocketFactory(), cbamSecurityProvider.buildTrustManager());
apiClient.getOkBuilder().hostnameVerifier(cbamSecurityProvider.buildHostnameVerifier());
apiClient.addAuthorization(AUTH_NAME, tokenProvider.getToken(vnfmId));
- apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(driverProperties.getCbamCatalogUrl()));
+ apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(convert(vnfmInfoProvider.getVnfmInfo(vnfmId)).getCatalogUrl()));
return apiClient;
}
@@ -113,7 +102,7 @@ public class CbamRestApiProvider {
apiClient.getOkBuilder().sslSocketFactory(cbamSecurityProvider.buildSSLSocketFactory(), cbamSecurityProvider.buildTrustManager());
apiClient.getOkBuilder().hostnameVerifier(cbamSecurityProvider.buildHostnameVerifier());
apiClient.addAuthorization(AUTH_NAME, tokenProvider.getToken(vnfmId));
- apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(vnfmInfo.getUrl()));
+ apiClient.setAdapterBuilder(apiClient.getAdapterBuilder().baseUrl(convert(vnfmInfoProvider.getVnfmInfo(vnfmId)).getLcmUrl()));
return apiClient;
}
}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForSo.java
new file mode 100644
index 00000000..5d5b1907
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForSo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.AAIExternalSystemInfoProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Responsible for providing client to access CBAM REST API
+ */
+@Component
+public class CbamRestApiProviderForSo extends CbamRestApiProvider {
+ @Autowired
+ public CbamRestApiProviderForSo(CbamTokenProviderForSo cbamTokenProvider, AAIExternalSystemInfoProvider vnfmInfoProvider, CbamSecurityProvider cbamSecurityProvider) {
+ super(cbamTokenProvider, vnfmInfoProvider, cbamSecurityProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForVfc.java
new file mode 100644
index 00000000..f283d098
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamRestApiProviderForVfc.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc.VfcExternalSystemInfoProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Responsible for providing client to access CBAM REST API
+ */
+@Component
+public class CbamRestApiProviderForVfc extends CbamRestApiProvider {
+ @Autowired
+ public CbamRestApiProviderForVfc(CbamTokenProviderForVfc cbamTokenProvider, VfcExternalSystemInfoProvider vnfmInfoProvider, CbamSecurityProvider cbamSecurityProvider) {
+ super(cbamTokenProvider, vnfmInfoProvider, cbamSecurityProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProvider.java
index df21e52d..c4a6645a 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProvider.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProvider.java
@@ -23,12 +23,11 @@ import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import okhttp3.*;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.VnfmInfoProvider;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.GenericExternalSystemInfoProvider;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.VnfmCredentials;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.VnfmUrls;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions;
-import org.onap.vnfmdriver.model.VnfmInfo;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.buildFatalFailure;
import static org.slf4j.LoggerFactory.getLogger;
@@ -38,7 +37,6 @@ import static org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VAL
/**
* Responsible for providing a token to access CBAM APIs
*/
-@Component
//even if the value for grant type an user password is the same they do not mean the same thing
//the duplication of this is intentional
@SuppressWarnings("squid:S1192")
@@ -49,15 +47,8 @@ public class CbamTokenProvider extends CbamSecurityProvider {
private static final String CBAM_TOKEN_URL = "realms/cbam/protocol/openid-connect/token";
private static Logger logger = getLogger(CbamTokenProvider.class);
private final VnfmInfoProvider vnfmInfoProvider;
- @Value("${cbamKeyCloakBaseUrl}")
- private String cbamKeyCloakBaseUrl;
- @Value("${cbamUsername}")
- private String username;
- @Value("${cbamPassword}")
- private String password;
private volatile CurrentToken token;
- @Autowired
CbamTokenProvider(VnfmInfoProvider vnfmInfoProvider) {
this.vnfmInfoProvider = vnfmInfoProvider;
}
@@ -66,11 +57,10 @@ public class CbamTokenProvider extends CbamSecurityProvider {
* @return the token to access CBAM APIs (ex. 123456)
*/
public Interceptor getToken(String vnfmId) {
- VnfmInfo vnfmInfo = vnfmInfoProvider.getVnfmInfo(vnfmId);
- return new OauthInterceptor(getToken(vnfmInfo.getUserName(), vnfmInfo.getPassword()));
+ return new OauthInterceptor(getTokenInternal(vnfmId));
}
- private String getToken(String clientId, String clientSecret) {
+ private String getTokenInternal(String vnfmId) {
logger.trace("Requesting token for accessing CBAM API");
synchronized (this) {
long now = SystemFunctions.systemFunctions().currentTimeMillis();
@@ -80,7 +70,7 @@ public class CbamTokenProvider extends CbamSecurityProvider {
} else {
logger.debug("Token expired {} ms ago", (now - token.refreshAfter));
}
- refresh(clientId, clientSecret);
+ refresh(vnfmId);
} else {
logger.debug("Token will expire in {} ms", (now - token.refreshAfter));
}
@@ -88,13 +78,17 @@ public class CbamTokenProvider extends CbamSecurityProvider {
return token.token.accessToken;
}
- private void refresh(String clientId, String clientSecret) {
+ private void refresh(String vnfmId) {
+ VnfmUrls vnfmUrls = GenericExternalSystemInfoProvider.convert(vnfmInfoProvider.getVnfmInfo(vnfmId));
+ VnfmCredentials vnfmCredentials = GenericExternalSystemInfoProvider.convertToCredentials(vnfmInfoProvider.getVnfmInfo(vnfmId));
+
FormBody body = new FormBody.Builder()
.add("grant_type", GRANT_TYPE)
- .add("client_id", clientId)
- .add("client_secret", clientSecret)
- .add("username", username)
- .add(CLIENT_SECRET, password).build();
+ .add("client_id", vnfmCredentials.getClientId())
+ .add("client_secret", vnfmCredentials.getClientSecret())
+ .add("username", vnfmCredentials.getUsername())
+ .add(CLIENT_SECRET, vnfmCredentials.getPassword()).build();
+ String cbamKeyCloakBaseUrl = vnfmUrls.getAuthUrl();
Request request = new Request.Builder().url(cbamKeyCloakBaseUrl + CBAM_TOKEN_URL).addHeader(CONTENT_TYPE, APPLICATION_FORM_URLENCODED_VALUE).post(body).build();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
SSLSocketFactory sslSocketFac = buildSSLSocketFactory();
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForSo.java
new file mode 100644
index 00000000..30eae6ba
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForSo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.AAIExternalSystemInfoProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+@Component
+@Qualifier("so")
+public class CbamTokenProviderForSo extends CbamTokenProvider {
+
+ @Autowired
+ CbamTokenProviderForSo(AAIExternalSystemInfoProvider vnfmInfoProvider) {
+ super(vnfmInfoProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForVfc.java
new file mode 100644
index 00000000..3e442dcd
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CbamTokenProviderForVfc.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc.VfcExternalSystemInfoProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+@Component
+@Qualifier("vfc")
+public class CbamTokenProviderForVfc extends CbamTokenProvider {
+
+ @Autowired
+ CbamTokenProviderForVfc(VfcExternalSystemInfoProvider vnfmInfoProvider) {
+ super(vnfmInfoProvider);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java
new file mode 100644
index 00000000..3d4ec93a
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/Constants.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager;
+
+/**
+ * Common constants
+ */
+public class Constants {
+ public static final String BASE_SUFFIX = "/" + SelfRegistrationManager.SERVICE_NAME + "/v1";
+ public static final String BASE_URL = "/api" + BASE_SUFFIX;
+ public static final String LCN_URL = "/lcn";
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/DriverProperties.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/DriverProperties.java
deleted file mode 100644
index b15d2850..00000000
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/DriverProperties.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2016-2017, Nokia Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
-
-import java.util.Objects;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-/**
- * Wraps the properties supplied to the servlet
- */
-@Component
-public class DriverProperties {
- public static final String BASE_SUFFIX = "/" + SelfRegistrationManager.SERVICE_NAME + "/v1";
- public static final String BASE_URL = "/api" + BASE_SUFFIX;
- public static final String LCN_URL = "/lcn";
-
- @Value("${cbamCatalogUrl}")
- private String cbamCatalogUrl;
- @Value("${cbamLcnUrl}")
- private String cbamLcnUrl;
- @Value("${vnfmId}")
- private String vnfmId;
-
- /**
- * @return the URL on which the CBAM catalog API can be accessed (ex. https://1.2.3.4:443/api/catalog/adapter )
- */
- public String getCbamCatalogUrl() {
- return cbamCatalogUrl;
- }
-
- /**
- * @param cbamCatalogUrl the URL on which the CBAM catalog API can be accessed (ex. https://1.2.3.4:443/api/catalog/adapter )
- */
- public void setCbamCatalogUrl(String cbamCatalogUrl) {
- this.cbamCatalogUrl = cbamCatalogUrl;
- }
-
- /**
- * @return the URL on which the CBAM LCN subscription API can be accessed (ex. https://1.2.3.4:443/vnfm/lcn/v3 )
- */
- public String getCbamLcnUrl() {
- return cbamLcnUrl;
- }
-
- /**
- * @param cbamLcnUrl the URL on which the CBAM LCN subscription API can be accessed (ex. https://1.2.3.4:443/vnfm/lcn/v3 )
- */
- public void setCbamLcnUrl(String cbamLcnUrl) {
- this.cbamLcnUrl = cbamLcnUrl;
- }
-
- /**
- * @return the identifier of the VNFM
- */
- public String getVnfmId() {
- return vnfmId;
- }
-
- /**
- * @param vnfmId the identifier of the VNFM
- */
- public void setVnfmId(String vnfmId) {
- this.vnfmId = vnfmId;
- }
-
- @Override
- public String toString() {
- return "DriverProperties{" +
- ", cbamCatalogUrl='" + cbamCatalogUrl + '\'' +
- ", cbamLcnUrl='" + cbamLcnUrl + '\'' +
- ", vnfmId='" + vnfmId + '\'' +
- '}';
- }
-
- @Override
- //generated code. This is the recommended way to formulate equals
- @SuppressWarnings({"squid:S00122", "squid:S1067"})
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- DriverProperties that = (DriverProperties) o;
- return Objects.equals(cbamCatalogUrl, that.cbamCatalogUrl) &&
- Objects.equals(cbamLcnUrl, that.cbamLcnUrl) &&
- Objects.equals(vnfmId, that.vnfmId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(cbamCatalogUrl, cbamLcnUrl, vnfmId);
- }
-}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManager.java
index 5624327b..34dce147 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManager.java
@@ -32,8 +32,6 @@ import org.onap.vnfmdriver.model.JobDetailInfoResponseDescriptor;
import org.onap.vnfmdriver.model.JobResponseInfo;
import org.onap.vnfmdriver.model.JobStatus;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
import static java.util.Optional.empty;
@@ -59,7 +57,6 @@ import static org.springframework.util.StringUtils.isEmpty;
* The second UUID is passed as mandatory parameter to each executed operation.
* This UUID is used to locate the operation execution from the ONAP job identifier
*/
-@Component
public class JobManager {
public static final String OPERATION_STARTED_DESCRIPTION = "Operation started";
private static final Ordering<JobResponseInfo> OLDEST_FIRST = new Ordering<JobResponseInfo>() {
@@ -74,7 +71,6 @@ public class JobManager {
private final SelfRegistrationManager selfRegistrationManager;
private volatile boolean preparingForShutDown = false;
- @Autowired
JobManager(CbamRestApiProvider cbamRestApiProvider, SelfRegistrationManager selfRegistrationManager) {
this.cbamRestApiProvider = cbamRestApiProvider;
this.selfRegistrationManager = selfRegistrationManager;
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForSo.java
new file mode 100644
index 00000000..0fca4309
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForSo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManagerForSo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class JobManagerForSo extends JobManager {
+
+ @Autowired
+ JobManagerForSo(CbamRestApiProviderForSo cbamRestApiProvider, SelfRegistrationManagerForSo selfRegistrationManager) {
+ super(cbamRestApiProvider, selfRegistrationManager);
+ }
+
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForVfc.java
new file mode 100644
index 00000000..66e8a904
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/JobManagerForVfc.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManagerForVfc;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class JobManagerForVfc extends JobManager {
+
+ @Autowired
+ JobManagerForVfc(CbamRestApiProviderForVfc cbamRestApiProvider, SelfRegistrationManagerForVfc selfRegistrationManager) {
+ super(cbamRestApiProvider, selfRegistrationManager);
+ }
+
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
index ce9da78c..5115aefd 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
@@ -35,8 +35,6 @@ import org.onap.vnfmdriver.model.*;
import org.onap.vnfmdriver.model.VimInfo;
import org.onap.vnfmdriver.model.VnfInfo;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.Yaml;
import static java.lang.Integer.parseInt;
@@ -60,7 +58,6 @@ import static org.springframework.util.StringUtils.isEmpty;
/**
* Responsible for executing lifecycle operation on the VNF
*/
-@Component
public class LifecycleManager {
public static final String ONAP_CSAR_ID = "onapCsarId";
public static final long OPERATION_STATUS_POLLING_INTERVAL_IN_MS = 5000L;
@@ -82,7 +79,6 @@ public class LifecycleManager {
*/
private ExecutorService executorService = Executors.newCachedThreadPool();
- @Autowired
LifecycleManager(CatalogManager catalogManager, IGrantManager grantManager, CbamRestApiProvider restApiProvider, VimInfoProvider vimInfoProvider, JobManager jobManager, ILifecycleChangeNotificationManager notificationManager) {
this.vimInfoProvider = vimInfoProvider;
this.grantManager = grantManager;
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForSo.java
new file mode 100644
index 00000000..b2f2bba2
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForSo.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.AAIExternalSystemInfoProvider;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.GrantlessGrantManager;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.LifecycleChangeNotificationManagerForSo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Responsible for executing lifecycle operation on the VNF
+ */
+@Component
+public class LifecycleManagerForSo extends LifecycleManager {
+
+ @Autowired
+ LifecycleManagerForSo(CatalogManagerForSo catalogManager, GrantlessGrantManager grantManager, CbamRestApiProviderForSo restApiProvider, AAIExternalSystemInfoProvider vimInfoProvider, JobManagerForSo jobManager, LifecycleChangeNotificationManagerForSo notificationManager) {
+ super(catalogManager, grantManager, restApiProvider, vimInfoProvider, jobManager, notificationManager);
+ }
+
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForVfc.java
new file mode 100644
index 00000000..014b7145
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManagerForVfc.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.GrantlessGrantManager;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc.VfcExternalSystemInfoProvider;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.LifecycleChangeNotificationManagerForVfc;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Responsible for executing lifecycle operation on the VNF
+ */
+@Component
+public class LifecycleManagerForVfc extends LifecycleManager {
+
+ @Autowired
+ LifecycleManagerForVfc(CatalogManagerForVfc catalogManager, GrantlessGrantManager grantManager, CbamRestApiProviderForVfc restApiProvider, VfcExternalSystemInfoProvider vimInfoProvider, JobManagerForVfc jobManager, LifecycleChangeNotificationManagerForVfc notificationManager) {
+ super(catalogManager, grantManager, restApiProvider, vimInfoProvider, jobManager, notificationManager);
+ }
+
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java
index 3ff04990..9b497343 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManager.java
@@ -27,14 +27,12 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.INotificationSender;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManager;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProvider;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.ILifecycleChangeNotificationManager;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.LifecycleManager;
import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
import static java.util.Optional.empty;
import static java.util.Optional.of;
@@ -64,7 +62,6 @@ import static org.slf4j.LoggerFactory.getLogger;
* on all LCN deliveries. The consequence of this is that the information known by VF-C / A&AI may be inconsistent with
* reality (VNF having been deleted)
*/
-@Component
public class LifecycleChangeNotificationManager implements ILifecycleChangeNotificationManager {
public static final String PROBLEM = "All operations must return the { \"operationResult\" : { \"cbam_pre\" : [<fillMeOut>], \"cbam_post\" : [<fillMeOut>] } } structure";
@@ -84,15 +81,14 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif
private static Logger logger = getLogger(LifecycleChangeNotificationManager.class);
private final CbamRestApiProvider restApiProvider;
- private final DriverProperties driverProperties;
private final INotificationSender notificationSender;
+ private final SelfRegistrationManager selfRegistrationManager;
private Set<ProcessedNotification> processedNotifications = newConcurrentHashSet();
- @Autowired
- LifecycleChangeNotificationManager(CbamRestApiProvider restApiProvider, DriverProperties driverProperties, INotificationSender notificationSender) {
+ LifecycleChangeNotificationManager(CbamRestApiProvider restApiProvider, SelfRegistrationManager selfRegistrationManager, INotificationSender notificationSender) {
this.notificationSender = notificationSender;
- this.driverProperties = driverProperties;
this.restApiProvider = restApiProvider;
+ this.selfRegistrationManager = selfRegistrationManager;
}
/**
@@ -115,7 +111,8 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif
if (logger.isInfoEnabled()) {
logger.info("Received LCN: {}", new Gson().toJson(receivedNotification));
}
- VnfsApi cbamLcmApi = restApiProvider.getCbamLcmApi(driverProperties.getVnfmId());
+ String vnfmId = selfRegistrationManager.getVnfmId(receivedNotification.getSubscriptionId());
+ VnfsApi cbamLcmApi = restApiProvider.getCbamLcmApi(vnfmId);
try {
List<VnfInfo> vnfs = cbamLcmApi.vnfsGet(NOKIA_LCM_API_VERSION).blockingFirst();
com.google.common.base.Optional<VnfInfo> currentVnf = tryFind(vnfs, vnf -> vnf.getId().equals(receivedNotification.getVnfInstanceId()));
@@ -131,7 +128,7 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif
logger.warn(vnfHeader + " is not a managed VNF");
return;
}
- if (!externalVnfmId.get().getValue().equals(driverProperties.getVnfmId())) {
+ if (!externalVnfmId.get().getValue().equals(vnfmId)) {
logger.warn(vnfHeader + " is not a managed by the VNFM with id " + externalVnfmId.get().getValue());
return;
}
@@ -139,7 +136,7 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif
} catch (Exception e) {
throw buildFatalFailure(logger, "Unable to list VNFs / query VNF", e);
}
- OperationExecutionsApi cbamOperationExecutionApi = restApiProvider.getCbamOperationExecutionApi(driverProperties.getVnfmId());
+ OperationExecutionsApi cbamOperationExecutionApi = restApiProvider.getCbamOperationExecutionApi(vnfmId);
List<OperationExecution> operationExecutions;
try {
operationExecutions = cbamLcmApi.vnfsVnfInstanceIdOperationExecutionsGet(receivedNotification.getVnfInstanceId(), NOKIA_LCM_API_VERSION).blockingFirst();
@@ -154,7 +151,7 @@ public class LifecycleChangeNotificationManager implements ILifecycleChangeNotif
}
OperationExecution closestInstantiationToOperation = findLastInstantiationBefore(operationExecutions, operationExecution);
String vimId = getVimId(cbamOperationExecutionApi, closestInstantiationToOperation);
- notificationSender.processNotification(receivedNotification, operationExecution, buildAffectedCps(operationExecution), vimId);
+ notificationSender.processNotification(receivedNotification, operationExecution, buildAffectedCps(operationExecution), vimId, vnfmId);
if (isTerminationFinished(receivedNotification)) {
//signal LifecycleManager to continue the deletion of the VNF
processedNotifications.add(new ProcessedNotification(receivedNotification.getLifecycleOperationOccurrenceId(), receivedNotification.getStatus()));
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForSo.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForSo.java
new file mode 100644
index 00000000..c354f3f9
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForSo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManagerForSo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.notification.AAINotificationProcessor;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProviderForSo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class LifecycleChangeNotificationManagerForSo extends LifecycleChangeNotificationManager {
+
+ @Autowired
+ LifecycleChangeNotificationManagerForSo(CbamRestApiProviderForSo restApiProvider, SelfRegistrationManagerForSo selfRegistrationManager, AAINotificationProcessor notificationSender) {
+ super(restApiProvider, selfRegistrationManager, notificationSender);
+ }
+}
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForVfc.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForVfc.java
new file mode 100644
index 00000000..8b843629
--- /dev/null
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/LifecycleChangeNotificationManagerForVfc.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification;
+
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.SelfRegistrationManagerForVfc;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc.VfcNotificationSender;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProviderForVfc;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class LifecycleChangeNotificationManagerForVfc extends LifecycleChangeNotificationManager {
+
+ @Autowired
+ LifecycleChangeNotificationManagerForVfc(CbamRestApiProviderForVfc restApiProvider, SelfRegistrationManagerForVfc selfRegistrationManager, VfcNotificationSender notificationSender) {
+ super(restApiProvider, selfRegistrationManager, notificationSender);
+ }
+}