[DMAAP-BC] Consolidate bus controller repos
[dmaap/buscontroller.git] / dbc-client / misc / dbc-client
index 775f719..461a069 100644 (file)
@@ -25,7 +25,6 @@ umask 0022
 TZ=GMT0
 COMPONENT=dbc-client
 APP_ROOT=${APP_ROOT:-/opt/app/$COMPONENT}
-USER=root
 export TZ
 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
 export PATH
@@ -40,10 +39,10 @@ PEMDIR=${PEMDIR:-/opt/app/osaaf/local}
 CAPEM=${CAPEM:-ca.pem}
 CLIENTPEM=${CLIENTPEM:-client.pem}
 KEYPEM=${KEYPEM:-key.pem}
-CERTPWD=${CERTPWD:-"2U[iOZzMHI:.#tdCwlBqc;}S"}
-
-
-
+CERTPWD=${CERTPWD:-'2U[iOZzMHI:.#tdCwlBqc;}S'}
+AUTH_METHOD=${AUTH_METHOD:-basicAuth}
+BA_IDENTITY=${BA_IDENTITY:-dmaap-bc@dmaap-bc.onap.org}
+BA_PWD=${BA_PWD:-'demo123456!'}
 
 config() {
        echo "ENTER config"
@@ -56,9 +55,14 @@ config() {
        cd $PEMDIR
        pwd
        ls -l
-       if [ -f $CAPEM  -a -f $CLIENTPEM -a -f $KEYPEM ]
+       echo "AUTH_METHOD=$AUTH_METHOD"
+       if [ "$AUTH_METHOD"  =  "basicAuth" ]
+       then
+               echo "-u ${BA_IDENTITY}:${BA_PWD}" > $PEMDIR/curl.cred
+               CURLCRED="-K $PEMDIR/curl.cred"
+       elif [ -f $CAPEM  -a -f $CLIENTPEM -a -f $KEYPEM ]
        then
-               echo "--key $PEMDIR/$KEYPEM --cacert $PEMDIR/$CAPEM --cert $PEMDIR/${CLIENTPEM}:${CERTPWD}" > $PEMDIR/curl.cred
+               printf "key \"$PEMDIR/$KEYPEM\"\ncacert \"$PEMDIR/$CAPEM\"\ncert \"$PEMDIR/${CLIENTPEM}:${CERTPWD}\"" > $PEMDIR/curl.cred
                CURLCRED="-K $PEMDIR/curl.cred"
        else
                echo "Warning: PEM files for authorization not found!"
@@ -106,6 +110,7 @@ init() {
        done
        set +x
 }
+
 dopost() {
        set -x
        RETRY_TIME=60
@@ -129,6 +134,7 @@ dopost() {
        set +x
 
 }
+
 doprov() {
 
        set -x
@@ -148,6 +154,7 @@ doprov() {
        done
        set +x
 }
+
 delay() {
        echo "DELAY=$DELAY"
        if [ ! -z "$DELAY" ]