blob: 45ba7a2abfb9c010ce4f8c7d2b429ad31b91ba0f [file] [log] [blame]
pipeline {
agent {
label "${params.BUILD_NODE}"
}
options {
timeout(time: 60, unit: 'MINUTES')
}
environment {
SWITCH_USER = "jenkins"
STRATUM_PORT = "${params.STRATUM_PORT}"
SWITCH_ADDR = "${params.SWITCH_IP}:${STRATUM_PORT}"
SWITCH_SSH = "${SWITCH_USER}@${params.SWITCH_IP}"
CHASSIS_CONFIG = "/home/jenkins/chassis_config.pb.txt"
TREX_DIR = "/srv/trex-core-2.85-scapy-2.4.5/scripts"
PLATFORM = "x86-64-accton-wedge100bf-32qs-r0"
}
stages {
stage('Start Stratum') {
steps {
step([$class: 'WsCleanup'])
git branch: "${params.GIT_BRANCH}", credentialsId: 'github-onf-bot-ssh-key', url: "${params.GIT_URL}"
sshagent(credentials: ['menlo-pdp-32qs-jenkins']) {
sh returnStdout: false, label: "Start Stratum on ${params.SWITCH_IP}", script: '''
. ./.env
ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
scp ./ptf/tests/linerate/chassis_config.pb.txt ${SWITCH_SSH}:/home/jenkins/
ssh ${SWITCH_SSH} "docker pull ${STRATUM_DOCKER_IMG}"
ssh ${SWITCH_SSH} "docker run -itd --rm --privileged --name stratum_bfrt \
-v /dev:/dev -v /sys:/sys \
-v /lib/modules/4.14.49-OpenNetworkLinux:/lib/modules/4.14.49-OpenNetworkLinux \
--env PLATFORM=${PLATFORM} \
--network host \
-v ${CHASSIS_CONFIG}:/etc/stratum/${PLATFORM}/chassis_config.pb.txt \
-v /var/log:/var/log/stratum \
${STRATUM_DOCKER_IMG} \
--enable_onlp=false \
-bf_switchd_background=false \
-external_stratum_urls=0.0.0.0:${STRATUM_PORT} \
-incompatible_enable_bfrt_legacy_bytestring_responses \
-experimental_enable_p4runtime_translation"
'''
sh "until nc -z ${params.SWITCH_IP} ${STRATUM_PORT}; do sleep 1; done"
}
}
}
stage("Build dependencies and fabric-tna") {
steps {
withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) {
sh label: "Build dependencies and fabric-tna", script: """
make deps
make build-tester-img
make ${params.PROFILE}
"""
}
}
}
stage("Run tests in hw mode") {
steps {
script {
withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) {
sh returnStdout: false, label: "Run tests in hw mode", script: """
PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} bash .jenkins/linerate.sh
"""
}
}
}
}
stage("Run tests in sw mode") {
steps {
script {
withDockerRegistry([url: "https://registry.opennetworking.org", credentialsId: "onf-internal-registry"]) {
sh returnStdout: false, label: "Run tests in sw mode", script: """
PROFILE=${params.PROFILE} SWITCH_ADDR=${SWITCH_ADDR} TREX_PARAMS="--trex-sw-mode" PTF_FILTER="trex-sw-mode" bash .jenkins/linerate.sh
"""
}
}
}
}
}
post {
always {
sshagent(credentials: ['menlo-pdp-32qs-jenkins']) {
sh returnStdout: false, label: "Stop Stratum", script: """
ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
"""
}
archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap')
}
}
}