X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fdeploy%2Ftls%2Fenable_connections.sh;fp=ntsimulator%2Fdeploy%2Ftls%2Fenable_connections.sh;h=ff51e2771079acf39df3297e1841bfbe77ef9ef6;hb=7dbf479029ba8bc528fb61a40ab2647489da28e9;hp=0000000000000000000000000000000000000000;hpb=610985b805c2b5c730bbc247ccbf76dd624792d0;p=sim%2Fo1-interface.git diff --git a/ntsimulator/deploy/tls/enable_connections.sh b/ntsimulator/deploy/tls/enable_connections.sh new file mode 100755 index 0000000..ff51e27 --- /dev/null +++ b/ntsimulator/deploy/tls/enable_connections.sh @@ -0,0 +1,64 @@ +#! /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. + +################################################################################ + +int_re='^[0-9]+$' + +ssh_conn=`jq '.["ssh-connections"]' /opt/dev/scripts/configuration.json` +tls_conn=`jq '.["tls-connections"]' /opt/dev/scripts/configuration.json` + +echo "Enabling $ssh_conn SSH connections and $tls_conn TLS connections in device..." + +# if [ "$#" -ne 2 ]; then +# echo "Usage: $0 NUM_SSH_CONNECTIONS NUM_TLS_CONNECTIONS" >&2 +# exit 1 +# fi + +if ! [[ $ssh_conn =~ $int_re ]] ; then + echo "error: Argument '$ssh_conn' is not a number" >&2 + exit 1 +fi + +if ! [[ $tls_conn =~ $int_re ]] ; then + echo "error: Argument '$tls_conn' is not a number" >&2 + exit 1 +fi + +netconf_port=830 + +echo '' > connections.xml + +for (( ssh_counter=0; ssh_counter<$ssh_conn; ssh_counter++ )) +do + echo "MNG$ssh_counter
::
$netconf_portimported SSH keyssh_host_rsa_key
" >> connections.xml + ((netconf_port++)) +done + +for (( tls_counter=0; tls_counter<$tls_conn; tls_counter++ )) +do + echo "MNGTLS$tls_counter
::
$netconf_portmelacon_server_certtrusted_ca_list102:E9:38:1F:F6:8B:62:DE:0A:0B:C5:03:81:A8:03:49:A0:00:7F:8B:F3x509c2n:specifiednetconf
" >> connections.xml + ((netconf_port++)) +done + +echo '
' >> connections.xml + +sysrepocfg --import=connections.xml --format=xml ietf-netconf-server +rm connections.xml + +echo 'Done' +exit 0 \ No newline at end of file