Revert "Feature 11060: Remove POL and PLA modules from OSM helm chart"

This reverts commit 07367db6ef025e4fbb872b32a1f42737d2a563ec.

Change-Id: Ifa86312a16c4841603316f38ee5ffbdb4e6cc39f
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh
index a35396f..9c6ff88 100755
--- a/installers/full_install_osm.sh
+++ b/installers/full_install_osm.sh
@@ -37,6 +37,9 @@
     echo -e "     -S <VCA secret> use VCA/juju secret key"
     echo -e "     -P <VCA pubkey> use VCA/juju public key file"
     echo -e "     -A <VCA apiproxy> use VCA/juju API proxy"
+    echo -e "     --pla:          install the PLA module for placement support"
+    echo -e "     --old-sa:       install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway"
+    echo -e "     --ng-sa:        install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)"
     echo -e "     -o <COMPONENT>: ONLY installs the specified component (k8s_monitor, ng-sa, k8scluster, docker, deploy-osm)"
     echo -e "     -O <openrc file path/cloud name>: install OSM to an OpenStack infrastructure. <openrc file/cloud name> is required. If a <cloud name> is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/"
     echo -e "     -N <openstack public network name/ID>: public network name required to setup OSM to OpenStack"
@@ -242,10 +245,13 @@
     fi
     [ -n "$OSM_VCA_APIPROXY" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set lcm.config.OSMLCM_VCA_APIPROXY=${OSM_VCA_APIPROXY}"
 
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.defaultAirflowRepository=${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow"
-    [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${OSM_DOCKER_TAG}"
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.ingress.web.hosts[0].name=airflow.${OSM_K8S_EXTERNAL_IP}.nip.io"
-
+    if [ -n "${INSTALL_NGSA}" ]; then
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.defaultAirflowRepository=${DOCKER_REGISTRY_URL}${DOCKER_USER}/airflow"
+        [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${OSM_DOCKER_TAG}"
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set airflow.ingress.web.hosts[0].name=airflow.${OSM_K8S_EXTERNAL_IP}.nip.io"
+    else
+        OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.oldServiceAssurance=true --set airflow.enabled=false"
+    fi
     if [ -n "${OSM_BEHIND_PROXY}" ]; then
         OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.behindHttpProxy=true"
         [ -n "${HTTP_PROXY}" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.httpProxy.HTTP_PROXY=\"${HTTP_PROXY}\""
@@ -271,6 +277,15 @@
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
+function install_osm_ngsa_service() {
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+    NGSA_OPTS="-i ${OSM_K8S_EXTERNAL_IP} -d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -t ${OSM_DOCKER_TAG} -U ${DOCKER_USER} ${DEBUG_INSTALL}"
+    [ -n "${DOCKER_REGISTRY_URL}" ] && NGSA_OPTS="${NGSA_OPTS} -r ${DOCKER_REGISTRY_URL}"
+    $OSM_DEVOPS/installers/install_ngsa.sh ${NGSA_OPTS} || \
+    FATAL_TRACK install_osm_ngsa_service "install_ngsa.sh failed"
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
 function add_local_k8scluster() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
     # OSM_HOSTNAME=$(kubectl get --namespace osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress)
@@ -539,7 +554,7 @@
     fi
     track mgmtcluster mgmt_and_aux_cluster_ok
 
-    # Deploy OSM (OSM helm chart)
+    # Deploy OSM (mongodb, OSM helm chart, NGSA)
     echo "Deploying OSM in the K8s cluster ..."
     deploy_osm
 
@@ -655,11 +670,14 @@
     echo "INSTALL_JUJU=$INSTALL_JUJU"
     echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR"
     echo "INSTALL_LXD=$INSTALL_LXD"
+    echo "INSTALL_NGSA=$INSTALL_NGSA"
     echo "INSTALL_DOCKER=$INSTALL_DOCKER"
     echo "INSTALL_ONLY=$INSTALL_ONLY"
     echo "INSTALL_ONLY_DEPLOY_OSM=$INSTALL_ONLY_DEPLOY_OSM"
     echo "INSTALL_ONLY_DOCKER_CE=$INSTALL_ONLY_DOCKER_CE"
     echo "INSTALL_ONLY_K8S_CLUSTER=$INSTALL_ONLY_K8S_CLUSTER"
+    echo "INSTALL_ONLY_NGSA=$INSTALL_ONLY_NGSA"
+    echo "INSTALL_PLA=$INSTALL_PLA"
     echo "INSTALL_TO_OPENSTACK=$INSTALL_TO_OPENSTACK"
     echo "INSTALL_VIMEMU=$INSTALL_VIMEMU"
     echo "OPENSTACK_PUBLIC_NET_NAME=$OPENSTACK_PUBLIC_NET_NAME"
@@ -718,6 +736,8 @@
 RELEASE="testing-daily"
 REPOSITORY="testing"
 INSTALL_K8S_MONITOR=""
+INSTALL_NGSA="y"
+INSTALL_PLA=""
 INSTALL_VIMEMU=""
 LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd"
 LXD_REPOSITORY_PATH=""
@@ -733,6 +753,7 @@
 INSTALL_ONLY_DEPLOY_OSM=""
 INSTALL_ONLY_DOCKER_CE=""
 INSTALL_ONLY_K8S_CLUSTER=""
+INSTALL_ONLY_NGSA=""
 INSTALL_DOCKER=""
 INSTALL_JUJU=""
 INSTALL_NOHOSTCLIENT=""
@@ -810,6 +831,7 @@
         o)
             INSTALL_ONLY="y"
             [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
+            [ "${OPTARG}" == "ng-sa" ] && INSTALL_ONLY_NGSA="y" && continue
             [ "${OPTARG}" == "docker" ] && INSTALL_ONLY_DOCKER_CE="y" && continue
             [ "${OPTARG}" == "k8scluster" ] && INSTALL_ONLY_K8S_CLUSTER="y" && continue
             [ "${OPTARG}" == "deploy-osm" ] && INSTALL_ONLY_DEPLOY_OSM="y" && continue
@@ -909,6 +931,9 @@
             [ "${OPTARG}" == "ha" ] && continue
             [ "${OPTARG}" == "tag" ] && continue
             [ "${OPTARG}" == "registry" ] && continue
+            [ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue
+            [ "${OPTARG}" == "old-sa" ] && INSTALL_NGSA="" && continue
+            [ "${OPTARG}" == "ng-sa" ] && INSTALL_NGSA="y" && continue
             [ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue
             [ "${OPTARG}" == "nocachelxdimages" ] && continue
             [ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="--cachelxdimages" && continue
@@ -989,6 +1014,7 @@
         [ -n "$INSTALL_ONLY_K8S_CLUSTER" ] && install_k8s_cluster
         [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
         [ -n "$INSTALL_ONLY_DEPLOY_OSM" ] && deploy_osm
+        [ -n "$INSTALL_ONLY_NGSA" ] && install_osm_ngsa_service
         echo -e "\nDONE" && exit 0
     fi
     # This is where installation starts