aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plans/sdc/nightly/setup.sh42
-rw-r--r--plans/sdc/sanity/setup.sh3
-rw-r--r--plans/sdc/uiSanity/setup.sh3
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/CloudRegionsController.java76
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProvider.java7
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProviderImpl.java100
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java10
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java5
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java38
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/vServer.json23
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java25
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java3
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java37
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java40
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java4
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteServiceInput.json28
-rw-r--r--scripts/sdc/setup_sdc_for_sanity.sh98
-rw-r--r--tests/sdc/nightly/test1.robot4
-rw-r--r--tests/sdc/sanity/test1.robot4
-rw-r--r--tests/sdc/uiSanity/test1.robot4
20 files changed, 507 insertions, 47 deletions
diff --git a/plans/sdc/nightly/setup.sh b/plans/sdc/nightly/setup.sh
index 7587d096..8c0336c9 100644
--- a/plans/sdc/nightly/setup.sh
+++ b/plans/sdc/nightly/setup.sh
@@ -1,11 +1,43 @@
#!/bin/bash
+#
+# Copyright 2019 © Samsung Electronics Co., Ltd.
+#
+# 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.
+#
-source ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh tad
+# It can enable HTTPS for SDC sanity tests
+export SDC_TEST_HTTPS="${SDC_TEST_HTTPS:-false}"
-BE_IP=`get-instance-ip.sh sdc-BE`
-echo BE_IP=${BE_IP}
+# By default all images are from remote upstream registry, this option
+# provides the chance to test locally built images
+export SDC_LOCAL_IMAGES="${SDC_LOCAL_IMAGES:-false}"
+# For this to take effect SDC_LOCAL_IMAGES must be enabled...
+#
+# The path to the local sdc git repo from which the local images have
+# been built - it also affects the tag used - if left empty *AND*
+# local images are used *AND* SDC_LOCAL_TAG is unset then the tag
+# will be set to: 'latest'
+#
+# BEWARE: Using local images with an incorrect git repo could lead to
+# problems...set SDC_LOCAL_GITREPO or GERRIT_BRANCH properly...
+export SDC_LOCAL_GITREPO="${SDC_LOCAL_GITREPO}"
-# Pass any variables required by Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v BE_IP:${BE_IP}"
+# For this to take effect SDC_LOCAL_IMAGES must be enabled...
+#
+# This will set the tag for local images - leaving this empty *AND*
+# with unset SDC_LOCAL_GITREPO the local images will fallback to the
+# tag: 'latest'
+export SDC_LOCAL_TAG="${SDC_LOCAL_TAG}"
+source ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh tad
diff --git a/plans/sdc/sanity/setup.sh b/plans/sdc/sanity/setup.sh
index 20a8eac3..8c0336c9 100644
--- a/plans/sdc/sanity/setup.sh
+++ b/plans/sdc/sanity/setup.sh
@@ -15,6 +15,9 @@
# limitations under the License.
#
+# It can enable HTTPS for SDC sanity tests
+export SDC_TEST_HTTPS="${SDC_TEST_HTTPS:-false}"
+
# By default all images are from remote upstream registry, this option
# provides the chance to test locally built images
export SDC_LOCAL_IMAGES="${SDC_LOCAL_IMAGES:-false}"
diff --git a/plans/sdc/uiSanity/setup.sh b/plans/sdc/uiSanity/setup.sh
index b02cd7be..bfb9a153 100644
--- a/plans/sdc/uiSanity/setup.sh
+++ b/plans/sdc/uiSanity/setup.sh
@@ -15,6 +15,9 @@
# limitations under the License.
#
+# It can enable HTTPS for SDC uiSanity tests
+export SDC_TEST_HTTPS="${SDC_TEST_HTTPS:-false}"
+
# By default all images are from remote upstream registry, this option
# provides the chance to test locally built images
export SDC_LOCAL_IMAGES="${SDC_LOCAL_IMAGES:-false}"
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/CloudRegionsController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/CloudRegionsController.java
index 29701ed4..8e007de3 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/CloudRegionsController.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/CloudRegionsController.java
@@ -24,6 +24,7 @@ import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGION;
import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGIONS;
import static org.onap.so.aaisimulator.utils.Constants.ESR_SYSTEM_INFO_LIST;
import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL;
+import static org.onap.so.aaisimulator.utils.Constants.VSERVER;
import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getHeaders;
import static org.onap.so.aaisimulator.utils.RequestErrorResponseUtils.getRequestErrorResponseEntity;
import static org.onap.so.aaisimulator.utils.RequestErrorResponseUtils.getResourceVersion;
@@ -130,7 +131,7 @@ public class CloudRegionsController {
}
LOGGER.error("Couldn't add {} relationship for 'key': {} ...", relationship.getRelatedTo(), key);
- return getRequestErrorResponseEntity(request, CLOUD_REGION);
+ return getRequestErrorResponseEntity(request, VSERVER);
}
@@ -265,6 +266,27 @@ public class CloudRegionsController {
vServerId);
if (cacheServiceProvider.putVserver(key, tenantId, vServerId, vServer)) {
+
+ if (vServer.getRelationshipList() != null) {
+ for (final Relationship relationship : vServer.getRelationshipList().getRelationship()) {
+ if (relationship.getRelatedLink() != null) {
+ final String requestUri = request.getRequestURI();
+ final String targetBaseUrl =
+ HttpServiceUtils.getBaseUrl(request.getRequestURL(), requestUri).toString();
+ final HttpHeaders incomingHeader = getHeaders(request);
+ final boolean result = cacheServiceProvider.addVServerRelationShip(incomingHeader,
+ targetBaseUrl, requestUri, key, tenantId, vServerId, relationship);
+ if (!result) {
+ LOGGER.error(
+ "Unable to add Vserver relationship in cache using key: {}, tenantId: {}, vServerId: {}",
+ key, tenantId, vServerId);
+ return getRequestErrorResponseEntity(request, CLOUD_REGION);
+ }
+ LOGGER.info("Successfully added relationship with {}", relationship.getRelatedLink());
+ }
+ }
+ }
+
LOGGER.info("Successfully added Vserver for key: {}, tenantId: {}, vServerId: {} ...", key, tenantId,
vServerId);
return ResponseEntity.accepted().build();
@@ -319,4 +341,56 @@ public class CloudRegionsController {
key, tenantId, vServerId, resourceVersion);
return getRequestErrorResponseEntity(request, CLOUD_REGION);
}
+
+ @PutMapping(
+ value = "{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}"
+ + RELATIONSHIP_LIST_RELATIONSHIP_URL,
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public ResponseEntity<?> putVserverRelationShip(@PathVariable("cloud-owner") final String cloudOwner,
+ @PathVariable("cloud-region-id") final String cloudRegionId,
+ @PathVariable("tenant-id") final String tenantId, @PathVariable("vserver-id") final String vServerId,
+ @RequestBody final Relationship relationship, final HttpServletRequest request) {
+ final CloudRegionKey key = new CloudRegionKey(cloudOwner, cloudRegionId);
+ LOGGER.info("Will add {} relationship to : {} ...", relationship.getRelatedTo());
+
+ if (relationship.getRelatedLink() != null) {
+ final String targetBaseUrl = HttpServiceUtils.getBaseUrl(request).toString();
+ final HttpHeaders incomingHeader = getHeaders(request);
+ final boolean result = cacheServiceProvider.addVServerRelationShip(incomingHeader, targetBaseUrl,
+ request.getRequestURI(), key, tenantId, vServerId, relationship);
+ if (result) {
+ LOGGER.info("added created bi directional relationship with {}", relationship.getRelatedLink());
+ return ResponseEntity.accepted().build();
+ }
+ }
+ LOGGER.error("Couldn't add {} relationship for 'key': {} ...", relationship.getRelatedTo(), key);
+ return getRequestErrorResponseEntity(request, CLOUD_REGION);
+
+ }
+
+ @PutMapping(
+ value = "{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}"
+ + BI_DIRECTIONAL_RELATIONSHIP_LIST_URL,
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public ResponseEntity<?> putBiDirectionalVServerRelationShip(@PathVariable("cloud-owner") final String cloudOwner,
+ @PathVariable("cloud-region-id") final String cloudRegionId,
+ @PathVariable("tenant-id") final String tenantId, @PathVariable("vserver-id") final String vServerId,
+ @RequestBody final Relationship relationship, final HttpServletRequest request) {
+ final CloudRegionKey key = new CloudRegionKey(cloudOwner, cloudRegionId);
+ LOGGER.info("Will add {} relationship to : {} ...", relationship.getRelatedTo());
+
+ final Optional<Relationship> optional = cacheServiceProvider.addvServerRelationShip(key, tenantId, vServerId,
+ relationship, request.getRequestURI());
+
+ if (optional.isPresent()) {
+ final Relationship resultantRelationship = optional.get();
+ LOGGER.info("Relationship add, sending resultant relationship: {} in response ...", resultantRelationship);
+ return ResponseEntity.accepted().body(resultantRelationship);
+ }
+ LOGGER.error("Couldn't add {} relationship for 'key': {} ...", relationship.getRelatedTo(), key);
+ return getRequestErrorResponseEntity(request, CLOUD_REGION);
+
+ }
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProvider.java
index 412da1c6..6facac82 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProvider.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProvider.java
@@ -59,4 +59,11 @@ public interface CloudRegionCacheServiceProvider extends Clearable {
boolean deleteVserver(final CloudRegionKey key, final String tenantId, final String vServerId,
final String resourceVersion);
+
+ Optional<Relationship> addvServerRelationShip(final CloudRegionKey key, final String tenantId,
+ final String vServerId, final Relationship relationship, final String requestUri);
+
+ boolean addVServerRelationShip(final HttpHeaders incomingHeader, final String targetBaseUrl, final String requestURI, final CloudRegionKey key,
+ final String tenantId, final String vServerId, final Relationship relationship);
+
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProviderImpl.java
index 6fb1eb0f..f1f782a0 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProviderImpl.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CloudRegionCacheServiceProviderImpl.java
@@ -25,10 +25,14 @@ import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGION;
import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGION_CLOUD_OWNER;
import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGION_CLOUD_REGION_ID;
import static org.onap.so.aaisimulator.utils.Constants.CLOUD_REGION_OWNER_DEFINED_TYPE;
+import static org.onap.so.aaisimulator.utils.Constants.HOSTED_ON;
import static org.onap.so.aaisimulator.utils.Constants.LOCATED_IN;
import static org.onap.so.aaisimulator.utils.Constants.TENANT;
import static org.onap.so.aaisimulator.utils.Constants.TENANT_TENANT_ID;
import static org.onap.so.aaisimulator.utils.Constants.TENANT_TENANT_NAME;
+import static org.onap.so.aaisimulator.utils.Constants.VSERVER;
+import static org.onap.so.aaisimulator.utils.Constants.VSERVER_VSERVER_ID;
+import static org.onap.so.aaisimulator.utils.Constants.VSERVER_VSERVER_NAME;
import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getBiDirectionalRelationShipListRelatedLink;
import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getRelationShipListRelatedLink;
import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getTargetUrl;
@@ -63,6 +67,8 @@ import org.springframework.stereotype.Service;
public class CloudRegionCacheServiceProviderImpl extends AbstractCacheServiceProvider
implements CloudRegionCacheServiceProvider {
+
+
private static final Logger LOGGER = LoggerFactory.getLogger(CloudRegionCacheServiceProviderImpl.class);
private final HttpRestServiceProvider httpRestServiceProvider;
@@ -325,6 +331,100 @@ public class CloudRegionCacheServiceProviderImpl extends AbstractCacheServicePro
return false;
}
+ @Override
+ public Optional<Relationship> addvServerRelationShip(final CloudRegionKey key, final String tenantId,
+ final String vServerId, final Relationship relationship, final String requestUri) {
+ final Optional<Vserver> optional = getVserver(key, tenantId, vServerId);
+ if (optional.isPresent()) {
+ final Vserver vServer = optional.get();
+ RelationshipList relationshipList = vServer.getRelationshipList();
+ if (relationshipList == null) {
+ relationshipList = new RelationshipList();
+ vServer.setRelationshipList(relationshipList);
+ }
+ relationshipList.getRelationship().add(relationship);
+ LOGGER.info("Successfully added relation to Vserver with key: {}, tenantId: {} and vServerId: {}", key,
+ tenantId, vServerId);
+ final String relatedLink = getBiDirectionalRelationShipListRelatedLink(requestUri);
+
+ final Relationship resultantRelationship = getVserverRelationship(key, tenantId, vServer, relatedLink);
+
+ return Optional.of(resultantRelationship);
+ }
+
+ LOGGER.error("Unable to find Vserver using key: {}, tenantId: {} and vServerId: {}...", key, tenantId,
+ vServerId);
+ return Optional.empty();
+ }
+
+ private Relationship getVserverRelationship(final CloudRegionKey key, final String tenantId, final Vserver vServer,
+ final String relatedLink) {
+ final Relationship resultantRelationship = new Relationship();
+ resultantRelationship.setRelatedTo(VSERVER);
+ resultantRelationship.setRelationshipLabel(HOSTED_ON);
+ resultantRelationship.setRelatedLink(relatedLink);
+
+ final List<RelationshipData> relationshipDataList = resultantRelationship.getRelationshipData();
+ relationshipDataList.add(getRelationshipData(CLOUD_REGION_CLOUD_OWNER, key.getCloudOwner()));
+ relationshipDataList.add(getRelationshipData(CLOUD_REGION_CLOUD_REGION_ID, key.getCloudRegionId()));
+ relationshipDataList.add(getRelationshipData(TENANT_TENANT_ID, tenantId));
+ relationshipDataList.add(getRelationshipData(VSERVER_VSERVER_ID, vServer.getVserverId()));
+
+ final List<RelatedToProperty> relatedToPropertyList = resultantRelationship.getRelatedToProperty();
+
+ final RelatedToProperty relatedToProperty = new RelatedToProperty();
+ relatedToProperty.setPropertyKey(VSERVER_VSERVER_NAME);
+ relatedToProperty.setPropertyValue(vServer.getVserverName());
+ relatedToPropertyList.add(relatedToProperty);
+ return resultantRelationship;
+ }
+
+ @Override
+ public boolean addVServerRelationShip(final HttpHeaders incomingHeader, final String targetBaseUrl,
+ final String requestUriString, final CloudRegionKey key, final String tenantId, final String vServerId,
+ final Relationship relationship) {
+ try {
+ final Optional<Vserver> optional = getVserver(key, tenantId, vServerId);
+ if (optional.isPresent()) {
+ final Vserver vServer = optional.get();
+ final String targetUrl = getTargetUrl(targetBaseUrl, relationship.getRelatedLink());
+ final Relationship outGoingRelationShip = getVserverRelationship(key, tenantId, vServer,
+ getRelationShipListRelatedLink(requestUriString));
+ final Optional<Relationship> optionalRelationship = httpRestServiceProvider.put(incomingHeader,
+ outGoingRelationShip, targetUrl, Relationship.class);
+ if (optionalRelationship.isPresent()) {
+ final Relationship resultantRelationship = optionalRelationship.get();
+
+ RelationshipList relationshipList = vServer.getRelationshipList();
+ if (relationshipList == null) {
+ relationshipList = new RelationshipList();
+ vServer.setRelationshipList(relationshipList);
+ }
+
+ final Optional<Relationship> relationShipExists = relationshipList.getRelationship().stream()
+ .filter(relation -> relation.getRelatedTo().equals(resultantRelationship.getRelatedTo())
+ && relation.getRelatedLink().equals(resultantRelationship.getRelatedLink()))
+ .findAny();
+
+ if (relationShipExists.isPresent()) {
+ LOGGER.info("relationship {} already exists in cache ", resultantRelationship);
+ return true;
+ }
+
+ LOGGER.info("added relationship {} in cache successfully", resultantRelationship);
+ return relationshipList.getRelationship().add(resultantRelationship);
+ }
+
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to add two-way relationship for key: {}, tenantId: {} and vServerId: {}", key,
+ tenantId, vServerId, exception);
+ }
+ LOGGER.error("Unable to add Vserver relationship for key: {}, tenantId: {} and vServerId: {}...", key, tenantId,
+ vServerId);
+ return false;
+ }
+
private List<EsrSystemInfo> getEsrSystemInfoList(final CloudRegion cloudRegion) {
EsrSystemInfoList esrSystemInfoList = cloudRegion.getEsrSystemInfoList();
if (esrSystemInfoList == null) {
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
index b4b562be..48735309 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
@@ -67,7 +67,7 @@ public class Constants {
public static final String OWNING_ENTITY_OWNING_ENTITY_ID = "owning-entity.owning-entity-id";
public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
-
+
public static final String APPLICATION_MERGE_PATCH_JSON = "application/merge-patch+json";
public static final String SERVICE_RESOURCE_TYPE = "service-instance";
@@ -130,6 +130,14 @@ public class Constants {
public static final String ESR_SYSTEM_INFO_LIST = "esr-system-info-list";
+ public static final String VSERVER_VSERVER_NAME = "vserver.vserver-name";
+
+ public static final String VSERVER_VSERVER_ID = "vserver.vserver-id";
+
+ public static final String HOSTED_ON = "tosca.relationships.HostedOn";
+
+ public static final String VSERVER = "vserver";
+
private Constants() {}
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
index a03a2757..10c1f258 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
@@ -45,6 +45,11 @@ public class HttpServiceUtils {
return UriComponentsBuilder.fromHttpUrl(url.substring(0, url.indexOf(uri))).path(BASE_URL).build().toUri();
}
+ public static URI getBaseUrl(final StringBuffer requestUrl, final String requestUri) {
+ return UriComponentsBuilder.fromHttpUrl(requestUrl.substring(0, requestUrl.indexOf(requestUri))).build()
+ .toUri();
+ }
+
public static String getBaseServiceInstanceUrl(final HttpServletRequest request, final String relatedLink) {
return UriComponentsBuilder.fromUri(getBaseUrl(request)).path(relatedLink).toUriString();
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
index 0ed9d4ea..334a0ebb 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSHIP_LIST_URL;
import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL;
+import static org.onap.so.aaisimulator.utils.Constants.VSERVER;
import static org.onap.so.aaisimulator.utils.TestConstants.CLOUD_OWNER_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.CLOUD_REGION_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.CUSTOMERS_URL;
@@ -300,6 +301,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
+ addCustomerServiceAndGenericVnf();
final String tenantUrl = url + TENANTS_TENANT + TENANT_ID;
addTenantAndAssertResponse(tenantUrl);
@@ -318,6 +320,41 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
assertEquals(VSERVER_NAME, actualVserver.getVserverName());
assertEquals(VSERVER_ID, actualVserver.getVserverId());
assertEquals("active", actualVserver.getProvStatus());
+ assertNotNull(actualVserver.getRelationshipList());
+ assertFalse(actualVserver.getRelationshipList().getRelationship().isEmpty());
+
+ final Optional<GenericVnf> optional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
+ assertTrue(optional.isPresent());
+ final GenericVnf genericVnf = optional.get();
+ assertNotNull(genericVnf.getRelationshipList());
+ assertFalse(genericVnf.getRelationshipList().getRelationship().isEmpty());
+
+ final Relationship expectedRelationShip = genericVnf.getRelationshipList().getRelationship().get(0);
+ assertEquals(VSERVER, expectedRelationShip.getRelatedTo());
+ assertNotNull(expectedRelationShip.getRelationshipData());
+ assertEquals(4, expectedRelationShip.getRelationshipData().size());
+
+ final List<RelationshipData> relationshipDataList = expectedRelationShip.getRelationshipData();
+ final RelationshipData vServerrelationshipData =
+ getRelationshipData(relationshipDataList, Constants.VSERVER_VSERVER_ID);
+ assertNotNull(vServerrelationshipData);
+ assertEquals(VSERVER_ID, vServerrelationshipData.getRelationshipValue());
+
+ final RelationshipData cloudOwnerRelationshipData =
+ getRelationshipData(relationshipDataList, Constants.CLOUD_REGION_CLOUD_OWNER);
+ assertNotNull(cloudOwnerRelationshipData);
+ assertEquals(CLOUD_OWNER_NAME, cloudOwnerRelationshipData.getRelationshipValue());
+
+ final RelationshipData cloudRegionIdRelationshipData =
+ getRelationshipData(relationshipDataList, Constants.CLOUD_REGION_CLOUD_REGION_ID);
+ assertNotNull(cloudRegionIdRelationshipData);
+ assertEquals(CLOUD_REGION_NAME, cloudRegionIdRelationshipData.getRelationshipValue());
+
+ final RelationshipData tenantRelationshipData =
+ getRelationshipData(relationshipDataList, Constants.TENANT_TENANT_ID);
+ assertNotNull(tenantRelationshipData);
+ assertEquals(TENANT_ID, tenantRelationshipData.getRelationshipValue());
+
}
@Test
@@ -325,6 +362,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
+ addCustomerServiceAndGenericVnf();
final String tenantUrl = url + TENANTS_TENANT + TENANT_ID;
addTenantAndAssertResponse(tenantUrl);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/vServer.json b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/vServer.json
index b3cbba65..5fa1843e 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/vServer.json
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/vServer.json
@@ -1,5 +1,26 @@
{
"vserver-id": "f84fdb9b-ad7c-49db-a08f-e443b4cbd033",
"vserver-name": "CsitVServer",
- "prov-status": "active"
+ "prov-status": "active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/dfd02fb5-d7fb-4aac-b3c4-cd6b60058701",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "58157d7e-d50d-4a7d-aebe-ae6e41ca1d9f"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "Test"
+ }
+ ]
+ }
+ ]
+ }
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
index 88970e74..9696beb6 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.sdncsimulator.controller;
+import static org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE;
import static org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE;
import static org.onap.so.sdncsimulator.utils.Constants.OPERATIONS_URL;
import javax.servlet.http.HttpServletRequest;
@@ -73,14 +74,14 @@ public class OperationsController {
return ResponseEntity.badRequest().build();
}
- final Output output = cacheServiceProvider.putServiceOperationInformation(apiServiceOperationInformation);
+ final Output output = getOutput(apiServiceOperationInformation);
final OutputRequest outputRequest = new OutputRequest(output);
if (output.getResponseCode().equals(HttpStatus.OK.toString())) {
- LOGGER.info("Sucessfully added service in cache sending response: {}", outputRequest);
+ LOGGER.info("Sucessfully executed service request sending response: {}", outputRequest);
return ResponseEntity.ok(outputRequest);
}
- LOGGER.error("Unable to add input request: {}, will send OutputRequest: {}", inputRequest, outputRequest);
+ LOGGER.error("Unable to execute input request: {}, will send OutputRequest: {}", inputRequest, outputRequest);
return ResponseEntity.badRequest().body(outputRequest);
}
@@ -100,19 +101,31 @@ public class OperationsController {
}
final Output output = getOutput(apiVnfOperationInformation);
-
final OutputRequest outputRequest = new OutputRequest(output);
if (output.getResponseCode().equals(HttpStatus.OK.toString())) {
- LOGGER.info("Sucessfully added vnf in cache sending response: {}", outputRequest);
+ LOGGER.info("Sucessfully executed request vnf sending response: {}", outputRequest);
return ResponseEntity.ok(outputRequest);
}
- LOGGER.error("Unable to add input request: {}, will send OutputRequest: {}", inputRequest, outputRequest);
+ LOGGER.error("Unable to execute input request: {}, will send OutputRequest: {}", inputRequest, outputRequest);
return ResponseEntity.badRequest().body(outputRequest);
}
+ private Output getOutput(final GenericResourceApiServiceOperationInformation serviceOperationInformation) {
+ final GenericResourceApiRequestinformationRequestInformation requestInformation =
+ serviceOperationInformation.getRequestInformation();
+ if (requestInformation != null) {
+ final GenericResourceApiRequestActionEnumeration requestAction = requestInformation.getRequestAction();
+ if (DELETESERVICEINSTANCE.equals(requestAction)) {
+ LOGGER.info("RequestAction: {} will delete service instance from cache ...", requestAction);
+ return cacheServiceProvider.deleteServiceOperationInformation(serviceOperationInformation);
+ }
+ }
+ return cacheServiceProvider.putServiceOperationInformation(serviceOperationInformation);
+ }
+
private Output getOutput(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation) {
final GenericResourceApiRequestinformationRequestInformation requestInformation =
apiVnfOperationInformation.getRequestInformation();
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
index 5b32b91f..c3a80ec3 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
@@ -34,6 +34,9 @@ public interface ServiceOperationsCacheServiceProvider {
Output putServiceOperationInformation(
final GenericResourceApiServiceOperationInformation apiServiceOperationInformation);
+ Output deleteServiceOperationInformation(
+ final GenericResourceApiServiceOperationInformation serviceOperationInformation);
+
Optional<GenericResourceApiServicemodelinfrastructureService> getGenericResourceApiServicemodelinfrastructureService(
final String serviceInstanceId);
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
index 616a56c4..180e636b 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
@@ -119,6 +119,34 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ
}
@Override
+ public Output deleteServiceOperationInformation(final GenericResourceApiServiceOperationInformation input) {
+ final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation();
+ final String svcRequestId = getSvcRequestId(input.getSdncRequestHeader());
+
+ if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId())) {
+ final String serviceInstanceId = serviceInformation.getServiceInstanceId();
+ final Optional<GenericResourceApiServicemodelinfrastructureService> optional =
+ getGenericResourceApiServicemodelinfrastructureService(serviceInstanceId);
+ if (optional.isPresent()) {
+ final Cache cache = getCache(SERVICE_TOPOLOGY_OPERATION_CACHE);
+ LOGGER.info("Deleting GenericResourceApiServiceOperationInformation from cache using key: {}",
+ serviceInstanceId);
+ cache.evict(serviceInstanceId);
+ return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.OK.toString())
+ .responseMessage(EMPTY_STRING).svcRequestId(svcRequestId).serviceResponseInformation(
+ new GenericResourceApiInstanceReference().instanceId(serviceInstanceId));
+ }
+ LOGGER.error(
+ "Unable to find existing GenericResourceApiServiceModelInfrastructure in cache using service instance id: {}",
+ serviceInstanceId);
+
+ }
+ LOGGER.error("Unable to remove service instance from cache due to invalid input: {}... ", input);
+ return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString())
+ .responseMessage("Unable to remove service").svcRequestId(svcRequestId);
+ }
+
+ @Override
public Optional<GenericResourceApiServicemodelinfrastructureService> getGenericResourceApiServicemodelinfrastructureService(
final String serviceInstanceId) {
final Cache cache = getCache(SERVICE_TOPOLOGY_OPERATION_CACHE);
@@ -210,7 +238,14 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ
getExistingVnf(vnfId, vnfsList);
if (vnfInstanceOptional.isPresent()) {
- vnfsList.removeIf(vnf -> vnf.getVnfId() != null && vnf.getVnfId().equals(vnfId));
+ vnfsList.removeIf(vnf -> {
+ final String existingVnfId = vnf.getVnfId();
+ if (existingVnfId != null && existingVnfId.equals(vnfId)) {
+ LOGGER.info("Remove vnf with id: {} ... ", existingVnfId);
+ return true;
+ }
+ return false;
+ });
return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.OK.toString())
.responseMessage(EMPTY_STRING).svcRequestId(svcRequestId)
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
index a338283c..3c17a376 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.sdncsimulator.controller.TestUtils.getInvalidRequestInput;
import static org.onap.so.sdncsimulator.controller.TestUtils.getRequestInput;
+import static org.onap.so.sdncsimulator.controller.TestUtils.getServiceRequestWithRequestActionDeleteServiceInput;
import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestInput;
import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestWithRequestActionDeleteVnfInput;
import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestWithSvcActionActivateInput;
@@ -302,7 +303,7 @@ public class OperationsControllerTest {
assertNotNull(vnf.getVnfId());
assertEquals(VNF_INSTANCE_ID, vnf.getVnfId());
assertNotNull(vnf.getVnfData());
- GenericResourceApiOperStatusData vnfLevelOperStatus = vnf.getVnfData().getVnfLevelOperStatus();
+ final GenericResourceApiOperStatusData vnfLevelOperStatus = vnf.getVnfData().getVnfLevelOperStatus();
assertNotNull(vnfLevelOperStatus);
assertEquals(GenericResourceApiLastRpcActionEnumeration.ACTIVATE, vnfLevelOperStatus.getLastRpcAction());
@@ -364,6 +365,43 @@ public class OperationsControllerTest {
}
+ @Test
+ public void test_postServiceOperationInformation_withActionDeleteServiceInstance_successfullyRemoveServiceFromExistingServiceInCache()
+ throws Exception {
+ final HttpEntity<?> httpEntity = new HttpEntity<>(getRequestInput(), getHttpHeaders());
+ final ResponseEntity<OutputRequest> responseEntity =
+ restTemplate.exchange(getUrl(), HttpMethod.POST, httpEntity, OutputRequest.class);
+
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+ Optional<GenericResourceApiServicemodelinfrastructureService> serviceOptional =
+ cacheServiceProvider.getGenericResourceApiServicemodelinfrastructureService(SERVICE_INSTANCE_ID);
+ assertTrue(serviceOptional.isPresent());
+
+ final GenericResourceApiServicemodelinfrastructureService service = serviceOptional.get();
+ assertNotNull(service.getServiceInstanceId());
+
+ final HttpEntity<?> httpRemoveServiceEntity =
+ new HttpEntity<>(getServiceRequestWithRequestActionDeleteServiceInput(), getHttpHeaders());
+ final ResponseEntity<OutputRequest> responseRemoveServiceEntity =
+ restTemplate.exchange(getUrl(), HttpMethod.POST, httpRemoveServiceEntity, OutputRequest.class);
+ assertEquals(HttpStatus.OK, responseRemoveServiceEntity.getStatusCode());
+
+ final OutputRequest actualOutputRequest = responseRemoveServiceEntity.getBody();
+ assertNotNull(actualOutputRequest);
+ assertNotNull(actualOutputRequest.getOutput());
+
+ final Output actualObject = actualOutputRequest.getOutput();
+
+ assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode());
+ assertEquals(Constants.YES, actualObject.getAckFinalIndicator());
+ assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId());
+
+ serviceOptional =
+ cacheServiceProvider.getGenericResourceApiServicemodelinfrastructureService(SERVICE_INSTANCE_ID);
+ assertFalse(serviceOptional.isPresent());
+
+ }
+
private HttpHeaders getHttpHeaders() {
return TestUtils.getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername());
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java
index b43ecf4c..8e0e9b43 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java
@@ -58,6 +58,10 @@ public class TestUtils {
return getFileAsString(getFile("test-data/deleteVnfInput.json").toPath());
}
+ public static String getServiceRequestWithRequestActionDeleteServiceInput() throws IOException {
+ return getFileAsString(getFile("test-data/deleteServiceInput.json").toPath());
+ }
+
public static String getFileAsString(final Path path) throws IOException {
return new String(Files.readAllBytes(path));
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteServiceInput.json b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteServiceInput.json
new file mode 100644
index 00000000..1040209f
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteServiceInput.json
@@ -0,0 +1,28 @@
+{
+ "input": {
+ "request-information": {
+ "request-action": "DeleteServiceInstance",
+ "source": "MSO",
+ "request-id": "33ebd358-a189-4664-90f5-cf9e23658e0a"
+ },
+ "sdnc-request-header": {
+ "svc-request-id": "04fc9f50-87b8-430d-a232-ef24bd6c4150",
+ "svc-action": "deactivate"
+ },
+ "service-information": {
+ "onap-model-information": {
+ "model-name": "Sol004Zip3Service",
+ "model-version": "2.0",
+ "model-uuid": "c112a499-6148-488b-ba82-3f5938cf26d2",
+ "model-invariant-uuid": "e9acd081-9c89-4b4d-bcb3-e0e2b9715b2a"
+ },
+ "subscription-service-type": "vCPE",
+ "service-id": "ccece8fe-13da-456a-baf6-41b3a4a2bc2b",
+ "global-customer-id": "NordixDemoCustomer",
+ "service-instance-id": "ccece8fe-13da-456a-baf6-41b3a4a2bc2b"
+ },
+ "service-request-input": {
+ "service-instance-name": "ServiceTest_24_07_2019"
+ }
+ }
+}
diff --git a/scripts/sdc/setup_sdc_for_sanity.sh b/scripts/sdc/setup_sdc_for_sanity.sh
index 562c26d1..2d644c3f 100644
--- a/scripts/sdc/setup_sdc_for_sanity.sh
+++ b/scripts/sdc/setup_sdc_for_sanity.sh
@@ -6,12 +6,13 @@ function usage {
echo "setup sdc and run ui test suite: setup_sdc_for_sanity.sh tud"
}
-# returns 0: if SDC_LOCAL_IMAGES is set to true value
+# arg: <variable name>
+# returns 0: if <variable name> is set to true value
# returns 1: otherwise
-function using_local_images {
- SDC_LOCAL_IMAGES=$(echo "${SDC_LOCAL_IMAGES}" | tr '[:upper:]' '[:lower:]')
+function is_true {
+ _value=$(eval echo "\$${1}" | tr '[:upper:]' '[:lower:]')
- case "$SDC_LOCAL_IMAGES" in
+ case "$_value" in
1|yes|true|Y)
return 0
;;
@@ -20,6 +21,18 @@ function using_local_images {
return 1
}
+# returns 0: if SDC_LOCAL_IMAGES is set to true value
+# returns 1: otherwise
+function using_local_images {
+ is_true SDC_LOCAL_IMAGES
+}
+
+# returns 0: if SDC_TEST_HTTPS is set to true value
+# returns 1: otherwise
+function using_https {
+ is_true SDC_TEST_HTTPS
+}
+
# fail quick if error
set -exo pipefail
@@ -32,10 +45,10 @@ if [ "$1" != "tad" ] && [ "$1" != "tud" ]; then
fi
# Clone sdc enviroment template
-mkdir -p ${WORKSPACE}/data/environments/
-mkdir -p ${WORKSPACE}/data/clone/
+mkdir -p "${WORKSPACE}/data/environments/"
+mkdir -p "${WORKSPACE}/data/clone/"
-cd ${WORKSPACE}/data/clone
+cd "${WORKSPACE}/data/clone"
if using_local_images && [ -n "$SDC_LOCAL_GITREPO" ] ; then
if [ -d "$SDC_LOCAL_GITREPO" ] ; then
rm -rf ./sdc
@@ -48,29 +61,41 @@ else
git clone --depth 1 http://gerrit.onap.org/r/sdc -b ${GERRIT_BRANCH}
fi
-chmod -R 777 ${WORKSPACE}/data/clone
+# TODO: why?
+chmod -R 777 "${WORKSPACE}/data/clone"
# set enviroment variables
export ENV_NAME='CSIT'
export MR_IP_ADDR='10.0.0.1'
-export TEST_SUITE=$1
+export TEST_SUITE="$1"
ifconfig
IP_ADDRESS=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
-export HOST_IP=$IP_ADDRESS
+export HOST_IP="$IP_ADDRESS"
# setup enviroment json
+# TODO: use jq or find a better way altogether...
+cp "${WORKSPACE}/data/clone/sdc/sdc-os-chef/environments/Template.json" \
+ "${WORKSPACE}/data/environments/$ENV_NAME.json"
+sed -i \
+ -e "s/xxx/${ENV_NAME}/g" \
+ -e "s/yyy/${IP_ADDRESS}/g" \
+ -e "s/\"ueb_url_list\":.*/\"ueb_url_list\": \"${MR_IP_ADDR},${MR_IP_ADDR}\",/g" \
+ -e "s/\"fqdn\":.*/\"fqdn\": [\"${MR_IP_ADDR}\", \"${MR_IP_ADDR}\"]/g" \
+ "${WORKSPACE}/data/environments/$ENV_NAME.json"
+if using_https ; then
+ # this is very fragile (as all above) and relies on the current state of Template.json in another project...
+ # using jq filters would be much better approach and no need for some "yyy"...
+ sed -i \
+ -e 's/"disableHttp":[[:space:]]*"\?[[:alnum:]]*"\?/"disableHttp": true/' \
+ "${WORKSPACE}/data/environments/$ENV_NAME.json"
+fi
-cat ${WORKSPACE}/data/clone/sdc/sdc-os-chef/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > ${WORKSPACE}/data/environments/$ENV_NAME.json
-sed -i "s/xxx/"$ENV_NAME"/g" ${WORKSPACE}/data/environments/$ENV_NAME.json
-sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" ${WORKSPACE}/data/environments/$ENV_NAME.json
-sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" ${WORKSPACE}/data/environments/$ENV_NAME.json
-
-cp ${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh ${WORKSPACE}/scripts/sdc/
+cp "${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh" "${WORKSPACE}/scripts/sdc/"
-source ${WORKSPACE}/data/clone/sdc/version.properties
-export RELEASE=$major.$minor-STAGING-latest
+source "${WORKSPACE}/data/clone/sdc/version.properties"
+export RELEASE="${major}.${minor}-STAGING-latest"
if using_local_images ; then
if [ -n "$SDC_LOCAL_TAG" ] ; then
@@ -81,17 +106,40 @@ if using_local_images ; then
fi
echo "[INFO]: We will use the locally built images (tag: ${RELEASE})"
- ${WORKSPACE}/scripts/sdc/docker_run.sh \
+ "${WORKSPACE}/scripts/sdc/docker_run.sh" \
--local \
- -r ${RELEASE} \
- -e ${ENV_NAME} \
- -p 10001 -${TEST_SUITE}
+ -r "${RELEASE}" \
+ -e "${ENV_NAME}" \
+ -p 10001 "-${TEST_SUITE}"
else
echo "[INFO]: We will download images from the default registry (tag: ${RELEASE})"
${WORKSPACE}/scripts/sdc/docker_run.sh \
- -r ${RELEASE} \
- -e ${ENV_NAME} \
- -p 10001 -${TEST_SUITE}
+ -r "${RELEASE}" \
+ -e "${ENV_NAME}" \
+ -p 10001 "-${TEST_SUITE}"
+fi
+
+# final step if the robot test needs to be adjusted
+# TODO: again grab the values from Template directly with jq
+# jq should be mandatory installed package (is it?)
+if using_https ; then
+ ROBOT_VARIABLES="${ROBOT_VARIABLES} \
+ -v SDC_FE_PROTOCOL:https \
+ -v SDC_FE_PORT:9443 \
+ -v SDC_BE_PROTOCOL:https \
+ -v SDC_BE_PORT:8443 \
+ -v SDC_ONBOARDING_BE_PROTOCOL:https \
+ -v SDC_ONBOARDING_BE_PORT:8443 \
+ "
+else
+ ROBOT_VARIABLES="${ROBOT_VARIABLES} \
+ -v SDC_FE_PROTOCOL:http \
+ -v SDC_FE_PORT:8181 \
+ -v SDC_BE_PROTOCOL:http \
+ -v SDC_BE_PORT:8080 \
+ -v SDC_ONBOARDING_BE_PROTOCOL:http \
+ -v SDC_ONBOARDING_BE_PORT:8081 \
+ "
fi
# This file is sourced in another script which is out of our control...
diff --git a/tests/sdc/nightly/test1.robot b/tests/sdc/nightly/test1.robot
index 3705d8f5..2b92be74 100644
--- a/tests/sdc/nightly/test1.robot
+++ b/tests/sdc/nightly/test1.robot
@@ -7,9 +7,9 @@ Library json
*** Test Cases ***
Get Requests health check ok
[Tags] get
- CreateSession sdc-be http://localhost:8181
+ CreateSession sdc-fe ${SDC_FE_PROTOCOL}://localhost:${SDC_FE_PORT}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request sdc-be /sdc1/rest/healthCheck headers=&{headers}
+ ${resp}= Get Request sdc-fe /sdc1/rest/healthCheck headers=&{headers}
Should Be Equal As Strings ${resp.status_code} 200
@{ITEMS}= Copy List ${resp.json()['componentsInfo']}
: FOR ${ELEMENT} IN @{ITEMS}
diff --git a/tests/sdc/sanity/test1.robot b/tests/sdc/sanity/test1.robot
index 3705d8f5..2b92be74 100644
--- a/tests/sdc/sanity/test1.robot
+++ b/tests/sdc/sanity/test1.robot
@@ -7,9 +7,9 @@ Library json
*** Test Cases ***
Get Requests health check ok
[Tags] get
- CreateSession sdc-be http://localhost:8181
+ CreateSession sdc-fe ${SDC_FE_PROTOCOL}://localhost:${SDC_FE_PORT}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request sdc-be /sdc1/rest/healthCheck headers=&{headers}
+ ${resp}= Get Request sdc-fe /sdc1/rest/healthCheck headers=&{headers}
Should Be Equal As Strings ${resp.status_code} 200
@{ITEMS}= Copy List ${resp.json()['componentsInfo']}
: FOR ${ELEMENT} IN @{ITEMS}
diff --git a/tests/sdc/uiSanity/test1.robot b/tests/sdc/uiSanity/test1.robot
index 3705d8f5..2b92be74 100644
--- a/tests/sdc/uiSanity/test1.robot
+++ b/tests/sdc/uiSanity/test1.robot
@@ -7,9 +7,9 @@ Library json
*** Test Cases ***
Get Requests health check ok
[Tags] get
- CreateSession sdc-be http://localhost:8181
+ CreateSession sdc-fe ${SDC_FE_PROTOCOL}://localhost:${SDC_FE_PORT}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request sdc-be /sdc1/rest/healthCheck headers=&{headers}
+ ${resp}= Get Request sdc-fe /sdc1/rest/healthCheck headers=&{headers}
Should Be Equal As Strings ${resp.status_code} 200
@{ITEMS}= Copy List ${resp.json()['componentsInfo']}
: FOR ${ELEMENT} IN @{ITEMS}