Enable ACM tests in K8s CSIT 21/134021/11
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Wed, 5 Apr 2023 12:47:15 +0000 (13:47 +0100)
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>
Tue, 2 May 2023 17:52:04 +0000 (18:52 +0100)
Moved all the image references to the parent chart.
Updating the latest image tags during installation.
Disabling charts by default and enabling only the project specific ones.

Issue-ID: POLICY-4541
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Ie22584ff38e777379ac1ee2d61743868a8b93b5c

41 files changed:
compose/get-k8s-versions.sh [new file with mode: 0755]
csit/resources/scripts/run-test.sh
csit/resources/scripts/setup-clamp.sh
csit/resources/tests/api-slas.robot
csit/resources/tests/data/AcDocker.json [moved from csit/resources/tests/data/AutomationComposition.json with 100% similarity]
csit/resources/tests/data/AcK8s.json [new file with mode: 0644]
csit/resources/tests/pap-slas.robot
csit/resources/tests/policy-clamp-test.robot
csit/run-k8s-csit-enable.sh [deleted file]
csit/run-k8s-csit.sh
helm/policy/components/mariadb-galera/templates/statefulset.yaml
helm/policy/components/mariadb-galera/values.yaml
helm/policy/components/policy-apex-pdp/templates/statefulset.yaml
helm/policy/components/policy-apex-pdp/values.yaml
helm/policy/components/policy-api/templates/deployment.yaml
helm/policy/components/policy-api/values.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-a1pms-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-http-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-k8s-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-k8s-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-kserve-ppnt/values.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/templates/deployment.yaml
helm/policy/components/policy-clamp-ac-pf-ppnt/values.yaml
helm/policy/components/policy-clamp-runtime-acm/templates/deployment.yaml
helm/policy/components/policy-clamp-runtime-acm/values.yaml
helm/policy/components/policy-distribution/templates/deployment.yaml
helm/policy/components/policy-distribution/values.yaml
helm/policy/components/policy-drools-pdp/templates/statefulset.yaml
helm/policy/components/policy-drools-pdp/values.yaml
helm/policy/components/policy-models-simulator/templates/deployment.yaml
helm/policy/components/policy-models-simulator/values.yaml
helm/policy/components/policy-pap/templates/deployment.yaml
helm/policy/components/policy-pap/values.yaml
helm/policy/components/policy-xacml-pdp/templates/deployment.yaml
helm/policy/components/policy-xacml-pdp/values.yaml
helm/policy/templates/job.yaml
helm/policy/values.yaml
helm/robot/templates/test-job.yaml

diff --git a/compose/get-k8s-versions.sh b/compose/get-k8s-versions.sh
new file mode 100755 (executable)
index 0000000..a1613bb
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/bash
+
+# ============LICENSE_START====================================================
+#  Copyright (C) 2023 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END======================================================
+
+# Fetches the latest snapshot tags of policy components and updates the values.yaml in policy helm chart.
+
+if [ -z "${WORKSPACE}" ]; then
+    WORKSPACE=$(git rev-parse --show-toplevel)
+    export WORKSPACE
+fi
+
+VALUES_YML=${WORKSPACE}/helm/policy/values.yaml
+
+policy_components=(policy-api policy-pap policy-apex-pdp policy-models-simulator policy-pdpd-cl policy-xacml-pdp policy-distribution)
+
+clamp_components=(policy-clamp-runtime-acm policy-clamp-ac-kserve-ppnt policy-clamp-ac-k8s-ppnt policy-clamp-ac-pf-ppnt policy-clamp-ac-http-ppnt policy-clamp-ac-a1pms-ppnt)
+
+version_tags=$(source ${WORKSPACE}/compose/get-versions.sh)
+export version_tags
+
+function update_yaml() {
+   local version=$(cut -d ":" -f2 <<< $(echo $version_tags | tr ' ' '\n' | grep "$1:" | tr -d '"'))
+   echo "$2:$version"
+   sed -i -e "s#onap/$2:[^=&]*#onap/$2:$version#g" $VALUES_YML
+}
+
+function update_image_tags() {
+    sub_components=("$@")
+    for sub_component in ${sub_components[@]}
+    do
+        if [[ $1 == 'clamp' ]]
+        then
+           component=policy-clamp-ac-kserve-ppnt
+        elif [[ $1 == 'policy' ]]
+       then
+            component=$sub_component
+       fi
+        update_yaml $component $sub_component
+    done
+}
+
+echo "Update the latest image tags:"
+update_image_tags policy ${policy_components[@]}
+update_image_tags clamp ${clamp_components[@]}
index 6286e9c..02f06ff 100755 (executable)
@@ -36,6 +36,7 @@ DISTRIBUTION_IP=policy-distribution:6969
 DMAAP_IP=message-router:3904
 APEX_EVENTS_IP=policy-apex-pdp:23324
 PROMETHEUS_IP=prometheus:9090
+CLAMP_K8S_TEST=true
 
 DIST_TEMP_FOLDER=/tmp/distribution
 
@@ -44,7 +45,7 @@ ROBOT_VARIABLES="-v DATA:$DATA -v NODETEMPLATES:$NODETEMPLATES -v POLICY_API_IP:
 -v POLICY_RUNTIME_ACM_IP:$POLICY_RUNTIME_ACM_IP -v POLICY_PAP_IP:$POLICY_PAP_IP -v APEX_IP:$APEX_IP
 -v APEX_EVENTS_IP:$APEX_EVENTS_IP -v DMAAP_IP:$DMAAP_IP -v PROMETHEUS_IP:${PROMETHEUS_IP}
 -v POLICY_PDPX_IP:$POLICY_PDPX_IP -v POLICY_DROOLS_IP:$POLICY_DROOLS_IP -v TEMP_FOLDER:${DIST_TEMP_FOLDER}
--v DISTRIBUTION_IP:$DISTRIBUTION_IP"
+-v DISTRIBUTION_IP:$DISTRIBUTION_IP -v CLAMP_K8S_TEST:$CLAMP_K8S_TEST"
 
 echo "Run Robot test"
 echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
index e680cf0..4eae4da 100755 (executable)
@@ -25,9 +25,11 @@ unset http_proxy https_proxy
 # wait for the app to start up
 "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}"
 
+CLAMP_K8S_TEST=false
+
 export SUITES="policy-clamp-test.robot"
 
 ROBOT_VARIABLES="-v POLICY_RUNTIME_ACM_IP:localhost:${ACM_PORT}
--v POLICY_API_IP:localhost:${API_PORT} -v POLICY_PAP_IP:localhost:${PAP_PORT}"
+-v POLICY_API_IP:localhost:${API_PORT} -v POLICY_PAP_IP:localhost:${PAP_PORT} -v CLAMP_K8S_TEST:$CLAMP_K8S_TEST"
 
 
index 717ac3d..7fd8ff9 100644 (file)
@@ -8,8 +8,8 @@ Resource    ${CURDIR}/common-library.robot
 *** Keywords ***
 ValidateResponseTimeForApi
     [Arguments]  ${uri}  ${method}
-    [Documentation]  Check if uri response is under the 500ms required time for api metrics
-    ValidateResponseTime  api-metrics  ${uri}  ${method}  500
+    [Documentation]  Check if uri response is under the 1500ms required time for api metrics
+    ValidateResponseTime  api-metrics  ${uri}  ${method}  1500
 
 *** Test Cases ***
 WaitForPrometheusServer
@@ -30,12 +30,12 @@ ValidateResponseTimeQueryPolicies
 
 ValidateResponseTimeQueryPolicyTypeListVersions
     [Documentation]  Validate query policyType versions response time
-    ValidateResponseTime  api-metrics  /policytypes/{policyTypeId}  GET  400
+    ValidateResponseTime  api-metrics  /policytypes/{policyTypeId}  GET  1500
 
-#Time increased from 200 to 250 due to slow ONAP machines
+#Time increased from 200 to 1500 due to slow ONAP machines
 ValidateResponseTimeQueryPolicyVersion
     [Documentation]  Validate query policy by version response time
-    ValidateResponseTime  api-metrics   /policies/{policyId}/versions/{policyVersion}  GET  250
+    ValidateResponseTime  api-metrics   /policies/{policyId}/versions/{policyVersion}  GET  1500
 
 ValidateResponseTimeCreatePolicy
     [Documentation]  Validate response time for creating a policy
