blob: de57a156471cba5e36f54afc0ac147edfa103381 [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 Moralesfa9eb9c2017-12-18 09:56:13 -080034 [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")]
Victor Morales4ab71c12017-11-08 07:28:28 -080035
Victor Morales5d5c5da2017-08-15 16:24:05 -050036 [Parameter(Mandatory=$True,Position=0)]
37 [ValidateNotNullOrEmpty()]
38 [String]
39 $Command
40,
41 [Parameter(Mandatory=$False,HelpMessage="Test suite to use in testing mode.")]
42 [Alias("suite")]
43 [String]
44 $s = "*"
45,
46 [Parameter(Mandatory=$False,HelpMessage="Test case to sue in testing mode.")]
47 [Alias("case")]
48 [String]
49 $c = "*"
50,
51 [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")]
52 [AllowNull()]
53 [Switch]
Victor Morales6a919972017-09-28 18:29:54 -070054 $y = $True
55,
56 [Parameter(Mandatory=$False,HelpMessage="Skips creation or retrieve image process.")]
57 [AllowNull()]
58 [Switch]
59 $skip_get_images = $True
60,
61 [Parameter(Mandatory=$False,HelpMessage="Skips warning prompt.")]
62 [AllowNull()]
63 [Switch]
64 $skip_install = $True
Victor Morales5d5c5da2017-08-15 16:24:05 -050065)
66
67if ( -Not "testing".Equals($Command) )
68 {
69 if($PsBoundParameters.ContainsKey('s'))
70 {
71 Write-Host "Test suite should only be specified in testing mode."
72 Write-Host ".\tools\Run.ps1 -?"
73 exit 1
74 }
75 if($PsBoundParameters.ContainsKey('c'))
76 {
77 Write-Host "Test case should only be specified in testing mode."
78 Write-Host ".\tools\Run.ps1 -?"
79 exit 1
80 }
81 }
82
Victor Morales6a919972017-09-28 18:29:54 -070083$env:SKIP_GET_IMAGES=$skip_get_images
84$env:SKIP_INSTALL=$skip_install
85
Victor Morales5d5c5da2017-08-15 16:24:05 -050086switch ($Command)
Victor Morales134f97a2017-08-08 16:08:19 -050087 {
88 "all_in_one" { $env:DEPLOY_MODE="all-in-one" }
Victor Moralesfa9eb9c2017-12-18 09:56:13 -080089 { @("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" }
Victor Morales134f97a2017-08-08 16:08:19 -050090 "testing"
91 {
92 $env:DEPLOY_MODE="testing"
Victor Morales5d5c5da2017-08-15 16:24:05 -050093 If(-Not $y)
94 {
95 Write-Host "Warning: This test script will delete the contents of ../opt/ and ~/.m2."
96 $yn = Read-Host "Would you like to continue? [y]es/[n]o: "
97 switch ($yn)
98 {
99 { @("n", "N") -contains $_ }
100 {
101 Write-Host "Exiting."
102 exit 0
103 }
104 }
105 }
106 $env:TEST_SUITE=$s
107 $env:TEST_CASE=$c
Victor Morales134f97a2017-08-08 16:08:19 -0500108
Victor Morales5d5c5da2017-08-15 16:24:05 -0500109 &cmd.exe /c rd /s /q .\opt\
110 &cmd.exe /c rd /s /q $HOME\.m2\
Victor Morales20163062017-08-09 10:50:44 -0500111 }
112 default
113 {
Victor Moralesd3cbcf22017-10-25 16:01:58 -0700114 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 -0500115 exit 1
Victor Morales134f97a2017-08-08 16:08:19 -0500116 }
117 }
118
Victor Morales5d5c5da2017-08-15 16:24:05 -0500119vagrant destroy -f $Command
120vagrant up $Command