X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fyang%2Fauto-load-yangs.sh;fp=ntsimulator%2Fyang%2Fauto-load-yangs.sh;h=0000000000000000000000000000000000000000;hb=f1d5c9198acde7a7ce296490087cad37e008f688;hp=fe2a1c1ddb4ef777e42a470b97bf871069e38d41;hpb=f2d8f1002fa93848c80a88e5658db4816cba3020;p=sim%2Fo1-interface.git diff --git a/ntsimulator/yang/auto-load-yangs.sh b/ntsimulator/yang/auto-load-yangs.sh deleted file mode 100755 index fe2a1c1..0000000 --- a/ntsimulator/yang/auto-load-yangs.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash -################################################################################ -# -# Copyright 2019 highstreet technologies GmbH and others -# -# 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. -################################################################################ - -echo "Installing YANG models..." - -set -eu -o pipefail - -shopt -s failglob - -: ${SYSREPOCTL:=sysrepoctl} -: ${SYSREPOCFG:=sysrepocfg} -: ${SYSREPOAPPSTART:=/opt/dev/sysrepo/build/examples/application_example} - -declare -a excludedModules=() - -sleep 5 - -pyang -f clearmust *.yang - -mapfile -t modelList < <(pyang -f depend --depend-recurse *.yang) - -for model in *.yang -do - echo "Removing config false from $model..." - sed -i '/config false;/d' $model - echo "Removing mandatory true from $model..." - sed -i '/mandatory true;/d' $model -done - -if [ ${#modelList[@]} -eq 0 ]; then - echo "No models present, nothing to do..." - exit 0 -else - for model in ${modelList[@]} - do - modelName=${model%".yang"} - - skip_model=false - - for excluded in ${excludedModules[@]}; do - if [ "$excluded" == "$modelName" ]; then - skip_model=true - fi - done - - isSubmoduleOnly=$(pyang -f submodule --submodule-only $model) - - if [ "$isSubmoduleOnly" == "True" ]; then - echo "Skipping installation of model $modelName because it only contains submodules..." - continue - fi - - if [ "$skip_model" = true ]; then - echo "Skipping installation of excluded model $modelName..." - continue - fi - - echo "Installing model: $model" - $SYSREPOCTL --install --yang=$model --owner=root:root --permissions=666 - - mapfile -t featureList < <(pyang -f listfeature $model) - - if [ ${#featureList[@]} -eq 0 ]; then - echo "No features, nothing to do here..." - else - for feature in ${featureList[@]} - do - $SYSREPOCTL --feature-enable=$feature --module=$modelName - done - fi - - #if the YANG model contains only typedefs, we do not need to subscribe for datastore changes - isTypeOnly=$(pyang -f listfeature --is-type-only $model) - - if [ "$isTypeOnly" == "False" ]; then - printf "\n[program:$modelName]\ncommand=/opt/dev/sysrepo/build/examples/application_example $modelName\nautorestart=false\nredirect_stderr=true\nstartretries=1\npriority=4\n" >> /etc/supervisord.conf - fi - - done -fi - -# Fix for the NETCONF notifications -echo "Fixing the NETCONF notifications..." -mkdir -p /var/run/sysrepo-subscriptions/ietf-crypto-types - -echo "YANG models installation done!" - -exit 0 \ No newline at end of file