Jorge Hernandez | b61e46a | 2017-06-23 06:33:43 -0500 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| 3 | ### |
| 4 | # ============LICENSE_START======================================================= |
| 5 | # ONAP POLICY |
| 6 | # ================================================================================ |
| 7 | # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. |
| 8 | # ================================================================================ |
| 9 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | # you may not use this file except in compliance with the License. |
| 11 | # You may obtain a copy of the License at |
| 12 | # |
| 13 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | # |
| 15 | # Unless required by applicable law or agreed to in writing, software |
| 16 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | # See the License for the specific language governing permissions and |
| 19 | # limitations under the License. |
| 20 | # ============LICENSE_END========================================================= |
| 21 | ## |
| 22 | |
| 23 | REST_TOOL="http-prompt" |
| 24 | TELEMETRY_SPEC="${POLICY_HOME}/config/telemetry-spec.json" |
| 25 | |
| 26 | if ! type -p "${REST_TOOL}" > /dev/null 2>&1; then |
| 27 | echo "error: prerequisite software not found: http-prompt" |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | if ! "${POLICY_HOME}"/bin/policy-management-controller status > /dev/null 2>&1; then |
| 32 | echo "error: pdp-d is not running" |
| 33 | exit 2 |
| 34 | fi |
| 35 | |
| 36 | if [[ ! -r ${TELEMETRY_SPEC} ]]; then |
| 37 | echo "generating new spec .." |
| 38 | if ! http -a "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" :9696/swagger.json > ${TELEMETRY_SPEC} 2> /dev/null; then |
| 39 | echo "error: cannot generate telemetry spec" |
| 40 | exit 3 |
| 41 | fi |
| 42 | fi |
| 43 | |
| 44 | exec http-prompt http://localhost:9696/policy/pdp/engine --auth "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" --spec ${TELEMETRY_SPEC} |