Refactor folder structure.
[sim/o1-interface.git] / ntsimulator / yang / sysrepo-configuration-load.sh
index d9d88df..8c41b40 100755 (executable)
@@ -1,4 +1,20 @@
 #!/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.
+################################################################################
 
 sleep 20
 
@@ -14,7 +30,7 @@ echo "Loading data into sysrepo..."
 #
 #ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts
 
-pyang -f sample-xml-skeleton --sample-xml-list-entries 3 *.yang
+pyang -f sample-xml-skeleton --sample-xml-list-entries 2 *.yang
 
 result=$(netopeer2-cli <<-END
        connect --host 127.0.0.1 --login netconf
@@ -23,8 +39,11 @@ result=$(netopeer2-cli <<-END
 END
 )
 
-while [[ "$result" != "OK" ]]
+count=1
+
+while [[ $count -le 100 ]] && [[ "$result" != "OK" ]]
 do
+  ((count++))
   pyang -f sample-xml-skeleton --sample-xml-list-entries 2 *.yang
   
   result=$(netopeer2-cli <<-END
@@ -34,6 +53,11 @@ do
 END
 )
 done
-echo "Finished loading data into sysrepo..."
+
+echo "Finished loading data into sysrepo. Removing edit-config XML..."
+rm -f /opt/dev/yang/edit_config_operation.xml
+
+echo "Done..."
+
 
 exit 0
\ No newline at end of file