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 \ |
Daniele Moro | b7f3de1 | 2022-02-10 22:55:02 +0100 | [diff] [blame] | 39 | -external_stratum_urls=0.0.0.0:${STRATUM_PORT} \ |
Yi Tseng | 2f2efea | 2022-02-09 13:33:47 -0800 | [diff] [blame] | 40 | -incompatible_enable_bfrt_legacy_bytestring_responses \ |
Daniele Moro | b7f3de1 | 2022-02-10 22:55:02 +0100 | [diff] [blame] | 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 | } |
Daniele Moro | d1aa777 | 2022-02-14 17:15:23 +0100 | [diff] [blame^] | 47 | stage("Build dependencies and fabric-tna") { |
| 48 | steps { |
| 49 | withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) { |
| 50 | sh label: "Build dependencies and fabric-tna", script: """ |
| 51 | make deps |
| 52 | make build-tester-img |
| 53 | make ${params.PROFILE} |
| 54 | """ |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | stage("Run tests in hw mode") { |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 59 | steps { |
| 60 | script { |
Carmelo Cascone | f983892 | 2021-08-20 13:32:45 -0700 | [diff] [blame] | 61 | withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) { |
Daniele Moro | d1aa777 | 2022-02-14 17:15:23 +0100 | [diff] [blame^] | 62 | sh returnStdout: false, label: "Run tests in hw mode", script: """ |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 63 | PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} bash .jenkins/linerate.sh |
| 64 | """ |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
Daniele Moro | d1aa777 | 2022-02-14 17:15:23 +0100 | [diff] [blame^] | 69 | stage("Run tests in sw mode") { |
| 70 | steps { |
| 71 | script { |
| 72 | withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) { |
| 73 | sh returnStdout: false, label: "Run tests in sw mode", script: """ |
| 74 | PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} TREX_PARAMS="--trex-sw-mode" PTF_FILTER="trex-sw-mode" bash .jenkins/linerate.sh |
| 75 | """ |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
Darius Grassi | 8b7a5e6 | 2021-07-30 15:35:04 -0700 | [diff] [blame] | 80 | } |
| 81 | post { |
| 82 | always { |
| 83 | sshagent(credentials: ['menlo-pdp-32qs-jenkins']) { |
| 84 | sh returnStdout: false, label: "Stop Stratum", script: """ |
Carmelo Cascone | 34c6d47 | 2021-08-22 23:14:03 -0700 | [diff] [blame] | 85 | 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] | 86 | """ |
| 87 | } |
| 88 | archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap') |
| 89 | } |
| 90 | } |
| 91 | } |