X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=near-rt-ric-simulator%2Ftest%2FSTD_1.1.3%2Fbasic_test.sh;h=af7093fa569eab8821daf22114248d1141c976b6;hb=79992d7e456696d6211edcb64d6b2ce2d8b730c6;hp=9274eaa4956ba21dd91d1d888379463417590196;hpb=21be2e0c890fb9604d0add2942fcff19b6fe2fb2;p=sim%2Fa1-interface.git diff --git a/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh b/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh index 9274eaa..af7093f 100755 --- a/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh +++ b/near-rt-ric-simulator/test/STD_1.1.3/basic_test.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# Copyright (C) 2021 Nordix Foundation. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,8 +17,39 @@ # ============LICENSE_END================================================= # -#Default port for the simulator -PORT=8085 +# Script for basic test of the simulator. +# Run the build_and_start with the same arg, except arg 'nonsecure|secure', as this script + +print_usage() { + echo "Usage: ./basic_test.sh nonsecure|secure duplicate-check|ignore-duplicate " + exit 1 +} + +if [ $# -ne 2 ]; then + print_usage +fi +if [ "$1" != "nonsecure" ] && [ "$1" != "secure" ]; then + print_usage +fi +if [ "$2" == "duplicate-check" ]; then + DUP_CHECK=1 +elif [ "$2" == "ignore-duplicate" ]; then + DUP_CHECK=0 +else + print_usage +fi + +if [ $1 == "nonsecure" ]; then + #Default http port for the simulator + PORT=8085 + # Set http protocol + HTTPX="http" +else + #Default https port for the simulator + PORT=8185 + # Set https protocol + HTTPX="https" +fi . ../common/test_common.sh @@ -28,7 +59,7 @@ RESULT="OK" do_curl GET / 200 echo "=== Check used and implemented interfaces ===" -RESULT="Current interface: STD_1.1.3 All supported A1 interface yamls in this container: ['1.1.x-alpha.2', 'STD_1.1.3', 'OSC_2.1.0']" +RESULT="Current interface: STD_1.1.3 All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']" do_curl GET /container_interfaces 200 echo "=== Reset simulator instances ===" @@ -55,9 +86,19 @@ echo "=== API: Get policy instances, shall contain pi1==" RESULT="json:[ \"pi1\" ]" do_curl GET /A1-P/v1/policies 200 -echo "=== API: Create policy instance pi2 (copy of pi1). Shall fail ===" -RESULT="json:{\"title\": \"The policy json already exists.\", \"status\": 400, \"instance\": \"pi2\"}" -do_curl PUT /A1-P/v1/policies/pi2 400 jsonfiles/pi1_updated.json +if [ $DUP_CHECK == 1 ]; then + echo "=== API: Create policy instance pi2 (copy of pi1). Shall fail ===" + RESULT="json:{\"title\": \"The policy json already exists.\", \"status\": 400, \"instance\": \"pi2\"}" + do_curl PUT /A1-P/v1/policies/pi2 400 jsonfiles/pi1_updated.json +else + echo "=== API: Create policy instance pi2 (copy of pi1). Shall succeed ===" + RESULT="json:{\"scope\": {\"ueId\": \"ue1\", \"groupId\": \"group1\", \"sliceId\": \"slice1\", \"qosId\": \"qos1\", \"cellId\": \"cell1\"}, \"statement\": {\"priorityLevel\": 5}}" + do_curl PUT /A1-P/v1/policies/pi2 201 jsonfiles/pi1.json + + echo "=== API: DELETE policy instance pi2 ===" + RESULT="" + do_curl DELETE /A1-P/v1/policies/pi2 204 +fi echo "=== Set force response code 409. ===" RESULT="*" @@ -77,7 +118,7 @@ do_curl PUT /A1-P/v1/policies/pi2 201 jsonfiles/pi2.json echo "=== API: Update policy instance pi2 ===" RESULT="json:{\"scope\": {\"ueId\": \"ue2\", \"groupId\": \"group2\", \"sliceId\": \"slice2\", \"qosId\": \"qos2\", \"cellId\": \"cell2\"}, \"statement\": {\"priorityLevel\": 10}}" -do_curl PUT '/A1-P/v1/policies/pi2?notificationDestination=http://localhost:8085/statustest' 200 jsonfiles/pi2.json +do_curl PUT '/A1-P/v1/policies/pi2?notificationDestination=http://localhost:2223/statustest' 200 jsonfiles/pi2.json echo "=== API: Get policy instances, shall contain pi1 and pi2==" RESULT="json:[ \"pi1\", \"pi2\" ]" @@ -143,6 +184,10 @@ echo "=== Get counter: interface ===" RESULT="STD_1.1.3" do_curl GET /counter/interface 200 +echo "=== Get counter: remote hosts ===" +RESULT="*" +do_curl GET '/counter/remote_hosts' 200 + echo "********************" echo "*** All tests ok ***" echo "********************"