4 # Set protocol and port based on DISABLE_HTTP
5 if [ "$DISABLE_HTTP" = "true" ]; then
8 param="-i $BE_IP -p $be_port --https"
10 # Set TLS flags if certificates are provided
11 if [ -n "$TLS_CERT" ]; then
12 tls_cert="--tls_cert $TLS_CERT"
14 if [ -n "$TLS_KEY" ]; then
15 tls_key="--tls_key $TLS_KEY"
17 if [ -n "$TLS_KEY_PW" ]; then
18 tls_key_pw="--tls_key_pw $TLS_KEY_PW"
20 if [ -n "$CA_CERT" ]; then
21 ca_cert="--ca_cert $CA_CERT"
25 be_port="$BE_HTTP_PORT"
26 param="-i $BE_IP -p $be_port"
29 # Set basic authentication if enabled
30 if [ "$BASIC_AUTH_ENABLED" = "true" ]; then
31 basic_auth_user="${BASIC_AUTH_USER:-}"
32 basic_auth_pass="${BASIC_AUTH_PASS:-}"
34 if [ -n "$basic_auth_user" ] && [ -n "$basic_auth_pass" ]; then
35 basic_auth_config="--header $(echo -n "$basic_auth_user:$basic_auth_pass" | base64)"
43 # Extract normatives tarball and run the initialization command
44 echo "Extracting normatives.tar.gz and initializing SDC..."
45 cd /var/tmp/ || exit 1
46 cp /home/onap/normatives.tar.gz /var/tmp/
47 tar -xvf /var/tmp/normatives.tar.gz
49 start_time=$(date +"%Y-%m-%d %H:%M:%S")
50 echo "[$start_time] Starting sdcinit..."
52 # Run sdcinit command with the constructed parameters
53 cd /var/tmp/normatives/import/tosca || exit 1
54 sdcinit $param $basic_auth_config $tls_cert $tls_key $tls_key_pw $ca_cert > "/home/onap/logs/init.log" 2>&1
56 end_time=$(date +"%Y-%m-%d %H:%M:%S")
57 echo "[$end_time] Done sdcinit."
59 start_ts=$(date -d "$start_time" +%s)
60 end_ts=$(date -d "$end_time" +%s)
61 elapsed=$((end_ts - start_ts))
62 echo "Elapsed time: $elapsed seconds"
64 echo "SDC initialization Done. Logs can be found at ${ONAP_LOG}/init.log"