Enable DCAE in ONAP OOM heat template

Change-Id: Ie9ddb0975f6a71241081c7b48d5a88c24798903f
Issue-ID: INT-381
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/test/ete/labs/gwu/onap-oom.env b/test/ete/labs/gwu/onap-oom.env
index 92c13fa..6315267 100644
--- a/test/ete/labs/gwu/onap-oom.env
+++ b/test/ete/labs/gwu/onap-oom.env
@@ -7,8 +7,20 @@
   ##############################################
 
   public_net_id: 024582bd-ef9b-48b9-9e70-e6732559d9df
-
+  public_net_name: provider
   docker_proxy: 192.168.1.51:5000
-
   apt_proxy: 192.168.1.51:3142
-
+  ubuntu_1404_image: trusty
+  ubuntu_1604_image: xenial
+  centos_7_image: centos7
+  openstack_tenant_id: 4c93f99551604bf7af25a8f80c7f34cb
+  openstack_tenant_name: onap
+  openstack_username: demo
+  openstack_api_key: demo
+  keystone_url: http://192.168.1.11:5000
+  rancher_vm_flavor: m1.small
+  k8s_vm_flavor: m2.xxlarge
+  dns_list: ["192.168.1.11", "192.168.1.3"]
+  dns_forwarder: 192.168.1.11
+  oam_network_cidr: 172.16.0.0/16
+  dcae_ip_addr: 172.16.0.4
diff --git a/test/ete/labs/huawei/k8s_vm_entrypoint.sh b/test/ete/labs/huawei/k8s_vm_entrypoint.sh
index 8a34b8e..cae0f39 100644
--- a/test/ete/labs/huawei/k8s_vm_entrypoint.sh
+++ b/test/ete/labs/huawei/k8s_vm_entrypoint.sh
@@ -53,7 +53,7 @@
 echo export RANCHER_SECRET_KEY=`jq -r '.secretValue' apikeys.json` >> api-keys-rc
 source api-keys-rc
 
-curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X DELETE -H 'Content-Type: application/json' "http://$RANCHER_IP:8080/v2-beta/projects/$OLD_PID"
+curl -s -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X DELETE -H 'Content-Type: application/json' "http://$RANCHER_IP:8080/v2-beta/projects/$OLD_PID"
 
 until [ ! -z "$TEMPLATE_ID" ] && [ "$TEMPLATE_ID" != "null" ]; do
     sleep 5
@@ -61,7 +61,7 @@
     TEMPLATE_ID=$(jq -r '.data[0].id' projectTemplatesKubernetes.json)
 done
 
-curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" | tee project.json
+curl -s -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" | tee project.json
 PID=`jq -r '.id' project.json`
 echo export RANCHER_URL=http://$RANCHER_IP:8080/v1/projects/$PID >> api-keys-rc
 source api-keys-rc
@@ -128,17 +128,33 @@
 # Create or edit ~/oom/kubernetes/config/onap-parameters.yaml
 cp ~/oom/kubernetes/config/onap-parameters-sample.yaml ~/oom/kubernetes/config/onap-parameters.yaml
 cat >> ~/oom/kubernetes/config/onap-parameters.yaml <<EOF
+
+####################################
+# Overridden by k8s_vm_entrypoint.sh
+####################################
+
 OPENSTACK_UBUNTU_14_IMAGE: "__ubuntu_1404_image__"
+OPENSTACK_UBUNTU_16_IMAGE: "__ubuntu_1604_image__"
+OPENSTACK_CENTOS_7_IMAGE: "__centos_7_image__"
 OPENSTACK_PUBLIC_NET_ID: "__public_net_id__"
-OPENSTACK_OAM_NETWORK_ID: "__oam_network_id__"
-OPENSTACK_OAM_SUBNET_ID: "__oam_subnet_id__"
+OPENSTACK_PUBLIC_NET_NAME: "__public_net_name__"
 OPENSTACK_OAM_NETWORK_CIDR: "__oam_network_cidr__"
 OPENSTACK_TENANT_NAME: "__openstack_tenant_name__"
 OPENSTACK_TENANT_ID: "__openstack_tenant_id__"
 OPENSTACK_USERNAME: "__openstack_username__"
 OPENSTACK_API_KEY: "__openstack_api_key__"
 OPENSTACK_KEYSTONE_URL: "__keystone_url__"
-DEPLOY_DCAE: "false"
+DCAE_IP_ADDR: "__dcae_ip_addr__"
+DCAE_KEYSTONE_URL: "__keystone_url__/v2.0"
+DNS_LIST: "__dns_list__"
+DNS_FORWARDER: "__dns_forwarder__"
+EXTERNAL_DNS: "8.8.8.8"
+DNSAAS_REGION: "RegionOne"
+DNSAAS_KEYSTONE_URL: "__keystone_url__/v2.0"
+DNSAAS_TENANT_NAME: "__openstack_tenant_name__"
+DNSAAS_USERNAME: "__openstack_username__"
+DNSAAS_PASSWORD: "__openstack_api_key__"
+
 EOF
 cat ~/oom/kubernetes/config/onap-parameters.yaml
 
