Update scripts to populate policy data for E2E testing of nonrtric 71/5671/1
authorRehanRaza <muhammad.rehan.raza@est.tech>
Wed, 17 Feb 2021 11:30:36 +0000 (12:30 +0100)
committerRehanRaza <muhammad.rehan.raza@est.tech>
Wed, 17 Feb 2021 11:36:07 +0000 (12:36 +0100)
Change-Id: I05985fb6688ba7eb4227edae9c01a5ad1c094b24
Issue-ID: NONRTRIC-445
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
nonrtric/data/run_in_k8s/populate_data.sh
nonrtric/data/run_in_k8s/testdata/OSC/policy.json [new file with mode: 0644]
nonrtric/data/run_in_k8s/testdata/OSC/policy_type.json
nonrtric/data/run_in_k8s/testdata/STD/policy.json [deleted file]
nonrtric/data/run_in_k8s/testdata/STD/v1/policy.json [new file with mode: 0644]
nonrtric/data/run_in_k8s/testdata/STD/v2/policy.json [new file with mode: 0644]
nonrtric/data/run_in_k8s/testdata/STD/v2/policy_type.json [moved from nonrtric/data/run_in_k8s/testdata/STD/policy_type.json with 100% similarity]
nonrtric/data/run_in_k8s/testdata/policy.json [deleted file]
nonrtric/data/run_in_k8s/testdata/service.json
nonrtric/helm/nonrtricgateway/resources/config/application.yaml

index d3e3f8b..4a3f1b8 100755 (executable)
 
 # The scripts in data/ will generate some dummy data in the running system.
 # It will create:
-# one policy type in a1-sim-OSC_0
 # one service in policy agent
-# five policies in a1-sim-OSC_0
-# one policy in a1-sim-STD_0
-# one policy type in a1-sim-STD2_0
-# one policy in a1-sim-STD2_0
+# one policy-type and one policy in a1-sim-OSC_0
+# one policy in a1-sim-STD_0 (with no policy-type)
+# one policy-type and one policy in a1-sim-STD2_0
 
 policy_agent_host="policymanagementservice"
 policy_agent_port="9080"
@@ -79,19 +77,19 @@ curl -X PUT -skw " %{http_code}" $httpx://$a1_sim_osc_1_host:$a1_sim_osc_1_port/
 echo -e "\n"
 
 echo "create policy type 2 to STD2 ric5:"
-curl -X PUT -skw " %{http_code}" $httpx://$a1_sim_std2_0_host:$a1_sim_std2_0_port/policytype?id=2 -H Content-Type:application/json --data-binary @testdata/STD/policy_type.json
+curl -X PUT -skw " %{http_code}" $httpx://$a1_sim_std2_0_host:$a1_sim_std2_0_port/policytype?id=2 -H Content-Type:application/json --data-binary @testdata/STD/v2/policy_type.json
 echo -e "\n"
 
 echo "create policy type 2 to STD2 ric6:"
-curl -X PUT -skw " %{http_code}" $httpx://$a1_sim_std2_1_host:$a1_sim_std2_1_port/policytype?id=2 -H Content-Type:application/json --data-binary @testdata/STD/policy_type.json
+curl -X PUT -skw " %{http_code}" $httpx://$a1_sim_std2_1_host:$a1_sim_std2_1_port/policytype?id=2 -H Content-Type:application/json --data-binary @testdata/STD/v2/policy_type.json
 echo -e "\n"
 
 for i in {1..12}; do
        echo "policy types from policy agent:"
-    curlString="curl -skw %{http_code} $httpx://$policy_agent_host:$policy_agent_port/policy_types"
+    curlString="curl -skw %{http_code} $httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policy-types"
     res=$($curlString)
     echo "$res"
-    expect="[\"\",\"1\",\"2\"]200"
+    expect="{\"policytype_ids\":[\"\",\"1\",\"2\"]}200"
     if [ "$res" == "$expect" ]; then
         echo -e "\n"
         break;
