blob: 28369ab65c0210f44a83ac092bb9cc3474bc73b9 [file] [log] [blame]
Jim Hahn8f8a6d82021-04-07 09:32:31 -04001#!/usr/bin/env sh
Pamela Dragosh0e16acf2017-02-14 19:45:48 -05002
Pamela Dragosh0e16acf2017-02-14 19:45:48 -05003# ============LICENSE_START=======================================================
jhh3f563fe2020-03-05 22:32:58 -06004# ONAP
Pamela Dragosh0e16acf2017-02-14 19:45:48 -05005# ================================================================================
Jim Hahn8f8a6d82021-04-07 09:32:31 -04006# Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
Pamela Dragosh0e16acf2017-02-14 19:45:48 -05007# ================================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
Taka Cho8583b512020-11-12 17:48:30 -050011#
Pamela Dragosh0e16acf2017-02-14 19:45:48 -050012# http://www.apache.org/licenses/LICENSE-2.0
Jim Hahn8f8a6d82021-04-07 09:32:31 -040013#
Pamela Dragosh0e16acf2017-02-14 19:45:48 -050014# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END=========================================================
Pamela Dragosh0e16acf2017-02-14 19:45:48 -050020
21source $POLICY_HOME/etc/profile.d/env.sh
22
23json=$1-controller.rest.json
24
Taka Cho8583b512020-11-12 17:48:30 -050025if [ -f "${json}" ]; then
26 if [ -n "${TELEMETRY_PASSWORD}" ]; then
27 curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X POST --data @${json} --header "Content-Type: application/json" \
28 https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers
29 else
30 curl -k --silent -X POST --data @${json} --header "Content-Type: application/json" \
31 https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers
32 fi
Pamela Dragosh0e16acf2017-02-14 19:45:48 -050033else
Taka Cho8583b512020-11-12 17:48:30 -050034 echo "Usage: rest-add-controller.sh closed-loop-sample|reporter|sepc|vsegw|.. (or any other config file ending with *-controller.rest.json)"
Pamela Dragosh0e16acf2017-02-14 19:45:48 -050035fi