diff --git a/csit/resources/tests/data/AcK8s.json b/csit/resources/tests/data/AcK8s.json
new file mode 100644 (file)
index 0000000..f9ef5b0
--- /dev/null
@@ -0,0 +1,211 @@
+{
+  "name": "DemoInstance0",
+  "version": "1.0.1",
+  "compositionId": "COMPOSITIONIDPLACEHOLDER",
+  "description": "Demo automation composition instance 0",
+  "elements": {
+    "709c62b3-8918-41b9-a747-d21eb79c6c20": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c20",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.Policy_AutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Starter Automation Composition Element for the Demo",
+      "properties": {
+        "policy_type_id": {
+          "name": "onap.policies.operational.pm-subscription-handler",
+          "version": "1.0.0"
+        },
+        "policy_id": {
+          "get_input": "acm_element_policy"
+        }
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c21": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c21",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.K8S_StarterAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Starter Automation Composition Element for the Demo",
+      "properties": {
+        "chart": {
+          "chartId": {
+            "name": "acelement",
+            "version": "0.1.0"
+          },
+          "namespace": "default",
+          "releaseName": "acm-starter",
+          "podName": "acm-starter",
+          "repository": {
+            "repoName": "policy-chartmuseum",
+            "address": "http://policy-chartmuseum:8080"
+          },
+          "overrideParams": {
+            "acelement.elementId.name": "onap.policy.clamp.ac.starter",
+            "service.nodeport": 30800
+          }
+        }
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c22": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.K8S_BridgeAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Bridge Automation Composition Element for the Demo",
+      "properties": {
+        "chart": {
+          "chartId": {
+            "name": "acelement",
+            "version": "0.1.0"
+          },
+          "namespace": "default",
+          "releaseName": "acm-bridge",
+          "podName": "acm-bridge",
+          "repository": {
+            "repoName": "policy-chartmuseum",
+            "address": "http://policy-chartmuseum:8080"
+          },
+          "overrideParams": {
+            "acelement.elementId.name": "onap.policy.clamp.ac.bridge",
+            "service.nodeport": 30801
+          }
+        }
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c23": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c23",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.K8S_SinkAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Sink Automation Composition Element for the Demo",
+      "properties": {
+        "chart": {
+          "chartId": {
+            "name": "acelement",
+            "version": "0.1.0"
+          },
+          "namespace": "default",
+          "releaseName": "acm-sink",
+          "podName": "acm-sink",
+          "repository": {
+            "repoName": "policy-chartmuseum",
+            "address": "http://policy-chartmuseum:8080"
+          },
+          "overrideParams": {
+            "acelement.elementId.name": "onap.policy.clamp.ac.sink",
+            "service.nodeport": 30802
+          }
+        }
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c24": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c24",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.Http_StarterAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Starter Automation Composition Element for the Demo",
+      "properties": {
+        "baseUrl": "http://acm-starter-ac-element-impl:8084",
+        "httpHeaders": {
+          "Content-Type": "application/json",
+          "Authorization": "Basic YWNtVXNlcjp6YiFYenRHMzQ="
+        },
+        "configurationEntities": [
+          {
+            "configurationEntityId": {
+              "name": "onap.policy.clamp.ac.starter",
+              "version": "1.0.0"
+            },
+            "restSequence": [
+              {
+                "restRequestId": {
+                  "name": "request1",
+                  "version": "1.0.1"
+                },
+                "httpMethod": "POST",
+                "path": "/onap/policy/clamp/acelement/v2/activate",
+                "body": "{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.startertobridge\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"STARTER\", \"topicParameterGroup\": { \"server\": \"message-router:3904\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }",
+                "expectedResponse": 201
+              }
+            ]
+          }
+        ]
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c25": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c25",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.Http_BridgeAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Bridge Automation Composition Element for the Demo",
+      "properties": {
+        "baseUrl": "http://acm-bridge-ac-element-impl:8084",
+        "httpHeaders": {
+          "Content-Type": "application/json",
+          "Authorization": "Basic YWNtVXNlcjp6YiFYenRHMzQ="
+        },
+        "configurationEntities": [
+          {
+            "configurationEntityId": {
+              "name": "onap.policy.clamp.ac.bridge",
+              "version": "1.0.0"
+            },
+            "restSequence": [
+              {
+                "restRequestId": {
+                  "name": "request2",
+                  "version": "1.0.1"
+                },
+                "httpMethod": "POST",
+                "path": "/onap/policy/clamp/acelement/v2/activate",
+                "body": "{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.bridgetosink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"BRIDGE\", \"topicParameterGroup\": { \"server\": \"message-router:3904\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }",
+                "expectedResponse": 201
+              }
+            ]
+          }
+        ]
+      }
+    },
+    "709c62b3-8918-41b9-a747-d21eb79c6c26": {
+      "id": "709c62b3-8918-41b9-a747-d21eb79c6c26",
+      "definition": {
+        "name": "onap.policy.clamp.ac.element.Http_SinkAutomationCompositionElement",
+        "version": "1.2.3"
+      },
+      "description": "Sink Automation Composition Element for the Demo",
+      "properties": {
+        "baseUrl": "http://acm-sink-ac-element-impl:8084",
+        "httpHeaders": {
+          "Content-Type": "application/json",
+          "Authorization": "Basic YWNtVXNlcjp6YiFYenRHMzQ="
+        },
+        "configurationEntities": [
+          {
+            "configurationEntityId": {
+              "name": "onap.policy.clamp.ac.sink",
+              "version": "1.0.0"
+            },
+            "restSequence": [
+              {
+                "restRequestId": {
+                  "name": "request3",
+                  "version": "1.0.1"
+                },
+                "httpMethod": "POST",
+                "path": "/onap/policy/clamp/acelement/v2/activate",
+                "body": "{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.sink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"SINK\", \"topicParameterGroup\": { \"server\": \"message-router\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }",
+                "expectedResponse": 201
+              }
+            ]
+          }
+        ]
+      }
+    }
+  }
+}
\ No newline at end of file
index 1fa1962..4b24004 100644 (file)
@@ -8,8 +8,8 @@ Resource    ${CURDIR}/common-library.robot
 *** Keywords ***
 ValidateResponseTimeForPap
     [Arguments]  ${uri}  ${method}
-    [Documentation]  Check if uri response is under the 500ms required time for pap metrics
-    ValidateResponseTime  pap-metrics  ${uri}  ${method}  500
+    [Documentation]  Check if uri response is under the 1500ms required time for pap metrics
+    ValidateResponseTime  pap-metrics  ${uri}  ${method}  1500
 
 *** Test Cases ***
 WaitForPrometheusServer
index 3fc4155..29a99eb 100644 (file)
@@ -55,7 +55,11 @@ InstantiateAutomationComposition
      [Documentation]  Instantiate automation composition.
      ${auth}=    Create List    runtimeUser    zb!XztG34
      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
-     ${postjson}=  Get file  ${CURDIR}/data/AutomationComposition.json
+     ${K8sEnabled}=    Convert To Boolean    ${CLAMP_K8S_TEST}
+     Run Keyword If    '${K8sEnabled}'=='True'    set Suite variable  ${instantiationfile}  AcK8s.json
+
+     ...    ELSE    set Suite variable  ${instantiationfile}  AcDocker.json
+     ${postjson}=  Get file  ${CURDIR}/data/${instantiationfile}
      ${updatedpostjson}=   Replace String     ${postjson}     COMPOSITIONIDPLACEHOLDER       ${compositionId}
      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
diff --git a/csit/run-k8s-csit-enable.sh b/csit/run-k8s-csit-enable.sh
deleted file mode 100755 (executable)
index f8c5667..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START====================================================
-#  Copyright (C) 2022-2023 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.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END======================================================
-
-# This script spins up kubernetes cluster in Microk8s for deploying policy helm charts.
-# Runs CSITs in kubernetes.
-
-if [ -z "${WORKSPACE}" ]; then
-    WORKSPACE=$(git rev-parse --show-toplevel)
-    export WORKSPACE
-fi
-
-export GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview)
-
-CSIT_SCRIPT="scripts/run-test.sh"
-ROBOT_DOCKER_IMAGE="policy-csit-robot"
-POLICY_CLAMP_ROBOT="policy-clamp-test.robot"
-POLICY_API_ROBOT="api-test.robot api-slas.robot"
-POLICY_PAP_ROBOT="pap-test.robot pap-slas.robot"
-POLICY_APEX_PDP_ROBOT="apex-pdp-test.robot apex-slas.robot"
-POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot"
-POLICY_DROOLS_PDP_ROBOT="drools-pdp-test.robot"
-POLICY_DISTRIBUTION_ROBOT="distribution-test.robot"
-
-POLICY_API_CONTAINER="policy-api"
-POLICY_PAP_CONTAINER="policy-pap"
-POLICY_CLAMP_CONTAINER="policy-clamp-runtime-acm"
-POLICY_APEX_CONTAINER="policy-apex-pdp"
-POLICY_DROOLS_CONTAINER="policy-drools-pdp"
-POLICY_XACML_CONTAINER="policy-xacml-pdp"
-POLICY_DISTRIBUTION_CONTAINER="policy-distribution"
-POLICY_K8S_PPNT_CONTAINER="policy-clamp-ac-k8s-ppnt"
-POLICY_HTTP_PPNT_CONTAINER="policy-clamp-ac-http-ppnt"
-POLICY_PF_PPNT_CONTAINER="policy-clamp-ac-pf-ppnt"
-SET_VALUES=""
-
-DISTRIBUTION_CSAR=${WORKSPACE}/csit/resources/tests/data/csar
-DIST_TEMP_FOLDER=/tmp/distribution
-
-export PROJECT=""
-export ROBOT_FILE=""
-export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives
-export READINESS_CONTAINERS=()
-
-function spin_microk8s_cluster() {
-    echo "Verify if Microk8s cluster is running.."
-    microk8s version
-    exitcode="${?}"
-
-    if [ "$exitcode" -ne 0 ]; then
-        echo "Microk8s cluster not available, Spinning up the cluster.."
-        sudo snap install microk8s --classic --channel=1.25/stable
-
-        if [ "${?}" -ne 0 ]; then
-            echo "Failed to install kubernetes cluster. Aborting.."
-            return 1
-        fi
-        echo "Microk8s cluster installed successfully"
-        sudo usermod -a -G microk8s $USER
-        echo "Enabling DNS and helm3 plugins"
-        sudo microk8s.enable dns helm3 hostpath-storage
-        echo "Creating configuration file for Microk8s"
-        sudo mkdir -p $HOME/.kube
-        sudo chown -R $USER:$USER $HOME/.kube
-        sudo microk8s kubectl config view --raw >$HOME/.kube/config
-        sudo chmod 600 $HOME/.kube/config
-        echo "K8s installation completed"
-        echo "----------------------------------------"
-    else
-        echo "K8s cluster is already running"
-        echo "----------------------------------------"
-        return 0
-    fi
-
-}
-
-function uninstall_policy() {
-    echo "Removing the policy helm deployment"
-    sudo microk8s helm uninstall csit-policy
-    sudo microk8s helm uninstall prometheus
-    sudo microk8s helm uninstall csit-robot
-    rm -rf ${WORKSPACE}/helm/policy/Chart.lock
-    sudo rm -rf /dockerdata-nfs/mariadb-galera/
-    echo "Policy deployment deleted"
-    echo "Clean up docker"
-    docker image prune -f
-}
-
-function teardown_cluster() {
-    echo "Removing k8s cluster and k8s configuration file"
-    sudo snap remove microk8s;rm -rf $HOME/.kube/config
-    echo "MicroK8s Cluster removed"
-}
-
-function build_robot_image() {
-    echo "Build docker image for robot framework"
-    cd ${WORKSPACE}/csit/resources || exit
-    clone_models
-    if [ "${PROJECT}" == "distribution" ] || [ "${PROJECT}" == "policy-distribution" ]; then
-        copy_csar_file
-    fi
-    echo "Build robot framework docker image"
-    docker login -u docker -p docker nexus3.onap.org:10001
-    docker build . --file Dockerfile \
-        --build-arg CSIT_SCRIPT="$CSIT_SCRIPT" \
-        --build-arg ROBOT_FILE="$ROBOT_FILE" \
-        --tag "${ROBOT_DOCKER_IMAGE}" --no-cache
-    echo "---------------------------------------------"
-}
-
-function start_csit() {
-    build_robot_image
-    if [ "${?}" -eq 0 ]; then
-        echo "Importing robot image into microk8s registry"
-        docker save -o policy-csit-robot.tar ${ROBOT_DOCKER_IMAGE}:latest
-        sudo microk8s ctr image import policy-csit-robot.tar
-        rm -rf ${WORKSPACE}/csit/resources/policy-csit-robot.tar
-        rm -rf ${WORKSPACE}/csit/resources/tests/models/
-        echo "---------------------------------------------"
-        if [ $PROJECT == "clamp" ] || [ $PROJECT == "policy-clamp" ]; then
-          POD_READY_STATUS="0/1"
-          while [[ ${POD_READY_STATUS} != "1/1" ]]; do
-            echo "Waiting for chartmuseum pod to come up..."
-            sleep 5
-            POD_READY_STATUS=$(microk8s kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}')
-          done
-          push_acelement_chart
-        fi
-        echo "Installing Robot framework pod for running CSIT"
-        cd ${WORKSPACE}/helm
-        mkdir -p ${ROBOT_LOG_DIR}
-        sudo microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR
-        print_robot_log
-        teardown_cluster
-    fi
-}
-
-function print_robot_log() {
-    count_pods=0
-    while [[ ${count_pods} -eq 0 ]]; do
-        echo "Waiting for pods to come up..."
-        sleep 5
-        count_pods=$(sudo microk8s kubectl get pods --output name | wc -l)
-    done
-    sudo microk8s kubectl get po
-    robotpod=$(sudo microk8s kubectl get po | grep policy-csit)
-    podName=$(echo "$robotpod" | awk '{print $1}')
-    echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..."
-    sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=10m pod/"$podName"
-    sudo microk8s kubectl logs -f "$podName"
-    echo "Please check the logs of policy-csit-robot pod for the test execution results"
-}
-
-
-function clone_models () {
-    # download models examples
-    git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git "${WORKSPACE}"/csit/resources/tests/models
-
-    # create a couple of variations of the policy definitions
-    sed -e 's!Measurement_vGMUX!ADifferentValue!' \
-        tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.json \
-        >tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.v1_2.json
-
-    sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \
-        -e 's!"policy-version": 1!"policy-version": 2!' \
-        tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.json \
-        >tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.v2.json
-}
-
-function copy_csar_file() {
-    zip -F ${DISTRIBUTION_CSAR}/sample_csar_with_apex_policy.csar \
-        --out ${DISTRIBUTION_CSAR}/csar_temp.csar -q
-    # Remake temp directory
-    sudo rm -rf "${DIST_TEMP_FOLDER}"
-    sudo mkdir "${DIST_TEMP_FOLDER}"
-    sudo cp ${DISTRIBUTION_CSAR}/csar_temp.csar ${DISTRIBUTION_CSAR}/temp.csar
-    sudo mv ${DISTRIBUTION_CSAR}/temp.csar ${DIST_TEMP_FOLDER}/sample_csar_with_apex_policy.csar
-}
-
-
-function set_project_config() {
-    echo "Setting project configuration for: $PROJECT"
-    case $PROJECT in
-
-    clamp | policy-clamp)
-        export ROBOT_FILE=$POLICY_CLAMP_ROBOT
-        export READINESS_CONTAINERS=($POLICY_CLAMP_CONTAINER,$POLICY_APEX_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER,
-            $POLICY_HTTP_PPNT_CONTAINER)
-        export SET_VALUES="--set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_APEX_CONTAINER.enabled=true
-            --set $POLICY_PF_PPNT_CONTAINER.enabled=true --set $POLICY_K8S_PPNT_CONTAINER.enabled=true --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true"
-        ;;
-
-    api | policy-api)
-        export ROBOT_FILE=$POLICY_API_ROBOT
-        export READINESS_CONTAINERS=($POLICY_API_CONTAINER)
-        ;;
-
-    pap | policy-pap)
-        export ROBOT_FILE=$POLICY_PAP_ROBOT
-        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_API_CONTAINER,$POLICY_DROOLS_CONTAINER,
-            $POLICY_XACML_CONTAINER)
-        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_DROOLS_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true"
-        ;;
-
-    apex-pdp | policy-apex-pdp)
-        export ROBOT_FILE=$POLICY_APEX_PDP_ROBOT
-        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER)
-        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true"
-        ;;
-
-    xacml-pdp | policy-xacml-pdp)
-        export ROBOT_FILE=($POLICY_XACML_PDP_ROBOT)
-        export READINESS_CONTAINERS=($POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_XACML_CONTAINER)
-        export SET_VALUES="--set $POLICY_XACML_CONTAINER.enabled=true"
-        ;;
-
-    drools-pdp | policy-drools-pdp)
-        export ROBOT_FILE=($POLICY_DROOLS_PDP_ROBOT)
-        export READINESS_CONTAINERS=($POLICY_DROOLS_CONTAINER)
-        export SET_VALUES="--set $POLICY_DROOLS_CONTAINER.enabled=true"
-        ;;
-
-    distribution | policy-distribution)
-        export ROBOT_FILE=($POLICY_DISTRIBUTION_ROBOT)
-        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,
-            $POLICY_DISTRIBUTION_CONTAINER)
-        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true"
-        ;;
-
-    *)
-        echo "Unknown project supplied. Enabling all policy charts for the deployment"
-        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true
-            --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true --set $POLICY_POLICY_DROOLS_CONTAINER.enabled=true
-            --set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_PF_PPNT_CONTAINER.enabled=true
-            --set $POLICY_K8S_PPNT_CONTAINER.enabled=true --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true"
-        ;;
-    esac
-
-}
-
-function install_chartmuseum () {
-    echo "Installing Chartmuseum helm repository..."
-    sudo microk8s helm repo add chartmuseum-git https://chartmuseum.github.io/charts
-    sudo microk8s helm repo update
-    sudo microk8s helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208
-    sudo microk8s helm plugin install https://github.com/chartmuseum/helm-push
-}
-
-function push_acelement_chart() {
-    echo "Pushing acelement chart to the chartmuseum repo..."
-    sudo microk8s helm repo add policy-chartmuseum http://localhost:30208
-
-    # download clamp repo
-    git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-clamp.git "${WORKSPACE}"/csit/resources/tests/clamp
-    ACELEMENT_CHART=${WORKSPACE}/csit/resources/tests/clamp/examples/src/main/resources/clamp/acm/acelement-helm/acelement
-    sudo microk8s helm cm-push $ACELEMENT_CHART policy-chartmuseum
-    sudo microk8s helm repo update
-    echo "-------------------------------------------"
-}
-
-
-OPERATION="$1"
-PROJECT="$2"
-
-if [ $OPERATION == "install" ];  then
-    spin_microk8s_cluster
-    if [ "${?}" -eq 0 ]; then
-        set_project_config
-        echo "Installing policy helm charts in the default namespace"
-        cd ${WORKSPACE}/helm || exit
-        sudo microk8s helm dependency build policy
-        sudo microk8s helm install csit-policy policy ${SET_VALUES}
-        sudo microk8s helm install prometheus prometheus
-        echo "Policy chart installation completed"
-        echo "-------------------------------------------"
-    fi
-
-    if [ "$PROJECT" ]; then
-        export $PROJECT
-        export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT}
-        get_robot_file
-        echo "CSIT will be invoked from $ROBOT_FILE"
-        echo "Readiness containers: ${READINESS_CONTAINERS[*]}"
-        echo "-------------------------------------------"
-        start_csit
-    else
-        echo "No project supplied for running CSIT"
-    fi
-
-elif [ $OPERATION == "uninstall" ]; then
-    uninstall_policy
-
-elif [ $OPERATION == "clean" ]; then
-    teardown_cluster
-else
-    echo "Invalid arguments provided. Usage: $0 [option..] {install {project} | uninstall} | {clean}"
-fi
index 20f9c1d..496f4dc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # ============LICENSE_START====================================================
-#  Copyright (C) 2023 Nordix Foundation.
+#  Copyright (C) 2022-2023 Nordix Foundation.
 # =============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END======================================================
 