@@ -163,10 +179,18 @@
     sleep 10
 done
 
+# version control the config to see what's happening
+cd /dockerdata-nfs/
+git init
+git config user.email "root@k8s"
+git config user.name "root"
+git add -A
+git commit -m "initial commit"
+
 # Run ONAP:
 cd ~/oom/kubernetes/oneclick/
 ./createAll.bash -n onap
 
 # Check ONAP status:
-sleep 30
+sleep 3
 kubectl get pods --all-namespaces
diff --git a/test/ete/labs/huawei/onap-oom.env b/test/ete/labs/huawei/onap-oom.env
index 208cc6f..423480f 100644
--- a/test/ete/labs/huawei/onap-oom.env
+++ b/test/ete/labs/huawei/onap-oom.env
@@ -17,3 +17,5 @@
   openstack_username: demo
   openstack_api_key: demo
   keystone_url: http://10.145.122.117:5000
+  rancher_vm_flavor: m1.small
+  k8s_vm_flavor: m1.xxlarge
diff --git a/test/ete/labs/huawei/onap-oom.yaml b/test/ete/labs/huawei/onap-oom.yaml
index 049e373..5db5344 100644
--- a/test/ete/labs/huawei/onap-oom.yaml
+++ b/test/ete/labs/huawei/onap-oom.yaml
@@ -12,6 +12,10 @@
     type: string
     description: The ID of the Public network for floating IP address allocation
 
+  public_net_name:
+    type: string
+    description: The name of the Public network referred by public_net_id
+
   dns_list:
     type: comma_delimited_list
     description: List of External DNS for OAM ONAP network
@@ -44,52 +48,42 @@
     type: string
     description: Name of the Ubuntu 14.04 image
 
+  ubuntu_1604_image:
+    type: string
+    description: Name of the Ubuntu 16.04 image
+
+  centos_7_image:
+    type: string
+    description: the id/name of the CentOS 7 VM imange
+
+  rancher_vm_flavor:
+    type: string
+    description: Name of the Ubuntu 14.04 image
+
+  k8s_vm_flavor:
+    type: string
+    description: Name of the Ubuntu 14.04 image
+
+  dcae_ip_addr:
+    type: string
+
+  dns_forwarder:
+    type: string
+    description: the forwarder address for setting up ONAP's private DNS server
+
+
 resources:
   random-str:
     type: OS::Heat::RandomString
     properties:
       length: 4
 
-  # ONAP management private network
-  oam_network:
-    type: OS::Neutron::Net
-    properties:
-      name:
-        str_replace:
-          template: "oam_network_RAND"
-          params:
-            RAND: { get_resource: random-str }
-
-  oam_subnet:
-    type: OS::Neutron::Subnet
-    properties:
-      name:
-        str_replace:
-          template: "oam_subnet_RAND"
-          params:
-            RAND: { get_resource: random-str }
-      network_id: { get_resource: oam_network }
-      cidr: { get_param: oam_network_cidr }
-      dns_nameservers: { get_param: dns_list }
-
-  router:
-    type: OS::Neutron::Router
-    properties:
-      external_gateway_info:
-        network: { get_param: public_net_id }
-
-  router_interface:
-    type: OS::Neutron::RouterInterface
-    properties:
-      router_id: { get_resource: router }
-      subnet_id: { get_resource: oam_subnet }
-
   rancher_vm:
     type: OS::Nova::Server
     properties:
       name: rancher
       image: xenial
-      flavor: m1.medium
+      flavor: { get_param: rancher_vm_flavor }
       key_name: onap_key
       networks:
       - network: { get_param: public_net_id }
@@ -107,7 +101,7 @@
     properties:
       name: k8s
       image: xenial
-      flavor: m1.xxlarge
+      flavor: { get_param: k8s_vm_flavor }
       key_name: onap_key
       networks:
       - network: { get_param: public_net_id }
@@ -123,10 +117,14 @@
             __openstack_username__: { get_param: openstack_username }
             __openstack_api_key__: { get_param : openstack_api_key }
             __public_net_id__: { get_param: public_net_id }
-            __oam_network_id__: { get_resource: oam_network }
-            __oam_subnet_id__: { get_resource: oam_subnet }
+            __public_net_name__: { get_param: public_net_name }
             __oam_network_cidr__: { get_param: oam_network_cidr }
             __ubuntu_1404_image__: { get_param: ubuntu_1404_image }
+            __ubuntu_1604_image__: { get_param: ubuntu_1604_image }
+            __centos_7_image__: { get_param: centos_7_image }
             __keystone_url__: { get_param: keystone_url }
+            __dcae_ip_addr__: { get_param: dcae_ip_addr }
+            __dns_list__: { get_param: [dns_list, 0] }
+            __dns_forwarder__: { get_param: dns_forwarder }
           template:
             get_file: k8s_vm_entrypoint.sh