diff options
105 files changed, 3541 insertions, 1593 deletions
diff --git a/plans/sdc/sanity/setup.sh b/plans/sdc/sanity/setup.sh index 7587d096..0e652f86 100644 --- a/plans/sdc/sanity/setup.sh +++ b/plans/sdc/sanity/setup.sh @@ -1,11 +1,18 @@ #!/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 - -BE_IP=`get-instance-ip.sh sdc-BE` -echo BE_IP=${BE_IP} - - -# Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v BE_IP:${BE_IP}" - diff --git a/plans/sdc/uiSanity/setup.sh b/plans/sdc/uiSanity/setup.sh index 863f8d4d..3d315098 100644 --- a/plans/sdc/uiSanity/setup.sh +++ b/plans/sdc/uiSanity/setup.sh @@ -1,10 +1,17 @@ #!/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 tud - -BE_IP=`get-instance-ip.sh sdc-BE` -echo BE_IP=${BE_IP} - -# Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v BE_IP:${BE_IP}" - diff --git a/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/customer.json b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/customer.json new file mode 100644 index 00000000..6c53c056 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/customer.json @@ -0,0 +1,73 @@ +{ + "global-customer-id": "DemoCustomer", + "subscriber-name": "DemoCustomer", + "subscriber-type": "INFRA", + "service-subscriptions": { + "service-subscription": [ + { + "service-type": "vLB", + "relationship-list": { + "relationship": [ + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/xyzcloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "xyzcloud" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "693c7729b2364a26a3ca602e6f66187d" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "admin" + } + ] + } + ] + } + }, + { + "service-type": "vCPE", + "relationship-list": { + "relationship": [ + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/xyzcloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "xyzcloud" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "693c7729b2364a26a3ca602e6f66187d" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "admin" + } + ] + } + ] + } + } + ] + } +} diff --git a/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/owning-entity.json b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/owning-entity.json new file mode 100644 index 00000000..7248d41d --- /dev/null +++ b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/owning-entity.json @@ -0,0 +1,4 @@ +{ + "owning-entity-id": "oe_1", + "owning-entity-name": "oe_2" +} diff --git a/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/project.json b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/project.json new file mode 100644 index 00000000..146a1e26 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/aai-simulator-populate-data/project.json @@ -0,0 +1,4 @@ +{ + "project-name": "etsiCsitProject" +} + diff --git a/plans/so/integration-etsi-testing/config/apply-workarounds.sh b/plans/so/integration-etsi-testing/config/apply-workarounds.sh index 4200a361..21a3aeb8 100755 --- a/plans/so/integration-etsi-testing/config/apply-workarounds.sh +++ b/plans/so/integration-etsi-testing/config/apply-workarounds.sh @@ -87,6 +87,9 @@ apply_workaround() echo "$SCRIPT_NAME $(current_timestamp): Will insert data into $CATALOG_DB" mysql -h $DB_HOST -uroot -p$MYSQL_ROOT_PASSWORD $CATALOG_DB << EOF BEGIN; + + UPDATE $NORTH_BOUND_TABLE_NAME SET SERVICE_TYPE="*"; + INSERT INTO $BUIDLING_BLOCK_TABLE_NAME (BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) values ("EtsiVnfInstantiateBB", "VNF", "ACTIVATE"); INSERT INTO $BUIDLING_BLOCK_TABLE_NAME (BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) values ("EtsiVnfDeleteBB", "VNF", "DEACTIVATE"); diff --git a/plans/so/integration-etsi-testing/config/env b/plans/so/integration-etsi-testing/config/env index 9b6dc557..5334c8cb 100644 --- a/plans/so/integration-etsi-testing/config/env +++ b/plans/so/integration-etsi-testing/config/env @@ -1,3 +1,4 @@ NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 TAG=1.4.0-STAGING-latest TIME_OUT_DEFAULT_VALUE_SEC=1200 +PROJECT_NAME=etsiintegrationtesting diff --git a/plans/so/integration-etsi-testing/config/populate-aai-simulator.sh b/plans/so/integration-etsi-testing/config/populate-aai-simulator.sh new file mode 100755 index 00000000..1a00f710 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/populate-aai-simulator.sh @@ -0,0 +1,99 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 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========================================================= +# + +# @author Gareth Roper (gareth.roper@est.tech) +# @auther Waqas Ikram (waqas.ikram@est.tech) + +SCRIPT_NAME=$(basename $0) +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +WAIT_FOR_SCRIPT=$SCRIPT_HOME/wait-for.sh + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +populate_aai_simulator() +{ + $WAIT_FOR_SCRIPT -t "$TIMEOUT_IN_SECONDS" -h "$AAI_SIMULATOR_HOST" -p "$AAI_SIMULATOR_PORT" + + if [ $? -eq 0 ] + then + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator is Running." + else + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator could not be found. Exiting..." + exit 1 + fi + + BASE_URL="https://$AAI_SIMULATOR_HOST:$AAI_SIMULATOR_PORT/aai/v15" + BASIC_AUTHORIZATION_HEADER="Authorization: Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==" + APPICATION_JSON="application/json" + ACCEPT_HEADER="Accept: $APPICATION_JSON" + CONTENT_TYPE_HEADER="Content-Type: $APPICATION_JSON" + CURL_COMMAND="curl -k -H $BASIC_AUTHORIZATION_HEADER -H $ACCEPT_HEADER -H $CONTENT_TYPE_HEADER" + + AAI_SIMULATOR_DATA_DIR=$SCRIPT_HOME/aai-simulator-populate-data + CUSTOMER_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/customer.json + PROJECT_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/project.json + OWNING_ENTITY_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/owning-entity.json + STATUS_CODE_ACCEPTED="202" + + echo "$SCRIPT_NAME $(current_timestamp): checking health of AAI Simulator" + response=$(curl -k $BASE_URL/healthcheck) + + if [[ "$response" -ne "healthy" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: AAI Simulator health check failed. Response: $response" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator is healthy" + + echo "$SCRIPT_NAME $(current_timestamp): Populating AAI Simulator" + + echo "$SCRIPT_NAME $(current_timestamp): Adding Cloud-Customer Data" + 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/DemoCustomer -X PUT -d @"$CUSTOMER_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put customer data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Project" + 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/projects/project/etsiCsitProject -X PUT -d @"$PROJECT_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put project data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Owning-Entity" + 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/owning-entities/owning-entity/oe_1 -X PUT -d @$"$OWNING_ENTITY_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put owning entity data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator Populated Successfully" +} + +# main body +populate_aai_simulator diff --git a/plans/so/integration-etsi-testing/config/wait-for-aai-config-job.sh b/plans/so/integration-etsi-testing/config/wait-for-aai-config-job.sh new file mode 100755 index 00000000..58a07811 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/wait-for-aai-config-job.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 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========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SLEEP_TIME=5 +SUCCESSFUL_TEXT="AAI Simulator Populated Successfully" +FAILURE_TEXT="ERROR:" +TIME_OUT_TEXT="Time out" +CONTAINER_NAME=$(docker ps -aqf "name=populate-aai-config" --format "{{.Names}}") +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_NAME=$(basename $0) + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# main body +if [ -z $TIME_OUT_DEFAULT_VALUE_SEC ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: Undefined value for TIME_OUT_DEFAULT_VALUE_SEC attribute" + exit 1 +fi + +if [ -z $CONTAINER_NAME ]; then + echo "$SCRIPT_NAME $(current_timestamp): Unable to find docker container id " + exit 1 +fi + +START_TIME_IN_SECONDS=`date +%s` +TIME_OUT_END_TIME_IN_SECONDS=$(($START_TIME_IN_SECONDS+$TIME_OUT_DEFAULT_VALUE_SEC)); + + +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME script Start Time `date -d @$START_TIME_IN_SECONDS`" +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME will time out at `date -d @$TIME_OUT_END_TIME_IN_SECONDS`" + +while [ `date +%s` -lt "$TIME_OUT_END_TIME_IN_SECONDS" ]; do + echo "$(current_timestamp): Waiting for $CONTAINER_NAME to finish ..." + + result=$(docker logs $CONTAINER_NAME 2>&1 | grep -E "$SUCCESSFUL_TEXT|$FAILURE_TEXT|$TIME_OUT_TEXT") + if [ ! -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): Found result: $result" + break; + fi + echo "$(current_timestamp): Sleeping for ${SLEEP_TIME} seconds" + sleep ${SLEEP_TIME} +done + +if [ -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: failed to populate AAI Simulator . . . " + echo "-------------- $CONTAINER_NAME logs -------------" + docker logs $CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +if echo "$result" | grep -E "$FAILURE_TEXT|$TIME_OUT_TEXT"; then + echo "$SCRIPT_NAME $(current_timestamp): populate-aai-simulator.sh failed" + echo "-------------- $CONTAINER_NAME logs -------------" + docker logs $CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +echo "$SCRIPT_NAME $(current_timestamp): Successfully populated AAI Simulator . . ." +exit 0 diff --git a/plans/so/integration-etsi-testing/config/wait-for-container.sh b/plans/so/integration-etsi-testing/config/wait-for-container.sh new file mode 100755 index 00000000..c2cbc262 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/wait-for-container.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 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========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_NAME=$(basename $0) +WAIT_FOR_SCRIPT=$SCRIPT_HOME/wait-for.sh + +# Process the arguments passed to the script +usage() +{ + _msg_="$@" + cat<<-EOF + Command Arguments: + + -n, --name + Mandatory argument. container name + + -p, --project-name + Mandatory argument. project name + + -t, --timeout + Mandatory argument. time out value in seconds (must be number) + + --help + Optional argument. Display this usage. + +EOF + exit 1 +} + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# Called when script is executed with invalid arguments +invalid_arguments() +{ + echo "Missing or invalid option(s):" + echo "$@" + echo "Try --help for more information" + exit 1 +} + +process_arguments() +{ + SHORT_ARGS="n:p:t:" + LONG_ARGS="help,name:,project-name:,timeout:" + + args=$(getopt -o $SHORT_ARGS -l $LONG_ARGS -n "$0" -- "$@" 2>&1 ) + [[ $? -ne 0 ]] && invalid_arguments $( echo " $args"| head -1 ) + [[ $# -eq 0 ]] && invalid_arguments "No options provided" + + eval set -- "$args" + cmd_arg="$0" + + while true; do + case "$1" in + -n|--name) + NAME=$2 + shift 2 ;; + -p|project-name) + PROJECT_NAME=$2 + shift 2 ;; + -t|--timeout) + TIME_OUT=$2 + shift 2 ;; + --help) + usage + exit 0 + ;; + --) + shift + break ;; + *) + echo BAD ARGUMENTS # perhaps error + break ;; + esac + done + + if [ -z "$NAME" ]; then + echo "$SCRIPT_NAME $(current_timestamp): error: Container name must not be empty! $NAME" >&2; exit 1 + fi + + if [ -z "$PROJECT_NAME" ]; then + echo "$SCRIPT_NAME $(current_timestamp): error: project name must not be empty! $PROJECT_NAME" >&2; exit 1 + fi + + regex='^[0-9]+$' + if ! [[ $TIME_OUT =~ $regex ]] ; then + echo "$SCRIPT_NAME $(current_timestamp): error: TIME_OUT must be number $TIME_OUT" >&2; exit 1 + fi + + CONTAINER_NAME=$(docker ps -aqf "name=$NAME" --format "{{.Names}}") + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find container using $NAME" + exit 1 + fi + + HOST_IP=$(docker inspect --format '{{ index .NetworkSettings.Networks "'$PROJECT_NAME'" "IPAddress"}}' $CONTAINER_NAME) + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find HOST IP using project name: $PROJECT_NAME and container name: $CONTAINER_NAME" + exit 1 + fi + + PORT=$(docker port $CONTAINER_NAME | cut -c1-$(docker port $CONTAINER_NAME | grep -aob '/' | grep -oE '[0-9]+')) + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find PORT using project name: $PROJECT_NAME and container name: $CONTAINER_NAME" + exit 1 + fi + + $WAIT_FOR_SCRIPT -t "$TIME_OUT" -h "$HOST_IP" -p "$PORT" + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: wait-for.sh failed ..." + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): finished successfully" +} + +# main body +process_arguments $@ diff --git a/plans/so/integration-etsi-testing/config/wait-for-workaround-job.sh b/plans/so/integration-etsi-testing/config/wait-for-workaround-job.sh index ae6c2f57..035c5e26 100755 --- a/plans/so/integration-etsi-testing/config/wait-for-workaround-job.sh +++ b/plans/so/integration-etsi-testing/config/wait-for-workaround-job.sh @@ -1,4 +1,4 @@ - +#!/bin/bash # # ============LICENSE_START======================================================= # Copyright (C) 2019 Nordix Foundation. diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml index 068349f8..69fb6857 100644 --- a/plans/so/integration-etsi-testing/docker-compose.yml +++ b/plans/so/integration-etsi-testing/docker-compose.yml @@ -343,3 +343,38 @@ services: command: - "/config/apply-workarounds.sh" ################################################################################# + sdnc-simulator: + image: simulators/sdnc-simulator:latest + ports: + - "9994:9994" + environment: + - APP=SDNC-SIMULATOR + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + sdnc-simulator + depends_on: + - mariadb + - vnfm-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" +################################################################################ + populate-aai-config: + image: jobs/workaround-job-container:latest + ports: + - "9995:9995" + volumes: + - ${CONFIG_DIR_PATH}/populate-aai-simulator.sh:/config/populate-aai-simulator.sh + - ${CONFIG_DIR_PATH}/wait-for.sh:/config/wait-for.sh + - ${CONFIG_DIR_PATH}/aai-simulator-populate-data:/config/aai-simulator-populate-data/ + environment: + - AAI_SIMULATOR_HOST=aai-simulator + - AAI_SIMULATOR_PORT=9993 + - TIMEOUT_IN_SECONDS=300 #5 mins + depends_on: + - aai-simulator + command: + - "/config/populate-aai-simulator.sh" +################################################################################ diff --git a/plans/so/integration-etsi-testing/setup.sh b/plans/so/integration-etsi-testing/setup.sh index 597bf2ea..a3eb784c 100755 --- a/plans/so/integration-etsi-testing/setup.sh +++ b/plans/so/integration-etsi-testing/setup.sh @@ -40,6 +40,7 @@ MVN_SETTINGS_XML="$SCRIPT_HOME/settings.xml" MVN_CLEAN_INSTALL="$MVN clean install" SIMULATOR_MAVEN_PROJECT_POM="$SCRIPT_HOME/so-simulators/pom.xml" WAIT_FOR_WORKAROUND_SCRIPT=$CONFIG_DIR/"wait-for-workaround-job.sh" +WAIT_FOR_POPULATE_AAI_SCRIPT=$CONFIG_DIR/"wait-for-aai-config-job.sh" echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." @@ -125,7 +126,7 @@ git clone http://gerrit.onap.org/r/so/docker-config.git $TEST_LAB_DIR_PATH export TEST_LAB_DIR=$TEST_LAB_DIR_PATH export CONFIG_DIR_PATH=$CONFIG_DIR -docker-compose -f $DOCKER_COMPOSE_FILE_PATH up -d +docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d echo "Sleeping for 3m" sleep 3m @@ -140,6 +141,15 @@ if [ $? -ne 0 ]; then exit 1 fi +echo "Will execute $WAIT_FOR_POPULATE_AAI_SCRIPT script" +$WAIT_FOR_POPULATE_AAI_SCRIPT + +if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_POPULATE_AAI_SCRIPT failed" + echo "Will stop running docker containers . . ." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH down + exit 1 +fi REPO_IP='127.0.0.1' ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml index 3dd82228..428aeb7b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml @@ -7,13 +7,16 @@ <version>1.0-SNAPSHOT</version> </parent> <artifactId>aai-simulator</artifactId> - <properties> <version.aai.schema>1.0.0</version.aai.schema> </properties> - <dependencies> <dependency> + <groupId>${project.parent.groupId}</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.onap.aai.schema-service</groupId> <artifactId>aai-schema</artifactId> <version>${version.aai.schema}</version> @@ -38,14 +41,13 @@ <scope>test</scope> </dependency> </dependencies> - <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> - <mainClass>org.onap.so.aai.simulator.AaiSimulatorApplication</mainClass> + <mainClass>org.onap.so.aaisimulator.AaiSimulatorApplication</mainClass> </configuration> <executions> <execution> @@ -61,5 +63,4 @@ </plugin> </plugins> </build> - </project>
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/AaiSimulatorApplication.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/AaiSimulatorApplication.java index 26f52e32..bb1b190d 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/AaiSimulatorApplication.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/AaiSimulatorApplication.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator; +package org.onap.so.aaisimulator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/configration/ApplicationConfigration.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/configration/ApplicationConfigration.java index b1f17796..2a55760b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/configration/ApplicationConfigration.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/configration/ApplicationConfigration.java @@ -17,12 +17,12 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.configration; +package org.onap.so.aaisimulator.configration; -import static org.onap.so.aai.simulator.utils.Constants.CUSTOMER_CACHE; -import static org.onap.so.aai.simulator.utils.Constants.NODES_CACHE; -import static org.onap.so.aai.simulator.utils.Constants.OWNING_ENTITY_CACHE; -import static org.onap.so.aai.simulator.utils.Constants.PROJECT_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.CUSTOMER_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.NODES_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.OWNING_ENTITY_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.PROJECT_CACHE; import java.util.Arrays; import java.util.List; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/configration/WebSecurityConfigImpl.java new file mode 100644 index 00000000..1dc483f7 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/configration/WebSecurityConfigImpl.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.aaisimulator.configration; + +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.simulator.configuration.SimulatorSecurityConfigurer; +import org.onap.so.simulator.model.UserCredentials; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@Configuration +@EnableWebSecurity +public class WebSecurityConfigImpl extends SimulatorSecurityConfigurer { + + @Autowired + public WebSecurityConfigImpl(final UserCredentials userCredentials) { + super(userCredentials.getUsers()); + } + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers(Constants.BUSINESS_URL + "/**/**").authenticated().and() + .httpBasic(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/AaiSimulatorController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/AaiSimulatorController.java index af0a0150..f5912908 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/AaiSimulatorController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/AaiSimulatorController.java @@ -17,11 +17,11 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; -import static org.onap.so.aai.simulator.utils.Constants.HEALTHY; +import static org.onap.so.aaisimulator.utils.Constants.HEALTHY; import javax.ws.rs.core.MediaType; -import org.onap.so.aai.simulator.utils.Constants; +import org.onap.so.aaisimulator.utils.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/BusinessController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java index 0189a427..190d86e6 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/BusinessController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java @@ -17,13 +17,13 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; -import static org.onap.so.aai.simulator.utils.Constants.CUSTOMER_URL; -import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE; -import static org.onap.so.aai.simulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; -import static org.onap.so.aai.simulator.utils.Utils.getRequestErrorResponseEntity; -import static org.onap.so.aai.simulator.utils.Utils.getResourceVersion; +import static org.onap.so.aaisimulator.utils.Constants.CUSTOMER_URL; +import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; +import static org.onap.so.aaisimulator.utils.Utils.getRequestErrorResponseEntity; +import static org.onap.so.aaisimulator.utils.Utils.getResourceVersion; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; @@ -31,9 +31,9 @@ import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.ServiceSubscription; -import org.onap.so.aai.simulator.models.NodeServiceInstance; -import org.onap.so.aai.simulator.service.providers.CustomerCacheServiceProvider; -import org.onap.so.aai.simulator.service.providers.NodesCacheServiceProvider; +import org.onap.so.aaisimulator.models.NodeServiceInstance; +import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider; +import org.onap.so.aaisimulator.service.providers.NodesCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/NodesController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/NodesController.java index 4fa4d408..9e93cc3b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/NodesController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/NodesController.java @@ -17,23 +17,23 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; -import static org.onap.so.aai.simulator.utils.Constants.NODES_URL; -import static org.onap.so.aai.simulator.utils.Constants.RESOURCE_LINK; -import static org.onap.so.aai.simulator.utils.Constants.RESOURCE_TYPE; -import static org.onap.so.aai.simulator.utils.Utils.getRequestErrorResponseEntity; -import java.util.HashMap; +import static org.onap.so.aaisimulator.utils.Constants.NODES_URL; +import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_LINK; +import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.Utils.getRequestErrorResponseEntity; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.so.aai.simulator.models.Format; -import org.onap.so.aai.simulator.models.NodeServiceInstance; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.CustomerCacheServiceProvider; -import org.onap.so.aai.simulator.service.providers.NodesCacheServiceProvider; +import org.onap.so.aaisimulator.models.Format; +import org.onap.so.aaisimulator.models.NodeServiceInstance; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider; +import org.onap.so.aaisimulator.service.providers.NodesCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -67,7 +67,6 @@ public class NodesController { } @GetMapping(value = "/service-instances/service-instance/{service-instance-id}", - consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity<?> getProject(@PathVariable(name = "service-instance-id") final String serviceInstanceId, @RequestParam(name = "format", required = false) final String format, final HttpServletRequest request) { @@ -85,10 +84,10 @@ public class NodesController { switch (value) { case PATHED: LOGGER.info("found project {} in cache", nodeServiceInstance); - final Map<String, Object> map = new HashMap<>(); + final Map<String, Object> map = new LinkedHashMap<>(); map.put(RESOURCE_TYPE, nodeServiceInstance.getResourceType()); map.put(RESOURCE_LINK, nodeServiceInstance.getResourceLink()); - return ResponseEntity.ok(new Result(map)); + return ResponseEntity.ok(new Results(map)); case RAW: final Optional<ServiceInstance> serviceInstance = customerCacheServiceProvider.getServiceInstance(nodeServiceInstance.getGlobalCustomerId(), @@ -103,8 +102,5 @@ public class NodesController { } LOGGER.error("invalid format type :{}", format); return getRequestErrorResponseEntity(request); - - } - } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/OwningEntityController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/OwningEntityController.java index e3d6b4f7..ec6412c2 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/OwningEntityController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/OwningEntityController.java @@ -17,12 +17,12 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; -import static org.onap.so.aai.simulator.utils.Constants.OWNING_ENTITY; -import static org.onap.so.aai.simulator.utils.Constants.OWNING_ENTITY_URL; -import static org.onap.so.aai.simulator.utils.Utils.getRequestErrorResponseEntity; -import static org.onap.so.aai.simulator.utils.Utils.getResourceVersion; +import static org.onap.so.aaisimulator.utils.Constants.OWNING_ENTITY; +import static org.onap.so.aaisimulator.utils.Constants.OWNING_ENTITY_URL; +import static org.onap.so.aaisimulator.utils.Utils.getRequestErrorResponseEntity; +import static org.onap.so.aaisimulator.utils.Utils.getResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -30,9 +30,9 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; import org.onap.aai.domain.yang.OwningEntity; import org.onap.aai.domain.yang.Relationship; -import org.onap.so.aai.simulator.models.Format; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.OwnEntityCacheServiceProvider; +import org.onap.so.aaisimulator.models.Format; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.OwnEntityCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -78,8 +78,7 @@ public class OwningEntityController { return ResponseEntity.accepted().build(); } - @GetMapping(value = "{owning-entity-id}", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, - produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @GetMapping(value = "{owning-entity-id}", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity<?> getOwningEntity(@PathVariable("owning-entity-id") final String owningEntityId, @RequestParam(name = "resultIndex", required = false) final Integer resultIndex, @RequestParam(name = "resultSize", required = false) final Integer resultSize, @@ -101,7 +100,7 @@ public class OwningEntityController { case COUNT: final Map<String, Object> map = new HashMap<>(); map.put(OWNING_ENTITY, 1); - return ResponseEntity.ok(new Result(map)); + return ResponseEntity.ok(new Results(map)); default: break; } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/ProjectController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/ProjectController.java index 0c3b3b7b..8a7c1b8a 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/controller/ProjectController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/ProjectController.java @@ -17,12 +17,12 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; -import static org.onap.so.aai.simulator.utils.Constants.PROJECT; -import static org.onap.so.aai.simulator.utils.Constants.PROJECT_URL; -import static org.onap.so.aai.simulator.utils.Utils.getRequestErrorResponseEntity; -import static org.onap.so.aai.simulator.utils.Utils.getResourceVersion; +import static org.onap.so.aaisimulator.utils.Constants.PROJECT; +import static org.onap.so.aaisimulator.utils.Constants.PROJECT_URL; +import static org.onap.so.aaisimulator.utils.Utils.getRequestErrorResponseEntity; +import static org.onap.so.aaisimulator.utils.Utils.getResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -30,9 +30,9 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; import org.onap.aai.domain.yang.Project; import org.onap.aai.domain.yang.Relationship; -import org.onap.so.aai.simulator.models.Format; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.ProjectCacheServiceProvider; +import org.onap.so.aaisimulator.models.Format; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.ProjectCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -76,8 +76,7 @@ public class ProjectController { } - @GetMapping(value = "/{project-name}", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, - produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @GetMapping(value = "/{project-name}", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public ResponseEntity<?> getProject(@PathVariable("project-name") final String projectName, @RequestParam(name = "resultIndex", required = false) final Integer resultIndex, @RequestParam(name = "resultSize", required = false) final Integer resultSize, @@ -99,7 +98,7 @@ public class ProjectController { case COUNT: final Map<String, Object> map = new HashMap<>(); map.put(PROJECT, 1); - return ResponseEntity.ok(new Result(map)); + return ResponseEntity.ok(new Results(map)); default: break; } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/Format.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/Format.java index f6ff2403..1c851fc3 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/Format.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/Format.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.models; +package org.onap.so.aaisimulator.models; /** * @author waqas.ikram@ericsson.com diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/NodeServiceInstance.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/NodeServiceInstance.java index f549850d..4a645915 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/NodeServiceInstance.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/NodeServiceInstance.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.models; +package org.onap.so.aaisimulator.models; import java.io.Serializable; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/Result.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/Results.java index 6aa92562..8dc20242 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/models/Result.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/models/Results.java @@ -17,26 +17,29 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.models; +package org.onap.so.aaisimulator.models; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.annotation.JsonProperty; /** * @author waqas.ikram@ericsson.com * */ -@JsonRootName(value = "result") -public class Result { +public class Results implements Serializable { + private static final long serialVersionUID = 3967660859271162759L; + + @JsonProperty("results") private List<Map<String, Object>> values = new ArrayList<>(); - public Result() {} + public Results() {} - public Result(final Map<String, Object> value) { + public Results(final Map<String, Object> value) { this.values.add(value); } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/CustomerCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java index 713da545..32d5ca0b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/CustomerCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; import java.util.Optional; import org.onap.aai.domain.yang.Customer; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/CustomerCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java index c3b5a47d..5c022c95 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/CustomerCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; import java.util.List; import java.util.Optional; @@ -27,7 +27,8 @@ import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.ServiceSubscription; import org.onap.aai.domain.yang.ServiceSubscriptions; -import org.onap.so.aai.simulator.utils.Constants; +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -100,16 +101,20 @@ public class CustomerCacheServiceProviderImpl extends AbstractCacheServiceProvid if (serviceSubscription.isPresent()) { LOGGER.info("Found service subscription ..."); - final List<ServiceInstance> serviceInstancesList = serviceSubscription.get().getServiceInstances() - .getServiceInstance().stream() - .filter(serviceInstance -> serviceInstanceName.equals(serviceInstance.getServiceInstanceName())) - .collect(Collectors.toList()); - if (serviceInstancesList != null && !serviceInstancesList.isEmpty()) { - LOGGER.info("Found {} service instances ", serviceInstancesList.size()); - final ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().addAll(serviceInstancesList); - return Optional.of(serviceInstances); - + final ServiceInstances serviceInstances = serviceSubscription.get().getServiceInstances(); + if (serviceInstances != null) { + final List<ServiceInstance> serviceInstancesList = + serviceInstances.getServiceInstance().stream() + .filter(serviceInstance -> serviceInstanceName + .equals(serviceInstance.getServiceInstanceName())) + .collect(Collectors.toList()); + if (serviceInstancesList != null && !serviceInstancesList.isEmpty()) { + LOGGER.info("Found {} service instances ", serviceInstancesList.size()); + final ServiceInstances result = new ServiceInstances(); + result.getServiceInstance().addAll(serviceInstancesList); + return Optional.of(result); + + } } } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/NodesCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/NodesCacheServiceProvider.java index bf444f2f..0dbd45eb 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/NodesCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/NodesCacheServiceProvider.java @@ -17,10 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; import java.util.Optional; -import org.onap.so.aai.simulator.models.NodeServiceInstance; +import org.onap.so.aaisimulator.models.NodeServiceInstance; /** * @author waqas.ikram@ericsson.com diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/NodesCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/NodesCacheServiceProviderImpl.java index 0f0ac114..156abd24 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/NodesCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/NodesCacheServiceProviderImpl.java @@ -17,12 +17,13 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; -import static org.onap.so.aai.simulator.utils.Constants.NODES_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.NODES_CACHE; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; -import org.onap.so.aai.simulator.models.NodeServiceInstance; +import org.onap.so.aaisimulator.models.NodeServiceInstance; +import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/OwnEntityCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/OwnEntityCacheServiceProvider.java index a7b6409c..e34aa70a 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/OwnEntityCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/OwnEntityCacheServiceProvider.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntity; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/OwnEntityCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/OwnEntityCacheServiceProviderImpl.java index 6b7af022..58a8b1e6 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/OwnEntityCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/OwnEntityCacheServiceProviderImpl.java @@ -17,14 +17,15 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; -import static org.onap.so.aai.simulator.utils.Constants.OWNING_ENTITY_CACHE; -import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.Constants.OWNING_ENTITY_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntity; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; +import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/ProjectCacheServiceProvider.java index 59060f27..60f763c7 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/ProjectCacheServiceProvider.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; import java.util.Optional; import org.onap.aai.domain.yang.Project; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/ProjectCacheServiceProviderImpl.java index 4fca3119..3ddefbe6 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/ProjectCacheServiceProviderImpl.java @@ -17,14 +17,15 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.aaisimulator.service.providers; -import static org.onap.so.aai.simulator.utils.Constants.PROJECT_CACHE; -import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.Constants.PROJECT_CACHE; +import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE; import java.util.Optional; import org.onap.aai.domain.yang.Project; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; +import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java index 3d1f85df..f81d6bd1 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/Constants.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; /** * @author waqas.ikram@ericsson.com diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/RequestError.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/RequestError.java index 471e884d..782625f7 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/RequestError.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/RequestError.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/RequestErrorBuilder.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/RequestErrorBuilder.java index 9dbd4a3d..f3742220 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/RequestErrorBuilder.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/RequestErrorBuilder.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; import java.util.Arrays; import java.util.List; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/ServiceException.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/ServiceException.java index ba2ee782..7ba47fa7 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/ServiceException.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/ServiceException.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/Utils.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Utils.java index 81deb86b..1963728c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/utils/Utils.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Utils.java @@ -17,10 +17,10 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; -import static org.onap.so.aai.simulator.utils.Constants.ERROR_MESSAGE; -import static org.onap.so.aai.simulator.utils.Constants.ERROR_MESSAGE_ID; +import static org.onap.so.aaisimulator.utils.Constants.ERROR_MESSAGE; +import static org.onap.so.aaisimulator.utils.Constants.ERROR_MESSAGE_ID; import javax.servlet.http.HttpServletRequest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml index d4f42992..de819447 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/resources/application.yaml @@ -3,15 +3,18 @@ server: tomcat: max-threads: 4 ssl: - key-store: classpath:keystore/org.onap.so.p12 - key-store-password: 'u!@JQoYD])@ykq.NKM,O7iA.' - keyStoreType: PKCS12 + key-store: classpath:keystore/org.onap.so.p12 + key-store-password: u!@JQoYD])@ykq.NKM,O7iA. + keyStoreType: PKCS12 ssl-enable: true - spring: security: - username: aai - #password: aai.onap.org:demo123456! - password: $2a$04$crRntT01fAF4kb48mxlvgu68/silcLg.czC1LxQsKTdWuDBPpO3YO - role: VID -
\ No newline at end of file + users: + - username: aai + #password: aai.onap.org:demo123456! + password: $2a$04$crRntT01fAF4kb48mxlvgu68/silcLg.czC1LxQsKTdWuDBPpO3YO + role: VID + - username: aai@aai.onap.org + #password: demo123456! + password: $2a$04$06VCpDvW5ztE7WOvhhvAtOx7JHLghECyZIzOShIbXLWpnshMva8T6 + role: VID
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java index 59d3a556..610aaa70 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java @@ -17,12 +17,12 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.aai.simulator.utils.Constants; +import org.onap.so.aaisimulator.utils.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java index ed9a129d..e7d07859 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java @@ -17,22 +17,22 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.onap.so.aai.simulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; -import static org.onap.so.aai.simulator.utils.TestConstants.CUSTOMERS_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.GLOBAL_CUSTOMER_ID; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_INSTANCES_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_INSTANCE_ID; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_INSTANCE_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_NAME; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_SUBSCRIPTIONS_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_TYPE; -import static org.onap.so.aai.simulator.utils.TestUtils.getJsonString; +import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; +import static org.onap.so.aaisimulator.utils.TestConstants.CUSTOMERS_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.GLOBAL_CUSTOMER_ID; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCES_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_ID; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_NAME; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_SUBSCRIPTIONS_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_TYPE; +import static org.onap.so.aaisimulator.utils.TestUtils.getJsonString; import java.io.IOException; import java.util.Optional; import java.util.UUID; @@ -43,13 +43,13 @@ import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.ServiceSubscription; -import org.onap.so.aai.simulator.service.providers.CustomerCacheServiceProvider; -import org.onap.so.aai.simulator.utils.Constants; -import org.onap.so.aai.simulator.utils.RequestError; -import org.onap.so.aai.simulator.utils.ServiceException; -import org.onap.so.aai.simulator.utils.TestUtils; +import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider; +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.aaisimulator.utils.RequestError; +import org.onap.so.aaisimulator.utils.ServiceException; +import org.onap.so.aaisimulator.utils.TestUtils; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -83,8 +83,8 @@ public class BusinessControllerTest { @Autowired private TestRestTemplate restTemplate; - @Value("${spring.security.username}") - private String username; + @Autowired + private UserCredentials userCredentials; @Autowired private CustomerCacheServiceProvider cacheServiceProvider; @@ -192,7 +192,7 @@ public class BusinessControllerTest { invokeHttpPut(url, getServiceInstance()); final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL - + "?service-instance-name=" + SERVICE_NAME; + + "?depth=2&service-instance-name=" + SERVICE_NAME; final ResponseEntity<ServiceInstances> actual = restTemplate.exchange(serviceInstanceUrl, HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), ServiceInstances.class); @@ -208,6 +208,28 @@ public class BusinessControllerTest { } @Test + public void test_getSericeInstance_usingServiceInstanceName_returnRequestErrorIfnoServiceInstanceFound() + throws Exception { + + + final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer()); + + assertEquals(HttpStatus.ACCEPTED, response.getStatusCode()); + + final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL + + "?depth=2&service-instance-name=" + SERVICE_NAME; + + final ResponseEntity<RequestError> actual = restTemplate.exchange(serviceInstanceUrl, HttpMethod.GET, + new HttpEntity<>(getHttpHeaders()), RequestError.class); + + assertEquals(HttpStatus.NOT_FOUND, actual.getStatusCode()); + assertTrue(actual.hasBody()); + + assertNotNull(actual.getBody().getServiceException()); + + } + + @Test public void test_getSericeInstance_usingServiceInstanceId_ableToRetrieveServiceInstanceFromCache() throws Exception { @@ -384,7 +406,7 @@ public class BusinessControllerTest { } private HttpHeaders getHttpHeaders() { - return TestUtils.getHttpHeaders(username); + return TestUtils.getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername()); } private String getServiceInstance() throws Exception, IOException { diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/NodesControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java index 5ea6dff0..e67d0987 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/NodesControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java @@ -17,35 +17,35 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.onap.so.aai.simulator.utils.Constants.RESOURCE_LINK; -import static org.onap.so.aai.simulator.utils.Constants.RESOURCE_TYPE; -import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE; -import static org.onap.so.aai.simulator.utils.TestConstants.CUSTOMERS_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_INSTANCE_ID; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_INSTANCE_URL; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_NAME; -import static org.onap.so.aai.simulator.utils.TestConstants.SERVICE_SUBSCRIPTIONS_URL; -import static org.onap.so.aai.simulator.utils.TestUtils.getJsonString; +import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_LINK; +import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE; +import static org.onap.so.aaisimulator.utils.TestConstants.CUSTOMERS_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_ID; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_URL; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_NAME; +import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_SUBSCRIPTIONS_URL; +import static org.onap.so.aaisimulator.utils.TestUtils.getJsonString; import java.io.IOException; import java.util.Map; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.so.aai.simulator.models.Format; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.CustomerCacheServiceProvider; -import org.onap.so.aai.simulator.service.providers.NodesCacheServiceProvider; -import org.onap.so.aai.simulator.utils.Constants; -import org.onap.so.aai.simulator.utils.TestUtils; +import org.onap.so.aaisimulator.models.Format; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider; +import org.onap.so.aaisimulator.service.providers.NodesCacheServiceProvider; +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.aaisimulator.utils.TestUtils; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -75,8 +75,8 @@ public class NodesControllerTest { @Autowired private TestRestTemplate restTemplate; - @Value("${spring.security.username}") - private String username; + @Autowired + private UserCredentials userCredentials; @Autowired private NodesCacheServiceProvider nodesCacheServiceProvider; @@ -130,14 +130,14 @@ public class NodesControllerTest { final ResponseEntity<Void> response2 = invokeHttpPut(url, getServiceInstance()); assertEquals(HttpStatus.ACCEPTED, response2.getStatusCode()); - final ResponseEntity<Result> actual = restTemplate.exchange( + final ResponseEntity<Results> actual = restTemplate.exchange( getNodesEndPointUrl() + SERVICE_INSTANCE_URL + "?format=" + Format.PATHED.getValue(), HttpMethod.GET, - new HttpEntity<>(getHttpHeaders()), Result.class); + new HttpEntity<>(getHttpHeaders()), Results.class); assertEquals(HttpStatus.OK, actual.getStatusCode()); assertTrue(actual.hasBody()); - final Result result = actual.getBody(); + final Results result = actual.getBody(); assertNotNull(result.getValues()); assertFalse(result.getValues().isEmpty()); @@ -175,6 +175,6 @@ public class NodesControllerTest { } private HttpHeaders getHttpHeaders() { - return TestUtils.getHttpHeaders(username); + return TestUtils.getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername()); } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/OwningEntityControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java index bbb2cad7..7aabc665 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/OwningEntityControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java @@ -17,29 +17,29 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.onap.so.aai.simulator.utils.TestConstants.RELATIONSHIP_URL; -import static org.onap.so.aai.simulator.utils.TestUtils.getFile; -import static org.onap.so.aai.simulator.utils.TestUtils.getHttpHeaders; -import static org.onap.so.aai.simulator.utils.TestUtils.getJsonString; +import static org.onap.so.aaisimulator.utils.TestConstants.RELATIONSHIP_URL; +import static org.onap.so.aaisimulator.utils.TestUtils.getFile; +import static org.onap.so.aaisimulator.utils.TestUtils.getHttpHeaders; +import static org.onap.so.aaisimulator.utils.TestUtils.getJsonString; import java.io.IOException; import java.nio.file.Files; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.domain.yang.OwningEntity; -import org.onap.so.aai.simulator.models.Format; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.OwnEntityCacheServiceProvider; -import org.onap.so.aai.simulator.utils.Constants; -import org.onap.so.aai.simulator.utils.TestUtils; +import org.onap.so.aaisimulator.models.Format; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.OwnEntityCacheServiceProvider; +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.aaisimulator.utils.TestUtils; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -74,8 +74,8 @@ public class OwningEntityControllerTest { @Autowired private TestRestTemplate restTemplate; - @Value("${spring.security.username}") - private String username; + @Autowired + private UserCredentials userCredentials; @Autowired private OwnEntityCacheServiceProvider cacheServiceProvider; @@ -112,12 +112,12 @@ public class OwningEntityControllerTest { assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode()); - final ResponseEntity<Result> actualResponse = - invokeHttpGet(url + "?resultIndex=0&resultSize=1&format=" + Format.COUNT.getValue(), Result.class); + final ResponseEntity<Results> actualResponse = + invokeHttpGet(url + "?resultIndex=0&resultSize=1&format=" + Format.COUNT.getValue(), Results.class); assertEquals(HttpStatus.OK, actualResponse.getStatusCode()); assertTrue(actualResponse.hasBody()); - final Result result = actualResponse.getBody(); + final Results result = actualResponse.getBody(); assertNotNull(result.getValues()); assertFalse(result.getValues().isEmpty()); assertEquals(1, result.getValues().get(0).get(Constants.OWNING_ENTITY)); @@ -153,7 +153,11 @@ public class OwningEntityControllerTest { } private <T> ResponseEntity<T> invokeHttpGet(final String url, final Class<T> clazz) { - return restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders(username)), clazz); + return restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders(getUsername())), clazz); + } + + private String getUsername() { + return userCredentials.getUsers().iterator().next().getUsername(); } private ResponseEntity<Void> invokeHttpPut(final String url, final Object obj) { @@ -162,7 +166,7 @@ public class OwningEntityControllerTest { } private HttpEntity<?> getHttpEntity(final Object obj) { - return new HttpEntity<>(obj, getHttpHeaders(username)); + return new HttpEntity<>(obj, getHttpHeaders(getUsername())); } private String getOwningEntityEndPointUrl() { diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java index ba6ad978..d4f686db 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java @@ -17,27 +17,27 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller; +package org.onap.so.aaisimulator.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.onap.so.aai.simulator.utils.TestUtils.getFile; -import static org.onap.so.aai.simulator.utils.TestUtils.getHttpHeaders; -import static org.onap.so.aai.simulator.utils.TestUtils.getJsonString; +import static org.onap.so.aaisimulator.utils.TestUtils.getFile; +import static org.onap.so.aaisimulator.utils.TestUtils.getHttpHeaders; +import static org.onap.so.aaisimulator.utils.TestUtils.getJsonString; import java.io.IOException; import java.nio.file.Files; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.domain.yang.Project; -import org.onap.so.aai.simulator.models.Result; -import org.onap.so.aai.simulator.service.providers.ProjectCacheServiceProvider; -import org.onap.so.aai.simulator.utils.Constants; -import org.onap.so.aai.simulator.utils.TestUtils; +import org.onap.so.aaisimulator.models.Results; +import org.onap.so.aaisimulator.service.providers.ProjectCacheServiceProvider; +import org.onap.so.aaisimulator.utils.Constants; +import org.onap.so.aaisimulator.utils.TestUtils; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -74,8 +74,8 @@ public class ProjectControllerTest { @Autowired private TestRestTemplate restTemplate; - @Value("${spring.security.username}") - private String username; + @Autowired + private UserCredentials userCredentials; @Autowired private ProjectCacheServiceProvider cacheServiceProvider; @@ -135,19 +135,19 @@ public class ProjectControllerTest { assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode()); - final ResponseEntity<Result> actualResponse = - invokeHttpGet(url + "?resultIndex=0&resultSize=1&format=count", Result.class); + final ResponseEntity<Results> actualResponse = + invokeHttpGet(url + "?resultIndex=0&resultSize=1&format=count", Results.class); assertEquals(HttpStatus.OK, actualResponse.getStatusCode()); assertTrue(actualResponse.hasBody()); - final Result result = actualResponse.getBody(); + final Results result = actualResponse.getBody(); assertNotNull(result.getValues()); assertFalse(result.getValues().isEmpty()); assertEquals(1, result.getValues().get(0).get(Constants.PROJECT)); } private <T> ResponseEntity<T> invokeHttpGet(final String url, final Class<T> clazz) { - return restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders(username)), clazz); + return restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders(getUsername())), clazz); } private ResponseEntity<Void> invokeHttpPut(final String url, final Object obj) { @@ -156,7 +156,11 @@ public class ProjectControllerTest { } private HttpEntity<?> getHttpEntity(final Object obj) { - return new HttpEntity<>(obj, getHttpHeaders(username)); + return new HttpEntity<>(obj, getHttpHeaders(getUsername())); + } + + private String getUsername() { + return userCredentials.getUsers().iterator().next().getUsername(); } private String getProjectEndPointUrl() { diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/configuration/TestRestTemplateConfigration.java index 6e8ccac6..7683721c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/configuration/TestRestTemplateConfigration.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.controller.configuration; +package org.onap.so.aaisimulator.controller.configuration; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/utils/TestConstants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java index f57c946d..f59e8b58 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/utils/TestConstants.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java @@ -17,7 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; + +import org.onap.so.aaisimulator.utils.Constants; /** * @author waqas.ikram@ericsson.com diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/utils/TestUtils.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestUtils.java index 73e43b10..4dfe9c2c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/utils/TestUtils.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestUtils.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.utils; +package org.onap.so.aaisimulator.utils; import java.io.File; import java.io.IOException; @@ -33,7 +33,6 @@ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; * @author waqas.ikram@ericsson.com * */ - public class TestUtils { private static final String PASSWORD = "aai.onap.org:demo123456!"; diff --git a/plans/so/integration-etsi-testing/so-simulators/common/pom.xml b/plans/so/integration-etsi-testing/so-simulators/common/pom.xml new file mode 100644 index 00000000..497e8213 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/common/pom.xml @@ -0,0 +1,38 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.simulators</groupId> + <artifactId>so-simulators</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>common</artifactId> + <properties> + <version.equalsverifier>2.5.1</version.equalsverifier> + <version.openpojo>0.8.6</version.openpojo> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>nl.jqno.equalsverifier</groupId> + <artifactId>equalsverifier</artifactId> + <version>${version.equalsverifier}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.openpojo</groupId> + <artifactId>openpojo</artifactId> + <version>${version.openpojo}</version> + </dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/AbstractCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/cache/provider/AbstractCacheServiceProvider.java index 4a45e81e..ae31a3ff 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/AbstractCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/cache/provider/AbstractCacheServiceProvider.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.service.providers; +package org.onap.so.simulator.cache.provider; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; @@ -26,8 +26,7 @@ import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; /** - * @author waqas.ikram@ericsson.com - * + * @author Waqas Ikram (waqas.ikram@ericsson.com) */ public abstract class AbstractCacheServiceProvider { diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/configuration/SimulatorSecurityConfigurer.java index a4a1fb11..5d59cbbd 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/configration/WebSecurityConfigImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/configuration/SimulatorSecurityConfigurer.java @@ -17,16 +17,16 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.aai.simulator.configration; +package org.onap.so.simulator.configuration; -import org.onap.so.aai.simulator.utils.Constants; +import java.util.List; +import org.onap.so.simulator.model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @@ -34,27 +34,14 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; * @author waqas.ikram@ericsson.com * */ -@Configuration -@EnableWebSecurity -public class WebSecurityConfigImpl extends WebSecurityConfigurerAdapter { +public abstract class SimulatorSecurityConfigurer extends WebSecurityConfigurerAdapter { + private static final Logger LOGGER = LoggerFactory.getLogger(SimulatorSecurityConfigurer.class); - private final String username; - private final String password; - private final String role; - - public WebSecurityConfigImpl(@Value("${spring.security.username}") final String username, - @Value("${spring.security.password}") final String password, - @Value("${spring.security.role}") final String role) { - this.username = username; - this.password = password; - this.role = role; - } + private final List<User> users; - @Override - protected void configure(final HttpSecurity http) throws Exception { - http.csrf().disable().authorizeRequests().antMatchers(Constants.BUSINESS_URL + "/**/**").authenticated().and() - .httpBasic(); + public SimulatorSecurityConfigurer(final List<User> users) { + this.users = users; } @Bean @@ -64,8 +51,15 @@ public class WebSecurityConfigImpl extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).withUser(username).password(password) - .roles(role); + final InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> inMemoryAuthentication = + auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()); + for (int index = 0; index < users.size(); index++) { + final User user = users.get(index); + LOGGER.info("Adding {} to InMemoryUserDetailsManager ...", user); + inMemoryAuthentication.withUser(user.getUsername()).password(user.getPassword()).roles(user.getRole()); + if (index < users.size()) { + inMemoryAuthentication.and(); + } + } } - } diff --git a/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/User.java b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/User.java new file mode 100644 index 00000000..48d5622a --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/User.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.simulator.model; + +import static org.springframework.util.ObjectUtils.nullSafeEquals; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class User { + private String username; + private String password; + private String role; + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(final String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(final String password) { + this.password = password; + } + + /** + * @return the role + */ + public String getRole() { + return role; + } + + /** + * @param role the role to set + */ + public void setRole(final String role) { + this.role = role; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((password == null) ? 0 : password.hashCode()); + result = prime * result + ((role == null) ? 0 : role.hashCode()); + result = prime * result + ((username == null) ? 0 : username.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof User) { + final User other = (User) obj; + return nullSafeEquals(this.username, other.username) && nullSafeEquals(this.password, other.password) + && nullSafeEquals(this.role, other.role); + } + return false; + } + + @Override + public String toString() { + return "UserCredential [username=" + username + ", password=" + password + ", role=" + role + "]"; + } + + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/UserCredentials.java b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/UserCredentials.java new file mode 100644 index 00000000..f12c2475 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/common/src/main/java/org/onap/so/simulator/model/UserCredentials.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.simulator.model; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Component +@ConfigurationProperties(prefix = "spring.security") +public class UserCredentials { + + private final List<User> users = new ArrayList<>(); + + public List<User> getUsers() { + return users; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((users == null) ? 0 : users.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + + if (obj instanceof UserCredentials) { + final UserCredentials other = (UserCredentials) obj; + return ObjectUtils.nullSafeEquals(users, other.users); + } + + return false; + } + + @Override + public String toString() { + return "UserCredentials [userCredentials=" + users + "]"; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/common/src/test/java/org/onap/so/simulator/model/PojoClassesTest.java b/plans/so/integration-etsi-testing/so-simulators/common/src/test/java/org/onap/so/simulator/model/PojoClassesTest.java new file mode 100644 index 00000000..8ae9b8b7 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/common/src/test/java/org/onap/so/simulator/model/PojoClassesTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.simulator.model; + +import org.junit.Test; +import org.onap.so.simulator.model.UserCredentials; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; +import nl.jqno.equalsverifier.EqualsVerifier; +import nl.jqno.equalsverifier.Warning; + + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class PojoClassesTest { + + @Test + public void test_UserCredentials_class() throws ClassNotFoundException { + verify(UserCredentials.class); + validate(UserCredentials.class); + } + + @Test + public void test_User_class() throws ClassNotFoundException { + verify(User.class); + validate(User.class); + } + + private void validate(final Class<?> clazz) { + final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); + validator.validate(PojoClassFactory.getPojoClass(clazz)); + } + + private void verify(final Class<?> clazz) { + EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS).verify(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml index 755e5418..8cf8c7f5 100644 --- a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml @@ -76,6 +76,29 @@ </assembly> </build> </image> + <image> + <name>simulators/sdnc-simulator</name> + <build> + <cleanup>try</cleanup> + <dockerFileDir>docker-files</dockerFileDir> + <dockerFile>Dockerfile.so-simulator-base-image</dockerFile> + <tags> + <tag>${project.version}</tag> + </tags> + <assembly> + <inline> + <dependencySets> + <dependencySet> + <includes> + <include>org.onap.so.simulators:sdnc-simulator</include> + </includes> + <outputFileNameMapping>app.jar</outputFileNameMapping> + </dependencySet> + </dependencySets> + </inline> + </assembly> + </build> + </image> </images> </configuration> <executions> @@ -110,14 +133,19 @@ </build> <dependencies> <dependency> - <groupId>org.onap.so.simulators</groupId> + <groupId>${project.parent.groupId}</groupId> <artifactId>sdc-simulator</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.so.simulators</groupId> + <groupId>${project.parent.groupId}</groupId> <artifactId>aai-simulator</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>${project.parent.groupId}</groupId> + <artifactId>sdnc-simulator</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/pom.xml b/plans/so/integration-etsi-testing/so-simulators/pom.xml index c18e1709..08d962b7 100644 --- a/plans/so/integration-etsi-testing/so-simulators/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/pom.xml @@ -17,8 +17,10 @@ </properties> <modules> + <module>common</module> <module>sdc-simulator</module> <module>aai-simulator</module> + <module>sdnc-simulator</module> <module>package</module> </modules> diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml index e5cc3d32..27e7c3ea 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml @@ -26,7 +26,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> - <mainClass>org.onap.so.sdc.simulator.SdcSimulatorApplication</mainClass> + <mainClass>org.onap.so.sdcsimulator.SdcSimulatorApplication</mainClass> </configuration> <executions> <execution> diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/utils/Constants.java deleted file mode 100644 index 4fa06881..00000000 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/utils/Constants.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ============LICENSE_START======================================================= Copyright (C) 2019 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.so.sdc.simulator.utils; - -/** - * @author Waqas Ikram (waqas.ikram@est.tech) - */ -public class Constants { - - public static final String BASE_URL = "/sdc/v1"; - - public static final String CATALOG_URL = BASE_URL + "/catalog"; - - public static final String HEALTHY = "healthy"; - - public static final String DEFAULT_CSAR_NAME = "default_csar_file"; - - public static final String DOT = "."; - - public static final String DOT_CSAR = DOT + "csar"; - - public static final String DEFAULT_CSAR_NAME_WITH_EXT = DEFAULT_CSAR_NAME + DOT_CSAR; - - public static final String DEFAULT_CSAR_PATH = "/csar/" + DEFAULT_CSAR_NAME_WITH_EXT; - - - private Constants() {} -} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/SdcSimulatorApplication.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/SdcSimulatorApplication.java index abb183b1..25d21e53 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/SdcSimulatorApplication.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/SdcSimulatorApplication.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator; +package org.onap.so.sdcsimulator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java index bf971785..b2c51369 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/configration/WebSecurityConfigImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java @@ -17,9 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.configration; +package org.onap.so.sdcsimulator.configration; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.utils.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/CatalogController.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java index 01c0b39f..60c1865d 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/CatalogController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java @@ -17,27 +17,27 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.controller; +package org.onap.so.sdcsimulator.controller; -import static org.onap.so.sdc.simulator.utils.Constants.CATALOG_URL; +import static org.onap.so.sdcsimulator.utils.Constants.CATALOG_URL; import java.util.Optional; import javax.ws.rs.core.MediaType; -import org.onap.so.sdc.simulator.providers.ResourceProvider; +import org.onap.so.sdcsimulator.providers.ResourceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; /** * @author Waqas Ikram (waqas.ikram@est.tech) * */ -@RestController +@Controller @RequestMapping(path = CATALOG_URL) public class CatalogController { private static final Logger LOGGER = LoggerFactory.getLogger(CatalogController.class); diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/SdcSimulatorController.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/SdcSimulatorController.java index 2baf2038..662c0bda 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/controller/SdcSimulatorController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/SdcSimulatorController.java @@ -18,27 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.controller; +package org.onap.so.sdcsimulator.controller; import javax.ws.rs.core.MediaType; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.utils.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; /** * @author Waqas Ikram (waqas.ikram@est.tech) */ -@RestController +@Controller @RequestMapping(path = Constants.BASE_URL) public class SdcSimulatorController { private static final Logger LOGGER = LoggerFactory.getLogger(SdcSimulatorController.class); - @GetMapping(value = "/healthcheck", produces = MediaType.APPLICATION_JSON) + @ResponseBody + @GetMapping(value = "/healthcheck", produces = MediaType.TEXT_PLAIN) @ResponseStatus(code = HttpStatus.OK) public String healthCheck() { LOGGER.info("Running health check ..."); diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/providers/ResourceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java index 83994b4b..4d5dcdd0 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/providers/ResourceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.providers; +package org.onap.so.sdcsimulator.providers; import java.io.IOException; import java.io.InputStream; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/providers/ResourceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java index efc98de7..192ac896 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdc/simulator/providers/ResourceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.providers; +package org.onap.so.sdcsimulator.providers; import java.io.IOException; import java.io.InputStream; @@ -26,7 +26,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.utils.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java new file mode 100644 index 00000000..e8412574 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdcsimulator.utils; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + */ +public class Constants { + + public static final String BASE_URL = "/sdc/v1"; + + public static final String CATALOG_URL = BASE_URL + "/catalog"; + + public static final String HEALTHY = "healthy"; + + public static final String DEFAULT_CSAR_NAME = "default_csar_file"; + + public static final String DOT = "."; + + public static final String DOT_CSAR = DOT + "csar"; + + public static final String DEFAULT_CSAR_NAME_WITH_EXT = DEFAULT_CSAR_NAME + DOT_CSAR; + + public static final String DEFAULT_CSAR_PATH = "/csar/" + DEFAULT_CSAR_NAME_WITH_EXT; + + private Constants() {} +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/CatalogControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java index 98ec448e..ca55f495 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/CatalogControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.controller; +package org.onap.so.sdcsimulator.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -27,8 +27,9 @@ import java.util.Optional; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.onap.so.sdc.simulator.providers.ResourceProvider; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.controller.CatalogController; +import org.onap.so.sdcsimulator.providers.ResourceProvider; +import org.onap.so.sdcsimulator.utils.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/SdcSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/SdcSimulatorControllerTest.java index 300b62a8..9789f812 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/controller/SdcSimulatorControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/SdcSimulatorControllerTest.java @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.controller; +package org.onap.so.sdcsimulator.controller; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.utils.Constants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/providers/ResourceProviderImplTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java index b112c403..e575f2a5 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdc/simulator/providers/ResourceProviderImplTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.sdc.simulator.providers; +package org.onap.so.sdcsimulator.providers; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertFalse; @@ -30,7 +30,8 @@ import java.nio.file.Path; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.so.sdc.simulator.utils.Constants; +import org.onap.so.sdcsimulator.providers.ResourceProviderImpl; +import org.onap.so.sdcsimulator.utils.Constants; import org.springframework.core.io.ClassPathResource; import org.springframework.util.StreamUtils; diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/pom.xml new file mode 100644 index 00000000..0806d88c --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/pom.xml @@ -0,0 +1,68 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.simulators</groupId> + <artifactId>so-simulators</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>sdnc-simulator</artifactId> + <name>${project.artifactId}</name> + <properties> + <version.generic-resource-api-client>1.5.2</version.generic-resource-api-client> + </properties> + <dependencies> + <dependency> + <groupId>${project.parent.groupId}</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api-client</artifactId> + <version>${version.generic-resource-api-client}</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <mainClass>org.onap.so.sdncsimulator.SdncSimulatorApplication</mainClass> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/SdncSimulatorApplication.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/SdncSimulatorApplication.java new file mode 100644 index 00000000..f6b6938c --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/SdncSimulatorApplication.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@SpringBootApplication(scanBasePackages = {"org.onap"}) +public class SdncSimulatorApplication extends SpringBootServletInitializer { + + public static void main(final String[] args) { + SpringApplication.run(SdncSimulatorApplication.class, args); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/ApplicationConfigration.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/ApplicationConfigration.java new file mode 100644 index 00000000..d51bd023 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/ApplicationConfigration.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.configration; + +import static org.onap.so.sdncsimulator.utils.Constants.SERVICE_TOPOLOGY_OPERATION_CACHE; +import java.util.Arrays; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCache; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Configuration +public class ApplicationConfigration { + + @Bean + public CacheManager cacheManager() { + final SimpleCacheManager manager = new SimpleCacheManager(); + manager.setCaches(Arrays.asList(getCache(SERVICE_TOPOLOGY_OPERATION_CACHE))); + return manager; + } + + private Cache getCache(final String name) { + return new ConcurrentMapCache(name); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/WebSecurityConfigImpl.java new file mode 100644 index 00000000..261b66d7 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/configration/WebSecurityConfigImpl.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.configration; + +import static org.onap.so.sdncsimulator.utils.Constants.OPERATIONS_URL; +import org.onap.so.simulator.configuration.SimulatorSecurityConfigurer; +import org.onap.so.simulator.model.UserCredentials; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@Configuration +@EnableWebSecurity +public class WebSecurityConfigImpl extends SimulatorSecurityConfigurer { + + @Autowired + public WebSecurityConfigImpl(final UserCredentials userCredentials) { + super(userCredentials.getUsers()); + } + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers(OPERATIONS_URL + "/**/**").authenticated().and() + .httpBasic(); + } + +} 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 new file mode 100644 index 00000000..00740298 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.controller; + +import static org.onap.so.sdncsimulator.utils.Constants.OPERATIONS_URL; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.MediaType; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.so.sdncsimulator.models.InputRequest; +import org.onap.so.sdncsimulator.models.Output; +import org.onap.so.sdncsimulator.models.OutputRequest; +import org.onap.so.sdncsimulator.providers.ServiceOperationsCacheServiceProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Controller +@RequestMapping(path = OPERATIONS_URL) +public class OperationsController { + + private static final Logger LOGGER = LoggerFactory.getLogger(OperationsController.class); + + private final ServiceOperationsCacheServiceProvider cacheServiceProvider; + + @Autowired + public OperationsController(final ServiceOperationsCacheServiceProvider cacheServiceProvider) { + this.cacheServiceProvider = cacheServiceProvider; + } + + @PostMapping(value = "/GENERIC-RESOURCE-API:service-topology-operation/", + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity<?> postServiceOperationInformation( + @RequestBody final InputRequest<GenericResourceApiServiceOperationInformation> inputRequest, + final HttpServletRequest request) { + LOGGER.info("Request Received {} ...", inputRequest); + + final GenericResourceApiServiceOperationInformation apiServiceOperationInformation = inputRequest.getInput(); + + if (apiServiceOperationInformation == null) { + return ResponseEntity.badRequest().build(); + } + + final Output output = cacheServiceProvider.putServiceOperationInformation(apiServiceOperationInformation); + final OutputRequest outputRequest = new OutputRequest(output); + + if (output.getResponseCode().equals(HttpStatus.OK.toString())) { + return ResponseEntity.ok(outputRequest); + } + + return ResponseEntity.badRequest().body(outputRequest); + + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/SdncSimulatorController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/SdncSimulatorController.java new file mode 100644 index 00000000..98655e10 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/SdncSimulatorController.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.controller; + +import javax.ws.rs.core.MediaType; +import org.onap.so.sdncsimulator.utils.Constants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Controller +@RequestMapping(path = Constants.BASE_URL) +public class SdncSimulatorController { + private static final Logger LOGGER = LoggerFactory.getLogger(SdncSimulatorController.class); + + @ResponseBody + @GetMapping(value = "/healthcheck", produces = MediaType.TEXT_PLAIN) + @ResponseStatus(code = HttpStatus.OK) + public String healthCheck() { + LOGGER.info("Running health check ..."); + return Constants.HEALTHY; + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/InputRequest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/InputRequest.java new file mode 100644 index 00000000..d4e83fce --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/InputRequest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.models; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class InputRequest<T> { + + private T input; + + /** + * @return the input + */ + public T getInput() { + return input; + } + + /** + * @param input the input to set + */ + public void setInput(final T input) { + this.input = input; + } + + @JsonIgnore + @Override + public String toString() { + return "Input [input=" + input + "]"; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java new file mode 100644 index 00000000..554989db --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.models; + +import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class Output { + + @JsonProperty("response-message") + private String responseMessage; + + @JsonProperty("ack-final-indicator") + private String ackFinalIndicator; + + @JsonProperty("svc-request-id") + private String svcRequestId; + + @JsonProperty("response-code") + private String responseCode; + + @JsonProperty("service-response-information") + private GenericResourceApiInstanceReference serviceResponseInformation = null; + + /** + * @return the responseMessage + */ + public String getResponseMessage() { + return responseMessage; + } + + /** + * @param responseMessage the responseMessage to set + */ + public void setResponseMessage(final String responseMessage) { + this.responseMessage = responseMessage; + } + + /** + * @return the ackFinalIndicator + */ + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + /** + * @param ackFinalIndicator the ackFinalIndicator to set + */ + public void setAckFinalIndicator(final String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + /** + * @return the svcRequestId + */ + public String getSvcRequestId() { + return svcRequestId; + } + + /** + * @param svcRequestId the svcRequestId to set + */ + public void setSvcRequestId(final String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + /** + * @return the responseCode + */ + public String getResponseCode() { + return responseCode; + } + + /** + * @param responseCode the responseCode to set + */ + public void setResponseCode(final String responseCode) { + this.responseCode = responseCode; + } + + /** + * @return the serviceResponseInformation + */ + public GenericResourceApiInstanceReference getServiceResponseInformation() { + return serviceResponseInformation; + } + + /** + * @param serviceResponseInformation the serviceResponseInformation to set + */ + public void setServiceResponseInformation(final GenericResourceApiInstanceReference serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + } + + public Output responseMessage(final String responseMessage) { + this.responseMessage = responseMessage; + return this; + } + + public Output ackFinalIndicator(final String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + return this; + } + + public Output svcRequestId(final String svcRequestId) { + this.svcRequestId = svcRequestId; + return this; + } + + public Output responseCode(final String responseCode) { + this.responseCode = responseCode; + return this; + } + + public Output serviceResponseInformation(final GenericResourceApiInstanceReference serviceResponseInformation) { + this.serviceResponseInformation = serviceResponseInformation; + return this; + } + + + @JsonIgnore + @Override + public String toString() { + return "OutputRequest [responseMessage=" + responseMessage + ", ackFinalIndicator=" + ackFinalIndicator + + ", svcRequestId=" + svcRequestId + ", responseCode=" + responseCode + ", serviceResponseInformation=" + + serviceResponseInformation + "]"; + } + + + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java new file mode 100644 index 00000000..97d20568 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ + +public class OutputRequest { + @JsonProperty("output") + private Output output; + + public OutputRequest() {} + + public OutputRequest(final Output output) { + this.output = output; + } + + + public Output getOutput() { + return output; + } + + public void setOutput(final Output output) { + this.output = output; + } + + @Override + public String toString() { + return "OutputRequest [output=" + output + "]"; + } + +} 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 new file mode 100644 index 00000000..a0116c48 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.providers; + +import java.util.Optional; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceModelInfrastructure; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.so.sdncsimulator.models.Output; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public interface ServiceOperationsCacheServiceProvider { + + Output putServiceOperationInformation( + final GenericResourceApiServiceOperationInformation apiServiceOperationInformation); + + Optional<GenericResourceApiServiceModelInfrastructure> getGenericResourceApiServiceModelInfrastructure( + final String serviceInstanceId); + + void clearAll(); + + +} 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 new file mode 100644 index 00000000..620742ab --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java @@ -0,0 +1,205 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.providers; + +import static org.onap.so.sdncsimulator.utils.Constants.RESTCONF_CONFIG_END_POINT; +import static org.onap.so.sdncsimulator.utils.Constants.SERVICE_TOPOLOGY_OPERATION; +import static org.onap.so.sdncsimulator.utils.Constants.SERVICE_TOPOLOGY_OPERATION_CACHE; +import static org.onap.so.sdncsimulator.utils.Constants.YES; +import static org.onap.so.sdncsimulator.utils.ObjectUtils.getString; +import static org.onap.so.sdncsimulator.utils.ObjectUtils.getStringOrNull; +import static org.onap.so.sdncsimulator.utils.ObjectUtils.isValid; +import java.time.LocalDateTime; +import java.util.Optional; +import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference; +import org.onap.sdnc.northbound.client.model.GenericResourceApiLastActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiLastRpcActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiOperStatusData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiOrderStatusEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestStatusEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRpcActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceModelInfrastructure; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicedataServiceData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicemodelinfrastructureService; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicestatusServiceStatus; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicetopologyServiceTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicetopologyidentifierServiceTopologyIdentifier; +import org.onap.so.sdncsimulator.models.Output; +import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Service +public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServiceProvider + implements ServiceOperationsCacheServiceProvider { + + + private static final Logger LOGGER = LoggerFactory.getLogger(ServiceOperationsCacheServiceProviderimpl.class); + + @Autowired + public ServiceOperationsCacheServiceProviderimpl(final CacheManager cacheManager) { + super(cacheManager); + } + + @Override + public Output putServiceOperationInformation(final GenericResourceApiServiceOperationInformation input) { + + final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); + final String svcRequestId = requestHeader != null ? requestHeader.getSvcRequestId() : null; + + final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation(); + if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId())) { + final Cache cache = getCache(SERVICE_TOPOLOGY_OPERATION_CACHE); + final String serviceInstanceId = serviceInformation.getServiceInstanceId(); + LOGGER.info("Adding GenericResourceApiServiceOperationInformation to cache with key: {}", + serviceInstanceId); + + final GenericResourceApiServiceModelInfrastructure serviceModelInfrastructure = + new GenericResourceApiServiceModelInfrastructure(); + + final GenericResourceApiServicemodelinfrastructureService service = getServiceItem(input); + serviceModelInfrastructure.addServiceItem(service); + cache.put(serviceInstanceId, serviceModelInfrastructure); + + final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus(); + + return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator()) + .responseCode(serviceStatus.getResponseCode()).responseMessage(serviceStatus.getResponseMessage()) + .svcRequestId(svcRequestId).serviceResponseInformation(new GenericResourceApiInstanceReference() + .instanceId(serviceInstanceId).objectPath(RESTCONF_CONFIG_END_POINT + serviceInstanceId)); + + } + return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + .responseMessage("Service instance not found").svcRequestId(svcRequestId); + } + + @Override + public Optional<GenericResourceApiServiceModelInfrastructure> getGenericResourceApiServiceModelInfrastructure( + final String serviceInstanceId) { + final Cache cache = getCache(SERVICE_TOPOLOGY_OPERATION_CACHE); + + final GenericResourceApiServiceModelInfrastructure value = + cache.get(serviceInstanceId, GenericResourceApiServiceModelInfrastructure.class); + if (value != null) { + return Optional.of(value); + } + return Optional.empty(); + } + + @Override + public void clearAll() { + clearCahce(SERVICE_TOPOLOGY_OPERATION_CACHE); + } + + private GenericResourceApiServicemodelinfrastructureService getServiceItem( + final GenericResourceApiServiceOperationInformation input) { + + final GenericResourceApiServicedataServiceData apiServicedataServiceData = + new GenericResourceApiServicedataServiceData(); + + apiServicedataServiceData.requestInformation(input.getRequestInformation()); + apiServicedataServiceData.serviceRequestInput(input.getServiceRequestInput()); + apiServicedataServiceData.serviceInformation(input.getServiceInformation()); + apiServicedataServiceData.serviceTopology(getServiceTopology(input)); + apiServicedataServiceData.sdncRequestHeader(input.getSdncRequestHeader()); + apiServicedataServiceData.serviceLevelOperStatus(getServiceLevelOperStatus(input)); + + final GenericResourceApiServicestatusServiceStatus serviceStatus = + getServiceStatus(getSvcAction(input.getSdncRequestHeader()), getAction(input.getRequestInformation()), + HttpStatus.OK.toString()); + + return new GenericResourceApiServicemodelinfrastructureService().serviceData(apiServicedataServiceData) + .serviceStatus(serviceStatus); + } + + private String getAction(final GenericResourceApiRequestinformationRequestInformation input) { + return getString(input.getRequestAction(), ""); + } + + private String getSvcAction(final GenericResourceApiSdncrequestheaderSdncRequestHeader input) { + return input != null ? getStringOrNull(input.getSvcAction()) : null; + } + + private GenericResourceApiServicestatusServiceStatus getServiceStatus(final String rpcAction, final String action, + final String responseCode) { + return new GenericResourceApiServicestatusServiceStatus().finalIndicator(YES) + .rpcAction(GenericResourceApiRpcActionEnumeration.fromValue(rpcAction)) + .rpcName(SERVICE_TOPOLOGY_OPERATION).responseTimestamp(LocalDateTime.now().toString()) + .responseCode(responseCode).requestStatus(GenericResourceApiRequestStatusEnumeration.SYNCCOMPLETE) + .responseMessage("").action(action); + } + + private GenericResourceApiOperStatusData getServiceLevelOperStatus( + final GenericResourceApiServiceOperationInformation input) { + return new GenericResourceApiOperStatusData().orderStatus(GenericResourceApiOrderStatusEnumeration.CREATED) + .lastAction(GenericResourceApiLastActionEnumeration + .fromValue(getRequestAction(input.getRequestInformation()))) + .lastRpcAction(GenericResourceApiLastRpcActionEnumeration + .fromValue(getSvcAction(input.getSdncRequestHeader()))); + } + + private String getRequestAction(final GenericResourceApiRequestinformationRequestInformation input) { + return input != null ? getStringOrNull(input.getRequestAction()) : null; + } + + private GenericResourceApiServicetopologyServiceTopology getServiceTopology( + final GenericResourceApiServiceOperationInformation input) { + final GenericResourceApiOnapmodelinformationOnapModelInformation modelInformation = + input.getServiceInformation() != null ? input.getServiceInformation().getOnapModelInformation() : null; + return new GenericResourceApiServicetopologyServiceTopology().onapModelInformation(modelInformation) + .serviceTopologyIdentifier(getServiceTopologyIdentifier(input)); + } + + private GenericResourceApiServicetopologyidentifierServiceTopologyIdentifier getServiceTopologyIdentifier( + final GenericResourceApiServiceOperationInformation input) { + final GenericResourceApiServicetopologyidentifierServiceTopologyIdentifier identifier = + new GenericResourceApiServicetopologyidentifierServiceTopologyIdentifier(); + + if (input.getServiceInformation() != null) { + final GenericResourceApiServiceinformationServiceInformation serviceInformation = + input.getServiceInformation(); + identifier.globalCustomerId(serviceInformation.getGlobalCustomerId()) + .serviceType(input.getServiceInformation().getSubscriptionServiceType()) + .serviceInstanceId(input.getServiceInformation().getServiceInstanceId());; + } + + if (input.getServiceRequestInput() != null) { + identifier.serviceInstanceName(input.getServiceRequestInput().getServiceInstanceName()); + } + + return identifier; + + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/Constants.java new file mode 100644 index 00000000..2d774edd --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/Constants.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.utils; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class Constants { + + public static final String BASE_URL = "/restconf"; + + public static final String OPERATIONS_URL = BASE_URL + "/operations"; + + public static final String SERVICE_TOPOLOGY_OPERATION_CACHE = "service-topology-operation-cache"; + + public static final String HEALTHY = "healthy"; + + public static final String YES = "Y"; + + public static final String SERVICE_TOPOLOGY_OPERATION = "service-topology-operation"; + + public static final String RESTCONF_CONFIG_END_POINT = "restconf/config/GENERIC-RESOURCE-API:services/service/"; + + private Constants() {} +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java new file mode 100644 index 00000000..833da414 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.utils; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class ObjectUtils { + + public static boolean isValid(final String value) { + return value != null && !value.isEmpty(); + } + + public static String getStringOrNull(final Object obj) { + return getString(obj, null); + } + + public static String getString(final Object obj, String defaultValue) { + return obj != null ? obj.toString() : defaultValue; + } + + private ObjectUtils() {} + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/resources/application.yaml new file mode 100644 index 00000000..95b28455 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +server: + port: 9994 + tomcat: + max-threads: 4 +ssl-enable: false +spring: + security: + users: + - username: mso + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID + - username: admin + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID
\ No newline at end of file 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 new file mode 100644 index 00000000..af46ab40 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java @@ -0,0 +1,186 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.controller; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Base64; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference; +import org.onap.so.sdncsimulator.models.InputRequest; +import org.onap.so.sdncsimulator.models.Output; +import org.onap.so.sdncsimulator.models.OutputRequest; +import org.onap.so.sdncsimulator.providers.ServiceOperationsCacheServiceProvider; +import org.onap.so.sdncsimulator.utils.Constants; +import org.onap.so.simulator.model.UserCredentials; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@Configuration +public class OperationsControllerTest { + + private static final String SVC_REQUEST_ID = "04fc9f50-87b8-430d-a232-ef24bd6c4150"; + + private static final String SERVICE_INSTANCE_ID = "ccece8fe-13da-456a-baf6-41b3a4a2bc2b"; + + private static final String SERVICE_TOPOLOGY_OPERATION_URL = "/GENERIC-RESOURCE-API:service-topology-operation/"; + + private static final String PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; + + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + @Autowired + private ServiceOperationsCacheServiceProvider cacheServiceProvider; + + @Autowired + private UserCredentials userCredentials; + + + @Test + public void test_postServiceOperationInformation_successfullyAddedToCache() 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()); + assertTrue(responseEntity.hasBody()); + + final OutputRequest actualOutputRequest = responseEntity.getBody(); + assertNotNull(actualOutputRequest); + + final Output actualObject = actualOutputRequest.getOutput(); + + assertNotNull(actualObject); + assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); + assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); + assertNotNull(actualObject.getServiceResponseInformation()); + + final GenericResourceApiInstanceReference acutalReference = actualObject.getServiceResponseInformation(); + assertEquals(Constants.RESTCONF_CONFIG_END_POINT + SERVICE_INSTANCE_ID, acutalReference.getObjectPath()); + assertEquals(SERVICE_INSTANCE_ID, acutalReference.getInstanceId()); + assertTrue( + cacheServiceProvider.getGenericResourceApiServiceModelInfrastructure(SERVICE_INSTANCE_ID).isPresent()); + } + + @Test + public void test_postServiceOperationInformation_NullInputRequest_badRequest() throws Exception { + + final HttpEntity<?> httpEntity = new HttpEntity<>(new InputRequest<>(), getHttpHeaders()); + final ResponseEntity<OutputRequest> responseEntity = + restTemplate.exchange(getUrl(), HttpMethod.POST, httpEntity, OutputRequest.class); + + assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode()); + } + + @Test + public void test_postServiceOperationInformation_NullServiceInstanceId_badRequest() throws Exception { + + final HttpEntity<?> httpEntity = new HttpEntity<>(getInvalidRequestInput(), getHttpHeaders()); + final ResponseEntity<OutputRequest> responseEntity = + restTemplate.exchange(getUrl(), HttpMethod.POST, httpEntity, OutputRequest.class); + + assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode()); + assertTrue(responseEntity.hasBody()); + + final OutputRequest actualOutputRequest = responseEntity.getBody(); + assertNotNull(actualOutputRequest); + + final Output actualObject = actualOutputRequest.getOutput(); + assertNotNull(actualObject); + assertEquals(HttpStatus.BAD_REQUEST.toString(), actualObject.getResponseCode()); + assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId()); + assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); + + } + + private HttpHeaders getHttpHeaders() { + return getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername()); + } + + private String getUrl() { + return "http://localhost:" + port + Constants.OPERATIONS_URL + SERVICE_TOPOLOGY_OPERATION_URL; + } + + private String getRequestInput() throws IOException { + return getFileAsString(getFile("test-data/input.json").toPath()); + } + + private String getInvalidRequestInput() throws IOException { + return getFileAsString(getFile("test-data/InvalidInput.json").toPath()); + } + + private String getFileAsString(final Path path) throws IOException { + return new String(Files.readAllBytes(path)); + } + + private File getFile(final String file) throws IOException { + return new ClassPathResource(file).getFile(); + } + + private HttpHeaders getHttpHeaders(final String username) { + final HttpHeaders requestHeaders = new HttpHeaders(); + requestHeaders.add("Authorization", getBasicAuth(username)); + requestHeaders.setContentType(MediaType.APPLICATION_JSON); + return requestHeaders; + } + + private String getBasicAuth(final String username) { + return "Basic " + new String(Base64.getEncoder().encodeToString((username + ":" + PASSWORD).getBytes())); + } + + @After + public void after() { + cacheServiceProvider.clearAll(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java new file mode 100644 index 00000000..b5d6dc0d --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/SdncSimulatorControllerTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 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.so.sdncsimulator.controller; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.sdncsimulator.utils.Constants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@Configuration +public class SdncSimulatorControllerTest { + + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void test_healthCheck_matchContent() { + final String url = "http://localhost:" + port + Constants.BASE_URL + "/healthcheck"; + final ResponseEntity<String> object = restTemplate.getForEntity(url, String.class); + + assertEquals(Constants.HEALTHY, object.getBody()); + + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/InvalidInput.json b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/InvalidInput.json new file mode 100644 index 00000000..6f2d27d4 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/InvalidInput.json @@ -0,0 +1,27 @@ +{ + "input": { + "request-information": { + "request-action": "CreateServiceInstance", + "source": "MSO", + "request-id": "33ebd358-a189-4664-90f5-cf9e23658e0a" + }, + "sdnc-request-header": { + "svc-request-id": "04fc9f50-87b8-430d-a232-ef24bd6c4150", + "svc-action": "assign" + }, + "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-request-input": { + "service-instance-name": "ServiceTest_24_07_2019" + } + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/input.json b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/input.json new file mode 100644 index 00000000..8d42b620 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/input.json @@ -0,0 +1,28 @@ +{ + "input": { + "request-information": { + "request-action": "CreateServiceInstance", + "source": "MSO", + "request-id": "33ebd358-a189-4664-90f5-cf9e23658e0a" + }, + "sdnc-request-header": { + "svc-request-id": "04fc9f50-87b8-430d-a232-ef24bd6c4150", + "svc-action": "assign" + }, + "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/plans/so/integration-etsi-testing/teardown.sh b/plans/so/integration-etsi-testing/teardown.sh index 6014a0d1..61edc7df 100755 --- a/plans/so/integration-etsi-testing/teardown.sh +++ b/plans/so/integration-etsi-testing/teardown.sh @@ -34,7 +34,6 @@ export $(egrep -v '^#' $ENV_FILE | xargs) export TEST_LAB_DIR=$TEST_LAB_DIR_PATH export CONFIG_DIR_PATH=$CONFIG_DIR - -docker-compose -f $DOCKER_COMPOSE_FILE_PATH down +docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME" diff --git a/plans/vfc-nfvo-lcm/sanity-check/setup.sh b/plans/vfc-nfvo-lcm/sanity-check/setup.sh index c206c0b0..394a8afd 100755 --- a/plans/vfc-nfvo-lcm/sanity-check/setup.sh +++ b/plans/vfc-nfvo-lcm/sanity-check/setup.sh @@ -61,7 +61,7 @@ echo sleep 60 sleep 60 # start vfc-nslcm -docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/nslcm +docker run -d --name vfc-nslcm -v /var/lib/mysql -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 -e REG_TO_MSB_WHEN_START=true nexus3.onap.org:10001/onap/vfc/nslcm NSLCM_IP=`get-instance-ip.sh vfc-nslcm` # Wait for initialization diff --git a/tests/portal/testsuites/browser_setup.robot b/tests/portal/testsuites/browser_setup.robot index dfa6ab68..e98c501a 100644 --- a/tests/portal/testsuites/browser_setup.robot +++ b/tests/portal/testsuites/browser_setup.robot @@ -13,28 +13,28 @@ Setup Browser Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'firefox' Setup Browser Firefox Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'chrome' Setup Browser Chrome Log Running with ${GLOBAL_SELENIUM_BROWSER} - + Setup Browser Firefox ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX sys, selenium.webdriver - Set To Dictionary ${dc} elementScrollBehavior 1 + Set To Dictionary ${dc} elementScrollBehavior 1 Create Webdriver Firefox desired_capabilities=${dc} Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} - + Setup Browser Chrome ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys Call Method ${chrome options} add_argument no-sandbox ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver Set To Dictionary ${dc} elementScrollBehavior 1 - Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} - Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} + Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} -Handle Proxy Warning +Handle Proxy Warning [Documentation] Handle Intermediate Warnings from Proxies - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} Return From Keyword if '${status}' != 'PASS' - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} Return From Keyword if '${status}' != 'PASS' Return From Keyword if "${GLOBAL_PROXY_WARNING_TITLE}" == '' Return From Keyword if "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == '' - ${test} ${value}= Run keyword and ignore error Title Should Be ${GLOBAL_PROXY_WARNING_TITLE} - Run keyword If '${test}' == 'PASS' Click Element xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
\ No newline at end of file + ${test} ${value}= Run keyword And Ignore Error Title Should Be ${GLOBAL_PROXY_WARNING_TITLE} + Run Keyword If '${test}' == 'PASS' Click Element xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
\ No newline at end of file diff --git a/tests/portal/testsuites/portal_VID.robot b/tests/portal/testsuites/portal_VID.robot index fdfa4e79..fd8464b6 100644 --- a/tests/portal/testsuites/portal_VID.robot +++ b/tests/portal/testsuites/portal_VID.robot @@ -1,10 +1,10 @@ *** Settings *** Documentation The main interface for interacting with Portal. It handles low level stuff like managing the selenium request library and Portal required steps -Library ExtendedSelenium2Library -Library RequestsClientCert -Library RequestsLibrary -Library ONAPLibrary.Utilities -Library DateTime +Library ExtendedSelenium2Library +Library RequestsClientCert +Library RequestsLibrary +Library ONAPLibrary.Utilities +Library DateTime Resource ../global_properties.robot Resource ../browser_setup.robot @@ -14,13 +14,13 @@ ${PORTAL_LOGIN_URL} ${GLOBAL_PORTAL_URL}${PORTAL_ENV}/login.htm ${PORTAL_HOME_PAGE} ${GLOBAL_PORTAL_URL}${PORTAL_ENV}/applicationsHome ${PORTAL_MICRO_ENDPOINT} ${GLOBAL_PORTAL_URL}${PORTAL_ENV}/commonWidgets ${PORTAL_HOME_URL} ${GLOBAL_PORTAL_URL}${PORTAL_ENV}/applicationsHome -${App_First_Name} appdemo +${App_First_Name} appdemo ${App_Last_Name} demo ${App_Email_Address} appdemo@onap.com -${App_LoginID} appdemo +${App_LoginID} appdemo ${App_Loginpwd} demo123456! ${App_LoginPwdCheck} demo123456! -${Sta_First_Name} stademo +${Sta_First_Name} stademo ${Sta_Last_Name} demo ${Sta_Email_Address} stademo@onap.com ${Sta_LoginID} stademo @@ -28,34 +28,30 @@ ${Sta_Loginpwd} demo123456! ${Sta_LoginPwdCheck} demo123456! ${Existing_User} portal ${PORTAL_HEALTH_CHECK_PATH} /ECOMPPORTAL/portalApi/healthCheck -#${Application} 'Virtual Infrastructure Deployment' -#${Application_tab} 'select-app-Virtual-Infrastructure-Deployment' +#${Application} 'Virtual Infrastructure Deployment' +#${Application_tab} 'select-app-Virtual-Infrastructure-Deployment' #${Application_dropdown} 'div-app-name-dropdown-Virtual-Infrastructure-Deployment' -#${Application_dropdown_select} 'div-app-name-Virtual-Infrastructure-Deployment' -${APPC_LOGIN_URL} http://104.130.74.99:8282/apidoc/explorer/index.html +#${Application_dropdown_select} 'div-app-name-Virtual-Infrastructure-Deployment' +${APPC_LOGIN_URL} http://104.130.74.99:8282/apidoc/explorer/index.html ${PORTAL_ASSETS_DIRECTORY} C:\\Users\\kk707x\\Downloads - - - - *** Keywords *** Run Portal Health Check [Documentation] Runs Portal Health check - ${resp}= Run Portal Get Request ${PORTAL_HEALTH_CHECK_PATH} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['statusCode']} 200 + ${resp}= Run Portal Get Request ${PORTAL_HEALTH_CHECK_PATH} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['statusCode']} 200 + Run Portal Get Request [Documentation] Runs Portal Get request [Arguments] ${data_path} - ${session}= Create Session portal ${GLOBAL_PORTAL_URL} + ${session}= Create Session portal ${GLOBAL_PORTAL_URL} ${uuid}= Generate UUID4 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Get Request portal ${data_path} headers=${headers} + ${resp}= Get Request portal ${data_path} headers=${headers} Log Received response from portal ${resp.text} - [Return] ${resp} - + [Return] ${resp} Portal admin Login To Portal GUI [Documentation] Logs into Portal GUI @@ -71,26 +67,26 @@ Portal admin Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_PORTAL_ADMIN_USER} Input Password xpath=//input[@ng-model='password'] ${GLOBAL_PORTAL_ADMIN_PWD} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Log Logged in to ${GLOBAL_PORTAL_SERVER}${PORTAL_ENV} Portal admin Go To Portal HOME - [Documentation] Naviage to Portal Home + [Documentation] Navigate to Portal Home Go To ${PORTAL_HOME_URL} - Wait Until Page Contains Element xpath=//div[@class='applicationWindow'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - -Portal admin User Notifications - [Documentation] Naviage to User notification tab + Wait Until Page Contains Element xpath=//div[@class='applicationWindow'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + +Portal admin User Notifications + [Documentation] Navigate to User notification tab Click Link xpath=//a[@id='parent-item-User-Notifications'] - Wait Until Element Is Visible xpath=//h1[@class='heading-page'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[@class='heading-page'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Button xpath=//button[@id='button-openAddNewApp'] Click Button xpath=(//button[@id='undefined'])[1] #Click Button xpath=//input[@id='datepicker-start'] - + Portal admin Add Application Admin New User - [Documentation] Naviage to Admins tab + [Documentation] Navigate to Admins tab Click Link xpath=//a[@title='Admins'] - Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] Click Button xpath=//button[@id='Create-New-User-button'] @@ -106,32 +102,29 @@ Portal admin Add Application Admin New User Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment')])[1] #Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment')])[1] Click Element xpath=(//li[contains(.,'Virtual Infrastructure Deployment')])[2] - Click Button xpath=//button[@id='div-updateAdminAppsRoles'] - Click Element xpath=//button[@id='admin-div-ok-button'] + Click Button xpath=//button[@id='div-updateAdminAppsRoles'] + Click Element xpath=//button[@id='admin-div-ok-button'] Click Element xpath=//button[@id='div-confirm-ok-button'] Click Link xpath=//a[@aria-label='Admins'] Click Button xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] Input Text xpath=//input[@id='input-table-search'] ${First_Name} Element Text Should Be xpath=(//span[contains(.,'Test')] )[1] ${First_Name} - - - - -Portal admin Add Application Admin Exiting User - [Documentation] Naviage to Admins tab - Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + +Portal admin Add Application Admin Existing User + [Documentation] Navigate to Admins tab + Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Admins'] - Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} Click Button xpath=//button[@id='button-search-users'] Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='search-users-button-next'] Click Button xpath=//input[@value='Select application'] Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment' )])[1] - + Click Element xpath=(//li[contains(.,'Virtual Infrastructure Deployment' )])[2] #Select From List xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment')])[1] Virtual Infrastructure Deployment Click Button xpath=//button[@id='div-updateAdminAppsRoles'] @@ -143,11 +136,10 @@ Portal admin Add Application Admin Exiting User Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment' )] Input Text xpath=//input[@id='input-table-search'] ${Existing_User} Element Text Should Be xpath=(//span[contains(.,'portal')])[1] ${Existing_User} - - -Portal admin Delete Application Admin Existing User - [Documentation] Naviage to Admins tab - Click Element xpath=(//span[contains(.,'portal')] )[1] + +Portal admin Delete Application Admin Existing User + [Documentation] Navigate to Admins tab + Click Element xpath=(//span[contains(.,'portal')] )[1] Click Element xpath=//*[@id='select-app-Virtual-Infrastructure-Deployment']/following::i[@id='i-delete-application'] Click Element xpath=//button[@id='div-confirm-ok-button'] Click Button xpath=//button[@id='div-updateAdminAppsRoles'] @@ -155,10 +147,9 @@ Portal admin Delete Application Admin Existing User #Is Element Visible xpath=(//span[contains(.,'Portal')] )[2] #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] Element Should Not Contain xpath=//*[@table-data='admins.adminsTableData'] portal - - + Portal admin Add Application admin User New user - [Documentation] Naviage to Users tab + [Documentation] Navigate to Users tab Click Link xpath=//a[@title='Users'] Page Should Contain Users Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] @@ -178,15 +169,14 @@ Portal admin Add Application admin User New user Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 Go To ${PORTAL_HOME_PAGE} - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] Input Text xpath=//input[@id='input-table-search'] ${App_First_Name} Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${App_First_Name} - - + Portal admin Add Standard User New user - [Documentation] Naviage to Users tab + [Documentation] Navigate to Users tab Click Link xpath=//a[@title='Users'] Page Should Contain Users Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] @@ -206,28 +196,26 @@ Portal admin Add Standard User New user Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 Go To ${PORTAL_HOME_PAGE} - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] Input Text xpath=//input[@id='input-table-search'] ${Sta_First_Name} - Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${Sta_First_Name} - - - -Portal admin Add Application Admin Exiting User -APPDEMO - [Documentation] Naviage to Admins tab - Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${Sta_First_Name} + +Portal admin Add Application Admin Existing User -APPDEMO + [Documentation] Navigate to Admins tab + Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Admins'] - Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] - Input Text xpath=//input[@id='input-user-search'] ${App_First_Name} + Input Text xpath=//input[@id='input-user-search'] ${App_First_Name} Click Button xpath=//button[@id='button-search-users'] Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='search-users-button-next'] Click Button xpath=//input[@value='Select application'] Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment' )])[1] - + Click Element xpath=(//li[contains(.,'Virtual Infrastructure Deployment' )])[2] #Select From List xpath=(//input[@value='Select application']/following::*[contains(text(),'Virtual Infrastructure Deployment')])[1] Virtual Infrastructure Deployment Click Button xpath=//button[@id='div-updateAdminAppsRoles'] @@ -238,91 +226,82 @@ Portal admin Add Application Admin Exiting User -APPDEMO Click Element xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment' )] Input Text xpath=//input[@id='input-table-search'] ${App_First_Name} - Element Text Should Be xpath=(//span[contains(.,'appdemo')])[1] ${App_First_Name} - - - -Portal admin Add Standard User Existing user - [Documentation] Naviage to Users tab - Click Link xpath=//a[@title='Users'] - Page Should Contain Users - Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} - Click Button xpath=//button[@id='button-search-users'] - Click Element xpath=//span[@id='result-uuid-0'] - Click Button xpath=//button[@id='next-button'] - Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] - #Click Element xpath=//div[@id='div-app-name-dropdown-xDemo-App'] - #Click Element xpath=//div[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} - #Select From List xpath=//input[@value='Select application'] Virtual Infrastructure Deployment - #Click Link xpath=//a[@title='Users'] - #Page Should Contain Users - #Focus xpath=//input[@name='dropdown1'] - - Go To ${PORTAL_HOME_PAGE} - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - #Click Element xpath=//li[contains(.,'XDemo App')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - - -Portal admin Edit Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='System-Administrator-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - Page Should Contain Users - #Click Button xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator - - - Portal admin Delete Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - Scroll Element Into View xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Button xpath=//button[@id='new-user-save-button'] - #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] - Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] portal - - - - -Functional Top Menu Get Access - [Documentation] Naviage to Support tab + Element Text Should Be xpath=(//span[contains(.,'appdemo')])[1] ${App_First_Name} + +Portal admin Add Standard User Existing user + [Documentation] Navigate to Users tab + Click Link xpath=//a[@title='Users'] + Page Should Contain Users + Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Click Button xpath=//button[@id='button-search-users'] + Click Element xpath=//span[@id='result-uuid-0'] + Click Button xpath=//button[@id='next-button'] + Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] + #Click Element xpath=//div[@id='div-app-name-dropdown-xDemo-App'] + #Click Element xpath=//div[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] + + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} + #Select From List xpath=//input[@value='Select application'] Virtual Infrastructure Deployment + #Click Link xpath=//a[@title='Users'] + #Page Should Contain Users + #Focus xpath=//input[@name='dropdown1'] + + Go To ${PORTAL_HOME_PAGE} + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + #Click Element xpath=//li[contains(.,'XDemo App')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User + +Portal admin Edit Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] + Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='System-Administrator-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + Page Should Contain Users + #Click Button xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator + +Portal admin Delete Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] + Scroll Element Into View xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Button xpath=//button[@id='new-user-save-button'] + #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] + Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] portal + +Functional Top Menu Get Access + [Documentation] Navigate to Support tab Click Link xpath=//a[contains(.,'Support')] Mouse Over xpath=//*[contains(text(),'Get Access')] Click Link xpath=//a[contains(.,'Get Access')] Element Text Should Be xpath=//h1[contains(.,'Get Access')] Get Access - - -Functional Top Menu Contact Us - [Documentation] Naviage to Support tab + +Functional Top Menu Contact Us + [Documentation] Navigate to Support tab Click Link xpath=//a[contains(.,'Support')] Mouse Over xpath=//*[contains(text(),'Contact Us')] Click Link xpath=//a[contains(.,'Contact Us')] - Element Text Should Be xpath=//h1[contains(.,'Contact Us')] Contact Us - Click Image xpath=//img[@alt='Onap Logo'] - + Element Text Should Be xpath=//h1[contains(.,'Contact Us')] Contact Us + Click Image xpath=//img[@alt='Onap Logo'] -Portal admin Edit Functional menu - [Documentation] Naviage to Edit Functional menu tab +Portal admin Edit Functional menu + [Documentation] Navigate to Edit Functional menu tab Click Link xpath=//a[@title='Edit Functional Menu'] Click Link xpath=.//*[@id='Manage']/div/a Click Link xpath=.//*[@id='Design']/div/a @@ -343,34 +322,27 @@ Portal admin Edit Functional menu Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Design')] - Set Selenium Implicit Wait 3000 - Element Text Should Be xpath=//a[contains(.,'ONAP Test')] ONAP Test - Set Selenium Implicit Wait 3000 - Click Link xpath=//a[@title='Edit Functional Menu'] + Mouse Over xpath=//*[contains(text(),'Design')] + Set Selenium Implicit Wait 3000 + Element Text Should Be xpath=//a[contains(.,'ONAP Test')] ONAP Test + Set Selenium Implicit Wait 3000 + Click Link xpath=//a[@title='Edit Functional Menu'] Click Link xpath=.//*[@id='Manage']/div/a Click Link xpath=.//*[@id='Design']/div/a Click Link xpath=.//*[@id='Product_Design']/div/a Open Context Menu xpath=//*[@id='ONAP_Test'] Click Link xpath=//a[@href='#delete'] - Set Selenium Implicit Wait 3000 - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Design')] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=(.//*[contains(.,'Design')]/following::ul[1])[1] ONAP Test - - - - - - - - + Mouse Over xpath=//*[contains(text(),'Design')] + Set Selenium Implicit Wait 3000 + Element Should Not Contain xpath=(.//*[contains(.,'Design')]/following::ul[1])[1] ONAP Test + Portal admin Microservice Onboarding - [Documentation] Naviage to Edit Functional menu tab + [Documentation] Navigate to Edit Functional menu tab Click Link xpath=//a[@title='Microservice Onboarding'] Click Button xpath=//button[@id='microservice-onboarding-button-add'] Input Text xpath=//input[@name='name'] Test Microservice @@ -388,11 +360,9 @@ Portal admin Microservice Onboarding Click Button xpath=//button[@id='microservice-details-save-button'] #Table Column Should Contain xpath=//*[@table-data='serviceList'] 0 Test Microservice Element Text Should Be xpath=//*[@table-data='serviceList'] Test Microservice - - - -Portal Admin Create Widget for All users - [Documentation] Naviage to Create Widget menu tab + +Portal Admin Create Widget for All users + [Documentation] Navigate to Create Widget menu tab ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}\\widget_news.zip Click Link xpath=//a[@title='Widget Onboarding'] Click Button xpath=//button[@id='widget-onboarding-button-add'] @@ -401,92 +371,84 @@ Portal Admin Create Widget for All users Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] Scroll Element Into View xpath=//li[contains(.,'Test Microservice')] Click Element xpath=//li[contains(.,'Test Microservice')] - Click Element xpath=//*[contains(text(),'Allow all user access')]/preceding::input[@ng-model='widgetOnboardingDetails.widget.allUser'][1] + Click Element xpath=//*[contains(text(),'Allow all user access')]/preceding::input[@ng-model='widgetOnboardingDetails.widget.allUser'][1] Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} Click Button xpath=//button[@id='widgets-details-save-button'] - Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain ONAP-VID Set Selenium Implicit Wait 3000 GO TO ${PORTAL_HOME_PAGE} - - -Portal Admin Delete Widget for All users - [Documentation] Naviage to delete Widget menu tab - #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - #Page Should Contain ONAP-VID - #Click Image xpath=//img[@alt='Onap Logo'] - Click Link xpath=//a[@title='Widget Onboarding'] - Click Element xpath=//input[@id='dropdown1'] + +Portal Admin Delete Widget for All users + [Documentation] Navigate to delete Widget menu tab + #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Page Should Contain ONAP-VID + #Click Image xpath=//img[@alt='Onap Logo'] + Click Link xpath=//a[@title='Widget Onboarding'] + Click Element xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-VID')]/followi - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Element xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-VID - #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] - #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-VID - #Set Selenium Implicit Wait 3000 - - -Portal Admin Create Widget for Application Roles - [Documentation] Naviage to Create Widget menu tab - ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}\\widget_news.zip - Click Link xpath=//a[@title='Widget Onboarding'] - Click Button xpath=//button[@id='widget-onboarding-button-add'] - Input Text xpath=//*[@name='name'] ONAP-VID - Input Text xpath=//*[@name='desc'] ONAP VID - Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] - Scroll Element Into View xpath=//li[contains(.,'Test Microservice')] - Click Element xpath=//li[contains(.,'Test Microservice')] - Click element xpath=//*[@id="app-select-Select Applications"] - click element xpath=//*[@id="Virtual-Infrastructure-Deployment-checkbox"] - Click element xpath=//*[@name='desc'] - click element xpath=//*[@id="app-select-Select Roles"] - click element xpath=//*[@id="Standard-User-checkbox"] - Click element xpath=//*[@name='desc'] - Scroll Element Into View xpath=//input[@id='widget-onboarding-details-upload-file'] - Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} - Click Button xpath=//button[@id='widgets-details-save-button'] + #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Element xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Set Selenium Implicit Wait 3000 + Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-VID + #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] + #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-VID + #Set Selenium Implicit Wait 3000 + +Portal Admin Create Widget for Application Roles + [Documentation] Navigate to Create Widget menu tab + ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}\\widget_news.zip + Click Link xpath=//a[@title='Widget Onboarding'] + Click Button xpath=//button[@id='widget-onboarding-button-add'] + Input Text xpath=//*[@name='name'] ONAP-VID + Input Text xpath=//*[@name='desc'] ONAP VID + Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] + Scroll Element Into View xpath=//li[contains(.,'Test Microservice')] + Click Element xpath=//li[contains(.,'Test Microservice')] + Click Element xpath=//*[@id="app-select-Select Applications"] + Click Element xpath=//*[@id="Virtual-Infrastructure-Deployment-checkbox"] + Click Element xpath=//*[@name='desc'] + Click Element xpath=//*[@id="app-select-Select Roles"] + Click Element xpath=//*[@id="Standard-User-checkbox"] + Click Element xpath=//*[@name='desc'] + Scroll Element Into View xpath=//input[@id='widget-onboarding-details-upload-file'] + Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} + Click Button xpath=//button[@id='widgets-details-save-button'] Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Link xpath=//a[@title='Widget Onboarding'] + #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Link xpath=//a[@title='Widget Onboarding'] Click Element xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - Page Should Contain ONAP-VID - Set Selenium Implicit Wait 3000 + Page Should Contain ONAP-VID + Set Selenium Implicit Wait 3000 GO TO ${PORTAL_HOME_PAGE} - - - - - Portal Admin Delete Widget for Application Roles - [Documentation] Naviage to delete Widget menu tab - #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - #Page Should Contain ONAP-VID - #Click Image xpath=//img[@alt='Onap Logo'] - Click Link xpath=//a[@title='Widget Onboarding'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Element xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-VID - #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] - #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-VID - #Set Selenium Implicit Wait 3000 - - - + +Portal Admin Delete Widget for Application Roles + [Documentation] Navigate to delete Widget menu tab + #Wait Until Page Contains ONAP-VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Page Should Contain ONAP-VID + #Click Image xpath=//img[@alt='Onap Logo'] + Click Link xpath=//a[@title='Widget Onboarding'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Element xpath=(.//*[contains(text(),'ONAP-VID')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Set Selenium Implicit Wait 3000 + Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-VID + #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] + #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-VID + #Set Selenium Implicit Wait 3000 + Portal Admin Edit Widget - [Documentation] Naviage to Home tab + [Documentation] Navigate to Home tab #Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1])[1] Click Element xpath=(//h3[contains(text(),'News')]/following::span[1])[1] Set Browser Implicit Wait 8000 #Wait Until Element Is Visible xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] 60 - Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] + Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] Click Link xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] Input Text xpath=//input[@name='title'] ONAP_VID Input Text xpath=//input[@name='url'] http://about.att.com/news/international.html @@ -498,71 +460,65 @@ Portal Admin Edit Widget Click Element xpath=//div[@id='confirmation-button-next'] Element Should Not Contain xpath=//*[@table-data='ignoredTableData'] ONAP_VID Click Link xpath=//a[@id='close-button'] - - - - -Portal Admin Broadcast Notifications - [Documentation] Portal Test Admin Broadcast Notifications - ${CurrentDay}= Get Current Date result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + +Portal Admin Broadcast Notifications + [Documentation] Portal Test Admin Broadcast Notifications + ${CurrentDay}= Get Current Date result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y ${CurrentDate}= Get Current Date result_format=%m%d%y%H%M - ${AdminBroadCastMsg}= catenate ONAP VID Broadcast Automation${CurrentDate} + ${AdminBroadCastMsg}= catenate ONAP VID Broadcast Automation${CurrentDate} Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - Click Link xpath=//*[@id="parent-item-User-Notifications"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - Click button xpath=//*[@id="button-openAddNewApp"] - Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} - Input Text xpath=//input[@id='datepicker-end'] ${NextDay} - Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Broadcast Automation - Input Text xpath=//*[@id="user-notif-input-message"] ${AdminBroadCastMsg} - click element xpath=//*[@id="button-notification-save"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - click element xpath=//*[@id="megamenu-notification-button"] - click element xpath=//*[@id="notification-history-link"] - Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 - Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminBroadCastMsg} - log ${AdminBroadCastMsg} + Click Link xpath=//*[@id="parent-item-User-Notifications"] + Wait Until Element Is Visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + Click button xpath=//*[@id="button-openAddNewApp"] + Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} + Input Text xpath=//input[@id='datepicker-end'] ${NextDay} + Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Broadcast Automation + Input Text xpath=//*[@id="user-notif-input-message"] ${AdminBroadCastMsg} + Click Element xpath=//*[@id="button-notification-save"] + Wait Until Element Is Visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + Click Element xpath=//*[@id="megamenu-notification-button"] + Click Element xpath=//*[@id="notification-history-link"] + Wait Until Element Is Visible xpath=//*[@id="notification-history-table"] timeout=10 + Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminBroadCastMsg} + Log ${AdminBroadCastMsg} [Return] ${AdminBroadCastMsg} - -Portal Admin Category Notifications - [Documentation] Portal Admin Broadcast Notifications - ${CurrentDay}= Get Current Date result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + +Portal Admin Category Notifications + [Documentation] Portal Admin Broadcast Notifications + ${CurrentDay}= Get Current Date result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y ${CurrentDate}= Get Current Date result_format=%m%d%y%H%M - ${AdminCategoryMsg}= catenate ONAP VID Category Automation${CurrentDate} - Click Link xpath=//a[@id='parent-item-Home'] - Click Link xpath=//*[@id="parent-item-User-Notifications"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + ${AdminCategoryMsg}= catenate ONAP VID Category Automation${CurrentDate} + Click Link xpath=//a[@id='parent-item-Home'] + Click Link xpath=//*[@id="parent-item-User-Notifications"] + Wait Until Element Is Visible xpath=//*[@id="button-openAddNewApp"] timeout=10 Click button xpath=//*[@id="button-openAddNewApp"] #Select Radio Button NO radio-button-no Click Element //*[contains(text(),'Broadcast to All Categories')]/following::*[contains(text(),'No')][1] #Select Radio Button //label[@class='radio'] radio-button-approles Click Element xpath=//*[contains(text(),'Categories')]/following::*[contains(text(),'Application Roles')][1] - Click Element xpath=//*[contains(text(),'Virtual Infrastructure Deployment')]/preceding::input[@ng-model='member.isSelected'][1] - Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} - Input Text xpath=//input[@id='datepicker-end'] ${NextDay} - Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Category Automation - Input Text xpath=//*[@id='user-notif-input-message'] ${AdminCategoryMsg} - click element xpath=//*[@id="button-notification-save"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - click element xpath=//*[@id="megamenu-notification-button"] - click element xpath=//*[@id="notification-history-link"] - Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 - Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminCategoryMsg} - log ${AdminCategoryMsg} - [Return] ${AdminCategoryMsg} - - - Portal admin Logout from Portal GUI + Click Element xpath=//*[contains(text(),'Virtual Infrastructure Deployment')]/preceding::input[@ng-model='member.isSelected'][1] + Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} + Input Text xpath=//input[@id='datepicker-end'] ${NextDay} + Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Category Automation + Input Text xpath=//*[@id='user-notif-input-message'] ${AdminCategoryMsg} + Click Element xpath=//*[@id="button-notification-save"] + Wait Until Element Is Visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + Click Element xpath=//*[@id="megamenu-notification-button"] + Click Element xpath=//*[@id="notification-history-link"] + Wait Until Element Is Visible xpath=//*[@id="notification-history-table"] timeout=10 + Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminCategoryMsg} + Log ${AdminCategoryMsg} + [Return] ${AdminCategoryMsg} + +Portal admin Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] Click Button xpath=//button[contains(.,'Log out')] Title Should Be Login - - - + Application admin Login To Portal GUI [Documentation] Logs into Portal GUI # Setup Browser Now being managed by test case @@ -577,93 +533,86 @@ Application admin Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_APP_ADMIN_USER} Input Password xpath=//input[@ng-model='password'] ${GLOBAL_APP_ADMIN_PWD} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Log Logged in to ${GLOBAL_PORTAL_SERVER}${PORTAL_ENV} - -Application Admin Navigation Application Link Tab + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Log Logged in to ${GLOBAL_PORTAL_SERVER}${PORTAL_ENV} + +Application Admin Navigation Application Link Tab [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[@id='parent-item-Home'] Click Element xpath=.//h3[contains(text(),'Virtual Infras...')]/following::div[1] Page Should Contain Welcome to VID - Click Element xpath=//i[@class='ion-close-round'] + Click Element xpath=//i[@class='ion-close-round'] Click Element xpath=(.//span[@id='tab-Home'])[1] - - -Application Admin Navigation Functional Menu + +Application Admin Navigation Functional Menu [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Technology Insertion')] - Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] - Page Should Contain Welcome to VID - Click Element xpath=//i[@class='ion-close-round'] - Click Element xpath=(.//span[@id='tab-Home'])[1] - - -Application admin Add Standard User Existing user - [Documentation] Naviage to Users tab - Click Link xpath=//a[@title='Users'] - Page Should Contain Users - Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} - Click Button xpath=//button[@id='button-search-users'] - Click Element xpath=//span[@id='result-uuid-0'] - Click Button xpath=//button[@id='next-button'] - Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} - #Select From List xpath=//input[@value='Select application'] Virtual Infrastructure Deployment - #Click Link xpath=//a[@title='Users'] - #Page Should Contain Users - Go To ${PORTAL_HOME_PAGE} - Set Selenium Implicit Wait 3000 - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - - -Application admin Edit Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='System-Administrator-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - Page Should Contain Users - #Click Button xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator - - -Application admin Delete Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - Scroll Element Into View xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] - Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Button xpath=//button[@id='new-user-save-button'] - #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] - Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal - - - + Mouse Over xpath=//*[contains(text(),'Technology Insertion')] + Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] + Page Should Contain Welcome to VID + Click Element xpath=//i[@class='ion-close-round'] + Click Element xpath=(.//span[@id='tab-Home'])[1] + +Application admin Add Standard User Existing user + [Documentation] Navigate to Users tab + Click Link xpath=//a[@title='Users'] + Page Should Contain Users + Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Click Button xpath=//button[@id='button-search-users'] + Click Element xpath=//span[@id='result-uuid-0'] + Click Button xpath=//button[@id='next-button'] + Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} + #Select From List xpath=//input[@value='Select application'] Virtual Infrastructure Deployment + #Click Link xpath=//a[@title='Users'] + #Page Should Contain Users + Go To ${PORTAL_HOME_PAGE} + Set Selenium Implicit Wait 3000 + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User + +Application admin Edit Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] + Click Element xpath=//*[@id='div-app-name-dropdown-Virtual-Infrastructure-Deployment'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='Standard-User-checkbox'] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::input[@id='System-Administrator-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + Page Should Contain Users + #Click Button xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'Virtual Infrastructure Deployment')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator + +Application admin Delete Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] + Scroll Element Into View xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] + Click Element xpath=//*[@id='div-app-name-Virtual-Infrastructure-Deployment']/following::*[@id='app-item-delete'][1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Button xpath=//button[@id='new-user-save-button'] + #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] + Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal + Application admin Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] Click Button xpath=//button[contains(.,'Log out')] - #Confirm Action - Title Should Be Login - - -Standared user Login To Portal GUI + #Confirm Action + Title Should Be Login + +Standard user Login To Portal GUI [Documentation] Logs into Portal GUI # Setup Browser Now being managed by test case ##Setup Browser @@ -677,65 +626,49 @@ Standared user Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_STA_USER_USER} Input Password xpath=//input[@ng-model='password'] ${GLOBAL_STA_USER_PWD} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Log Logged in to ${GLOBAL_PORTAL_SERVER}${PORTAL_ENV} - - -Standared user Navigation Application Link Tab + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Log Logged in to ${GLOBAL_PORTAL_SERVER}${PORTAL_ENV} + +Standard user Navigation Application Link Tab [Documentation] Logs into Portal GUI as application admin #Portal admin Go To Portal HOME Click Element xpath=.//h3[contains(text(),'Virtual Infras...')]/following::div[1] - Page Should Contain Welcome to VID + Page Should Contain Welcome to VID Click Element xpath=(.//span[@id='tab-Home'])[1] - - -Standared user Navigation Functional Menu + +Standard user Navigation Functional Menu [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Technology Insertion')] - Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] - Page Should Contain Welcome to VID - Click Element xpath=(.//span[@id='tab-Home'])[1] - - - -Standared user Broadcast Notifications - [Documentation] Logs into Portal GUI as application admin + Mouse Over xpath=//*[contains(text(),'Technology Insertion')] + Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] + Page Should Contain Welcome to VID + Click Element xpath=(.//span[@id='tab-Home'])[1] + +Standard user Broadcast Notifications + [Documentation] Logs into Portal GUI as application admin [Arguments] ${AdminBroadCastMsg} - Click element xpath=//*[@id='megamenu-notification-button'] - Click element xpath=//*[@id='notification-history-link'] - Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 - Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminBroadCastMsg} - log ${AdminBroadCastMsg} - - -Standared user Category Notifications - [Documentation] Logs into Portal GUI as application admin + Click Element xpath=//*[@id='megamenu-notification-button'] + Click Element xpath=//*[@id='notification-history-link'] + Wait Until Element Is Visible xpath=//*[@id='app-title'] timeout=10 + Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminBroadCastMsg} + Log ${AdminBroadCastMsg} + +Standard user Category Notifications + [Documentation] Logs into Portal GUI as application admin [Arguments] ${AdminCategoryMsg} - #click element xpath=//*[@id='megamenu-notification-button'] - #click element xpath=//*[@id="notification-history-link"] - Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 - Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminCategoryMsg} - log ${AdminCategoryMsg} - - -Standared user Logout from Portal GUI + #Click Element xpath=//*[@id='megamenu-notification-button'] + #Click Element xpath=//*[@id="notification-history-link"] + Wait Until Element Is Visible xpath=//*[@id='app-title'] timeout=10 + Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminCategoryMsg} + Log ${AdminCategoryMsg} + +Standard user Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] Click Button xpath=//button[contains(.,'Log out')] - #Confirm Action - Title Should Be Login - - - - -Tear Down + #Confirm Action + Title Should Be Login + +Tear Down [Documentation] Close all browsers Close All Browsers - - - - - - - diff --git a/tests/portal/testsuites/test1.robot b/tests/portal/testsuites/test1.robot index 93316548..c45ef52f 100644 --- a/tests/portal/testsuites/test1.robot +++ b/tests/portal/testsuites/test1.robot @@ -1,38 +1,38 @@ *** Settings *** -Documentation This is RobotFrame work script -Library ExtendedSelenium2Library -Library OperatingSystem -Library RequestsLibrary -Library ONAPLibrary.Utilities -Library ONAPLibrary.Templating -Library DateTime -Library Collections -Library String -Library XvfbRobot +Documentation CSIT cases for basic ONAP functionalities +Library ExtendedSelenium2Library +Library OperatingSystem +Library RequestsLibrary +Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating +Library DateTime +Library Collections +Library String +Library XvfbRobot *** Variables *** -${PORTAL_URL} http://portal.api.simpledemo.onap.org:8989 +${PORTAL_URL} http://portal.api.simpledemo.onap.org:8989 ${PORTAL_ENV} /ONAPPORTAL ${PORTAL_LOGIN_URL} ${PORTAL_URL}${PORTAL_ENV}/login.htm ${PORTAL_HOME_PAGE} ${PORTAL_URL}${PORTAL_ENV}/applicationsHome ${PORTAL_MICRO_ENDPOINT} ${PORTAL_URL}${PORTAL_ENV}/commonWidgets ${PORTAL_HOME_URL} ${PORTAL_URL}${PORTAL_ENV}/applicationsHome -${App_First_Name} demoapp +${App_First_Name} demoapp ${App_Last_Name} demo ${App_Email_Address} demoapp@onap.com -${App_LoginID} demoapp +${App_LoginID} demoapp ${App_Loginpwd} demo123456! ${App_LoginPwdCheck} demo123456! -${Sta_First_Name} demosta +${Sta_First_Name} demosta ${Sta_Last_Name} demo ${Sta_Email_Address} demosta@onap.com ${Sta_LoginID} demosta ${Sta_Loginpwd} demo123456! ${Sta_LoginPwdCheck} demo123456! -${Test_First_Name} portal +${Test_First_Name} portal ${Test_Last_Name} demo ${Test_Email_Address} portal@onap.com -${Test_LoginID} portal +${Test_LoginID} portal ${Test_Loginpwd} demo123456! ${Test_LoginPwdCheck} demo123456! ${Existing_User} portal @@ -40,8 +40,8 @@ ${PORTAL_HEALTH_CHECK_PATH} /ONAPPORTAL/portalApi/healthCheck ${PORTAL_XDEMPAPP_REST_URL} http://portal-sdk:8080/ONAPPORTALSDK/api/v2 ${PORTAL_ASSETS_DIRECTORY} ${CURDIR} ${GLOBAL_APPLICATION_ID} robot-functional -${GLOBAL_PORTAL_ADMIN_USER} demo -${GLOBAL_PORTAL_ADMIN_PWD} demo123456! +${GLOBAL_PORTAL_ADMIN_USER} demo +${GLOBAL_PORTAL_ADMIN_PWD} demo123456! ${AppAccountName} testApp ${AppUserName} testApp ${AppPassword} testApp123! @@ -69,155 +69,155 @@ ${download_link_id} 0 *** Test Cases *** -Portal Health Check +Portal Health Check Run Portal Health Check - -#Login into Portal URL -# Portal admin Login To Portal GUI - + +#Login into Portal URL +# Portal admin Login To Portal GUI + ## Portal R1 Release # # [Documentation] ONAP Portal R1 functionality test # # Notification on ONAP Portal # # Portal Application Account Management validation #Portal Change REST URL Of X-DemoApp -# [Documentation] Portal Change REST URL Of X-DemoApp +# [Documentation] Portal Change REST URL Of X-DemoApp # Portal Change REST URL - + #Portal R1 Release for AAF -# [Documentation] ONAP Portal R1 functionality for AAF test -# Portal AAF new fields - -#Create Microse service onboarding -# Portal admin Microservice Onboarding - -###Delete Microse service -# ##Portal admin Microservice Delete - +# [Documentation] ONAP Portal R1 functionality for AAF test +# Portal AAF new fields + +#Create Microservice onboarding +# Portal admin Microservice Onboarding + +###Delete Microservice +# ##Portal admin Microservice Delete + #Create Widget for all users -# Portal Admin Create Widget for All users +# Portal Admin Create Widget for All users #Delete Widget for all users -# Portal Admin Delete Widget for All users - +# Portal Admin Delete Widget for All users + #Create Widget for Application Roles -# Portal Admin Create Widget for Application Roles - +# Portal Admin Create Widget for Application Roles + ##Delete Widget for Application Roles -# #Portal Admin Delete Widget for Application Roles +# #Portal Admin Delete Widget for Application Roles ##EP Admin widget download -# #Admin widget download - +# #Admin widget download + #EP Admin widget layout reset -# Reset widget layout option - -#Validate Functional Top Menu Get Access -# Functional Top Menu Get Access - -#Validate Functional Top Menu Contact Us -# Functional Top Menu Contact Us - -#Edit Functional Menu -# Portal admin Edit Functional menu - -#Broadbond Notification functionality -# ${AdminBroadCastMsg}= Portal Admin Broadcast Notifications -# set global variable ${AdminBroadCastMsg} - -#Category Notification functionality -# ${AdminCategoryMsg}= Portal Admin Category Notifications -# set global variable ${AdminCategoryMsg} - +# Reset widget layout option + +#Validate Functional Top Menu Get Access +# Functional Top Menu Get Access + +#Validate Functional Top Menu Contact Us +# Functional Top Menu Contact Us + +#Edit Functional Menu +# Portal admin Edit Functional menu + +#Broadcast Notification functionality +# ${AdminBroadCastMsg}= Portal Admin Broadcast Notifications +# set global variable ${AdminBroadCastMsg} + +#Category Notification functionality +# ${AdminCategoryMsg}= Portal Admin Category Notifications +# set global variable ${AdminCategoryMsg} + #Create a Test user for Application Admin -Test -# Portal admin Add Application admin User New user -Test - -#Create a Test User for Apllication Admin -# Portal admin Add Application admin User New user - -#Add Application Admin for Existing User Test user -# Portal admin Add Application Admin Exiting User -APPDEMO - -#Create a Test user for Standared User -# Portal admin Add Standard User New user - -#Add Application Admin for Exisitng User -# Portal admin Add Application Admin Exiting User - -#Delete Application Admin for Exisitng User -# Portal admin Delete Application Admin Existing User - -#Add Standard User Role for Existing user -# Portal admin Add Standard User Existing user - +# Portal admin Add Application admin User New user -Test + +#Create a Test User for Application Admin +# Portal admin Add Application admin User New user + +#Add Application Admin for Existing User Test user +# Portal admin Add Application Admin Existing User -APPDEMO + +#Create a Test user for Standard User +# Portal admin Add Standard User New user + +#Add Application Admin for Existing User +# Portal admin Add Application Admin Existing User + +#Delete Application Admin for Exisitng User +# Portal admin Delete Application Admin Existing User + +#Add Standard User Role for Existing user +# Portal admin Add Standard User Existing user + #Edit Standard User Role for Existing user -# Portal admin Edit Standard User Existing user - -#Delete Standard User Role for Existing user -# Portal admin Delete Standard User Existing user +# Portal admin Edit Standard User Existing user + +#Delete Standard User Role for Existing user +# Portal admin Delete Standard User Existing user ##Add Account new account from App Account Management -# #Portal admin Add New Account - +# #Portal admin Add New Account + ##Delete Account new account from App Account Management -# #Portal admin Delete Account +# #Portal admin Delete Account ##EP Create Portal Admin -# #Add Portal Admin +# #Add Portal Admin ##EP Portal Admin delete -# #Delete Portal Admin - +# #Delete Portal Admin + #Logout from Portal GUI as Portal Admin # Portal admin Logout from Portal GUI -## Application Admin user Test cases - -#Login To Portal GUI as APP Admin -# Application admin Login To Portal GUI - -##Navigate Functional Link as APP Admin - ##Application Admin Navigation Functional Menu - +## Application Admin user Test cases + +#Login To Portal GUI as APP Admin +# Application admin Login To Portal GUI + +##Navigate Functional Link as APP Admin + ##Application Admin Navigation Functional Menu + #Add Standard User Role for Existing user as APP Admin -# Application admin Add Standard User Existing user - +# Application admin Add Standard User Existing user + #Edit Standard User Role for Existing user as APP Admin -# Application admin Edit Standard User Existing user - -#Delete Standard User Role for Existing user as APP Admin -# Application admin Delete Standard User Existing user - -##Navigate Application Link as APP Admin -# #Application Admin Navigation Application Link Tab - -#Logout from Portal GUI as APP Admin -# Application admin Logout from Portal GUI - +# Application admin Edit Standard User Existing user + +#Delete Standard User Role for Existing user as APP Admin +# Application admin Delete Standard User Existing user + +##Navigate Application Link as APP Admin +# #Application Admin Navigation Application Link Tab + +#Logout from Portal GUI as APP Admin +# Application admin Logout from Portal GUI + ##Standard User Test cases - -#Login To Portal GUI as Standared User -# Standared user Login To Portal GUI - -##Navigate Application Link as Standared User -# #Standared user Navigation Application Link Tab - -##Navigate Functional Link as Standared User -# #Standared user Navigation Functional Menu - -##Broadcast Notifications Standared user -# #Standared user Broadcast Notifications ${AdminBroadCastMsg} - -##Category Notifications Standared user -# #Standared user Category Notifications ${AdminCategoryMsg} - -#Logout from Portal GUI as Standared User -# Standared User Logout from Portal GUI - -Teardown - [Documentation] Close All Open browsers - Close All Browsers - + +#Login To Portal GUI as Standard User +# Standard user Login To Portal GUI + +##Navigate Application Link as Standard User +# #Standard user Navigation Application Link Tab + +##Navigate Functional Link as Standard User +# #Standard user Navigation Functional Menu + +##Broadcast Notifications Standard user +# #Standard user Broadcast Notifications ${AdminBroadCastMsg} + +##Category Notifications Standard user +# #Standard user Category Notifications ${AdminCategoryMsg} + +#Logout from Portal GUI as Standard User +# Standard User Logout from Portal GUI + +Teardown + [Documentation] Close All Open browsers + Close All Browsers + *** Keywords *** Setup Browser @@ -225,51 +225,48 @@ Setup Browser # Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'firefox' Setup Browser Firefox Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'chrome' Setup Browser Chrome Log Running with ${GLOBAL_SELENIUM_BROWSER} - - - Setup Browser Chrome + +Setup Browser Chrome ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys Call Method ${chrome options} add_argument no-sandbox ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver Set To Dictionary ${dc} elementScrollBehavior 1 - Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} - Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} + Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} -Handle Proxy Warning +Handle Proxy Warning [Documentation] Handle Intermediate Warnings from Proxies - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} Return From Keyword if '${status}' != 'PASS' - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} Return From Keyword if '${status}' != 'PASS' Return From Keyword if "${GLOBAL_PROXY_WARNING_TITLE}" == '' Return From Keyword if "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == '' ${test} ${value}= Run keyword and ignore error Title Should Be ${GLOBAL_PROXY_WARNING_TITLE} Run keyword If '${test}' == 'PASS' Click Element xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} - Run Portal Health Check [Documentation] Runs Portal Health check - ${resp}= Run Portal Get Request ${PORTAL_HEALTH_CHECK_PATH} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['statusCode']} 200 + ${resp}= Run Portal Get Request ${PORTAL_HEALTH_CHECK_PATH} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['statusCode']} 200 Run Portal Get Request [Documentation] Runs Portal Get request [Arguments] ${data_path} - ${session}= Create Session portal ${PORTAL_URL} + ${session}= Create Session portal ${PORTAL_URL} ${uuid}= Generate UUID4 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Get Request portal ${data_path} headers=${headers} + ${resp}= Get Request portal ${data_path} headers=${headers} Log Received response from portal ${resp.text} - [Return] ${resp} - + [Return] ${resp} Portal admin Login To Portal GUI [Documentation] Logs into Portal GUI ## Setup Browser Now being managed by test case # Setup Browser - Start Virtual Display 1920 1080 - Open Browser ${PORTAL_LOGIN_URL} chrome + Start Virtual Display 1920 1080 + Open Browser ${PORTAL_LOGIN_URL} chrome # Go To ${PORTAL_LOGIN_URL} Maximize Browser Window Set Selenium Speed ${GLOBAL_SELENIUM_DELAY} @@ -280,39 +277,39 @@ Portal admin Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_PORTAL_ADMIN_USER} Input Password xpath=//input[@ng-model='password'] ${GLOBAL_PORTAL_ADMIN_PWD} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - #Execute Javascript document.getElementById('w-ecomp-footer').style.display = 'none' - Log Logged in to ${PORTAL_URL}${PORTAL_ENV} + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Execute Javascript document.getElementById('w-ecomp-footer').style.display = 'none' + Log Logged in to ${PORTAL_URL}${PORTAL_ENV} Portal admin Go To Portal HOME - [Documentation] Naviage to Portal Home + [Documentation] Navigate to Portal Home Go To ${PORTAL_HOME_URL} Wait Until Page Contains Element xpath=//div[@class='applicationWindow'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - -Portal admin User Notifications - [Documentation] Naviage to User notification tab + +Portal admin User Notifications + [Documentation] Navigate to User notification tab Click Link xpath=//a[@id='parent-item-User-Notifications'] Wait Until Element Is Visible xpath=//h1[@class='heading-page'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Button xpath=//button[@id='button-openAddNewApp'] Click Button xpath=(//button[@id='undefined'])[1] - #Click Button xpath=//input[@id='datepicker-start'] - -Portal admin Add Application Admin Exiting User - [Documentation] Naviage to Admins tab + #Click Button xpath=//input[@id='datepicker-start'] + +Portal admin Add Application Admin Existing User + [Documentation] Navigate to Admins tab Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Admins'] Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins - Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} Click Button xpath=//button[@id='button-search-users'] Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='search-users-button-next'] Click Button xpath=//input[@value='Select application'] - Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'xDemo App' )])[1] + Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'xDemo App' )])[1] Click Element xpath=(//li[contains(.,'xDemo App' )])[2] -# Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Default' )])[1] +# Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Default' )])[1] # Click Element xpath=(//li[contains(.,'Default' )])[2] #Select From List xpath=(//input[@value='Select application']/following::*[contains(text(),'xDemo App')])[1] xDemo App Click Button xpath=//button[@id='div-updateAdminAppsRoles'] @@ -324,21 +321,20 @@ Portal admin Add Application Admin Exiting User # Click Element xpath=//li[contains(.,'Default' )] Click Element xpath=//li[contains(.,'xDemo App' )] Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${Existing_User} + Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${Existing_User} #Element Text Should Be xpath=(//span[contains(.,'portal')])[1] ${Existing_User} - #Element Text Should Be xpath=(//span[contains(.,'demo')])[1] ${Existing_User} - - -Portal admin Delete Application Admin Existing User - [Documentation] Naviage to Admins tab - Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Element Text Should Be xpath=(//span[contains(.,'demo')])[1] ${Existing_User} + +Portal admin Delete Application Admin Existing User + [Documentation] Navigate to Admins tab + Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Admins'] - Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Click Element xpath=(//span[contains(.,'portal')] )[1] - #Click Element xpath=(//span[contains(.,'demo')] )[1] + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Click Element xpath=(//span[contains(.,'portal')] )[1] + #Click Element xpath=(//span[contains(.,'demo')] )[1] Click Element xpath=//*[@id='select-app-xDemo-App']/following::i[@id='i-delete-application'] # Click Element xpath=//*[@id='select-app-Default']/following::i[@id='i-delete-application'] Click Element xpath=//button[@id='div-confirm-ok-button'] @@ -347,16 +343,15 @@ Portal admin Delete Application Admin Existing User #Is Element Visible xpath=(//span[contains(.,'Portal')] )[2] #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] Element Should Not Contain xpath=//*[@table-data='admins.adminsTableData'] portal - #Element Should Not Contain xpath=//*[@table-data='admins.adminsTableData'] demo - Click Image xpath=//img[@alt='Onap Logo'] + #Element Should Not Contain xpath=//*[@table-data='admins.adminsTableData'] demo + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - - + Portal admin Add Application admin User New user - [Documentation] Naviage to Users tab + [Documentation] Navigate to Users tab Click Link xpath=//a[@title='Users'] Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] Click Button xpath=//button[@id='users-button-add'] Click Button xpath=//button[@id='Create-New-User-button'] Input Text xpath=//input[@ng-model='searchUsers.newUser.firstName'] ${App_First_Name} @@ -366,7 +361,7 @@ Portal admin Add Application admin User New user Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwd'] ${App_Loginpwd} Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwdCheck'] ${App_LoginPwdCheck} Click Button xpath=//button[@ng-click='searchUsers.addNewUserFun()'] - + ${Result}= Get Matching XPath Count xpath=//*[contains(text(),'User with same loginId already exists')] #log ${Result} @@ -380,7 +375,7 @@ Portal admin Add Application admin User New user Goto Home Image Click Image xpath=//img[@alt='Onap Logo'] -AdminUser does not exist already +AdminUser does not exist already Click Button xpath=//button[@id='next-button'] #Scroll Element Into View xpath=//div[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] @@ -389,21 +384,20 @@ AdminUser does not exist already Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 Go To ${PORTAL_HOME_PAGE} - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'xDemo App')] - Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${App_First_Name} + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'xDemo App')] + Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${App_First_Name} #Input Text xpath=//input[@id='input-table-search'] ${App_First_Name} #Element Text Should Be xpath=(//span[contains(.,'demoapp')] )[1] ${App_First_Name} - Click Image xpath=//img[@alt='Onap Logo'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - - + Portal admin Add Standard User New user - [Documentation] Naviage to Users tab + [Documentation] Navigate to Users tab Click Link xpath=//a[@title='Users'] Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] Click Button xpath=//button[@id='users-button-add'] Click Button xpath=//button[@id='Create-New-User-button'] Input Text xpath=//input[@ng-model='searchUsers.newUser.firstName'] ${Sta_First_Name} @@ -413,7 +407,7 @@ Portal admin Add Standard User New user Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwd'] ${Sta_Loginpwd} Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwdCheck'] ${Sta_LoginPwdCheck} Click Button xpath=//button[@ng-click='searchUsers.addNewUserFun()'] - + ${Result}= Get Matching XPath Count xpath=//*[contains(text(),'User with same loginId already exists')] #log ${Result} @@ -424,7 +418,7 @@ Portal admin Add Standard User New user ... ELSE Goto Home Image Set Selenium Implicit Wait 3000 -StaUser does not exist already +StaUser does not exist already Click Button xpath=//button[@id='next-button'] #Scroll Element Into View xpath=//div[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] @@ -433,23 +427,21 @@ StaUser does not exist already Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 Go To ${PORTAL_HOME_PAGE} - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'xDemo App')] - Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${Sta_First_Name} + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'xDemo App')] + Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${Sta_First_Name} #Input Text xpath=//input[@id='input-table-search'] ${Sta_First_Name} #Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${Sta_First_Name} - Click Image xpath=//img[@alt='Onap Logo'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - - - + Portal admin Add Application admin User New user -Test - [Documentation] Naviage to Users tab + [Documentation] Navigate to Users tab Click Link xpath=//a[@title='Users'] Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Button xpath=//button[@id='users-button-add'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@id='users-button-add'] Click Button xpath=//button[@id='Create-New-User-button'] Input Text xpath=//input[@ng-model='searchUsers.newUser.firstName'] ${Test_First_Name} Input Text xpath=//input[@ng-model='searchUsers.newUser.lastName'] ${Test_Last_Name} @@ -458,11 +450,10 @@ Portal admin Add Application admin User New user -Test Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwd'] ${Test_Loginpwd} Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwdCheck'] ${Test_LoginPwdCheck} Click Button xpath=//button[@ng-click='searchUsers.addNewUserFun()'] - Click Button xpath=//button[@id='search-users-button-cancel'] - Click Image xpath=//img[@alt='Onap Logo'] + Click Button xpath=//button[@id='search-users-button-cancel'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - - + #Click Button xpath=//button[@id='next-button'] #Scroll Element Into View xpath=//div[@id='div-app-name-dropdown-xDemo-App'] #Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] @@ -471,22 +462,22 @@ Portal admin Add Application admin User New user -Test #Click Button xpath=//button[@id='new-user-save-button'] #Set Selenium Implicit Wait 3000 #Go To ${PORTAL_HOME_PAGE} - #Click Link xpath=//a[@title='Users'] - #Click Element xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'xDemo App')] - #Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${Test_First_Name} + #Click Link xpath=//a[@title='Users'] + #Click Element xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'xDemo App')] + #Table Column Should Contain xpath=//*[@table-data='users.accountUsers'] 1 ${Test_First_Name} #Input Text xpath=//input[@id='input-table-search'] ${Test_First_Name} - #Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${Test_First_Name} - -Portal admin Add Application Admin Exiting User -APPDEMO - [Documentation] Naviage to Admins tab + #Element Text Should Be xpath=(//span[contains(.,'appdemo')] )[1] ${Test_First_Name} + +Portal admin Add Application Admin Existing User -APPDEMO + [Documentation] Navigate to Admins tab Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Admins'] - Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain Admins - Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] - Input Text xpath=//input[@id='input-user-search'] ${App_First_Name} + Input Text xpath=//input[@id='input-user-search'] ${App_First_Name} Click Button xpath=//button[@id='button-search-users'] Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='search-users-button-next'] @@ -500,129 +491,128 @@ Portal admin Add Application Admin Exiting User -APPDEMO Get Selenium Implicit Wait Click Link xpath=//a[@aria-label='Admins'] Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'xDemo App' )] + Click Element xpath=//li[contains(.,'xDemo App' )] Input Text xpath=//input[@id='input-table-search'] ${App_First_Name} #Element Text Should Be xpath=(//span[contains(.,'appdemo')])[1] ${App_First_Name} - Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${App_First_Name} - Click Image xpath=//img[@alt='Onap Logo'] - Set Selenium Implicit Wait 3000 - -Portal admin Add Standard User Existing user - [Documentation] Naviage to Users tab - Click Link xpath=//a[@title='Users'] - Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} - Click Button xpath=//button[@id='button-search-users'] - Click Element xpath=//span[@id='result-uuid-0'] - Click Button xpath=//button[@id='next-button'] -# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] -# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//div[@id='app-select-Select roles1'] - Click Element xpath=//div[@id='app-select-Select roles1']/following::input[@id='Standard-User-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} - #Select From List xpath=//input[@value='Select application'] xDemo App - #Click Link xpath=//a[@title='Users'] - #Page Should Contain Users - #Focus xpath=//input[@name='dropdown1'] - Go To ${PORTAL_HOME_PAGE} - #Click Link xpath=//a[@title='Users'] - #Click Element xpath=//input[@id='dropdown1'] -# Click Element xpath=//li[contains(.,'Default')] - #Click Element xpath=//li[contains(.,'XDemo App')] - #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - #Set Selenium Implicit Wait 3000 - + Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${App_First_Name} + Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + +Portal admin Add Standard User Existing user + [Documentation] Navigate to Users tab + Click Link xpath=//a[@title='Users'] + Page Should Contain Users + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Click Button xpath=//button[@id='button-search-users'] + Click Element xpath=//span[@id='result-uuid-0'] + Click Button xpath=//button[@id='next-button'] +# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] + Click Element xpath=//div[@id='app-select-Select roles1'] + Click Element xpath=//div[@id='app-select-Select roles1']/following::input[@id='Standard-User-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 +# Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} +# Select From List xpath=//input[@value='Select application'] xDemo App +# Click Link xpath=//a[@title='Users'] +# Page Should Contain Users +# Focus xpath=//input[@name='dropdown1'] + Go To ${PORTAL_HOME_PAGE} +# Click Link xpath=//a[@title='Users'] +# Click Element xpath=//input[@id='dropdown1'] +# Click Element xpath=//li[contains(.,'Default')] +# Click Element xpath=//li[contains(.,'XDemo App')] +# Input Text xpath=//input[@id='input-table-search'] ${Existing_User} +# Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User +# Set Selenium Implicit Wait 3000 + Portal admin Edit Standard User Existing user - [Documentation] Naviage to Users tab - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - # Click Element xpath=//li[contains(.,'Default')] -# Set Selenium Implicit Wait 3000 - Click Element xpath=//li[contains(.,'xDemo App')] -# Set Selenium Implicit Wait 3000 - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - # Click Element xpath=//*[@id='div-app-name-dropdown-Default'] - # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] - # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] - Click Element xpath=//*[@id='app-select-Standard User1'] - Click Element xpath=//*[@id='app-select-Standard User1']/following::input[@id='Standard-User-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 + [Documentation] Navigate to Users tab + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] +# Click Element xpath=//li[contains(.,'Default')] +# Set Selenium Implicit Wait 3000 + Click Element xpath=//li[contains(.,'xDemo App')] +# Set Selenium Implicit Wait 3000 + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] + Click Element xpath=//*[@id='app-select-Standard User1'] + Click Element xpath=//*[@id='app-select-Standard User1']/following::input[@id='Standard-User-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 - Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} - Click Button xpath=//button[@id='button-search-users'] - Click Element xpath=//span[@id='result-uuid-0'] - Click Button xpath=//button[@id='next-button'] - Click Element xpath=//div[@id='app-select-Select roles1'] - Click Element xpath=//div[@id='app-select-Select roles1']/following::input[@id='System-Administrator-checkbox'] - Set Selenium Implicit Wait 3000 -# Click Element xpath=//*[@id='app-select-Standard User1'] -# Click Element xpath=//*[@id='app-select-Standard User1']/following::input[@id='System-Administrator-checkbox'] - # Click Element xpath=//*[@id='div-app-name-dropdown-SDC'] - # Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Standard-User-checkbox'] - # Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Portal-Notification-Admin-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - Page Should Contain Users - #Click Button xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'xDemo App')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Portal Notification Admin - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator - Set Selenium Implicit Wait 3000 - - Portal admin Delete Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] -# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] -# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] - Set Selenium Implicit Wait 9000 - Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] -# Scroll Element Into View xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] -# Click Element xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Button xpath=//button[@id='new-user-save-button'] - #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] - Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal - #Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] demo - Set Selenium Implicit Wait 3000 - - -Functional Top Menu Get Access - [Documentation] Naviage to Support tab - Go To ${PORTAL_HOME_URL} + Page Should Contain Users + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Click Button xpath=//button[@id='button-search-users'] + Click Element xpath=//span[@id='result-uuid-0'] + Click Button xpath=//button[@id='next-button'] + Click Element xpath=//div[@id='app-select-Select roles1'] + Click Element xpath=//div[@id='app-select-Select roles1']/following::input[@id='System-Administrator-checkbox'] + Set Selenium Implicit Wait 3000 +# Click Element xpath=//*[@id='app-select-Standard User1'] +# Click Element xpath=//*[@id='app-select-Standard User1']/following::input[@id='System-Administrator-checkbox'] + # Click Element xpath=//*[@id='div-app-name-dropdown-SDC'] + # Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Standard-User-checkbox'] + # Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Portal-Notification-Admin-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + Page Should Contain Users + #Click Button xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'xDemo App')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Portal Notification Admin + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator + Set Selenium Implicit Wait 3000 + +Portal admin Delete Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] + Set Selenium Implicit Wait 9000 + Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] +# Scroll Element Into View xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Button xpath=//button[@id='new-user-save-button'] + #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] + Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal + #Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] demo + Set Selenium Implicit Wait 3000 + +Functional Top Menu Get Access + [Documentation] Navigate to Support tab + Go To ${PORTAL_HOME_URL} Click Link xpath=//a[contains(.,'Support')] Mouse Over xpath=//*[contains(text(),'Get Access')] Click Link xpath=//a[contains(.,'Get Access')] Element Text Should Be xpath=//h1[contains(.,'Get Access')] Get Access - Set Selenium Implicit Wait 3000 - -Functional Top Menu Contact Us - [Documentation] Naviage to Support tab + Set Selenium Implicit Wait 3000 + +Functional Top Menu Contact Us + [Documentation] Navigate to Support tab Click Link xpath=//a[contains(.,'Support')] Mouse Over xpath=//*[contains(text(),'Contact Us')] Click Link xpath=//a[contains(.,'Contact Us')] - Element Text Should Be xpath=//h1[contains(.,'Contact Us')] Contact Us - Click Image xpath=//img[@alt='Onap Logo'] - Set Selenium Implicit Wait 3000 + Element Text Should Be xpath=//h1[contains(.,'Contact Us')] Contact Us + Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 -Portal admin Edit Functional menu - [Documentation] Naviage to Edit Functional menu tab +Portal admin Edit Functional menu + [Documentation] Navigate to Edit Functional menu tab Click Link xpath=//a[@title='Edit Functional Menu'] Click Link xpath=.//*[@id='Manage']/div/a Click Link xpath=.//*[@id='Design']/div/a @@ -643,52 +633,52 @@ Portal admin Edit Functional menu Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Design')] - Set Selenium Implicit Wait 3000 - Element Text Should Be xpath=//a[contains(.,'ONAP Test')] ONAP Test - Set Selenium Implicit Wait 3000 - Click Image xpath=//img[@alt='Onap Logo'] - Click Link xpath=//a[@title='Edit Functional Menu'] + Mouse Over xpath=//*[contains(text(),'Design')] + Set Selenium Implicit Wait 3000 + Element Text Should Be xpath=//a[contains(.,'ONAP Test')] ONAP Test + Set Selenium Implicit Wait 3000 + Click Image xpath=//img[@alt='Onap Logo'] + Click Link xpath=//a[@title='Edit Functional Menu'] Click Link xpath=.//*[@id='Manage']/div/a Click Link xpath=.//*[@id='Design']/div/a Click Link xpath=.//*[@id='Product_Design']/div/a Open Context Menu xpath=//*[@id='ONAP_Test'] Click Link xpath=//a[@href='#delete'] - Set Selenium Implicit Wait 3000 - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Design')] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=(.//*[contains(.,'Design')]/following::ul[1])[1] ONAP Test - Set Selenium Implicit Wait 3000 - Click Image xpath=//img[@alt='Onap Logo'] - Set Selenium Implicit Wait 3000 - + Mouse Over xpath=//*[contains(text(),'Design')] + Set Selenium Implicit Wait 3000 + Element Should Not Contain xpath=(.//*[contains(.,'Design')]/following::ul[1])[1] ONAP Test + Set Selenium Implicit Wait 3000 + Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + Portal admin Microservice Onboarding - [Documentation] Naviage to Edit Functional menu tab - Click Link xpath=//a[@title='Microservice Onboarding'] - Click Button xpath=//button[@id='microservice-onboarding-button-add'] - Input Text xpath=//input[@name='name'] Test Microservice - Input Text xpath=//*[@name='desc'] Test - Click Element xpath=//input[@id='microservice-details-input-app'] - Scroll Element Into View xpath=//li[contains(.,'xDemo App')] - Click Element xpath=//li[contains(.,'xDemo App')] - Click Element xpath=//*[@name='desc'] - Input Text xpath=//input[@name='url'] ${PORTAL_MICRO_ENDPOINT} - Click Element xpath=//input[@id='microservice-details-input-security-type'] - Scroll Element Into View xpath=//li[contains(.,'Basic Authentication')] - Click Element xpath=//li[contains(.,'Basic Authentication')] - Input Text xpath=//input[@name='username'] ${GLOBAL_PORTAL_ADMIN_USER} - Input Text xpath=//input[@name='password'] ${GLOBAL_PORTAL_ADMIN_PWD} - Click Button xpath=//button[@id='microservice-details-save-button'] - Table Column Should Contain xpath=//*[@table-data='serviceList'] 1 Test Microservice - #Element Text Should Be xpath=//*[@table-data='serviceList'] Test Microservice - Set Selenium Implicit Wait 3000 + [Documentation] Navigate to Edit Functional menu tab + Click Link xpath=//a[@title='Microservice Onboarding'] + Click Button xpath=//button[@id='microservice-onboarding-button-add'] + Input Text xpath=//input[@name='name'] Test Microservice + Input Text xpath=//*[@name='desc'] Test + Click Element xpath=//input[@id='microservice-details-input-app'] + Scroll Element Into View xpath=//li[contains(.,'xDemo App')] + Click Element xpath=//li[contains(.,'xDemo App')] + Click Element xpath=//*[@name='desc'] + Input Text xpath=//input[@name='url'] ${PORTAL_MICRO_ENDPOINT} + Click Element xpath=//input[@id='microservice-details-input-security-type'] + Scroll Element Into View xpath=//li[contains(.,'Basic Authentication')] + Click Element xpath=//li[contains(.,'Basic Authentication')] + Input Text xpath=//input[@name='username'] ${GLOBAL_PORTAL_ADMIN_USER} + Input Text xpath=//input[@name='password'] ${GLOBAL_PORTAL_ADMIN_PWD} + Click Button xpath=//button[@id='microservice-details-save-button'] + Table Column Should Contain xpath=//*[@table-data='serviceList'] 1 Test Microservice + #Element Text Should Be xpath=//*[@table-data='serviceList'] Test Microservice + Set Selenium Implicit Wait 3000 Portal admin Microservice Delete - [Documentation] Naviage to Edit Functional menu tab + [Documentation] Navigate to Edit Functional menu tab Click Link xpath=//a[@title='Microservice Onboarding'] Click Button xpath=//button[@id='microservice-onboarding-button-add'] Input Text xpath=//input[@name='name'] TestMS @@ -708,105 +698,100 @@ Portal admin Microservice Delete Click Element xpath=(.//*[contains(text(),'TestMS')]/following::*[@ng-click='microserviceOnboarding.deleteService(rowData)'])[1] Click Button xpath=//button[@id="div-confirm-ok-button"] Set Selenium Implicit Wait 3000 - -Portal Admin Create Widget for All users + +Portal Admin Create Widget for All users [Documentation] Navigate to Create Widget menu tab ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}//news_widget.zip - Wait until page contains Element xpath=//a[@title='Widget Onboarding'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Page Contains Element xpath=//a[@title='Widget Onboarding'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Click Link xpath=//a[@title='Widget Onboarding'] - Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] Click Button xpath=//button[@id='widget-onboarding-button-add'] Input Text xpath=//*[@name='name'] ONAP-xDemo Input Text xpath=//*[@name='desc'] ONAP xDemo Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] Scroll Element Into View xpath=//li[contains(.,'News Microservice')] Click Element xpath=//li[contains(.,'News Microservice')] - Click Element xpath=//*[contains(text(),'Allow all user access')]/preceding::input[@ng-model='widgetOnboardingDetails.widget.allUser'][1] + Click Element xpath=//*[contains(text(),'Allow all user access')]/preceding::input[@ng-model='widgetOnboardingDetails.widget.allUser'][1] Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} Click Button xpath=//button[@id='widgets-details-save-button'] - Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Page Should Contain ONAP-xDemo Set Selenium Implicit Wait 3000 GO TO ${PORTAL_HOME_PAGE} - - -Portal Admin Delete Widget for All users - [Documentation] Naviage to delete Widget menu tab - #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - #Page Should Contain ONAP-xDemo - #Click Image xpath=//img[@alt='Onap Logo'] - Click Link xpath=//a[@title='Widget Onboarding'] - Click Element xpath=//input[@id='dropdown1'] + +Portal Admin Delete Widget for All users + [Documentation] Navigate to delete Widget menu tab + #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Page Should Contain ONAP-xDemo + #Click Image xpath=//img[@alt='Onap Logo'] + Click Link xpath=//a[@title='Widget Onboarding'] + Click Element xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'xDemo App')] - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/followi - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Element xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-xDemo - #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] - #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo - #Set Selenium Implicit Wait 3000 - -Portal Admin Create Widget for Application Roles - [Documentation] Naviage to Create Widget menu tab - ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}//news_widget.zip - Click Link xpath=//a[@title='Widget Onboarding'] - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Button xpath=//button[@id='widget-onboarding-button-add'] - Input Text xpath=//*[@name='name'] ONAP-xDemo - Input Text xpath=//*[@name='desc'] ONAP xDemo - Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] - Scroll Element Into View xpath=//li[contains(.,'News Microservice')] - Click Element xpath=//li[contains(.,'News Microservice')] - Click element xpath=//*[@id="app-select-Select Applications"] - click element xpath=//*[@id="xDemo-App-checkbox"] - Click element xpath=//*[@name='desc'] - click element xpath=//*[@id="app-select-Select Roles0"] - click element xpath=//*[@id="Standard-User-checkbox"] - Click element xpath=//*[@name='desc'] - Scroll Element Into View xpath=//input[@id='widget-onboarding-details-upload-file'] - Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} - Click Button xpath=//button[@id='widgets-details-save-button'] - Click Image xpath=//img[@alt='Onap Logo'] + #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Element xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] + Click Element xpath=//button[@id='div-confirm-ok-button'] Set Selenium Implicit Wait 3000 - #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Link xpath=//a[@title='Widget Onboarding'] + Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-xDemo + #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] + #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo + #Set Selenium Implicit Wait 3000 + +Portal Admin Create Widget for Application Roles + [Documentation] Navigate to Create Widget menu tab + ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}//news_widget.zip + Click Link xpath=//a[@title='Widget Onboarding'] + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@id='widget-onboarding-button-add'] + Input Text xpath=//*[@name='name'] ONAP-xDemo + Input Text xpath=//*[@name='desc'] ONAP xDemo + Click Element xpath=//*[@id='widgets-details-input-endpoint-url'] + Scroll Element Into View xpath=//li[contains(.,'News Microservice')] + Click Element xpath=//li[contains(.,'News Microservice')] + Click Element xpath=//*[@id="app-select-Select Applications"] + Click Element xpath=//*[@id="xDemo-App-checkbox"] + Click Element xpath=//*[@name='desc'] + Click Element xpath=//*[@id="app-select-Select Roles0"] + Click Element xpath=//*[@id="Standard-User-checkbox"] + Click Element xpath=//*[@name='desc'] + Scroll Element Into View xpath=//input[@id='widget-onboarding-details-upload-file'] + Choose File xpath=//input[@id='widget-onboarding-details-upload-file'] ${WidgetAttachment} + Click Button xpath=//button[@id='widgets-details-save-button'] + Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Link xpath=//a[@title='Widget Onboarding'] Click Element xpath=//input[@id='dropdown1'] Click Element xpath=//li[contains(.,'xDemo App')] - Page Should Contain ONAP-xDemo - Set Selenium Implicit Wait 3000 + Page Should Contain ONAP-xDemo + Set Selenium Implicit Wait 3000 GO TO ${PORTAL_HOME_PAGE} - -Portal Admin Delete Widget for Application Roles - #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - #Page Should Contain ONAP-xDemo - #Click Image xpath=//img[@alt='Onap Logo'] - Click Link xpath=//a[@title='Widget Onboarding'] - Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'xDemo App')] - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/followi - #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Scroll Element Into View xpath=//*[contains(text(),'ONAP-xDemo')]/following::td[3]/div - Click Element xpath=//*[contains(text(),'ONAP-xDemo')]/following::td[3]/div - Click Element xpath=//button[@id='div-confirm-ok-button'] - Set Selenium Implicit Wait 3000 - Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-xDemo - #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] - #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo - Set Selenium Implicit Wait 3000 - - - + +Portal Admin Delete Widget for Application Roles + #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + #Page Should Contain ONAP-xDemo + #Click Image xpath=//img[@alt='Onap Logo'] + Click Link xpath=//a[@title='Widget Onboarding'] + Click Element xpath=//input[@id='dropdown1'] + Click Element xpath=//li[contains(.,'xDemo App')] + #Wait Until Page Contains xpath=(.//*[contains(text(),'ONAP-xDemo')]/following::*[@ng-click='widgetOnboarding.deleteWidget(rowData)'])[1] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Scroll Element Into View xpath=//*[contains(text(),'ONAP-xDemo')]/following::td[3]/div + Click Element xpath=//*[contains(text(),'ONAP-xDemo')]/following::td[3]/div + Click Element xpath=//button[@id='div-confirm-ok-button'] + Set Selenium Implicit Wait 3000 + Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-xDemo + #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] + #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo + Set Selenium Implicit Wait 3000 + Portal Admin Edit Widget - [Documentation] Naviage to Home tab + [Documentation] Navigate to Home tab #Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1])[1] Click Element xpath=(//h3[contains(text(),'News')]/following::span[1])[1] Set Browser Implicit Wait 8000 #Wait Until Element Is Visible xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] 60 - Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] + Mouse Over xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] Click Link xpath=(//h3[contains(text(),'News')]/following::span[1]/following::a[contains(text(),'Edit')])[1] Input Text xpath=//input[@name='title'] ONAP_VID Input Text xpath=//input[@name='url'] http://about.att.com/news/international.html @@ -818,72 +803,72 @@ Portal Admin Edit Widget Click Element xpath=//div[@id='confirmation-button-next'] Element Should Not Contain xpath=//*[@table-data='ignoredTableData'] ONAP_VID Click Link xpath=//a[@id='close-button'] - Set Selenium Implicit Wait 3000 - -Portal Admin Broadcast Notifications - [Documentation] Portal Test Admin Broadcast Notifications - ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y + Set Selenium Implicit Wait 3000 + +Portal Admin Broadcast Notifications + [Documentation] Portal Test Admin Broadcast Notifications + ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y ${CurrentDate}= Get Current Date increment=24:00:00 result_format=%m%d%y%H%M - ${AdminBroadCastMsg}= catenate ONAP VID Broadcast Automation${CurrentDate} + ${AdminBroadCastMsg}= catenate ONAP VID Broadcast Automation${CurrentDate} Go To ${PORTAL_HOME_URL} - Click Image xpath=//img[@alt='Onap Logo'] + Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - Click Link xpath=//*[@id="parent-item-User-Notifications"] + Click Link xpath=//*[@id="parent-item-User-Notifications"] Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - Click button xpath=//*[@id="button-openAddNewApp"] - Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} - Input Text xpath=//input[@id='datepicker-end'] ${NextDay} - Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Broadcast Automation - Input Text xpath=//*[@id="user-notif-input-message"] ${AdminBroadCastMsg} - click element xpath=//*[@id="button-notification-save"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - click element xpath=//*[@id="megamenu-notification-button"] - click element xpath=//*[@id="notification-history-link"] -# Notification bug, Uncomment the code when PORTAL-232 is fixed - # Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 + Click button xpath=//*[@id="button-openAddNewApp"] + Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} + Input Text xpath=//input[@id='datepicker-end'] ${NextDay} + Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Broadcast Automation + Input Text xpath=//*[@id="user-notif-input-message"] ${AdminBroadCastMsg} + Click Element xpath=//*[@id="button-notification-save"] + Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + Click Element xpath=//*[@id="megamenu-notification-button"] + Click Element xpath=//*[@id="notification-history-link"] +# Notification bug, Uncomment the code when PORTAL-232 is fixed + # Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 # Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminBroadCastMsg} - Set Selenium Implicit Wait 3000 - log ${AdminBroadCastMsg} + Set Selenium Implicit Wait 3000 + Log ${AdminBroadCastMsg} [Return] ${AdminBroadCastMsg} - -Portal Admin Category Notifications - [Documentation] Portal Admin Broadcast Notifications - ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y -# ${CurrentDay}= Get Current Date result_format=%m/%d/%Y + +Portal Admin Category Notifications + [Documentation] Portal Admin Broadcast Notifications + ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y +# ${CurrentDay}= Get Current Date result_format=%m/%d/%Y ${CurrentDate}= Get Current Date increment=24:00:00 result_format=%m%d%y%H%M - ${AdminCategoryMsg}= catenate ONAP VID Category Automation${CurrentDate} - Click Link xpath=//a[@id='parent-item-Home'] - Click Link xpath=//*[@id="parent-item-User-Notifications"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + ${AdminCategoryMsg}= catenate ONAP VID Category Automation${CurrentDate} + Click Link xpath=//a[@id='parent-item-Home'] + Click Link xpath=//*[@id="parent-item-User-Notifications"] + Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 Click button xpath=//*[@id="button-openAddNewApp"] #Select Radio Button NO radio-button-no Click Element //*[contains(text(),'Broadcast to All Categories')]/following::*[contains(text(),'No')][1] #Select Radio Button //label[@class='radio'] radio-button-approles Click Element xpath=//*[contains(text(),'Categories')]/following::*[contains(text(),'Application Roles')][1] - Click Element xpath=//*[contains(text(),'xDemo App')]/preceding::input[@ng-model='member.isSelected'][1] - Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} - Input Text xpath=//input[@id='datepicker-end'] ${NextDay} - Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Category Automation - Input Text xpath=//*[@id='user-notif-input-message'] ${AdminCategoryMsg} - click element xpath=//*[@id="button-notification-save"] - Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 - click element xpath=//*[@id="megamenu-notification-button"] - click element xpath=//*[@id="notification-history-link"] + Click Element xpath=//*[contains(text(),'xDemo App')]/preceding::input[@ng-model='member.isSelected'][1] + Input Text xpath=//input[@id='datepicker-start'] ${CurrentDay} + Input Text xpath=//input[@id='datepicker-end'] ${NextDay} + Input Text xpath=//*[@id="add-notification-input-title"] ONAP VID Category Automation + Input Text xpath=//*[@id='user-notif-input-message'] ${AdminCategoryMsg} + Click Element xpath=//*[@id="button-notification-save"] + Wait until Element is visible xpath=//*[@id="button-openAddNewApp"] timeout=10 + Click Element xpath=//*[@id="megamenu-notification-button"] + Click Element xpath=//*[@id="notification-history-link"] # Notification bug, Uncomment the code when PORTAL-232 is fixed - # Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 + # Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 # Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminCategoryMsg} - Set Selenium Implicit Wait 3000 - log ${AdminCategoryMsg} - [Return] ${AdminCategoryMsg} - + Set Selenium Implicit Wait 3000 + Log ${AdminCategoryMsg} + [Return] ${AdminCategoryMsg} + Portal admin Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] Click Button xpath=//button[contains(.,'Log out')] Title Should Be Login - + Application admin Login To Portal GUI [Documentation] Logs into Portal GUI # Setup Browser Now being managed by test case @@ -898,104 +883,102 @@ Application admin Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${App_LoginID} Input Password xpath=//input[@ng-model='password'] ${App_Loginpwd} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Log Logged in to ${PORTAL_URL}${PORTAL_ENV} - -Application Admin Navigation Application Link Tab + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Log Logged in to ${PORTAL_URL}${PORTAL_ENV} + +Application Admin Navigation Application Link Tab [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[@id='parent-item-Home'] Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] Page Should Contain ONAP Portal - Scroll Element Into View xpath=//i[@class='ion-close-round'] + Scroll Element Into View xpath=//i[@class='ion-close-round'] Click Element xpath=//i[@class='ion-close-round'] - Set Selenium Implicit Wait 3000 + Set Selenium Implicit Wait 3000 #Click Element xpath=(.//span[@id='tab-Home'])[1] - - -Application Admin Navigation Functional Menu + +Application Admin Navigation Functional Menu [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[contains(.,'Manage')] Mouse Over xpath=//*[contains(text(),'Technology Insertion')] - Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] + Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] Page Should Contain ONAP Portal Click Element xpath=//i[@class='ion-close-round'] Click Element xpath=(.//span[@id='tab-Home'])[1] - - + Application admin Add Standard User Existing user - [Documentation] Naviage to Users tab - Click Link xpath=//a[@title='Users'] - Page Should Contain Users - Click Button xpath=//button[@ng-click='toggleSidebar()'] - Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] - Input Text xpath=//input[@id='input-user-search'] ${Existing_User} - Click Button xpath=//button[@id='button-search-users'] - Click Element xpath=//span[@id='result-uuid-0'] - Click Button xpath=//button[@id='next-button'] - Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - # Click Element xpath=//*[@id='div-app-name-dropdown-Default'] - # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] - # Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} - #Select From List xpath=//input[@value='Select application'] xDemo App - #Click Link xpath=//a[@title='Users'] - #Page Should Contain Users - Go To ${PORTAL_HOME_PAGE} - Set Selenium Implicit Wait 3000 - Click Link xpath=//a[@title='Users'] - Click Element xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'Default')] - Click Element xpath=//li[contains(.,'xDemo App')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Account Administrator - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - + [Documentation] Navigate to Users tab + Click Link xpath=//a[@title='Users'] + Page Should Contain Users + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Click Button xpath=//button[@ng-click='users.openAddNewUserModal()'] + Input Text xpath=//input[@id='input-user-search'] ${Existing_User} + Click Button xpath=//button[@id='button-search-users'] + Click Element xpath=//span[@id='result-uuid-0'] + Click Button xpath=//button[@id='next-button'] + Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] + # Click Element xpath=//*[@id='div-app-name-dropdown-Default'] + # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] + # Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + #Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} + #Select From List xpath=//input[@value='Select application'] xDemo App + #Click Link xpath=//a[@title='Users'] + #Page Should Contain Users + Go To ${PORTAL_HOME_PAGE} + Set Selenium Implicit Wait 3000 + Click Link xpath=//a[@title='Users'] + Click Element xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'Default')] + Click Element xpath=//li[contains(.,'xDemo App')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Account Administrator + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User + Application admin Edit Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] - # Click Element xpath=//*[@id='div-app-name-dropdown-Default'] - # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] - # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] - Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='System-Administrator-checkbox'] - Set Selenium Implicit Wait 3000 - Click Button xpath=//button[@id='new-user-save-button'] - Set Selenium Implicit Wait 3000 - Page Should Contain Users - #Click Button xpath=//input[@id='dropdown1'] - #Click Element xpath=//li[contains(.,'xDemo App')] - Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Account Administrator - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator - -Application admin Delete Standard User Existing user - [Documentation] Naviage to Users tab - Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] -# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] -# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] - Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] - Click Element xpath=//button[@id='div-confirm-ok-button'] - Click Button xpath=//button[@id='new-user-save-button'] -# Input Text xpath=//input[@id='input-table-search'] ${Existing_User} -# Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] - Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal - #Click Image xpath=//img[@alt='Onap Logo'] - Set Selenium Implicit Wait 3000 - + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] + # Click Element xpath=//*[@id='div-app-name-dropdown-Default'] + # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] + # Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] + Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='System-Administrator-checkbox'] + Set Selenium Implicit Wait 3000 + Click Button xpath=//button[@id='new-user-save-button'] + Set Selenium Implicit Wait 3000 + Page Should Contain Users + #Click Button xpath=//input[@id='dropdown1'] + #Click Element xpath=//li[contains(.,'xDemo App')] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} + # Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Account Administrator + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator + +Application admin Delete Standard User Existing user + [Documentation] Navigate to Users tab + Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] + Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] + Click Element xpath=//button[@id='div-confirm-ok-button'] + Click Button xpath=//button[@id='new-user-save-button'] +# Input Text xpath=//input[@id='input-table-search'] ${Existing_User} +# Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] + Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal + #Click Image xpath=//img[@alt='Onap Logo'] + Set Selenium Implicit Wait 3000 + Application admin Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] - #Set Selenium Implicit Wait 3000 + #Set Selenium Implicit Wait 3000 Click Button xpath=//button[contains(text(),'Log out')] - #Set Selenium Implicit Wait 3000 - Title Should Be Login - -Standared user Login To Portal GUI + #Set Selenium Implicit Wait 3000 + Title Should Be Login + +Standard user Login To Portal GUI [Documentation] Logs into Portal GUI # Setup Browser Now being managed by test case ##Setup Browser @@ -1009,53 +992,51 @@ Standared user Login To Portal GUI Input Text xpath=//input[@ng-model='loginId'] ${Sta_LoginID} Input Password xpath=//input[@ng-model='password'] ${Sta_Loginpwd} Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - Log Logged in to ${PORTAL_URL}${PORTAL_ENV} - -Standared user Navigation Application Link Tab + Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Log Logged in to ${PORTAL_URL}${PORTAL_ENV} + +Standard user Navigation Application Link Tab [Documentation] Logs into Portal GUI as application admin #Portal admin Go To Portal HOME Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] - Page Should Contain ONAP Portal + Page Should Contain ONAP Portal Click Element xpath=(.//span[@id='tab-Home'])[1] Set Selenium Implicit Wait 3000 - -Standared user Navigation Functional Menu + +Standard user Navigation Functional Menu [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[contains(.,'Manage')] Mouse Over xpath=//*[contains(text(),'Technology Insertion')] - Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] + Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] Page Should Contain Welcome to VID - Click Element xpath=(.//span[@id='tab-Home'])[1] - Set Selenium Implicit Wait 3000 - - -Standared user Broadcast Notifications - [Documentation] Logs into Portal GUI as application admin + Click Element xpath=(.//span[@id='tab-Home'])[1] + Set Selenium Implicit Wait 3000 + +Standard user Broadcast Notifications + [Documentation] Logs into Portal GUI as application admin [Arguments] ${AdminBroadCastMsg} - Click element xpath=//*[@id='megamenu-notification-button'] - Click element xpath=//*[@id='notification-history-link'] - Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 - Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminBroadCastMsg} - log ${AdminBroadCastMsg} - - -Standared user Category Notifications - [Documentation] Logs into Portal GUI as application admin + Click Element xpath=//*[@id='megamenu-notification-button'] + Click Element xpath=//*[@id='notification-history-link'] + Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 + Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminBroadCastMsg} + Log ${AdminBroadCastMsg} + +Standard user Category Notifications + [Documentation] Logs into Portal GUI as application admin [Arguments] ${AdminCategoryMsg} - #click element xpath=//*[@id='megamenu-notification-button'] - #click element xpath=//*[@id="notification-history-link"] - Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 - Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminCategoryMsg} - log ${AdminCategoryMsg} - -Standared user Logout from Portal GUI + #Click Element xpath=//*[@id='megamenu-notification-button'] + #Click Element xpath=//*[@id="notification-history-link"] + Wait until Element is visible xpath=//*[@id='app-title'] timeout=10 + Table Column Should Contain xpath=//*[@id='notification-history-table'] 2 ${AdminCategoryMsg} + Log ${AdminCategoryMsg} + +Standard user Logout from Portal GUI [Documentation] Logout from Portal GUI Click Element xpath=//div[@id='header-user-icon'] Click Button xpath=//button[contains(.,'Log out')] - #Confirm Action - Title Should Be Login - + #Confirm Action + Title Should Be Login + Portal admin Add New Account Click Link //*[@id="parent-item-App-Account-Management"] Click Button xpath=//button[@ng-click='toggleSidebar()'] @@ -1070,18 +1051,18 @@ Portal admin Add New Account # #Click Button xpath=//button[@ng-click='admins.openAddNewAdminModal()'] #account-details-next-button Click Button xpath=//button[@ng-click='accountAddDetails.saveChanges()'] - + Portal admin Delete Account Click Link //*[@id="parent-item-App-Account-Management"] Click Button xpath=//button[@ng-click='toggleSidebar()'] Set Selenium Implicit Wait 3000 Click Button //*[@id="account-onboarding-button-add"] Set Selenium Implicit Wait 3000 - + Tear Down [Documentation] Close all browsers Close All Browsers - + Enhanced Notification on ONAP Portal [Documentation] Runs portal Post request [Arguments] ${data_path} ${data} @@ -1090,8 +1071,8 @@ Enhanced Notification on ONAP Portal ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic amlyYTpfcGFzcw== username=jira password=_pass ${resp}= Post Request portal ${data_path} data=${data} headers=${headers} # Log Received response from portal ${resp.text} - [Return] ${resp} - + [Return] ${resp} + Notification on ONAP Portal [Documentation] Create Config portal ${configportal}= Create Dictionary jira_id=${jira} @@ -1099,57 +1080,56 @@ Notification on ONAP Portal ${output} = Apply Template portal ${portal_Template} ${configportal} ${post_resp} = Enhanced Notification on ONAP Portal ${RESOURCE_PATH} ${output} Should Be Equal As Strings ${post_resp.status_code} 200 - + Portal Application Account Management - [Documentation] Naviage to Application Account Management tab - Click Link xpath=//a[@title='App Account Management'] - Click Button xpath=//button[@id='account-onboarding-button-add'] - Input Text xpath=//input[@name='name'] JIRA - Input Text xpath=//input[@name='username'] jira - Input Text xpath=//input[@name='password'] _pass - Input Text xpath=//input[@name='repassword'] _pass - Click Element xpath=//div[@ng-click='accountAddDetails.saveChanges()'] - Element Text Should Be xpath=//*[@table-data='serviceList'] JIRA - + [Documentation] Navigate to Application Account Management tab + Click Link xpath=//a[@title='App Account Management'] + Click Button xpath=//button[@id='account-onboarding-button-add'] + Input Text xpath=//input[@name='name'] JIRA + Input Text xpath=//input[@name='username'] jira + Input Text xpath=//input[@name='password'] _pass + Input Text xpath=//input[@name='repassword'] _pass + Click Element xpath=//div[@ng-click='accountAddDetails.saveChanges()'] + Element Text Should Be xpath=//*[@table-data='serviceList'] JIRA + Portal Application Account Management validation - [Documentation] Naviage to user notification tab - Click Link xpath=//a[@id='parent-item-User-Notifications'] - click element xpath=//*[@id="megamenu-notification-button"] - Click element xpath=//*[@id="notification-history-link"] - Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 - Table Column Should Contain xpath=//*[@id="notification-history-table"] 1 JIRA - - + [Documentation] Navigate to user notification tab + Click Link xpath=//a[@id='parent-item-User-Notifications'] + Click Element xpath=//*[@id="megamenu-notification-button"] + Click Element xpath=//*[@id="notification-history-link"] + Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 + Table Column Should Contain xpath=//*[@id="notification-history-table"] 1 JIRA + Portal AAF new fields - [Documentation] Naviage to user Application details tab + [Documentation] Navigate to user Application details tab Click Link xpath=//a[@title='Application Onboarding'] Click Element xpath=//td[contains(.,'xDemo App')] Page Should Contain Name Space Page Should Contain Centralized - Click Element xpath=//button[@id='button-notification-cancel'] - Set Selenium Implicit Wait 3000 + Click Element xpath=//button[@id='button-notification-cancel'] + Set Selenium Implicit Wait 3000 Portal Change REST URL - [Documentation] Naviage to user Application details tab + [Documentation] Navigate to user Application details tab Click Link xpath=//a[@title='Application Onboarding'] Click Element xpath=//td[contains(.,'xDemo App')] Input Text xpath=//input[@name='restUrl'] ${PORTAL_XDEMPAPP_REST_URL} - Click Element xpath=//button[@id='button-save-app'] - Set Selenium Implicit Wait 6000 - Go To ${PORTAL_HOME_PAGE} + Click Element xpath=//button[@id='button-save-app'] + Set Selenium Implicit Wait 6000 + Go To ${PORTAL_HOME_PAGE} Wait Until Element Is Visible xpath=//a[@title='Application Onboarding'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - -Admin widget download + +Admin widget download Go To ${PORTAL_HOME_URL} - Wait until page contains Element xpath=//a[@title='Widget Onboarding'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} - click Link xpath=//a[@title='Widget Onboarding'] - Wait until page contains Element xpath=//table[@class='ng-scope'] + Wait Until Page Contains Element xpath=//a[@title='Widget Onboarding'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Link xpath=//a[@title='Widget Onboarding'] + Wait Until Page Contains Element xpath=//table[@class='ng-scope'] ${td_id}= get element attribute xpath=//*[contains(text(),'Events')]@id - log ${td_id} + Log ${td_id} ${test}= Get Substring ${td_id} -1 - log ${test} + Log ${test} ${download_link_id}= Catenate 'widget-onboarding-div-download-widget-${test}' - click Element xpath=//*[@id=${download_link_id}] + Click Element xpath=//*[@id=${download_link_id}] Reset widget layout option Go To ${PORTAL_HOME_URL} @@ -1157,7 +1137,7 @@ Reset widget layout option Execute Javascript document.getElementById('widgets').scrollTo(0,1400) Wait Until Page Contains Element xpath=//*[@id='widget-gridster-Events-icon'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Execute Javascript document.getElementById('widgets').scrollTo(0,1800) - Drag And Drop By Offset xpath=//*[@id='widget-gridster-Events-icon'] 500 500 + Drag And Drop By Offset xpath=//*[@id='widget-gridster-Events-icon'] 500 500 Execute Javascript document.getElementById('widgets').scrollTo(0,document.getElementById('widgets').scrollHeight); Execute Javascript document.getElementById('dashboardDefaultPreference').click() Execute Javascript document.getElementById('div-confirm-ok-button').click() @@ -1172,10 +1152,9 @@ Add Portal Admin Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='pa-search-users-button-save'] Click Button xpath=//button[@id='admin-div-ok-button'] - Delete Portal Admin - Wait Until Page Does Not Contain Element xpath=//*[@class='b2b-modal-header'] + Wait Until Page Does Not Contain Element xpath=//*[@class='b2b-modal-header'] Click Link xpath=//a[@id='parent-item-Portal-Admins'] Click Element xpath=//td[contains(.,'portal')]/following::span[@id='1-button-portal-admin-remove'] - Click Button xpath=//*[@id='div-confirm-ok-button'] + Click Button xpath=//*[@id='div-confirm-ok-button'] diff --git a/tests/sdc-dcae-d/dcaed/asdc_interface.robot b/tests/sdc-dcae-d/dcaed/asdc_interface.robot index 88053e88..2310522d 100644 --- a/tests/sdc-dcae-d/dcaed/asdc_interface.robot +++ b/tests/sdc-dcae-d/dcaed/asdc_interface.robot @@ -3,6 +3,8 @@ Library Collections Library OperatingSystem Library RequestsLibrary Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating WITH NAME Templating +Library ONAPLibrary.SDC WITH NAME SDC Resource common.robot @@ -14,14 +16,11 @@ ${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance ${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state ${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve -${ASDC_CATALOG_RESOURCE_TEMPLATE} ${ASSETS_DIR}component_catalog_resource.template -${ASDC_CATALOG_SERVICE_TEMPLATE} ${ASSETS_DIR}catalog_service.template -${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${ASSETS_DIR}artifact_upload.template -${ASDC_USER_REMARKS_TEMPLATE} ${ASSETS_DIR}user_remarks.template -${DCAE_VFCMT_TEMPLATE} ${ASSETS_DIR}create_vfcmt.template -${DCAE_COMPOSITION_TEMPLATE} ${ASSETS_DIR}dcae_composition.template -${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${ASSETS_DIR}dcae_monitoring_configuration.template -${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${ASSETS_DIR}resource_instance.template +${SDC_CATALOG_RESOURCE_TEMPLATE} component_catalog_resource.jinja +${SDC_CATALOG_SERVICE_TEMPLATE} catalog_service.jinja +${SDC_ARTIFACT_UPLOAD_TEMPLATE} artifact_upload.jinja +${SDC_USER_REMARKS_TEMPLATE} user_remarks.jinja +${SDC_RESOURCE_INSTANCE_TEMPLATE} resource_instance.jinja ${ASDC_BE_ENDPOINT} http://localhost:8080 @@ -31,64 +30,39 @@ Create Catalog Resource Data [Documentation] Creates and returns data for ASDC Catalog Resource [Arguments] ${resource_name} ${vendor_name} ${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name} - ${data}= json_templater.Fill JSON Template File ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map} + Templating.Create Environment sdc_catalog_resource ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_catalog_resource ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map} [Return] ${data} -# Based on testsuite/robot/resources/asdc_interface.robot's 'Post ASDC Resource Request' keyword Post ASDC Resource Request Unauthenticated [Documentation] Makes unauthenticated Post request for ASDC Catalog resource and returns its unique id [Arguments] ${data} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} -# Based on testsuite/robot/resources/asdc_interface.robot's 'Run ASDC Post Request' keyword -Run ASDC Post Request Unauthenticated - [Documentation] Runs an ASDC Post request without authentication and returns the HTTP response - [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT} - Log Creating session ${MY_ASDC_BE_ENDPOINT} - ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} - ${uuid}= Generate UUID4 - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Post Request asdc ${data_path} data=${data} headers=${headers} - Log Received response from asdc ${resp.text} - [Return] ${resp} - -# Based on testsuite/robot/resources/asdc_interface.robot's 'Run ASDC MD5 Post Request' keyword -Run ASDC MD5 Post Request Unauthenticated - [Documentation] Runs an ASDC post request with MD5 Checksum header without authentication and returns the HTTP response - [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT} - Log Creating session ${MY_ASDC_BE_ENDPOINT} - ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} - ${uuid}= Generate UUID4 - ${data_string}= Evaluate json.dumps(${data}) json - ${md5checksum}= Evaluate md5.new('''${data_string}''').hexdigest() modules=md5 - ${base64md5checksum}= Evaluate base64.b64encode("${md5checksum}") modules=base64 - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Content-MD5=${base64md5checksum} - ${resp}= Post Request asdc ${data_path} data=${data} headers=${headers} - Log Received response from asdc: ${resp.text} - [Return] ${resp} - -# Based on testsuite/robot/resources/asdc_interface.robot's 'Setup SDC Catalog Resource Deployment Artifact Properties' keyword +# Based on testsuite/robot/resources/sdc_interface.robot's 'Setup SDC Catalog Resource Deployment Artifact Properties' keyword Add Tosca Artifact To Resource [Documentation] Add Tosca artifacts to given resource id [Arguments] ${artifact} ${vf_id} ${blueprint_data} OperatingSystem.Get File ${ASSETS_DIR}${artifact}.yaml - ${payloadData}= Evaluate base64.b64encode('''${blueprint_data}'''.encode('utf-8')) modules=base64 + ${payloadData}= Base64 Encode ${blueprint_data} ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData} - ${data}= Fill JSON Template File ${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} + Templating.Create Environment sdc_artifact_upload ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} # POST artifactUpload to resource - ${resp}= Run ASDC MD5 Post Request Unauthenticated ${ASDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp} -# Directly copied from testsuite/robot/resources/asdc_interface.robot +# Directly copied from testsuite/robot/resources/sdc_interface.robot Certify ASDC Catalog Resource [Documentation] Certifies an ASDC Catalog Resource by its id and returns the new id [Arguments] ${catalog_resource_id} ${user_id}=${ASDC_TESTER_USER_ID} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} @@ -96,12 +70,13 @@ Add Catalog Service For Monitoring Template [Documentation] Creates an ASDC Catalog Service for Monitoring Template with given name [Arguments] ${service_name} ${map}= Create Dictionary service_name=${service_name} - ${data}= Fill JSON Template File ${ASDC_CATALOG_SERVICE_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH} ${data} + Templating.Create Environment sdc_catalog_service ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} -# Based on testsuite/robot/resources/asdc_interface.robot's 'Add ASDC Resource Instance' keyword +# Based on testsuite/robot/resources/sdc_interface.robot's 'Add SDC Resource Instance' keyword Add ASDC Resource Instance [Documentation] Creates an ASDC Resource Instance and returns its id [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF @@ -109,19 +84,22 @@ Add ASDC Resource Instance ${xoffset}= Set Variable ${xoffset+306} ${yoffset}= Set Variable ${yoffset+248} ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType} - ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} + Templating.Create Environment sdc_resource_instance ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_resource_instance ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 201 [Return] ${resp.json()['uniqueId']} ${resp.json()['name']} -# Adjusted from asdc_interface.robot +# All the following methods are adjusted from sdc_interface.robot Checkin ASDC Catalog Service [Documentation] Checks in an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID} + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -129,15 +107,16 @@ Request Certify ASDC Catalog Service [Documentation] Requests certification of an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID} + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} Start Certify ASDC Catalog Service [Documentation] Start certification of an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${ASDC_TESTER_USER_ID} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${ASDC_TESTER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} @@ -145,8 +124,9 @@ Certify ASDC Catalog Service [Documentation] Certifies an ASDC Catalog Service by its id and returns the new id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${ASDC_TESTER_USER_ID} + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${ASDC_TESTER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uniqueId']} @@ -154,8 +134,8 @@ Approve ASDC Catalog Service [Documentation] Approves an ASDC Catalog Service by its id [Arguments] ${catalog_service_id} ${map}= Create Dictionary user_remarks=Robot remarks - ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${ASDC_GOVERNOR_USER_ID} + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${ASDC_GOVERNOR_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} - diff --git a/tests/sdc-dcae-d/dcaed/assets/artifact_upload.jinja b/tests/sdc-dcae-d/dcaed/assets/artifact_upload.jinja new file mode 100755 index 00000000..80e6fc63 --- /dev/null +++ b/tests/sdc-dcae-d/dcaed/assets/artifact_upload.jinja @@ -0,0 +1,8 @@ +{ + "artifactLabel":"{{artifactLabel}}", + "artifactName": "{{artifactName}}", + "artifactType": "{{artifactType}}", + "artifactGroupType": "{{artifactGroupType}}", + "description": "{{description}}", + "payloadData": "{{payloadData}}" +} diff --git a/tests/sdc-dcae-d/dcaed/assets/artifact_upload.template b/tests/sdc-dcae-d/dcaed/assets/artifact_upload.template deleted file mode 100755 index 9be6ca04..00000000 --- a/tests/sdc-dcae-d/dcaed/assets/artifact_upload.template +++ /dev/null @@ -1,8 +0,0 @@ -{ - "artifactLabel":"${artifactLabel}", - "artifactName": "${artifactName}", - "artifactType": "${artifactType}", - "artifactGroupType": "${artifactGroupType}", - "description": "${description}", - "payloadData": "${payloadData}" -} diff --git a/tests/sdc-dcae-d/dcaed/assets/catalog_service.template b/tests/sdc-dcae-d/dcaed/assets/catalog_service.jinja index 56085025..3cd326e4 100755 --- a/tests/sdc-dcae-d/dcaed/assets/catalog_service.template +++ b/tests/sdc-dcae-d/dcaed/assets/catalog_service.jinja @@ -21,10 +21,10 @@ "icon": "defaulticon", "componentInstancesProperties": {}, "componentInstancesAttributes": {}, - "name": "${service_name}", + "name": "{{service_name}}", "tags": [ "robot-ete", - "${service_name}" + "{{service_name}}" ], "capabilities": {}, "requirements": {}, diff --git a/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.template b/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.jinja index cb6c402c..a3661b36 100644 --- a/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.template +++ b/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.jinja @@ -23,15 +23,15 @@ "icon": "defaulticon", "componentInstancesProperties": {}, "componentInstancesAttributes": {}, - "name": "${resource_name}", + "name": "{{resource_name}}", "tags": [ - "${resource_name}" + "{{resource_name}}" ], "capabilities": {}, "requirements": {}, "deploymentArtifacts": {}, "componentType": "RESOURCE", - "vendorName": "${vendor_name}", + "vendorName": "{{vendor_name}}", "vendorRelease": "1.0", "componentInstances": [], "properties": [], diff --git a/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.jinja b/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.jinja new file mode 100644 index 00000000..d399e25e --- /dev/null +++ b/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.jinja @@ -0,0 +1,4 @@ +{ +"name":"{{vfcmtName}}", +"description":"{{description}}" +} diff --git a/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.template b/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.template deleted file mode 100644 index 19ce2117..00000000 --- a/tests/sdc-dcae-d/dcaed/assets/create_vfcmt.template +++ /dev/null @@ -1,4 +0,0 @@ -{ -"name":"${vfcmtName}", -"description":"${description}" -} diff --git a/tests/sdc-dcae-d/dcaed/assets/dcae_composition.template b/tests/sdc-dcae-d/dcaed/assets/dcae_composition.jinja index 81be7893..c2557ca2 100644 --- a/tests/sdc-dcae-d/dcaed/assets/dcae_composition.template +++ b/tests/sdc-dcae-d/dcaed/assets/dcae_composition.jinja @@ -1,5 +1,5 @@ { - "cid": "${cid}", + "cid": "{{cid}}", "flowType": "TCA Hi Lo", "inputs": [], "nodes": [ @@ -13,8 +13,8 @@ } } ], - "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", - "id": "${vf_id}", + "description": "/sdc/v1/catalog/resources/{{vf_id}}/toscaModel/", + "id": "{{vf_id}}", "name": "tca-docker", "ndata": { "label": "tca-docker", @@ -160,39 +160,39 @@ { "name": "feature", "type": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" } } ], "hierarchy": [ { - "id": "${vf_id}/tosca.dcae.nodes.dockerApp", + "id": "{{vf_id}}/tosca.dcae.nodes.dockerApp", "name": "tosca.dcae.nodes.dockerApp" }, { - "id": "${vf_id}/tosca.dcae.nodes.Root", + "id": "{{vf_id}}/tosca.dcae.nodes.Root", "name": "tosca.dcae.nodes.Root" }, { "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", - "id": "${vf_id}/tosca.nodes.Root", + "id": "{{vf_id}}/tosca.nodes.Root", "name": "tosca.nodes.Root" } ], - "id": "${vf_id}/tosca.dcae.nodes.dockerApp.tca-docker", - "itemId": "${vf_id}/tosca.dcae.nodes.dockerApp.tca-docker", + "id": "{{vf_id}}/tosca.dcae.nodes.dockerApp.tca-docker", + "itemId": "{{vf_id}}/tosca.dcae.nodes.dockerApp.tca-docker", "name": "tosca.dcae.nodes.dockerApp.tca-docker", "requirements": [ { "capability": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" }, - "id": "${vf_id}/stream_subscribe_0", + "id": "{{vf_id}}/stream_subscribe_0", "name": "stream_subscribe_0", "node": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" }, "relationship": { @@ -201,13 +201,13 @@ }, { "capability": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" }, - "id": "${vf_id}/stream_publish_0", + "id": "{{vf_id}}/stream_publish_0", "name": "stream_publish_0", "node": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" }, "relationship": { @@ -216,13 +216,13 @@ }, { "capability": { - "id": "${vf_id}/dcae.capabilities.dockerHost", + "id": "{{vf_id}}/dcae.capabilities.dockerHost", "name": "dcae.capabilities.dockerHost" }, - "id": "${vf_id}/host", + "id": "{{vf_id}}/host", "name": "host", "node": { - "id": "${vf_id}/dcae.capabilities.dockerHost", + "id": "{{vf_id}}/dcae.capabilities.dockerHost", "name": "dcae.capabilities.dockerHost" }, "relationship": { @@ -231,25 +231,25 @@ }, { "capability": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" }, - "id": "${vf_id}/composition", + "id": "{{vf_id}}/composition", "name": "composition", "node": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" } }, { "capability": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, - "id": "${vf_id}/dependency", + "id": "{{vf_id}}/dependency", "name": "dependency", "node": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, "occurrences": [ @@ -354,8 +354,8 @@ } } ], - "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", - "id": "${vf_id}", + "description": "/sdc/v1/catalog/resources/{{vf_id}}/toscaModel/", + "id": "{{vf_id}}", "name": "topic0", "ndata": { "label": "topic0", @@ -473,54 +473,54 @@ { "name": "topic", "type": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" } }, { "name": "feature", "type": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" } } ], "hierarchy": [ { - "id": "${vf_id}/tosca.dcae.nodes.Root", + "id": "{{vf_id}}/tosca.dcae.nodes.Root", "name": "tosca.dcae.nodes.Root" }, { "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", - "id": "${vf_id}/tosca.nodes.Root", + "id": "{{vf_id}}/tosca.nodes.Root", "name": "tosca.nodes.Root" } ], - "id": "${vf_id}/tosca.dcae.nodes.dmaap.topic", - "itemId": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "id": "{{vf_id}}/tosca.dcae.nodes.dmaap.topic", + "itemId": "{{vf_id}}/tosca.dcae.nodes.dmaap.topic", "name": "tosca.dcae.nodes.dmaap.topic", "requirements": [ { "capability": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" }, - "id": "${vf_id}/composition", + "id": "{{vf_id}}/composition", "name": "composition", "node": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" } }, { "capability": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, - "id": "${vf_id}/dependency", + "id": "{{vf_id}}/dependency", "name": "dependency", "node": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, "occurrences": [ @@ -625,8 +625,8 @@ } } ], - "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", - "id": "${vf_id}", + "description": "/sdc/v1/catalog/resources/{{vf_id}}/toscaModel/", + "id": "{{vf_id}}", "name": "topic1", "ndata": { "label": "topic1", @@ -744,54 +744,54 @@ { "name": "topic", "type": { - "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "id": "{{vf_id}}/dcae.capabilities.dmmap.topic", "name": "dcae.capabilities.dmmap.topic" } }, { "name": "feature", "type": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" } } ], "hierarchy": [ { - "id": "${vf_id}/tosca.dcae.nodes.Root", + "id": "{{vf_id}}/tosca.dcae.nodes.Root", "name": "tosca.dcae.nodes.Root" }, { "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", - "id": "${vf_id}/tosca.nodes.Root", + "id": "{{vf_id}}/tosca.nodes.Root", "name": "tosca.nodes.Root" } ], - "id": "${vf_id}/tosca.dcae.nodes.dmaap.topic", - "itemId": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "id": "{{vf_id}}/tosca.dcae.nodes.dmaap.topic", + "itemId": "{{vf_id}}/tosca.dcae.nodes.dmaap.topic", "name": "tosca.dcae.nodes.dmaap.topic", "requirements": [ { "capability": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" }, - "id": "${vf_id}/composition", + "id": "{{vf_id}}/composition", "name": "composition", "node": { - "id": "${vf_id}/dcae.capabilities.composition.host", + "id": "{{vf_id}}/dcae.capabilities.composition.host", "name": "dcae.capabilities.composition.host" } }, { "capability": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, - "id": "${vf_id}/dependency", + "id": "{{vf_id}}/dependency", "name": "dependency", "node": { - "id": "${vf_id}/tosca.capabilities.Node", + "id": "{{vf_id}}/tosca.capabilities.Node", "name": "tosca.capabilities.Node" }, "occurrences": [ diff --git a/tests/sdc-dcae-d/dcaed/assets/dcae_monitoring_configuration.template b/tests/sdc-dcae-d/dcaed/assets/dcae_monitoring_configuration.jinja index f42e4685..27a5d020 100755..100644 --- a/tests/sdc-dcae-d/dcaed/assets/dcae_monitoring_configuration.template +++ b/tests/sdc-dcae-d/dcaed/assets/dcae_monitoring_configuration.jinja @@ -1,9 +1,9 @@ { - "name": "${name}", + "name": "{{name}}", "description": "Created by robot", - "templateUuid": "${template_uuid}", - "vfiName": "${vfi_name}", - "serviceUuid": "${service_uuid}", + "templateUuid": "{{template_uuid}}", + "vfiName": "{{vfi_name}}", + "serviceUuid": "{{service_uuid}}", "contextType": "SERVICE", "flowType": "TCA Hi Lo", "cloneVFCMT": true, diff --git a/tests/sdc-dcae-d/dcaed/assets/resource_instance.jinja b/tests/sdc-dcae-d/dcaed/assets/resource_instance.jinja new file mode 100644 index 00000000..18b71685 --- /dev/null +++ b/tests/sdc-dcae-d/dcaed/assets/resource_instance.jinja @@ -0,0 +1,10 @@ +{ + "uniqueId": "{{catalog_resource_id}}{{milli_timestamp}}", + "posX": {{posX}}, + "posY": {{posY}}, + "name": "{{catalog_resource_name}}", + "componentVersion": "1.0", + "originType": "{{originType}}", + "icon": "defaulticon", + "componentUid": "{{catalog_resource_id}}" +} diff --git a/tests/sdc-dcae-d/dcaed/assets/resource_instance.template b/tests/sdc-dcae-d/dcaed/assets/resource_instance.template deleted file mode 100644 index 18cf34c7..00000000 --- a/tests/sdc-dcae-d/dcaed/assets/resource_instance.template +++ /dev/null @@ -1,10 +0,0 @@ -{ - "uniqueId": "${catalog_resource_id}${milli_timestamp}", - "posX": ${posX}, - "posY": ${posY}, - "name": "${catalog_resource_name}", - "componentVersion": "1.0", - "originType": "${originType}", - "icon": "defaulticon", - "componentUid": "${catalog_resource_id}" -} diff --git a/tests/sdc-dcae-d/dcaed/assets/user_remarks.jinja b/tests/sdc-dcae-d/dcaed/assets/user_remarks.jinja new file mode 100644 index 00000000..ea01a249 --- /dev/null +++ b/tests/sdc-dcae-d/dcaed/assets/user_remarks.jinja @@ -0,0 +1 @@ +{"userRemarks":"{{user_remarks}}"}
\ No newline at end of file diff --git a/tests/sdc-dcae-d/dcaed/assets/user_remarks.template b/tests/sdc-dcae-d/dcaed/assets/user_remarks.template deleted file mode 100644 index 465115e6..00000000 --- a/tests/sdc-dcae-d/dcaed/assets/user_remarks.template +++ /dev/null @@ -1 +0,0 @@ -{"userRemarks":"${user_remarks}"}
\ No newline at end of file diff --git a/tests/sdc-dcae-d/dcaed/dcaed_interface.robot b/tests/sdc-dcae-d/dcaed/dcaed_interface.robot index e3aa4b91..481210d1 100644 --- a/tests/sdc-dcae-d/dcaed/dcaed_interface.robot +++ b/tests/sdc-dcae-d/dcaed/dcaed_interface.robot @@ -1,16 +1,16 @@ *** Settings *** Library json Library ONAPLibrary.Utilities - -Resource json_templater.robot +Library ONAPLibrary.SDC WITH NAME SDC +Library ONAPLibrary.Templating WITH NAME Templating Resource common.robot *** Variables *** ${DCAE_PATH} /dcae ${DCAE_CREATE_BLUEPRINT_PATH} /SERVICE/createBluePrint -${DCAE_VFCMT_TEMPLATE} ${ASSETS_DIR}create_vfcmt.template -${DCAE_COMPOSITION_TEMPLATE} ${ASSETS_DIR}dcae_composition.template -${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${ASSETS_DIR}dcae_monitoring_configuration.template +${DCAE_VFCMT_TEMPLATE} create_vfcmt.jinja +${DCAE_COMPOSITION_TEMPLATE} dcae_composition.jinja +${DCAE_MONITORING_CONFIGURATION_TEMPLATE} dcae_monitoring_configuration.jinja ${DCAE_BE_ENDPOINT} http://localhost:8082 *** Keywords *** @@ -19,57 +19,38 @@ Add VFCMT To DCAE-DS [Documentation] Create VFCMT with the given name and return its uuid [Arguments] ${vfcmt_name} ${map}= Create Dictionary vfcmtName=${vfcmt_name} description=VFCMT created by robot - ${data}= Fill JSON Template File ${DCAE_VFCMT_TEMPLATE} ${map} - ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/createVFCMT ${data} ${ASDC_DESIGNER_USER_ID} + Create Environment create_vfcmt ${ASSETS_DIR} + ${data}= Apply Template create_vfcmt ${DCAE_VFCMT_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/createVFCMT ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uuid']} -Run DCAE-DS Post Request - [Documentation] Runs a DCAE-DS post request - [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} - Log Creating session ${MY_DCAE_BE_ENDPOINT} - ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} - ${uuid}= Generate UUID4 - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Post Request sdc_dcae_ds ${data_path} data=${data} headers=${headers} - Log Received response from DCAE-BE: ${resp.text} - [Return] ${resp} - -Run DCAE-DS Put Request - [Documentation] Runs a DCAE-DS put request - [Arguments] ${data_path} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} - Log Creating session ${MY_DCAE_BE_ENDPOINT} - ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} - ${uuid}= Generate UUID4 - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Put Request sdc_dcae_ds ${data_path} headers=${headers} - Log Received response from DCAE-BE: ${resp.text} - [Return] ${resp} - Save Composition [Arguments] ${vfcmt_uuid} ${vf_uuid} ${map}= Create Dictionary cid=${vfcmt_uuid} vf_id=${vf_uuid} - ${data}= Fill JSON Template File ${DCAE_COMPOSITION_TEMPLATE} ${map} - ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID} + Create Environment dcae_composition ${ASSETS_DIR} + ${data}= Apply Template dcae_composition ${DCAE_COMPOSITION_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 Certify VFCMT [Arguments] ${vfcmt_uuid} - ${resp}= Run DCAE-DS Put Request ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} + ${resp}= SDC.Run Put Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} ${None} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uuid']} Add Monitoring Configuration To DCAE-DS [Arguments] ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} ${map}= Create Dictionary template_uuid=${vfcmt_uuid} service_uuid=${cs_uuid} vfi_name=${vfi_name} name=${mc_name} - ${data}= Fill JSON Template File ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map} - ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/importMC ${data} ${ASDC_DESIGNER_USER_ID} + Create Environment dcae_monitoring_configuration ${ASSETS_DIR} + ${data}= Apply Template dcae_monitoring_configuration ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/importMC ${data} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['vfcmt']['uuid']} Submit Monitoring Configuration To DCAE-DS [Arguments] ${mc_uuid} ${cs_uuid} ${vfi_name} ${url_vfi_name} url_encode_string ${vfi_name} - ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 diff --git a/tests/sdc-dcae-d/dcaed/json_templater.robot b/tests/sdc-dcae-d/dcaed/json_templater.robot deleted file mode 100644 index 33e8baa4..00000000 --- a/tests/sdc-dcae-d/dcaed/json_templater.robot +++ /dev/null @@ -1,20 +0,0 @@ -*** Settings *** -Documentation This resource is filling out json string templates and returning the json back -Library RequestsLibrary -Library ONAPLibrary.TemplatingKeywords -Library OperatingSystem - -*** Keywords *** -Fill JSON Template - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json} ${arguments} - ${returned_string}= Template String ${json} ${arguments} - ${returned_json}= To Json ${returned_string} - [Return] ${returned_json} - -Fill JSON Template File - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json_file} ${arguments} - ${json}= OperatingSystem.Get File ${json_file} - ${returned_json}= Fill JSON Template ${json} ${arguments} - [Return] ${returned_json} |