Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 1 | pipeline { |
| 2 | agent { |
| 3 | label "${params.BUILD_NODE}" |
| 4 | } |
| 5 | options { |
| 6 | timeout(time: 60, unit: 'MINUTES') |
| 7 | } |
| 8 | environment { |
| 9 | SWITCH_USER = "jenkins" |
| 10 | STRATUM_PORT = "${params.STRATUM_PORT}" |
| 11 | SWITCH_ADDR = "${params.SWITCH_IP}:${STRATUM_PORT}" |
| 12 | SWITCH_SSH = "${SWITCH_USER}@${params.SWITCH_IP}" |
| 13 | CHASSIS_CONFIG = "/home/jenkins/chassis_config.pb.txt" |
| 14 | TREX_DIR = "/srv/trex-core-2.85-scapy-2.4.5/scripts" |
| 15 | } |
| 16 | |
| 17 | stages { |
| 18 | stage('Start Stratum') { |
| 19 | steps { |
| 20 | step([$class: 'WsCleanup']) |
| 21 | git branch: "${params.GIT_BRANCH}", credentialsId: 'github-onf-bot-ssh-key', url: "${params.GIT_URL}" |
| 22 | sshagent(credentials: ['menlo-pdp-32qs-jenkins']) { |
| 23 | sh returnStdout: false, label: "Start Stratum on ${params.SWITCH_IP}", script: ''' |
| 24 | . ./.env |
| 25 | ssh ${SWITCH_SSH} "docker stop stratum_bfrt && sudo pkill stratum" || true |
| 26 | scp ./ptf/tests/linerate/chassis_config.pb.txt ${SWITCH_SSH}:/home/jenkins/ |
| 27 | ssh ${SWITCH_SSH} "DOCKER_IMAGE_TAGGED=$STRATUM_DOCKER_IMG SDE_VERSION=$SDE_VERSION CHASSIS_CONFIG=${CHASSIS_CONFIG} \ |
| 28 | ./start-stratum-container.sh -external_stratum_urls=0.0.0.0:${STRATUM_PORT}" |
| 29 | ''' |
| 30 | sh "until nc -z ${params.SWITCH_IP} ${STRATUM_PORT}; do sleep 1; done" |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | stage('Run fabric-tna tests') { |
| 35 | options { retry(3) } |
| 36 | steps { |
| 37 | script { |
Carmelo Cascone | f983892 | 2021-08-20 13:32:45 -0700 | [diff] [blame^] | 38 | withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) { |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 39 | sh returnStdout: false, label: "Build fabric-tna and run linerate tests", script: """ |
| 40 | PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} bash .jenkins/linerate.sh |
| 41 | """ |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | post { |
| 48 | always { |
| 49 | sshagent(credentials: ['menlo-pdp-32qs-jenkins']) { |
| 50 | sh returnStdout: false, label: "Stop Stratum", script: """ |
| 51 | ssh ${SWITCH_SSH} "docker stop stratum_bfrt && sudo pkill stratum" || true |
| 52 | """ |
| 53 | } |
| 54 | archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap') |
| 55 | } |
| 56 | } |
| 57 | } |