Add License information in every source file or script.
[sim/o1-interface.git] / ntsimulator / yang / sysrepo-configuration-load.sh
1 #!/bin/bash
2 ################################################################################
3 #
4 # Copyright 2019 highstreet technologies GmbH and others
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9
10 #     http://www.apache.org/licenses/LICENSE-2.0
11
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ################################################################################
18
19 sleep 20
20
21 echo "Loading data into sysrepo..."
22
23 #SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')"
24
25 #echo '<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system"><authentication><user><name>netconf</name><authorized-key><name>ssh_key</name><algorithm>ssh-dss</algorithm>' >> load_auth_pubkey.xml
26 #echo '<key-data>'"$SSH_PUB_KEY"'</key-data></authorized-key></user></authentication></system>' >> load_auth_pubkey.xml
27
28 #sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system
29 #rm load_auth_pubkey.xml
30 #
31 #ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts
32
33 pyang -f sample-xml-skeleton --sample-xml-list-entries 3 *.yang
34
35 result=$(netopeer2-cli <<-END
36         connect --host 127.0.0.1 --login netconf
37         user-rpc --content=/opt/dev/yang/edit_config_operation.xml
38         disconnect
39 END
40 )
41
42 while [[ "$result" != "OK" ]]
43 do
44   pyang -f sample-xml-skeleton --sample-xml-list-entries 2 *.yang
45   
46   result=$(netopeer2-cli <<-END
47         connect --host 127.0.0.1 --login netconf
48         user-rpc --content=edit_config_operation.xml
49         disconnect
50 END
51 )
52 done
53 echo "Finished loading data into sysrepo..."
54
55 exit 0