diff options
author | Victor Morales <victor.morales@intel.com> | 2018-03-13 12:26:08 -0700 |
---|---|---|
committer | Victor Morales <victor.morales@intel.com> | 2018-03-13 12:26:08 -0700 |
commit | 4d7590ed7425a94c0f87a8461548c2461d79a710 (patch) | |
tree | 083ffc33a4cd6d8eff42deeea1da0b50c49efdfe /tools/Run.ps1 | |
parent | ceb22354fcb078e8991a66dc9bc11dd5f21e77f4 (diff) |
Migrate vagrant-onap to devtool repo
This change covers the migration of the vagrant-onap tool's code
which was located under integration repo to devtool's repository.
The tool was renamed to avoid misunderstandings about its goals.
Change-Id: I79df8c35fccaa266a789217d441a6cf1183bd42a
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: INT-441
Diffstat (limited to 'tools/Run.ps1')
-rw-r--r-- | tools/Run.ps1 | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/tools/Run.ps1 b/tools/Run.ps1 new file mode 100644 index 0000000..de57a15 --- /dev/null +++ b/tools/Run.ps1 @@ -0,0 +1,120 @@ +<# +.SYNOPSIS +This script helps to configure its environment variables based on the component selected. + +.EXAMPLE +.\tools\Run.ps1 testing -s functions -c install_maven -y + +.EXAMPLE +.\tools\Run.ps1 all_in_one + +.EXAMPLE +.\tools\Run.ps1 aai + +.PARAMETER s +Test suite to use in testing mode. + +.PARAMETER c +Test case to use in testing mode. + +.PARAMETER y +Skips warning prompt. + +.PARAMETER g +Skips creation or retrieve image process. + +.PARAMETER i +Skips installation service process. + +.LINK +https://wiki.onap.org/display/DW/ONAP+on+Vagrant +#> + +Param( + [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom", "testing")] + + [Parameter(Mandatory=$True,Position=0)] + [ValidateNotNullOrEmpty()] + [String] + $Command +, + [Parameter(Mandatory=$False,HelpMessage="Test suite to use in testing mode.")] + [Alias("suite")] + [String] + $s = "*" +, + [Parameter(Mandatory=$False,HelpMessage="Test case to sue in testing mode.")] + [Alias("case")] + [String] + $c = "*" +, + [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")] + [AllowNull()] + [Switch] + $y = $True +, + [Parameter(Mandatory=$False,HelpMessage="Skips creation or retrieve image process.")] + [AllowNull()] + [Switch] + $skip_get_images = $True +, + [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")] + [AllowNull()] + [Switch] + $skip_install = $True +) + +if ( -Not "testing".Equals($Command) ) + { + if($PsBoundParameters.ContainsKey('s')) + { + Write-Host "Test suite should only be specified in testing mode." + Write-Host ".\tools\Run.ps1 -?" + exit 1 + } + if($PsBoundParameters.ContainsKey('c')) + { + Write-Host "Test case should only be specified in testing mode." + Write-Host ".\tools\Run.ps1 -?" + exit 1 + } + } + +$env:SKIP_GET_IMAGES=$skip_get_images +$env:SKIP_INSTALL=$skip_install + +switch ($Command) + { + "all_in_one" { $env:DEPLOY_MODE="all-in-one" } + { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom") -contains $_ } { $env:DEPLOY_MODE="individual" } + "testing" + { + $env:DEPLOY_MODE="testing" + If(-Not $y) + { + Write-Host "Warning: This test script will delete the contents of ../opt/ and ~/.m2." + $yn = Read-Host "Would you like to continue? [y]es/[n]o: " + switch ($yn) + { + { @("n", "N") -contains $_ } + { + Write-Host "Exiting." + exit 0 + } + } + } + $env:TEST_SUITE=$s + $env:TEST_CASE=$c + + &cmd.exe /c rd /s /q .\opt\ + &cmd.exe /c rd /s /q $HOME\.m2\ + } + default + { + Write-Output $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk|vnfsdk|vvp|testing}" + exit 1 + } + } + +vagrant destroy -f $Command +vagrant up $Command |