X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=descriptor-packages%2Fsrc%2Fgen_nsd_pkg.sh;fp=descriptor-packages%2Fsrc%2Fgen_nsd_pkg.sh;h=07761d2f62abb83db78ce7a916ed33218a77dd92;hb=d21e9d06f4b662d6a7166c4715875fb41cd561ff;hp=0000000000000000000000000000000000000000;hpb=98bac2f1daa9eadcc0a95e73df251483e7522d5d;p=osm%2Fdevops.git diff --git a/descriptor-packages/src/gen_nsd_pkg.sh b/descriptor-packages/src/gen_nsd_pkg.sh new file mode 100755 index 00000000..07761d2f --- /dev/null +++ b/descriptor-packages/src/gen_nsd_pkg.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Copyright 2016 RIFT.IO Inc +# +# 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. +# +# Author(s): Austin Cormier +# Creation Date: 2016/05/23 +# + +# Generates a NSD descriptor package from a source directory +# Usage: +# gen_nsd_pkg.sh + +set -o nounset + +if [ $# -ne 2 ]; then + echo "Error: Must provide 2 parameters" >@2 + exit 1 +fi + +pkg_src_dir="$1" +pkg_dest_dir="$2" + +if [ ! -e ${pkg_src_dir} ]; then + echo "Error: ${pkg_src_dir} does not exist" + exit 1 +fi + +if [ ! -e ${pkg_dest_dir} ]; then + echo "Error: ${pkg_src_dir} does not exist" + exit 1 +fi + +echo "Generating package in directory: ${pkg_dest_dir}" + +# Create any missing directories/files so each package has +# a complete hierachy +nsd_dirs=( ns_config vnf_config icons scripts ) +nsd_files=( README ) + +nsd_dir="${pkg_src_dir}" +echo $(pwd) + +mkdir -p "${pkg_dest_dir}" +cp -rf ${nsd_dir}/* "${pkg_dest_dir}" +for sub_dir in ${nsd_dirs[@]}; do + dir_path=${pkg_dest_dir}/${sub_dir} + mkdir -p ${dir_path} +done + +for file in ${nsd_files[@]}; do + file_path=${pkg_dest_dir}/${file} + touch ${file_path} +done