blob: 9357d00e7e5839fdee88a9843d1d2278b6509d8b [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 \
Yi Tseng2f2efea2022-02-09 13:33:47 -080039 -external_stratum_urls=0.0.0.0:${STRATUM_PORT}" \
40 -incompatible_enable_bfrt_legacy_bytestring_responses \
41 -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 }
47 stage('Run fabric-tna tests') {
Darius Grassi8b7a5e62021-07-30 15:35:04 -070048 steps {
49 script {
Carmelo Casconef9838922021-08-20 13:32:45 -070050 withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) {
Darius Grassi8b7a5e62021-07-30 15:35:04 -070051 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 Cascone34c6d472021-08-22 23:14:03 -070063 ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
Darius Grassi8b7a5e62021-07-30 15:35:04 -070064 """
65 }
66 archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap')
67 }
68 }
69}