aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plans/so/integration-etsi-testing/config/override-files/ve-vnfm-adapter/onapheat/override.yaml61
-rw-r--r--plans/so/integration-etsi-testing/docker-compose.local.yml3
-rw-r--r--plans/so/integration-etsi-testing/docker-compose.yml24
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/controller/SvnfmController.java36
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java100
5 files changed, 149 insertions, 75 deletions
diff --git a/plans/so/integration-etsi-testing/config/override-files/ve-vnfm-adapter/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/ve-vnfm-adapter/onapheat/override.yaml
new file mode 100644
index 00000000..ad6e4018
--- /dev/null
+++ b/plans/so/integration-etsi-testing/config/override-files/ve-vnfm-adapter/onapheat/override.yaml
@@ -0,0 +1,61 @@
+# Copyright © 2020 Samsung# Copyright © 2020 Samsung
+#
+# 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.
+
+server:
+ port: 9098
+
+vevnfmadapter:
+ vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
+ endpoint: http://ve-vnfm-adapter:9098
+
+client:
+ key-store: classpath:so-vnfm-adapter.p12
+ key-store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
+ trust-store: classpath:org.onap.so.trust.jks
+ trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
+
+mso:
+ key: 07a7159d3bf51a0e53be7a8f89699be7
+
+aai:
+ endpoint: https://aai-simulator:9993
+ auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885
+ version: v15
+
+vnfm:
+ default-endpoint: https://so-vnfm-simulator:9093/vnflcm/v1
+ subscription: /subscriptions
+ notification: /lcm/v1/vnf/instances/notifications
+
+notification:
+ vnf-filter-type: NONE
+
+dmaap:
+ endpoint: http://message-router:3904
+ topic: /events/unauthenticated.DCAE_CL_OUTPUT
+ closed-loop:
+ control:
+ name: ClosedLoopControlName
+ version: 1.0.2
+
+spring:
+ security:
+ usercredentials:
+ - username: admin
+ openpass: a4b3c2d1
+ password: '$2a$10$vU.mWyNTsikAxXIA5c269ewCpAbYTiyMS0m1N.kn4F2CSGEnrKN7K'
+ role: USER
+ http:
+ converters:
+ preferred-json-mapper: gson
diff --git a/plans/so/integration-etsi-testing/docker-compose.local.yml b/plans/so/integration-etsi-testing/docker-compose.local.yml
index 8fda4bfd..e11b8006 100644
--- a/plans/so/integration-etsi-testing/docker-compose.local.yml
+++ b/plans/so/integration-etsi-testing/docker-compose.local.yml
@@ -28,3 +28,6 @@ services:
so-vnfm-adapter:
image: onap/so/vnfm-adapter:${TAG}
################################################################################
+ ve-vnfm-adapter:
+ image: onap/so/ve-vnfm-adapter:${TAG}
+################################################################################
diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml
index ae8d7746..b40a8579 100644
--- a/plans/so/integration-etsi-testing/docker-compose.yml
+++ b/plans/so/integration-etsi-testing/docker-compose.yml
@@ -344,3 +344,27 @@ services:
command:
- "/config/populate-aai-simulator.sh"
################################################################################
+ ve-vnfm-adapter:
+ image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/ve-vnfm-adapter:${TAG}
+ ports:
+ - "9098:9098"
+ volumes:
+ - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates
+ - ${CONFIG_DIR_PATH}/override-files/ve-vnfm-adapter/onapheat:/app/config
+ environment:
+ - APP=ve-vnfm-adapter
+ - JVM_ARGS=-Xms64m -Xmx512m
+ - DB_HOST=mariadb
+ hostname:
+ ve-vnfm-adapter
+ depends_on:
+ - request-db-adapter
+ - aai-simulator
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
+ user: root
+ entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"'
+################################################################################
diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/controller/SvnfmController.java b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/controller/SvnfmController.java
index ce3ee8f7..e45665c9 100644
--- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/controller/SvnfmController.java
+++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/controller/SvnfmController.java
@@ -20,13 +20,7 @@
package org.onap.so.svnfm.simulator.controller;
-import java.util.UUID;
-import javax.ws.rs.core.MediaType;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
import org.onap.so.svnfm.simulator.constants.Constant;
import org.onap.so.svnfm.simulator.repository.VnfmCacheRepository;
import org.onap.so.svnfm.simulator.services.SvnfmService;
@@ -36,17 +30,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import javax.ws.rs.core.MediaType;
+import java.util.UUID;
/**
- *
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
* @author Ronan Kenny (ronan.kenny@est.tech)
*/
@@ -54,14 +42,12 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(path = Constant.BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public class SvnfmController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class);
@Autowired
private SvnfmService svnfmService;
-
@Autowired
private VnfmCacheRepository vnfmCacheRepository;
- private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class);
-
/**
* To create the Vnf and stores the response in cache
*
@@ -163,9 +149,19 @@ public class SvnfmController {
LOGGER.info("Subscription request received: {}", lccnSubscriptionRequest);
svnfmService.registerSubscription(lccnSubscriptionRequest);
final InlineResponse2001 response = new InlineResponse2001();
-
+ response.setId(UUID.randomUUID().toString());
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
return new ResponseEntity<>(response, headers, HttpStatus.CREATED);
}
+
+ @GetMapping(value = "/subscriptions/{id}")
+ public ResponseEntity<InlineResponse2001> getSubscribeId(@PathVariable("id") final String id) {
+ LOGGER.info("Subscription/id request received with id: {}", id);
+ final InlineResponse2001 response = new InlineResponse2001();
+ response.setId(id);
+ final HttpHeaders headers = new HttpHeaders();
+ headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ return new ResponseEntity<>(response, headers, HttpStatus.OK);
+ }
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java
index ba549009..5c27665e 100644
--- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java
+++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java
@@ -2,32 +2,11 @@ package org.onap.so.svnfm.simulator.services;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.modelmapper.ModelMapper;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiResponse;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.*;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiClient;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api.DefaultApi;
@@ -40,41 +19,53 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperatio
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.NotificationTypeEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
import org.onap.so.svnfm.simulator.api.VeVnfmApi;
-import org.onap.so.svnfm.simulator.model.Vnfds;
-import org.onap.so.svnfm.simulator.repository.VnfOperationRepository;
import org.onap.so.svnfm.simulator.config.ApplicationConfig;
import org.onap.so.svnfm.simulator.model.VnfOperation;
+import org.onap.so.svnfm.simulator.model.Vnfds;
+import org.onap.so.svnfm.simulator.repository.VnfOperationRepository;
import org.onap.so.svnfm.simulator.util.PatternContainedChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.ws.rs.core.MediaType;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.*;
+
public abstract class OperationProgressor implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class);
private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem";
-
- private Resource keyStoreResource = new ClassPathResource("so-vnfm-simulator.p12");
- private String keyStorePassword = "7Em3&j4.19xYiMelhD5?xbQ.";
-
protected final VnfOperation operation;
protected final SvnfmService svnfmService;
+ protected final Vnfds vnfds;
private final VnfOperationRepository vnfOperationRepository;
private final ApplicationConfig applicationConfig;
- protected final Vnfds vnfds;
private final SubscriptionService subscriptionService;
private final DefaultApi notificationClient;
private final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi grantClient;
+ private final Resource keyStoreResource = new ClassPathResource("so-vnfm-simulator.p12");
+ private final String keyStorePassword = "7Em3&j4.19xYiMelhD5?xbQ.";
public OperationProgressor(final VnfOperation operation, final SvnfmService svnfmService,
- final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig,
- final Vnfds vnfds, final SubscriptionService subscriptionService) {
+ final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig,
+ final Vnfds vnfds, final SubscriptionService subscriptionService) {
this.operation = operation;
this.svnfmService = svnfmService;
this.vnfOperationRepository = vnfOperationRepository;
@@ -83,7 +74,7 @@ public abstract class OperationProgressor implements Runnable {
this.subscriptionService = subscriptionService;
final ApiClient apiClient = new ApiClient();
- String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri();
+ String callBackUrl = getLastLccnSubscriptionRequest().getCallbackUri();
final PatternContainedChecker checker = new PatternContainedChecker("/lcn/", callBackUrl);
callBackUrl = checker.getText();
apiClient.setBasePath(callBackUrl);
@@ -137,7 +128,6 @@ public abstract class OperationProgressor implements Runnable {
buildNotification(NotificationStatusEnum.START, OperationStateEnum.PROCESSING);
sendNotification(notificationOfProcessing);
-
final GrantRequest grantRequest = buildGrantRequest();
final InlineResponse201 grantResponse = sendGrantRequest(grantRequest);
final List<InlineResponse201InstantiatedVnfInfoVnfcResourceInfo> vnfcs = handleGrantResponse(grantResponse);
@@ -154,7 +144,6 @@ public abstract class OperationProgressor implements Runnable {
} catch (final Exception exception) {
LOGGER.error("Error in OperationProgressor ", exception);
}
-
}
private void sleep(final long milliSeconds) {
@@ -174,7 +163,7 @@ public abstract class OperationProgressor implements Runnable {
}
private VnfLcmOperationOccurrenceNotification buildNotification(final NotificationStatusEnum status,
- final OperationStateEnum operationState) {
+ final OperationStateEnum operationState) {
final VnfLcmOperationOccurrenceNotification notification = new VnfLcmOperationOccurrenceNotification();
notification.setId(UUID.randomUUID().toString());
notification.setNotificationType(NotificationTypeEnum.VNFLCMOPERATIONOCCURRENCENOTIFICATION);
@@ -190,7 +179,6 @@ public abstract class OperationProgressor implements Runnable {
vnfInstanceLink.setHref(getVnfLink());
links.setVnfInstance(vnfInstanceLink);
-
final LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance operationLink =
new LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance();
operationLink.setHref(getOperationLink());
@@ -222,23 +210,18 @@ public abstract class OperationProgressor implements Runnable {
LOGGER.info("Sending notification: {}", notification);
try {
final SubscriptionsAuthenticationParamsBasic subscriptionAuthentication =
- subscriptionService.getSubscriptions().iterator().next().getAuthentication().getParamsBasic();
- final String auth =
- subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
+ getLastLccnSubscriptionRequest().getAuthentication().getParamsBasic();
+ final String auth = subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
String authHeader = "Basic " + new String(encodedAuth);
-
- notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification,
- MediaType.APPLICATION_JSON, authHeader);
+ notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification, MediaType.APPLICATION_JSON, authHeader);
} catch (final ApiException exception) {
LOGGER.error("Error sending notification: " + notification, exception);
LOGGER.error("Response code: {}, body: {}, basePath: {}", exception.getCode(), exception.getResponseBody(),
notificationClient.getApiClient().getBasePath());
-
}
}
-
public GrantRequest buildGrantRequest() {
final GrantRequest grantRequest = new GrantRequest();
grantRequest.setVnfInstanceId(operation.getVnfInstanceId());
@@ -275,15 +258,11 @@ public abstract class OperationProgressor implements Runnable {
private InlineResponse201 sendGrantRequest(final GrantRequest grantRequest) {
LOGGER.info("Sending grant request: {}", grantRequest);
try {
-
final SubscriptionsAuthenticationParamsOauth2ClientCredentials subscriptionAuthentication =
- subscriptionService.getSubscriptions().iterator().next().getAuthentication()
- .getParamsOauth2ClientCredentials();
-
+ getLastLccnSubscriptionRequest().getAuthentication().getParamsOauth2ClientCredentials();
final String authHeader = applicationConfig.getGrantAuth().equals("oauth")
? "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication)
: null;
-
final ApiResponse<InlineResponse201> response = grantClient.grantsPostWithHttpInfo(grantRequest,
MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, authHeader);
LOGGER.info("Grant Response: {}", response);
@@ -307,7 +286,7 @@ public abstract class OperationProgressor implements Runnable {
}
private String getToken(final ApiClient apiClient,
- final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
final String basePath = apiClient.getBasePath().substring(0, apiClient.getBasePath().indexOf("/so/"));
final String tokenUrl = basePath + "/oauth/token?grant_type=client_credentials";
@@ -321,7 +300,6 @@ public abstract class OperationProgressor implements Runnable {
connection.connect();
return getResponse(connection).get("access_token").getAsString();
-
} catch (IOException exception) {
LOGGER.error("Error getting token", exception);
return null;
@@ -348,4 +326,16 @@ public abstract class OperationProgressor implements Runnable {
return jsonObject;
}
+ private LccnSubscriptionRequest getLastLccnSubscriptionRequest() {
+ final Collection<LccnSubscriptionRequest> subscriptions = subscriptionService.getSubscriptions();
+ final Iterator<LccnSubscriptionRequest> iterator = subscriptions.iterator();
+
+ LccnSubscriptionRequest last = null;
+
+ while (iterator.hasNext()) {
+ last = iterator.next();
+ }
+
+ return last;
+ }
}