Merge "Rename SDNC Docker Images"
diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc
index 2b0634b..2d14182 100755
--- a/bootstrap/vagrant-onap/lib/vfc
+++ b/bootstrap/vagrant-onap/lib/vfc
@@ -19,22 +19,15 @@
 function compile_all_vfc_repos {
     install_python_package tox
 
-    pushd $src_folder/gvnfm/vnflcm/lcm
-    tox -e py27
-    popd
+    tox_repos=("gvnfm/vnflcm/lcm" "gvnfm/vnfmgr/mgr" "gvnfm/vnfres/res" "nfvo/lcm"
+               "nfvo/driver/vnfm/gvnfm/gvnfmadapter" "nfvo/driver/vnfm/svnfm/zte/vmanager")
+    for dirc in ${tox_repos[@]}; do
+        pushd $src_folder/$dirc
+        tox -e py27
+        popd
+    done
 
-
-    pushd $src_folder/nfvo/lcm
-    tox -e py27
-    popd
-
-    # TODO(sshank): Add compile for other vfc_repos. (Both Java and Python based.)
-    # Python based:
-    # gvnfm/vnflcm/lcm
-    # gvnfm/vnfmgr/mgr
-    # gvnfm/vnfres/res
-    # nfvo/driver/vnfm/gvnfm/gvnfmadapter
-    # nfvo/driver/vnfm/svnfm/zte/vmanager
+    # TODO(sshank): Add compile for other vfc_repos. (Java based.)
 
     # Java based:
     # nfvo/catalog
@@ -46,10 +39,42 @@
     # nfvo/wfengine
 }
 
+# build_gvnfm_lcm_image() - Build VFC GVNFM VNF LCM docker image
+function build_gvnfm_lcm_image {
+    pushd $src_folder/gvnfm/vnflcm/lcm/docker
+    sed -i '$ {s/^/#/}' build_image.sh
+    ./build_image.sh
+    popd
+}
+
+# build_gvnfm_vnfmgr_image() - Build VFC GVNFM VNF Manager docker image
+function build_gvnfm_vnfmgr_image {
+    pushd $src_folder/gvnfm/vnfmgr/mgr/docker
+    sed -i '$ {s/^/#/}' build_image.sh
+    ./build_image.sh
+    popd
+}
+
+# build_gvnfm_vnfres_image() - Build VFC GVNFM VNF Resource Management docker image
+function build_gvnfm_vnfres_image {
+    pushd $src_folder/gvnfm/vnfres/res/docker
+    sed -i '$ {s/^/#/}' build_image.sh
+    ./build_image.sh
+    popd
+}
+
 # build_nfvo_lcm_image() - Build VFC NFVO LCM docker image
 function build_nfvo_lcm_image {
     pushd $src_folder/nfvo/lcm/docker
-    sed -i '$ d' build_image.sh
+    sed -i '$ {s/^/#/}' build_image.sh
+    ./build_image.sh
+    popd
+}
+
+# build_nfvo_vnfm_gvnfmadapter_image() - Build VFC NFVO General VNF Adapter docker image
+function build_nfvo_vnfm_gvnfmadapter_image {
+    pushd $src_folder/nfvo/driver/vnfm/gvnfm/gvnfmadapter/docker
+    sed -i '$ {s/^/#/}' build_image.sh
     ./build_image.sh
     popd
 }
