blob: 696f9a5afa7bd1951a5841039d8551eb2ce40c58 [file] [log] [blame]
Kailash Khalasic1a90f12018-09-13 13:13:22 -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
15node ("${TestNodeName}") {
16 timeout (100) {
17 try {
18 stage ("Parse deployment configuration file") {
19 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
20 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
21 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yml"
22 }
23 stage('Download Cord-Tester Repo') {
24 timeout(2) {
25 sh returnStdout: true, script: """
26 git clone -b ${branch} ${cordRepoUrl}/cord-tester
27 """
28 }
29 }
30 stage('Test Configurations') {
31 timeout(10) {
32 sh """
33 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
34 cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/
35 sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py
36 sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py
37 sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py
38 sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py
39 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
40 rm -rf Log/ || true
41 """
42 }
43 }
44 stage('Subscriber Validation and Ping Tests') {
45 timeout(30) {
46 sh """
47 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
48 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
49 pybot -d Log -T -v src_ip:${deployment_config.srcHost.ip} -v src_user:${deployment_config.srcHost.user} -v src_pass:${deployment_config.srcHost.pass} -v dst_user:${deployment_config.dstHost.user} -v dst_pass:${deployment_config.dstHost.pass} -v dst_ip:${deployment_config.dstHost.ip} -v dst_host_ip:${deployment_config.dstHost.hostIp} -v src_gateway:${deployment_config.srcHost.gateway} -v dst_gateway:${deployment_config.dstHost.gateway} -v src_iface:${deployment_config.srcHost.public_iface} WorkflowValidations/ATT_Test001.txt || true
50 """
51 }
52 }
53 stage('Publish test results') {
54 sh returnStdout: true, script: """
55 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
56 mkdir RobotLogs/TestDoc || true
57 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
58 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
59 """
60 step([$class: 'RobotPublisher',
61 disableArchiveOutput: false,
62 logFileName: 'RobotLogs/log*.html',
63 otherFiles: '',
64 outputFileName: 'RobotLogs/output*.xml',
65 outputPath: '.',
66 passThreshold: 100,
67 reportFileName: 'RobotLogs/report*.html',
68 unstableThreshold: 0
69 ])
70 }
71 currentBuild.result = 'SUCCESS'
72 } catch (err) {
73 currentBuild.result = 'FAILURE'
74 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
75 }
76 echo "RESULT: ${currentBuild.result}"
77 }
78}