blob: a74dcb72d7d970cc78a761add021f16bd65d0ee2 [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
Victor Morales6a919972017-09-28 18:29:54 -070023.PARAMETER g
24Skips creation or retrieve image process.
25
26.PARAMETER i
27Skips installation service process.
28
Victor Morales5d5c5da2017-08-15 16:24:05 -050029.LINK
30https://wiki.onap.org/display/DW/ONAP+on+Vagrant
31#>
32
33Param(
Victor Moralesd3cbcf22017-10-25 16:01:58 -070034 [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "testing")]
Victor Morales5d5c5da2017-08-15 16:24:05 -050035 [Parameter(Mandatory=$True,Position=0)]
36 [ValidateNotNullOrEmpty()]
37 [String]
38 $Command
39,
40 [Parameter(Mandatory=$False,HelpMessage="Test suite to use in testing mode.")]
41 [Alias("suite")]
42 [String]
43 $s = "*"
44,
45 [Parameter(Mandatory=$False,HelpMessage="Test case to sue in testing mode.")]
46 [Alias("case")]
47 [String]
48 $c = "*"
49,
50 [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")]
51 [AllowNull()]
52 [Switch]
Victor Morales6a919972017-09-28 18:29:54 -070053 $y = $True
54,
55 [Parameter(Mandatory=$False,HelpMessage="Skips creation or retrieve image process.")]
56 [AllowNull()]
57 [Switch]
58 $skip_get_images = $True
59,
60 [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")]
61 [AllowNull()]
62 [Switch]
63 $skip_install = $True
Victor Morales5d5c5da2017-08-15 16:24:05 -050064)
65
66if ( -Not "testing".Equals($Command) )
67 {
68 if($PsBoundParameters.ContainsKey('s'))
69 {
70 Write-Host "Test suite should only be specified in testing mode."
71 Write-Host ".\tools\Run.ps1 -?"
72 exit 1
73 }
74 if($PsBoundParameters.ContainsKey('c'))
75 {
76 Write-Host "Test case should only be specified in testing mode."
77 Write-Host ".\tools\Run.ps1 -?"
78 exit 1
79 }
80 }
81
Victor Morales6a919972017-09-28 18:29:54 -070082$env:SKIP_GET_IMAGES=$skip_get_images
83$env:SKIP_INSTALL=$skip_install
84
Victor Morales5d5c5da2017-08-15 16:24:05 -050085switch ($Command)
Victor Morales134f97a2017-08-08 16:08:19 -050086 {
87 "all_in_one" { $env:DEPLOY_MODE="all-in-one" }
Victor Moralesd3cbcf22017-10-25 16:01:58 -070088 { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp") -contains $_ } { $env:DEPLOY_MODE="individual" }
Victor Morales134f97a2017-08-08 16:08:19 -050089 "testing"
90 {
91 $env:DEPLOY_MODE="testing"
Victor Morales5d5c5da2017-08-15 16:24:05 -050092 If(-Not $y)
93 {
94 Write-Host "Warning: This test script will delete the contents of ../opt/ and ~/.m2."
95 $yn = Read-Host "Would you like to continue? [y]es/[n]o: "
96 switch ($yn)
97 {
98 { @("n", "N") -contains $_ }
99 {
100 Write-Host "Exiting."
101 exit 0
102 }
103 }
104 }
105 $env:TEST_SUITE=$s
106 $env:TEST_CASE=$c
Victor Morales134f97a2017-08-08 16:08:19 -0500107
Victor Morales5d5c5da2017-08-15 16:24:05 -0500108 &cmd.exe /c rd /s /q .\opt\
109 &cmd.exe /c rd /s /q $HOME\.m2\
Victor Morales20163062017-08-09 10:50:44 -0500110 }
111 default
112 {
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700113 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}"
Victor Morales20163062017-08-09 10:50:44 -0500114 exit 1
Victor Morales134f97a2017-08-08 16:08:19 -0500115 }
116 }
117
Victor Morales5d5c5da2017-08-15 16:24:05 -0500118vagrant destroy -f $Command
119vagrant up $Command