@@ -58,18 +83,37 @@
 function get_vfc_images {
     if [[ "$build_image" == "True" ]]; then
         install_docker
+        # Separate methods are required since the image build process will change.
+        build_gvnfm_lcm_image
+        build_gvnfm_vnfmgr_image
+        build_gvnfm_vnfres_image
         build_nfvo_lcm_image
-        # TODO(sshank): Add other VFC component docker image builds when they are ready.
+        build_nfvo_vnfm_gvnfmadapter_image
+        # TODO(sshank): Add other VFC component docker image builds.
     else
-        pull_onap_image vfc/nslcm
+        pull_onap_image vfc/gvnfm/vnflcm/lcm
+        pull_onap_image vfc/gvnfm/vnfmgr/mgr
+        pull_onap_image vfc/gvnfm/vnfres/res
+        pull_onap_image vfc/nfvo/lcm
+        pull_onap_image vfc/nfvo/driver/vnfm/gvnfm/gvnfmadapter
     fi
 }
 
 # install_vfc() - Download and install vfc service from source code
 function install_vfc {
     nslcm_image=`docker images | grep nslcm | grep latest| awk '{print $1 ":" $2}'`
-    docker run -d --name vfc-nslcm -p 3306:3306 -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image
-    # TODO(sshank): Run other VFC component docker images when they are ready.
+    vnflcm_image=`docker images | grep vnflcm | grep latest| awk '{print $1 ":" $2}'`
+    vnfmgr_image=`docker images | grep vnfmgr | grep latest| awk '{print $1 ":" $2}'`
+    vnfres_image=`docker images | grep vnfres | grep latest| awk '{print $1 ":" $2}'`
+    gvnfmdriver_image=`docker images | grep gvnfmdriver | grep latest| awk '{print $1 ":" $2}'`
+
+    docker run -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image
+    docker run -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image
+    docker run -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image
+    docker run -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image
+    docker run -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image
+
+    # TODO(sshank): Run other VFC component docker images.
 }
 
 # init_vfc() - Function that initialize VF-C services
@@ -78,7 +122,7 @@
 
     if [[ "$clone_repo" == "True" ]]; then
         clone_all_vfc_repos
-        if [[ "$compile_repo" == "False" ]]; then
+        if [[ "$compile_repo" == "True" ]]; then
             compile_all_vfc_repos
         fi
     fi
diff --git a/bootstrap/vagrant-onap/tests/test_aai b/bootstrap/vagrant-onap/tests/test_aai
index 0fa82d5..5ff62c1 100644
--- a/bootstrap/vagrant-onap/tests/test_aai
+++ b/bootstrap/vagrant-onap/tests/test_aai
@@ -4,7 +4,8 @@
 source /var/onap/aai
 
 covered_functions=(
-"install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "start_aai_microservices" "install_hbase" "install_ajsc_aai" "install_model_loader"
+#"install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "start_aai_microservices" "install_hbase" "install_ajsc_aai" "install_model_loader"
+"install_hadoop" "install_haproxy" "clone_all_aai_repos" "compile_aai_repos" "setup_titan" "install_hbase" "install_ajsc_aai" "install_model_loader"
 )
 
 # TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings
@@ -61,23 +62,11 @@
     asserts_file_exist $aai_src_folder/aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar
     asserts_file_exist $aai_src_folder/aai-common/aai-schema/target/aai-schema-1.1.0-SNAPSHOT.jar
 
-    asserts_file_exist $aai_src_folder/aai-service/aai-schema/target/aai-schema-1.1.0-SNAPSHOT.jar
-    asserts_file_exist $aai_src_folder/aai-service/ajsc-aai/target/aai.jar
-    asserts_file_exist $aai_src_folder/aai-service/annotations/target/annotations-1.1.0-SNAPSHOT.jar
-
-    asserts_file_exist $aai_src_folder/data-router/target/data-router-1.1.0-SNAPSHOT.jar
-
     asserts_file_exist $aai_src_folder/logging-service/common-logging/target/common-logging-1.1.0-SNAPSHOT.jar
     asserts_file_exist $aai_src_folder/logging-service/eelf-logging/target/eelf-logging-1.1.0-SNAPSHOT.jar
     asserts_file_exist $aai_src_folder/logging-service/logging-api/target/logging-api-1.1.0-SNAPSHOT.jar
 
