From 64755e08adfe535b5a52f6164f5ef8f0d5432323 Mon Sep 17 00:00:00 2001 From: "raviteja.karumuri" Date: Wed, 29 May 2024 18:20:42 +0100 Subject: [PATCH] Updating FTC 100 series tests to support a1pms V3 image Issue-ID: CCSDK-4013 Change-Id: Id250209efed7f8a4a67bd161b24e0ff894f915a8 Signed-off-by: Raviteja Karumuri --- test/auto-test/FTC100.sh | 896 ++++++++++++++++++++----------------- test/common/a1pms_api_functions.sh | 426 ++++++++++++++++-- test/common/cr_api_functions.sh | 2 +- test/common/create_rics_json.py | 5 + 4 files changed, 886 insertions(+), 443 deletions(-) diff --git a/test/auto-test/FTC100.sh b/test/auto-test/FTC100.sh index 04ff8d22..c034e712 100755 --- a/test/auto-test/FTC100.sh +++ b/test/auto-test/FTC100.sh @@ -81,548 +81,636 @@ else TESTED_PROTOCOLS="HTTP" fi -for __httpx in $TESTED_PROTOCOLS ; do - for interface in $TESTED_VARIANTS ; do +VERSIONS_TO_RUN=2 - echo "#####################################################################" - echo "#####################################################################" - echo "### Testing a1pms: $interface using $__httpx" - echo "#####################################################################" - echo "#####################################################################" - - # Clean container and start all needed containers # - clean_environment - - if [ $RUNMODE != "KUBE" ]; then - USE_ISTIO=0 - echo "ISTIO not supported by docker - setting USE-ISTIO=0" - fi - - if [ $USE_ISTIO -eq 1 ]; then - echo -e $RED"#########################################"$ERED - echo -e $RED"# Work around istio jwks cache"$ERED - echo -e $RED"# Cycle istiod down and up to clear cache"$ERED - echo "" - __kube_scale deployment istiod istio-system 0 - __kube_scale deployment istiod istio-system 1 - echo -e $RED"# Cycle istiod done" - echo -e $RED"#########################################"$ERED - - istio_enable_istio_namespace $KUBE_SIM_NAMESPACE - istio_enable_istio_namespace $KUBE_NONRTRIC_NAMESPACE - istio_enable_istio_namespace $KUBE_A1SIM_NAMESPACE - fi - - - start_kube_proxy - - if [ $USE_ISTIO -eq 1 ]; then - start_keycloak - - keycloak_api_obtain_admin_token - - keycloak_api_create_realm nrtrealm true 60 - keycloak_api_create_confidential_client nrtrealm a1pmsc - keycloak_api_generate_client_secret nrtrealm a1pmsc - keycloak_api_get_client_secret nrtrealm a1pmsc - keycloak_api_create_client_roles nrtrealm a1pmsc nrtrole - keycloak_api_map_client_roles nrtrealm a1pmsc nrtrole - - keycloak_api_get_client_token nrtrealm a1pmsc - - CLIENT_TOKEN=$(keycloak_api_read_client_token nrtrealm a1pmsc) - echo "CLIENT_TOKEN: "$CLIENT_TOKEN +if [ -n "$A1PMS_V3_FLAG" ] && [ "${A1PMS_V3_FLAG,,}" == "true" ]; then + VERSIONS_TO_RUN=3 +fi - A1PMS_SEC=$(keycloak_api_read_client_secret nrtrealm a1pmsc) - echo "A1PMS_SEC: "$A1PMS_SEC +for version in $(seq 2 $VERSIONS_TO_RUN); do + if [ "$version" == "3" ]; then + if [ -n "$A1PMS_V3" ] && [ -n "$A1PMS_API_PREFIX_V3" ] && [ -n "$A1PMS_ALIVE_URL_V3" ]; then + export A1PMS_VERSION="$A1PMS_V3" + export A1PMS_API_PREFIX="$A1PMS_API_PREFIX_V3" + export A1PMS_ALIVE_URL="$A1PMS_API_PREFIX$A1PMS_ALIVE_URL_V3" + else + echo "One/All parameters not set in env file (, , )" + break + fi + fi + for __httpx in $TESTED_PROTOCOLS ; do + for interface in $TESTED_VARIANTS ; do - # Protect ricsim-g3 - istio_req_auth_by_jwks ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" - istio_auth_policy_by_issuer ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY + echo "#####################################################################" + echo "#####################################################################" + echo "### Testing a1pms: ${interface} and ${__httpx} with a1pms V${version} " + echo "#####################################################################" + echo "#####################################################################" - istio_req_auth_by_jwksuri ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm - istio_auth_policy_by_realm ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + # Clean container and start all needed containers # + clean_environment - # Protect ricsim-g2 - istio_req_auth_by_jwks ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" - istio_auth_policy_by_issuer ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY + if [ $RUNMODE != "KUBE" ]; then + USE_ISTIO=0 + echo "ISTIO not supported by docker - setting USE-ISTIO=0" + fi + + if [ $USE_ISTIO -eq 1 ]; then + echo -e $RED"#########################################"$ERED + echo -e $RED"# Work around istio jwks cache"$ERED + echo -e $RED"# Cycle istiod down and up to clear cache"$ERED + echo "" + __kube_scale deployment istiod istio-system 0 + __kube_scale deployment istiod istio-system 1 + echo -e $RED"# Cycle istiod done" + echo -e $RED"#########################################"$ERED + + istio_enable_istio_namespace $KUBE_SIM_NAMESPACE + istio_enable_istio_namespace $KUBE_NONRTRIC_NAMESPACE + istio_enable_istio_namespace $KUBE_A1SIM_NAMESPACE + fi + + + start_kube_proxy + + if [ $USE_ISTIO -eq 1 ]; then + start_keycloak + + keycloak_api_obtain_admin_token + + keycloak_api_create_realm nrtrealm true 60 + keycloak_api_create_confidential_client nrtrealm a1pmsc + keycloak_api_generate_client_secret nrtrealm a1pmsc + keycloak_api_get_client_secret nrtrealm a1pmsc + keycloak_api_create_client_roles nrtrealm a1pmsc nrtrole + keycloak_api_map_client_roles nrtrealm a1pmsc nrtrole + + keycloak_api_get_client_token nrtrealm a1pmsc + + CLIENT_TOKEN=$(keycloak_api_read_client_token nrtrealm a1pmsc) + echo "CLIENT_TOKEN: "$CLIENT_TOKEN + + A1PMS_SEC=$(keycloak_api_read_client_secret nrtrealm a1pmsc) + echo "A1PMS_SEC: "$A1PMS_SEC + + # Protect ricsim-g3 + istio_req_auth_by_jwks ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" + istio_auth_policy_by_issuer ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY + + istio_req_auth_by_jwksuri ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm + istio_auth_policy_by_realm ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + + # Protect ricsim-g2 + istio_req_auth_by_jwks ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" + istio_auth_policy_by_issuer ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY + + istio_req_auth_by_jwksuri ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm + istio_auth_policy_by_realm ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + + # Protect ricsim-g3 + istio_req_auth_by_jwks ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" + istio_auth_policy_by_issuer ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY + + istio_req_auth_by_jwksuri ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm + istio_auth_policy_by_realm ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + + # Protect CR + istio_req_auth_by_jwks $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" + istio_auth_policy_by_issuer $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY + + istio_req_auth_by_jwksuri $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm + istio_auth_policy_by_realm $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm a1pmsc nrtrole + + a1pms_configure_sec nrtrealm a1pmsc $A1PMS_SEC + fi + + if [ $__httpx == "HTTPS" ]; then + use_cr_https + use_a1pms_rest_https + else + use_a1pms_rest_http + use_cr_http + fi + + start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE + + set_a1pms_debug + + # Create service to be able to receive events when rics becomes available + # Must use rest towards the a1pms since dmaap is not configured yet + a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" + + + if [ $__httpx == "HTTPS" ]; then + use_simulator_https + use_mr_https + if [[ $interface = *"SDNC"* ]]; then + if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then + deviation "SDNC does not support NB https" + use_sdnc_http + else + use_sdnc_https + fi + fi + if [[ $interface = *"DMAAP"* ]]; then + use_a1pms_dmaap_https + else + use_a1pms_rest_https + fi + else + use_simulator_http + use_mr_http + if [[ $interface = *"SDNC"* ]]; then + use_sdnc_http + fi + if [[ $interface = *"DMAAP"* ]]; then + use_a1pms_dmaap_http + else + use_a1pms_rest_http + fi + fi + + start_ric_simulators ricsim_g1 1 OSC_2.1.0 + start_ric_simulators ricsim_g2 1 STD_1.1.3 + + sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json + sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json + + start_ric_simulators ricsim_g3 1 STD_2.0.0 + sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json + sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json + + if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then + : + else + start_mr + fi + + start_cr 1 + + start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE - istio_req_auth_by_jwksuri ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm - istio_auth_policy_by_realm ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then + start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE + fi - # Protect ricsim-g3 - istio_req_auth_by_jwks ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" - istio_auth_policy_by_issuer ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY - istio_req_auth_by_jwksuri ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm - istio_auth_policy_by_realm ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole + if [[ $interface = *"SDNC"* ]]; then + start_sdnc + controller_api_wait_for_status_ok 200 ricsim_g1_1 + prepare_a1pms_config SDNC ".a1pms_config.json" + else + prepare_a1pms_config NOSDNC ".a1pms_config.json" + fi - # Protect CR - istio_req_auth_by_jwks $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS" - istio_auth_policy_by_issuer $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY + if [ $RUNMODE == "KUBE" ]; then + a1pms_load_config ".a1pms_config.json" + else + #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config + if [ $__httpx == "HTTPS" ]; then + use_a1pms_rest_https + else + use_a1pms_rest_http + fi - istio_req_auth_by_jwksuri $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm - istio_auth_policy_by_realm $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm a1pmsc nrtrole + if [[ $interface != *"DMAAP"* ]]; then + echo "{}" > ".a1pms_config_incorrect.json" + a1pms_api_put_configuration 400 ".a1pms_config_incorrect.json" + fi - a1pms_configure_sec nrtrealm a1pmsc $A1PMS_SEC - fi + a1pms_api_put_configuration 200 ".a1pms_config.json" + a1pms_api_get_configuration 200 ".a1pms_config.json" + if [ $__httpx == "HTTPS" ]; then + if [[ $interface = *"DMAAP"* ]]; then + use_a1pms_dmaap_https + else + use_a1pms_rest_https + fi + else + if [[ $interface = *"DMAAP"* ]]; then + use_a1pms_dmaap_http + else + use_a1pms_rest_http + fi + fi + fi - if [ $__httpx == "HTTPS" ]; then - use_cr_https - use_a1pms_rest_https - else - use_a1pms_rest_http - use_cr_http - fi + a1pms_equal json:rics 3 300 - start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE + if [ "$A1PMS_VERSION" == "V2" ]; then + a1pms_equal json:policy-types 5 120 #Wait for the a1pms to refresh types from the simulator + elif [ "$A1PMS_VERSION" == "V3" ]; then + a1pms_equal json:policytypes 5 120 #Wait for the a1pms to refresh types from the simulator + fi - set_a1pms_debug + a1pms_equal json:policies 0 - # Create service to be able to receive events when rics becomes available - # Must use rest towards the a1pms since dmaap is not configured yet - a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" + if [ "$A1PMS_VERSION" == "V2" ]; then + a1pms_equal json:policy-instances 0 + fi + cr_equal 0 received_callbacks 3 120 + cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1 - if [ $__httpx == "HTTPS" ]; then - use_simulator_https - use_mr_https - if [[ $interface = *"SDNC"* ]]; then - if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then - deviation "SDNC does not support NB https" - use_sdnc_http - else - use_sdnc_https - fi - fi - if [[ $interface = *"DMAAP"* ]]; then - use_a1pms_dmaap_https - else - use_a1pms_rest_https - fi - else - use_simulator_http - use_mr_http - if [[ $interface = *"SDNC"* ]]; then - use_sdnc_http - fi - if [[ $interface = *"DMAAP"* ]]; then - use_a1pms_dmaap_http - else - use_a1pms_rest_http - fi - fi + if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then + : + else + mr_equal requests_submitted 0 + fi - start_ric_simulators ricsim_g1 1 OSC_2.1.0 - start_ric_simulators ricsim_g2 1 STD_1.1.3 - sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json - sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json + echo "############################################" + echo "############## Health check ################" + echo "############################################" - start_ric_simulators ricsim_g3 1 STD_2.0.0 - sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json - sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json + sleep_wait 120 "Let A1PMS configuration take effect" - if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then - : - else - start_mr - fi + a1pms_api_get_status 200 - start_cr 1 + a1pms_api_get_status_root 200 - start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE + echo "############################################" + echo "##### Service registry and supervision #####" + echo "############################################" - if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then - start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE - fi + a1pms_api_get_services 404 "service1" + a1pms_api_put_service 201 "service1" 1000 "$CR_SERVICE_APP_PATH_0/1" - if [[ $interface = *"SDNC"* ]]; then - start_sdnc - controller_api_wait_for_status_ok 200 ricsim_g1_1 - prepare_a1pms_config SDNC ".a1pms_config.json" - else - prepare_a1pms_config NOSDNC ".a1pms_config.json" - fi + a1pms_api_put_service 200 "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" - if [ $RUNMODE == "KUBE" ]; then - a1pms_load_config ".a1pms_config.json" - else - #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config - if [ $__httpx == "HTTPS" ]; then - use_a1pms_rest_https - else - use_a1pms_rest_http - fi - if [[ $interface != *"DMAAP"* ]]; then - echo "{}" > ".a1pms_config_incorrect.json" - a1pms_api_put_configuration 400 ".a1pms_config_incorrect.json" - fi + a1pms_api_put_service 400 "service2" -1 "$CR_SERVICE_APP_PATH_0/2" - a1pms_api_put_configuration 200 ".a1pms_config.json" - a1pms_api_get_configuration 200 ".a1pms_config.json" - if [ $__httpx == "HTTPS" ]; then - if [[ $interface = *"DMAAP"* ]]; then - use_a1pms_dmaap_https - else - use_a1pms_rest_https - fi - else - if [[ $interface = *"DMAAP"* ]]; then - use_a1pms_dmaap_http - else - use_a1pms_rest_http - fi - fi - fi + a1pms_api_put_service 400 "service2" "wrong" "$CR_SERVICE_APP_PATH_0/2" - a1pms_equal json:rics 3 300 + a1pms_api_put_service 400 "service2" 100 "/test" - a1pms_equal json:policy-types 5 120 + a1pms_api_put_service 400 "service2" 100 "test-path" - a1pms_equal json:policies 0 + a1pms_api_put_service 201 "service2" 300 "ftp://localhost:80/test" - a1pms_equal json:policy-instances 0 + a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" - cr_equal 0 received_callbacks 3 120 - cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1 + a1pms_api_get_service_ids 200 "service1" "service2" "ric-registration" - if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then - : - else - mr_equal requests_submitted 0 - fi + a1pms_api_put_service 201 "service3" 5000 "$CR_SERVICE_APP_PATH_0/3" - echo "############################################" - echo "############## Health check ################" - echo "############################################" + a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" - sleep_wait 120 "Let A1PMS configuration take effect" - a1pms_api_get_status 200 + a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" - a1pms_api_get_status_root 200 + a1pms_api_get_services 200 NOSERVICE "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_SERVICE_APP_PATH_0/3" "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" - echo "############################################" - echo "##### Service registry and supervision #####" - echo "############################################" + a1pms_api_get_services 200 - a1pms_api_get_services 404 "service1" + if [ "$A1PMS_VERSION" == "V2" ]; then + deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx" + #The below should work, kept here until fixed or other decision made + #a1pms_api_put_services_keepalive 201 "service1" + #Using the below until decision + a1pms_api_put_services_keepalive 200 "service1" - a1pms_api_put_service 201 "service1" 1000 "$CR_SERVICE_APP_PATH_0/1" + deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx" + #The below should work, keept here until fixed or other decision made + #a1pms_api_put_services_keepalive 201 "service3" + #Using the below until decision + a1pms_api_put_services_keepalive 200 "service3" - a1pms_api_put_service 200 "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" + a1pms_api_put_services_keepalive 200 "service1" + a1pms_api_put_services_keepalive 200 "service3" - a1pms_api_put_service 400 "service2" -1 "$CR_SERVICE_APP_PATH_0/2" + a1pms_api_put_services_keepalive 404 "service5" + fi - a1pms_api_put_service 400 "service2" "wrong" "$CR_SERVICE_APP_PATH_0/2" + a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" - a1pms_api_put_service 400 "service2" 100 "/test" + a1pms_api_delete_services 204 "service1" - a1pms_api_put_service 400 "service2" 100 "test-path" + a1pms_api_get_service_ids 200 "service2" "service3" "ric-registration" - a1pms_api_put_service 201 "service2" 300 "ftp://localhost:80/test" - a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" + a1pms_api_put_service 201 "service1" 50 "$CR_SERVICE_APP_PATH_0/1" - a1pms_api_get_service_ids 200 "service1" "service2" "ric-registration" + a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" - a1pms_api_put_service 201 "service3" 5000 "$CR_SERVICE_APP_PATH_0/3" + a1pms_api_delete_services 204 "service1" + a1pms_api_delete_services 204 "service3" + a1pms_equal json:services 2 - a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" + a1pms_api_delete_services 204 "service2" + a1pms_equal json:services 1 - a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" + echo "############################################" + echo "############## RIC Repository ##############" + echo "############################################" - a1pms_api_get_services 200 NOSERVICE "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_SERVICE_APP_PATH_0/3" "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" + a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" - a1pms_api_get_services 200 + a1pms_api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" - deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx" - #The below should work, keept here until fixed or other decision made - #a1pms_api_put_services_keepalive 201 "service1" - #Using the below until decision - a1pms_api_put_services_keepalive 200 "service1" + a1pms_api_get_rics 404 47 - deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx" - #The below should work, keept here until fixed or other decision made - #a1pms_api_put_services_keepalive 201 "service3" - #Using the below until decision - a1pms_api_put_services_keepalive 200 "service3" + a1pms_api_get_rics 404 "test" - a1pms_api_put_services_keepalive 200 "service1" + a1pms_api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" - a1pms_api_put_services_keepalive 200 "service3" + a1pms_api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" - a1pms_api_put_services_keepalive 404 "service5" + a1pms_api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" - a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" + a1pms_api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" - a1pms_api_delete_services 204 "service1" + a1pms_api_get_ric 200 me1_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" - a1pms_api_get_service_ids 200 "service2" "service3" "ric-registration" + a1pms_api_get_ric 200 me2_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_get_ric 200 NOME ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" - a1pms_api_put_service 201 "service1" 50 "$CR_SERVICE_APP_PATH_0/1" + a1pms_api_get_ric 200 NOME ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" - a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration" + a1pms_api_get_ric 200 NOME ricsim_g3_1 "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_get_ric 404 NOME test1 - a1pms_api_delete_services 204 "service1" - a1pms_api_delete_services 204 "service3" + a1pms_api_get_ric 404 test NORIC - a1pms_equal json:services 2 + a1pms_api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1 - a1pms_api_delete_services 204 "service2" + a1pms_api_get_ric 400 me1_ricsim_g1_1 TESTRIC - a1pms_equal json:services 1 + a1pms_api_get_ric 400 TESTME ricsim_g1_1 + echo "############################################" + echo "########### A1 Policy Management ###########" + echo "############################################" - echo "############################################" - echo "############## RIC Repository ##############" - echo "############################################" + deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" + #Behaviour accepted for now + a1pms_api_get_policy_type 200 1 testdata/OSC/1-a1pms-modified.json + deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" + #Behaviour accepted for now + a1pms_api_get_policy_type 200 2 testdata/OSC/2-a1pms-modified.json + deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" + #Behaviour accepted for now + a1pms_api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-a1pms-modified.json + deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" + #Behaviour accepted for now + a1pms_api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-a1pms-modified.json - a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_get_policy_type 404 3 + if [ "$A1PMS_VERSION" != "V3" ]; then + a1pms_api_get_policy_schemas 404 - a1pms_api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" + a1pms_api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0 - a1pms_api_get_rics 404 47 + a1pms_api_get_policy_types 200 ricsim_g1_1 1 2 - a1pms_api_get_rics 404 "test" + a1pms_api_get_policy_types 200 ricsim_g2_1 EMPTY - a1pms_api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" + a1pms_api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0 - a1pms_api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" + a1pms_api_get_policy_types 404 dummy-ric + fi - a1pms_api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" + if [ "$A1PMS_VERSION" == "V3" ]; then - a1pms_api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" + a1pms_api_get_policy_types_v3 200 NORIC 1:ricsim_g1_1 2:ricsim_g1_1 EMPTY:ricsim_g2_1 STD_QOS_0_2_0:ricsim_g3_1 STD_QOS2_0.1.0:ricsim_g3_1 - a1pms_api_get_ric 200 me1_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_get_policy_types_v3 200 ricsim_g1_1 1:ricsim_g1_1 2:ricsim_g1_1 - a1pms_api_get_ric 200 me2_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_get_policy_types_v3 200 ricsim_g2_1 EMPTY:ricsim_g2_1 - a1pms_api_get_ric 200 NOME ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE" + a1pms_api_get_policy_types_v3 200 ricsim_g3_1 STD_QOS_0_2_0:ricsim_g3_1 STD_QOS2_0.1.0:ricsim_g3_1 - a1pms_api_get_ric 200 NOME ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE" + a1pms_api_get_policy_types_v3 404 dummy-ric - a1pms_api_get_ric 200 NOME ricsim_g3_1 "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE" + a1pms_api_post_policy_v3 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT NONOTIFYURL testdata/OSC/pi1_template.json - a1pms_api_get_ric 404 NOME test1 + a1pms_api_post_policy_v3 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT NONOTIFYURL testdata/OSC/pi1_template.json - a1pms_api_get_ric 404 test NORIC + a1pms_api_post_policy_v3 201 NOSERVICE ricsim_g2_1 NOTYPE 5100 NOTRANSIENT NONOTIFYURL testdata/STD/pi1_template.json - a1pms_api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1 + a1pms_api_post_policy_v3 201 NOSERVICE ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT NONOTIFYURL testdata/STD2/pi_qos2_template.json + fi - a1pms_api_get_ric 400 me1_ricsim_g1_1 TESTRIC + a1pms_api_put_service 201 "service10" 3600 "$CR_SERVICE_APP_PATH_0/1" - a1pms_api_get_ric 400 TESTME ricsim_g1_1 + notificationurl=$CR_SERVICE_APP_PATH_0"/test" + deviation "TR10 - a1pms allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx" - echo "############################################" - echo "########### A1 Policy Management ###########" - echo "############################################" + if [ "$A1PMS_VERSION" != "V3" ]; then - deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" - #Behaviour accepted for now - a1pms_api_get_policy_type 200 1 testdata/OSC/1-a1pms-modified.json - deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" - #Behaviour accepted for now - a1pms_api_get_policy_type 200 2 testdata/OSC/2-a1pms-modified.json - deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" - #Behaviour accepted for now - a1pms_api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-a1pms-modified.json - deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx" - #Behaviour accepted for now - a1pms_api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-a1pms-modified.json - - a1pms_api_get_policy_type 404 3 - - a1pms_api_get_policy_schemas 404 - - - a1pms_api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0 - - a1pms_api_get_policy_types 200 ricsim_g1_1 1 2 - - a1pms_api_get_policy_types 200 ricsim_g2_1 EMPTY - - a1pms_api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0 - - a1pms_api_get_policy_types 404 dummy-ric - - - - a1pms_api_put_service 201 "service10" 3600 "$CR_SERVICE_APP_PATH_0/1" - - notificationurl=$CR_SERVICE_APP_PATH_0"/test" + if [[ $interface != *"DMAAP"* ]]; then + # Badly formatted json is not possible to send via dmaap + a1pms_api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi_bad_template.json + fi + a1pms_api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json - if [[ $interface != *"DMAAP"* ]]; then - # Badly formatted json is not possible to send via dmaap - a1pms_api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi_bad_template.json - fi - deviation "TR10 - a1pms allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx" - #Kept until decison - #a1pms_api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json - #Allow 201 for now - a1pms_api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json + a1pms_api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json - a1pms_api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json + a1pms_api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json - a1pms_api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json + a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json - a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json + a1pms_api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json + a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json - a1pms_api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json - a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json + a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json + a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json - a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json - a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json + a1pms_api_get_policy_status 404 1 + a1pms_api_get_policy_status 404 2 + if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then + VAL='NOT IN EFFECT' + VAL2="false" + VAL3=EMPTY + VAL4=EMPTY + else + VAL="NOT_ENFORCED" + VAL2="OTHER_REASON" + VAL3="NOT_ENFORCED" + VAL4="OTHER_REASON" + fi + a1pms_api_get_policy_status 200 5000 OSC "$VAL" "$VAL2" + a1pms_api_get_policy_status 200 5100 STD "UNDEFINED" + a1pms_api_get_policy_status 200 5200 STD2 $VAL3 $VAL4 - a1pms_api_get_policy_status 404 1 - a1pms_api_get_policy_status 404 2 - if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then - VAL='NOT IN EFFECT' - VAL2="false" - VAL3=EMPTY - VAL4=EMPTY - else - VAL="NOT_ENFORCED" - VAL2="OTHER_REASON" - VAL3="NOT_ENFORCED" - VAL4="OTHER_REASON" - fi - a1pms_api_get_policy_status 200 5000 OSC "$VAL" "$VAL2" - a1pms_api_get_policy_status 200 5100 STD "UNDEFINED" - a1pms_api_get_policy_status 200 5200 STD2 $VAL3 $VAL4 + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_equal json:policy_ids 2 + #Allow 3 for now + a1pms_equal json:policy-instances 4 + fi + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_equal json:policies 2 + #Allow 3 for now + a1pms_equal json:policies 4 - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_equal json:policies 2 - #Allow 3 for now - a1pms_equal json:policies 4 + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 + #Allow policy create with unregistered service for now - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_equal json:policy_ids 2 - #Allow 3 for now - a1pms_equal json:policy-instances 4 + if [ "$A1PMS_VERSION" != "V3" ]; then + a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200 - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 - #Allow policy create with unregistered service for now - a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200 + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 + #Allow policy create with unregistered service for now + a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000 - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 - #Allow policy create with unregistered service for now - a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000 + a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100 - a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100 + a1pms_api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200 - a1pms_api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200 + a1pms_api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200 - a1pms_api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200 + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 + #Allow policy create with unregistered service for now - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 - #Allow policy create with unregistered service for now + a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000 - a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000 + a1pms_api_get_policy_ids 200 NORIC NOSERVICE 2 NOID - a1pms_api_get_policy_ids 200 NORIC NOSERVICE 2 NOID + a1pms_api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200 - a1pms_api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200 + a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID + fi - a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID + if [ "$A1PMS_VERSION" == "V3" ]; then + a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE NOTYPE 5000:ricsim_g1_1 5100:ricsim_g2_1 2000:ricsim_g1_1 5200:ricsim_g3_1 - a1pms_api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 + #Allow policy create with unregistered service for now + a1pms_api_get_all_policies_v3 200 ricsim_g1_1 NOSERVICE NOTYPE 5000:ricsim_g1_1 2000:ricsim_g1_1 - a1pms_api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl + a1pms_api_get_all_policies_v3 200 ricsim_g2_1 NOSERVICE NOTYPE 5100:ricsim_g2_1 - a1pms_api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 false $notificationurl + a1pms_api_get_all_policies_v3 200 ricsim_g3_1 NOSERVICE NOTYPE 5200:ricsim_g3_1 - a1pms_api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json + a1pms_api_get_all_policies_v3 200 NORIC "service10" NOTYPE 5000:ricsim_g1_1 - deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" - #kept until decision - #a1pms_api_delete_policy 404 2000 - #Allow policy create with unregistered service for now - a1pms_api_delete_policy 204 2000 + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 + #Allow policy create with unregistered service for now - a1pms_api_delete_policy 404 1500 + a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE 1 5000:ricsim_g1_1 2000:ricsim_g1_1 - a1pms_api_delete_policy 204 5000 + a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE 2 NOID - a1pms_api_delete_policy 204 5200 + a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200:ricsim_g3_1 - a1pms_equal json:policies 1 + a1pms_api_get_all_policies_v3 200 ricsim_g2_1 NOSERVICE 1 NOID + fi + a1pms_api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl - a1pms_equal json:policy-instances 1 + a1pms_api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl - a1pms_api_delete_policy 204 5100 + a1pms_api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 false $notificationurl - a1pms_equal json:policies 0 + if [ "$A1PMS_VERSION" != "V3" ]; then + a1pms_api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json + fi - a1pms_equal json:policy-instances 0 + if [ "$A1PMS_VERSION" == "V3" ]; then + a1pms_api_put_policy_v3 200 5100 testdata/STD/pi1_template.json - cr_equal 0 received_callbacks 3 + a1pms_api_put_policy_v3 200 5200 testdata/STD2/pi_qos2_template.json - if [[ $interface = *"DMAAP"* ]]; then - mr_greater requests_submitted 0 - VAL=$(mr_read requests_submitted) - mr_equal requests_fetched $VAL - mr_equal responses_submitted $VAL - mr_equal responses_fetched $VAL - mr_equal current_requests 0 - mr_equal current_responses 0 - else - if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then - : - else - mr_equal requests_submitted 0 - fi - fi - if [ $USE_ISTIO -eq 0 ]; then - if [[ $interface = *"SDNC"* ]]; then - sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME - sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME - sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME - else - sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME - sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME - sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME + if [[ $interface != *"DMAAP"* ]]; then + a1pms_api_put_policy_v3 400 2000 testdata/OSC/pi_bad_template.json fi - fi - - check_a1pms_logs - - if [[ $interface = *"SDNC"* ]]; then - check_sdnc_logs - fi - - store_logs "${__httpx}__${interface}" - - done + fi + deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx" + #kept until decision + #a1pms_api_delete_policy 404 2000 + #Allow policy create with unregistered service for now + a1pms_api_delete_policy 204 2000 + + a1pms_api_delete_policy 404 1500 + + a1pms_api_delete_policy 204 5000 + + a1pms_api_delete_policy 204 5200 + + a1pms_equal json:policies 1 + + if [ "$A1PMS_VERSION" != "V3" ]; then + a1pms_equal json:policy-instances 1 + fi + + a1pms_api_delete_policy 204 5100 + + a1pms_equal json:policies 0 + + if [ "$A1PMS_VERSION" != "V3" ]; then + a1pms_equal json:policy-instances 0 + fi + + cr_equal 0 received_callbacks 3 + + if [[ $interface = *"DMAAP"* ]]; then + mr_greater requests_submitted 0 + VAL=$(mr_read requests_submitted) + mr_equal requests_fetched $VAL + mr_equal responses_submitted $VAL + mr_equal responses_fetched $VAL + mr_equal current_requests 0 + mr_equal current_responses 0 + else + if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then + : + else + mr_equal requests_submitted 0 + fi + fi + if [ $USE_ISTIO -eq 0 ]; then + if [[ $interface = *"SDNC"* ]]; then + sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME + sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME + sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME + else + sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME + sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME + sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME + fi + fi + + check_a1pms_logs + + if [[ $interface = *"SDNC"* ]]; then + check_sdnc_logs + fi + + store_logs "${__httpx}__${interface}" + + done + + done done - #### TEST COMPLETE #### diff --git a/test/common/a1pms_api_functions.sh b/test/common/a1pms_api_functions.sh index 93976267..ceef204e 100644 --- a/test/common/a1pms_api_functions.sh +++ b/test/common/a1pms_api_functions.sh @@ -865,10 +865,9 @@ a1pms_api_get_policies() { } -# API Test function: GET /policy and V2 GET /v2/policies/{policy_id} +# API Test function: GET /policy, V2 GET /v2/policies/{policy_id} and V3 GET a1policymanagement/v1/policies/{policy_id} # args: [] # args(V2): [ |NOTYPE |NOURL ] - # (Function for test scripts) a1pms_api_get_policy() { __log_test_start $@ @@ -879,6 +878,12 @@ a1pms_api_get_policy() { return 1 fi query="/v2/policies/$UUID$2" + elif [ "$A1PMS_VERSION" == "V3" ]; then + if [ $# -ne 2 ] && [ $# -ne 8 ]; then + __print_err " [ |NOTYPE |NOURL ]" $@ + return 1 + fi + query="/v1/policies/$UUID$2" else if [ $# -lt 2 ] || [ $# -gt 3 ]; then __print_err " [] " $@ @@ -917,6 +922,20 @@ a1pms_api_get_policy() { targetJson=$targetJson", \"policy_data\":$data" targetJson="{$targetJson}" + echo "TARGET JSON: $targetJson" >>$HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + elif [ "$A1PMS_VERSION" == "V3" ]; then + if [ $# -eq 8 ]; then + #Create a policy json to compare with + body=${res:0:${#res}-3} + data=$(sed 's/XXX/'${2}'/g' $3) + targetJson=$data + echo "TARGET JSON: $targetJson" >>$HTTPLOG res=$(python3 ../common/compare_json.py "$targetJson" "$body") if [ $res -ne 0 ]; then @@ -939,7 +958,7 @@ a1pms_api_get_policy() { fi fi - __collect_endpoint_stats "A1PMS" 01 "GET" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status + __collect_endpoint_stats "A1PMS" 01 "GET" ${A1PMS_API_PREFIX}${query} ${status} __log_test_pass return 0 } @@ -951,7 +970,7 @@ a1pms_api_get_policy() { a1pms_api_put_policy() { __log_test_start $@ - if [ "$A1PMS_VERSION" == "V2" ]; then + if [ "$A1PMS_VERSION" == "V2" ] || [ "$A1PMS_VERSION" == "V3" ]; then if [ $# -lt 8 ] || [ $# -gt 9 ]; then __print_err " |NOTYPE |NOTRANSIENT |NOURL []" $@ return 1 @@ -1032,7 +1051,122 @@ a1pms_api_put_policy() { let count=$count+1 echo -ne " Executed "$count"("$max")${SAMELINE}" done - __collect_endpoint_stats "A1PMS" 02 "PUT" $A1PMS_API_PREFIX"/v2/policies" $status $max + __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${query} ${status} ${max} + echo "" + + __log_test_pass + return 0 +} + +# API Test function: V3 PUT a1policymanagement/v1/policies +# args: [] +# args(V2): [] +# (Function for test scripts) +a1pms_api_put_policy_v3() { + __log_test_start $@ + + if [ $# -lt 3 ] || [ $# -gt 4 ]; then + __print_err " []" $@ + return 1 + fi + + count=0 + max=1 + pid=$2 + temp=$3 + + if [ $# -eq 4 ]; then + max=$4 + fi + + while [ $count -lt $max ]; do + query="/v1/policies/$UUID$pid" + file="./tmp/.p_v3.json" + let update_value=$pid+300 + data=$(sed 's/XXX/'${update_value}'/g' $temp) + inputJson="$data" + echo $inputJson >$file + res="$(__do_curl_to_api A1PMS PUT $query $file)" + status=${res:${#res}-3} + echo -ne " Executing "$count"("$max")${SAMELINE}" + if [ $status -ne $1 ]; then + echo " Executed "$count"?("$max")" + __log_test_fail_status_code $1 $status + return 1 + fi + let pid=$pid+1 + let count=$count+1 + echo -ne " Executed "$count"("$max")${SAMELINE}" + done + __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${query} ${status} ${max} + echo "" + + __log_test_pass + return 0 +} + +# API Test function: V£ POST a1policymanagement/v1/policies +# args: |NOTYPE |NOTRANSIENT [] +# args(V2): |NOTYPE |NOTRANSIENT |NOURL [] +# (Function for test scripts) +a1pms_api_post_policy_v3() { + __log_test_start $@ + + if [ $# -lt 8 ] || [ $# -gt 9 ]; then + __print_err " |NOTYPE |NOTRANSIENT |NOURL []" $@ + return 1 + fi + + count=0 + max=1 + serv=$2 + ric=$3 + pt=$4 + pid=$5 + trans=$6 + noti=$7 + temp=$8 + if [ $# -eq 9 ]; then + max=$9 + fi + + while [ $count -lt $max ]; do + query="/v1/policies" + + inputJson="\"nearRtRicId\":\"$ric\"" + if [ $pt != "NOTYPE" ]; then + inputJson=$inputJson", \"policyTypeId\":\"$pt\"" + else + inputJson=$inputJson", \"policyTypeId\":\"\"" + fi + if [ $serv != "NOSERVICE" ]; then + inputJson=$inputJson", \"serviceId\":\"$serv\"" + fi + if [ $noti != "NONOTIFYURL" ]; then + inputJson=$inputJson", \"statusNotificationUri\":\"$noti\"" + fi + if [ $trans != "NOTRANSIENT" ]; then + inputJson=$inputJson", \"transient\":\"$trans\"" + fi + file="./tmp/.p.json" + data=$(sed 's/XXX/'${pid}'/g' $temp) + inputJson=$inputJson", \"policyObject\":$data" + inputJson=$inputJson", \"policyId\":\"$UUID$pid\"" + inputJson="{$inputJson}" + echo $inputJson >$file + res="$(__do_curl_to_api A1PMS POST $query $file)" + status=${res:${#res}-3} + echo -ne " Executing "$count"("$max")${SAMELINE}" + if [ $status -ne $1 ]; then + echo " Executed "$count"?("$max")" + __log_test_fail_status_code $1 $status + return 1 + fi + let pid=$pid+1 + let count=$count+1 + echo -ne " Executed "$count"("$max")${SAMELINE}" + done + __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${A1PMS_VERSION} ${status} ${max} echo "" __log_test_pass @@ -1483,24 +1617,26 @@ a1pms_api_delete_policy() { while [ $count -lt $max ]; do if [ "$A1PMS_VERSION" == "V2" ]; then query="/v2/policies/"$UUID$pid + elif [ "$A1PMS_VERSION" == "V3" ]; then + query="/v1/policies/"$UUID$pid else query="/policy?id="$UUID$pid fi res="$(__do_curl_to_api A1PMS DELETE $query)" status=${res:${#res}-3} - echo -ne " Executing "$count"("$max")${SAMELINE}" + echo -ne " Executing "${count}"("${max}")${SAMELINE}" if [ $status -ne $1 ]; then - echo " Executed "$count"?("$max")" + echo " Executed "${count}"?("${max}")" __log_test_fail_status_code $1 $status return 1 fi let pid=$pid+1 let count=$count+1 - echo -ne " Executed "$count"("$max")${SAMELINE}" + echo -ne " Executed "${count}"("${max}")${SAMELINE}" done - __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status $max + __collect_endpoint_stats "A1PMS" 03 "DELETE" ${A1PMS_API_PREFIX}${query} ${status} ${max} echo "" __log_test_pass @@ -1983,13 +2119,84 @@ a1pms_api_get_policy_ids() { return 0 } -# API Test function: V2 GET /v2/policy-types/{policyTypeId} +# API Test function: V3 GET a1policymanagement/v1/policies +# args: |NORIC |NOSERVICE |NOTYPE ([ |NORIC |NOSERVICE |NOTYPE ([>$HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __collect_endpoint_stats "A1PMS" 04 "GET" ${A1PMS_API_PREFIX}${query} ${status} + __log_test_pass + return 0 +} + +# API Test function: V2 GET a1-policy/v2/policy-types/{policyTypeId} and V3 GET a1policymanagement/v1/policytypes/{policyTypeId} # args(V2): [] # (Function for test scripts) a1pms_api_get_policy_type() { __log_test_start $@ - if [ "$A1PMS_VERSION" != "V2" ]; then + if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then __log_test_fail_not_supported return 1 fi @@ -1998,7 +2205,12 @@ a1pms_api_get_policy_type() { __print_err " []" $@ return 1 fi - query="/v2/policy-types/$2" + if [ "$A1PMS_VERSION" == "V2" ]; then + query="/v2/policy-types/$2" + fi + if [ "$A1PMS_VERSION" == "V3" ]; then + query="/v1/policytypes/$2" + fi res="$(__do_curl_to_api A1PMS GET $query)" status=${res:${#res}-3} @@ -2013,7 +2225,11 @@ a1pms_api_get_policy_type() { body=${res:0:${#res}-3} targetJson=$(<$3) - targetJson="{\"policy_schema\":$targetJson}" + if [ "$A1PMS_VERSION" == "V2" ]; then + targetJson="{\"policy_schema\":$targetJson}" + elif [ "$A1PMS_VERSION" == "V3" ]; then + targetJson="$targetJson" + fi echo "TARGET JSON: $targetJson" >>$HTTPLOG res=$(python3 ../common/compare_json.py "$targetJson" "$body") @@ -2023,7 +2239,7 @@ a1pms_api_get_policy_type() { fi fi - __collect_endpoint_stats "A1PMS" 05 "GET" $A1PMS_API_PREFIX"/v2/policy-types/{policyTypeId}" $status + __collect_endpoint_stats "A1PMS" 05 "GET" ${A1PMS_API_PREFIX}${query} ${status} __log_test_pass return 0 } @@ -2290,6 +2506,65 @@ a1pms_api_get_policy_types() { return 0 } +# API Test function: V3 GET a1policymanagement/v1/policytypes +# args: [|NORIC [|EMPTY []*]] +# (Function for test scripts) +a1pms_api_get_policy_types_v3() { + __log_test_start $@ + + if [ $# -lt 1 ]; then + __print_err " [|NORIC [|EMPTY []*]]" $@ + return 1 + fi + + if [ $# -eq 1 ]; then + query="/v1/policytypes" + elif [ $2 == "NORIC" ]; then + query="/v1/policytypes" + else + query="/v1/policytypes?nearRtRicId=$2" + fi + res="$(__do_curl_to_api A1PMS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 2 ]; then + body=${res:0:${#res}-3} + targetJson="[" + + for pid in ${@:3}; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + IFS=':' read -r policy_type_id ric_id <<<"$pid" + # if [ -n "$policy_type_id" ] && [ -n "$ric_id" ]; then + if [ $policy_type_id == "EMPTY" ]; then + policy_type_id="" + fi + targetJson=$targetJson"{ \"policyTypeId\": \"$policy_type_id\", \"nearRtRicId\": \"$ric_id\" }" + # fi + done + + targetJson=$targetJson"]" + + echo "TARGET JSON: $targetJson" >>$HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __collect_endpoint_stats "A1PMS" 09 "GET" ${A1PMS_API_PREFIX}${query} ${status} + __log_test_pass + return 0 +} + ######################################################### #### Test case functions Health check ######################################################### @@ -2320,7 +2595,7 @@ a1pms_api_get_status() { return 1 fi - __collect_endpoint_stats "A1PMS" 10 "GET" ${A1PMS_API_PREFIX}${query} ${status} + __collect_endpoint_stats "A1PMS" 10 "GET" $A1PMS_API_PREFIX$query $status __log_test_pass return 0 } @@ -2355,7 +2630,7 @@ a1pms_api_get_status_root() { #### Test case functions RIC Repository ######################################################### -# API Test function: GET /ric and V2 GET /v2/rics/ric +# API Test function: GET /ric, V2 GET /v2/rics/ric, and V3 GET a1policymanagement/v1/rics/ric # args: [] # (V2) args: |NOME | [] # (V2) example of = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4" @@ -2399,6 +2674,49 @@ a1pms_api_get_ric() { return 1 fi + targetJson=$(<./tmp/.tmp_rics.json) + targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets + echo " TARGET JSON: $targetJson" >>$HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + elif [ "$A1PMS_VERSION" == "V3" ]; then + if [ $# -lt 3 ]; then + __print_err " |NOME | [stringOfRicInfo>]" $@ + return 1 + fi + search="" + if [ $2 != "NOME" ]; then + search="?managedElementId="$2 + fi + if [ $3 != "NORIC" ]; then + if [ -z $search ]; then + search="?ricId="$3 + else + search=$search"&ricId="$3 + fi + fi + query="/v1/rics/ric"$search + + res="$(__do_curl_to_api A1PMS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 3 ]; then + body=${res:0:${#res}-3} + res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "${A1PMS_VERSION}" "$4") + if [ $res -ne 0 ]; then + __log_test_fail_general "Could not create target ric info json" + return 1 + fi + targetJson=$(<./tmp/.tmp_rics.json) targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets echo " TARGET JSON: $targetJson" >>$HTTPLOG @@ -2410,7 +2728,7 @@ a1pms_api_get_ric() { fi else if [ $# -lt 2 ] || [ $# -gt 3 ]; then - __print_err " []" $@ + __print_err " []" $@ return 1 fi @@ -2433,12 +2751,12 @@ a1pms_api_get_ric() { fi fi - __collect_endpoint_stats "A1PMS" 11 "GET" $A1PMS_API_PREFIX"/v2/rics/ric" $status + __collect_endpoint_stats "A1PMS" 11 "GET" ${A1PMS_API_PREFIX}${query} ${status} __log_test_pass return 0 } -# API test function: GET /rics and V2 GET /v2/rics +# API test function: GET /rics, V2 GET /v2/rics, and V3 GET /a1policymanagement/v1/rics # args: |NOTYPE [] # example of = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........." # format of ric-info: :: @@ -2456,6 +2774,11 @@ a1pms_api_get_rics() { if [ $2 != "NOTYPE" ]; then query="/v2/rics?policytype_id="$2 fi + elif [ "$A1PMS_VERSION" == "V3" ]; then + query="/v1/rics" + if [ $2 != "NOTYPE" ]; then + query=${query}"?policyTypeId="$2 + fi else query="/rics" if [ $2 != "NOTYPE" ]; then @@ -2473,18 +2796,14 @@ a1pms_api_get_rics() { if [ $# -gt 2 ]; then body=${res:0:${#res}-3} - if [ "$A1PMS_VERSION" == "V2" ]; then - res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$3") - else - res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3") - fi + res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "${A1PMS_VERSION}" "$3") if [ $res -ne 0 ]; then __log_test_fail_general "Could not create target ric info json" return 1 fi targetJson=$(<./tmp/.tmp_rics.json) - if [ "$A1PMS_VERSION" == "V2" ]; then + if [ "$A1PMS_VERSION" == "V2" ] || [ "$A1PMS_VERSION" == "V3" ]; then targetJson="{\"rics\": $targetJson }" fi echo "TARGET JSON: $targetJson" >>$HTTPLOG @@ -2495,7 +2814,7 @@ a1pms_api_get_rics() { fi fi - __collect_endpoint_stats "A1PMS" 12 "GET" $A1PMS_API_PREFIX"/v2/rics" $status + __collect_endpoint_stats "A1PMS" 12 "GET" ${A1PMS_API_PREFIX}${query} ${status} __log_test_pass return 0 } @@ -2535,12 +2854,12 @@ a1pms_api_put_service() { return 1 fi - __collect_endpoint_stats "A1PMS" 13 "PUT" ${A1PMS_API_PREFIX}${query} ${status} + __collect_endpoint_stats "A1PMS" 13 "PUT" $A1PMS_API_PREFIX$query $status __log_test_pass return 0 } -# API test function: GET /services and V2 GET /v2/services +# API test function: GET /services, V2 GET /v2/services and V3 /a1policymanagement/v1/services #args: [ ( ) | (NOSERVICE [ ]* )] # (Function for test scripts) a1pms_api_get_services() { @@ -2567,10 +2886,14 @@ a1pms_api_get_services() { if [ "$A1PMS_VERSION" == "V2" ]; then query="/v2/services" - if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then query="/v2/services?service_id="$2 fi + elif [ "$A1PMS_VERSION" == "V3" ]; then + query="/v1/services" + if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then + query="/v1/services?serviceId="$2 + fi else query="/services" @@ -2606,6 +2929,8 @@ a1pms_api_get_services() { # timeSinceLastActivitySeconds value cannot be checked since value varies if [ "$A1PMS_VERSION" == "V2" ]; then targetJson=$targetJson"{\"service_id\": \""$servicename"\",\"keep_alive_interval_seconds\": "$timeout",\"time_since_last_activity_seconds\":\"????\",\"callback_url\": \""$callback"\"}" + elif [ "$A1PMS_VERSION" == "V3" ]; then + targetJson=$targetJson"{\"serviceId\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}" else targetJson=$targetJson"{\"serviceName\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}" fi @@ -2614,6 +2939,10 @@ a1pms_api_get_services() { targetJson=$targetJson"]" if [ "$A1PMS_VERSION" == "V2" ]; then targetJson="{\"service_list\": $targetJson }" + URL_for_Collect_End_Point="/v2/services" + elif [ "$A1PMS_VERSION" == "V3" ]; then + targetJson="{\"serviceList\": $targetJson }" + URL_for_Collect_End_Point="/v1/services" fi echo "TARGET JSON: $targetJson" >>$HTTPLOG res=$(python3 ../common/compare_json.py "$targetJson" "$body") @@ -2623,12 +2952,12 @@ a1pms_api_get_services() { fi fi - __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status + __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX$URL_for_Collect_End_Point $status __log_test_pass return 0 } -# API test function: GET /services V2 GET /v2/services - (only checking service names) +# API test function: GET /services, V2 GET /v2/services and V3 /a1policymanagement/v1/services - (only checking service names) # args: []*" # (Function for test scripts) a1pms_api_get_service_ids() { @@ -2641,6 +2970,8 @@ a1pms_api_get_service_ids() { if [ "$A1PMS_VERSION" == "V2" ]; then query="/v2/services" + elif [ "$A1PMS_VERSION" == "V3" ]; then + query="/v1/services" else query="/services" fi @@ -2660,6 +2991,8 @@ a1pms_api_get_service_ids() { fi if [ "$A1PMS_VERSION" == "V2" ]; then targetJson=$targetJson"{\"callback_url\":\"????\",\"keep_alive_interval_seconds\":\"????\",\"service_id\":\""$rapp"\",\"time_since_last_activity_seconds\":\"????\"}" + elif [ "$A1PMS_VERSION" == "V3" ]; then + targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceId\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}" else targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceName\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}" fi @@ -2668,6 +3001,10 @@ a1pms_api_get_service_ids() { targetJson=$targetJson"]" if [ "$A1PMS_VERSION" == "V2" ]; then targetJson="{\"service_list\": $targetJson }" + URL_for_Collect_End_Point="/v2/services" + elif [ "$A1PMS_VERSION" == "V3" ]; then + targetJson="{\"serviceList\": $targetJson }" + URL_for_Collect_End_Point="/v1/services" fi echo "TARGET JSON: $targetJson" >>$HTTPLOG res=$(python3 ../common/compare_json.py "$targetJson" "$body") @@ -2677,7 +3014,7 @@ a1pms_api_get_service_ids() { return 1 fi - __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status + __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX$URL_for_Collect_End_Point $status __log_test_pass return 0 } @@ -2693,7 +3030,11 @@ a1pms_api_delete_services() { return 1 fi if [ "$A1PMS_VERSION" == "V2" ]; then - query="/v2/services/"$2 + url_part="/v2/services/" + query=${url_part}${2} + elif [ "$A1PMS_VERSION" == "V3" ]; then + url_part="/v1/services/" + query=${url_part}${2} else query="/services?name="$2 fi @@ -2705,7 +3046,7 @@ a1pms_api_delete_services() { return 1 fi - __collect_endpoint_stats "A1PMS" 15 "DELETE" $A1PMS_API_PREFIX"/v2/services/{serviceId}" $status + __collect_endpoint_stats "A1PMS" 15 "DELETE" ${A1PMS_API_PREFIX}${url_part}"{serviceId}" $status __log_test_pass return 0 } @@ -2782,7 +3123,7 @@ a1pms_api_put_configuration() { return 1 fi - __collect_endpoint_stats "A1PMS" 17 "PUT" ${A1PMS_API_PREFIX}${query} ${status} + __collect_endpoint_stats "A1PMS" 17 "PUT" $A1PMS_API_PREFIX$query $status __log_test_pass return 0 } @@ -2793,7 +3134,7 @@ a1pms_api_put_configuration() { a1pms_api_get_configuration() { __log_test_start $@ - if [ "$A1PMS_VERSION" != "V2" ]; then + if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then __log_test_fail_not_supported return 1 fi @@ -2807,7 +3148,12 @@ a1pms_api_get_configuration() { return 1 fi - query="/v2/configuration" + if [ "$A1PMS_VERSION" == "V3" ]; then + #The V3 of a1-pms URL is a1policymanagement/v1 and the v2 is a1-policy/v2 + query="/v1/configuration" + else + query="/v2/configuration" + fi res="$(__do_curl_to_api A1PMS GET $query)" status=${res:${#res}-3} @@ -2833,7 +3179,11 @@ a1pms_api_get_configuration() { fi fi - __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v2/configuration" $status + if [ "$A1PMS_VERSION" == "V3" ]; then + __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v1/configuration" $status + else + __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v2/configuration" $status + fi __log_test_pass return 0 } diff --git a/test/common/cr_api_functions.sh b/test/common/cr_api_functions.sh index 4fad4c4e..e7d1ba74 100644 --- a/test/common/cr_api_functions.sh +++ b/test/common/cr_api_functions.sh @@ -444,7 +444,7 @@ cr_delay_callback() { cr_api_check_all_sync_events() { __log_test_start $@ - if [ "$A1PMS_VERSION" != "V2" ]; then + if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then __log_test_fail_not_supported return 1 fi diff --git a/test/common/create_rics_json.py b/test/common/create_rics_json.py index 5f2fe697..9edd31c7 100644 --- a/test/common/create_rics_json.py +++ b/test/common/create_rics_json.py @@ -42,6 +42,11 @@ try: param_me='managed_element_ids' param_policy_type='policytype_ids' param_state='state' + elif (api_version == "V3"): + param_ric='ricId' + param_me='managedElementIds' + param_policy_type='policyTypeIds' + param_state='state' else: param_ric='ricName' param_me='managedElementIds' -- 2.16.6