Refactor folder structure.
[sim/o1-interface.git] / ntsimulator / deploy / o-ran-sc / o-ran-ru / sysrepo-configuration-load.sh
diff --git a/ntsimulator/deploy/o-ran-sc/o-ran-ru/sysrepo-configuration-load.sh b/ntsimulator/deploy/o-ran-sc/o-ran-ru/sysrepo-configuration-load.sh
new file mode 100755 (executable)
index 0000000..34a1e79
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+sleep 20
+
+echo "Loading data into sysrepo..."
+
+: ${SYSREPOCFG:=sysrepocfg}
+
+pyang -f sample-xml-skeleton --sample-xml-list-entries 1 *.yang
+
+mapfile -t modelList < <(ls -S -lr *.xml | awk {'print $9'})
+
+if [ ${#modelList[@]} -eq 0 ]; then
+  echo "No modules present, nothing to do..."
+  exit 0
+else
+  for model in ${modelList[@]}
+  do
+    modelName=${model%".xml"}
+
+    echo "Importing data for module: $model"
+    $SYSREPOCFG --import=$model --format=xml $modelName
+    
+  done
+fi
+
+echo "Finished loading data into sysrepo..."
+
+exit 0
\ No newline at end of file