@@ -100,50 +98,43 @@ for i in {1..12}; do
     fi
 done
 
-echo "create service 1 to policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/service" --data-binary @testdata/service.json
+echo "create service1 to policy agent:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/services" --data-binary @testdata/service.json
 echo -e "\n"
 
-echo "create policy 2000 to ric1 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2000&ric=ric1&service=service1&type=1" --data-binary @testdata/policy.json
+echo "create policy aa8feaa88d944d919ef0e83f2172a5000 to ric1 with type1 and service1 via policy agent:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policies" --data-binary @testdata/OSC/policy.json
 echo -e "\n"
 
-echo "create policy 2001 to ric1 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2001&ric=ric1&service=service1&type=1" --data '{"scope": {"ueId": "ue3100","qosId": "qos3100"},"qosObjective": {"priorityLevel": 3101}}'
+echo "create policy aa8feaa88d944d919ef0e83f2172a5100 to ric3 with service1 via policy agent, no type:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=aa8feaa88d944d919ef0e83f2172a5100&ric=ric3&service=service1" --data-binary @testdata/STD/v1/policy.json
 echo -e "\n"
 
-echo "create policy 2002 to ric1 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2002&ric=ric1&service=service1&type=1" --data '{"scope": {"ueId": "ue3100","qosId": "qos3100"},"qosObjective": {"priorityLevel": 3102}}'
+echo "create policy aa8feaa88d944d919ef0e83f2172a5200 to ric5 with type2 and service1 via policy agent:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policies" --data-binary @testdata/STD/v2/policy.json
 echo -e "\n"
 
-echo "create policy 2003 to ric1 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2003&ric=ric1&service=service1&type=1" --data '{"scope": {"ueId": "ue3100","qosId": "qos3100"},"qosObjective": {"priorityLevel": 3103}}'
+echo "policy numbers from ric1:"
+curl -skw " %{http_code}" $httpx://$a1_sim_osc_0_host:$a1_sim_osc_0_port/counter/num_instances
 echo -e "\n"
 
-echo "create policy 2004 to ric1 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2004&ric=ric1&service=service1&type=1" --data '{"scope": {"ueId": "ue3100","qosId": "qos3100"},"qosObjective": {"priorityLevel": 3104}}'
+echo "policy numbers from ric3:"
+curl -skw " %{http_code}" $httpx://$a1_sim_std_0_host:$a1_sim_std_0_port/counter/num_instances
 echo -e "\n"
 
-echo "create policy 2200 to ric5 with type1 and service1 via policy agent:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/v2/policies" --data-binary @testdata/STD/policy.json
+echo "policy numbers from ric5:"
+curl -skw " %{http_code}" $httpx://$a1_sim_std2_0_host:$a1_sim_std2_0_port/counter/num_instances
 echo -e "\n"
 
-echo "policy numbers from ric1:"
-curl -skw " %{http_code}" $httpx://$a1_sim_osc_0_host:$a1_sim_osc_0_port/counter/num_instances
+echo "policy id aa8feaa88d944d919ef0e83f2172a5000 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5000
 echo -e "\n"
 
-echo "create policy 2100 to ric3 with service1 via policy agent, no type:"
-curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://$policy_agent_host:$policy_agent_port/policy?id=2100&ric=ric3&service=service1" --data-binary @testdata/policy.json
+echo "policy id aa8feaa88d944d919ef0e83f2172a5100 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5100
 echo -e "\n"
 
-echo "policy numbers from ric3:"
-curl -skw " %{http_code}" $httpx://$a1_sim_std_0_host:$a1_sim_std_0_port/counter/num_instances
+echo "policy id aa8feaa88d944d919ef0e83f2172a5200 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://$policy_agent_host:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5200
 echo -e "\n"
 
