diff options
Diffstat (limited to 'vid-automation/src')
10 files changed, 41 insertions, 250 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 312c3fd99..329bb4a89 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -55,6 +55,7 @@ public enum Features implements Feature { FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG, FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE, + FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE ; public boolean isActive() { diff --git a/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh b/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh deleted file mode 100644 index 86fcadfef..000000000 --- a/vid-automation/src/main/resources/ci/scripts/copyToStorage.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -REPORT_NAME=$1 -VERSION=$2 -ENV=$3 - -if [ -z "$REPORT_NAME" ] - then - source ExtentReport/versions.info - now=$(date +'%Y-%m-%d_%H_%M') - REPORT_NAME="${now}" - VERSION="${osVersion}" - if [[ $env == *"DEV20"* ]] - then - ENV="Nightly" - else - ENV="" - fi - - fi - -/usr/bin/expect << EOF -spawn ssh admin@135.76.210.45 mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send "Aa123456\r" - } -} - -expect eof - -spawn scp -pr ExtentReport admin@135.76.210.45:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/ - -expect { - -re ".*es.*o.*" { - exp_send "yes\r" - exp_continue - } - -re ".*sword.*" { - exp_send "Aa123456\r" - } -} - -expect eof -EOF diff --git a/vid-automation/src/main/resources/ci/scripts/sendMail.sh b/vid-automation/src/main/resources/ci/scripts/sendMail.sh deleted file mode 100644 index 794534fc8..000000000 --- a/vid-automation/src/main/resources/ci/scripts/sendMail.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -now=$(date +'%Y%-m%d%H%M') - -REPORT_NAME=$1 -VERSION=$2 -ENV=$3 - -RECIPIENTS1="dl-sdcqa@intl.att.com,ml636r@intl.att.com,bl5783intl.att.com,ak314p@intl.att.com,el489u@intl.att.com,hk096q@intl.att.com,bs5719@intl.att.com" -RECIPIENTS2="dl-asdcqa@intl.att.com" - -source ExtentReport/versions.info -if [ -z "$REPORT_NAME" ] - then - source ExtentReport/versions.info - now=$(date +'%Y-%m-%d_%H_%M') - REPORT_NAME="${now}" - VERSION="${osVersion}" - - -fi - -if [[ $env == *"DEV20"* ]] - then - ENV="Nightly" - RECIPIENTS=$RECIPIENTS1 - else - ENV="" - RECIPIENTS=$RECIPIENTS2 -fi - -#REPORT_ZIP_FILE=ExtentReport_${now}.zip -REPORT_FOLDER='ExtentReport' -REPORT_HTML_FILE=${REPORT_FOLDER}/*Report.html -BODY_MESSAGE='Hello, \n\n Please find automation results on following link: \n\n http://asdc-srv-210-45.tlv.intl.att.com/'${ENV}'/'${VERSION}'/UI/'${REPORT_NAME}'/SDC_UI_Extent_Report.html \n\nThanks, \nASDC QA Team\n\n ' - -#OLD_FILE=$(find ./ -type f -name ${REPORT_ZIP_FILE} -print) -#if [ ! -z ${OLD_FILE} ] -#then -# rm -f ${REPORT_ZIP_FILE} -# echo "Removing old zip file............" -#fi - -#echo "Creating new zip file" -#zip -r ${REPORT_ZIP_FILE} ./${REPORT_FOLDER} - - - -echo -e ${BODY_MESSAGE} | mail -s 'E2E Automation '$ENV' results - SDC '$VERSION -r 'ASDC@Automation.team' $RECIPIENTS diff --git a/vid-automation/src/main/resources/ci/scripts/startTest.sh b/vid-automation/src/main/resources/ci/scripts/startTest.sh deleted file mode 100644 index e4c1a0995..000000000 --- a/vid-automation/src/main/resources/ci/scripts/startTest.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -REMOTE_DEBUG=false -RERUN=true -JAVA_OPTION="" -debug_port=8000 -TEST_SUITES=testSuites -fileName=testng-failed.xml - -function help_usage () -{ - echo - echo "$0 (<jar_file_name> <suite file name>) [-r/rerun <true/false> -d/debug <true/false>]" - echo "nohup ./startTest.sh ui-ci-1707.0.5-SNAPSHOT-jar-with-dependencies.jar extendedSanity.xml -r false -d true &" - echo "by default rerun is true and remote debug is false." - echo - exit 2 -} - -function isBoolean () -{ - PARAM_NAME=$1 - VALUE=$2 - if [[ ${VALUE} != "true" ]] && [[ ${VALUE} != "false" ]]; then - echo "Valid parameter" ${PARAM_NAME} "values are: true/false" - help_usage - fi -} - -function prepareFailedXmlFile () -{ - echo "1="$1 "2="$2 "fileName="${fileName} - PATTERN=`grep -w "test name=" ${FULL_PATH}/${TEST_SUITES}/$2 | awk -F'"' '{print $2}'` - sed '/<test name="'${PATTERN}'"/,/<!-- '${PATTERN}' --/d' $1 > ${FULL_PATH}/${TEST_SUITES}/${fileName} - sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName} -} - -#main -[ $# -lt 2 ] && help_usage - -JAR_FILE=$1 -SUITE_FILE=$2 - -while [ $# -ne 0 ]; do - case $1 in - -r|rerun) - RERUN=$2 - isBoolean $1 ${RERUN} - shift 1 - shift 1 - ;; - -d|debug) - REMOTE_DEBUG=$2 - isBoolean $1 ${REMOTE_DEBUG} - shift 1 - shift 1 - ;; - *) - shift 1 - ;; - esac -done - -CURRENT_DIR=`pwd` -BASEDIR=$(dirname $0) - -if [ ${BASEDIR:0:1} = "/" ] -then - FULL_PATH=$BASEDIR -else - FULL_PATH=$CURRENT_DIR/$BASEDIR -fi -LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties -############################################# -TARGET_DIR=${FULL_PATH}/target -CONF_FILE=${FULL_PATH}/conf/attsdc.yaml - -DEBUG=true -MainClass=org.onap.sdc.ci.tests.run.StartTest - -TESTS_DIR=/opt/app/sdc/ci/resources/tests -COMPONENTS_DIR=/opt/app/sdc/ci/resources/components - - -TARGET_LOG_DIR="${TARGET_DIR}/" - -if [ ${REMOTE_DEBUG} == "true" ]; then - echo "Debug mode, Listen on port $debug_port"; - JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ; -fi - -cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" - - -if [ $DEBUG == "true" ] -then - $cmd -else - $cmd >> /dev/null -fi - -if [ ${RERUN} == "true" ]; then - if [ -f ${TARGET_DIR}/${fileName} ]; then - echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ..."; - prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE; - SUITE_FILE=${fileName}; - cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" - $cmd; - fi -fi - -status=`echo $?` - -source ExtentReport/versions.info -now=$(date +'%Y-%m-%d_%H_%M') -REPORT_NAME=${now} -VERSION=${osVersion} - -if [[ $env == *"DEV20"* ]] -then - MYENV="Nightly" -else - MYENV="" -fi - -COPY_REPORT_SCRIPT="copyToStorage.sh" -chmod +x ${COPY_REPORT_SCRIPT} -echo "copy report to storage..." -sh ./${COPY_REPORT_SCRIPT} ${REPORT_NAME} ${VERSION} ${MYENV} - - -MAILING_SCRIPT_NAME="sendMail.sh" -chmod +x ${MAILING_SCRIPT_NAME} -echo "Sending report via mail..." -`./${MAILING_SCRIPT_NAME} ${REPORT_NAME} ${VERSION} ${MYENV}` - - -echo "##################################################" -echo "################# status is ${status} #################" -echo "##################################################" - -exit $status diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index 39110c550..05d73a619 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -774,11 +774,12 @@ public class AaiApiTest extends BaseApiAaiTest { new PresetAAIGetVpnsByType(), new PresetAAIGetSubscribersGet() ),CLEAR_THEN_SET); - - String url = uri + "/aai_get_vpn_list"; + String internalPath = "/aai_get_vpn_list"; + String url = uri + internalPath; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId,"/network/vpn-bindings" , 1); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath); } @Test diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java index f22b6de65..858b2f8ef 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java @@ -220,7 +220,7 @@ public class SdcApiTest extends BaseApiTest { public void whenCallSdc_thenRequestRecordedInMetricsLog() { ModelInfo modelInfo = ModelInfo.transportWithPnfsService; - + String internalPath = SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId; registerExpectationFromPresets(ImmutableList.of( new PresetSDCGetServiceToscaModelGet(modelInfo), new PresetSDCGetServiceMetadataGet(modelInfo), @@ -228,11 +228,12 @@ public class SdcApiTest extends BaseApiTest { ), CLEAR_THEN_SET); ResponseEntity<String> response = restTemplate.getForEntity( - buildUri(SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId), String.class); + buildUri(internalPath), String.class); final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, SDC_ROOT_PATH, 2); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath); } } diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java index 28b407697..8bc2a7390 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java @@ -139,6 +139,7 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ ResponseEntity<String> responseEntity = restTemplate.postForEntity(buildUri(MSO_ACTIVATE_FABRIC_CONFIGURATION), requestBody, String.class); String requestId = responseEntity.getHeaders().getFirst("X-ECOMP-RequestID-echo"); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, msoRootPath, 1); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, MSO_ACTIVATE_FABRIC_CONFIGURATION); } @Test(dataProvider = "errorCodes") diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java index e5a2a739b..f8bdc97e2 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java @@ -31,6 +31,7 @@ import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; +import org.onap.vid.more.LoggerFormatTest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.testng.ITestResult; @@ -150,13 +151,15 @@ public class ServiceTreeApiTest extends BaseApiTest { new PresetAAIGetCloudRegionFromVnf(vnfPreset1.getInstanceId()), new PresetAAIGetCloudRegionFromVnf(vnfPreset2.getInstanceId()), new PresetAAIGetCloudRegionFromVnf(vnfPreset3.getInstanceId()), - new PresetAAIGetCloudRegionFromVnf(vnfPreset4.getInstanceId()) + new PresetAAIGetCloudRegionFromVnf(vnfPreset4.getInstanceId()), + new PresetAAIGetSubscribersGet() ), CLEAR_THEN_SET); String api_url = "aai_search_group_members?subscriberId={subscriberId}&serviceType={serviceType}&serviceInvariantId={serviceInvariantId}" + "&groupType={groupType}&groupRole={groupRole}"; - final String response = restTemplate.getForObject(buildUri(api_url), String.class, "global-customer-id", "service-instance-type", "24632e6b-584b-4f45-80d4-fefd75fd9f14", "LOAD-GROUP", "SERVICE-ACCESS"); + final ResponseEntity<String> responseEntity = restTemplate.getForEntity(buildUri(api_url), String.class, "global-customer-id", "service-instance-type", "24632e6b-584b-4f45-80d4-fefd75fd9f14", "LOAD-GROUP", "SERVICE-ACCESS"); + String response = responseEntity.getBody(); LOGGER.info(response); @@ -176,6 +179,7 @@ public class ServiceTreeApiTest extends BaseApiTest { .replace("VNF4_INSTANCE_TYPE", vnfPreset4.getInstanceType()); assertJsonEquals(response, expected); + LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, echoedRequestId(responseEntity), "/network/generic-vnfs/generic-vnf/", 5); } @Test @@ -287,9 +291,14 @@ public class ServiceTreeApiTest extends BaseApiTest { .replace("NETWORK4_INSTANCE_NAME", l3NetworkPreset4.getInstanceName()) .replace("NETWORK4_INSTANCE_ID", l3NetworkPreset4.getInstanceId()); - String response = restTemplate.getForObject(buildUri(API_URL), String.class, "global-customer-id", "service-instance-type", "service-instance-id"); + ResponseEntity<String> response = restTemplate.getForEntity(buildUri(API_URL), String.class, "global-customer-id", "service-instance-type", "service-instance-id"); - assertJsonEquals(response, expected); + assertJsonEquals(response.getBody(), expected); + LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, echoedRequestId(response), "/vf-modules", 2); + } + + private String echoedRequestId(ResponseEntity<?> response) { + return response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); } @Override diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java index 6638a0e23..7a4eedfa9 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java +++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java @@ -131,6 +131,23 @@ public class LoggerFormatTest extends BaseApiTest { return lines; } + public static void verifyExistenceOfIncomingReqsInAuditLogs(RestTemplate restTemplate, URI uri, String requestId, + String path){ + List<String> logLines = getRequestLogLines(requestId, LogName.audit2019, restTemplate, uri); + String requestIdPrefix = "RequestID="; + assertThat("request id must be found in exactly two rows - entry & exit message in audit log, and include the req path", + logLines, + containsInRelativeOrder( + allOf( + containsString(requestIdPrefix+requestId), + containsString("ENTRY"), + containsString(path)), + allOf( + containsString(requestIdPrefix+requestId), + containsString("EXIT"), + containsString(path)) + )); + } public static void assertHeadersAndMetricLogs(RestTemplate restTemplate, URI uri, String requestId, String path, int requestsSize) { List<String> logLines = @@ -167,7 +184,7 @@ public class LoggerFormatTest extends BaseApiTest { } public static void assertIdsInMetricsLog(List<String> logLines, String requestId, String invocationId) { - assertThat("request id and invocation id must be found in exactly two rows", + assertThat("request id and invocation id must be found in exactly two rows in: \n" + String.join("\n", logLines), logLines, containsInRelativeOrder( allOf( diff --git a/vid-automation/src/test/resources/features.properties b/vid-automation/src/test/resources/features.properties index 63b9fc61b..08edbbe75 100644 --- a/vid-automation/src/test/resources/features.properties +++ b/vid-automation/src/test/resources/features.properties @@ -35,4 +35,5 @@ FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT = true FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH = false FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = true FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false -FLAG_SHOW_ORCHESTRATION_TYPE = false +FLAG_SHOW_ORCHESTRATION_TYPE = false, +FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE = false |