diff options
author | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:37:53 -0500 |
---|---|---|
committer | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:40:37 -0500 |
commit | 324ee36fe31763e507b422ab0a88e4230045e205 (patch) | |
tree | d0b04520f6657601c918ce63fd27575977624187 /dgbuilder/tools/update_app_impl_yang.sh | |
parent | f0c97e8db427481e28c0a16b789bc73801b35e47 (diff) |
Initial commit for OpenECOMP SDN-C OA&M
Change-Id: I7ab579fd0d206bf356f36d52dcdf4f71f1fa2680
Signed-off-by: Timoney, Daniel (dt5972) <dtimoney@att.com>
Former-commit-id: 2a9f0edd09581f907e62ec4689b5ac94dd5382ba
Diffstat (limited to 'dgbuilder/tools/update_app_impl_yang.sh')
-rwxr-xr-x | dgbuilder/tools/update_app_impl_yang.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dgbuilder/tools/update_app_impl_yang.sh b/dgbuilder/tools/update_app_impl_yang.sh new file mode 100755 index 00000000..9ae5610b --- /dev/null +++ b/dgbuilder/tools/update_app_impl_yang.sh @@ -0,0 +1,45 @@ +toolsDir=$PROJECT_HOME/tools +appRootDir=$1 +yangFileFullPath=$2 +yangFile=$(basename $yangFileFullPath) + +if [ "$#" != "2" ] +then + echo "Usage: $0 appRootDir yangModuleName example:$0 bwcal bwcal" + exit +fi +cd ${toolsDir}/tmpws +#cp ${toolsDir}/module-provider-impl.yang ${toolsDir}/tmpws + +if [ ! -e "${toolsDir}/module-provider-impl.yang" ] +then + echo "${toolsDir}/module-provider-impl.yang should exist" + exit +fi + +#echo "appRootDir:$appRootDir" +#echo "yangFileFullPath:$yangFileFullPath" +#echo "yangFile:$yangFile" + +cp ${yangFileFullPath} ${appRootDir}/model/src/main/yang/${yangFile} +if [ "$?" != "0" ] +then + echo "Could not copy the yang file. Exiting ..." + exit +fi + +moduleName=$(cat $yangFileFullPath|egrep "module .*{"|cut -d' ' -f2|cut -d'{' -f1) +#echo $moduleName +sed -i.bak s/\$MODULE/$1/g ${toolsDir}/module-provider-impl.yang +cp ${toolsDir}/module-provider-impl.yang ${appRootDir}/provider/src/main/yang/${appRootDir}-provider-impl.yang +cd $appRootDir +mvn clean install >${toolsDir}/tmpws/logs/mvn_install.log 2>&1 +mkdir ${toolsDir}/tmpws/jars +cp ./model/target/${appRootDir}.model-1.0.0-SNAPSHOT.jar ${toolsDir}/tmpws/jars + +mv ${toolsDir}/output_js/${moduleName}_inputs.js ${toolsDir}/output_js/${moduleName}_inputs_prev.js >/dev/null 2>&1 + +${toolsDir}/getRpcsClassFromYang.sh ${yangFileFullPath} ${toolsDir}/tmpws/${appRootDir}/model/target/${appRootDir}.model-1.0.0-SNAPSHOT.jar > ${toolsDir}/output_js/${moduleName}.js + +node ${toolsDir}/dot_to_json.js ${toolsDir}/output_js/${moduleName}.js $moduleName >${toolsDir}/output_js/${moduleName}_inputs.js +cp ${toolsDir}/output_js/${moduleName}_inputs.js $PROJECT_HOME/generatedJS |