-    asserts_file_exist $aai_src_folder/model-loader/target/model-loader-1.1.0-SNAPSHOT.jar
     asserts_file_exist $aai_src_folder/resources/aai-resources/target/aai-resources.jar
-    asserts_file_exist $aai_src_folder/rest-client/target/rest-client-1.1.0-SNAPSHOT.jar
-    asserts_file_exist $aai_src_folder/router-core/target/router-core-1.1.0-SNAPSHOT.jar
-    asserts_file_exist $aai_src_folder/search-data-service/target/search-data-service-1.1.0-SNAPSHOT.jar
-    asserts_file_exist $aai_src_folder/sparky-be/target/sparky-be-1.0-SNAPSHOT.jar
-    asserts_file_exist $aai_src_folder/sparky-fe/target/sparky-fe-1.0.0-SNAPSHOT.war
     asserts_file_exist $aai_src_folder/traversal/aai-traversal/target/traversal.jar
 }
 
diff --git a/bootstrap/vagrant-onap/tests/test_vfc b/bootstrap/vagrant-onap/tests/test_vfc
index e948cce..8392e70 100644
--- a/bootstrap/vagrant-onap/tests/test_vfc
+++ b/bootstrap/vagrant-onap/tests/test_vfc
@@ -5,7 +5,9 @@
 
 covered_functions=(
 "clone_all_vfc_repos" "compile_all_vfc_repos" "install_vfc"
-"build_nfvo_lcm_image" "get_vfc_images" "run_vfc_images"
+"get_vfc_images" "run_vfc_images" "build_nfvo_lcm_image"
+"build_gvnfm_lcm_image" "build_gvnfm_vnfmgr_image" "build_gvnfm_vnfres_image"
+"build_nfvo_lcm_image" "build_nfvo_vnfm_gvnfmadapter_image"
 )
 
 # test_clone_all_vfc_repos() - Verify cloning and pulling source code from repositories
@@ -29,17 +31,25 @@
     get_vfc_images
 
     asserts_image nexus3.onap.org:10003/onap/vfc/nslcm
+    asserts_image nexus3.onap.org:10003/onap/vfc/gvnfmdriver
+    asserts_image nexus3.onap.org:10003/onap/vfc/vnfres
+    asserts_image nexus3.onap.org:10003/onap/vfc/vnfmgr
+    asserts_image nexus3.onap.org:10003/onap/vfc/vnflcm
 
-    # TODO(sshank): Add asserts for other VFC component docker image builds when they are ready.
+    # TODO(sshank): Add asserts for other VFC component docker image builds.
 }
 
 # test_install_vfc() - Verify that the VFC are up and running
 function test_install_vfc {
     install_vfc
 
-    asserts_image_running vfc-nslcm
+    asserts_image_running nexus3.onap.org:10003/onap/vfc/nslcm:latest
+    asserts_image_running nexus3.onap.org:10003/onap/vfc/gvnfmdriver:latest
+    asserts_image_running nexus3.onap.org:10003/onap/vfc/vnfres:latest
+    asserts_image_running nexus3.onap.org:10003/onap/vfc/vnfmgr:latest
+    asserts_image_running nexus3.onap.org:10003/onap/vfc/vnflcm:latest
 
-    # TODO(sshank): Add asserts for other running VFC component docker images when they are ready.
+    # TODO(sshank): Add asserts for other running VFC component docker images.
 }
 
 if [ "$1" != '*' ]; then
diff --git a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh
index cbe107c..ee010a0 100644
--- a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh
+++ b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh
@@ -17,7 +17,7 @@
 # Place the scripts in run order:
 
 # Download and start MySQL
-docker pull postgresql:9.5
+docker pull postgres:9.5
 docker run --name postgres-holmes -p 5432:5432 -e POSTGRES_USER=holmes -e POSTGRES_PASSWORD=holmespwd -d postgres:9.5 
 DB_IP=`get-instance-ip.sh postgres-holmes`
 echo DB_IP=${DB_IP}
