summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-01-04 14:43:44 -0600
committerJorge Hernandez <jorge.hernandez-herrero@att.com>2019-01-04 14:43:44 -0600
commit777131d706b8379c5fb30f8161902d0388eb96bf (patch)
treecca309d2b46d4772682afdb9fc0c4f0798a86869
parentd803757e8696a4383b57e0ee619687b820225550 (diff)
Add tooling for drools policy developers
This commit adds tooling to better support development activities for drools developers. 1. deploy artifacts to nexus or to local file repository on demand. It also allows to test on a single drools instance without the dependency on a nexus repo. 2. make installation configuration files conform to same convention (all upper case). Change-Id: Ia0a2fc25db2ef21b774a9eee4ed51d4b876a1993 Issue-ID: POLICY-1367 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
-rw-r--r--feature-state-management/src/main/feature/config/feature-state-management.properties10
-rw-r--r--packages/base/src/files/etc/profile.d/env.sh20
-rwxr-xr-xpackages/base/src/files/m2/settings.xml43
-rwxr-xr-xpackages/base/src/files/m2/standalone-settings.xml7
-rw-r--r--packages/docker/src/main/docker/do-start.sh11
-rw-r--r--packages/docker/src/main/docker/docker-install.sh86
-rw-r--r--packages/install/src/files/base.conf63
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/properties/DroolsProperties.java18
-rw-r--r--policy-management/src/main/server-gen/bin/deploy-artifact318
-rw-r--r--policy-management/src/main/server-gen/bin/features161
-rw-r--r--policy-management/src/main/server-gen/bin/policy-management-controller8
-rw-r--r--policy-management/src/main/server-gen/bin/rest-add-controller10
-rw-r--r--policy-management/src/main/server-gen/bin/rest-delete-controller8
-rw-r--r--policy-management/src/main/server-gen/bin/telemetry6
-rw-r--r--policy-management/src/main/server/config/policy-engine.properties6
15 files changed, 634 insertions, 141 deletions
diff --git a/feature-state-management/src/main/feature/config/feature-state-management.properties b/feature-state-management/src/main/feature/config/feature-state-management.properties
index bb3c2f17..9005519c 100644
--- a/feature-state-management/src/main/feature/config/feature-state-management.properties
+++ b/feature-state-management/src/main/feature/config/feature-state-management.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# feature-state-management
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -74,10 +74,10 @@ refresh_state_audit_interval_ms=600000
# Assume it's the releaseRepository that needs to be audited,
# because that's the one BRMGW will publish to.
-repository.audit.id=${{releaseRepositoryID}}
-repository.audit.url=${{releaseRepositoryUrl}}
-repository.audit.username=${{repositoryUsername}}
-repository.audit.password=${{repositoryPassword}}
+repository.audit.id=${{RELEASE_REPOSITORY_ID}}
+repository.audit.url=${{RELEASE_REPOSITORY_URL}}
+repository.audit.username=${{REPOSITORY_USERNAME}}
+repository.audit.password=${{REPOSITORY_PASSWORD}}
# Flag to control the execution of the subsystemTest for the Nexus Maven repository
repository.audit.is.active=false
repository.audit.ignore.errors=true
diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh
index 97076606..833064fe 100644
--- a/packages/base/src/files/etc/profile.d/env.sh
+++ b/packages/base/src/files/etc/profile.d/env.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
###
# ============LICENSE_START=======================================================
# Base Package
@@ -18,15 +19,16 @@
# ============LICENSE_END=========================================================
###
-export POLICY_HOME=${{POLICY_HOME}}
-export POLICY_LOGS=${{POLICY_LOGS}}
-export JAVA_HOME=${{JAVA_HOME}}
-export ENGINE_MANAGEMENT_USER=${{ENGINE_MANAGEMENT_USER}}
-export ENGINE_MANAGEMENT_PASSWORD=${{ENGINE_MANAGEMENT_PASSWORD}}
-export ENGINE_MANAGEMENT_PORT=${{ENGINE_MANAGEMENT_PORT}}
-export ENGINE_MANAGEMENT_HOST=${{ENGINE_MANAGEMENT_HOST}}
+set -a
-for x in $POLICY_HOME/bin $JAVA_HOME/bin $HOME/bin ; do
+POLICY_HOME=${{POLICY_HOME}}
+
+source ${POLICY_HOME}/etc/build.info
+for c in ${POLICY_HOME}/etc/profile.d/*.conf ; do
+ source ${c}
+done
+
+for x in ${POLICY_HOME}/bin ${JAVA_HOME}/bin ${HOME}/bin ; do
if [ -d $x ] ; then
case ":$PATH:" in
*":$x:"*) :;; # already there
@@ -34,3 +36,5 @@ for x in $POLICY_HOME/bin $JAVA_HOME/bin $HOME/bin ; do
esac
fi
done
+
+set +a
diff --git a/packages/base/src/files/m2/settings.xml b/packages/base/src/files/m2/settings.xml
index 4ec22c1e..63ab214d 100755
--- a/packages/base/src/files/m2/settings.xml
+++ b/packages/base/src/files/m2/settings.xml
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
Base Package
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,13 +26,33 @@
<profiles>
+ <profile>
+ <id>policy-local</id>
+
+ <repositories>
+ <repository>
+ <id>file-repository</id>
+ <url>file:${user.home}/.m2/file-repository</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ </profile>
+
<profile>
<id>policy-releases</id>
<repositories>
<repository>
- <id>${{releaseRepositoryID}}</id>
- <url>${{releaseRepositoryUrl}}</url>
+ <id>${env.RELEASE_REPOSITORY_ID}</id>
+ <url>${env.RELEASE_REPOSITORY_URL}</url>
<releases>
<enabled>true</enabled>
</releases>
@@ -49,8 +69,8 @@
<repositories>
<repository>
- <id>${{snapshotRepositoryID}}</id>
- <url>${{snapshotRepositoryUrl}}</url>
+ <id>${env.SNAPSHOT_REPOSITORY_ID}</id>
+ <url>${env.SNAPSHOT_REPOSITORY_URL}</url>
<releases>
<enabled>false</enabled>
</releases>
@@ -126,6 +146,7 @@
</profiles>
<activeProfiles>
+ <activeProfile>policy-local</activeProfile>
<activeProfile>policy-releases</activeProfile>
<activeProfile>policy-snapshots</activeProfile>
<activeProfile>onap-releases</activeProfile>
@@ -135,14 +156,14 @@
<servers>
<server>
- <id>${{snapshotRepositoryID}}</id>
- <username>${{repositoryUsername}}</username>
- <password>${{repositoryPassword}}</password>
+ <id>${env.SNAPSHOT_REPOSITORY_ID}</id>
+ <username>${env.REPOSITORY_USERNAME}</username>
+ <password>${env.REPOSITORY_PASSWORD}</password>
</server>
<server>
- <id>${{releaseRepositoryID}}</id>
- <username>${{repositoryUsername}}</username>
- <password>${{repositoryPassword}}</password>
+ <id>${env.RELEASE_REPOSITORY_ID}</id>
+ <username>${env.REPOSITORY_USERNAME}</username>
+ <password>${env.REPOSITORY_PASSWORD}</password>
</server>
</servers>
diff --git a/packages/base/src/files/m2/standalone-settings.xml b/packages/base/src/files/m2/standalone-settings.xml
index 15e37ca1..63f2f92d 100755
--- a/packages/base/src/files/m2/standalone-settings.xml
+++ b/packages/base/src/files/m2/standalone-settings.xml
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
Base Package
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
<repositories>
<repository>
- <id>${{fileRepoID}}</id>
- <url>${{fileRepoUrl}}</url>
+ <id>file-repository</id>
+ <url>file:${user.home}/.m2/file-repository</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
@@ -86,7 +86,6 @@
</profile>
<profile>
-
<id>onap-snapshots</id>
<repositories>
diff --git a/packages/docker/src/main/docker/do-start.sh b/packages/docker/src/main/docker/do-start.sh
index af7b3d9c..91402e62 100644
--- a/packages/docker/src/main/docker/do-start.sh
+++ b/packages/docker/src/main/docker/do-start.sh
@@ -3,7 +3,7 @@
# ============LICENSE_START=======================================================
#
# ================================================================================
-# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -50,11 +50,18 @@ else
unzip -o ${app}
done
+ feats=$(ls config/feature*.zip 2> /dev/null)
+ for feat in $feats
+ do
+ echo "Feature found: ${feat}"
+ cp ${feat} .
+ done
+
echo "docker install at ${PWD}"
./docker-install.sh
- . /opt/app/policy/etc/profile.d/env.sh
+ . ${POLICY_HOME}/etc/profile.d/env.sh
# allow user to override the key or/and the trust stores
diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh
index 98560202..76f8fb27 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -199,39 +199,39 @@ function configure_settings() {
mkdir -p "${fileRepoUrl#file:}"
# The following parameters are also used outside of this function.
- # if snapshotRepositoryUrl and/or releaseRepositoryUrl is defined,
+ # if SNAPSHOT_REPOSITORY_URL and/or RELEASE_REPOSITORY_URL is defined,
# the corresponding ID and url will be updated below
releaseRepoID=${fileRepoID}
releaseRepoUrl=${fileRepoUrl}
snapshotRepoID=${fileRepoID}
snapshotRepoUrl=${fileRepoUrl}
- # if both snapshotRepositoryUrl and releaseRepositoryUrl are null,
+ # if both SNAPSHOT_REPOSITORY_URL and RELEASE_REPOSITORY_URL are null,
# use standalone-settings.xml that just defines the file-based repo.
# if only one of them is specified, use file-based repo for the other.
- if [[ -z "$snapshotRepositoryUrl" && -z $releaseRepositoryUrl ]]; then
- echo "snapshotRepositoryUrl and releaseRepositoryUrl properties not set, configuring settings.xml for standalone operation"
- mv $HOME_M2/standalone-settings.xml $HOME_M2/settings.xml
+ if [[ -z "${SNAPSHOT_REPOSITORY_URL}" && -z "${RELEASE_REPOSITORY_URL}" ]]; then
+ echo "SNAPSHOT_REPOSITORY_URL and RELEASE_REPOSITORY_URL properties not set, configuring settings.xml for standalone operation"
+ mv ${HOME_M2}/standalone-settings.xml ${HOME_M2}/settings.xml
else
rm $HOME_M2/standalone-settings.xml
- if [[ -n "${snapshotRepositoryUrl}" ]] ; then
- snapshotRepoID=${snapshotRepositoryID}
- snapshotRepoUrl=${snapshotRepositoryUrl}
+ if [[ -n "${SNAPSHOT_REPOSITORY_URL}" ]] ; then
+ snapshotRepoID=${SNAPSHOT_REPOSITORY_ID}
+ snapshotRepoUrl=${SNAPSHOT_REPOSITORY_URL}
fi
- if [[ -n "${releaseRepositoryUrl}" ]] ; then
- releaseRepoID=${releaseRepositoryID}
- releaseRepoUrl=${releaseRepositoryUrl}
+ if [[ -n "${RELEASE_REPOSITORY_URL}" ]] ; then
+ releaseRepoID=${RELEASE_REPOSITORY_ID}
+ releaseRepoUrl=${RELEASE_REPOSITORY_URL}
fi
fi
SED_LINE="sed -i"
- SED_LINE+=" -e 's!\${{snapshotRepositoryID}}!${snapshotRepoID}!g' "
- SED_LINE+=" -e 's!\${{snapshotRepositoryUrl}}!${snapshotRepoUrl}!g' "
- SED_LINE+=" -e 's!\${{releaseRepositoryID}}!${releaseRepoID}!g' "
- SED_LINE+=" -e 's!\${{releaseRepositoryUrl}}!${releaseRepoUrl}!g' "
- SED_LINE+=" -e 's!\${{repositoryUsername}}!${repositoryUsername}!g' "
- SED_LINE+=" -e 's!\${{repositoryPassword}}!${repositoryPassword}!g' "
+ SED_LINE+=" -e 's!\${{SNAPSHOT_REPOSITORY_ID}}!${snapshotRepoID}!g' "
+ SED_LINE+=" -e 's!\${{SNAPSHOT_REPOSITORY_URL}}!${snapshotRepoUrl}!g' "
+ SED_LINE+=" -e 's!\${{RELEASE_REPOSITORY_ID}}!${releaseRepoID}!g' "
+ SED_LINE+=" -e 's!\${{RELEASE_REPOSITORY_URL}}!${releaseRepoUrl}!g' "
+ SED_LINE+=" -e 's!\${{REPOSITORY_USERNAME}}!${REPOSITORY_USERNAME}!g' "
+ SED_LINE+=" -e 's!\${{REPOSITORY_PASSWORD}}!${REPOSITORY_PASSWORD}!g' "
SED_LINE+=" -e 's!\${{fileRepoID}}!${fileRepoID}!g' "
SED_LINE+=" -e 's!\${{fileRepoUrl}}!${fileRepoUrl}!g' "
@@ -364,7 +364,7 @@ function configure_base() {
echo "${PROFILE_LINE}" >> "${HOME}/.profile"
fi
- . "${POLICY_HOME}/etc/profile.d/env.sh"
+ source "${POLICY_HOME}/etc/profile.d/env.sh"
cat "${POLICY_HOME}"/etc/cron.d/* | crontab
}
@@ -445,17 +445,12 @@ function install_base() {
# Undo any changes in the $HOME directory if any
BASH_PROFILE_LINE=". ${POLICY_HOME}/etc/profile.d/env.sh"
-# PROFILE_LINE="ps -p \$\$ | grep -q bash || . ${POLICY_HOME}/etc/profile.d/env.sh"
-
+
# Note: using .bashrc instead of .bash_profile
if [[ -f ${HOME}/.bashrc ]]; then
- /bin/sed -i.bak "\:${BASH_PROFILE_LINE}:d" "${HOME}/.bashrc"
+ /bin/sed -i "\:${BASH_PROFILE_LINE}:d" "${HOME}/.bashrc"
fi
-
-# if [[ -f ${HOME}/.profile ]]; then
-# /bin/sed -i.bak "\:${PROFILE_LINE}:d" "${HOME}/.profile"
-# fi
-
+
tar -C ${POLICY_HOME} -xf ${BASE_TGZ} --no-same-owner
if [[ $? != 0 ]]; then
# this should not happened
@@ -471,14 +466,6 @@ function install_base() {
fi
fi
-# /bin/mkdir -p ${POLICY_HOME}/etc/ssl > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/etc/init.d > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/nagios/tmp > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/tmp > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/var > /dev/null 2>&1
-
-# chmod -R 755 ${POLICY_HOME}/nagios > /dev/null 2>&1
-
if [[ -d $HOME_M2 ]]; then
echo "Renaming existing $HOME_M2 to $HOME/m2.$TIMESTAMP"
mv $HOME_M2 $HOME/m2.$TIMESTAMP
@@ -494,19 +481,16 @@ function install_base() {
exit 1
fi
fi
-
- configure_base
-
+
+ # base.conf properties may have characters with special meaning to bash,
+ # so wrap all the values in quotes in the profile.d version so it can
+ # be sourced into scripts that need the values. Also remove any blanks
+ # that may be present around the = sign.
# save ${BASE_CONF} in PDP-D installation
cp "${BASE_CONF}" "${POLICY_HOME}"/etc/profile.d
-
-# if ! create_keystore; then
-# echo "error: aborting base installation: creating keystore"
-# exit 1
-# fi
-
-# list_unexpanded_files ${POLICY_HOME}
+ sed -i -e "s/ *= */=/" -e "s/=\(.*$\)/='\1'/" ${POLICY_HOME}/etc/profile.d/base.conf
+ configure_base
}
function install_controller()
@@ -868,6 +852,7 @@ function installFeatures
if [[ -r "${featureConf}" ]]; then
configure_component "${featureConf}" "${FEATURES_HOME}"
cp "${featureConf}" "${POLICY_HOME}"/etc/profile.d
+ sed -i -e "s/ *= */=/" -e "s/=\(.*$\)/='\1'/" "${POLICY_HOME}/etc/profile.d/${featureConf}"
echo "feature ${name} has been installed (configuration present)"
else
echo "feature ${name} has been installed (no configuration present)"
@@ -903,15 +888,12 @@ function do_install()
installFeatures
installArtifacts
+ appInstallers=$(ls apps*installer 2> /dev/null)
+ for appInstaller in ${appInstallers}; do
+ echo "Executing application installer ${appInstaller} .."
+ source ${appInstaller}
+ done
- if [[ -f apps-controlloop-installer ]]; then
- # if exists, any customizations to the
- # base drools installation from the drools apps
- # is executed here
-
- ./apps-controlloop-installer
- fi
-
echo
echo "Installation complete"
echo "Please logoff and login again to update shell environment"
diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf
index dd9e7c56..bd5c5e88 100644
--- a/packages/install/src/files/base.conf
+++ b/packages/install/src/files/base.conf
@@ -22,33 +22,37 @@
POLICY_HOME=/opt/app/policy
POLICY_LOGS=/opt/app/policy/logs
-JAVA_HOME=/opt/jdk1.8.0_77
-M2_HOME=/opt/app/policy/3rdparty/apache-maven-3.3.1
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
KEYSTORE_PASSWD=Pol1cy_0nap
TRUSTSTORE_PASSWD=Pol1cy_0nap
# Telemetry credentials
-ENGINE_MANAGEMENT_PORT=9696
-ENGINE_MANAGEMENT_HOST=0.0.0.0
-ENGINE_MANAGEMENT_USER=
-ENGINE_MANAGEMENT_PASSWORD=
+TELEMETRY_PORT=9696
+TELEMETRY_HOST=0.0.0.0
+TELEMETRY_USER=
+TELEMETRY_PASSWORD=
# nexus repository
-# To use a Nexus repository for rules artifacts,
-# following properties must be uncommented and set:
-#repositoryID=policy-nexus
-#repositoryUrl=http://....(URL for the repository goes here)
-#repositoryUsername=(nexus username goes here)
-#repositoryPassword=(password goes here)
+SNAPSHOT_REPOSITORY_ID=
+SNAPSHOT_REPOSITORY_URL=
+RELEASE_REPOSITORY_ID=
+REPOSITORY_USERNAME=
+REPOSITORY_PASSWORD=
-# Relational (SQL) DB access
+# Relational (SQL) DB access
SQL_HOST=
SQL_USER=
SQL_PASSWORD=
+# AAF
+
+AAF=false
+AAF_NAMESPACE=org.onap.policy
+AAF_HOST=aaf-onap-test.osaaf.org
+
# PDP-D DMaaP configuration channel
PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION
@@ -59,11 +63,6 @@ PDPD_CONFIGURATION_CONSUMER_GROUP=
PDPD_CONFIGURATION_CONSUMER_INSTANCE=
PDPD_CONFIGURATION_PARTITION_KEY=
-# AAF
-
-AAF_NAMESPACE=org.onap.policy
-AAF_HOST=aaf-onap-test.osaaf.org
-
# PAP
PAP_HOST=
@@ -75,12 +74,40 @@ PAP_PASSWORD=
PDP_HOST=
PDP_USERNAME=
PDP_PASSWORD=
+PDP_CLIENT_USERNAME=
+PDP_CLIENT_PASSWORD=
+PDP_ENVIRONMENT=
# DCAE DMaaP
DCAE_TOPIC=
DCAE_SERVERS=
+DCAE_CONSUMER_GROUP=
# Open DMaaP
DMAAP_SERVERS=
+
+# AAI
+
+AAI_URL=
+AAI_USERNAME=
+AAI_PASSWORD=
+
+# MSO
+
+SO_URL=
+SO_USERNAME=
+SO_PASSWORD=
+
+# VFC
+
+VFC_URL=
+VFC_USERNAME=
+VFC_PASSWORD=
+
+# SDNC
+
+SDNC_URL=
+SDNC_USERNAME=
+SDNC_PASSWORD=
diff --git a/policy-core/src/main/java/org/onap/policy/drools/properties/DroolsProperties.java b/policy-core/src/main/java/org/onap/policy/drools/properties/DroolsProperties.java
index dad9d946..468f0e3a 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/properties/DroolsProperties.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/properties/DroolsProperties.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-core
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,19 +24,11 @@ public interface DroolsProperties {
/* Controller Properties */
- public static final String PROPERTY_CONTROLLER_NAME = "controller.name";
+ String PROPERTY_CONTROLLER_NAME = "controller.name";
/* Drools Properties */
- public static final String RULES_GROUPID = "rules.groupId";
- public static final String RULES_ARTIFACTID = "rules.artifactId";
- public static final String RULES_VERSION = "rules.version";
-
- /* Management Server Properties */
-
- public static final String ENV_MANAGEMENT_SERVER_PORT = "ENGINE_MANAGEMENT_PORT";
- public static final String ENV_MANAGEMENT_SERVER_HOST = "ENGINE_MANAGEMENT_HOST";
- public static final String ENV_MANAGEMENT_AUTH_USER = "ENGINE_MANAGEMENT_USER";
- public static final String ENV_MANAGEMENT_AUTH_PASSWD = "ENGINE_MANAGEMENT_PASSWORD";
-
+ String RULES_GROUPID = "rules.groupId";
+ String RULES_ARTIFACTID = "rules.artifactId";
+ String RULES_VERSION = "rules.version";
}
diff --git a/policy-management/src/main/server-gen/bin/deploy-artifact b/policy-management/src/main/server-gen/bin/deploy-artifact
new file mode 100644
index 00000000..81f5f14c
--- /dev/null
+++ b/policy-management/src/main/server-gen/bin/deploy-artifact
@@ -0,0 +1,318 @@
+#!/usr/bin/env bash
+
+#
+# ============LICENSE_START=======================================================
+# ONAP
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+##############################################################################
+# Usage: usage
+##############################################################################
+
+function usage() {
+ echo
+ echo -e "syntax: $(basename "$0") "
+ echo -e "\t [-f]"
+ echo -e "\t -a <artifact> "
+ echo
+ echo -e "Options:"
+ echo -e "\t -f|--file-repo: deployment in the file repository"
+ echo -e "\t -a|--artifact: file artifact (jar or pom) to deploy"
+ echo
+ echo
+}
+
+##############################################################################
+# Usage: getPomAttributes <pom-file> <attribute> ...
+#
+# This function performs simplistic parsing of a 'pom.xml' file, extracting
+# the specified attributes (e.g. 'groupId', 'artifactId', 'version'). The
+# attributes are returned as environment variables with the associated name
+##############################################################################
+
+function getPomAttributes
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local file="$1"
+ if [[ ! -f "${file}" ]]; then
+ echo "{1}: file does not exist"
+ return 1
+ fi
+
+ local tab=$'\t' rval=0 attr value
+ shift
+
+ for attr in "$@" ; do
+ # Try to fetch the parameter associated with the 'pom.xml' file.
+ # Initially, the 'parent' element is excluded. If the desired
+ # parameter is not found, the 'parent' element is included in the
+ # second attempt.
+ value=$(sed -n \
+ -e '/<parent>/,/<\/parent>/d' \
+ -e '/<dependencies>/,/<\/dependencies>/d' \
+ -e '/<build>/,/<\/build>/d' \
+ -e '/<profiles>/,/<\/profiles>/d' \
+ -e '/<description>/,/<\/description>/d' \
+ -e '/<packaging>/,/<\/packaging>/d' \
+ -e '/<modelVersion>/,/<\/modelVersion>/d' \
+ -e '/<properties>/,/<\/properties>/d' \
+ -e "/^[ ${tab}]*<${attr}>\([^<]*\)<\/${attr}>.*/{s//\1/p;}" \
+ <"${file}")
+
+ if [[ "${value}" == "" ]]; then
+ # need to check parent for parameter
+ value=$(sed -n \
+ -e '/<dependencies>/,/<\/dependencies>/d' \
+ -e '/<build>/,/<\/build>/d' \
+ -e '/<profiles>/,/<\/profiles>/d' \
+ -e '/<description>/,/<\/description>/d' \
+ -e '/<packaging>/,/<\/packaging>/d' \
+ -e '/<modelVersion>/,/<\/modelVersion>/d' \
+ -e '/<properties>/,/<\/properties>/d' \
+ -e "/^[ ${tab}]*<${attr}>\([^<]*\)<\/${attr}>.*/{s//\1/p;}" \
+ <"${file}")
+
+ if [[ "${value}" == "" ]] ; then
+ echo "${file}: Can't determine ${attr}" >&2
+ rval=1
+ fi
+ fi
+
+ # the following sets an environment variable with the name referred
+ # to by ${attr}
+ read "${attr}" <<<"${value}"
+ done
+ return ${rval}
+}
+
+
+
+##############################################################################
+# Usage: deployJar <jar-file>
+#
+# This function deploys a JAR file in a repository, as well as
+# the 'pom.xml' member it contains.
+#################################################################
+
+function deployJar
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local artifact="${1}"
+ if [[ ! -f "${artifact}" ]]; then
+ echo "{artifact}: does not exist"
+ return 1
+ fi
+
+ local dir=$(mktemp -d)
+ local jar="${artifact##*/}"
+
+ cp -p "${artifact}" "${dir}/${jar}"
+
+ (
+ local rval=0
+ cd "${dir}"
+
+ # determine name of 'pom' file within JAR
+ local pom=$(jar tf "${jar}" META-INF | grep '/pom\.xml$' | head -1)
+ if [[ -z ${pom} ]] ; then
+ echo "${jar}: Can't find 'pom.xml'" >&2
+ return 1
+ fi
+ jar xf "${jar}" "${pom}"
+
+ local pomProperties=$(jar tf "${jar}" META-INF | grep '/pom\.properties$' | head -1)
+ if [[ -n ${pomProperties} ]] ; then
+ # extract pom file
+ jar xf "${jar}" "${pomProperties}"
+ source "${pomProperties}"
+ fi
+
+ if [[ -z ${version} ]]; then
+ if ! getPomAttributes "${pom}" version ; then
+ echo "${pom}: Can't extract 'version' from pom" >&2
+ return 2
+ fi
+ fi
+
+ local repoId repoUrl
+ if [[ "${version}" =~ SNAPSHOT ]] ; then
+ repoId=${SNAPSHOT_REPOSITORY_ID}
+ repoUrl=${SNAPSHOT_REPOSITORY_URL}
+ else
+ repoId=${RELEASE_REPOSITORY_ID}
+ repoUrl=${RELEASE_REPOSITORY_URL}
+ fi
+
+ echo "${artifact}: Deploying JAR artifact to repository ${repoUrl} (${repoId})"
+ mvn deploy:deploy-file \
+ -Dfile="${jar}" \
+ -Dversion="${version}" \
+ -Dpackaging=jar -DgeneratePom=false -DpomFile="${pom}" \
+ -DrepositoryId="${repoId}" -Durl="${repoUrl}" \
+ -DupdateReleaseInfo=true
+
+ retval=${?}
+ rm -rf "${dir}"
+
+ return ${retval}
+ )
+}
+
+##############################################################################
+# Usage: deployPom <pom-file>
+#
+# This function deploys a 'pom.xml' file in the local repository
+##############################################################################
+
+function deployPom
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local file="${1}"
+
+ if [[ -f ${file} ]]; then
+ return 1
+ fi
+
+ # need to extract attributes from POM file
+ if getPomAttributes "${1}" artifactId groupId version ; then
+ local repoId repoUrl
+ if [[ "${version}" =~ SNAPSHOT ]] ; then
+ repoId=${SNAPSHOT_REPOSITORY_ID}
+ repoUrl=${SNAPSHOT_REPOSITORY_URL}
+ else
+ repoId=${RELEASE_REPOSITORY_ID}
+ repoUrl=${RELEASE_REPOSITORY_URL}
+ fi
+
+ echo "${file}: Deploying POM artifact to remote repository"
+ mvn deploy:deploy-file -Dfile="${file}" \
+ -Dpackaging=pom -DgeneratePom=false \
+ -DgroupId="${groupId}" \
+ -DartifactId="${artifactId}" \
+ -Dversion="${version}" \
+ -DrepositoryId="${repoId}" -Durl="${repoUrl}" \
+ -DupdateReleaseInfo=true
+ else
+ echo "${file}: Can't install pom due to missing attributes" >&2
+ return 1
+ fi
+}
+
+##############################################################################
+# Usage: deployArtifact
+#
+# This function deploys a maven artifacts in a repository
+##############################################################################
+
+function deployArtifact
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local file="${1}"
+ if [[ -z "${file}" ]]; then
+ echo "${file}: artifact file not provided"
+ return 1
+ fi
+
+ if [[ ! -f "${file}" ]]; then
+ echo "${file}: artifact file does not exist"
+ return 1
+ fi
+
+ case "${file}" in
+ *pom.xml|*.pom)
+ deployPom "${file}"
+ ;;
+ *.jar)
+ deployJar "${file}"
+ ;;
+ *) echo "${file}: Don't know how to install artifact" >&2
+ return 2
+ ;;
+ esac
+
+ return ${?}
+}
+
+##############################################################################
+# MAIN
+##############################################################################
+
+if [[ ${DEBUG} == y ]]; then
+ echo "-- $0 $* --"
+ set -x
+fi
+
+retval=0
+
+until [[ -z "$1" ]]; do
+ case $1 in
+ -a|--artifact) shift
+ ARTIFACT=$1
+ ;;
+ -f|--file-repo) FILE_REPO_ID="file-repository"
+ FILE_REPO_URL="file:${HOME}/.m2/file-repository"
+ ;;
+ *) usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [[ -z ${ARTIFACT} ]]; then
+ echo "No artifact file provided: $*"
+ usage
+ exit 1
+fi
+
+if [[ -n ${SNAPSHOT_REPOSITORY_URL} ]] && [[ -n ${RELEASE_REPOSITORY_URL} ]]; then
+ deployArtifact "${ARTIFACT}"
+ retval=${?}
+else
+ FILE_REPO_ID="file-repository"
+ FILE_REPO_URL="file:${HOME}/.m2/file-repository"
+fi
+
+if [[ -n ${FILE_REPO_ID} ]]; then
+ SNAPSHOT_REPOSITORY_ID="${FILE_REPO_ID}"
+ SNAPSHOT_REPOSITORY_URL="${FILE_REPO_URL}"
+ RELEASE_REPOSITORY_ID="${FILE_REPO_ID}"
+ RELEASE_REPOSITORY_URL="${FILE_REPO_URL}"
+
+ mkdir -p "${FILE_REPO_URL#file:}" 2> /dev/null
+ deployArtifact "${ARTIFACT}"
+ retval=${?}
+fi
+
+exit ${retval}
diff --git a/policy-management/src/main/server-gen/bin/features b/policy-management/src/main/server-gen/bin/features
index 13621aa4..676ce38d 100644
--- a/policy-management/src/main/server-gen/bin/features
+++ b/policy-management/src/main/server-gen/bin/features
@@ -1,10 +1,10 @@
-#! /bin/bash
+#!/usr/bin/env bash
###
# ============LICENSE_START=======================================================
# ONAP POLICY
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,6 +28,8 @@
# L─ <feature-name>*/
#     L─ [config]/
#     |   L─ <config-file>+
+#     L─ [bin]/
+#     |   L─ <bin-file>+
#     L─ lib/
#     |  L─ [dependencies]/
#     |  | L─ <dependent-jar>+
@@ -37,6 +39,8 @@
#     │   L─ <db-name>/+
#     │  L─ sql/
#     │ L─ <sql-scripts>*
+#     L─ [artifacts]/
+#      L─ <artifact>+
#     L─ [install]
#      L─ [enable]
#      L─ [disable]
@@ -49,6 +53,8 @@
# [config]/<config-file> preferable named with "feature-<feature-name>" prefix to
# precisely match it against the exact features, source code, and
# associated wiki page for configuration details.
+# [bin] feature bin directory that contains helper scripts for this feature
+# [bin]/<executable-file> preferable named with "feature-<feature-name>" prefix.
# lib jar libraries needed by this features
# lib/[dependencies] 3rd party jar dependencies not provided by base installation
# of pdp-d that are necessary for <feature-name> to operate
@@ -64,6 +70,9 @@
# [db]/<db-name>/sql/<sql-scripts> for this feature sql scripts
# upgrade scripts should be suffixed with ".upgrade.sql"
# downgrade scripts should be suffixed with ".downgrade.sql"
+# [artifacts] maven artifacts to be deployed in a maven repository.
+# [artifacts]/<artifact> maven artifact with identifiable maven coordinates embedded
+# in the artifact.
# [install] custom installation directory where custom enable or disable scripts
# and other free form data is included to be used for the enable and
# and disable scripts.
@@ -78,8 +87,10 @@
# Operations:
# install: installs a feature
# uninstall: uninstalls a feature
-# enable : enables 1) dependencies, 2) configuration, 3) database, 4) feature, 5) customization
-# disable: disables 1) dependencies, 2) configuration, 3) database, 4) feature, 6) customization
+# enable : enables 1) dependencies, 2) configuration, 3) binaries 4) database, 5) artifacts,
+# 6) feature, 7) customization.
+# disable: disables 1) dependencies, 2) configuration, 3) binaries, 4) database, 5) feature,
+# 6) customization
# status : status of a feature
#
# 'enable' operation details:
@@ -87,9 +98,11 @@
# 1. sets the symbolic link to the actual feature jar in pdp-d classpath ($POLICY_HOME/lib)
# 2. sets symbolic links to feature dependencies in pdp-d classpath ($POLICY_HOME/lib)
# 3. sets symbolic links to feature configuration in pdp-d configuration directory ($POLICY_HOME/config)
-# 4. sets symbolic links to feature upgrade scripts and removes links to downgrade scripts (if any)
+# 4. sets symbolic links to feature executables in pdp-d bin directory ($POLICY_HOME/bin)
+# 5. sets symbolic links to feature upgrade scripts and removes links to downgrade scripts (if any)
# in the pdp-d migration directory ($POLICY_HOME/etc/db/migration).
-# 5. cd to the feature 'install' directory an executes (if exists) the 'enable' script to allow for specific
+# 6. deploys any maven artifacts in the maven repositories in use (if any)
+# 7. cd to the feature 'install' directory an executes (if exists) the 'enable' script to allow for specific
# customizations for this feature.
#
# 'disable' operation details:
@@ -97,15 +110,16 @@
# 1. removes the symbolic link to the actual feature jar in pdp-d classpath ($POLICY_HOME/lib)
# 2. removes symbolic links to feature dependencies in pdp-d classpath ($POLICY_HOME/lib)
# 3. removes symbolic links to feature configuration in pdp-d configuration directory ($POLICY_HOME/config)
-# 4. removes symbolic links to feature upgrade scripts and sets links to downgrade scripts (if any)
+# 4. removes symbolic links to feature executables in pdp-d bin directory ($POLICY_HOME/bin)
+# 5. removes symbolic links to feature upgrade scripts and sets links to downgrade scripts (if any)
# in the pdp-d migration directory ($POLICY_HOME/etc/db/migration).
-# 5. cd to the feature 'install' directory an executes (if exists) the 'disable' script to allow for specific
+# 6. cd to the feature 'install' directory an executes (if exists) the 'disable' script to allow for specific
# customizations for this feature.
#
# Notes for DB enabled features:
# A. Upgrade/Downgrade SQL File Name Format:
# <VERSION>-<pdp|feature-name>[-description](.upgrade|.downgrade).sql
-# B. See related tooling: db-migrator and policy
+# B. See related tooling: db-migrator, deploy-artifact, and policy
#
# Example:
#
@@ -140,6 +154,7 @@ fi
LIB=${POLICY_HOME}/lib
CONFIG=${POLICY_HOME}/config
+BIN=${POLICY_HOME}/bin
DB=${POLICY_HOME}/etc/db/migration
FEATURES=${POLICY_HOME}/features
PROFILED=${POLICY_HOME}/etc/profile.d
@@ -166,7 +181,9 @@ fi
FEATURE_DEPS="lib/dependencies"
FEATURE_LIB="lib/feature"
FEATURE_CONFIG="config"
+FEATURE_BIN="bin"
FEATURE_INSTALL="install"
+FEATURE_ARTIFACTS="artifacts"
FEATURE_DB="db"
FEATURE_SQL="sql"
@@ -340,6 +357,36 @@ function enableConfigAnalysis ()
}
# ##########################################################
+# enableBinAnalysis (featureName):
+# reports on potential dependency conflicts
+# featureName: name of the feature
+# ##########################################################
+function enableBinAnalysis ()
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local featureName="$1"
+ local featureBins binPath binFileName
+
+ if [[ -z ${featureName} ]]; then
+ echo "warning: no feature name"
+ return 1
+ fi
+
+ featureBins=$(ls "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ 2> /dev/null)
+ for binPath in ${featureBins}; do
+ binFileName=$(basename "${binPath}")
+ if [[ -e "${CONFIG}"/"${binFileName}" ]]; then
+ echo "error: a bin file of the same name is already in the base installation: ${binFileName}"
+ return 2
+ fi
+ done
+}
+
+# ##########################################################
# enableDbAnalysis (featureName):
# reports on potential db access problems
# featureName: name of the feature
@@ -443,6 +490,33 @@ function enableFeatureConfig()
}
# ##########################################################
+# enableFeatureBin(featureName):
+# enables feature binaries
+# featureName: name of the feature
+# ##########################################################
+function enableFeatureBin()
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local featureName="$1"
+ local featureBins featureBinPath
+
+ if [[ -z ${featureName} ]]; then
+ echo "warning: no feature name"
+ return 1
+ fi
+
+ featureBins=$(find "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ -type f -maxdepth 1 2> /dev/null)
+ for featureBinPath in ${featureBins}; do
+ chmod u+x "${featureBinPath}"
+ ln -s -f "${featureBinPath}" "${BIN}/"
+ done
+}
+
+# ##########################################################
# enableFeatureDbSchema(featureName):
# enables feature DB Schema configuration
# featureName: name of the feature
@@ -533,6 +607,32 @@ function enableFeatureDb()
}
# ##########################################################
+# enableFeatureArtifacts(featureName):
+# deploys maven artifacts
+# featureName: name of the feature
+# ##########################################################
+function enableFeatureArtifacts()
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local featureName="$1"
+ local artifacts
+
+ if [[ -z ${featureName} ]]; then
+ echo "warning: no feature name"
+ return 1
+ fi
+
+ artifacts=$(ls "${FEATURES}"/"${featureName}"/"${FEATURE_ARTIFACTS}"/* 2> /dev/null)
+ for artifactPath in ${artifacts}; do
+ deploy-artifact -f -a ${artifactPath}
+ done
+}
+
+# ##########################################################
# customize(featureName):
# executes customized script for an operation.
#
@@ -603,6 +703,10 @@ function enableFeature()
return "$?"
fi
+ if ! enableBinAnalysis "${featureName}"; then
+ return "$?"
+ fi
+
if ! enableDbAnalysis "${featureName}"; then
return "$?"
fi
@@ -619,10 +723,18 @@ function enableFeature()
enableFeatureConfig "${featureName}"
+ # enable binaries
+
+ enableFeatureBin "${featureName}"
+
# enable db
enableFeatureDb "${featureName}"
+ # enable feature artifacts
+
+ enableFeatureArtifacts "${featureName}"
+
# run custom enable if any
customOpScript "${featureName}" "enable"
@@ -722,6 +834,33 @@ function disableFeatureConfig()
}
# ##########################################################
+# disableFeatureBin(featureName):
+# disables feature binaries
+# featureName: name of the feature
+# ##########################################################
+function disableFeatureBin()
+{
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} $* --"
+ set -x
+ fi
+
+ local featureName="$1"
+ local featureBins featureBinPath
+
+ if [[ -z ${featureName} ]]; then
+ echo "warning: no feature name"
+ return 1
+ fi
+
+ featureBins=$(find "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ -type f -maxdepth 1 2> /dev/null)
+ for featureBinPath in ${featureBins}; do
+ binFileName=$(basename "${featureBinPath}")
+ rm -f "${BIN}"/"${binFileName}" 2> /dev/null
+ done
+}
+
+# ##########################################################
# disableFeatureDbSchema(featureName, featureDbPath, schemaName):
# disables feature db configuration for a schema
# featureName: name of the feature
@@ -846,6 +985,10 @@ function disableFeature()
disableFeatureConfig "${featureName}"
+ # disable binaries if any
+
+ disableFeatureBin "${featureName}"
+
# disable DB SQL scripts if any
disableFeatureDb "${featureName}"
diff --git a/policy-management/src/main/server-gen/bin/policy-management-controller b/policy-management/src/main/server-gen/bin/policy-management-controller
index bad1783f..51d83d6a 100644
--- a/policy-management/src/main/server-gen/bin/policy-management-controller
+++ b/policy-management/src/main/server-gen/bin/policy-management-controller
@@ -66,7 +66,7 @@ function um_start() {
# to subprocesses
exec {cfg}>&-
fi
- nohup $JAVA_HOME/bin/java -Dkie.maven.settings.custom=$_DIR/config/kie_settings.xml -Dlog4j.configuration=file:$_DIR/config/log4j.properties -cp $_DIR/config:$_DIR/lib:$CP "${systemProperties[@]}" "$@" $CLASS > >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.out) 2> >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.err) &
+ nohup $JAVA_HOME/bin/java -cp $_DIR/config:$_DIR/lib:$CP "${systemProperties[@]}" "$@" $CLASS > >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.out) 2> >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.err) &
_PID=$!
echo $_PID > $_PIDFILE
@@ -95,10 +95,10 @@ function um_stop() {
echo $_STATUS
remove_pid_file
else
- if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then
- http_proxy= curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X DELETE https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine -o /dev/null
+ if [[ -n ${TELEMETRY_PASSWORD} ]]; then
+ http_proxy= timeout 30 curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X DELETE https://localhost:${TELEMETRY_PORT}/policy/pdp/engine -o /dev/null
else
- http_proxy= curl -k --silent -X DELETE https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine -o /dev/null
+ http_proxy= timeout 30 curl -k --silent -X DELETE https://localhost:${TELEMETRY_PORT}/policy/pdp/engine -o /dev/null
fi
sleep 5
echo "Stopping $SNAME..."
diff --git a/policy-management/src/main/server-gen/bin/rest-add-controller b/policy-management/src/main/server-gen/bin/rest-add-controller
index 0dd82eec..98b5702b 100644
--- a/policy-management/src/main/server-gen/bin/rest-add-controller
+++ b/policy-management/src/main/server-gen/bin/rest-add-controller
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# policy-management
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,12 +25,12 @@ source $POLICY_HOME/etc/profile.d/env.sh
json=$1-controller.rest.json
if [ -f ${json} ]; then
- if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then
- curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X POST --data @${json} --header "Content-Type: application/json" \
- https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers
+ if [[ -n ${TELEMETRY_PASSWORD} ]]; then
+ curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X POST --data @${json} --header "Content-Type: application/json" \
+ https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers
else
curl -k --silent -X POST --data @${json} --header "Content-Type: application/json" \
- https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers
+ https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers
fi
else
echo "Usage: rest-add-controller.sh closed-loop-sample|reporter|sepc|vsegw|.. (or any other config file ending with *-controller.rest.json)"
diff --git a/policy-management/src/main/server-gen/bin/rest-delete-controller b/policy-management/src/main/server-gen/bin/rest-delete-controller
index 03e67483..7a47c928 100644
--- a/policy-management/src/main/server-gen/bin/rest-delete-controller
+++ b/policy-management/src/main/server-gen/bin/rest-delete-controller
@@ -23,12 +23,12 @@
source $POLICY_HOME/etc/profile.d/env.sh
if [[ -n $1 ]]; then
- if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then
- curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X DELETE --header "Content-Type: application/json" \
- https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers/${1}
+ if [[ -n ${TELEMETRY_PASSWORD} ]]; then
+ curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X DELETE --header "Content-Type: application/json" \
+ https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers/${1}
else
curl -k --silent -X DELETE --header "Content-Type: application/json" \
- https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers/${1}
+ https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers/${1}
fi
echo
exit
diff --git a/policy-management/src/main/server-gen/bin/telemetry b/policy-management/src/main/server-gen/bin/telemetry
index 7058d64c..37614b08 100644
--- a/policy-management/src/main/server-gen/bin/telemetry
+++ b/policy-management/src/main/server-gen/bin/telemetry
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# ONAP POLICY
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,10 +35,10 @@ fi
if [[ ! -r ${TELEMETRY_SPEC} ]]; then
echo "generating new spec .."
- if ! http --verify=no -a "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" https://localhost:9696/swagger.json > ${TELEMETRY_SPEC} 2> /dev/null; then
+ if ! http --verify=no -a "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" https://localhost:9696/swagger.json > ${TELEMETRY_SPEC} 2> /dev/null; then
echo "error: cannot generate telemetry spec"
exit 3
fi
fi
-exec http-prompt https://localhost:9696/policy/pdp/engine --verify=no --auth "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" --spec ${TELEMETRY_SPEC}
+exec http-prompt https://localhost:9696/policy/pdp/engine --verify=no --auth "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" --spec ${TELEMETRY_SPEC}
diff --git a/policy-management/src/main/server/config/policy-engine.properties b/policy-management/src/main/server/config/policy-engine.properties
index 81b7db78..c2e8aa10 100644
--- a/policy-management/src/main/server/config/policy-engine.properties
+++ b/policy-management/src/main/server/config/policy-engine.properties
@@ -41,10 +41,10 @@ dmaap.sink.topics.${{PDPD_CONFIGURATION_TOPIC}}.https=true
http.server.services=SECURED-CONFIG
-http.server.services.SECURED-CONFIG.host=${{ENGINE_MANAGEMENT_HOST}}
+http.server.services.SECURED-CONFIG.host=${{TELEMETRY_HOST}}
http.server.services.SECURED-CONFIG.port=9696
-http.server.services.SECURED-CONFIG.userName=${{ENGINE_MANAGEMENT_USER}}
-http.server.services.SECURED-CONFIG.password=${{ENGINE_MANAGEMENT_PASSWORD}}
+http.server.services.SECURED-CONFIG.userName=${{TELEMETRY_USER}}
+http.server.services.SECURED-CONFIG.password=${{TELEMETRY_PASSWORD}}
http.server.services.SECURED-CONFIG.restPackages=org.onap.policy.drools.server.restful
http.server.services.SECURED-CONFIG.managed=false
http.server.services.SECURED-CONFIG.swagger=true