-# This script generates dummy robot result files for jenkins.
+# This script spins up kubernetes cluster in Microk8s for deploying policy helm charts.
+# Runs CSITs in kubernetes.
 
 if [ -z "${WORKSPACE}" ]; then
     WORKSPACE=$(git rev-parse --show-toplevel)
     export WORKSPACE
 fi
 
-export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/$2
-
-mkdir -p $ROBOT_LOG_DIR
-
-echo "CSIT in kubernetes is disabled. Generating dummy results..."
-
-cat >${ROBOT_LOG_DIR}/output.xml <<EOF
-<robot generator="Robot 6.1a1 (Python 3.11.2 on linux)" rpa="false" schemaversion="4">
-<statistics>
-<total>
-<stat pass="1" fail="0" skip="0">All Tests</stat>
-</total>
-<tag>
-</tag>
-<suite>
-<stat pass="1" fail="0" skip="0" id="s1" name="Dummy-Test">Dummy-Test</stat>
-</suite>
-</statistics>
-<errors></errors>
-</robot>
-EOF
-
-cat >${ROBOT_LOG_DIR}/log.html <<EOF
-<!DOCTYPE html>
-<head>
-    <style media="all" type="text/css">
-        /* Generic and misc styles */
-        body {
-            font-family: Helvetica, sans-serif;
-            font-size: 0.8em;
-            color: black;
-            padding: 6px;
-            background: white;
-        }
-        table {
-            table-layout: fixed;
-            word-wrap: break-word;
-            empty-cells: show;
-            font-size: 1em;
-        }
-        th, td {
-            vertical-align: top;
-        }
-        br {
-            mso-data-placement: same-cell; /* maintain line breaks in Excel */
-        }
-        hr {
-            background: #ccc;
-            height: 1px;
-            border: 0;
-        }
-        a, a:link, a:visited {
-            text-decoration: none;
-            color: #15c;
-        }
-        a > img {
-            border: 1px solid #15c !important;
-        }
-        a:hover, a:active {
-            text-decoration: underline;
-            color: #61c;
-        }
-        .parent-name {
-            font-size: 0.7em;
-            letter-spacing: -0.07em;
-        }
-        .message {
-            white-space: pre-wrap;
-        }
-        /* Headers */
-        #header {
-            width: 65em;
-            height: 3em;
-            margin: 6px 0;
-        }
-        h1 {
-            float: left;
-            margin: 0 0 0.5em 0;
-            width: 75%;
-        }
-        h2 {
-            clear: left;
-        }
-        #generated {
-            float: right;
-            text-align: right;
-            font-size: 0.9em;
-            white-space: nowrap;
-        }
-        /* Documentation headers */
-        .doc > h2 {
-            font-size: 1.2em;
-        }
-        .doc > h3 {
-            font-size: 1.1em;
-        }
-        .doc > h4 {
-            font-size: 1.0em;
-        }
-        /* Status text colors -- !important allows using them in links */
-        .fail {
-            color: #ce3e01 !important;
-            font-weight: bold;
-        }
-        .pass {
-            color: #098a09 !important;
-        }
-        .skip {
-            color: #927201 !important;
-            font-weight: bold;
-        }
-        .label {
-            padding: 2px 5px;
-            font-size: 0.75em;
-            letter-spacing: 1px;
-            white-space: nowrap;
-            color: black;
-            background-color: #ddd;
-            border-radius: 3px;
-        }
-        .label.debug, .label.trace, .label.error, .label.keyword {
-            letter-spacing: 0;
-        }
-        .label.pass, .label.fail, .label.error, .label.skip, .label.warn {
-            font-weight: bold;
-        }
-        .label.pass {
-            background-color: #97bd61;
-            color: #000 !important;
-        }
-        .label.fail, .label.error {
-            background-color: #ce3e01;
-            color: #fff !important;
-        }
-        .label.skip, .label.warn {
-            background-color: #fed84f;
-            color: #000 !important;
-        }
-        /* Top right header */
-        #top-right-header {
-            position: fixed;
-            top: 0;
-            right: 0;
-            z-index: 1000;
-            width: 12em;
-            text-align: center;
-        }
-        #report-or-log-link a {
-            display: block;
-            background: black;
-            color: white;
-            text-decoration: none;
-            font-weight: bold;
-            letter-spacing: 0.1em;
-            padding: 0.3em 0;
-            border-bottom-left-radius: 4px;
-        }
-        #report-or-log-link a:hover {
-            color: #ddd;
-        }
-        #log-level-selector {
-            padding: 0.3em 0;
-            font-size: 0.9em;
-            border-bottom-left-radius: 4px;
-            background: #ddd;
-        }
-        /* Statistics table */
-        .statistics {
-            width: 65em;
-            border-collapse: collapse;
-            empty-cells: show;
-            margin-bottom: 1em;
-        }
-        .statistics tr:hover {
-            background: #f4f4f4;
-            cursor: pointer;
-        }
-        .statistics th, .statistics td {
-            border: 1px solid #ccc;
-            padding: 0.1em 0.3em;
-        }
-        .statistics th {
-            background-color: #ddd;
-            padding: 0.2em 0.3em;
-        }
-        .statistics td {
-            vertical-align: middle;
-        }
-        .stats-col-stat {
-            width: 4.5em;
-            text-align: center;
-        }
-        .stats-col-elapsed {
-            width: 5.5em;
-            text-align: center;
-        }
-        .stats-col-graph {
-            width: 9em;
-        }
-        th.stats-col-graph:hover {
-            cursor: default;
-        }
-        .stat-name {
-            float: left;
-        }
-        .stat-name a, .stat-name span {
-            font-weight: bold;
-        }
-        .tag-links {
-            font-size: 0.9em;
-            float: right;
-            margin-top: 0.05em;
-        }
-        .tag-links span {
-            margin-left: 0.2em;
-        }
-        /* Statistics graph */
-        .graph, .empty-graph {
-            border: 1px solid #ccc;
-            width: auto;
-            height: 7px;
-            padding: 0;
-            background: #aaa;
-        }
-        .empty-graph {
-            background: #eee;
-        }
-        .pass-bar, .fail-bar, .skip-bar {
-            float: left;
-            height: 100%;
-        }
-        .fail-bar {
-            background: #ce3e01;
-        }
-        .pass-bar {
-            background: #97bd61;
-        }
-        .skip-bar {
-            background: #fed84f;
-        }
-        /* Tablesorter - adapted from provided Blue Skin */
-        .tablesorter-header {
-            background-image: url(data:image/gif;base64,R0lGODlhCwAJAIAAAH9/fwAAACH5BAEAAAEALAAAAAALAAkAAAIRjAOnBr3cnIr0WUjTrC9e9BQAOw==);
-            background-repeat: no-repeat;
-            background-position: center right;
-            cursor: pointer;
-        }
-        .tablesorter-header:hover {
-            background-color: #ccc;
-        }
-        .tablesorter-headerAsc {
-            background-image: url(data:image/gif;base64,R0lGODlhCwAJAKEAAAAAAH9/fwAAAAAAACH5BAEAAAIALAAAAAALAAkAAAIUlBWnFr3cnIr0WQOyBmvzp13CpxQAOw==);
-            background-color: #ccc !important;
-        }
-        .tablesorter-headerDesc {
-            background-image: url(data:image/gif;base64,R0lGODlhCwAJAKEAAAAAAH9/fwAAAAAAACH5BAEAAAIALAAAAAALAAkAAAIUlAWnBr3cnIr0WROyDmvzp13CpxQAOw==);
-            background-color: #ccc !important;
-        }
-        .sorter-false {
-            background-image: none;
-            cursor: default;
-        }
-        .sorter-false:hover {
-            background-color: #ddd;
-        }
-        </style>
-
-
-</head>
-<body>
-  <div id="statistics-container">
-    <h2>Test Statistics</h2>
-    <table class="statistics tablesorter tablesorter-default tablesorter2e2fe879cc465" id="total-stats" role="grid">
-      <thead>
-        <tr role="row" class="tablesorter-headerRow">
-          <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Total Statistics: No sort applied, activate to apply an ascending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Total Statistics</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Total</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Fail</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Skip</div>
-          </th>
-          <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of these tests. Excludes suite setups and teardowns." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Elapsed</div>
-          </th>
-          <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
-          </th>
-        </tr>
-      </thead>
-      <tbody aria-live="polite" aria-relevant="all">
-        <tr class="row-0" role="row">
-          <td class="stats-col-name">
-            <div class="stat-name">
-              <span>All Tests</span>
-            </div>
-          </td>
-          <td class="stats-col-stat">1</td>
-          <td class="stats-col-stat">1</td>
-          <td class="stats-col-stat">0</td>
-          <td class="stats-col-stat">0</td>
-          <td class="stats-col-elapsed" title="Total execution time of these tests. Excludes suite setups and teardowns.">00:00:00</td>
-          <td class="stats-col-graph">
-            <div class="graph">
-              <div class="pass-bar" style="width: 100%" title="100%"></div>
-              <div class="fail-bar" style="width: 0%" title="0%"></div>
-              <div class="skip-bar" style="width: 0%" title="0%"></div>
-            </div>
-          </td>
-        </tr>
-      </tbody>
-    </table>
-    <table class="statistics tablesorter tablesorter-default tablesorter8e8ffd77a824a" id="tag-stats" role="grid">
-      <thead>
-        <tr role="row" class="tablesorter-headerRow">
-          <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Statistics by Tag: No sort applied, activate to apply an ascending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Statistics by Tag</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Total</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Fail</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Skip</div>
-          </th>
-          <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of these tests. Excludes suite setups and teardowns." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Elapsed</div>
-          </th>
-          <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
-          </th>
-        </tr>
-      </thead>
-      <tbody aria-live="polite" aria-relevant="all">
-        <tr class="row-0" role="row">
-          <td class="stats-col-name">No Tags</td>
-          <td class="stats-col-stat"></td>
-          <td class="stats-col-stat"></td>
-          <td class="stats-col-stat"></td>
-          <td class="stats-col-stat"></td>
-          <td class="stats-col-elapsed" title="Total execution time of these tests. Excludes suite setups and teardowns."></td>
-          <td class="stats-col-graph">
-            <div class="empty-graph"></div>
-          </td>
-        </tr>
-      </tbody>
-    </table>
-    <table class="statistics tablesorter tablesorter-default tablesorter06030fd685e0f" id="suite-stats" role="grid">
-      <thead>
-        <tr role="row" class="tablesorter-headerRow">
-          <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Statistics by Suite: No sort applied, activate to apply an ascending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Statistics by Suite</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Total</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Fail</div>
-          </th>
-          <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Skip</div>
-          </th>
-          <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of this suite." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
-            <div class="tablesorter-header-inner">Elapsed</div>
-          </th>
-          <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
-            <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
-          </th>
-        </tr>
-      </thead>
-      <tbody aria-live="polite" aria-relevant="all">
-        <tr onclick="makeElementVisible('s1')" class="row-0" role="row">
-          <td class="stats-col-name" title="pap">
-            <div class="stat-name">
-              <span href="#s1">
-                <span class="parent-name"></span>Dummy Test</span>
-            </div>
-          </td>
-          <td class="stats-col-stat">1</td>
-          <td class="stats-col-stat">1</td>
-          <td class="stats-col-stat">0</td>
-          <td class="stats-col-stat">0</td>
-          <td class="stats-col-elapsed" title="Total execution time of this suite.">00:00:00</td>
-          <td class="stats-col-graph">
-            <div class="graph">
-              <div class="pass-bar" style="width: 100%" title="100%"></div>
-              <div class="fail-bar" style="width: 0%" title="0%"></div>
-              <div class="skip-bar" style="width: 0%" title="0%"></div>
-            </div>
-          </td>
-        </tr>
-      </tbody>
-    </table>
-  </div>
-</body>
-</html>
-EOF
-
-cp ${ROBOT_LOG_DIR}/log.html ${ROBOT_LOG_DIR}/report.html
+export GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview)
+
+CSIT_SCRIPT="scripts/run-test.sh"
+ROBOT_DOCKER_IMAGE="policy-csit-robot"
+POLICY_CLAMP_ROBOT="policy-clamp-test.robot"
+POLICY_API_ROBOT="api-test.robot api-slas.robot"
+POLICY_PAP_ROBOT="pap-test.robot pap-slas.robot"
+POLICY_APEX_PDP_ROBOT="apex-pdp-test.robot apex-slas.robot"
+POLICY_XACML_PDP_ROBOT="xacml-pdp-test.robot"
+POLICY_DROOLS_PDP_ROBOT="drools-pdp-test.robot"
+POLICY_DISTRIBUTION_ROBOT="distribution-test.robot"
+
+POLICY_API_CONTAINER="policy-api"
+POLICY_PAP_CONTAINER="policy-pap"
+POLICY_CLAMP_CONTAINER="policy-clamp-runtime-acm"
+POLICY_APEX_CONTAINER="policy-apex-pdp"
+POLICY_DROOLS_CONTAINER="policy-drools-pdp"
+POLICY_XACML_CONTAINER="policy-xacml-pdp"
+POLICY_DISTRIBUTION_CONTAINER="policy-distribution"
+POLICY_K8S_PPNT_CONTAINER="policy-clamp-ac-k8s-ppnt"
+POLICY_HTTP_PPNT_CONTAINER="policy-clamp-ac-http-ppnt"
+POLICY_PF_PPNT_CONTAINER="policy-clamp-ac-pf-ppnt"
+SET_VALUES=""
+
+DISTRIBUTION_CSAR=${WORKSPACE}/csit/resources/tests/data/csar
+DIST_TEMP_FOLDER=/tmp/distribution
+
+export PROJECT=""
+export ROBOT_FILE=""
+export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives
+export READINESS_CONTAINERS=()
+
+function spin_microk8s_cluster() {
+    echo "Verify if Microk8s cluster is running.."
+    microk8s version
+    exitcode="${?}"
+
+    if [ "$exitcode" -ne 0 ]; then
+        echo "Microk8s cluster not available, Spinning up the cluster.."
+        sudo snap install microk8s --classic --channel=1.26/stable
+
+        if [ "${?}" -ne 0 ]; then
+            echo "Failed to install kubernetes cluster. Aborting.."
+            return 1
+        fi
+        echo "Microk8s cluster installed successfully"
+        sudo usermod -a -G microk8s $USER
+        echo "Enabling DNS and helm3 plugins"
+        sudo microk8s.enable dns helm3 hostpath-storage
+        echo "Creating configuration file for Microk8s"
+        sudo mkdir -p $HOME/.kube
+        sudo chown -R $USER:$USER $HOME/.kube
+        sudo microk8s kubectl config view --raw >$HOME/.kube/config
+        sudo chmod 600 $HOME/.kube/config
+        echo "K8s installation completed"
+        echo "----------------------------------------"
+    else
+        echo "K8s cluster is already running"
+        echo "----------------------------------------"
+        return 0
+    fi
+
+}
+
+function uninstall_policy() {
+    echo "Removing the policy helm deployment"
+    sudo microk8s helm uninstall csit-policy
+    sudo microk8s helm uninstall prometheus
+    sudo microk8s helm uninstall csit-robot
+    rm -rf ${WORKSPACE}/helm/policy/Chart.lock
+    if [ "$PROJECT" == "clamp" ] || [ "$PROJECT" == "policy-clamp" ]; then
+      sudo microk8s helm uninstall policy-chartmuseum
+      sudo microk8s helm repo remove chartmuseum-git policy-chartmuseum
+    fi
+    sudo rm -rf /dockerdata-nfs/mariadb-galera/
+    sudo microk8s kubectl delete pvc --all
+    echo "Policy deployment deleted"
+    echo "Clean up docker"
+    docker image prune -f
+}
+
+function teardown_cluster() {
+    echo "Removing k8s cluster and k8s configuration file"
+    sudo snap remove microk8s;rm -rf $HOME/.kube/config
+    echo "MicroK8s Cluster removed"
+}
+
+function build_robot_image() {
+    echo "Build docker image for robot framework"
+    cd ${WORKSPACE}/csit/resources || exit
+    clone_models
+    if [ "${PROJECT}" == "distribution" ] || [ "${PROJECT}" == "policy-distribution" ]; then
+        copy_csar_file
+    fi
+    echo "Build robot framework docker image"
+    docker login -u docker -p docker nexus3.onap.org:10001
+    docker build . --file Dockerfile \
+        --build-arg CSIT_SCRIPT="$CSIT_SCRIPT" \
+        --build-arg ROBOT_FILE="$ROBOT_FILE" \
+        --tag "${ROBOT_DOCKER_IMAGE}" --no-cache
+    echo "---------------------------------------------"
+}
+
+function start_csit() {
+    build_robot_image
+    if [ "${?}" -eq 0 ]; then
+        echo "Importing robot image into microk8s registry"
+        docker save -o policy-csit-robot.tar ${ROBOT_DOCKER_IMAGE}:latest
+        sudo microk8s ctr image import policy-csit-robot.tar
+        rm -rf ${WORKSPACE}/csit/resources/policy-csit-robot.tar
+        rm -rf ${WORKSPACE}/csit/resources/tests/models/
+        echo "---------------------------------------------"
+        if [ "$PROJECT" == "clamp" ] || [ "$PROJECT" == "policy-clamp" ]; then
+          POD_READY_STATUS="0/1"
+          while [[ ${POD_READY_STATUS} != "1/1" ]]; do
+            echo "Waiting for chartmuseum pod to come up..."
+            sleep 5
+            POD_READY_STATUS=$(sudo microk8s kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}')
+          done
+          push_acelement_chart
+        fi
+        echo "Installing Robot framework pod for running CSIT"
+        cd ${WORKSPACE}/helm
+        mkdir -p ${ROBOT_LOG_DIR}
+        sudo microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR
+        print_robot_log
+        uninstall_policy
+    fi
+}
+
+function print_robot_log() {
+    count_pods=0
+    while [[ ${count_pods} -eq 0 ]]; do
+        echo "Waiting for pods to come up..."
+        sleep 5
+        count_pods=$(sudo microk8s kubectl get pods --output name | wc -l)
+    done
+    robotpod=$(sudo microk8s kubectl get po | grep policy-csit)
+    podName=$(echo "$robotpod" | awk '{print $1}')
+    echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..."
+    sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=10m pod/"$podName"
+    echo "Policy deployment status:"
+    sudo microk8s kubectl get po
+    sudo microk8s kubectl get all -A
+    echo "Robot Test logs:"
+    sudo microk8s kubectl logs -f "$podName"
+}
+
+function clone_models() {
+
+    # download models examples
+    git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git "${WORKSPACE}"/csit/resources/tests/models
+
+    # create a couple of variations of the policy definitions
+    sed -e 's!Measurement_vGMUX!ADifferentValue!' \
+        tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.json \
+        >tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.v1_2.json
+
+    sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \
+        -e 's!"policy-version": 1!"policy-version": 2!' \
+        tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.json \
+        >tests/models/models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.v2.json
+}
+
+function copy_csar_file() {
+    zip -F ${DISTRIBUTION_CSAR}/sample_csar_with_apex_policy.csar \
+        --out ${DISTRIBUTION_CSAR}/csar_temp.csar -q
+    # Remake temp directory
+    sudo rm -rf "${DIST_TEMP_FOLDER}"
+    sudo mkdir "${DIST_TEMP_FOLDER}"
+    sudo cp ${DISTRIBUTION_CSAR}/csar_temp.csar ${DISTRIBUTION_CSAR}/temp.csar
+    sudo mv ${DISTRIBUTION_CSAR}/temp.csar ${DIST_TEMP_FOLDER}/sample_csar_with_apex_policy.csar
+}
+
+function set_project_config() {
+    echo "Setting project configuration for: $PROJECT"
+    case $PROJECT in
+
+    clamp | policy-clamp)
+        export ROBOT_FILE=$POLICY_CLAMP_ROBOT
+        export READINESS_CONTAINERS=($POLICY_CLAMP_CONTAINER,$POLICY_APEX_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER,
+            $POLICY_HTTP_PPNT_CONTAINER)
+        export SET_VALUES="--set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_APEX_CONTAINER.enabled=true
+            --set $POLICY_PF_PPNT_CONTAINER.enabled=true --set $POLICY_K8S_PPNT_CONTAINER.enabled=true --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true"
+        install_chartmuseum
+        ;;
+
+    api | policy-api)
+        export ROBOT_FILE=$POLICY_API_ROBOT
+        export READINESS_CONTAINERS=($POLICY_API_CONTAINER)
+        ;;
+
+    pap | policy-pap)
+        export ROBOT_FILE=$POLICY_PAP_ROBOT
+        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_API_CONTAINER,$POLICY_XACML_CONTAINER)
+        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true"
+        ;;
+
+    apex-pdp | policy-apex-pdp)
+        export ROBOT_FILE=$POLICY_APEX_PDP_ROBOT
+        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER)
+        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true"
+        ;;
+
+    xacml-pdp | policy-xacml-pdp)
+        export ROBOT_FILE=($POLICY_XACML_PDP_ROBOT)
+        export READINESS_CONTAINERS=($POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_XACML_CONTAINER)
+        export SET_VALUES="--set $POLICY_XACML_CONTAINER.enabled=true"
+        ;;
+
+    drools-pdp | policy-drools-pdp)
+        export ROBOT_FILE=($POLICY_DROOLS_PDP_ROBOT)
+        export READINESS_CONTAINERS=($POLICY_DROOLS_CONTAINER)
+        export SET_VALUES="--set $POLICY_DROOLS_CONTAINER.enabled=true"
+        ;;
+
+    distribution | policy-distribution)
+        export ROBOT_FILE=($POLICY_DISTRIBUTION_ROBOT)
+        export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,
+            $POLICY_DISTRIBUTION_CONTAINER)
+        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true"
+        ;;
+
+    *)
+        echo "Unknown project supplied. Enabling all policy charts for the deployment"
+        export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true
+            --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true --set $POLICY_POLICY_DROOLS_CONTAINER.enabled=true
+            --set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_PF_PPNT_CONTAINER.enabled=true
+            --set $POLICY_K8S_PPNT_CONTAINER.enabled=true --set $POLICY_HTTP_PPNT_CONTAINER.enabled=true"
+        ;;
+    esac
+
+}
+
+function install_chartmuseum () {
+    echo "Installing Chartmuseum helm repository..."
+    sudo microk8s helm repo add chartmuseum-git https://chartmuseum.github.io/charts
+    sudo microk8s helm repo update
+    sudo microk8s helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208
+    sudo microk8s helm plugin install https://github.com/chartmuseum/helm-push
+    echo "---------------------------------------------"
+}
+
+function push_acelement_chart() {
+    echo "Pushing acelement chart to the chartmuseum repo..."
+    sudo microk8s helm repo add policy-chartmuseum http://localhost:30208
+
+    # download clamp repo
+    git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-clamp.git "${WORKSPACE}"/csit/resources/tests/clamp
+    ACELEMENT_CHART=${WORKSPACE}/csit/resources/tests/clamp/examples/src/main/resources/clamp/acm/acelement-helm/acelement
+    sudo microk8s helm cm-push $ACELEMENT_CHART policy-chartmuseum
+    sudo microk8s helm repo update
+    rm -rf ${WORKSPACE}/csit/resources/tests/clamp/
+    echo "-------------------------------------------"
+}
+
+
+OPERATION="$1"
+PROJECT="$2"
+
+if [ $OPERATION == "install" ]; then
+    spin_microk8s_cluster
+    if [ "${?}" -eq 0 ]; then
+        set_project_config
+        echo "Installing policy helm charts in the default namespace"
+        source ${WORKSPACE}/compose/get-k8s-versions.sh
+        cd ${WORKSPACE}/helm || exit
+        sudo microk8s helm dependency build policy
+        sudo microk8s helm install csit-policy policy ${SET_VALUES}
+        sudo microk8s helm install prometheus prometheus
+        echo "Policy chart installation completed"
+        echo "-------------------------------------------"
+    fi
+
+    if [ "$PROJECT" ]; then
+        export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT}
+        echo "CSIT will be invoked from $ROBOT_FILE"
+        echo "Readiness containers: ${READINESS_CONTAINERS[*]}"
+        echo "-------------------------------------------"
+        start_csit
+    else
+        echo "No project supplied for running CSIT"
+    fi
+
+elif [ $OPERATION == "uninstall" ]; then
+    uninstall_policy
+
+elif [ $OPERATION == "clean" ]; then
+    teardown_cluster
+
+else
+    echo "Invalid arguments provided. Usage: $0 [options..] {install {project_name} | uninstall | clean}"
+fi
index c347bef..a606088 100644 (file)
@@ -90,7 +90,7 @@ spec:
             {{- end }}
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.dockerRepository }}/{{ .Values.global.image.mariadb }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
           command:
             - bash
index 8fce880..f0a2138 100644 (file)
@@ -27,7 +27,6 @@ global:
 
 passwordStrengthOverride: basic
 
-image: docker.io/bitnami/mariadb-galera:10.5.8
 ## Specify a imagePullPolicy
 ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
 ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
index 29291af..f8fc4b0 100755 (executable)
@@ -74,7 +74,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.apex }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["sh","-c"]
           args: ["/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /home/apexuser/config/OnapPfConfig.json"]
