blob: 483098d32093f3a60f0d08920363e3079bbba58b [file] [log] [blame]
Suchitra Vemuric365ebe2018-06-01 00:04:16 -07001// Copyright 2017-present Open Networking Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pod_config = null
16
17node ("${TestNodeName}") {
18 timeout (time: 240) {
19 stage ("Parse deployment configuration file") {
20 sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}'
21 sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}'
22 deployment_config = readYaml file: "${configRepoBaseDir}${configRepoFile}"
23 pod_config = readYaml file: "${configRepoBaseDir}${deployment_config.pod_config.file_name}"
24 }
25
26 stage('Clean up') {
27 timeout(10) {
28 try {
29 sh """
30 helm delete --purge onos-voltha
31 helm delete --purge onos-fabric
32 helm delete --purge voltha
33 helm delete --purge rcord-lite
34 helm delete --purge xos-core
35 """
36 } catch(error) { currentBuild.result = 'FAILURE' }
37 }
38 stage('Export pod config') {
39 timeout(10) {
40 try {
41 sh """
42 export KUBECONFIG=/home/cord/${pod_config.pod_config}
43 """
44 } catch(error) { currentBuild.result = 'FAILURE' }
45 }
46 stage('Install xos-core and rcord-lite') {
47 timeout(10) {
48 try {
49 sh """
50 rm -rf ~/helm-charts*
51 git clone -b ${branch} https://gerrit.opencord.org/helm-charts
52 cd helm-charts
53 helm dep update xos-core
54 helm install -n xos-core xos-core
55 helm dep update xos-profiles/rcord-lite
56 helm install -n rcord-lite xos-profiles/rcord-lite
57 """
58 } catch(error) { currentBuild.result = 'FAILURE' }
59 }
60 }
61 stage('Install voltha') {
62 timeout(10)
63 try {
64 sh """
65 cd ~/helm-charts/voltha
66 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
67 helm dep build
68 cd ~/helm-charts
69 helm install -n voltha --set etcd-operator.customResources.createEtcdClusterCRD=false voltha
70 helm upgrade --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha
71 """
72 } catch(error) { currentBuild.result = 'FAILURE' }
73 }
74 }
75 stage('Install ONOS-Voltha and ONOS-Fabric') {
76 timeout(10)
77 try {
78 sh """
79 cd ~/helm-charts
80 helm install -n onos-fabric -f configs/onos-fabric.yaml onos
81 helm install -n onos-voltha -f configs/onos-voltha.yaml onos
82 """
83 } catch(error) { currentBuild.result = 'FAILURE' }
84 }
85 }
86 stage('Download cord-tester repo') {
87 timeout(10)
88 try {
89 sh """
90 cd ~/home/cord
91 rm -rf ~/cord-tester
92 git clone -b ${branch} https://gerrit.opencord.org/cord-tester
93 """
94 } catch(error) { currentBuild.result = 'FAILURE' }
95 }
96 }
97 stage('Verify E2E XOS') {
98 timeout(10) {
99 try {
100 sh """
101 cd /home/cord/cord-tester/src/test/cord-api/Properties/
102 sed -i s/^XOS_USER\\ =\\ .*$/XOS_USER\\ =\\ \\'admin@opencord.org'/ RestApiProperties.py
103 sed -i s/^XOS_PASSWD\\ =\\ .*$/XOS_PASSWD\\ =\\ \\'letmein'/ RestApiProperties.py
104 cd /home/cord/cord-tester/src/test/cord-api/Tests
105 rm -r Log/ || true
106 pybot -d Log -T VOLTDevice_Test.txt || all_passed=false
107 pybot -d Log -T RCORDLite_E2ETest.txt || all_passed=false
108 python -m robot.testdoc Tests/*.txt TestDoc/XOSApiTests.html
109 if [ "\\\$all_passed" = true ]; then exit 0; else exit 1; fi
110 """
111 } catch(error) { currentBuild.result = 'FAILURE' }
112 }
113 }
114 stage('Publish') {
115 try {
116 sh """
117 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
118 scp -r sdn@{TestNodeName}:/home/cord/cord-tester/src/test/cord-api/Tests/Log/* ./RobotLogs || true
119 """
120 step([$class: 'RobotPublisher',
121 disableArchiveOutput: false,
122 logFileName: 'RobotLogs/log*.html',
123 otherFiles: '',
124 outputFileName: 'RobotLogs/output*.xml',
125 outputPath: '.',
126 passThreshold: 100,
127 reportFileName: 'RobotLogs/report*.html',
128 unstableThreshold: 0])
129 } catch(error) {}
130 }
131 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
132}