3 # Copyright 2023 highstreet technologies GmbH and others
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.
17 # Script which downloads the 3GPP YANG models in preparation for loading them in the O1 Simulator
19 DIRBIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
20 DIR_AVAILABLE_YANGS="$DIRBIN/available-yangs"
21 DIR_YANGS="$DIRBIN/yang"
22 FILE_DOWNLOADZIP="$DIRBIN/yangs.zip"
23 TMPFOLDER="/tmp/o1-yangs"
25 if [ -z "$UNZIP" ]; then
26 echo "unable to find unzip. please install."
31 if [ ! -f "$FILE_DOWNLOADZIP" ]; then
32 wget -O "$FILE_DOWNLOADZIP" "https://forge.3gpp.org/rep/sa5/MnS/-/archive/Rel-18/MnS-Rel-18.zip?path=yang-models"
34 if [ ! -d "$DIR_AVAILABLE_YANGS" ]; then
35 mkdir "$DIR_AVAILABLE_YANGS"
37 # cleanup yang folders
38 rm -rf "$DIR_AVAILABLE_YANGS/"*
40 unzip -uj yangs.zip -d "$TMPFOLDER"
41 cp -r "$TMPFOLDER/"* "$DIR_AVAILABLE_YANGS/"
43 rm "$FILE_DOWNLOADZIP"
46 cp "$DIR_AVAILABLE_YANGS/"_3gpp-common*.yang "$DIR_YANGS"
47 cp "$DIR_AVAILABLE_YANGS/"ietf-*.yang "$DIR_YANGS/"
49 declare special_files=(
50 "_3gpp-5g-common-yang-types.yang"
51 "_3gpp-5gc-nrm-configurable5qiset.yang"
52 "_3gpp-nr-nrm-bwp.yang"
53 "_3gpp-nr-nrm-ep.yang"
54 "_3gpp-nr-nrm-gnbcucpfunction.yang"
55 "_3gpp-nr-nrm-gnbcuupfunction.yang"
56 "_3gpp-nr-nrm-gnbdufunction.yang"
57 "_3gpp-nr-nrm-nrsectorcarrier.yang"
58 "_3gpp-nr-nrm-nrcelldu.yang"
61 for file in "${special_files[@]}"
63 cp "$DIR_AVAILABLE_YANGS/$file" "$DIR_YANGS/"