index 647bf5b..ae6ae1d 100755 (executable)
@@ -29,7 +29,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-apex-pdp:2.9-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index ae8b85f..d89cd5a 100755 (executable)
@@ -49,7 +49,7 @@ spec:
               fieldRef:
                 apiVersion: v1
                 fieldPath: metadata.namespace
-          image: nexus3.onap.org:10001/onap/oom/readiness:3.0.1
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           name: {{ .Chart.Name }}-readiness
         - command:
@@ -88,7 +88,7 @@ spec:
           name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.api }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/api/bin/policy-api.sh"]
           args: ["/opt/app/policy/api/etc/mounted/apiParameters.yaml"]
index c1e654c..15a33e1 100644 (file)
@@ -28,7 +28,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-api:2.8-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index 3b7678b..071339b 100755 (executable)
@@ -81,7 +81,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.a1pmsparticipant }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/a1pms-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/A1pmsParticipantParameters.yaml"]
index 9abca5b..21f4134 100755 (executable)
@@ -20,7 +20,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-ac-a1pms-ppnt:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index f056861..c8aadc8 100644 (file)
@@ -77,7 +77,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.httpparticipant }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/http-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/HttpParticipantParameters.yaml"]
index 9cf80fc..7ad75d0 100644 (file)
@@ -28,7 +28,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-ac-http-ppnt:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # application configuration
index 5872107..2916da4 100644 (file)
@@ -81,7 +81,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.k8sparticipant }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/kubernetes-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/KubernetesParticipantParameters.yaml"]
index d158d2a..84ac7b3 100644 (file)
@@ -20,7 +20,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-ac-k8s-ppnt:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
@@ -90,6 +89,10 @@ repoList:
         repoName: bitnami
         address: https://charts.bitnami.com/bitnami
 
