Merge "[VOL-3780] generalizing the periodic pipeline to support multiple testing scenarios"
diff --git a/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy b/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
similarity index 76%
rename from jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy
rename to jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
index eeca95a..57a6e0e 100644
--- a/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy
+++ b/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
@@ -23,7 +23,7 @@
def clusterName = "kind-ci"
-def execute_test(testName, workflow, testTarget, outputDir, testSpecificHelmFlags = "") {
+def execute_test(testTarget, workflow, testSpecificHelmFlags = "") {
def infraNamespace = "default"
def volthaNamespace = "voltha"
def robotLogsDir = "RobotLogs"
@@ -67,8 +67,8 @@
}
// start logging
sh """
- mkdir -p ${outputDir}
- _TAG=kail-${workflow} kail -n infra -n voltha > ${outputDir}/onos-voltha-combined.log &
+ mkdir -p $WORKSPACE/${testTarget}
+ _TAG=kail-${workflow} kail -n infra -n voltha > $WORKSPACE/${testTarget}/onos-voltha-combined.log &
"""
sh """
JENKINS_NODE_COOKIE="dontKillMe" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
@@ -76,13 +76,13 @@
JENKINS_NODE_COOKIE="dontKillMe" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"&
ps aux | grep port-forward
"""
- getPodsInfo("${outputDir}")
+ getPodsInfo("$WORKSPACE/${testTarget}")
}
}
stage('Run test ' + testTarget + ' on ' + workflow + ' workFlow') {
sh """
- mkdir -p $WORKSPACE/${robotLogsDir}/${testName}
- export ROBOT_MISC_ARGS="-d $WORKSPACE/${robotLogsDir}/${testName} "
+ mkdir -p $WORKSPACE/${robotLogsDir}/${testTarget}
+ export ROBOT_MISC_ARGS="-d $WORKSPACE/${robotLogsDir}/${testTarget} "
ROBOT_MISC_ARGS+="-v ONOS_SSH_PORT:30115 -v ONOS_REST_PORT:30120"
export KVSTOREPREFIX=voltha/voltha_voltha
@@ -164,57 +164,21 @@
}
}
}
+ stage('Parse and execute tests') {
+ steps {
+ script {
+ def tests = readYaml text: testTargets
- stage('Run E2E Tests 1t1gem') {
- steps {
- execute_test("1t1gem", "att", makeTarget, "$WORKSPACE/1t1gem")
- }
- }
-
- stage('Run E2E Tests 1t4gem') {
- steps {
- execute_test("1t4gem", "att", make1t4gemTestTarget, "$WORKSPACE/1t4gem")
- }
- }
-
- stage('Run E2E Tests 1t8gem') {
- steps {
- execute_test("1t8gem", "att", make1t8gemTestTarget, "$WORKSPACE/1t8gem")
- }
- }
-
- stage('Run MIB Upload Tests') {
- when { beforeAgent true; expression { return "${olts}" == "1" } }
- steps {
- script {
- def mibUploadHelmFlags = "--set pon=2,onu=2,controlledActivation=only-onu "
- execute_test("mibupload", "att", "mib-upload-templating-openonu-go-adapter-test", "$WORKSPACE/mibupload", mibUploadHelmFlags)
+ for(int i = 0;i<tests.size();i++) {
+ def test = tests[i]
+ def target = test["target"]
+ def workflow = test["workflow"]
+ def flags = test["flags"]
+ println "Executing test ${target} on workflow ${workflow} with extra flags ${flags}"
+ execute_test(target, workflow, flags)
+ }
+ }
}
- }
- }
-
- stage('Reconcile DT workflow') {
- steps {
- script {
- execute_test("ReconcileDT", "dt", makeReconcileDtTestTarget, "$WORKSPACE/ReconcileDT")
- }
- }
- }
-
- stage('Reconcile ATT workflow') {
- steps {
- script {
- execute_test("ReconcileATT", "att", makeReconcileTestTarget, "$WORKSPACE/ReconcileATT")
- }
- }
- }
-
- stage('Reconcile TT workflow') {
- steps {
- script {
- execute_test("ReconcileTT", "tt", makeReconcileTtTestTarget, "$WORKSPACE/ReconcileTT")
- }
- }
}
}
post {
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 39e22c7..22b73c5 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -73,6 +73,28 @@
name: 'periodic-voltha-openonu-go-test-bbsim'
code-branch: 'master'
time-trigger: "H H/12 * * *"
+ testTargets: |
+ - target: openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: 1t4gem-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: 1t8gem-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: mib-upload-templating-openonu-go-adapter-test
+ workflow: att
+ flags: "--set pon=2,onu=2,controlledActivation=only-onu"
+ - target: reconcile-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-test-dt
+ workflow: dt
+ flags: ""
+ - target: reconcile-openonu-go-adapter-test-tt
+ workflow: tt
+ flags: ""
- 'voltha-periodic-test':
name: 'patchset-voltha-openonu-go-test-bbsim'
@@ -80,6 +102,28 @@
code-branch: '$GERRIT_BRANCH'
gerrit-project: '$GERRIT_PROJECT'
gerritRefspec: '$GERRIT_REFSPEC'
+ testTargets: |
+ - target: openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: 1t4gem-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: 1t8gem-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: mib-upload-templating-openonu-go-adapter-test
+ workflow: att
+ flags: "--set pon=2,onu=2,controlledActivation=only-onu"
+ - target: reconcile-openonu-go-adapter-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-test-dt
+ workflow: dt
+ flags: ""
+ - target: reconcile-openonu-go-adapter-test-tt
+ workflow: tt
+ flags: ""
- 'voltha-periodic-test-kind-voltha-based':
name: 'periodic-voltha-openonu-go-test-bbsim-2.7'
@@ -101,12 +145,25 @@
olts: 2
onus: 2
pons: 2
- make-target: openonu-go-adapter-multi-olt-test
- make-target-1t4gemtest: 1t4gem-openonu-go-adapter-multi-olt-test
- make-target-1t8gemtest: 1t8gem-openonu-go-adapter-multi-olt-test
- make-target-reconciletest: reconcile-openonu-go-adapter-multi-olt-test
- make-target-reconciledttest: reconcile-openonu-go-adapter-multi-olt-test-dt
- make-target-reconciletttest: reconcile-openonu-go-adapter-multi-olt-test-tt
+ testTargets: |
+ - target: openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: 1t4gem-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: 1t8gem-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test-dt
+ workflow: dt
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test-tt
+ workflow: tt
+ flags: ""
time-trigger: "H H/12 * * *"
- 'voltha-periodic-test':
@@ -115,12 +172,25 @@
code-branch: '$GERRIT_BRANCH'
gerrit-project: '$GERRIT_PROJECT'
gerritRefspec: '$GERRIT_REFSPEC'
- make-target: openonu-go-adapter-multi-olt-test
- make-target-1t4gemtest: 1t4gem-openonu-go-adapter-multi-olt-test
- make-target-1t8gemtest: 1t8gem-openonu-go-adapter-multi-olt-test
- make-target-reconciletest: reconcile-openonu-go-adapter-multi-olt-test
- make-target-reconciledttest: reconcile-openonu-go-adapter-multi-olt-test-dt
- make-target-reconciletttest: reconcile-openonu-go-adapter-multi-olt-test-tt
+ testTargets: |
+ - target: openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: 1t4gem-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: 1t8gem-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test
+ workflow: att
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test-dt
+ workflow: dt
+ flags: ""
+ - target: reconcile-openonu-go-adapter-multi-olt-test-tt
+ workflow: tt
+ flags: ""
olts: 2
onus: 2
pons: 2
@@ -296,12 +366,9 @@
default-test-args: '-i sanityORDeleteOLT -i PowerSwitch -X'
- job-template:
- # as of now this template is only used by the openonu-go periodic test,
- # in order to use for multiple pipelines we should change it so that
- # we can specify a list of make targets and iterate over that
id: 'voltha-periodic-test'
name: '{name}'
- pipeline-script: 'voltha/master/openonu-go-periodic-test-bbsim.groovy'
+ pipeline-script: 'voltha/master/periodic-bbsim-tests.groovy'
build-node: 'ubuntu18.04-basebuild-8c-15g'
test-runs: 1
robot-args: ''
@@ -313,12 +380,7 @@
extraHelmFlags: ''
sandbox: true
olts: 1
- make-target: openonu-go-adapter-test
- make-target-1t4gemtest: 1t4gem-openonu-go-adapter-test
- make-target-1t8gemtest: 1t8gem-openonu-go-adapter-test
- make-target-reconciletest: reconcile-openonu-go-adapter-test
- make-target-reconciledttest: reconcile-openonu-go-adapter-test-dt
- make-target-reconciletttest: reconcile-openonu-go-adapter-test-tt
+
trigger-comment: vv7CBoQQYYonvaN8xcru
time-trigger: 0 0 29 2 *
@@ -346,59 +408,20 @@
- string:
name: extraHelmFlags
default: '--set onu={onus},pon={pons},{extraHelmFlags}'
- description: 'Helm flags to pass to ./voltha up'
+ description: 'Helm flags (passed to each deployment)'
- # TODO is there a better way to manage the test targets?
- # maybe we can use a comma separated list?
- - string:
- name: makeTarget
- default: '{make-target}'
- description: 'Makefile target to invoke during test'
-
- - string:
- name: makeFailtestTarget
- default: '{make-target-failtest}'
- description: 'Makefile target to invoke during failure/based test'
-
- - string:
- name: makeMultiOltTarget
- default: '{make-target-multipleolt}'
- description: 'Makefile target to invoke during multiple olt test'
-
- - string:
- name: makeErrortestTarget
- default: '{make-target-errortest}'
- description: 'Makefile target to invoke during error test'
-
- - string:
- name: makeAlarmtestTarget
- default: '{make-target-alarmtest}'
- description: 'Makefile target to invoke during alarm test'
-
- - string:
- name: make1t4gemTestTarget
- default: '{make-target-1t4gemtest}'
- description: 'Makefile target to invoke during 1t4gem test'
-
- - string:
- name: make1t8gemTestTarget
- default: '{make-target-1t8gemtest}'
- description: 'Makefile target to invoke during 1t8gem test'
-
- - string:
- name: makeReconcileTestTarget
- default: '{make-target-reconciletest}'
- description: 'Makefile target to invoke during reconcile test'
-
- - string:
- name: makeReconcileDtTestTarget
- default: '{make-target-reconciledttest}'
- description: 'Makefile target to invoke during reconcile dt test'
-
- - string:
- name: makeReconcileTtTestTarget
- default: '{make-target-reconciletttest}'
- description: 'Makefile target to invoke during reconcile tt test'
+ # test configuration
+ # this is a parameter to drive the test execution, VOLTHA is redeployed each time with
+ # the provided configuration and then the make target is invoked,
+ # example value (has to be valid YAML):
+ # testTargets: |
+ # - target: openonu-go-adapter-test
+ # workflow: att
+ # flags: ""
+ - text:
+ name: testTargets
+ default: '{testTargets}'
+ description: 'Test configuration, see the ci-management job definition for more info'
- string:
name: branch