aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2020-03-12 16:49:42 +0800
committerMarco Platania <platania@research.att.com>2020-03-23 12:39:21 +0000
commitebbd0c313e44fcbc7bd176371f9b33d1ecf5c97c (patch)
treef9993eee4333932a7e15fbfe0d4fe932cc1b97ff /test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
parente0fe449c16bd0781840e1608e72373ac1d2cc18a (diff)
Add script and patch to build CBA file to support PNF SW upgrade
Change-Id: I8b0155a0a6022d7b6d172c1b46d1b7d189fcbe8a Issue-ID: INT-1210 Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Diffstat (limited to 'test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh')
-rwxr-xr-xtest/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
new file mode 100755
index 000000000..76102c3b1
--- /dev/null
+++ b/test/mocks/emssimulator/pnf-sw-upgrade-cba-builder/build-cba-for-pnf-sw-upgrade-with-em.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 Huawei Technologies Co., Ltd. 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=========================================================
+
+set -euo pipefail
+
+readonly SOURCE_CBA="PNF_CDS_RESTCONF"
+readonly TARGET_CBA="PNF_SW_UPGRADE_WITH_EM"
+readonly CDS_CODE_DIR="cds-codes-for-pnf-sw-upgrade"
+
+function use_specific_commit()
+{
+ local commit_id="$1"
+ cd ${CDS_CODE_DIR}
+ local tmp_branch="get-cba-for-pnf-sw-upgrade"
+ if ! git branch | grep -q "${tmp_branch}"; then
+ git checkout -b ${tmp_branch} ${commit_id}
+ else
+ git checkout -q ${tmp_branch}
+ fi
+ cd ${OLDPWD}
+}
+
+if [ ! -e ${CDS_CODE_DIR} ]; then
+ git clone https://gerrit.onap.org/r/ccsdk/cds ${CDS_CODE_DIR}
+else
+ cd ${CDS_CODE_DIR}
+ code_status=`git status -s`
+ if [ -n "${code_status}" ]; then
+ echo "Please keep the CDS codes are not modified."
+ exit 1
+ fi
+ cd ${OLDPWD}
+fi
+
+# Lock the version of source CBA files
+use_specific_commit f4ac359d80d043a2d0e6eaf1730813b81f2c837f
+
+if [ -e ${TARGET_CBA} -o -e ${TARGET_CBA}.zip ]; then
+ echo "${TARGET_CBA} or ${TARGET_CBA}.zip has existed, please rename or delete them."
+ exit 1
+fi
+
+cp -ir ${CDS_CODE_DIR}/components/model-catalog/blueprint-model/uat-blueprints/${SOURCE_CBA} ${TARGET_CBA}
+cp -ir patches ${TARGET_CBA}
+
+cd ${TARGET_CBA}
+
+mv Definitions/PNF_CDS_RESTCONF.json Definitions/PNF_SW_UPGRADE_WITH_EM.json
+mv Templates/pnf-swug-config-template.vtl Templates/pnf-swug-activate-ne-sw-template.vtl
+
+for p in patches/*.patch; do
+ patch -p1 -i $p
+done
+
+rm -rf patches
+
+zip -r ${TARGET_CBA}.zip .
+
+cd ${OLDPWD}
+
+mv -i ${TARGET_CBA}/${TARGET_CBA}.zip .
+