Jim Hahn | 8f8a6d8 | 2021-04-07 09:32:31 -0400 | [diff] [blame^] | 1 | #!/usr/bin/env sh |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 2 | |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 3 | # ============LICENSE_START======================================================= |
jhh | 3f563fe | 2020-03-05 22:32:58 -0600 | [diff] [blame] | 4 | # ONAP |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 5 | # ================================================================================ |
Jim Hahn | 8f8a6d8 | 2021-04-07 09:32:31 -0400 | [diff] [blame^] | 6 | # Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 7 | # ================================================================================ |
| 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 Cho | 8583b51 | 2020-11-12 17:48:30 -0500 | [diff] [blame] | 11 | # |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jim Hahn | 8f8a6d8 | 2021-04-07 09:32:31 -0400 | [diff] [blame^] | 13 | # |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 14 | # 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 Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 20 | |
| 21 | source $POLICY_HOME/etc/profile.d/env.sh |
| 22 | |
| 23 | json=$1-controller.rest.json |
| 24 | |
Taka Cho | 8583b51 | 2020-11-12 17:48:30 -0500 | [diff] [blame] | 25 | if [ -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 Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 33 | else |
Taka Cho | 8583b51 | 2020-11-12 17:48:30 -0500 | [diff] [blame] | 34 | echo "Usage: rest-add-controller.sh closed-loop-sample|reporter|sepc|vsegw|.. (or any other config file ending with *-controller.rest.json)" |
Pamela Dragosh | 0e16acf | 2017-02-14 19:45:48 -0500 | [diff] [blame] | 35 | fi |