X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=scripts%2Fappmgrcli;fp=scripts%2Fappmgrcli;h=22f06779fe378f07a7e61c4db07d5418debb6c54;hb=b175b949d5e3a9caf78e2c0c0db225d08bd73b07;hp=ac0048573ebe3aa6548dbc81fc387055e93e419a;hpb=97e8d9a3254989f086d7ad02c168442832b49946;p=ric-plt%2Fappmgr.git diff --git a/scripts/appmgrcli b/scripts/appmgrcli index ac00485..22f0677 100755 --- a/scripts/appmgrcli +++ b/scripts/appmgrcli @@ -125,6 +125,9 @@ case $1 in (health|heal) cmd=health ;; + (config|upload) + cmd=config + ;; (help) usage exit 0 @@ -167,6 +170,7 @@ rest() { if [ "x$3" != "x" ]; then data="--data $3" fi + if curl --silent --show-error --connect-timeout 20 --header "Content-Type: application/json" -X $1 -o $resultfile "http://${host}:${port}$2" $data 2> $errfile ;then status=0 else @@ -188,6 +192,7 @@ base=/ric/v1 base_xapps=$base/xapps base_health=$base/health base_subs=$base/subscriptions +base_config=$base/config do_deploy() { if [ "x$1" != "x" ]; then @@ -333,6 +338,40 @@ do_subscriptions() { esac } +do_config() { + local urlpath + urlpath=$base_config + case $1 in + (get|list) + if [ "x$2" != "x" ]; then + urlpath="$urlpath/$2" + fi + if rest GET $urlpath; then + json_reformat < $resultfile + else + status=1 + fi + ;; + (add|update) + if rest POST $urlpath "@$2" ; then + cat $resultfile + else + status=1 + fi + ;; + (del|delete|remove|rem) + if rest DELETE $urlpath "@$2" ; then + cat $resultfile + else + status=1 + fi + ;; + (*) + echo "$myname: unrecognized config subcommand $1" + status=1 + esac +} + case $cmd in (deploy) do_deploy "$2" @@ -346,6 +385,9 @@ case $cmd in (subscriptions) do_subscriptions "$2" "$3" "$4" "$5" "$6" "$7" ;; + (config) + do_config "$2" "$3" + ;; (health) if rest GET $base_health ; then echo OK