2 # ============LICENSE_START===============================================
3 # Copyright (C) 2020 Nordix Foundation. All rights reserved.
4 # ========================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=================================================
19 # Different commands for the simulator.
20 # By running this, nothing should return an error.
22 # Run the build_and_start with the same arg as this script
24 echo "Usage: ./commands.sh nonsecure|secure"
27 if [ "$1" != "nonsecure" ] && [ "$1" != "secure" ]; then
28 echo "Usage: ./commands.sh nonsecure|secure"
32 if [ $1 == "nonsecure" ]; then
33 #Default http port for the simulator
38 #Default https port for the simulator
45 curl -vk "$HTTPX://localhost:$PORT/"
47 # PUT a policy type STD_QoSNudging_0.2.0
48 curl -X PUT -vk "$HTTPX://localhost:$PORT/policytypes/STD_QoSNudging_0.2.0" -H "accept: application/json" -H "Content-Type: application/json" --data-binary @example_files/policy_type_STD_QoSNudging_0.2.0.json
51 curl -vk "$HTTPX://localhost:$PORT/A1-P/v1/policytypes"
53 # GET policy type STD_QoSNudging_0.2.0
54 curl -vk "$HTTPX://localhost:$PORT/A1-P/v1/policytypes/STD_QoSNudging_0.2.0"
56 # PUT a policy instance pi1
57 curl -X PUT -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies/pi1?policyTypeId=STD_QoSNudging_0.2.0" -H "accept: application/json" -H "Content-Type: application/json" --data-binary @example_files/policy_instance_1_STD_QoSNudging_0.2.0.json
59 # PUT a policy instance pi2
60 curl -X PUT -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies/pi2?policyTypeId=STD_QoSNudging_0.2.0" -H "accept: application/json" -H "Content-Type: application/json" --data-binary @example_files/policy_instance_2_STD_QoSNudging_0.2.0.json
62 # SET status for pi1 and pi2
63 curl -X PUT -vk "$HTTPX://localhost:$PORT/pi1/NOT_ENFORCED/300"
64 curl -X PUT -vk "$HTTPX://localhost:$PORT/pi2/ENFORCED"
67 curl -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies"
69 # DELETE policy instance pi2
70 curl -X DELETE -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies/pi2"
72 # PUT a different policy instance pi1 (i.e. update it)
73 curl -X PUT -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies/pi1?policyTypeId=STD_QoSNudging_0.2.0" -H "accept: application/json" -H "Content-Type: application/json" --data-binary @example_files/policy_instance_1_bis_STD_QoSNudging_0.2.0.json
75 # GET policy instance pi1
76 curl -vk "$HTTPX://localhost:$PORT/A1-P/v1/policies/pi1"
78 # GET policy status for pi1
79 curl -vk "$HTTPX://localhost:$PORT/A1-P/v1/policystatus/pi1"