blob: 6e04f98b8ee604516832241136a9d94c440633f3 [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: """
Kailash Khalasi135b81e2018-09-18 09:18:37 -070026 rm -rf cord-tester
Kailash Khalasic1a90f12018-09-13 13:13:22 -070027 git clone -b ${branch} ${cordRepoUrl}/cord-tester
28 """
29 }
30 }
31 stage('Test Configurations') {
32 timeout(10) {
33 sh """
34 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
35 cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/
36 sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py
37 sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py
38 sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py
39 sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py
40 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
41 rm -rf Log/ || true
42 """
43 }
44 }
45 stage('Subscriber Validation and Ping Tests') {
46 timeout(30) {
47 sh """
48 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
49 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
You Wang0c2b3662018-10-01 16:56:17 -070050 pybot -d Log -T -l log-ATT_Test001 -v src_ip:${deployment_config.hosts.src.ip} -v src_gateway:${deployment_config.hosts.src.dp_iface_gateway} -v src_user:${deployment_config.hosts.src.user} -v src_pass:${deployment_config.hosts.src.pass} -v src_iface:${deployment_config.hosts.src.dp_iface_name} -v dst_ip:${deployment_config.hosts.dst.ip} -v dst_user:${deployment_config.hosts.dst.user} -v dst_pass:${deployment_config.hosts.dst.pass} -v dst_gateway:${deployment_config.hosts.dst.dp_iface_gateway} -v dst_dp_iface:${deployment_config.hosts.dst.dp_iface_name} -v dst_dp_ip:${deployment_config.hosts.dst.dp_iface_ip_qinq} -v olt_ip:${deployment_config.olts[0].ip} -v olt_user:${deployment_config.olts[0].user} -v olt_pass:${deployment_config.olts[0].pass} -v kubernetes_conf:$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf -v kubernetes_yml:$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml WorkflowValidations/ATT_Test001.txt || true
Kailash Khalasic1a90f12018-09-13 13:13:22 -070051 """
52 }
53 }
54 stage('Publish test results') {
55 sh returnStdout: true, script: """
56 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
57 mkdir RobotLogs/TestDoc || true
58 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
59 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
60 """
61 step([$class: 'RobotPublisher',
62 disableArchiveOutput: false,
63 logFileName: 'RobotLogs/log*.html',
64 otherFiles: '',
65 outputFileName: 'RobotLogs/output*.xml',
66 outputPath: '.',
67 passThreshold: 100,
68 reportFileName: 'RobotLogs/report*.html',
69 unstableThreshold: 0
70 ])
71 }
72 currentBuild.result = 'SUCCESS'
73 } catch (err) {
74 currentBuild.result = 'FAILURE'
75 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
76 }
77 echo "RESULT: ${currentBuild.result}"
78 }
79}