Create a upstream repos validator

This Unit Test helps to validate the usage of the official
repositrories and fails in case that a minimum are not used.

Change-Id: Id5a922163a8a0d16de5460aee92e5cced3f285a3
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-Id: INT-289
diff --git a/bootstrap/vagrant-onap/lib/appc b/bootstrap/vagrant-onap/lib/appc
index 5e3858f..4d93f54 100755
--- a/bootstrap/vagrant-onap/lib/appc
+++ b/bootstrap/vagrant-onap/lib/appc
@@ -6,17 +6,20 @@
 source /var/onap/functions
 
 appc_src_folder=$git_src_folder/appc
+appc_repos=("appc" "appc/deployment")
 
 # clone_all_appc_repos() - Function that clones APPC source repo.
 function clone_all_appc_repos {
-    clone_repo appc $appc_src_folder
-    clone_repo appc/deployment $appc_src_folder/deployment
+    for repo in ${appc_repos[@]}; do
+        clone_repo $repo $appc_src_folder${repo#*appc}
+    done
 }
 
 # compile_all_appc_repos() - Function that compiles APPC source repo.
 function compile_all_appc_repos {
-    compile_src $appc_src_folder
-    compile_src $appc_src_folder/deployment
+    for repo in ${appc_repos[@]}; do
+        compile_src $appc_src_folder${repo#*appc}
+    done
 }
 
 # _build_appc_images() - Function that creates APPC images from source code.
diff --git a/bootstrap/vagrant-onap/lib/ccsdk b/bootstrap/vagrant-onap/lib/ccsdk
index 85cdf4d..03987ea 100755
--- a/bootstrap/vagrant-onap/lib/ccsdk
+++ b/bootstrap/vagrant-onap/lib/ccsdk
@@ -5,23 +5,24 @@
 source /var/onap/functions
 
 ccsdk_src_folder=$git_src_folder/ccsdk
-ccsdk_repos=("dashboard" "distribution" "parent" "platform/blueprints" "platform/nbapi" "platform/plugins" "sli" "sli/adaptors" "sli/core" "sli/northbound" "sli/plugins" "storage" "storage/esaas" "storage/pgaas" "utils")
+ccsdk_repos=("ccsdk" "ccsdk/dashboard" "ccsdk/distribution" "ccsdk/parent"
+"ccsdk/platform/blueprints" "ccsdk/platform/nbapi" "ccsdk/platform/plugins"
+"ccsdk/sli" "ccsdk/sli/adaptors" "ccsdk/sli/core" "ccsdk/sli/northbound"
+"ccsdk/sli/plugins" "ccsdk/storage" "ccsdk/storage/esaas" "ccsdk/storage/pgaas"
+"ccsdk/utils")
 
 # clone_ccsdk_repos() - Function that clones the CCSDK repositories
 function clone_ccsdk_repos {
-    clone_repo ccsdk $ccsdk_src_folder
-
-    for dirc in ${ccsdk_repos[@]}; do
-        clone_repo ccsdk/$dirc $ccsdk_src_folder/$dirc
+    for repo in ${ccsdk_repos[@]}; do
+        clone_repo $repo $ccsdk_src_folder${repo#ccsdk}
     done
 }
 
 # compile_ccsdk_repos() - 
 function compile_ccsdk_repos {
-    compile_src ccsdk $ccsdk_src_folder
-
-    for dirc in ${ccsdk_repos[@]}; do
-        compile_src $ccsdk_src_folder/$dirc
+    install_package unzip
+    for repo in ${ccsdk_repos[@]}; do
+        compile_src $ccsdk_src_folder${repo#ccsdk}
     done
 }
 
diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae
index 4995c61..78ca8de 100755
--- a/bootstrap/vagrant-onap/lib/dcae
+++ b/bootstrap/vagrant-onap/lib/dcae
@@ -5,8 +5,12 @@
 source /var/onap/functions
 
 dcae_src_folder=$git_src_folder/dcae
-dcae_repos=("apod" "apod/analytics" "apod/buildtools" "apod/cdap" "collectors" "collectors/ves" "controller" "controller/analytics" "dcae-inventory"
-"demo" "demo/startup" "demo/startup/aaf" "demo/startup/controller" "demo/startup/message-router" "dmaapbc" "operation" "operation/utils" "pgaas" "utils" "utils/buildtools")
+dcae_repos=("dcae" "dcae/apod" "dcae/apod/analytics" "dcae/apod/buildtools"
+"dcae/apod/cdap" "dcae/collectors" "dcae/collectors/ves" "dcae/controller"
+"dcae/controller/analytics" "dcae/dcae-inventory" "dcae/demo"
+"dcae/demo/startup" "dcae/demo/startup/aaf" "dcae/demo/startup/controller"
+"dcae/demo/startup/message-router" "dcae/dmaapbc" "dcae/operation"
+"dcae/operation/utils" "dcae/orch-dispatcher" "dcae/pgaas" "dcae/utils" "dcae/utils/buildtools")
 
 # _create_config_file() - Creates a configuration yaml file for the controller
 function _create_config_file {
@@ -59,16 +63,15 @@
 
 # clone_all_dcae_repos() - Function that clones DCAE source repo.
 function clone_all_dcae_repos {
-    clone_repo dcae $dcae_src_folder
-    for dirc in ${dcae_repos[@]}; do
-        clone_repo dcae/$dirc $dcae_src_folder/$dirc
+    for repo in ${dcae_repos[@]}; do
+        clone_repo $repo $dcae_src_folder${repo#*dcae}
     done
 }
 
 # compile_all_dcae_repos() - Function that compiles DCAE source repo.
 function compile_all_dcae_repos {
-    for dirc in ${dcae_repos[@]}; do
-        compile_src $dcae_src_folder/$dirc
+    for repo in ${dcae_repos[@]}; do
+        compile_src $dcae_src_folder${repo#*dcae}
     done
 }
 
diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso
index 6ff4bbe..5439d99 100755
--- a/bootstrap/vagrant-onap/lib/mso
+++ b/bootstrap/vagrant-onap/lib/mso
@@ -5,23 +5,20 @@
 source /var/onap/functions
 
 src_folder=$git_src_folder/mso
-mso_repos=("chef-repo" "docker-config" "libs" "mso-config")
+mso_repos=("mso" "mso/chef-repo" "mso/docker-config" "mso/libs"
+"mso/mso-config")
 
 # clone_all_mso_repos() - Function that clones MSO source repo.
 function clone_all_mso_repos {
-    clone_repo mso $src_folder
-
-    for dirc in ${mso_repos[@]}; do
-        clone_repo mso/$dirc $src_folder/$dirc
+    for repo in ${mso_repos[@]}; do
+        clone_repo $repo $src_folder${repo#*mso}
     done
 }
 
 # compile_all_mso_repos() - Function that compiles MSO source repo.
 function compile_all_mso_repos {
-    compile_src $src_folder
-
-    for dirc in ${mso_repos[@]}; do
-        compile_src $src_folder/$dirc
+    for repo in ${mso_repos[@]}; do
+        compile_src $src_folder${repo#*mso}
     done
 }
 
diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal
index 4dc5ef9..b5e768b 100755
--- a/bootstrap/vagrant-onap/lib/portal
+++ b/bootstrap/vagrant-onap/lib/portal
@@ -5,25 +5,29 @@
 source /var/onap/functions
 
 portal_src_folder=$git_src_folder/portal
-portal_repos=("sdk")
+portal_repos=("portal" "portal/sdk" "ecompsdkos" "ui/dmaapbc")
 
 # clone_all_portal_repos() - Function that clones Portal source repo.
 function clone_all_portal_repos {
-    clone_repo portal $portal_src_folder
-    clone_repo ecompsdkos $portal_src_folder/ecompsdkos
-    clone_repo "ui/dmaapbc" $portal_src_folder/dmaapbc
-
-    for dirc in ${portal_repos[@]}; do
-        clone_repo portal/$dirc $portal_src_folder/$dirc
+    for repo in ${portal_repos[@]}; do
+        if [[ "$repo" == "ui/dmaapbc" ]];then
+            prefix="ui"
+        else
+            prefix="portal"
+        fi
+        clone_repo $repo $portal_src_folder/${repo#*$prefix}
     done
 }
 
 # compile_all_portal_repos() - Function that compiles Portal source repo.
 function compile_all_portal_repos {
-    compile_src $portal_src_folder
-
-    for dirc in ${portal_repos[@]}; do
-        compile_src $portal_src_folder/$dirc
+    for repo in ${portal_repos[@]}; do
+        if [[ "$repo" == "ui/dmaapbc" ]];then
+            prefix="ui"
+        else
+            prefix="portal"
+        fi
+        compile_src $portal_src_folder/${repo#*$prefix}
     done
 }
 
diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc
index 1d21e13..a21e2a4 100755
--- a/bootstrap/vagrant-onap/lib/sdc
+++ b/bootstrap/vagrant-onap/lib/sdc
@@ -5,7 +5,9 @@
 source /var/onap/functions
 
 sdc_src_folder=$git_src_folder/sdc
-sdc_repos=("jtosca" "sdc-distribution-client" "sdc-docker-base" "sdc-titan-cassandra" "sdc-tosca" "sdc-vnfdesign" "sdc-workflow-designer" "sdc_common")
+sdc_repos=("sdc" "sdc/jtosca" "sdc/sdc-distribution-client"
+"sdc/sdc-docker-base" "sdc/sdc-titan-cassandra" "sdc/sdc-tosca"
+"sdc/sdc-vnfdesign" "sdc/sdc-workflow-designer" "sdc/sdc_common")
 
 # _mount_external_partition() - Create partition and mount the external volume
 function _mount_external_partition {
@@ -47,19 +49,15 @@
 
 # clone_all_sdc_repos() - Function that clones SDC source repo.
 function clone_all_sdc_repos {
-    clone_repo sdc $sdc_src_folder
-
-    for dirc in ${sdc_repos[@]}; do
-        clone_repo sdc/$dirc $sdc_src_folder/$dirc
+    for repo in ${sdc_repos[@]}; do
+        clone_repo $repo $sdc_src_folder${repo#*sdc}
     done
 }
 
 # compile_all_sdc_repos() - Function that compiles SDC source repo.
 function compile_all_sdc_repos {
-    compile_src sdc $sdc_src_folder
-
-    for dirc in ${sdc_repos[@]}; do
-        compile_src $sdc_src_folder/$dirc
+    for repo in ${sdc_repos[@]}; do
+        compile_src $sdc_src_folder${repo#*sdc}
     done
 }
 
diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid
index 83b5309..f99fd60 100755
--- a/bootstrap/vagrant-onap/lib/vid
+++ b/bootstrap/vagrant-onap/lib/vid
@@ -5,17 +5,20 @@
 source /var/onap/functions
 
 vid_src_folder=$git_src_folder/vid
+vid_repos=("vid" "vid/asdcclient")
 
 # clone_all_vid_repos() - Function that clones VID source code.
 function clone_all_vid_repos {
-    clone_repo vid $vid_src_folder
-    clone_repo vid/asdcclient $vid_src_folder/asdcclient
+    for repo in ${vid_repos[@]}; do
+        clone_repo $repo $vid_src_folder${repo#*vid}
+    done
 }
 
 # compile_all_vid_repos() - Function that compiles VID source repo.
 function compile_all_vid_repos {
-    compile_src $vid_src_folder/asdcclient
-    compile_src $vid_src_folder
+    for repo in ${vid_repos[@]}; do
+        compile_src $vid_src_folder${repo#*vid}
+    done
 }
 
 # _build_vid_images() - Function that builds VID docker images