-echo "policy id 2000 from policy agent:"
-curl -k -X GET -sw " %{http_code}" $httpx://$policy_agent_host:$policy_agent_port/policy?id=2000
-echo -e "\n"
-
-echo "policy id 2100 from policy agent:"
-curl -k -X GET -sw " %{http_code}" $httpx://$policy_agent_host:$policy_agent_port/policy?id=2100
-echo -e "\n"
diff --git a/nonrtric/data/run_in_k8s/testdata/OSC/policy.json b/nonrtric/data/run_in_k8s/testdata/OSC/policy.json
new file mode 100644 (file)
index 0000000..cae1d32
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "ric_id": "ric1",
+  "policy_id": "aa8feaa88d944d919ef0e83f2172a5000",
+  "service_id": "service1",
+  "policy_data": {
+    "scope": {
+      "ueId": "ue5000",
+      "qosId": "qos5000"
+    },
+    "qosObjectives": {
+      "priorityLevel": 5000
+    }
+  },
+  "policytype_id": "1"
+}
\ No newline at end of file
index 537d86f..aeea773 100644 (file)
@@ -24,7 +24,7 @@
           "qosId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -39,7 +39,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
diff --git a/nonrtric/data/run_in_k8s/testdata/STD/policy.json b/nonrtric/data/run_in_k8s/testdata/STD/policy.json
deleted file mode 100644 (file)
index de158bd..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "ric_id": "ric5",
-  "policy_id": "2100",
-  "service_id": "service1",
-  "policy_data": {
-    "scope": {
-      "ueId": "ue3100",
-      "qosId": "qos3100"
-    },
-    "qosObjective": {
-      "priorityLevel": 3100
-    }
-  },
-  "policytype_id": "2"
-}
diff --git a/nonrtric/data/run_in_k8s/testdata/STD/v1/policy.json b/nonrtric/data/run_in_k8s/testdata/STD/v1/policy.json
new file mode 100644 (file)
index 0000000..745eab6
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "scope": {
+    "ueId": "ue5100",
+    "qosId": "qos5100"
+  },
+  "qosObjectives": {
+    "priorityLevel": 5100
+  }
+}
diff --git a/nonrtric/data/run_in_k8s/testdata/STD/v2/policy.json b/nonrtric/data/run_in_k8s/testdata/STD/v2/policy.json
new file mode 100644 (file)
index 0000000..814469b
--- /dev/null
@@ -0,0 +1,16 @@
+{
+    "ric_id": "ric5",
+    "policy_id": "aa8feaa88d944d919ef0e83f2172a5200",
+    "service_id": "service1",
+    "policytype_id": "2",
+    "status_notification_uri": "http://callback-receiver:8090/callbacks/test",
+    "policy_data": {
+        "scope": {
+            "ueId": "ue5200",
+            "qosId": "qos5200"
+        },
+        "qosObjectives": {
+            "priorityLevel": 5200
+        }
+    }
+}
diff --git a/nonrtric/data/run_in_k8s/testdata/policy.json b/nonrtric/data/run_in_k8s/testdata/policy.json
deleted file mode 100644 (file)
index 119ba8b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-  "scope": {
-    "ueId": "ue3100",
-    "qosId": "qos3100"
-  },
-  "qosObjective": {
-    "priorityLevel": 3100
-  }
-}
index 1b973fc..66f43ac 100644 (file)
@@ -1 +1,5 @@
-{"callbackUrl": "http://callback-receiver:8090/callbacks/1","keepAliveIntervalSeconds": "3600","serviceName": "service1"}
+{
+    "callback_url": "http://callback-receiver:8090/callbacks/service1",
+    "keep_alive_interval_seconds": "3600",
+    "service_id": "service1"
+}
\ No newline at end of file
index 1a6c1bf..50533e7 100644 (file)
@@ -26,11 +26,11 @@ spring:
       httpserver:
         wiretap: true
       routes:
-      - id: a1-policy
+      - id: A1-Policy
         uri: https://policymanagementservice:9081
         predicates:
         - Path=/a1-policy/**
-      - id: ei-producer
+      - id: A1-EI
         uri: https://enrichmentservice:9083
         predicates:
         - Path=/ei-producer/**