blob: 103dfeee156edf829ddb4f74bb87e2b8fb209f8e [file] [log] [blame]
Victor Morales5d5c5da2017-08-15 16:24:05 -05001<#
2.SYNOPSIS
3This script helps to configure its environment variables based on the component selected.
4
5.EXAMPLE
6.\tools\Run.ps1 testing -s functions -c install_maven -y
7
8.EXAMPLE
9.\tools\Run.ps1 all_in_one
10
11.EXAMPLE
12.\tools\Run.ps1 aai
13
14.PARAMETER s
15Test suite to use in testing mode.
16
17.PARAMETER c
18Test case to use in testing mode.
19
20.PARAMETER y
21Skips warning prompt.
22
23.LINK
24https://wiki.onap.org/display/DW/ONAP+on+Vagrant
25#>
26
27Param(
Victor Morales000de532017-08-31 17:28:10 -050028 [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "testing")]
Victor Morales5d5c5da2017-08-15 16:24:05 -050029 [Parameter(Mandatory=$True,Position=0)]
30 [ValidateNotNullOrEmpty()]
31 [String]
32 $Command
33,
34 [Parameter(Mandatory=$False,HelpMessage="Test suite to use in testing mode.")]
35 [Alias("suite")]
36 [String]
37 $s = "*"
38,
39 [Parameter(Mandatory=$False,HelpMessage="Test case to sue in testing mode.")]
40 [Alias("case")]
41 [String]
42 $c = "*"
43,
44 [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")]
45 [AllowNull()]
46 [Switch]
47 $y = $false
48)
49
50if ( -Not "testing".Equals($Command) )
51 {
52 if($PsBoundParameters.ContainsKey('s'))
53 {
54 Write-Host "Test suite should only be specified in testing mode."
55 Write-Host ".\tools\Run.ps1 -?"
56 exit 1
57 }
58 if($PsBoundParameters.ContainsKey('c'))
59 {
60 Write-Host "Test case should only be specified in testing mode."
61 Write-Host ".\tools\Run.ps1 -?"
62 exit 1
63 }
64 }
65
66switch ($Command)
Victor Morales134f97a2017-08-08 16:08:19 -050067 {
68 "all_in_one" { $env:DEPLOY_MODE="all-in-one" }
69 { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc") -contains $_ } { $env:DEPLOY_MODE="individual" }
70 "testing"
71 {
72 $env:DEPLOY_MODE="testing"
Victor Morales5d5c5da2017-08-15 16:24:05 -050073 If(-Not $y)
74 {
75 Write-Host "Warning: This test script will delete the contents of ../opt/ and ~/.m2."
76 $yn = Read-Host "Would you like to continue? [y]es/[n]o: "
77 switch ($yn)
78 {
79 { @("n", "N") -contains $_ }
80 {
81 Write-Host "Exiting."
82 exit 0
83 }
84 }
85 }
86 $env:TEST_SUITE=$s
87 $env:TEST_CASE=$c
Victor Morales134f97a2017-08-08 16:08:19 -050088
Victor Morales5d5c5da2017-08-15 16:24:05 -050089 &cmd.exe /c rd /s /q .\opt\
90 &cmd.exe /c rd /s /q $HOME\.m2\
Victor Morales20163062017-08-09 10:50:44 -050091 }
92 default
93 {
94 Write-Output $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|testing}"
95 exit 1
Victor Morales134f97a2017-08-08 16:08:19 -050096 }
97 }
98
Victor Morales5d5c5da2017-08-15 16:24:05 -050099vagrant destroy -f $Command
100vagrant up $Command