X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fyang%2Fsysrepo-configuration-load.sh;h=8c41b40c660acfeb7f6113d8f6d46fda84f7c550;hb=1f1479ff8ce3a268acb7b70a32bb789d859a915b;hp=bf8f93b6ee9f94e9822b5efeafa75676e2d86880;hpb=29ce368a8b49cb41f3a1640581ff9958ea50ad8c;p=sim%2Fo1-interface.git diff --git a/ntsimulator/yang/sysrepo-configuration-load.sh b/ntsimulator/yang/sysrepo-configuration-load.sh index bf8f93b..8c41b40 100755 --- a/ntsimulator/yang/sysrepo-configuration-load.sh +++ b/ntsimulator/yang/sysrepo-configuration-load.sh @@ -1,41 +1,63 @@ #!/bin/bash - -sleep 5 +################################################################################ +# +# 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 echo "Loading data into sysrepo..." -SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')" - -echo 'netconfssh_keyssh-dss' >> load_auth_pubkey.xml -echo ''"$SSH_PUB_KEY"'' >> load_auth_pubkey.xml +#SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')" -sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system -rm load_auth_pubkey.xml +#echo 'netconfssh_keyssh-dss' >> load_auth_pubkey.xml +#echo ''"$SSH_PUB_KEY"'' >> load_auth_pubkey.xml -ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts +#sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system +#rm load_auth_pubkey.xml +# +#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 - auth pref publickey 1000 - auth keys add /home/netconf/.ssh/id_dsa.pub /home/netconf/.ssh/id_dsa - connect --login netconf + connect --host 127.0.0.1 --login netconf user-rpc --content=/opt/dev/yang/edit_config_operation.xml disconnect 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 - connect --login netconf + connect --host 127.0.0.1 --login netconf user-rpc --content=edit_config_operation.xml disconnect 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