3 # This script is called within the docker-compose to get the public RSA key of the
4 # device(callhome client) and provision the controller.
8 key3="$(cat /etc/ssh/ssh_host_rsa_key.pub)"
12 controller=ODL_SYSTEM_IP
13 echo "Adding key for ${id} to ${controller}"
14 echo "Found host key: ${hostkey}"
17 basicauth="YWRtaW46YWRtaW4="
20 read -r -d '' payload << EOM
24 "ssh-host-key": "${hostkey}",
32 payload=$(echo "${payload}" | tr '\n' ' ' | tr -s " ")
34 url="http://${controller}:${port}/restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices"
36 echo "POST to whitelist"
37 res=$(curl -s -X POST -H "Authorization: Basic ${basicauth}" \
38 -H "Content-Type: application/json" \
39 -H "Cache-Control: no-cache" \
40 -H "Postman-Token: 656d7e0d-2f48-5135-3569-06b2a27a709d" \
44 if [[ $res == *"data-exists"* ]]; then
45 echo "Whitelist already has that entry."