blob: 45ba7a2abfb9c010ce4f8c7d2b429ad31b91ba0f [file] [log] [blame]
Darius Grassi8b7a5e62021-07-30 15:35:04 -07001pipeline {
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 Tsenge8cc8d32021-09-27 12:16:53 -070015 PLATFORM = "x86-64-accton-wedge100bf-32qs-r0"
Darius Grassi8b7a5e62021-07-30 15:35:04 -070016 }
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 Cascone34c6d472021-08-22 23:14:03 -070026 ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
Darius Grassi8b7a5e62021-07-30 15:35:04 -070027 scp ./ptf/tests/linerate/chassis_config.pb.txt ${SWITCH_SSH}:/home/jenkins/
Yi Tsenge8cc8d32021-09-27 12:16:53 -070028 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 Morob7f3de12022-02-10 22:55:02 +010039 -external_stratum_urls=0.0.0.0:${STRATUM_PORT} \
Yi Tseng2f2efea2022-02-09 13:33:47 -080040 -incompatible_enable_bfrt_legacy_bytestring_responses \
Daniele Morob7f3de12022-02-10 22:55:02 +010041 -experimental_enable_p4runtime_translation"
Darius Grassi8b7a5e62021-07-30 15:35:04 -070042 '''
43 sh "until nc -z ${params.SWITCH_IP} ${STRATUM_PORT}; do sleep 1; done"
44 }
45 }
46 }
Daniele Morod1aa7772022-02-14 17:15:23 +010047 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 Grassi8b7a5e62021-07-30 15:35:04 -070059 steps {
60 script {
Carmelo Casconef9838922021-08-20 13:32:45 -070061 withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) {
Daniele Morod1aa7772022-02-14 17:15:23 +010062 sh returnStdout: false, label: "Run tests in hw mode", script: """
Darius Grassi8b7a5e62021-07-30 15:35:04 -070063 PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} bash .jenkins/linerate.sh
64 """
65 }
66 }
67 }
68 }
Daniele Morod1aa7772022-02-14 17:15:23 +010069 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 Grassi8b7a5e62021-07-30 15:35:04 -070080 }
81 post {
82 always {
83 sshagent(credentials: ['menlo-pdp-32qs-jenkins']) {
84 sh returnStdout: false, label: "Stop Stratum", script: """
Carmelo Cascone34c6d472021-08-22 23:14:03 -070085 ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
Darius Grassi8b7a5e62021-07-30 15:35:04 -070086 """
87 }
88 archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap')
89 }
90 }
91}