Automatic ONAP deployment in Wind River lab

Change-Id: If6e1d7da8a8a7a6a34ba60c949f9cf6a43e1a899
Issue-ID: INT-278
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/test/ete/labs/windriver/Integration-Stable-openrc.sh b/test/ete/labs/windriver/Integration-Stable-openrc.sh
new file mode 100644
index 0000000..1d68adc
--- /dev/null
+++ b/test/ete/labs/windriver/Integration-Stable-openrc.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+# To use an OpenStack cloud you need to authenticate against the Identity
+# service named keystone, which returns a **Token** and **Service Catalog**.
+# The catalog contains the endpoints for all services the user/tenant has
+# access to - such as Compute, Image Service, Identity, Object Storage, Block
+# Storage, and Networking (code-named nova, glance, keystone, swift,
+# cinder, and neutron).
+#
+# *NOTE*: Using the 3 *Identity API* does not necessarily mean any other
+# OpenStack API is version 3. For example, your cloud provider may implement
+# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is
+# only for the Identity API served through keystone.
+export OS_AUTH_URL=http://10.12.25.2:5000/v3
+
+# With the addition of Keystone we have standardized on the term **project**
+# as the entity that owns the resources.
+export OS_PROJECT_ID=3583253e932845a09cd4c8ca2f31d095
+export OS_PROJECT_NAME="Integration-Stable"
+export OS_USER_DOMAIN_NAME="Default"
+if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi
+
+# unset v2.0 items in case set
+unset OS_TENANT_ID
+unset OS_TENANT_NAME
+
+# In addition to the owning entity (tenant), OpenStack stores the entity
+# performing the action as the **user**.
+export OS_USERNAME="gary_wu"
+
+# Remote Openstack clients will need to set this environment if
+# connecting to an HTTPS enabled endpoint
+CERT_MSG="Please enter a path for your CA certificate pem file, \
+or press enter if you are not using HTTPS "
+read -p "$CERT_MSG" OS_CACERT_INPUT
+if [ ! -z "$OS_CACERT_INPUT" ]
+then
+    export OS_CACERT=$(readlink -f $OS_CACERT_INPUT)
+fi
+
+# With Keystone you pass the keystone password.
+read -sp "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: " OS_PASSWORD_INPUT
+export OS_PASSWORD=$OS_PASSWORD_INPUT
+
+# If your configuration has multiple regions, we set that information here.
+# OS_REGION_NAME is optional and only valid in certain environments.
+export OS_REGION_NAME="RegionOne"
+# Don't leave a blank variable, unset it if it was empty
+if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
+
+export OS_INTERFACE=public
+export OS_IDENTITY_API_VERSION=3
diff --git a/test/ete/labs/windriver/onap.env b/test/ete/labs/windriver/onap.env
new file mode 100644
index 0000000..5eb5d36
--- /dev/null
+++ b/test/ete/labs/windriver/onap.env
@@ -0,0 +1,185 @@
+parameters:
+
+  ##############################################
+  #                                            #
+  # Parameters used across all ONAP components #
+  #                                            #
+  ##############################################
+
+  public_net_id: 971040b2-7059-49dc-b220-4fab50cb2ad4
+
+  ubuntu_1404_image: ubuntu-14-04-cloud-amd64
+
+  ubuntu_1604_image: ubuntu-16-04-cloud-amd64
+
+  centos_7_image: CentOS-7
+
+  flavor_small: m1.small
+
+  flavor_medium: m1.medium
+
+  flavor_large: m1.large
+
+  flavor_xlarge: m1.xlarge
+
+  flavor_xxlarge: m1.xxlarge
+
+  security_group: default
+
+  vm_base_name: onap
+
+  key_name: onap_key
+
+  dcae_key_name: dcae_key
+
+  pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh
+
+  dcae_pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC94pcIva90rzXumORjMCf16qjVrn5+ykfW6uMcn+DPlifU+ihtqx4Up26v1gVZyCuY8BFmbhm4YGxnRykNfi71kYbWOasUFzY86dtptCuLVMRLsMYWwOA3sHQ5IcUYNbWmChh4LyOIfhy4p2atCmB1UUkQf7Icg8LokCIcdI3IohlNko50t9KOIhBvqC7Bnegnl6zpoYdtYQppdgp5xesdhYRrdIGmT86cH2QbImpcR3tMTty7SLsw5WdTSfUFwfm76s07ivUDfCRMCJoWcxQeh6my7P7BkfDYMVIYRyfWmoIf2iv3UrqahHTcCiL79SRiD0iCt0K2SEgGsVyCX2jf
+
+  nexus_repo: https://nexus.onap.org/content/sites/raw
+
+  nexus_docker_repo: nexus3.onap.org:10001
+
+  nexus_username: docker
+
+  nexus_password: docker
+
+  dmaap_topic: AUTO
+
+  artifacts_version: 1.1.0-SNAPSHOT
+
+  openstack_tenant_id: SAMPLE
+
+  openstack_username: SAMPLE
+
+  openstack_api_key: SAMPLE
+
+  openstack_auth_method: password
+
+  openstack_region: RegionOne
+
+  horizon_url: http://10.12.25.2/horizon
+
+  keystone_url: http://10.12.25.2:5000
+
+  cloud_env: openstack
+
+
+  ######################
+  #                    #
+  # Network parameters #
+  #                    #
+  ######################
+
+  dns_list: 8.8.8.8
+  external_dns: 8.8.8.8
+  oam_network_cidr: 10.0.0.0/16
+
+  ### Private IP addresses ###
+
+  aai1_ip_addr: 10.0.1.1
+  aai2_ip_addr: 10.0.1.2
+  appc_ip_addr: 10.0.2.1
+  dcae_ip_addr: 10.0.4.1
+  dcae_coll_ip_addr: 10.0.4.102
+  dcae_db_ip_addr: 10.0.4.101
+  dcae_hdp1_ip_addr: 10.0.4.103
+  dcae_hdp2_ip_addr: 10.0.4.104
+  dcae_hdp3_ip_addr: 10.0.4.105
+  dns_ip_addr: 10.0.100.1
+  so_ip_addr: 10.0.5.1
+  mr_ip_addr: 10.0.11.1
+  policy_ip_addr: 10.0.6.1
+  portal_ip_addr: 10.0.9.1
+  robot_ip_addr: 10.0.10.1
+  sdc_ip_addr: 10.0.3.1
+  sdnc_ip_addr: 10.0.7.1
+  vid_ip_addr: 10.0.8.1
+  clamp_ip_addr: 10.0.12.1
+  openo_ip_addr: 10.0.14.1
+
+  dcae_coll_float_ip: 10.12.0.32
+  dcae_db_float_ip: 10.12.0.24
+  dcae_hdp1_float_ip: 10.12.0.30
+  dcae_hdp2_float_ip: 10.12.0.33
+  dcae_hdp3_float_ip: 10.12.0.15
+
+  ###########################
+  #                         #
+  # Parameters used by DCAE #
+  #                         #
+  ###########################
+
+  dcae_base_environment: 1-NIC-FLOATING-IPS
+
+  dcae_zone: ZONE
+
+  dcae_state: STATE
+
+  nexus_repo_root: https://nexus.onap.org
+
+  nexus_url_snapshot: https://nexus.onap.org/content/repositories/snapshots
+
+  gitlab_branch: master
+
+  dcae_code_version: 1.1.0
+
+
+  ################################
+  #                              #
+  # Docker versions and branches #
+  #                              #
+  ################################
+
+  aai_branch: master
+  appc_branch: master
+  so_branch: master
+  mr_branch: master
+  dcae_branch: master
+  policy_branch: master
+  portal_branch: master
+  robot_branch: master
+  sdc_branch: master
+  sdnc_branch: master
+  vid_branch: master
+  clamp_branch: master
+  vnfsdk_branch: master
+
+  aai_docker: 1.1-STAGING-latest
+  appc_docker: 1.1-STAGING-latest
+  so_docker: 1.1-STAGING-latest
+  mr_docker: 1.1-STAGING-latest
+  dcae_docker: 1.1-latest
+  policy_docker: 1.1-STAGING-latest
+  portal_docker: 1.3-STAGING-latest
+  robot_docker: 1.1-STAGING-latest
+  sdc_docker: 1.1-STAGING-latest
+  sdnc_docker: 1.2-STAGING-latest
+  vid_docker: 1.1-STAGING-latest
+  clamp_docker: 1.1-STAGING-latest
+  msb_docker: latest
+  mvim_docker: latest
+  vfc_docker: latest
+  uui_docker: latest
+  esr_docker: latest
+  dgbuilder_docker: 0.1-STAGING-latest
+  cli_docker: 1.1-STAGING-latest
+
+  #####################
+  #                   #
+  # ONAP repositories #
+  #                   #
+  #####################
+  aai_repo: http://gerrit.onap.org/r/aai/test-config
+  appc_repo: http://gerrit.onap.org/r/appc/deployment.git
+  dcae_repo: http://gerrit.onap.org/r/dcae/demo/startup/controller.git
+  mr_repo: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git 
+  so_repo: http://gerrit.onap.org/r/so/docker-config.git
+  policy_repo: http://gerrit.onap.org/r/policy/docker.git
+  portal_repo: http://gerrit.onap.org/r/portal.git
+  robot_repo: http://gerrit.onap.org/r/testsuite/properties.git
+  sdc_repo: http://gerrit.onap.org/r/sdc.git
+  sdnc_repo: http://gerrit.onap.org/r/sdnc/oam.git
+  vid_repo: http://gerrit.onap.org/r/vid.git
+  clamp_repo: http://gerrit.onap.org/r/clamp.git
+  vnfsdk_repo: http://gerrit.onap.org/r/vnfsdk/refrepo.git
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh
new file mode 100755
index 0000000..3c69e15
--- /dev/null
+++ b/test/ete/scripts/deploy-onap.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ]
+then
+    echo "ERROR: OpenStack environment variables not set.  Please source your OpenStack RC script first."
+    exit 1
+fi
+
+
+if [ -z "$WORKSPACE" ]; then
+    export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+
+
+# Assume that if ROBOT_VENV is set, we don't need to reinstall robot
+if [ -f ${WORKSPACE}/env.properties ]; then
+    source ${WORKSPACE}/env.properties
+fi
+
+if [ ! -z "$ONAP_VENV" ] && [ -f "$ONAP_VENV/bin/activate" ]; then
+    source ${ONAP_VENV}/bin/activate
+else
+    ONAP_VENV=$(mktemp -d --suffix=_onap_venv)
+    virtualenv ${ONAP_VENV}
+    source ${ONAP_VENV}/bin/activate
+    
+    pip install --upgrade pip
+    pip install --upgrade python-openstackclient python-heatclient
+    
+    echo "ONAP_VENV=${ONAP_VENV}" >> $WORKSPACE/env.properties
+fi
+echo "ONAP_VENV=${ONAP_VENV}"
+
+if [ -z "$ONAP_WORKDIR" ]; then
+    ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir)
+    echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties
+fi
+echo "ONAP_WORKDIR=${ONAP_WORKDIR}"
+if [ ! -d ${ONAP_WORKDIR}/demo ]; then
+    git clone http://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo
+else
+    pushd ${ONAP_WORKDIR}/demo
+    git pull
+    popd
+fi
+
+
+
+STACK="ete-$(uuidgen | cut -c-8)"
+echo "Stack Name: ${STACK}"
+openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap.env $STACK
+