Merge "Add csit cases for activiti workflow"
diff --git a/.gitignore b/.gitignore
index 4126c2c..749c14a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,4 @@
 .idea
 *.iml
 
+/bin/
diff --git a/deployment/heat/onap-oom/onap-oom.yaml b/deployment/heat/onap-oom/onap-oom.yaml
index 29f70bd..236437f 100644
--- a/deployment/heat/onap-oom/onap-oom.yaml
+++ b/deployment/heat/onap-oom/onap-oom.yaml
@@ -211,6 +211,8 @@
               get_attr: [k8s_9_floating_ip, floating_ip_address],
               get_attr: [k8s_10_floating_ip, floating_ip_address],
               get_attr: [k8s_11_floating_ip, floating_ip_address],
+              get_attr: [k8s_12_floating_ip, floating_ip_address],
+              get_attr: [k8s_13_floating_ip, floating_ip_address],
             ]
             __k8s_private_ips__: [
               get_attr: [k8s_1_floating_ip, fixed_ip_address],
@@ -224,6 +226,8 @@
               get_attr: [k8s_9_floating_ip, fixed_ip_address],
               get_attr: [k8s_10_floating_ip, fixed_ip_address],
               get_attr: [k8s_11_floating_ip, fixed_ip_address],
+              get_attr: [k8s_12_floating_ip, fixed_ip_address],
+              get_attr: [k8s_13_floating_ip, fixed_ip_address],
             ]
   k8s_1_private_port:
     type: OS::Neutron::Port
@@ -621,6 +625,78 @@
           template:
             get_file: k8s_vm_entrypoint.sh
 
+  k8s_12_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_12_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_12_private_port }
+
+  k8s_12_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_12']]
+      image: { get_param: ubuntu_1604_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_12_private_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __docker_proxy__: { get_param: docker_proxy }
+            __apt_proxy__: { get_param: apt_proxy }
+            __docker_version__: { get_param: docker_version }
+            __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+            __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+          template:
+            get_file: k8s_vm_entrypoint.sh
+
+  k8s_13_private_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: oam_network }
+      fixed_ips: [{"subnet": { get_resource: oam_subnet }}]
+      security_groups:
+      - { get_resource: onap_sg }
+
+  k8s_13_floating_ip:
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network_id: { get_param: public_net_id }
+      port_id: { get_resource: k8s_13_private_port }
+
+  k8s_13_vm:
+    type: OS::Nova::Server
+    properties:
+      name:
+        list_join: ['-', [ { get_param: 'OS::stack_name' }, 'k8s_13']]
+      image: { get_param: ubuntu_1604_image }
+      flavor: { get_param: k8s_vm_flavor }
+      key_name: { get_param: key_name }
+      networks:
+      - port: { get_resource: k8s_13_private_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __docker_proxy__: { get_param: docker_proxy }
+            __apt_proxy__: { get_param: apt_proxy }
+            __docker_version__: { get_param: docker_version }
+            __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
+            __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
+          template:
+            get_file: k8s_vm_entrypoint.sh
+
 outputs:
   rancher_vm_ip:
     description: The IP address of the rancher instance
@@ -670,3 +746,11 @@
     description: The IP address of the k8s_11 instance
     value: { get_attr: [k8s_11_floating_ip, floating_ip_address] }
 
+  k8s_12_vm_ip:
+    description: The IP address of the k8s_12 instance
+    value: { get_attr: [k8s_12_floating_ip, floating_ip_address] }
+
+  k8s_13_vm_ip:
+    description: The IP address of the k8s_13 instance
+    value: { get_attr: [k8s_13_floating_ip, floating_ip_address] }
+
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/addSubscriber.json b/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/addSubscriber.json
new file mode 100644
index 0000000..612c462
--- /dev/null
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/addSubscriber.json
@@ -0,0 +1,18 @@
+{
+    "delivery":{
+       "url":"http://fileconsumer:7070",
+       "user":"LOGIN",
+       "password":"PASSWORD",
+       "use100":true
+    },
+    "follow_redirect":false,
+    "metadataOnly":false,
+    "suspend":false,
+    "groupid":0,
+    "links":{
+       "self": "https://dmaap-dr-prov/subscribe/1",
+       "log": "https://dmaap-dr-prov/feedlog/1",
+       "feed": "https://dmaap-dr-prov/feed/1"
+    },
+    "subscriber":"admin"
+ }
\ No newline at end of file
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/createFeed.json b/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/createFeed.json
new file mode 100644
index 0000000..fdcc7ee
--- /dev/null
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/createFeed.json
@@ -0,0 +1,18 @@
+{
+    "name": "DefaultFeed",
+    "version": "m1.0",
+    "description": "Default feed",
+    "business_description": "Default Feed",
+    "suspend": false,
+    "deleted": false,
+    "changeowner": true,
+    "authorization": {
+      "classification": "unclassified",
+      "endpoint_addrs": [],
+      "endpoint_ids": [
+        {
+          "password": "dradmin",
+          "id": "dradmin"
+        }]
+    }
+  }
\ No newline at end of file
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
index c9f5318..24027e9 100644
--- a/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/setup.sh
@@ -63,7 +63,8 @@
 docker kill datarouter-prov
 docker kill datarouter-node
 docker kill vescollector
-sed -i -e '/DMAAPHOST:/ s/:.*/: '$DMAAP_MR_IP'/' docker-compose.yml
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml
 MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
 sed -i 's/172.100.0.2/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/prov_data/provserver.properties
 docker-compose up -d
@@ -90,10 +91,6 @@
 DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' subscriber-node)
 DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
 
-#Add the DR_NODE_IP to /etc/hosts
-echo "${DR_NODE_IP} dmaap-dr-node" >> /etc/hosts
-echo "${DR_PROV_IP} dmaap-dr-prov" >> /etc/hosts
-
 echo DR_PROV_IP=${DR_PROV_IP}
 echo DR_NODE_IP=${DR_NODE_IP}
 echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
@@ -110,16 +107,23 @@
 KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
 ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER)
 VESC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vescollector)
+SFTP_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sftp)
 
 export VESC_IP=${VESC_IP}
 export HOST_IP=${HOST_IP}
 export DMAAP_MR_IP=${DMAAP_MR_IP}
 
-echo "${DMAAP_MR_IP} dmaap-mr" >> /etc/hosts
-
 #Pass any variables required by Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP}"
+ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}"
 
 pip install jsonschema uuid
 # Wait container ready
-sleep 2
\ No newline at end of file
+sleep 2
+# Update the File Ready Notification with actual sftp ip address
+sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
+#Create default feed in data router.
+curl -v -X POST -H "Content-Type:application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443
+#create file consumer subscriber on data router.
+cp $WORKSPACE/test/csit/plans/dcae-bulkpm/bulkpm-suite/assets/addSubscriber.json /tmp/addSubscriber.json
+sed -i 's/fileconsumer/'${DR_SUBSCIBER_IP}'/g' /tmp/addSubscriber.json
+curl -v -X POST -H "Content-Type:application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @/tmp/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1
diff --git a/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh b/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
index e3035f0..e11616e 100644
--- a/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
+++ b/test/csit/plans/dcae-bulkpm/bulkpm-suite/teardown.sh
@@ -1,14 +1,12 @@
 #!/bin/bash
 echo "Starting teardown script"
-cd $WORKSPACE/test/csit/scripts
-./kill-instance.sh $DMAAP
-./kill-instance.sh $KAFKA
-./kill-instance.sh $ZOOKEEPER
-./kill-instance.sh vescollector
-./kill-instance.sh datarouter-node
-./kill-instance.sh datarouter-prov
-./kill-instance.sh subscriber-node
-./kill-instance.sh mariadb
-./kill-instance.sh dfc
-./kill-instance.sh sftp
-sudo sed -i '/dmaap/d' /etc/hosts
\ No newline at end of file
+kill-instance.sh $DMAAP
+kill-instance.sh $KAFKA
+kill-instance.sh $ZOOKEEPER
+kill-instance.sh vescollector
+kill-instance.sh datarouter-node
+kill-instance.sh datarouter-prov
+kill-instance.sh subscriber-node
+kill-instance.sh mariadb
+kill-instance.sh dfc
+kill-instance.sh sftp
\ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
index 96068e3..1cfc78a 100644
--- a/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
+++ b/test/csit/tests/dcae-bulkpm/testcases/assets/json_events/FileExistNotification.json
@@ -18,13 +18,16 @@
             "changeIdentifier": "PM_MEAS_FILES",
             "changeType": "FileReady",
             "notificationFieldsVersion": "2.0",
-            "additionalFields": 
-              {
-                "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1045.bin.gz",
-                "compression": "gzip",
-                "fileformatType": "org.3GPP.32.435#measCollec",
-                "fileFormatVersion": "V10"
-              }
-        }
+            "arrayOfNamedHashMap": [
+                { "name": "pm.xml.gz",
+                  "hashMap":{
+                            "location": "sftp://admin:admin@sftpserver:22/pm.xml.gz",
+                            "compression": "gzip",
+                            "fileFormatType": "org.3GPP.32.435#measCollec",
+                            "fileFormatVersion": "V10"
+                            }
+                }
+        ]
     }
-  }
\ No newline at end of file
+}
+}
\ No newline at end of file
diff --git a/test/csit/tests/dcae-bulkpm/testcases/e2e.robot b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
index 69c7953..210012c 100644
--- a/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
+++ b/test/csit/tests/dcae-bulkpm/testcases/e2e.robot
@@ -3,6 +3,7 @@
 Library           RequestsLibrary
 Library           OperatingSystem
 Library           Collections
+Library           Process
 Resource          resources/ves_keywords.robot
 
 
@@ -15,11 +16,13 @@
 
 ${TARGETURL_TOPICS}                      http://${DMAAP_MR_IP}:3904/topics
 ${TARGETURL_SUBSCR}                      http://${DMAAP_MR_IP}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12?timeout=1000
+${CLI_EXEC_CLI}                          curl -k https://${DR_PROV_IP}:8443/internal/prov
+
 *** Test Cases ***
 
 Send VES File Ready Event to VES Collector
-    [Tags]    DCAE-VESC-R1
-    [Documentation]   Post single event and expect 200 Response
+    [Tags]    Bulk_PM_E2E_01
+    [Documentation]   Send VES File Ready Event
     ${evtdata}=   Get Event Data From File   ${EVENT_DATA_FILE}
     ${headers}=   Create Header From String    ${HEADER_STRING}
     ${resp}=  Publish Event To VES Collector    ${VESC_URL}  ${VES_ANY_EVENT_PATH}  ${headers}  ${evtdata}
@@ -27,7 +30,8 @@
     Should Be Equal As Strings 	${resp.status_code} 	202
 
 Check VES Notification Topic is existing in Message Router
-    [Documentation]                 Get the count of the Topics
+    [Tags]                          Bulk_PM_E2E_02
+    [Documentation]                 Get the VES Notification topic on message router
     [Timeout]                       1 minute
     Sleep                           10s
     ${resp}=                        GetCall                         ${TARGETURL_TOPICS}
@@ -38,3 +42,12 @@
     ${ListLength}=                  Get Length                      ${topics}
     log                             ${ListLength}
     List Should Contain Value       ${topics}                       unauthenticated.VES_NOTIFICATION_OUTPUT
+
+Verify Default Feed And File Consumer Subscription On Datarouter
+    [Tags]              Bulk_PM_E2E_04
+    [Documentation]     Verify Default Feed And File Consumer Subscription On Datarouter
+    ${cli_cmd_output}=    Run Process   ${CLI_EXEC_CLI}    shell=yes
+    Log    ${cli_cmd_output.stdout}
+    Should Be Equal As Strings    ${cli_cmd_output.rc}    0
+    Should Contain    ${cli_cmd_output.stdout}    https://dmaap-dr-prov/publish/1
+    Should Contain    ${cli_cmd_output.stdout}    http://${DR_SUBSCIBER_IP}:7070
\ No newline at end of file
diff --git a/test/ete/labs/gwu/onap-openstack-template.env b/test/ete/labs/gwu/onap-openstack-template.env
index 53139b5..09f180b 100644
--- a/test/ete/labs/gwu/onap-openstack-template.env
+++ b/test/ete/labs/gwu/onap-openstack-template.env
@@ -95,7 +95,7 @@
   #                         #
   ###########################
 
-  dcae_deployment_profile: R2MVP
+  dcae_deployment_profile: R3MVP
 
   ################################
   #                              #
diff --git a/test/ete/labs/huawei/onap-openstack-template.env b/test/ete/labs/huawei/onap-openstack-template.env
index e6e2a2c..25098e2 100644
--- a/test/ete/labs/huawei/onap-openstack-template.env
+++ b/test/ete/labs/huawei/onap-openstack-template.env
@@ -95,7 +95,7 @@
   #                         #
   ###########################
 
-  dcae_deployment_profile: R2MVP
+  dcae_deployment_profile: R3MVP
 
   ################################
   #                              #
diff --git a/test/ete/labs/tlab/onap-openstack-template.env b/test/ete/labs/tlab/onap-openstack-template.env
index dcdb7d5..3d36a98 100644
--- a/test/ete/labs/tlab/onap-openstack-template.env
+++ b/test/ete/labs/tlab/onap-openstack-template.env
@@ -96,7 +96,7 @@
   #                         #
   ###########################
 
-  dcae_deployment_profile: R2MVP
+  dcae_deployment_profile: R3MVP
 
   ################################
   #                              #
diff --git a/test/ete/labs/windriver/onap-openstack-template.env b/test/ete/labs/windriver/onap-openstack-template.env
index 90d901d..ba7f25c 100644
--- a/test/ete/labs/windriver/onap-openstack-template.env
+++ b/test/ete/labs/windriver/onap-openstack-template.env
@@ -95,7 +95,7 @@
   #                         #
   ###########################
 
-  dcae_deployment_profile: R2MVP
+  dcae_deployment_profile: R3MVP
 
   ################################
   #                              #