+      -
+        repoName: policy-chartmuseum
+        address: http://policy-chartmuseum:8080
+
     protocols:
       - http
       - https
index 2b02d9a..f9e17cf 100755 (executable)
@@ -81,7 +81,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.kserveparticipant }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/kserve-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/KserveParticipantParameters.yaml"]
index 7bc601b..eb4dfcf 100755 (executable)
@@ -20,7 +20,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-ac-kserve-ppnt:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index 14ba8ae..a321c5b 100644 (file)
@@ -97,7 +97,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.pfparticipant }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/policy-participant.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/PolicyParticipantParameters.yaml"]
index 16bd6ad..59c1388 100644 (file)
@@ -27,7 +27,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-ac-pf-ppnt:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index 14f5bb3..2cd63b3 100644 (file)
@@ -49,7 +49,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: nexus3.onap.org:10001/onap/oom/readiness:3.0.1
+        image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
         imagePullPolicy: {{ .Values.pullPolicy }}
         name: {{ .Chart.Name }}-readiness
       - command:
@@ -100,7 +100,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.runtimeacm }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/clamp/bin/acm-runtime.sh"]
           args: ["/opt/app/policy/clamp/etc/mounted/acRuntimeParameters.yaml"]
index 4c606f0..e312849 100644 (file)
@@ -21,7 +21,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-clamp-runtime-acm:6.4-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
@@ -73,16 +72,16 @@ affinity: {}
 
 # probe configuration parameters
 liveness:
-  initialDelaySeconds: 20
-  periodSeconds: 10
+  initialDelaySeconds: 50
+  periodSeconds: 30
   # necessary to disable liveness probe when setting breakpoints
   # in debugger so K8s doesn't restart unresponsive container
   enabled: true
   port: http-api
 
 readiness:
-  initialDelaySeconds: 20
-  periodSeconds: 10
+  initialDelaySeconds: 50
+  periodSeconds: 30
   port: http-api
 
 service:
index e8b203b..4d8605d 100755 (executable)
@@ -96,7 +96,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.distribution }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/opt/app/policy/distribution/bin/policy-dist.sh"]
           args: ["/opt/app/policy/distribution/etc/mounted/config.json"]
index 63ab801..28f1f26 100644 (file)
@@ -28,7 +28,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-distribution:2.9-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index e2121fa..d68f5aa 100644 (file)
@@ -52,14 +52,14 @@ spec:
                 fieldRef:
                   apiVersion: v1
                   fieldPath: metadata.namespace
-          image: nexus3.onap.org:10001/onap/oom/readiness:3.0.1
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
           imagePullPolicy: Always
           name: {{ .Chart.Name }}-db-readiness
 
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
-          imagePullPolicy: Always
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.pdpdcl }}
+          imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["sh","-c"]
           args: ["/opt/app/policy/bin/pdpd-cl-entrypoint.sh boot"]
           ports:
index 2d7415c..dd2ce0c 100644 (file)
@@ -43,7 +43,6 @@ secrets:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-pdpd-cl:1.12.1
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index fa70f79..84f1197 100644 (file)
@@ -27,8 +27,8 @@ spec:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.simulator }}
+          imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/simulators/bin/simulators.sh"]
           args: ["/opt/app/policy/simulators/etc/mounted/simParameters.json"]
           ports:
index e567a14..367a7d8 100644 (file)
@@ -4,10 +4,7 @@
 
 replicaCount: 1
 
-image:
-  repository: nexus3.onap.org:10001/onap/policy-models-simulator
-  tag: latest
-  pullPolicy: IfNotPresent
+pullPolicy: IfNotPresent
 
 imagePullSecrets: []
 nameOverride: ""
index 6c82fb8..09858de 100755 (executable)
@@ -55,7 +55,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: nexus3.onap.org:10001/onap/oom/readiness:3.0.1
+        image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
         imagePullPolicy: {{ .Values.pullPolicy }}
         name: {{ .Chart.Name }}-readiness
       - command:
@@ -121,7 +121,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.pap }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/pap/bin/policy-pap.sh"]
           args: ["/opt/app/policy/pap/etc/mounted/papParameters.yaml"]
index 85f08c0..be4a4a1 100755 (executable)
@@ -28,7 +28,6 @@ global:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-pap:2.8-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index ec82064..bad2a1f 100755 (executable)
@@ -51,7 +51,7 @@ spec:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: nexus3.onap.org:10001/onap/oom/readiness:3.0.1
+        image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ .Chart.Name }}-readiness
       - command:
@@ -100,7 +100,7 @@ spec:
         name: {{ .Chart.Name }}-update-config
       containers:
         - name: {{ .Chart.Name }}
-          image: {{ .Values.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.xacml }}
           imagePullPolicy: {{ .Values.pullPolicy }}
           command: ["/opt/app/policy/pdpx/bin/policy-pdpx.sh"]
           args: ["/opt/app/policy/pdpx/etc/mounted/config.json"]
index f7bb045..5bf9d09 100644 (file)
@@ -51,7 +51,6 @@ secrets:
 # Application configuration defaults.
 #################################################################
 # application image
-image: nexus3.onap.org:10001/onap/policy-xacml-pdp:2.8-SNAPSHOT-latest
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index beca128..eee143b 100755 (executable)
@@ -33,7 +33,7 @@ spec:
       - name: "default-docker-registry-key"
       initContainers:
       - name: policy-mariadb-readiness
-        image: {{ .Values.repository }}/{{ .Values.readiness.image }}
+        image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         command:
         - /app/ready.py
@@ -47,7 +47,7 @@ spec:
               fieldPath: metadata.namespace
       containers:
       - name: policy-galera-config
-        image: {{ .Values.dockerRepository }}/{{ .Values.mariadb.image }}
+        image: {{ .Values.global.dockerRepository }}/{{ .Values.mariadb.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         volumeMounts:
         - mountPath: /dbcmd-config/db.sh
@@ -113,7 +113,7 @@ spec:
       - name: "default-docker-registry-key"
       initContainers:
         - name: policy-init-readiness
-          image: {{ .Values.repository }}/{{ .Values.readiness.image }}
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command:
           - /app/ready.py
@@ -128,7 +128,7 @@ spec:
                 fieldPath: metadata.namespace
       containers:
       - name: policy-galera-db-migrator
-        image: {{ .Values.repository }}/{{ .Values.dbmigrator.image }}
+        image: {{ .Values.global.repository }}/{{ .Values.dbmigrator.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         volumeMounts:
         - mountPath: /dbcmd-config/db_migrator_policy_init.sh
index 322b1e9..547344a 100755 (executable)
@@ -30,6 +30,26 @@ global:
   kafkaBootstrap: strimzi-kafka-bootstrap
   policyKafkaUser: policy-kafka-user
 
+  repository: nexus3.onap.org:10001
+  pullPolicy: Always
+  dockerRepository: docker.io
+
+  image:
+    readiness: onap/oom/readiness:3.0.1
+    mariadb: bitnami/mariadb-galera:10.5.8
+    api: onap/policy-api:$tag
+    pap: onap/policy-pap:$tag
+    apex: onap/policy-apex-pdp:$tag
+    simulator: onap/policy-models-simulator:$tag
+    pdpdcl: onap/policy-pdpd-cl:$tag
+    xacml: onap/policy-xacml-pdp:$tag
+    distribution: onap/policy-distribution:$tag
+    runtimeacm: onap/policy-clamp-runtime-acm:$tag
+    kserveparticipant: onap/policy-clamp-ac-kserve-ppnt:$tag
+    k8sparticipant: onap/policy-clamp-ac-k8s-ppnt:$tag
+    pfparticipant: onap/policy-clamp-ac-pf-ppnt:$tag
+    httpparticipant: onap/policy-clamp-ac-http-ppnt:$tag
+    a1pmsparticipant: onap/policy-clamp-ac-a1pms-ppnt:$tag
 
 policy-mariadb-galera:
   enabled: true
@@ -64,10 +84,6 @@ policy-clamp-ac-a1pms-ppnt:
 # DB configuration defaults.
 #################################################################
 
-repository: nexus3.onap.org:10001
-pullPolicy: Always
-
-dockerRepository: docker.io
 
 mariadb:
   image: mariadb:10.5.8
@@ -90,46 +106,6 @@ nodeSelector: {}
 
 affinity: {}
 
-# probe configuration parameters
-liveness:
-  initialDelaySeconds: 10
-  periodSeconds: 10
-  # necessary to disable liveness probe when setting breakpoints
-  # in debugger so K8s doesn't restart unresponsive container
-  enabled: true
-
-readiness:
-  image: onap/oom/readiness:3.0.1
-  initialDelaySeconds: 10
-  periodSeconds: 10
-
-
-config:
-  policyAppUserName: runtimeUser
-  useStrimziKafka: true
-  acRuntimeTopic:
-    name: policy-acruntime-participant
-    partitions: 10
-    retentionMs: 7200000
-    segmentBytes: 1073741824
-    consumer:
-      groupId: policy-group
-  policyHeartbeatTopic:
-    name: policy-heartbeat
-    partitions: 10
-    retentionMs: 7200000
-    segmentBytes: 1073741824
-    consumer:
-      groupId: policy-group
-  policyNotificationTopic:
-    name: policy-notification
-    partitions: 10
-    retentionMs: 7200000
-    segmentBytes: 1073741824
-    consumer:
-      groupId: policy-group
-  someConfig: blah
-
 mariadb-galera:
   # mariadb-galera.config and global.mariadb.config must be equals
   db:
@@ -146,12 +122,6 @@ mariadb-galera:
   serviceAccount:
     nameOverride: *mariadb-galera
 
-restServer:
-  policyPapUserName: policyadmin
-  policyPapUserPassword: zb!XztG34
-  policyApiUserName: policyadmin
-  policyApiUserPassword: zb!XztG34
-
 # Resource Limit flavor -By Default using small
 # Segregation for Different environment (small, large, or unlimited)
 flavor: small
index ed1669a..1cdc53e 100644 (file)
@@ -35,6 +35,8 @@ spec:
           - --container-name
           - {{ $container}}
           {{- end }}
+          - --timeout
+          - "15"
           env:
             - name: NAMESPACE
               valueFrom:
@@ -52,7 +54,7 @@ spec:
           volumeMounts:
             - name: robot-csit-pv
               mountPath: /tmp
-      restartPolicy: Never
+      restartPolicy: OnFailure
       volumes:
         - name: robot-csit-pv
           hostPath: