Add fail scenarios in csit
[policy/docker.git] / csit / resources / scripts / node-templates.sh
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # Copyright 2023 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 if [ -z "${WORKSPACE}" ]; then
21     WORKSPACE=$(git rev-parse --show-toplevel)
22     export WORKSPACE
23 fi
24
25 GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
26                     "${WORKSPACE}"/.gitreview)
27
28 echo GERRIT_BRANCH="${GERRIT_BRANCH}"
29
30 rm -rf "${WORKSPACE}"/models
31 mkdir "${WORKSPACE}"/models
32
33 # download models examples
34 git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git \
35     "${WORKSPACE}"/models
36
37 export DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
38
39 export NODETEMPLATES=${WORKSPACE}/models/models-examples/src/main/resources/nodetemplates
40
41 # create a couple of variations of the policy definitions
42 sed -e 's!Measurement_vGMUX!ADifferentValue!' \
43         "${DATA}"/vCPE.policy.monitoring.input.tosca.json \
44     >"${DATA}"/vCPE.policy.monitoring.input.tosca.v1_2.json
45
46 sed -e 's!"version": "1.0.0"!"version": "2.0.0"!' \
47         -e 's!"policy-version": 1!"policy-version": 2!' \
48         "${DATA}"/vCPE.policy.monitoring.input.tosca.json \
49     >"${DATA}"/vCPE.policy.monitoring.input.tosca.v2.json