@@ -26,7 +26,7 @@
 docker login -u docker -p docker nexus3.onap.org:10001
 
 # Start MSB
-docker run -d -p 8500:8500 --name msb_consul nexus3.onap.org:10001/onap/msb/msb_base
+docker run -d -p 8500:8500 --name msb_consul consul
 CONSUL_IP=`get-instance-ip.sh msb_consul`
 echo CONSUL_IP=${CONSUL_IP}
 docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
diff --git a/test/csit/plans/integration/vCPE/setup.sh b/test/csit/plans/integration/vCPE/setup.sh
new file mode 100755
index 0000000..1b9cc34
--- /dev/null
+++ b/test/csit/plans/integration/vCPE/setup.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+# Place the scripts in run order:
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES=""
+
diff --git a/test/csit/plans/integration/vCPE/teardown.sh b/test/csit/plans/integration/vCPE/teardown.sh
new file mode 100755
index 0000000..8beb6e1
--- /dev/null
+++ b/test/csit/plans/integration/vCPE/teardown.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# 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.
+#
+
+
diff --git a/test/csit/plans/integration/vCPE/testplan.txt b/test/csit/plans/integration/vCPE/testplan.txt
new file mode 100644
index 0000000..2b3d4ad
--- /dev/null
+++ b/test/csit/plans/integration/vCPE/testplan.txt
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration.git]/test/csit/tests/.
+# Place the suites in run order.
+integration/vCPE
diff --git a/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh
index d75b1ca..3cc5398 100755
--- a/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh
+++ b/test/csit/plans/vfc-nfvo-lcm/sanity-check/setup.sh
@@ -55,4 +55,4 @@
 done
 
 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v NSLCM_IP:${NSLCM_IP}"
+ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v NSLCM_IP:${NSLCM_IP} -v SCRIPTS:${SCRIPTS}"
diff --git a/test/csit/tests/common.robot b/test/csit/tests/common.robot
new file mode 100644
index 0000000..944be6b
--- /dev/null
+++ b/test/csit/tests/common.robot
@@ -0,0 +1,22 @@
+#Robot functions that will be shared also with other tests
+
+*** Keywords ***
+json_from_file
+#Robot function to extract the json object from a file
+    [Arguments]    ${file_path}
+    ${json_file}=    Get file    ${file_path}
+    ${json_object}=    Evaluate    json.loads('''${json_file}''')    json
+    [return]    ${json_object}
+
+string_from_json
+#Robot function to transform the json object to a string
+    [Arguments]    ${json_value}
+    ${json_string}=   Stringify Json     ${json_value}
+    [return]    ${json_string}
+
+random_ip
+#Robot function to generate a random IP
+    [Arguments]
+    ${numbers}=    Evaluate    random.sample([x for x in range(1, 256)], 4)    random
+    ${generated_ip}=    Catenate    ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]}
+    [return]    ${generated_ip}
\ No newline at end of file
diff --git a/test/csit/tests/integration/vCPE/__init__.robot b/test/csit/tests/integration/vCPE/__init__.robot
new file mode 100644
index 0000000..b2057b0
--- /dev/null
+++ b/test/csit/tests/integration/vCPE/__init__.robot
@@ -0,0 +1,2 @@
+*** Settings ***
+Documentation    Integration - vCPE
diff --git a/test/csit/tests/integration/vCPE/test1.robot b/test/csit/tests/integration/vCPE/test1.robot
new file mode 100644
index 0000000..d9a9baf
--- /dev/null
+++ b/test/csit/tests/integration/vCPE/test1.robot
@@ -0,0 +1,34 @@
+*** Settings ***
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           Process
+
+*** Test Cases ***
+SO ServiceInstance health check
+    ${SO_IP}=    Run Docker    nexus3.onap.org:10001/openecomp/mso    i-so
+    Wait Until Keyword Succeeds    1 min    5 sec    CheckUrl    http://${SO_IP}:8080
+    Create Session    refrepo    http://${SO_IP}:8080
+    &{headers}=    Create Dictionary    Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==    Content-Type=application/json    Accept=application/json
+    ${resp}=    Get Request    refrepo    /ecomp/mso/infra/orchestrationRequests/v2    headers=${headers}
+    Should Not Contain    ${resp.content}    null
+    Kill Docker    i-so
+
+*** Keywords ***
+Run Docker
+    [Arguments]    ${image}    ${name}    ${parameters}=${EMPTY}
+    ${result}=    Run Process    docker run --name ${name} ${parameters} -d ${image}    shell=True
+    Log    all output: ${result.stdout}
+    ${result}=    Run Process    docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${name}    shell=True
+    [Return]    ${result.stdout}
+
+Kill Docker
+    [Arguments]    ${name}
+    ${result}=    Run Process    docker logs ${name}    shell=True
+    ${result}=    Run Process    docker kill ${name}    shell=True
+    ${result}=    Run Process    docker rm ${name}    shell=True
+
+CheckUrl
+    [Arguments]    ${url}
+    Create Session    session    ${url}    disable_warnings=True
+    ${resp}=    Get Request    session    /
+    Should Be Equal As Integers    ${resp.status_code}    200
diff --git a/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json
new file mode 100644
index 0000000..bb39364
--- /dev/null
+++ b/test/csit/tests/vfc/nfvo-lcm/jsoninput/create_ns.json
@@ -0,0 +1,6 @@
+{
+  "nsName": "ns1",
+  "csarId": "123",
+  "description": "ns1 desc",
+  "test": "test"
+}
\ No newline at end of file
diff --git a/test/csit/tests/vfc/nfvo-lcm/test.robot b/test/csit/tests/vfc/nfvo-lcm/test.robot
index 7f6a0d8..44d2329 100644
--- a/test/csit/tests/vfc/nfvo-lcm/test.robot
+++ b/test/csit/tests/vfc/nfvo-lcm/test.robot
@@ -1,12 +1,22 @@
 *** settings ***
