Merge "Add description to parameters in policy controller"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Tue, 9 Jun 2020 06:39:42 +0000 (06:39 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 9 Jun 2020 06:39:42 +0000 (06:39 +0000)
95 files changed:
.gitignore
LICENSE.txt
docker-compose/README.md [new file with mode: 0644]
docker-compose/data/fill_data.sh [new file with mode: 0755]
docker-compose/data/testdata/OSC/policy_type.json [new file with mode: 0644]
docker-compose/data/testdata/policy.json [new file with mode: 0644]
docker-compose/data/testdata/service.json [new file with mode: 0644]
docker-compose/nosdnc/config/application.yaml [new file with mode: 0755]
docker-compose/nosdnc/config/application_configuration.json [new file with mode: 0644]
docker-compose/nosdnc/docker-compose.yml [new file with mode: 0644]
docker-compose/sdnc/config/application.yaml [new file with mode: 0755]
docker-compose/sdnc/config/application_configuration.json [new file with mode: 0644]
docker-compose/sdnc/docker-compose.yml [new file with mode: 0644]
policy-agent/Dockerfile
policy-agent/pom.xml
policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java
policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java
pom.xml
sdnc-a1-controller/northbound/features/features-sdnc-a1-northbound/pom.xml
sdnc-a1-controller/northbound/features/installer/pom.xml
sdnc-a1-controller/northbound/features/pom.xml
sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/features/features-nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/features/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/installer/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/model/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapterImpl.java
sdnc-a1-controller/northbound/pom.xml
sdnc-a1-controller/oam/installation/pom.xml
sdnc-a1-controller/oam/installation/sdnc-a1/pom.xml
sdnc-a1-controller/oam/installation/src/main/yaml/docker-compose.yml
sdnc-a1-controller/oam/platform-logic/installer/pom.xml
sdnc-a1-controller/oam/platform-logic/pom.xml
sdnc-a1-controller/oam/platform-logic/setup/pom.xml
sdnc-a1-controller/oam/pom.xml
sdnc-a1-controller/pom.xml
test/auto-test/.gitignore
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC150.sh
test/auto-test/FTC300.sh
test/auto-test/FTC310.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC850.sh
test/auto-test/FTC900.sh
test/auto-test/Suite-all.sh [new file with mode: 0755]
test/auto-test/Suite-interfaces.sh
test/auto-test/testdata/OSC/1-agent-modified.json
test/auto-test/testdata/OSC/1.json
test/auto-test/testdata/OSC/3-agent-modified.json
test/auto-test/testdata/OSC/3.json
test/auto-test/testdata/OSC/4-agent-modified.json
test/auto-test/testdata/OSC/4.json
test/auto-test/testdata/OSC/5-agent-modified.json
test/auto-test/testdata/OSC/5.json
test/auto-test/testdata/OSC/hw-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/hw.json [new file with mode: 0644]
test/auto-test/testdata/OSC/pi1_template.json
test/auto-test/testdata/OSC/pi3_template.json
test/auto-test/testdata/OSC/pi4_template.json
test/auto-test/testdata/OSC/pi5_template.json
test/auto-test/testdata/OSC/pihw_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/piqos_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/pitsa_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/qos-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/qos.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_1.json
test/auto-test/testdata/OSC/sim_3.json
test/auto-test/testdata/OSC/sim_4.json
test/auto-test/testdata/OSC/sim_5.json
test/auto-test/testdata/OSC/sim_hw.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_qos.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_tsa.json [new file with mode: 0644]
test/auto-test/testdata/OSC/tsa-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/tsa.json [new file with mode: 0644]
test/auto-test/testdata/STD/pi1_template.json
test/common/README.md
test/common/agent_api_functions.sh
test/common/controller_api_functions.sh
test/common/create_policies_process.py
test/common/delete_policies_process.py
test/common/ricsimulator_api_functions.sh
test/common/test_env.sh
test/common/testcase_common.sh
test/simulator-group/ric/docker-compose.yml
test/simulator-group/sim-monitor.js

index f459dca..6136fcb 100644 (file)
@@ -9,4 +9,5 @@ docs/_build/
 .sts4-cache
 .project
 .settings
-.pydevproject
\ No newline at end of file
+.pydevproject
+infer-out/
\ No newline at end of file
index f49a4e1..96589bf 100644 (file)
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
-   limitations under the License.
\ No newline at end of file
+   limitations under the License. 
diff --git a/docker-compose/README.md b/docker-compose/README.md
new file mode 100644 (file)
index 0000000..7573398
--- /dev/null
@@ -0,0 +1,54 @@
+# O-RAN-SC docker-compose files
+
+The docker-compose.yml file will create an entire nonrtric system with one command:
+docker-compose up
+
+Two docker-compose files are provided in this folder:
+
+nosdnc/docker-compose.yml
+This file is to create nonrtric system without sdnc a1-controller
+
+sdnc/docker-compose.yml
+This file is to create nonrtric system with sdnc a1-controller
+
+Howto:
+cd nosdnc/
+docker-compose up
+
+or
+
+cd sdnc/
+docker-compose up
+
+The scripts in data/ will generate some dummy data in the running system.
+It will create:
+one policy type in a1-sim-OSC
+one service in policy agent
+one policy in a1-sim-OSC
+one policy in a1-sim-STD
+
+Run command:
+cd data/
+./fill_data.sh [policy-agent-port] [a1-sim-OSC-port] [a1-sim-STD-port] [http/https]
+
+Open link:
+http://localhost:[control-panel-port]/
+
+All the generated data is shown on the web page
+
+## License
+
+Copyright (C) 2020 Nordix Foundation.
+Licensed under the Apache License, Version 2.0 (the "License")
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+For more information about license please see the [LICENSE](LICENSE.txt) file for details.
diff --git a/docker-compose/data/fill_data.sh b/docker-compose/data/fill_data.sh
new file mode 100755 (executable)
index 0000000..7b8f665
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 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.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+# The scripts in data/ will generate some dummy data in the running system.
+# It will create:
+# one policy type in a1-sim-OSC
+# one service in policy agent
+# one policy in a1-sim-OSC
+# one policy in a1-sim-STD
+
+# Run command:
+# ./fill_data.sh [policy-agent port] [a1-sim-OSC port] [a1-sim-STD port] [http/https]
+
+policy_agent_port=${1:-8081}
+a1_sim_OSC_port=${2:-30001}
+a1_sim_STD_port=${3:-30003}
+httpx=${4:-"http"}
+
+echo "using policy_agent port: "$policy_agent_port
+echo "using a1-sim-OSC port: "$a1_sim_OSC_port
+echo "using a1-sim-STD port: "$a1_sim_STD_port
+echo "using protocol: "$httpx
+echo -e "\n"
+
+echo "policy agent status:"
+curl -skw " %{http_code}" $httpx://localhost:$policy_agent_port/status
+echo -e "\n"
+
+echo "ric1 version:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/counter/interface
+echo -e "\n"
+
+echo "ric2 version:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_STD_port/counter/interface
+echo -e "\n"
+
+echo "create policy type 1 to ric1:"
+curl -X PUT -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @testdata/OSC/policy_type.json
+echo -e "\n"
+
+for i in {1..12}; do
+       echo "policy types from policy agent:"
+    curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/policy_types"
+    res=$($curlString)
+    echo "$res"
+    expect="[\"\",\"1\"]200"
+    if [ "$res" == "$expect" ]; then
+        echo -e "\n"
+        break;
+    else
+        sleep $i
+    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://localhost:$policy_agent_port/service" --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://localhost:$policy_agent_port/policy?id=2000&ric=ric1&service=service1&type=1" --data-binary @testdata/policy.json
+echo -e "\n"
+
+echo "policy numbers from ric1:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/counter/num_instances
+echo -e "\n"
+
+echo "create policy 2100 to ric2 with service1 via policy agent, no type:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/policy?id=2100&ric=ric2&service=service1" --data-binary @testdata/policy.json
+echo -e "\n"
+
+echo "policy numbers from ric2:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_STD_port/counter/num_instances
+echo -e "\n"
+
+echo "policy id 2000 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://localhost:$policy_agent_port/policy?id=2000
+echo -e "\n"
+
+echo "policy id 2100 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://localhost:$policy_agent_port/policy?id=2100
+echo -e "\n"
\ No newline at end of file
diff --git a/docker-compose/data/testdata/OSC/policy_type.json b/docker-compose/data/testdata/OSC/policy_type.json
new file mode 100644 (file)
index 0000000..537d86f
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "name": "pt1",
+  "description": "pt1 policy type",
+  "policy_type_id": 1,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "OSC_Type1_1.0.0",
+    "description": "Type 1 policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjective": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjective"
+    ]
+  }
+}
diff --git a/docker-compose/data/testdata/policy.json b/docker-compose/data/testdata/policy.json
new file mode 100644 (file)
index 0000000..119ba8b
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "scope": {
+    "ueId": "ue3100",
+    "qosId": "qos3100"
+  },
+  "qosObjective": {
+    "priorityLevel": 3100
+  }
+}
diff --git a/docker-compose/data/testdata/service.json b/docker-compose/data/testdata/service.json
new file mode 100644 (file)
index 0000000..1b973fc
--- /dev/null
@@ -0,0 +1 @@
+{"callbackUrl": "http://callback-receiver:8090/callbacks/1","keepAliveIntervalSeconds": "3600","serviceName": "service1"}
diff --git a/docker-compose/nosdnc/config/application.yaml b/docker-compose/nosdnc/config/application.yaml
new file mode 100755 (executable)
index 0000000..c0ddfb5
--- /dev/null
@@ -0,0 +1,37 @@
+spring:
+  profiles:
+    active: prod
+  main:
+    allow-bean-definition-overriding: true
+  aop:
+    auto: false
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+  level:
+    ROOT: ERROR
+    org.springframework: ERROR
+    org.springframework.data: ERROR
+    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+    org.oransc.policyagent: INFO
+  file: /var/log/policy-agent/application.log
+server:
+   port : 8433
+   http-port: 8081
+   ssl:
+      key-store-type: JKS
+      key-store-password: policy_agent
+      key-store: classpath:keystore.jks
+      key-password: policy_agent
+      key-alias: policy_agent
+app:
+  filepath: /opt/app/policy-agent/config/application_configuration.json
+  webclient:
+    trust-store-used: false
+    trust-store-password: policy_agent
+    trust-store: classpath:keystore.jks
+
diff --git a/docker-compose/nosdnc/config/application_configuration.json b/docker-compose/nosdnc/config/application_configuration.json
new file mode 100644 (file)
index 0000000..3a10acd
--- /dev/null
@@ -0,0 +1,23 @@
+{
+   "config": {
+      "//description": "Application configuration",
+      "ric": [
+         {
+            "name": "ric1",
+            "baseUrl": "http://a1-sim-OSC:8085/",
+            "managedElementIds": [
+               "kista_1",
+               "kista_2"
+            ]
+         },
+         {
+            "name":"ric2",
+            "baseUrl":"http://a1-sim-STD:8085/",
+            "managedElementIds": [
+               "kista_1",
+               "kista_2"
+            ]
+         }
+      ]
+   }
+}
\ No newline at end of file
diff --git a/docker-compose/nosdnc/docker-compose.yml b/docker-compose/nosdnc/docker-compose.yml
new file mode 100644 (file)
index 0000000..043ecde
--- /dev/null
@@ -0,0 +1,64 @@
+#  Copyright (C) 2020 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.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+version: '3.0'
+services:
+  policy-agent:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.0.0
+    container_name: policy-agent
+    networks:
+      default:
+        aliases:
+          - policy-agent-container
+    ports:
+      - 8081:8081
+      - 8433:8433
+    volumes:
+      - ./config:/opt/app/policy-agent/config:ro
+
+  a1-sim-OSC:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.0.0
+    container_name: a1-sim-OSC
+    networks:
+      - default
+    ports:
+      - 30001:8085
+      - 30002:8185
+    environment:
+      - A1_VERSION=OSC_2.1.0
+      - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
+
+  a1-sim-STD:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.0.0
+    container_name: a1-sim-STD
+    networks:
+      - default
+    ports:
+      - 30003:8085
+      - 30004:8185
+    environment:
+      - A1_VERSION=STD_1.1.3
+      - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
+
+  policy-control-panel:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.0.0
+    container_name: policy-control-panel
+    networks:
+      - default
+    ports:
+      - 8080:8080
+      - 8082:8082
diff --git a/docker-compose/sdnc/config/application.yaml b/docker-compose/sdnc/config/application.yaml
new file mode 100755 (executable)
index 0000000..c0ddfb5
--- /dev/null
@@ -0,0 +1,37 @@
+spring:
+  profiles:
+    active: prod
+  main:
+    allow-bean-definition-overriding: true
+  aop:
+    auto: false
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+  level:
+    ROOT: ERROR
+    org.springframework: ERROR
+    org.springframework.data: ERROR
+    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+    org.oransc.policyagent: INFO
+  file: /var/log/policy-agent/application.log
+server:
+   port : 8433
+   http-port: 8081
+   ssl:
+      key-store-type: JKS
+      key-store-password: policy_agent
+      key-store: classpath:keystore.jks
+      key-password: policy_agent
+      key-alias: policy_agent
+app:
+  filepath: /opt/app/policy-agent/config/application_configuration.json
+  webclient:
+    trust-store-used: false
+    trust-store-password: policy_agent
+    trust-store: classpath:keystore.jks
+
diff --git a/docker-compose/sdnc/config/application_configuration.json b/docker-compose/sdnc/config/application_configuration.json
new file mode 100644 (file)
index 0000000..31ec633
--- /dev/null
@@ -0,0 +1,33 @@
+{
+   "config": {
+      "//description": "Application configuration",
+      "controller": [
+         {
+            "name": "a1-controller",
+            "baseUrl": "http://a1-controller:8181",
+            "userName": "admin",
+            "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+         }
+      ],
+      "ric": [
+         {
+            "name": "ric1",
+            "baseUrl": "http://a1-sim-OSC:8085/",
+            "controller": "a1-controller",
+            "managedElementIds": [
+               "kista_1",
+               "kista_2"
+            ]
+         },
+         {
+            "name":"ric2",
+            "baseUrl":"http://a1-sim-STD:8085/",
+            "controller": "a1-controller",
+            "managedElementIds":[
+               "kista_1",
+               "kista_2"
+            ]
+         }
+      ]
+   }
+}
\ No newline at end of file
diff --git a/docker-compose/sdnc/docker-compose.yml b/docker-compose/sdnc/docker-compose.yml
new file mode 100644 (file)
index 0000000..f12f08c
--- /dev/null
@@ -0,0 +1,104 @@
+#  Copyright (C) 2020 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.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+version: '3.0'
+services:
+  policy-agent:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.0.0
+    container_name: policy-agent
+    networks:
+      default:
+        aliases:
+          - policy-agent-container
+    ports:
+      - 8081:8081
+      - 8433:8433
+    volumes:
+      - ./config:/opt/app/policy-agent/config:ro
+
+  a1-sim-OSC:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.0.0
+    container_name: a1-sim-OSC
+    networks:
+      - default
+    ports:
+      - 30001:8085
+      - 30002:8185
+    environment:
+      - A1_VERSION=OSC_2.1.0
+      - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
+
+  a1-sim-STD:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.0.0
+    container_name: a1-sim-STD
+    networks:
+      - default
+    ports:
+      - 30003:8085
+      - 30004:8185
+    environment:
+      - A1_VERSION=STD_1.1.3
+      - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
+
+  policy-control-panel:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.0.0
+    container_name: policy-control-panel
+    networks:
+      - default
+    ports:
+      - 8080:8080
+      - 8082:8082
+
+  db:
+    image: mysql/mysql-server:5.6
+    container_name: sdnc-db
+    networks:
+      - default
+    ports:
+      - "3306"
+    environment:
+      - MYSQL_ROOT_PASSWORD=openECOMP1.0
+      - MYSQL_ROOT_HOST=%
+    logging:
+      driver:   "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
+
+  a1-controller:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller:2.0.0
+    depends_on :
+      - db
+    container_name: a1-controller
+    networks:
+      - default
+    entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
+    ports:
+      - 8282:8181
+      - 8443:8443
+    links:
+      - db:dbhost
+      - db:sdnctldb01
+      - db:sdnctldb02
+    environment:
+      - MYSQL_ROOT_PASSWORD=openECOMP1.0
+      - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
+    logging:
+      driver:   "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
index 75da240..15f0502 100644 (file)
@@ -28,7 +28,7 @@ RUN mkdir -p /opt/app/policy-agent/etc/cert/
 EXPOSE 8081 8433
 
 ADD /config/application.yaml /opt/app/policy-agent/config/application.yaml
-ADD /config/application_configuration.json /opt/app/policy-agent/data/application_configuration.json
+ADD /config/application_configuration.json /opt/app/policy-agent/data/application_configuration.json_example
 ADD target/${JAR} /opt/app/policy-agent/policy-agent.jar
 
 
index ed1cbf1..2943ef8 100644 (file)
@@ -31,7 +31,7 @@
     </parent>
     <groupId>org.o-ran-sc.nonrtric</groupId>
     <artifactId>policy-agent</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <licenses>
         <license>
             <name>The Apache Software License, Version 2.0</name>
@@ -53,7 +53,6 @@
         <swagger.version>2.0.0</swagger.version>
         <json.version>20190722</json.version>
         <commons-net.version>3.6</commons-net.version>
-        <awaitility.version>4.0.2</awaitility.version>
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <formatter-maven-plugin.version>2.8.1</formatter-maven-plugin.version>
         <spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
             <artifactId>commons-net</artifactId>
             <version>${commons-net.version}</version>
         </dependency>
-        <!-- Actuator dependencies -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <!--TEST -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-configuration-processor</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>com.squareup.okhttp3</groupId>
-            <artifactId>mockwebserver</artifactId>
-            <scope>test</scope>
+            <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+            <artifactId>dmaapClient</artifactId>
+            <version>${version.dmaap}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${javax.ws.rs-api.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.inject</groupId>
+            <artifactId>jersey-hk2</artifactId>
         </dependency>
+
+        <!-- Actuator dependencies -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
         <!--REQUIRED TO GENERATE DOCUMENTATION -->
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger-ui</artifactId>
             <version>${springfox.version}</version>
         </dependency>
+
         <!-- TEST -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.awaitility</groupId>
             <artifactId>awaitility</artifactId>
-            <version>${awaitility.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
-            <artifactId>dmaapClient</artifactId>
-            <version>${version.dmaap}</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>${javax.ws.rs-api.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.inject</groupId>
-            <artifactId>jersey-hk2</artifactId>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>mockwebserver</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
     <build>
index 4ba58c7..b292c51 100644 (file)
@@ -196,7 +196,7 @@ public class AsyncRestClient {
             logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
                 exception.getResponseBodyAsString());
         } else {
-            logger.debug("{} HTTP error: {}", traceTag, t.getMessage());
+            logger.debug("{} HTTP error", traceTag, t);
         }
     }
 
index 017a9fd..b75d320 100644 (file)
@@ -282,6 +282,7 @@ public class PolicyController {
             RejectionException e = new RejectionException("Policy cannot change RIC, policyId: " + current.id() + //
                 ", RIC name: " + current.ric().name() + //
                 ", new name: " + policy.ric().name(), HttpStatus.CONFLICT);
+            logger.debug("Request rejected, {}", e.getMessage());
             return Mono.error(e);
         }
         return Mono.just("OK");
@@ -289,6 +290,7 @@ public class PolicyController {
 
     private Mono<Object> checkSupportedType(Ric ric, PolicyType type) {
         if (!ric.isSupportingType(type.name())) {
+            logger.debug("Request rejected, type not supported, RIC: {}", ric);
             RejectionException e = new RejectionException(
                 "Type: " + type.name() + " not supported by RIC: " + ric.name(), HttpStatus.NOT_FOUND);
             return Mono.error(e);
@@ -300,6 +302,7 @@ public class PolicyController {
         if (ric.getState() == Ric.RicState.AVAILABLE) {
             return Mono.just("OK");
         } else {
+            logger.debug("Request rejected RIC not IDLE, ric: {}", ric);
             RejectionException e = new RejectionException(
                 "Ric is not operational, RIC name: " + ric.name() + ", state: " + ric.getState(), HttpStatus.LOCKED);
             return Mono.error(e);
index c50a46f..19d1564 100644 (file)
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.web.reactive.function.client.WebClientException;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
 import reactor.core.publisher.Mono;
 
@@ -81,7 +82,7 @@ public class DmaapMessageHandler {
     private Mono<ResponseEntity<String>> handleAgentCallError(Throwable t, String originalMessage,
         DmaapRequestMessage dmaapRequestMessage) {
         logger.debug("Agent call failed: {}", t.getMessage());
-        HttpStatus status = HttpStatus.NOT_FOUND;
+        HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
         String errorMessage = t.getMessage();
         if (t instanceof WebClientResponseException) {
             WebClientResponseException exception = (WebClientResponseException) t;
@@ -90,7 +91,8 @@ public class DmaapMessageHandler {
         } else if (t instanceof ServiceException) {
             status = HttpStatus.BAD_REQUEST;
             errorMessage = prepareBadOperationErrorMessage(t, originalMessage);
-
+        } else if (!(t instanceof WebClientException)) {
+            logger.warn("Unexpected exception ", t);
         }
         return sendDmaapResponse(errorMessage, dmaapRequestMessage, status) //
             .flatMap(notUsed -> Mono.empty());
@@ -119,7 +121,6 @@ public class DmaapMessageHandler {
         } else {
             return Mono.error(new ServiceException("Not implemented operation: " + operation));
         }
-
     }
 
     private String payload(DmaapRequestMessage message) {
index ed94492..716148f 100644 (file)
@@ -44,48 +44,6 @@ public class Lock {
     private final List<LockRequest> lockRequestQueue = new LinkedList<>();
     private static AsynchCallbackExecutor callbackProcessor = new AsynchCallbackExecutor();
 
-    private static class AsynchCallbackExecutor implements Runnable {
-        private List<LockRequest> lockRequestQueue = new LinkedList<>();
-
-        public AsynchCallbackExecutor() {
-            Thread thread = new Thread(this);
-            thread.start();
-        }
-
-        public synchronized void addAll(List<LockRequest> requests) {
-            this.lockRequestQueue.addAll(requests);
-            this.notifyAll();
-        }
-
-        @Override
-        public void run() {
-            try {
-                while (true) {
-                    for (LockRequest request : consume()) {
-                        request.callback.success(request.lock);
-                    }
-                    waitForNewEntries();
-                }
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                logger.error("Interrupted {}", e.getMessage());
-            }
-        }
-
-        private synchronized List<LockRequest> consume() {
-            List<LockRequest> q = this.lockRequestQueue;
-            this.lockRequestQueue = new LinkedList<>();
-            return q;
-        }
-
-        @SuppressWarnings("java:S2274")
-        private synchronized void waitForNewEntries() throws InterruptedException {
-            if (this.lockRequestQueue.isEmpty()) {
-                this.wait();
-            }
-        }
-    }
-
     public enum LockType {
         EXCLUSIVE, SHARED
     }
@@ -113,23 +71,21 @@ public class Lock {
         });
     }
 
-    public void unlockBlocking() {
-        synchronized (this) {
-            if (lockCounter <= 0) {
-                lockCounter = -1; // Might as well stop, to make it easier to find the problem
-                logger.error("Number of unlocks must match the number of locks");
-            }
-            this.lockCounter--;
-            if (lockCounter == 0) {
-                isExclusive = false;
-            }
-            this.notifyAll();
+    public synchronized void unlockBlocking() {
+        if (lockCounter <= 0) {
+            lockCounter = -1; // Might as well stop, to make it easier to find the problem
+            logger.error("Number of unlocks must match the number of locks");
+        }
+        this.lockCounter--;
+        if (lockCounter == 0) {
+            isExclusive = false;
         }
+        this.notifyAll();
         this.processQueuedEntries();
     }
 
     @Override
-    public String toString() {
+    public synchronized String toString() {
         return "Lock cnt: " + this.lockCounter + " exclusive: " + this.isExclusive + " queued: "
             + this.lockRequestQueue.size();
     }
@@ -141,32 +97,19 @@ public class Lock {
 
     private void processQueuedEntries() {
         List<LockRequest> granted = new ArrayList<>();
-        synchronized (this) {
-            for (Iterator<LockRequest> i = lockRequestQueue.iterator(); i.hasNext();) {
-                LockRequest request = i.next();
-                if (tryLock(request.lockType)) {
-                    i.remove();
-                    granted.add(request);
-                }
+        for (Iterator<LockRequest> i = lockRequestQueue.iterator(); i.hasNext();) {
+            LockRequest request = i.next();
+            if (tryLock(request.lockType)) {
+                i.remove();
+                granted.add(request);
             }
         }
         callbackProcessor.addAll(granted);
     }
 
-    private static class LockRequest {
-        final MonoSink<Lock> callback;
-        final LockType lockType;
-        final Lock lock;
-
-        LockRequest(MonoSink<Lock> callback, LockType lockType, Lock lock) {
-            this.callback = callback;
-            this.lockType = lockType;
-            this.lock = lock;
-        }
-    }
-
     private synchronized void addToQueue(MonoSink<Lock> callback, LockType lockType) {
         lockRequestQueue.add(new LockRequest(callback, lockType, this));
+        processQueuedEntries();
     }
 
     @SuppressWarnings("java:S2274") // Always invoke wait() and await() methods inside a loop
@@ -191,4 +134,64 @@ public class Lock {
         return true;
     }
 
+    /**
+     * Represents a queued lock request
+     */
+    private static class LockRequest {
+        final MonoSink<Lock> callback;
+        final LockType lockType;
+        final Lock lock;
+
+        LockRequest(MonoSink<Lock> callback, LockType lockType, Lock lock) {
+            this.callback = callback;
+            this.lockType = lockType;
+            this.lock = lock;
+        }
+    }
+
+    /**
+     * A separate thread that calls a MonoSink to continue. This is done after a
+     * queued lock is granted.
+     */
+    private static class AsynchCallbackExecutor implements Runnable {
+        private List<LockRequest> lockRequestQueue = new LinkedList<>();
+
+        public AsynchCallbackExecutor() {
+            Thread thread = new Thread(this);
+            thread.start();
+        }
+
+        public synchronized void addAll(List<LockRequest> requests) {
+            this.lockRequestQueue.addAll(requests);
+            this.notifyAll();
+        }
+
+        @Override
+        public void run() {
+            try {
+                while (true) {
+                    for (LockRequest request : consume()) {
+                        request.callback.success(request.lock);
+                    }
+                    waitForNewEntries();
+                }
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.error("Interrupted {}", e.getMessage());
+            }
+        }
+
+        private synchronized List<LockRequest> consume() {
+            List<LockRequest> q = this.lockRequestQueue;
+            this.lockRequestQueue = new LinkedList<>();
+            return q;
+        }
+
+        @SuppressWarnings("java:S2274")
+        private synchronized void waitForNewEntries() throws InterruptedException {
+            if (this.lockRequestQueue.isEmpty()) {
+                this.wait();
+            }
+        }
+    }
 }
diff --git a/pom.xml b/pom.xml
index facc920..4cb5edf 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
     <groupId>org.o-ran-sc</groupId>
     <artifactId>nonrtric</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>nonrtric</name>
index c637817..042e481 100644 (file)
@@ -38,7 +38,7 @@ limitations under the License.
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>features-sdnc-a1-northbound</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>feature</packaging>
 
     <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
index 2366499..75e41f6 100755 (executable)
@@ -30,7 +30,7 @@ limitations under the License.
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>sdnc-a1-northbound-features-installer</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
index 96dfb7b..3986363 100755 (executable)
@@ -30,7 +30,7 @@ limitations under the License.
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>sdnc-northbound-feature-aggregator</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-northbound :: features</name>
index 3490585..6365abe 100644 (file)
@@ -38,7 +38,7 @@ limitations under the License.
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>sdnc-a1-northbound-all</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>feature</packaging>
 
        <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
index 74867cc..4ec9ab6 100644 (file)
@@ -30,7 +30,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>features-nonrt-ric-api</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>feature</packaging>
 
        <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index 6547d33..09ce581 100644 (file)
@@ -30,7 +30,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-features</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index 4f4d223..83eb53e 100644 (file)
@@ -30,7 +30,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>sdnc-nonrt-ric-api</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>feature</packaging>
 
     <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index aaa3517..3a70a34 100755 (executable)
@@ -30,7 +30,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>nonrt-ric-api-installer</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index df2a5b0..08fd479 100644 (file)
@@ -38,7 +38,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-model</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index fbac7a5..c24857f 100644 (file)
@@ -32,7 +32,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>nonrt-ric-api</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-northbound :: nonrt-ric-api</name>
index 4b4e081..7f38d5b 100644 (file)
@@ -40,7 +40,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-provider</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
index d317e56..928b65f 100644 (file)
@@ -34,7 +34,7 @@ import java.util.Properties;
 import org.apache.http.client.HttpClient;
 import org.apache.http.conn.ssl.NoopHostnameVerifier;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.conn.ssl.TrustAllStrategy;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.ssl.SSLContexts;
 import org.slf4j.Logger;
@@ -87,7 +87,7 @@ public class RestAdapterImpl implements RestAdapter {
                   SSLContexts.custom()
                              .loadKeyMaterial(ResourceUtils.getFile(properties.getProperty("key-store")),
                                      keystorePassword.toCharArray(), keystorePassword.toCharArray())
-                             .loadTrustMaterial(null, new TrustSelfSignedStrategy())
+                             .loadTrustMaterial(null, new TrustAllStrategy())
                              .build(),
                   NoopHostnameVerifier.INSTANCE);
           HttpClient client = HttpClients.custom().setSSLSocketFactory(scsf).build();
index fed4727..1f95097 100644 (file)
@@ -38,7 +38,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>sdnc-a1-northbound</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <properties>
index 7ebda23..6cdf04f 100644 (file)
@@ -30,7 +30,7 @@
     <packaging>pom</packaging>
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
     <artifactId>installation</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
 
     <name>sdnc-a1-oam :: installation</name>
     <description>Installs SDN-C on local file system</description>
index 9e1731a..cd58073 100644 (file)
     <packaging>pom</packaging>
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
     <artifactId>installation-sdnc-a1</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
 
     <name>sdnc-a1-oam :: installation :: ${project.artifactId}</name>
     <description>Creates SDN Controller Docker container</description>
 
     <properties>
      <standalone.image.name>o-ran-sc/nonrtric-a1-controller</standalone.image.name>
-     <standalone.image.version>1.7.5-SNAPSHOT</standalone.image.version>
+     <standalone.image.version>2.0.0-SNAPSHOT</standalone.image.version>
      <sdnc.project.version>${project.version}</sdnc.project.version>
      <sdnc.build.timestamp>${maven.build.timestamp}</sdnc.build.timestamp>
-     <sdnc.northbound.version>1.7.5-SNAPSHOT</sdnc.northbound.version>
+     <sdnc.northbound.version>2.0.0-SNAPSHOT</sdnc.northbound.version>
      <ccsdk.docker.version>0.7.0</ccsdk.docker.version>
      <docker.push.phase>deploy</docker.push.phase>
     </properties>
index c7244f7..c2b9978 100644 (file)
@@ -38,7 +38,7 @@ services:
         max-file: "5"
 
   a1-controller:
-    image: o-ran-sc/nonrtric-a1-controller:1.7.5-SNAPSHOT
+    image: o-ran-sc/nonrtric-a1-controller:2.0.0-SNAPSHOT
     depends_on :
       - db
     container_name: a1-controller-container
index fb55685..7e9030c 100644 (file)
@@ -30,7 +30,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
        <artifactId>platform-logic-installer</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-oam :: platform-logic :: ${project.artifactId}</name>
index f796613..a9d8ca9 100644 (file)
@@ -30,7 +30,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
     <artifactId>platform-logic</artifactId>
-    <version>1.7.5-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>sdnc-a1-oam :: platform-logic</name>
index 6f6cc71..f4c62c5 100644 (file)
@@ -30,7 +30,7 @@
 
     <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
        <artifactId>platform-logic-setup</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
     <name>sdnc-a1-oam :: platform-logic :: ${project.artifactId}</name>
index eb8a720..45105e6 100755 (executable)
@@ -29,7 +29,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
        <artifactId>sdnc-a1-oam</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1-oam</name>
index daca84c..e15d7ef 100644 (file)
@@ -25,7 +25,7 @@
 
        <groupId>org.o-ran-sc.nonrtric.sdnc-a1</groupId>
        <artifactId>sdnc-a1</artifactId>
-       <version>1.7.5-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <name>sdnc-a1</name>
index c5c4261..89e22de 100644 (file)
@@ -13,3 +13,4 @@ logs
 .sdnc*
 .timer*
 .pid*
+.result*
index 877a209..d9a88b1 100755 (executable)
@@ -35,6 +35,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 # Path to callback receiver
 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
 
+generate_uuid
+
 # Tested variants of REST/DMAAP/SDNC config
 TESTED_VARIANTS="REST   DMAAP   REST+SDNC   DMAAP+SDNC"
 #Test agent and simulator protocol versions (others are http only)
index 771ee55..eaa6de2 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 8ee7e37..6f90437 100755 (executable)
@@ -29,6 +29,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 
index 1efce99..8427ad1 100755 (executable)
@@ -27,6 +27,7 @@ EXCLUDED_IMAGES="SDMC SDNC_ONAP"
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 
+generate_uuid
 
 #Local vars in test script
 ##########################
index 9320302..1cd2a33 100755 (executable)
@@ -29,6 +29,8 @@ EXCLUDED_IMAGES="PA CP SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Test agent and simulator protocol versions (others are http only)
 TESTED_PROTOCOLS="HTTP HTTPS"
 
index 9320606..2ab4385 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 18d6816..7eb3c19 100755 (executable)
@@ -30,6 +30,7 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
 
 # Clean container and start all needed containers #
 clean_containers
index 0fe253f..416a77d 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 6bab06b..e97f3ff 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index 2dae7e7..e9f19f8 100755 (executable)
@@ -28,6 +28,8 @@ EXCLUDED_IMAGES="SDNC_ONAP"
 
 #### TEST BEGIN ####
 
+generate_uuid
+
 #Local vars in test script
 ##########################
 # Path to callback receiver
index f45246d..32e450f 100755 (executable)
@@ -42,6 +42,8 @@ TESTED_PROTOCOLS="HTTP HTTPS"
 NUM_RICS=20
 NUM_POLICIES_PER_RIC=500
 
+generate_uuid
+
 for __httpx in $TESTED_PROTOCOLS ; do
     for interface in $TESTED_VARIANTS ; do
 
@@ -80,6 +82,8 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_mr # Not used, but removes error messages from the agent log
 
+        start_control_panel
+
         start_policy_agent
 
         set_agent_debug
index 5515a77..05b6ff6 100755 (executable)
 #  ============LICENSE_END=================================================
 #
 
-TC_ONELINE_DESCR="Testing of the health check app"
+TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check app - populating a number of ric simulators with types and instances"
 
 #App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC SDNC_ONAP"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
@@ -35,80 +35,105 @@ CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
 
 clean_containers
 
-start_ric_simulators  ricsim_g1 6 OSC_2.1.0
+OSC_NUM_RICS=6
+STD_NUM_RICS=5
 
-start_ric_simulators  ricsim_g2 5 STD_1.1.3
+start_ric_simulators  $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
 
+start_ric_simulators  $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
 
+start_mr #Just to prevent errors in the agent log...
+
+start_control_panel
 
 start_consul_cbs
 
 prepare_consul_config      NOSDNC  ".consul_config.json"
 consul_config_app                  ".consul_config.json"
 
-
 start_policy_agent
 
-
 use_agent_rest_http
 
 api_get_status 200
 
-sim_print ricsim_g1_1 interface
-sim_print ricsim_g1_2 interface
-sim_print ricsim_g1_3 interface
-sim_print ricsim_g1_4 interface
-sim_print ricsim_g1_5 interface
-sim_print ricsim_g1_6 interface
+# Print the A1 version for OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_print $RIC_SIM_PREFIX"_g1_"$i interface
+done
+
+
+# Print the A1 version for STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_print $RIC_SIM_PREFIX"_g2_"$i interface
+done
+
+
+# Load the polictypes in osc
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 2 testdata/OSC/sim_hw.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 testdata/OSC/sim_qos.json
+    sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 testdata/OSC/sim_tsa.json
+done
 
-sim_print ricsim_g2_1 interface
-sim_print ricsim_g2_2 interface
-sim_print ricsim_g2_3 interface
-sim_print ricsim_g2_4 interface
-sim_print ricsim_g2_5 interface
 
-sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_6 1 testdata/OSC/sim_1.json
+#Check the number of schemas and the individual schemas in OSC
+api_equal json:policy_types 4 120
 
-api_equal json:policy_types 2 120
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 3 120
+done
+
+# Check the schemas in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    api_get_policy_schema 200 2 testdata/OSC/hw-agent-modified.json
+    api_get_policy_schema 200 100 testdata/OSC/qos-agent-modified.json
+    api_get_policy_schema 200 20008 testdata/OSC/tsa-agent-modified.json
+done
 
-sleep_wait 30 "Give the agent some extra time...."
 
 # Create policies
 use_agent_rest_http
 
-api_put_service 201 "rapp1" 3600 "$CR_PATH/1"
-
-api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 NOTRANSIENT testdata/OSC/pi1_template.json 1
-
-sim_equal ricsim_g1_1 num_instances 1
-sim_equal ricsim_g1_2 num_instances 1
-sim_equal ricsim_g1_3 num_instances 1
-sim_equal ricsim_g1_4 num_instances 1
-sim_equal ricsim_g1_5 num_instances 1
-sim_equal ricsim_g1_6 num_instances 1
-
-api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 NOTRANSIENT testdata/STD/pi1_template.json 1
-
-sim_equal ricsim_g2_1 num_instances 1
-sim_equal ricsim_g2_2 num_instances 1
-sim_equal ricsim_g2_3 num_instances 1
-sim_equal ricsim_g2_4 num_instances 1
-sim_equal ricsim_g2_5 num_instances 1
+api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+
+# Create policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 2 $((2000+$i)) NOTRANSIENT testdata/OSC/pihw_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT testdata/OSC/piqos_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT testdata/OSC/pitsa_template.json 1
+done
+
+
+# Check the number of policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+    sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 3
+done
+
+
+# Create policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT testdata/STD/pi1_template.json 1
+done
+
 
+# Check the number of policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
+done
 
 check_policy_agent_logs
 
diff --git a/test/auto-test/Suite-all.sh b/test/auto-test/Suite-all.sh
new file mode 100755 (executable)
index 0000000..342596d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 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.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+TS_ONELINE_DESCR="Test suite - all test cases except the stab test(s)"
+
+. ../common/testsuite_common.sh
+
+suite_setup
+
+############# TEST CASES #################
+ARG1=$1
+
+./FTC1.sh $1
+
+if [ $ARG1 == "remote-remove" ]; then
+    #Prevent image removal for every test case
+    ARG1="remote"
+fi
+
+./FTC10.sh $1
+./FTC100.sh $1
+./FTC110.sh $1
+./FTC150.sh $1
+./FTC300.sh $1
+./FTC310.sh $1
+./FTC350.sh $1
+./FTC800.sh $1
+./FTC850.sh $1
+
+##########################################
+
+suite_complete
\ No newline at end of file
index 1723555..7a21646 100755 (executable)
@@ -25,9 +25,17 @@ suite_setup
 
 ############# TEST CASES #################
 
-./FTC100.sh $1
-./FTC110.sh $1
-./FTC150.sh $1
+ARG1=$1
+
+./FTC100.sh $ARG1
+
+if [ $ARG1 == "remote-remove" ]; then
+    #Prevent image removal for every test case
+    ARG1="remote"
+fi
+
+./FTC110.sh $ARG1
+./FTC150.sh $ARG1
 
 ##########################################
 
index 3b37214..a40aa88 100644 (file)
@@ -20,7 +20,7 @@
           "qosId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,6 +35,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index 5fe68ce..c865bac 100644 (file)
@@ -20,7 +20,7 @@
         "qosId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -35,6 +35,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index 303b36b..3bf9a47 100644 (file)
@@ -16,7 +16,7 @@
           "groupId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -31,6 +31,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index ab0204d..4966dea 100644 (file)
@@ -16,7 +16,7 @@
         "groupId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -31,6 +31,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index 868ceea..7fb71a6 100644 (file)
@@ -16,7 +16,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -31,6 +31,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index c5e785c..3891b76 100644 (file)
@@ -16,7 +16,7 @@
         "cellId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -31,6 +31,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
index b5fd5bc..1b1c508 100644 (file)
@@ -20,7 +20,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,6 +35,6 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
index dee440a..1708a1e 100644 (file)
@@ -20,7 +20,7 @@
         "cellId"
       ]
     },
-    "qosObjective": {
+    "qosObjectives": {
       "type": "object",
       "properties": {
         "priorityLevel": {
@@ -35,6 +35,6 @@
   },
   "additionalProperties": false,
   "required": [
-    "scope", "qosObjective"
+    "scope", "qosObjectives"
   ]
 }
diff --git a/test/auto-test/testdata/OSC/hw-agent-modified.json b/test/auto-test/testdata/OSC/hw-agent-modified.json
new file mode 100644 (file)
index 0000000..5ea5802
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "2",
+    "description": "Hello World policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/hw.json b/test/auto-test/testdata/OSC/hw.json
new file mode 100644 (file)
index 0000000..b15b93e
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "Hello World Policy",
+    "description": "Hello World policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
index 7795808..da25554 100644 (file)
@@ -3,7 +3,7 @@
       "ueId": "ueXXX",
       "qosId": "qosXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index a916fad..02d33bc 100644 (file)
@@ -2,7 +2,7 @@
     "scope": {
       "groupId": "groupXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index 0673dec..dff4b6b 100644 (file)
@@ -2,7 +2,7 @@
     "scope": {
       "cellId": "cellXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
index e362c9e..af6be9d 100644 (file)
@@ -3,7 +3,7 @@
       "sliceId": "sliceXXX",
       "cellId": "cellXXX"
     },
-    "qosObjective": {
+    "qosObjectives": {
       "priorityLevel": XXX
     }
   }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/pihw_template.json b/test/auto-test/testdata/OSC/pihw_template.json
new file mode 100644 (file)
index 0000000..7574995
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/piqos_template.json b/test/auto-test/testdata/OSC/piqos_template.json
new file mode 100644 (file)
index 0000000..da25554
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "scope": {
+      "ueId": "ueXXX",
+      "qosId": "qosXXX"
+    },
+    "qosObjectives": {
+      "priorityLevel": XXX
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/pitsa_template.json b/test/auto-test/testdata/OSC/pitsa_template.json
new file mode 100644 (file)
index 0000000..7574995
--- /dev/null
@@ -0,0 +1,3 @@
+{
+    "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/qos-agent-modified.json b/test/auto-test/testdata/OSC/qos-agent-modified.json
new file mode 100644 (file)
index 0000000..3a012cd
--- /dev/null
@@ -0,0 +1,40 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "100",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
diff --git a/test/auto-test/testdata/OSC/qos.json b/test/auto-test/testdata/OSC/qos.json
new file mode 100644 (file)
index 0000000..070ebe4
--- /dev/null
@@ -0,0 +1,40 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "title": "OSC_Type1_1.0.0",
+  "description": "Quality of Service policy type",
+  "type": "object",
+  "properties": {
+    "scope": {
+      "type": "object",
+      "properties": {
+        "ueId": {
+          "type": "string"
+        },
+        "qosId": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "ueId",
+        "qosId"
+      ]
+    },
+    "qosObjectives": {
+      "type": "object",
+      "properties": {
+        "priorityLevel": {
+          "type": "number"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "priorityLevel"
+      ]
+    }
+  },
+  "additionalProperties": false,
+  "required": [
+    "scope", "qosObjectives"
+  ]
+}
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"
     ]
   }
 }
index 1b97047..d21a9a9 100644 (file)
@@ -20,7 +20,7 @@
           "groupId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,7 +35,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index ac1fa2b..a55b34e 100644 (file)
@@ -20,7 +20,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -35,7 +35,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
index 4d8f3c9..fd5290f 100644 (file)
@@ -24,7 +24,7 @@
           "cellId"
         ]
       },
-      "qosObjective": {
+      "qosObjectives": {
         "type": "object",
         "properties": {
           "priorityLevel": {
@@ -39,7 +39,7 @@
     },
     "additionalProperties": false,
     "required": [
-      "scope", "qosObjective"
+      "scope", "qosObjectives"
     ]
   }
 }
diff --git a/test/auto-test/testdata/OSC/sim_hw.json b/test/auto-test/testdata/OSC/sim_hw.json
new file mode 100644 (file)
index 0000000..47e0ae0
--- /dev/null
@@ -0,0 +1,18 @@
+{
+    "name": "hwpolicy",
+    "description": "Hellow World policy type",
+    "policy_type_id": 2,
+    "create_schema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "HW Policy",
+      "description": "Hello World policy type",
+      "type": "object",
+      "properties": {
+        "threshold": {
+          "type": "integer",
+          "default": 0
+        }
+      },
+      "additionalProperties": false
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/sim_qos.json b/test/auto-test/testdata/OSC/sim_qos.json
new file mode 100644 (file)
index 0000000..92eaa6f
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "name": "pt1",
+  "description": "pt1 policy type",
+  "policy_type_id": 100,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "OSC_Type1_1.0.0",
+    "description": "Quality of Service policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjectives"
+    ]
+  }
+}
diff --git a/test/auto-test/testdata/OSC/sim_tsa.json b/test/auto-test/testdata/OSC/sim_tsa.json
new file mode 100644 (file)
index 0000000..9227b5e
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "tsapolicy",
+  "description": "tsa parameters",
+  "policy_type_id": 20008,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "TS Policy",
+    "description": "Traffic Steering - High prio traffic - policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/tsa-agent-modified.json b/test/auto-test/testdata/OSC/tsa-agent-modified.json
new file mode 100644 (file)
index 0000000..d9426c7
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "20008",
+    "description": "Traffic Steering - High prio traffic - policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/tsa.json b/test/auto-test/testdata/OSC/tsa.json
new file mode 100644 (file)
index 0000000..5f4d20d
--- /dev/null
@@ -0,0 +1,13 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "TS Policy",
+    "description": "Traffic Steering - High prio traffic - policy type",
+    "type": "object",
+    "properties": {
+      "threshold": {
+        "type": "integer",
+        "default": 0
+      }
+    },
+    "additionalProperties": false
+  }
\ No newline at end of file
index 2a87513..e06b031 100644 (file)
@@ -3,7 +3,7 @@
     "ueId": "ueXXX",
     "qosId": "qosXXX"
   },
-  "qosObjective": {
+  "qosObjectives": {
     "priorityLevel": XXX
   }
 }
\ No newline at end of file
index dd1ddf3..a048c64 100644 (file)
-## Description for common test scripts
+## Introduction ##
+This dir contains most scripts needed for the auto-test environment. There are scripts with functions to adapt to the apis of the components of the Non-RT RIC; Policy Agent, A1 Controller and Ric (A1) simulator.
+Some of the scripts can also be used for other kinds of tests, for example basic tests.
+
+## Overview for common test scripts and files ##
 
 `test_env.sh` \
-Common env variables for test in the auto-test dir.
-Used by the auto test cases/suites but could be used for other test script as well.
+Common env variables for test in the auto-test dir. All configuration of port numbers, image names and version etc shall be made in this file.
+Used by the auto test scripts/suites but could be used for other test script as well.
 
 `testcase_common.sh` \
-Common functions for auto test cases in the auto-test dir.
-A subset of the functions could be used in other test scripts as well.
+Common functions for auto test cases in the auto-test dir. This script is the foundation of test auto environment which sets up images and enviroment variables needed by this script as well as the script adapting to the APIs.
+The included functions are described in detail further below.
+
+`testsuite_common.sh` \
+Common functions for running two or more auto test scripts as a suite.
+
+`agent_api_functions.sh` \
+Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
+
+`controller_api_functions.sh` \
+Contains functions for adaping towards the A1-controller API.
+
+`ricsimulator_api_functions.sh` \
+Contains functions for adapting towards the RIC (A1) simulator admin API.
+
+`compare_json.py` \
+A python script to compare two json obects for equality. Note that the comparsion always sort json-arrays before comparing (that is, it does not care about the order of items within the array). In addition, the target json object may specify individual parameter values where equality is 'dont care'.
+
+`count_json_elements.py` \
+A python script returning the number of items in a json array.
+
+`create_policies_process.py` \
+A python script to create a batch of policies. The script is intended to run in a number of processes to create policies in parallel.
+
+`create_rics_json.py` \
+A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
+
+`delete_policies_process.py` \
+A python script to delete a batch of policies. The script is intended to run in a number of processes to delete policies in parallel.
+
+`extract_sdnc_reply.py` \
+A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
+
+`do_curl_function.sh`
+A script for executing a curl call with a specific url and optional payload. It also compare the response with an expected result in terms of response code and optional returned payload. Intended to be used by test script (for example basic test scripts of other components)
+
+
+
+### Descriptions of functions in testcase_common.sh ###
+
+#### Script args ####
+The script can be started with these arguments
+
+| arg list |
+|--|
+| `local|remote|remote-remove [auto-clean] [--stop-at-error] [--use-local-image <app-nam> [<app-name>]*]` |
+
+| parameter | description |
+|-|-|
+| `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
+| `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
+| `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
+| `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
+| `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
+| `--use-local-image <app-nam> [<app-name>]*` | nnly applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
+| `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
+
+#### Function: print_result ####
+Print a test report of an auto-test script.
+| arg list |
+|--|
+| None |
+
+#### Function: start_timer ####
+Start a timer for time measurement. Only one timer can be running.
+| arg list |
+|--|
+| None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
+
+#### Function: print_timer ####
+Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
+| arg list |
+|--|
+| `<timer-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
+
+#### Function: print_and_reset_timer ####
+Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
+| arg list |
+|--|
+| `<timer-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
+
+#### Function: deviation ####
+Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
+| arg list |
+|--|
+| `<deviation-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
+
+#### Function: clean_containers ####
+Stop and remove all containers. Containers not part of the test are not affected.
+| arg list |
+|--|
+| None |
+
+#### Function: auto_clean_containers ####
+Stop and remove all containers. Containers not part of the test are not affected. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
+| arg list |
+|--|
+| None |
+
+#### Function: sleep_wait ####
+Make the script sleep for a number of seconds.
+| arg list |
+|--|
+| `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<sleep-time-in-sec> ` | Number of seconds to sleep |
+| `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
+
+#### Function: generate_uuid ####
+Geneate a UUID prefix to use along with the policy instance number when creating/deleting policies. Sets the env var UUID.
+UUID is then automatically added to the policy id in GET/PUT/DELETE.
+| arg list |
+|--|
+| None |
+
+#### Function: consul_config_app ####
+Function to load a json config from a file into consul for the Policy Agent
+
+| arg list |
+|--|
+| `<json-config-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
+
+#### Function: prepare_consul_config ####
+Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
+| arg list |
+|--|
+| `<deviation-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `SDNC|SDNC_ONAP|NOSDNC` | Configure based on a1-controller (SNDC), a1-adapter (SDNC_ONAP) or without a controller/adapter (NOSDNC) |
+| `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app'  |
+
+#### Function: start_consul_cbs ####
+Start the Consul and CBS containers
+| arg list |
+|--|
+| None |
+
+#### Function: use_simulator_http ####
+Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_simulator_https ####
+Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_ric_simulators ####
+Start a group of simulator where a group may contain 1 more simulators.
+| arg list |
+|--|
+| `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `ricsim_g1|ricsim_g2|ricsim_g3` | Base name of the simulator. Each instance will have an postfix instance id added, starting on '1'. For examplle 'ricsim_g1_1', 'ricsim_g1_2' etc  |
+|`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
+|`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
+
+#### Function: start_control_panel ####
+Start the Control Panel container
+| arg list |
+|--|
+| None |
+
+#### Function: start_sdnc ####
+Start the SDNC A1 Controller container and its database container
+| arg list |
+|--|
+| None |
+
+#### Function: use_sdnc_http ####
+Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_sdnc_http ####
+Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_sdnc_onap ####
+Start the SDNC A1 Adapter container and its database container
+| arg list |
+|--|
+| None |
+
+#### Function: config_sdnc_onap ####
+Configure the SDNC A1 adapter - Not implemented
+| arg list |
+|--|
+| None |
+
+#### Function: start_mr ####
+Start the Message Router stub interface container
+| arg list |
+|--|
+| None |
+
+#### Function: use_mr_http ####
+Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_mr_https ####
+Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_cr ####
+Start the Callback Receiver container
+| arg list |
+|--|
+| None |
+
+#### Function: start_policy_agent ####
+Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_stand_alone ####
+Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_rest_http ####
+Use http for all API calls to the Policy Agent. This is the default.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_rest_https ####
+Use https for all API calls to the Policy Agent.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_dmaap ####
+Send and recieve all API calls to the Policy Agent over Dmaap via the MR.
+| arg list |
+|--|
+| None |
+
+#### Function: set_agent_debug ####
+Configure the Policy Agent log on debug level. The Policy Agent must be running.
+| arg list |
+|--|
+| None |
+
+#### Function: set_agent_trace ####
+Configure the Policy Agent log on trace level. The Policy Agent must be running.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_retries ####
+Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
+| arg list |
+|--|
+| `[<response-code>]*` |
+
+| parameter | description |
+| --------- | ----------- |
+| `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'.  |
+
+#### Function: check_policy_agent_logs ####
+Check the Policy Agent log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+#### Function: check_control_panel_logs ####
+Check the Control Panel log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+#### Function: store_logs ####
+Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
+| arg list |
+|--|
+| `<logfile-prefix>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<logfile-prefix>` | Log file prefix  |
+
 
-###Descriptions of functions in testcase_common.sh
+#### Function: cr_equal ####
+TBD
 
-`clean_containers` \
-Stop and remove all containers including Policy Agent apps and simulators
+#### Function: mr_equal ####
+TBD
 
-`start_simulators` \
-Start all simulators in the simulator group
+#### Function: mr_greater ####
+TBD
 
-`consul_config_app  ` \
-Configure consul with json file with app config for a Policy Agent instance using the Policy Agent
-instance id and the json file.
+#### Function: mr_read ####
+TBD
 
-`start_policy_agent` \
-Start the Policy Agent application.
+#### Function: mr_print ####
+TBD
 
-`check_policy_agent_logs`
-Check the Policy Agent application log for WARN and ERR messages and print the count.
-`store_logs`
-Store all Policy Agent app and simulators log to the test case log dir. All logs get a prefix to
-separate logs stored at different steps in the test script.
-If logs need to be stored in several locations, use different prefix to easily identify the location
-when the logs where taken.
+### Descriptions of functions in testsuite_common.sh ###
+TBD
+### Descriptions of functions in agent_api_function.sh ###
+TBD
+### Descriptions of functions in ricsimulator_api_functions.sh ###
+TBD
+### Descriptions of functions in controller_api_functions.sh ###
+TBD
 
 ## License
 
index 958f914..550ace0 100644 (file)
@@ -251,7 +251,7 @@ api_get_policies() {
        fi
 
     if [ $paramError -ne 0 ]; then
-        __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-ype-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
+        __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
         return 1
     fi
        queryparams=""
@@ -280,6 +280,7 @@ api_get_policies() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -296,7 +297,7 @@ api_get_policies() {
                                if [ "$targetJson" != "[" ]; then
                                        targetJson=$targetJson","
                                fi
-                               targetJson=$targetJson"{\"id\":\"${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
+                               targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
                                if [ "${arr[$i+3]}" == "EMPTY" ]; then
                                        targetJson=$targetJson"\"\","
                                else
@@ -316,6 +317,7 @@ api_get_policies() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -339,13 +341,14 @@ api_get_policy() {
         return 1
     fi
 
-       query="/policy?id=$2"
+       query="/policy?id=$UUID$2"
        res="$(__do_curl_to_agent GET $query)"
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -360,6 +363,7 @@ api_get_policy() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -394,7 +398,7 @@ api_put_policy() {
        file=$7
 
        while [ $count -lt $max ]; do
-               query="/policy?id=$pid&ric=$ric&service=$2"
+               query="/policy?id=$UUID$pid&ric=$ric&service=$2"
 
                if [ $4 != "NOTYPE" ]; then
                        query=$query"&type=$4"
@@ -410,10 +414,10 @@ api_put_policy() {
        status=${res:${#res}-3}
                echo -ne " Creating "$count"("$max")${SAMELINE}"
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Created "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -453,7 +457,7 @@ api_put_policy_batch() {
        file=$7
        ARR=""
        while [ $count -lt $max ]; do
-               query="/policy?id=$pid&ric=$ric&service=$2"
+               query="/policy?id=$UUID$pid&ric=$ric&service=$2"
 
                if [ $4 != "NOTYPE" ]; then
                        query=$query"&type=$4"
@@ -470,10 +474,10 @@ api_put_policy_batch() {
                echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
-                       let pid=$pid+1
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -492,10 +496,10 @@ api_put_policy_batch() {
                echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Created(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -555,8 +559,12 @@ api_put_policy_parallel() {
 
        for ((i=1; i<=$pids; i++))
        do
+               uuid=$UUID
+               if [ -z "$uuid" ]; then
+                       uuid="NOUUID"
+               fi
                echo "" > ".pid${i}.res.txt"
-               echo $resp_code $urlbase $ric_base $num_rics $start_id $template $count $pids $i > ".pid${i}.txt"
+               echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i > ".pid${i}.txt"
                echo $i
        done  | xargs -n 1 -I{} -P $pids bash -c '{
                arg=$(echo {})
@@ -591,6 +599,7 @@ api_put_policy_parallel() {
 
        echo -e $RED" FAIL. One of more processes failed to execute" $ERED
        ((RES_FAIL++))
+       __check_stop_at_error
        return 1
 }
 
@@ -617,7 +626,7 @@ api_delete_policy() {
        pid=$2
 
        while [ $count -lt $max ]; do
-               query="/policy?id="$pid
+               query="/policy?id="$UUID$pid
                res="$(__do_curl_to_agent DELETE $query)"
                status=${res:${#res}-3}
                echo -ne " Deleting "$count"("$max")${SAMELINE}"
@@ -626,6 +635,7 @@ api_delete_policy() {
                        echo " Deleted "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                let pid=$pid+1
@@ -662,16 +672,16 @@ api_delete_policy_batch() {
        pid=$2
        ARR=""
        while [ $count -lt $max ]; do
-               query="/policy?id="$pid
+               query="/policy?id="$UUID$pid
                res="$(__do_curl_to_agent DELETE_BATCH $query)"
                status=${res:${#res}-3}
                echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne 200 ]; then
-                       let pid=$pid+1
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -691,10 +701,10 @@ api_delete_policy_batch() {
                echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
 
                if [ $status -ne $1 ]; then
-                       let pid=$pid+1
                        echo " Deleted(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -736,8 +746,12 @@ api_delete_policy_parallel() {
 
        for ((i=1; i<=$pids; i++))
        do
+               uuid=$UUID
+               if [ -z "$uuid" ]; then
+                       uuid="NOUUID"
+               fi
                echo "" > ".pid${i}.del.res.txt"
-               echo $resp_code $urlbase $num_rics $start_id $count $pids $i > ".pid${i}.del.txt"
+               echo $resp_code $urlbase $num_rics $uuid $start_id $count $pids $i > ".pid${i}.del.txt"
                echo $i
        done  | xargs -n 1 -I{} -P $pids bash -c '{
                arg=$(echo {})
@@ -772,6 +786,7 @@ api_delete_policy_parallel() {
 
        echo -e $RED" FAIL. One of more processes failed to execute" $ERED
        ((RES_FAIL++))
+       __check_stop_at_error
        return 1
 }
 
@@ -816,6 +831,7 @@ api_get_policy_ids() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -828,7 +844,7 @@ api_get_policy_ids() {
                                targetJson=$targetJson","
                        fi
                        if [ $pid != "NOID" ]; then
-                               targetJson=$targetJson"\"$pid\""
+                               targetJson=$targetJson"\"$UUID$pid\""
                        fi
                done
 
@@ -839,6 +855,7 @@ api_get_policy_ids() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -868,6 +885,7 @@ api_get_policy_schema() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -882,6 +900,7 @@ api_get_policy_schema() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -915,6 +934,7 @@ api_get_policy_schemas() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -940,6 +960,7 @@ api_get_policy_schemas() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -980,7 +1001,7 @@ api_get_policy_status() {
                return 1
        fi
 
-       query="/policy_status?id="$2
+       query="/policy_status?id="$UUID$2
 
        res="$(__do_curl_to_agent GET $query)"
     status=${res:${#res}-3}
@@ -988,6 +1009,7 @@ api_get_policy_status() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -998,6 +1020,7 @@ api_get_policy_status() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1033,6 +1056,7 @@ api_get_policy_types() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1057,6 +1081,7 @@ api_get_policy_types() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1088,6 +1113,7 @@ api_get_status() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1120,6 +1146,7 @@ api_get_ric() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1128,6 +1155,7 @@ api_get_ric() {
                if [ "$body" != "$3" ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1163,6 +1191,7 @@ api_get_rics() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1172,6 +1201,7 @@ api_get_rics() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, could not create target ric info json"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -1181,6 +1211,7 @@ api_get_rics() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1217,6 +1248,7 @@ api_put_service() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1264,6 +1296,7 @@ api_get_services() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1290,6 +1323,7 @@ api_get_services() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1319,6 +1353,7 @@ api_get_service_ids() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1338,6 +1373,7 @@ api_get_service_ids() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1366,6 +1402,7 @@ api_delete_services() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1394,6 +1431,7 @@ api_put_services_keepalive() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
index c4ba71c..e33c619 100644 (file)
@@ -98,12 +98,14 @@ controller_api_get_A1_policy_ids() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -117,7 +119,7 @@ controller_api_get_A1_policy_ids() {
         if [ "$targetJson" != "[" ]; then
             targetJson=$targetJson","
         fi
-        targetJson=$targetJson"\"$pid\""
+        targetJson=$targetJson"\"$UUID$pid\""
     done
     targetJson=$targetJson"]"
 
@@ -128,6 +130,7 @@ controller_api_get_A1_policy_ids() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -163,12 +166,14 @@ controller_api_get_A1_policy_type() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -184,6 +189,7 @@ controller_api_get_A1_policy_type() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -203,10 +209,10 @@ controller_api_delete_A1_policy() {
 
     paramError=1
     if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5"
                paramError=0
     elif [ $# -eq 4 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4"
         paramError=0
        fi
 
@@ -222,12 +228,14 @@ controller_api_delete_A1_policy() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -246,12 +254,12 @@ controller_api_put_A1_policy() {
 
     paramError=1
     if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5"
         body=$(sed 's/XXX/'${5}'/g' $6)
 
                paramError=0
     elif [ $# -eq 5 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4"
         body=$(sed 's/XXX/'${4}'/g' $5)
         paramError=0
        fi
@@ -268,12 +276,14 @@ controller_api_put_A1_policy() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -294,7 +304,7 @@ controller_api_get_A1_policy_status() {
     targetJson=""
     paramError=1
     if [ $# -ge 5 ] && [ $2 == "OSC" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5/status"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
         if [ $# -gt 5 ]; then
             targetJson="{\"instance_status\":\"$6\""
             targetJson=$targetJson",\"has_been_deleted\":\"$7\""
@@ -302,7 +312,7 @@ controller_api_get_A1_policy_status() {
         fi
                paramError=0
     elif [ $# -ge 4 ] && [ $2 == "STD" ]; then
-        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4/status"
+        url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$UUID$4/status"
         if [ $# -gt 4 ]; then
             targetJson="{\"enforceStatus\":\"$5\""
             if [ $# -eq 6 ]; then
@@ -325,12 +335,14 @@ controller_api_get_A1_policy_status() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -343,6 +355,7 @@ controller_api_get_A1_policy_status() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
index b242db0..8d37678 100644 (file)
@@ -23,27 +23,32 @@ import os
 import json
 import sys
 import requests
+import traceback
 
 # disable warning about unverified https requests
 from requests.packages import urllib3
 
 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
-#arg responsecode baseurl ric_base num_rics startid templatepath count pids pid_id
+#arg responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id
 try:
-    if len(sys.argv) != 10:
-        print("1Expected 9 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics startid templatepath count pids pid_id")
+    if len(sys.argv) != 11:
+        print("1Expected 10 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics uuid startid templatepath count pids pid_id")
         sys.exit()
 
     responsecode=int(sys.argv[1])
     baseurl=sys.argv[2]
     ric_base=sys.argv[3]
     num_rics=int(sys.argv[4])
-    start=int(sys.argv[5])
-    templatepath=sys.argv[6]
-    count=int(sys.argv[7])
-    pids=int(sys.argv[8])
-    pid_id=int(sys.argv[9])
+    uuid=sys.argv[5]
+    start=int(sys.argv[6])
+    templatepath=sys.argv[7]
+    count=int(sys.argv[8])
+    pids=int(sys.argv[9])
+    pid_id=int(sys.argv[10])
+
+    if uuid == "NOUUID":
+        uuid=""
 
     with open(templatepath, 'r') as file:
         template = file.read()
@@ -56,15 +61,18 @@ try:
                 payload=template.replace("XXX",str(i))
                 ric_id=(i%num_rics)+1
                 ric=ric_base+str(ric_id)
-                url=baseurl+"&id="+str(i)+"&ric="+str(ric)
+                url=baseurl+"&id="+uuid+str(i)+"&ric="+str(ric)
                 try:
                     headers = {'Content-type': 'application/json'}
                     resp=requests.put(url, json.dumps(json.loads(payload)), headers=headers, verify=False, timeout=90)
                 except Exception as e1:
-                    print("1Put failed for id:"+str(i)+ ", "+str(e1))
+                    print("1Put failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                    sys.exit()
+                if (resp.status_code == None):
+                    print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
                     sys.exit()
                 if (resp.status_code != responsecode):
-                    print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+                    print("1Put failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
                     sys.exit()
 
     print("0")
index be15e92..e647118 100644 (file)
@@ -23,38 +23,46 @@ import os
 import json
 import sys
 import requests
+import traceback
 
 # disable warning about unverified https requests
 from requests.packages import urllib3
 
 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
-#arg responsecode baseurl num_rics startid count pids pid_id
+#arg responsecode baseurl num_rics uuid startid count pids pid_id
 
 try:
-    if len(sys.argv) != 8:
-        print("1Expected 7 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl num_rics startid count pids pid_id")
+    if len(sys.argv) != 9:
+        print("1Expected 8 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl num_rics uuid startid count pids pid_id")
         sys.exit()
 
     responsecode=int(sys.argv[1])
     baseurl=sys.argv[2]
     num_rics=int(sys.argv[3])
-    start=int(sys.argv[4])
-    count=int(sys.argv[5])
-    pids=int(sys.argv[6])
-    pid_id=int(sys.argv[7])
+    uuid=sys.argv[4]
+    start=int(sys.argv[5])
+    count=int(sys.argv[6])
+    pids=int(sys.argv[7])
+    pid_id=int(sys.argv[8])
+
+    if uuid == "NOUUID":
+        uuid=""
 
     stop=count*num_rics+start
     for i in range(start,stop):
         if (i%pids == (pid_id-1)):
-            url=str(baseurl+"?id="+str(i))
+            url=str(baseurl+"?id="+uuid+str(i))
             try:
                 resp=requests.delete(url, verify=False, timeout=90)
             except Exception as e1:
-                print("1Delete failed for id:"+str(i)+ ", "+str(e1))
+                print("1Delete failed for id:"+uuid+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                sys.exit()
+            if (resp.status_code == None):
+                print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: None")
                 sys.exit()
             if (resp.status_code != responsecode):
-                print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+                print("1Delete failed for id:"+uuid+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
                 sys.exit()
 
     print("0")
index c30af1a..f003559 100644 (file)
@@ -214,7 +214,7 @@ sim_post_forcedelay() {
        app=$2
        res=$(__find_sim_port $app)
 
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/delay"
+    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/forcedelay"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?delay="$3
        fi
index afe81c9..11c3b6d 100755 (executable)
 
 # Local Policy Agent image and tag
 POLICY_AGENT_LOCAL_IMAGE="o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
+POLICY_AGENT_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
 # Remote Policy Agent image and tag
 POLICY_AGENT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.0"
+POLICY_AGENT_REMOTE_IMAGE_TAG="2.0.0"
 
 
 # Control Panel local image and tag
 CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
+CONTROL_PANEL_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
 # Control Panel remote image and tag
 CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_REMOTE_IMAGE_TAG="1.0.0"
+CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
 
 
 # SDNC A1 Controller local image and tag
 SDNC_A1_CONTROLLER_LOCAL_IMAGE="o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="1.7.5-SNAPSHOT"
+SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
 # SDNC A1 Controller remote image and tag
 SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="1.7.5"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.0"
 
 
 #SDNC DB remote image and tag
@@ -69,7 +69,7 @@ RIC_SIM_LOCAL_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
 RIC_SIM_LOCAL_IMAGE_TAG="latest"
 # Near RT RIC Simulator remote image and tag
 RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="1.0.1"
+RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
 
 
 #Consul remote image and tag
@@ -132,6 +132,7 @@ export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of C
 export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
                                                                 # Note, a prefix is added to each container name by the .env file in the 'ric' dir
 RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                                # This prefix can be changed from the command line
 export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
                                                                 # (external ports allocated by docker)
 export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
@@ -167,6 +168,9 @@ export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel
 export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
 CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
 
+UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
+                                                                # Testscript need to set the UUID to use other this empty prefix is used
+
 RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
 RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
 DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter
index 4818bc0..d694ef1 100755 (executable)
@@ -18,7 +18,7 @@
 #
 
 # This is a script that contains all the functions needed for auto test
-# Arg: local|remote|remote-remove [auto-clean]
+# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam> [<app-name>]*]
 
 
 #Formatting for 'echo' cmd
@@ -94,6 +94,12 @@ AUTO_CLEAN=""
 # Var to hold the app names to use local image for when running 'remote' or 'remote-remove'
 USE_LOCAL_IMAGES=""
 
+# List of available apps to override with local image
+AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA CP SDNC RICSIM"
+
+# Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
+STOP_AT_ERROR=0
+
 # Set a description string for the test case
 if [ -z "$TC_ONELINE_DESCR" ]; then
        TC_ONELINE_DESCR="<no-description>"
@@ -121,6 +127,11 @@ TESTLOGS=$PWD/logs
 HTTPLOG=$PWD"/.httplog_"$ATC".txt"
 echo "" > $HTTPLOG
 
+#Create result file (containing '1' for error) for this test case
+#Will be replaced with a file containing '0' if script is ok
+
+echo "1" > "$PWD/.result$ATC.txt"
+
 # Create a log dir for the test case
 mkdir -p $TESTLOGS/$ATC
 
@@ -172,27 +183,67 @@ if [ $paramerror -eq 0 ]; then
                shift;
        fi
 fi
-if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "auto-clean" ]; then
-               AUTO_CLEAN="auto"
-               shift;
+foundparm=0
+while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
+       foundparm=1
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "auto-clean" ]; then
+                       AUTO_CLEAN="auto"
+                       echo "Option set - Auto clean at end of test script"
+                       shift;
+                       foundparm=0
+               fi
        fi
-fi
-if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "-use-local-image" ]; then
-               USE_LOCAL_IMAGES=${@:2}
-               while [ $# -gt 0 ]; do
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--stop-at-error" ]; then
+                       STOP_AT_ERROR=1
+                       echo "Option set - Stop at first error"
                        shift;
-               done
+                       foundparm=0
+               fi
        fi
-fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--ricsim-prefix" ]; then
+                       shift;
+                       RIC_SIM_PREFIX=$1
+                       if [ -z "$1" ]; then
+                               paramerror=1
+                       else
+                               echo "Option set - Overriding RIC_SIM_PREFIX with: "$1
+                               shift;
+                               foundparm=0
+                       fi
+               fi
+       fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-local-image" ]; then
+                       USE_LOCAL_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_LOCAL_IMAGES=$USE_LOCAL_IMAGES" "$1
+                               if [[ "$AVAILABLE_LOCAL_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                                       paramerror=1
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_LOCAL_IMAGES" ]; then
+                               paramerror=1
+                       else
+                               echo "Option set - Override remote images for app(s):"$USE_LOCAL_IMAGES
+                       fi
+               fi
+       fi
+done
+echo ""
 
+#Still params left?
 if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then
        paramerror=1
 fi
 
 if [ $paramerror -eq 1 ]; then
-       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [-use-local-image <app-nam> [<app-name>]]"$ERED
+       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam> [<app-name>]*]"$ERED
        exit 1
 fi
 
@@ -242,7 +293,7 @@ __check_image_var() {
 
 
 #Check if app local image shall override remote image
-check_image_local_override() {
+__check_image_local_override() {
        for im in $USE_LOCAL_IMAGES; do
                if [ "$1" == "$im" ]; then
                        return 1
@@ -252,7 +303,7 @@ check_image_local_override() {
 }
 
 #Check if app uses image excluded from this test run
-check_excluded_image() {
+__check_excluded_image() {
        for im in $EXCLUDED_IMAGES; do
                if [ "$1" == "$im" ]; then
                        return 1
@@ -280,7 +331,7 @@ if [ $START_ARG == "local" ]; then
 
 elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
 
-       check_image_local_override 'PA'
+       __check_image_local_override 'PA'
        if [ $? -eq 0 ]; then
                #Remote agent image
                __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG"
@@ -289,7 +340,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'CP'
+       __check_image_local_override 'CP'
        if [ $? -eq 0 ]; then
                #Remote Control Panel image
                __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG"
@@ -298,7 +349,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'SDNC'
+       __check_image_local_override 'SDNC'
        if [ $? -eq 0 ]; then
                #Remote SDNC image
                __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG"
@@ -307,7 +358,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'RICSIM'
+       __check_image_local_override 'RICSIM'
        if [ $? -eq 0 ]; then
                #Remote ric sim image
                __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG"
@@ -329,7 +380,7 @@ __check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "C
 __check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG"
 __check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG"
 __check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG"
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        __check_image_var " SDNC ONAP A1 Adapter" $START_ARG "SDNC_ONAP_A1_ADAPTER_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG"
        __check_image_var " SDNC ONAP DB" $START_ARG "SDNC_ONAP_DB_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE_TAG"
@@ -453,21 +504,21 @@ __check_and_pull_image() {
 echo -e $BOLD"Pulling configured images, if needed"$EBOLD
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'PA'
+__check_image_local_override 'PA'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
 app="Policy Agent";             __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'CP'
+__check_image_local_override 'CP'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
 app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'RICSIM'
+__check_image_local_override 'RICSIM'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
@@ -475,10 +526,10 @@ app="Near-RT RIC Simulator";    __check_and_pull_image $START_ARG_MOD "$app" $RI
 
 app="Consul";                   __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
 app="CBS";                      __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
-check_excluded_image 'SDNC'
+__check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        START_ARG_MOD=$START_ARG
-       check_image_local_override 'SDNC'
+       __check_image_local_override 'SDNC'
        if [ $? -eq 1 ]; then
                START_ARG_MOD="local"
        fi
@@ -487,7 +538,7 @@ if [ $? -eq 0 ]; then
 else
        echo -e $YELLOW" Excluding SDNC image and related DB image from image check/pull"$EYELLOW
 fi
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        app="SDNC ONAP A1 Adapter";     __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_A1_ADAPTER_IMAGE
        app="SDNC ONAP DB";             __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_DB_IMAGE
@@ -554,12 +605,12 @@ echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)
 echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >>   $docker_tmp_file
 echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >>   $docker_tmp_file
 echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >>   $docker_tmp_file
-check_excluded_image 'SDNC'
+__check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >>   $docker_tmp_file
 fi
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        echo -e " SDNC ONAP A1 Adapter\t$(docker images --format $format_string $SDNC_ONAP_A1_ADAPTER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC ONAP DB\t$(docker images --format $format_string $SDNC_ONAP_DB_IMAGE)" >>   $docker_tmp_file
@@ -640,6 +691,8 @@ print_result() {
                if [ -f .tmp_tcsuite_pass ]; then
                        echo " - "$ATC " -- "$TC_ONELINE_DESCR"  Execution time: "$duration" seconds" >> .tmp_tcsuite_pass
                fi
+               #Create file with OK exit code
+               echo "0" > "$PWD/.result$ATC.txt"
        else
                echo -e "One or more tests with status  \033[31m\033[1mFAIL\033[0m "
                echo -e "\033[31m\033[1m  ___ _   ___ _    \033[0m"
@@ -743,6 +796,16 @@ deviation() {
        echo ""
 }
 
+# Stop at first FAIL test case and take all logs - only for debugging/trouble shooting
+__check_stop_at_error() {
+       if [ $STOP_AT_ERROR -eq 1 ]; then
+               echo -e $RED"Test script configured to stop at first FAIL, taking all logs and stops"$ERED
+               store_logs "STOP_AT_ERROR"
+               exit 1
+       fi
+       return 0
+}
+
 # Stop and remove all containers
 # args: -
 # (Function for test scripts)
@@ -803,6 +866,14 @@ clean_containers() {
        echo -e $BOLD" Removing all dangling/untagged docker images"$EBOLD
     docker rmi --force $(docker images -q -f dangling=true) &> /dev/null
        echo ""
+
+       CONTRS=$(docker ps | awk '$1 != "CONTAINER" { n++ }; END { print n+0 }')
+       if [ $? -eq 0 ]; then
+               if [ $CONTRS -ne 0 ]; then
+                       echo -e $RED"Containers running, may cause distubance to the test case"$ERED
+                       docker ps -a
+               fi
+       fi
 }
 
 # Function stop and remove all container in the end of the test script, if the arg 'auto-clean' is given at test script start
@@ -817,7 +888,7 @@ auto_clean_containers() {
 }
 
 # Function to sleep a test case for a numner of seconds. Prints the optional text args as info
-# args: <sleep-time-in-sec> [any-text-in-quoteds-to-printed]
+# args: <sleep-time-in-sec> [any-text-in-quotes-to-be-printed]
 # (Function for test scripts)
 sleep_wait() {
 
@@ -1022,6 +1093,13 @@ __start_container() {
        return 0
 }
 
+# Generate a UUID to use as prefix for policy ids
+generate_uuid() {
+       UUID=$(python3 -c 'import sys,uuid; sys.stdout.write(uuid.uuid4().hex)')
+       #Reduce length to make space for serial id, us 'a' as marker where the serial id is added
+       UUID=${UUID:0:${#UUID}-4}"a"
+}
+
 ####################
 ### Consul functions
 ####################
@@ -1156,7 +1234,7 @@ prepare_consul_config() {
 
        config_json=$config_json"\n   \"ric\": ["
 
-       rics=$(docker ps | grep ricsim | awk '{print $NF}')
+       rics=$(docker ps | grep $RIC_SIM_PREFIX | awk '{print $NF}')
 
        if [ $? -ne 0 ] || [ -z "$rics" ]; then
                echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
@@ -1231,31 +1309,36 @@ use_simulator_https() {
 }
 
 # Start one group (ricsim_g1, ricsim_g2 or ricsim_g3) with a number of RIC Simulators using a given A interface
+# 'ricsim' may be set on command line to other prefix
 # args:  ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>
 # (Function for test scripts)
 start_ric_simulators() {
 
        echo -e $BOLD"Starting RIC Simulators"$EBOLD
 
+       RIC1=$RIC_SIM_PREFIX"_g1"
+       RIC2=$RIC_SIM_PREFIX"_g2"
+       RIC3=$RIC_SIM_PREFIX"_g3"
+
        if [ $# != 3 ]; then
                ((RES_CONF_FAIL++))
-       __print_err "need three args,  ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>" $@
+       __print_err "need three args,  $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
                exit 1
        fi
        echo " $2 simulators using basename: $1 on interface: $3"
        #Set env var for simulator count and A1 interface vesion for the given group
-       if [ $1 == "ricsim_g1" ]; then
+       if [ $1 == "$RIC1" ]; then
                G1_COUNT=$2
                G1_A1_VERSION=$3
-       elif [ $1 == "ricsim_g2" ]; then
+       elif [ $1 == "$RIC2" ]; then
                G2_COUNT=$2
                G2_A1_VERSION=$3
-       elif [ $1 == "ricsim_g3" ]; then
+       elif [ $1 == "$RIC3" ]; then
                G3_COUNT=$2
                G3_A1_VERSION=$3
        else
                ((RES_CONF_FAIL++))
-       __print_err "need three args, gricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>" $@
+       __print_err "need three args, $RIC1|$RIC2|$RIC3 <count> <interface-id>" $@
                exit 1
        fi
 
@@ -1305,7 +1388,7 @@ start_sdnc() {
 
        echo -e $BOLD"Starting SDNC A1 Controller"$EBOLD
 
-       check_excluded_image 'SDNC'
+       __check_excluded_image 'SDNC'
        if [ $? -eq 1 ]; then
                echo -e $RED"The image for SDNC and the related DB has not been checked for this test run due to arg to the test script"$ERED
                echo -e $RED"SDNC will not be started"$ERED
@@ -1343,7 +1426,7 @@ start_sdnc_onap() {
 
        echo -e $BOLD"Starting SDNC ONAP A1 Adapter"$EBOLD
 
-       check_excluded_image 'SDNC_ONAP'
+       __check_excluded_image 'SDNC_ONAP'
        if [ $? -eq 1 ]; then
                echo -e $RED"The image for SDNC ONAP and the related DB has not been checked for this test run due to arg to the test script"$ERED
                echo -e $RED"SDNC ONAP will not be started"$ERED
@@ -1509,6 +1592,20 @@ set_agent_debug() {
        return 0
 }
 
+# Turn on trace level tracing in the agent
+# args: -
+# (Function for test scripts)
+set_agent_trace() {
+       echo -e $BOLD"Setting agent trace"$EBOLD
+       curl $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST  -H 'Content-Type: application/json' -d '{"configuredLevel":"trace"}' &> /dev/null
+       if [ $? -ne 0 ]; then
+               __print_err "could not set trace mode" $@
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
 # Perform curl retries when making direct call to the agent for the specified http response codes
 # Speace separated list of http response codes
 # args: [<response-code>]*
@@ -1656,7 +1753,6 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
-               #echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} within ${6} seconds ----"
                echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
                ((RES_TEST++))
                start=$SECONDS
@@ -1679,39 +1775,35 @@ __var_test() {
                        if [ $retcode -ne 0 ]; then
                                if [ $duration -gt $6 ]; then
                                        ((RES_FAIL++))
-                                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5}  not reached in ${6} seconds, result = ${result} ----"
                                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached in ${6} seconds, result = ${result}"
+                                       __check_stop_at_error
                                        return
                                fi
                        elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds ----"
                                return
                        elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        else
                                if [ $duration -gt $6 ]; then
                                        ((RES_FAIL++))
                                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached in ${6} seconds, result = ${result}"
-                                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5}  not reached in ${6} seconds, result = ${result} ----"
+                                       __check_stop_at_error
                                        return
                                fi
                        fi
@@ -1722,7 +1814,6 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
-               #echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} ----"
                echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD
                ((RES_TEST++))
                if [ $checkjsonarraycount -eq 0 ]; then
@@ -1738,28 +1829,24 @@ __var_test() {
                fi
                if [ $retcode -ne 0 ]; then
                        ((RES_FAIL++))
-                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
                        echo -e $RED" FAIL ${ERED}- ${3} ${4} ${5} not reached, result = ${result}"
+                       __check_stop_at_error
                elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met"
                elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                else
                        ((RES_FAIL++))
                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached, result = ${result}"
-                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
+                       __check_stop_at_error
                fi
        else
                echo "Wrong args to __var_test, needs five or six args: <simulator-name> <host> <variable-name> <condition-operator> <target-value> [ <timeout> ]"
index 701a7f5..70ec587 100644 (file)
@@ -34,6 +34,7 @@ services:
     environment:
       - A1_VERSION=${G1_A1_VERSION}
       - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
     volumes:
       - ${RIC_SIM_CERT_MOUNT_DIR}:/usr/src/app/cert:ro
   g2:
@@ -46,6 +47,7 @@ services:
     environment:
       - A1_VERSION=${G2_A1_VERSION}
       - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
     volumes:
       - ${RIC_SIM_CERT_MOUNT_DIR}:/usr/src/app/cert:ro
   g3:
@@ -58,5 +60,6 @@ services:
     environment:
       - A1_VERSION=${G3_A1_VERSION}
       - REMOTE_HOSTS_LOGGING=1
+      - ALLOW_HTTP=true
     volumes:
       - ${RIC_SIM_CERT_MOUNT_DIR}:/usr/src/app/cert:ro
\ No newline at end of file
index d56ad7f..17d3205 100644 (file)
@@ -41,7 +41,7 @@ app.get("/",function(req, res){
 function getSimCtr(url, index, cb) {
     var data = '';
 
-    console.log("URL: "+ url + " - ")
+    //console.log("URL: "+ url + " - ")
     try {
         http.get(url, (resp) => {
             // A chunk of data has been recieved.
@@ -185,6 +185,8 @@ var getCtr=0
 
 var refreshInterval=4000
 
+var ricbasename="ricsim"
+
 function fetchAllMetrics() {
     setTimeout(() => {
 
@@ -195,7 +197,7 @@ function fetchAllMetrics() {
         if (getCtr%3 == 0) {
             //Extract the port numbers from the running simulators, for every 3 calls
             const { exec } = require('child_process');
-            exec('docker ps --filter "name=ricsim" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => {
+            exec('docker ps --filter "name='+ricbasename+'" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => {
 
                 var simulators = ""
                 simulators=`${stdout}`.replace(/(\r\n|\n|\r)/gm," ");
@@ -377,6 +379,14 @@ setInterval(() => {
 
 app.get("/mon",function(req, res){
 
+    var bn=req.query.basename
+
+    if (bn == undefined) {
+        getCtr=0
+        return res.redirect('/mon?basename=ricsim');
+    } else {
+        ricbasename=bn
+    }
 
     refreshInterval=2000
 
@@ -388,6 +398,9 @@ app.get("/mon",function(req, res){
             "<title>Policy Agent and simulator monitor</title>"+
             "</head>" +
             "<body>" +
+            "<font size=\"-3\" face=\"monospace\">" +
+            "<p>Change basename in url if other ric sim prefix is used</p>" +
+            "</font>" +
             "<h3>Policy agent</h3>" +
             "<font face=\"monospace\">" +
             "Status:..............................." + formatDataRow(ag1) + "<br>" +