2 ################################################################################
3 # Copyright (c) [2020-2021] [HCL Technologies Ltd.] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 # This script is used to install yang module and load initial configuration
19 #initialize globle variables
21 ROOT_DIR=$CURRENT_DIR/../../
22 CONFIG_PATH=$ROOT_DIR/bin/odu/config/
23 YANG_PATH_3GPP="https://forge.3gpp.org/rep/sa5/MnS/-/raw/0032d2835382c47bc402c077b40ef71d77c9a3c9/yang-models"
25 #list of 3gpp yang models
26 declare -a YANG_MODEL_3GPP=( "_3gpp-common-yang-types.yang"
27 "_3gpp-common-top.yang"
28 "_3gpp-common-measurements.yang"
29 "_3gpp-common-trace.yang"
30 "_3gpp-common-managed-function.yang"
31 "_3gpp-common-subscription-control.yang"
32 "_3gpp-common-fm.yang"
33 "_3gpp-common-managed-element.yang"
34 "_3gpp-5g-common-yang-types.yang"
35 "_3gpp-nr-nrm-rrmpolicy.yang"
36 "_3gpp-nr-nrm-gnbdufunction.yang"
37 "_3gpp-nr-nrm-nrcelldu.yang")
40 #list of ORAN yang models
41 declare -a YANG_MODEL_ORAN=( "o-ran-sc-odu-alarm-v1.yang"
42 "o-ran-sc-du-hello-world.yang"
43 "o-ran-sc-odu-interface-v1.yang")
47 declare -a CONFIGURATION_ARRAY=( "startup_config.xml"
49 "netconf_server_ipv6.xml")
51 #list of modules corresponding to the above config files
52 declare -a MODULE_ARRAY=( "o-ran-sc-odu-interface-v1"
54 "ietf-netconf-server")
57 #check 3GPP yang module if not available then downalod and update
60 #check 3GPP yang modules available
61 for yang in "${YANG_MODEL_3GPP[@]}"
64 if [ ! -f "$ROOT_DIR/build/yang/$yang" ]
66 wget $YANG_PATH_3GPP/$yang -P $ROOT_DIR/build/yang
72 #3GPP yang modules having some warning so fix it.
75 sed -i -e "s/'\.\/tj/'\.\.\/tj/g" $ROOT_DIR/build/yang/_3gpp-common-trace.yang
76 sed -i -e "s/\ \.\/tj/\ \.\.\/tj/g" $ROOT_DIR/build/yang/_3gpp-common-trace.yang
77 sed -i -e 's/"IMMEDIATE_MDT"/"IMMEDIATE_MDT_ONLY"/g' $ROOT_DIR/build/yang/_3gpp-common-trace.yang
78 sed -i -e 's/"TRACE"/"TRACE_ONLY"/g' $ROOT_DIR/build/yang/_3gpp-common-trace.yang
80 echo "updateYang done"
84 #initialize the variable
87 if [ -d "$ROOT_DIR/bin/odu/config" ]
89 CONFIG_PATH=$ROOT_DIR/bin/odu/config/
90 echo "CONFIG_PATH = $CONFIG_PATH"
92 CONFIG_PATH=$ROOT_DIR/build/config/
93 echo "CONFIG_PATH = $CONFIG_PATH"
95 echo "CONFIG_PATH = $CONFIG_PATH"
99 #install 3GPP and ORAN yang modules
102 echo "### install yang modules ###"
103 #install 3GPP yang modules
104 for yang in "${YANG_MODEL_3GPP[@]}"
106 sysrepoctl -i $ROOT_DIR/build/yang/$yang
109 #install ORAN yang modules
110 for yang in "${YANG_MODEL_ORAN[@]}"
112 sysrepoctl -i $ROOT_DIR/build/yang/$yang
116 #load initial configuration
119 echo "### load initial configuration ###"
121 for ((i=0;i<${#CONFIGURATION_ARRAY[@]};i++))
123 sysrepocfg --import=$CONFIG_PATH/${CONFIGURATION_ARRAY[$i]} -v 3 --datastore running --module ${MODULE_ARRAY[$i]}
126 echo "### load initial configuration done ###"
135 ################################################################################
137 ################################################################################