+Resource    ../../common.robot
 Library     Collections
 Library     RequestsLibrary
 Library     OperatingSystem
 Library     json
+Library     HttpLibrary.HTTP
 
 *** Variables ***
-@{return_ok_list}=   200  201  202
+@{return_ok_list}=   200  201  202  204
 ${queryswagger_url}    /api/nslcm/v1/swagger.json
+${create_ns_url}    /api/nslcm/v1/ns
+${delete_ns_url}    /api/nslcm/v1/ns
+
+#json files
+${create_ns_json}    ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json
+
+#global variables
+${nsInstId}
 
 *** Test Cases ***
 NslcmSwaggerTest
@@ -29,4 +39,26 @@
     List Should Contain Value    ${return_ok_list}   ${responese_code}
     ${response_json}    json.loads    ${resp.content}
     ${swagger_version}=    Convert To String      ${response_json['swagger']}
-    Should Be Equal    ${swagger_version}    2.0
\ No newline at end of file
+    Should Be Equal    ${swagger_version}    2.0
+
+CreateNSTest
+    [Documentation]    Create NS function test
+    ${json_value}=     json_from_file      ${create_ns_json}
+    ${json_string}=     string_from_json   ${json_value}
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${MSB_IAG_IP}:80    headers=${headers}
+    Set Request Body    ${json_string}
+    ${resp}=    Post Request    web_session     ${create_ns_url}    ${json_string}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${nsInstId}=    Convert To String      ${response_json['nsInstanceId']}
+    Set Global Variable     ${nsInstId}
+
+DeleteNS Test
+    [Documentation]    Delete NS function test
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${MSB_IAG_IP}:80    headers=${headers}
+    ${resp}=    Delete Request    web_session     ${delete_ns_url}/${nsInstId}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}