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" |
Yi Tseng | e8cc8d3 | 2021-09-27 12:16:53 -0700 | [diff] [blame] | 15 | PLATFORM = "x86-64-accton-wedge100bf-32qs-r0" |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | stages { |
| 19 | stage('Start Stratum') { |
| 20 | steps { |
| 21 | step([$class: 'WsCleanup']) |
| 22 | git branch: "${params.GIT_BRANCH}", credentialsId: 'github-onf-bot-ssh-key', url: "${params.GIT_URL}" |
| 23 | sshagent(credentials: ['menlo-pdp-32qs-jenkins']) { |
| 24 | sh returnStdout: false, label: "Start Stratum on ${params.SWITCH_IP}", script: ''' |
| 25 | . ./.env |
Carmelo Cascone | 34c6d47 | 2021-08-22 23:14:03 -0700 | [diff] [blame] | 26 | ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 27 | scp ./ptf/tests/linerate/chassis_config.pb.txt ${SWITCH_SSH}:/home/jenkins/ |
Yi Tseng | e8cc8d3 | 2021-09-27 12:16:53 -0700 | [diff] [blame] | 28 | ssh ${SWITCH_SSH} "docker pull ${STRATUM_DOCKER_IMG}" |
| 29 | ssh ${SWITCH_SSH} "docker run -itd --rm --privileged --name stratum_bfrt \ |
| 30 | -v /dev:/dev -v /sys:/sys \ |
| 31 | -v /lib/modules/4.14.49-OpenNetworkLinux:/lib/modules/4.14.49-OpenNetworkLinux \ |
| 32 | --env PLATFORM=${PLATFORM} \ |
| 33 | --network host \ |
| 34 | -v ${CHASSIS_CONFIG}:/etc/stratum/${PLATFORM}/chassis_config.pb.txt \ |
| 35 | -v /var/log:/var/log/stratum \ |
| 36 | ${STRATUM_DOCKER_IMG} \ |
| 37 | --enable_onlp=false \ |
| 38 | -bf_switchd_background=false \ |
Yi Tseng | 2f2efea | 2022-02-09 13:33:47 -0800 | [diff] [blame^] | 39 | -external_stratum_urls=0.0.0.0:${STRATUM_PORT}" \ |
| 40 | -incompatible_enable_bfrt_legacy_bytestring_responses \ |
| 41 | -experimental_enable_p4runtime_translation |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 42 | ''' |
| 43 | sh "until nc -z ${params.SWITCH_IP} ${STRATUM_PORT}; do sleep 1; done" |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | stage('Run fabric-tna tests') { |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 48 | steps { |
| 49 | script { |
Carmelo Cascone | f983892 | 2021-08-20 13:32:45 -0700 | [diff] [blame] | 50 | withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) { |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 51 | sh returnStdout: false, label: "Build fabric-tna and run linerate tests", script: """ |
| 52 | PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} bash .jenkins/linerate.sh |
| 53 | """ |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | post { |
| 60 | always { |
| 61 | sshagent(credentials: ['menlo-pdp-32qs-jenkins']) { |
| 62 | sh returnStdout: false, label: "Stop Stratum", script: """ |
Carmelo Cascone | 34c6d47 | 2021-08-22 23:14:03 -0700 | [diff] [blame] | 63 | ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 64 | """ |
| 65 | } |
| 66 | archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap') |
| 67 | } |
| 68 | } |
| 69 | } |