diff options
author | 2020-12-03 15:18:08 +0530 | |
---|---|---|
committer | 2021-01-07 22:57:02 +0530 | |
commit | 1feb0a77c857d811283d74d0f3df018d42c2debe (patch) | |
tree | 298b6820f52f4f1e1863f9037841434f8665bd67 /plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade | |
parent | a94201cdbbe0c1ceb2fa0e676a61627e4bc7b657 (diff) |
CSIT Support for ServiceLevel PNF Software Upgrade
- Details on CSIT test cases: https://wiki.onap.org/display/DW/E2E+Integration+Test+Cases+PNF-Software+Upgrade+With+Schema+Updates
- Newly added test are listed below:
1. Distribute Service Level Upgrade Template
2. Get ServiceModel Version from AAI using ServiceModelInVariant UUId
3. Invoke Service Instantiation for ServiceLevel Upgrade
4. Verify PNF-1 Configuration for Service Level Upgrade
5. AAI-Update for PNF-1 Target Software Version after Service Level Upgrade
6. Verify PNF-2 Configuration for Service Level Upgrade
7. AAI-Update for PNF-2 Target Software Version after Service Level Upgrade
8. Test AAI-Update for ServiceInstance after Service Level Upgrade
Issue-ID: INT-1591
Signed-off-by: ajay_dp001 <ajay.deep.singh@est.tech>
Change-Id: I7bd1ee8d19692f16e0f4415b5115e88a9feff869
Diffstat (limited to 'plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade')
20 files changed, 296 insertions, 52 deletions
diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/setup.sh b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/setup.sh index 65cd576f..6dbe58c1 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/setup.sh +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/setup.sh @@ -57,6 +57,7 @@ docker-compose -f $PNF_SIM_DOCKER_PATH/docker-compose.yml -p $PROJECT_NAME up -d ##### update pnf simulator ip in config deploy request ####### RES_KEY=$(uuidgen -r) sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount.json +sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount2.json ############################################################## diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/simulators/pnfsim/docker-compose.yml b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/simulators/pnfsim/docker-compose.yml index 7b1d5a8f..c6657e27 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/simulators/pnfsim/docker-compose.yml +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/simulators/pnfsim/docker-compose.yml @@ -9,4 +9,14 @@ services: - "830:830" - "6513:6513" volumes: + - ./:/config/modules + + netconf-pnp-simulator-2: + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 + container_name: netconf-pnp-simulator-2 + restart: always + ports: + - "831:830" + - "6514:6513" + volumes: - ./:/config/modules
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/a51e2bef-961c-496f-b235-b4540400e885.json b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/a51e2bef-961c-496f-b235-b4540400e885.json new file mode 100644 index 00000000..fc42fa55 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/a51e2bef-961c-496f-b235-b4540400e885.json @@ -0,0 +1,20 @@ +{ + "model-vers": { + "model-ver": [ + { + "model-version-id": "cd4decf6-4f27-4775-9561-0e683ed43635", + "model-name": "EricService", + "model-version": "1.0", + "model-description": "service_instance_1.0", + "resource-version": "1594657102313" + }, + { + "model-version-id": "4442dfc1-0d2d-46b4-b0bc-a2ac10448269", + "model-name": "EricService", + "model-version": "2.0", + "model-description": "service_instance_2.0", + "resource-version": "1594707742646" + } + ] + } +}
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf.json b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf.json index ab39d8c7..331b249d 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf.json +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf.json @@ -1,5 +1,5 @@ { - "pnf-name2":"PNFDemo-pnf-name2-val-78244", + "pnf-name2":"6513", "pnf-name2-source":"PNFDemo-pnf-name2-source-val-99275", "equip-type":"PNFDemo-equip-type-val-20348", "equip-vendor":"PNFDemo-equip-vendor-val-52182", diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf2.json b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf2.json new file mode 100755 index 00000000..07732f21 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/pnf2.json @@ -0,0 +1,16 @@ +{ + "pnf-name2":"6514", + "pnf-name2-source":"PNFDemo1-pnf-name2-source-val-99275", + "equip-type":"PNFDemo1-equip-type-val-20348", + "equip-vendor":"PNFDemo1-equip-vendor-val-52182", + "equip-model":"PNFDemo1-equip-model-val-8370", + "management-option":"PNFDemo1-management-option-val-72881", + "ipaddress-v4-oam":"pnfaddr", + "ipaddress-v6-oam":"0:0:0:0:0:0", + "sw-version":"pnf_sw_version-1.0.0", + "pnf-name":"PNFDemo1", + "pnf-id":"PNFDemo1", + "in-maint":false, + "resource-version":"1371558818531", + "selflink": "http://localhost:9993/pnf/PNFDemo1" +}
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/service-instance-aai.json b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/service-instance-aai.json index 8ea4263b..53dc39d2 100644 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/service-instance-aai.json +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/aai-simulator-populate-data/service-instance-aai.json @@ -1,9 +1,9 @@ { - "service-instance-id": "5df8b6de-2083-11e7-93ae-92361f002676", + "service-instance-id": "df4decf6-h727-8875-8761-89683ed43645", "service-instance-name": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269", "environment-context": "General_Revenue-Bearing", "workload-context": "Production", - "model-version-id": "d88da85c-d9e8-4f73-b837-3a72a431622b", + "model-version-id": "cd4decf6-4f27-4775-9561-0e683ed43635", "modelInvariantId": "fe41489e-1563-46a3-b90a-1db629e4375b", "resource-version": "1595258335377", "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/5df8b6de-2083-11e7-93ae-92361f002676/service-data/service-topology/", diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/apply-workarounds.sh b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/apply-workarounds.sh index cb61ca34..72e84347 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/apply-workarounds.sh +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/apply-workarounds.sh @@ -72,6 +72,9 @@ apply_workaround() insert into $WORKFLOW_TABLE_NAME(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values ('02bffbd9-6af0-4f8d-bf9b-d1dfccd28c84','GenericPnfSWUPDownload','GenericPnfSWUPDownload','GenericPnfSWUPDownload',1.0,'Pnf Workflow to download software',null,'pnf','native'); + insert into $WORKFLOW_TABLE_NAME(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values + ('03fcdjf2-6af0-4f8d-bf9b-s3frzca23c19','ServiceLevelUpgrade','ServiceLevelUpgrade','ServiceLevelUpgrade',1.0,'ServiceLevel Upgrade Workflow to upgrade software',null,'service','native'); + COMMIT; EOF diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/distribution-test-zip/zipped_sdc_csar_2.0.tar.gz b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/distribution-test-zip/zipped_sdc_csar_2.0.tar.gz Binary files differnew file mode 100644 index 00000000..357260ef --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/distribution-test-zip/zipped_sdc_csar_2.0.tar.gz diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/env b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/env index ab4e3df4..71e9daff 100644 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/env +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/env @@ -1,6 +1,6 @@ NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 DOCKER_ENVIRONMENT=remote -TAG=1.7.7-STAGING-latest +TAG=1.8.0-STAGING-latest TIME_OUT_DEFAULT_VALUE_SEC=1200 PROJECT_NAME=pnfSwU DEFAULT_NETWORK_NAME=pnfswu_default diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/populate-aai-simulator.sh b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/populate-aai-simulator.sh index 26673fcf..bbc5b9f3 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/populate-aai-simulator.sh +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/config/populate-aai-simulator.sh @@ -62,6 +62,7 @@ populate_aai_simulator() ESR_SYSTEM_INFO_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/esr-system-info.json CLOUD_ESR_SYSTEM_INFO_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/cloud-esr-system-info.json PNF_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/pnf.json + PNF2_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/pnf2.json SERVICE_INSTANCE_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/service-instance-aai.json STATUS_CODE_ACCEPTED="202" @@ -157,8 +158,16 @@ populate_aai_simulator() exit 1 fi + echo "$SCRIPT_NAME $(current_timestamp): Adding PNF_2.0" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/network/pnfs/pnf/PNFDemo1 -X PUT -d @$"$PNF2_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put PNF data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + echo "$SCRIPT_NAME $(current_timestamp): Adding ServiceInstance" - status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/customers/customer/5df8b6de-2083-11e7-93ae-92361f002676/service-subscriptions/service-subscription/pNF/service-instances/service-instance/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce -X PUT -d @$"$SERVICE_INSTANCE_JSON_FILE") + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/customers/customer/807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/cd4decf6-4f27-4775-9561-0e683ed43635 -X PUT -d @$"$SERVICE_INSTANCE_JSON_FILE") if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put ServiceInstance data in AAI Simulator. Status code received: $status_code" diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/docker-compose.yml b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/docker-compose.yml index 0886d9d5..4699be33 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/docker-compose.yml +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/docker-compose.yml @@ -140,6 +140,7 @@ services: - /etc/localtime:/etc/localtime:ro - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates - ${CONFIG_DIR_PATH}/distribution-test-zip/zipped_sdc_csar.tar.gz:/distribution-test-zip/zipped_sdc_csar.tar.gz + - ${CONFIG_DIR_PATH}/distribution-test-zip/zipped_sdc_csar_2.0.tar.gz:/distribution-test-zip/zipped_sdc_csar_2.0.tar.gz - ${CONFIG_DIR_PATH}/override-files/sdc-controller/onapheat:/app/config environment: - APP=sdc-controller @@ -160,7 +161,7 @@ services: entrypoint: - /bin/sh - -c - - 'mkdir -p /app/distribution-test-zip/unzipped && cp -R /distribution-test-zip/zipped_sdc_csar.tar.gz /app && tar -xvzf /app/zipped_sdc_csar.tar.gz -C /app/distribution-test-zip/unzipped && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' + - 'mkdir -p /app/distribution-test-zip/unzipped && cp -R /distribution-test-zip/zipped_sdc_csar.tar.gz /app && cp -R /distribution-test-zip/zipped_sdc_csar_2.0.tar.gz /app && tar -xvzf /app/zipped_sdc_csar.tar.gz -C /app/distribution-test-zip/unzipped && tar -xvzf /app/zipped_sdc_csar_2.0.tar.gz -C /app/distribution-test-zip/unzipped && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' ################################################################################ bpmn-infra: user: root @@ -246,6 +247,7 @@ services: container_name: aai-simulator volumes: - /etc/localtime:/etc/localtime:ro + - ${CONFIG_DIR_PATH}/a51e2bef-961c-496f-b235-b4540400e885.json:/app/a51e2bef-961c-496f-b235-b4540400e885.json ports: - "9993:9993" environment: diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/pom.xml b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/pom.xml index 30d25215..99768146 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/pom.xml +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/pom.xml @@ -55,6 +55,11 @@ <groupId>javax.activation</groupId> <artifactId>activation</artifactId> </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.8.5</version> + </dependency> </dependencies> <build> <plugins> diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java index ddc2b624..13753871 100644 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,14 @@ */ package org.onap.aaisimulator.controller; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import javax.ws.rs.core.MediaType; +import org.onap.aaisimulator.models.ServiceModelVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -50,25 +53,27 @@ public class ServiceDesignAndCreationController { @Value("${SERVICE_DESIGN_AND_CREATION_RESPONSES_LOCATION:./}") private String responsesLocation; - @GetMapping(path = "/models/model/{model-invariant-id}/model-vers", - produces = MediaType.APPLICATION_XML_VALUE) + @GetMapping(path = "/models/model/{model-invariant-id}/model-vers", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity<String> getModelVers(@PathVariable("model-invariant-id") String modelInvariantId) { Path responsesPath = Paths.get(responsesLocation).toAbsolutePath(); LOGGER.info("Will get ModelVer for 'model-invariant-id': {}, looking under {}", modelInvariantId, responsesPath.toString()); - Path responsePath = responsesPath.resolve(modelInvariantId + ".xml"); + Path responsePath = responsesPath.resolve(modelInvariantId + ".json"); if (!responsePath.toFile().exists()) { LOGGER.error("{} not found", responsePath.toString()); return ResponseEntity.notFound().build(); } try { String content = new String(Files.readAllBytes(responsePath), StandardCharsets.UTF_8); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + ServiceModelVersion json = gson.fromJson(content, ServiceModelVersion.class); + String jsonInString = gson.toJson(json); LOGGER.info("{} found with {} characters", responsePath.toString(), content.length()); - return ResponseEntity.ok().body(content); + return ResponseEntity.ok().body(jsonInString); } catch (IOException e) { LOGGER.error("Failed to read response from {}: {}}", responsePath.toString(), e.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); } } -} +}
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersion.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersion.java new file mode 100644 index 00000000..d6825089 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersion.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.aaisimulator.models; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class ModelVersion { + + @SerializedName("model-version-id") + @Expose + private String modelVersionId; + + @SerializedName("model-name") + @Expose + private String modelName; + + @SerializedName("model-version") + @Expose + private String modelVersion; + + @SerializedName("model-description") + @Expose + private String modelDescription; + + @SerializedName("resource-version") + @Expose + private String resourceVersion; + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelDescription() { + return modelDescription; + } + + public void setModelDescription(String modelDescription) { + this.modelDescription = modelDescription; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } +} diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersions.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersions.java new file mode 100644 index 00000000..7d74ec36 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ModelVersions.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.aaisimulator.models; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; +import java.util.List; + +public class ModelVersions { + + @SerializedName("model-ver") + @Expose + private List<ModelVersion> modelVer = null; + + public List<ModelVersion> getModelVer() { + return modelVer; + } + + public void setModelVer(List<ModelVersion> modelVer) { + this.modelVer = modelVer; + } +} diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ServiceModelVersion.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ServiceModelVersion.java new file mode 100644 index 00000000..d0a879c4 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/models/ServiceModelVersion.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.aaisimulator.models; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class ServiceModelVersion { + + @SerializedName("model-vers") + @Expose + private ModelVersions modelVers; + + public ModelVersions getModelVers() { + return modelVers; + } + + public void setModelVers(ModelVersions modelVers) { + this.modelVers = modelVers; + } +} diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationControllerTest.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationControllerTest.java index d0e652bd..8bda17e4 100644 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationControllerTest.java +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationControllerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ package org.onap.aaisimulator.controller; import org.junit.Test; +import org.onap.aaisimulator.models.ServiceModelVersion; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.HttpStatus; @@ -37,31 +38,35 @@ public class ServiceDesignAndCreationControllerTest extends AbstractSpringBootTe @Test public void should_reply_sample_modelvers_response() { - final String url = getUrl(SERVICE_DESIGN_AND_CREATION_URL, - "/models/model/a51e2bef-961c-496f-b235-b4540400e885/model-vers"); - ResponseEntity<String> actual = testRestTemplateService.invokeHttpGet(url, String.class); - String expectedXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + - "<model-vers xmlns=\"http://org.onap.aai.inventory/v11\">\n" + - " <model-ver>\n" + - " <model-version-id>c0818142-324d-4a8c-8065-45a61df247a5</model-version-id>\n" + - " <model-name>EricService</model-name>\n" + - " <model-version>1.0</model-version>\n" + - " <model-description>blah</model-description>\n" + - " <resource-version>1594657102313</resource-version>\n" + - " </model-ver>\n" + - " <model-ver>\n" + - " <model-version-id>4442dfc1-0d2d-46b4-b0bc-a2ac10448269</model-version-id>\n" + - " <model-name>EricService</model-name>\n" + - " <model-version>2.0</model-version>\n" + - " <model-description>blahhhh</model-description>\n" + - " <resource-version>1594707742646</resource-version>\n" + - " </model-ver>\n" + - "</model-vers>"; + final String url = getUrl(SERVICE_DESIGN_AND_CREATION_URL, "/models/model/a51e2bef-961c-496f-b235-b4540400e885/model-vers"); + + ResponseEntity<?> actual = testRestTemplateService.invokeHttpGet(url, String.class); + + String expectedXml = "{\n" + + " \"model-vers\": {\n" + + " \"model-ver\": [\n" + + " {\n" + + " \"model-version-id\": \"cd4decf6-4f27-4775-9561-0e683ed43635\",\n" + + " \"model-name\": \"EricService\",\n" + + " \"model-version\": \"1.0\",\n" + + " \"model-description\": \"service_instance_1.0\",\n" + + " \"resource-version\": \"1594657102313\"\n" + + " },\n" + + " {\n" + + " \"model-version-id\": \"4442dfc1-0d2d-46b4-b0bc-a2ac10448269\",\n" + + " \"model-name\": \"EricService\",\n" + + " \"model-version\": \"2.0\",\n" + + " \"model-description\": \"service_instance_2.0\",\n" + + " \"resource-version\": \"1594707742646\"\n" + + " }\n" + + " ]\n" + + " }\n" + + "}"; assertEquals(HttpStatus.OK, actual.getStatusCode()); MediaType contentType = actual.getHeaders().getContentType(); assertNotNull(contentType); - assertTrue(contentType.isCompatibleWith(MediaType.APPLICATION_XML)); + assertTrue(contentType.isCompatibleWith(MediaType.APPLICATION_JSON)); assertEquals(expectedXml, actual.getBody()); } }
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.json b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.json new file mode 100644 index 00000000..fc42fa55 --- /dev/null +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.json @@ -0,0 +1,20 @@ +{ + "model-vers": { + "model-ver": [ + { + "model-version-id": "cd4decf6-4f27-4775-9561-0e683ed43635", + "model-name": "EricService", + "model-version": "1.0", + "model-description": "service_instance_1.0", + "resource-version": "1594657102313" + }, + { + "model-version-id": "4442dfc1-0d2d-46b4-b0bc-a2ac10448269", + "model-name": "EricService", + "model-version": "2.0", + "model-description": "service_instance_2.0", + "resource-version": "1594707742646" + } + ] + } +}
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.xml b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.xml deleted file mode 100644 index 55247be6..00000000 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/test/resources/test-data/service-design-and-creation-responses/a51e2bef-961c-496f-b235-b4540400e885.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<model-vers xmlns="http://org.onap.aai.inventory/v11"> - <model-ver> - <model-version-id>c0818142-324d-4a8c-8065-45a61df247a5</model-version-id> - <model-name>EricService</model-name> - <model-version>1.0</model-version> - <model-description>blah</model-description> - <resource-version>1594657102313</resource-version> - </model-ver> - <model-ver> - <model-version-id>4442dfc1-0d2d-46b4-b0bc-a2ac10448269</model-version-id> - <model-name>EricService</model-name> - <model-version>2.0</model-version> - <model-description>blahhhh</model-description> - <resource-version>1594707742646</resource-version> - </model-ver> -</model-vers>
\ No newline at end of file diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/so_setup.sh b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/so_setup.sh index ed5f6f07..de90c1f3 100755 --- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/so_setup.sh +++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/so_setup.sh @@ -45,6 +45,7 @@ WAIT_FOR_WORKAROUND_SCRIPT=$CONFIG_DIR/"wait-for-workaround-job.sh" WAIT_FOR_POPULATE_AAI_SCRIPT=$CONFIG_DIR/"wait-for-aai-config-job.sh" WAIT_FOR_CONTAINER_SCRIPT=$CONFIG_DIR/"wait-for-container.sh" PNF_PAYLOAD_PATH=$CONFIG_DIR/aai-simulator-populate-data/pnf.json +PNF2_PAYLOAD_PATH=$CONFIG_DIR/aai-simulator-populate-data/pnf2.json echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." @@ -142,6 +143,7 @@ export CONFIG_DIR_PATH=$CONFIG_DIR echo "updating PNF ip-address in pnf.json" sed -i "s/pnfaddr/$LOCAL_IP/g" $PNF_PAYLOAD_PATH +sed -i "s/pnfaddr/$LOCAL_IP/g" $PNF2_PAYLOAD_PATH if [ "$DOCKER_ENVIRONMENT" == "remote" ]; then echo "Starting docker containers with remote images ..." |