Run ODL CSIT on Apex from Cperf container
[releng.git] / jjb / cperf / cperf-ci-jobs.yaml
1 ---
2 ###################################
3 # job configuration for cperf
4 ###################################
5 - project:
6     name: cperf-ci-jobs
7     project: cperf
8
9     # -------------------------------
10     # BRANCH ANCHORS
11     # -------------------------------
12     stream: master
13     branch: '{stream}'
14     gs-pathname: ''
15     docker-tag: 'latest'
16
17     installer: apex
18
19     testsuite:
20       - csit
21       - cbench
22
23     jobs:
24       - 'cperf-{installer}-{testsuite}-{stream}'
25
26 ################################
27 # job template
28 ################################
29 - job-template:
30     name: 'cperf-{installer}-{testsuite}-{stream}'
31
32     concurrent: true
33
34     properties:
35       - throttle:
36           enabled: true
37           max-per-node: 1
38           option: 'project'
39
40     wrappers:
41       - build-name:
42           name: '$BUILD_NUMBER Suite: $CPERF_SUITE_NAME ODL BRANCH: $ODL_BRANCH'
43       - timeout:
44           timeout: 400
45           abort: true
46
47     parameters:
48       - cperf-parameter:
49           testsuite: '{testsuite}'
50           gs-pathname: '{gs-pathname}'
51           docker-tag: '{docker-tag}'
52           stream: '{stream}'
53
54     builders:
55       - 'cperf-{testsuite}-builder'
56
57 ########################
58 # parameter macros
59 ########################
60 - parameter:
61     name: cperf-parameter
62     parameters:
63       - string:
64           name: CPERF_SUITE_NAME
65           default: '{testsuite}'
66           description: "Suite name to run"
67       - string:
68           name: ODL_BRANCH
69           default: 'master'
70           description: "Branch that OpenDaylight is running"
71       - string:
72           name: OS_VERSION
73           default: 'master'
74           description: "OpenStack version (short name, no stable/ prefix)"
75       - string:
76           name: GS_PATHNAME
77           default: '{gs-pathname}'
78           description: "Version directory where the opnfv documents will be stored in gs repository"
79       - string:
80           name: CI_DEBUG
81           default: 'false'
82           description: "Show debug output information"
83       - string:
84           name: DOCKER_TAG
85           default: '{docker-tag}'
86           description: 'Tag to pull docker image'
87       - string:
88           name: RC_FILE_PATH
89           default: ''
90           description: "Path to the OS credentials file if given"
91       - string:
92           name: SSH_KEY_PATH
93           default: ''
94           description: "Path to the private SSH key to access OPNFV nodes"
95       - string:
96           name: NODE_FILE_PATH
97           default: ''
98           description: "Path to the yaml file describing overcloud nodes"
99       - string:
100           name: ODL_CONTAINERIZED
101           default: 'true'
102           description: "boolean set true if ODL on overcloud is a container"
103
104 ########################
105 # trigger macros
106 ########################
107
108 ########################
109 # builder macros
110 ########################
111 - builder:
112     name: cperf-csit-builder
113     builders:
114       - 'cperf-cleanup'
115       - 'cperf-prepare-robot'
116       - 'cperf-robot-netvirt-csit'
117
118 - builder:
119     name: cperf-cbench-builder
120     builders:
121       - 'cperf-cleanup'
122       - 'cperf-prepare-robot'
123       - 'cperf-robot-cbench'
124
125 - builder:
126     name: cperf-prepare-robot
127     builders:
128       - shell:
129           !include-raw: ./cperf-prepare-robot.sh
130
131 - builder:
132     name: cperf-robot-cbench
133     builders:
134       - shell: |
135           #!/bin/bash
136           set -o errexit
137           set -o nounset
138           set -o pipefail
139
140           # cbench requires the openflow drop test feature to be installed.
141           sshpass -p karaf ssh -o StrictHostKeyChecking=no \
142                                -o UserKnownHostsFile=/dev/null \
143                                -o LogLevel=error \
144                                -p 8101 karaf@$SDN_CONTROLLER_IP \
145                                 feature:install odl-openflowplugin-flow-services-ui odl-openflowplugin-drop-test
146
147           robot_cmd="pybot -e exclude -L TRACE -d /tmp \
148                       -v ODL_SYSTEM_1_IP:${SDN_CONTROLLER_IP} \
149                       -v ODL_SYSTEM_IP:${SDN_CONTROLLER_IP} \
150                       -v BUNDLEFOLDER:/opt/opendaylight \
151                       -v RESTCONFPORT:8081 \
152                       -v USER_HOME:/tmp \
153                       -v USER:heat-admin \
154                       -v ODL_SYSTEM_USER:heat-admin \
155                       -v TOOLS_SYSTEM_IP:localhost \
156                       -v of_port:6653"
157           robot_suite="/home/opnfv/repos/odl_test/csit/suites/openflowplugin/Performance/010_Cbench.robot"
158
159           docker run -i -v /tmp:/tmp opnfv/cperf:$DOCKER_TAG ${robot_cmd} ${robot_suite}
160
161 - builder:
162     name: cperf-robot-netvirt-csit
163     builders:
164       - shell:
165           !include-raw: ./cperf-robot-netvirt-csit.sh
166
167 - builder:
168     name: cperf-cleanup
169     builders:
170       - shell: |
171           #!/bin/bash
172           [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
173
174           echo "Cleaning up docker containers/images..."
175           # Remove previous running containers if exist
176           if [[ ! -z $(docker ps -a | grep opnfv/cperf) ]]; then
177               echo "Removing existing opnfv/cperf containers..."
178               docker ps -a | grep opnfv/cperf | awk '{print $1}' | xargs docker rm -f >${redirect}
179           fi
180
181           # Remove existing images if exist
182           if [[ ! -z $(docker images | grep opnfv/cperf) ]]; then
183               echo "Docker images to remove:"
184               docker images | head -1 && docker images | grep opnfv/cperf >${redirect}
185               image_tags=($(docker images | grep opnfv/cperf | awk '{print $2}'))
186               for tag in "${image_tags[@]}"; do
187                   echo "Removing docker image opnfv/cperf:$tag..."
188                   docker rmi opnfv/cperf:$tag >/dev/null
189               done
190           fi