X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fdeploy%2Ftls%2Fenable_netconf_call_home.sh;fp=ntsimulator%2Fdeploy%2Ftls%2Fenable_netconf_call_home.sh;h=5d453ea01949322dfef1bfb29c12f328692f4e42;hb=048a8673d15e0329cd79594028f19ba315ba7140;hp=0000000000000000000000000000000000000000;hpb=7dbf479029ba8bc528fb61a40ab2647489da28e9;p=sim%2Fo1-interface.git diff --git a/ntsimulator/deploy/tls/enable_netconf_call_home.sh b/ntsimulator/deploy/tls/enable_netconf_call_home.sh new file mode 100755 index 0000000..5d453ea --- /dev/null +++ b/ntsimulator/deploy/tls/enable_netconf_call_home.sh @@ -0,0 +1,94 @@ +#! /bin/bash +################################################################################ +# +# Copyright 2020 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 + +netconf_call_home=`jq '.["netconf-call-home"]' /opt/dev/scripts/configuration.json` + + +if [ $netconf_call_home = "false" ] ; then + echo "NETCONF Call Home is disabled, nothing to do..." + exit 0 +else + echo "Enabling NETCONF Call Home in device..." +fi + +controller_ip=`jq '.["controller-details"] ."controller-ip"' /opt/dev/scripts/configuration.json` +controller_username=`jq '.["controller-details"] ."controller-username"' /opt/dev/scripts/configuration.json` +controller_password=`jq '.["controller-details"] ."controller-password"' /opt/dev/scripts/configuration.json` +controller_port=`jq '.["controller-details"] ."controller-port"' /opt/dev/scripts/configuration.json` +netconf_call_home_port=`jq '.["controller-details"] ."netconf-call-home-port"' /opt/dev/scripts/configuration.json` + +SSH_PUB_KEY_MELACON="$(cat /home/netconf/.ssh/melacon.server.key.pub | awk '{print $2}')" + +payload='{ + "odl-netconf-callhome-server:device": [ + { + "odl-netconf-callhome-server:unique-id": "'$HOSTNAME'", + "odl-netconf-callhome-server:ssh-host-key": "'$SSH_PUB_KEY_MELACON'", + "odl-netconf-callhome-server:credentials": { + "odl-netconf-callhome-server:username": "netconf", + "odl-netconf-callhome-server:passwords": [ + "netconf" + ] + } + } + ] +}' + +odl_ip=`sed -e 's/^"//' -e 's/"$//' <<<"$controller_ip"` +odl_username=`sed -e 's/^"//' -e 's/"$//' <<<"$controller_username"` +odl_password=`sed -e 's/^"//' -e 's/"$//' <<<"$controller_password"` + +echo "Payload: $payload" + +curl -v -H 'Content-Type: application/json' -X PUT -u $odl_username:$odl_password \ +-d "$payload" http://$odl_ip:$controller_port/restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices/device/$HOSTNAME + +echo ' + + + test_ssh_ch_client + + + + test_ssh_ch_endpt +
'$odl_ip'
+ '$netconf_call_home_port' +
+
+ + + melacon server key + melacon_server_key + + +
+ + + +
+
+
' > connections.xml + +sysrepocfg --merge=connections.xml --format=xml ietf-netconf-server +rm connections.xml + +echo 'Done' +exit 0 \ No newline at end of file