---

# -----------------------------------------------------------------------
# Copyright 2021-2024 Open Networking Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
# SPDX-FileCopyrightText: 2021-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
# Entropy: 0fcb5ffa-d1a4-11ee-be5e-9f44b7181764
# -----------------------------------------------------------------------
# Intent: voltha 2.X tests
# oar image URLs that redirect away from oss to maven-central (?)
# olt, dhcpl2relay, igmpproxy, kafka
# -----------------------------------------------------------------------

- project:
    name: software-upgrades
    project-name: '{name}'

    jobs:
      - 'software-upgrades-test':
          name: 'periodic-software-upgrade-test-bbsim'
          pipeline-script: 'voltha/software-upgrades.groovy'
          pipeline-branch: 'master'
          build-node: 'ubuntu18.04-basebuild-8c-15g'
          code-branch: 'master'
          aaa-version: '2.11.2'
          aaa-oar-url: 'https://repo1.maven.org/maven2/org/opencord/aaa-app/2.11.2/aaa-app-2.11.2.oar'
          olt-version: '5.2.8'
          olt-oar-url: 'https://repo1.maven.org/maven2/org/opencord/olt-app/5.2.8/olt-app-5.2.8.oar'
          dhcpl2relay-version: '2.11.2'
          dhcpl2relay-oar-url: 'https://repo1.maven.org/maven2/org/opencord/dhcpl2relay-app/2.11.2/dhcpl2relay-app-2.11.2.oar'
          igmpproxy-version: '2.9.1'
          igmpproxy-oar-url: 'https://repo1.maven.org/maven2/org/opencord/onos-app-igmpproxy-app/2.9.1/onos-app-igmpproxy-app-2.9.1.oar'
          sadis-version: '5.12.3'
          sadis-oar-url: 'https://repo1.maven.org/maven2/org/opencord/sadis-app/5.12.3/sadis-app-5.12.3.oar'
          mcast-version: '2.9.3'
          mcast-oar-url: 'https://repo1.maven.org/maven2/org/opencord/mcast-app/2.9.3/mcast-app-2.9.3.oar'
          kafka-version: '2.13.2'
          kafka-oar-url: 'https://repo1.maven.org/maven2/org/opencord/kafka/2.13.2/kafka-2.13.2.oar'
          openolt-adapter-deploy-base-tag: '4.5.6'
          openonu-adapter-deploy-base-tag: '2.12.25'
          rw-core-deploy-base-tag: '3.6.6'
          ofagent-deploy-base-tag: '2.3.2'
          onu-image-version: 'BBSM_IMG_00002'
          onu-image-url: 'http://bbsim0:50074/images/software-image.img'
          onu-image-vendor: 'BBSM'
          onu-image-activate-on-success: 'false'
          onu-image-commit-on-success: 'false'
          onu-image-crc: '0'
          time-trigger: "H H/23 * * *"

# -----------------------------------------------------------------------
# voltha 2.14 release
# -----------------------------------------------------------------------

      - 'software-upgrades-test':
          name: 'periodic-software-upgrade-test-bbsim-2.14'
          pipeline-script: 'voltha/voltha-2.14/software-upgrades.groovy'
          pipeline-branch: 'voltha-2.14'
          build-node: 'ubuntu18.04-basebuild-8c-15g'
          code-branch: 'voltha-2.14'
          aaa-version: '2.11.2'
          aaa-oar-url: 'https://repo1.maven.org/maven2/org/opencord/aaa-app/2.11.2/aaa-app-2.11.2.oar'
          olt-version: '5.2.8'
          olt-oar-url: 'https://repo1.maven.org/maven2/org/opencord/olt-app/5.2.8/olt-app-5.2.8.oar'
          dhcpl2relay-version: '2.11.2'
          dhcpl2relay-oar-url: 'https://repo1.maven.org/maven2/org/opencord/dhcpl2relay-app/2.11.2/dhcpl2relay-app-2.11.2.oar'
          igmpproxy-version: '2.9.1'
          igmpproxy-oar-url: 'https://repo1.maven.org/maven2/org/opencord/onos-app-igmpproxy-app/2.9.1/onos-app-igmpproxy-app-2.9.1.oar'
          sadis-version: '5.12.3'
          sadis-oar-url: 'https://repo1.maven.org/maven2/org/opencord/sadis-app/5.12.3/sadis-app-5.12.3.oar'
          mcast-version: '2.9.3'
          mcast-oar-url: 'https://repo1.maven.org/maven2/org/opencord/mcast-app/2.9.3/mcast-app-2.9.3.oar'
          kafka-version: '2.13.2'
          kafka-oar-url: 'https://repo1.maven.org/maven2/org/opencord/kafka/2.13.2/kafka-2.13.2.oar'
          openolt-adapter-deploy-base-tag: '4.5.6'
          openonu-adapter-deploy-base-tag: '2.12.25'
          rw-core-deploy-base-tag: '3.6.6'
          ofagent-deploy-base-tag: '2.3.2'
          onu-image-version: 'BBSM_IMG_00002'
          onu-image-url: 'http://bbsim0:50074/images/software-image.img'
          onu-image-vendor: 'BBSM'
          onu-image-activate-on-success: 'false'
          onu-image-commit-on-success: 'false'
          onu-image-crc: '0'
          time-trigger: "H H/23 * * *"

# -----------------------------------------------------------------------
# https://docs.voltha.org/master/release_notes/voltha_2.11.html#onos-apps
# -----------------------------------------------------------------------
      - 'software-upgrades-test':
          name: 'periodic-software-upgrade-test-bbsim-2.11'
          pipeline-script: 'voltha/voltha-2.11/software-upgrades.groovy'
          pipeline-branch: 'voltha-2.11'
          build-node: 'ubuntu18.04-basebuild-8c-15g'
          code-branch: 'voltha-2.11'
          aaa-version: '2.9.0'
          aaa-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.9.0/aaa-app-2.9.0.oar'
          olt-version: '5.2.3'
          olt-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/olt-app/5.2.3/olt-app-5.2.3.oar'
          dhcpl2relay-version: '2.9.0'
          dhcpl2relay-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/dhcpl2relay-app/2.9.0/dhcpl2relay-app-2.9.0.oar'
          igmpproxy-version: '2.7.0'
          igmpproxy-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/onos-app-igmpproxy-app/2.7.0/onos-app-igmpproxy-app-2.7.0.oar'
          sadis-version: '5.10.0'
          sadis-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/sadis-app/5.10.0/sadis-app-5.10.0.oar'
          mcast-version: '2.8.0'
          mcast-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/mcast-app/2.4.0/mcast-app-2.8.0.oar'
          kafka-version: '2.11.1'
          kafka-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/kafka/2.11.1/kafka-2.11.1.oar'
          openolt-adapter-deploy-base-tag: '4.2.6'
          openonu-adapter-deploy-base-tag: '2.2.8'
          rw-core-deploy-base-tag: '3.1.8'
          ofagent-deploy-base-tag: '2.1.2'
          onu-image-version: 'BBSM_IMG_00002'
          onu-image-url: 'http://bbsim0:50074/images/software-image.img'
          onu-image-vendor: 'BBSM'
          onu-image-activate-on-success: 'false'
          onu-image-commit-on-success: 'false'
          onu-image-crc: '0'
          time-trigger: "H H/23 * * *"

# -----------------------------------------------------------------------
# to be used for voltha releases 2.9 onwards
# -----------------------------------------------------------------------
- job-template:
    id: 'software-upgrades-test'
    name: '{name}'
    sandbox: true
    volthaSystemTestsChange: ''
    volthaHelmChartsChange: ''
    kindVolthaChange: ''
    logLevel: 'DEBUG'
    logging: true

    description: |
      <!-- Managed by Jenkins Job Builder -->
      Created by {id} job-template from ci-management/jjb/software-upgrades.yaml  <br /><br />
      E2E Validation for Voltha master
    properties:
      - onf-infra-volthadevs-permissions
      - cord-infra-properties:
          build-days-to-keep: '{build-days-to-keep}'
          artifact-num-to-keep: '{artifact-num-to-keep}'

    wrappers:
      - lf-infra-wrappers:
          build-timeout: '{build-timeout}'
          jenkins-ssh-credential: '{jenkins-ssh-credential}'

    parameters:
      - string:
          name: buildNode
          default: '{build-node}'
          description: 'Name of the Jenkins node to run the job on'

      - string:
          name: extraHelmFlags
          default: ''
          description: 'Helm flags to pass to every helm install command'

      - string:
          name: volthaSystemTestsChange
          default: ''
          description: 'Download a change for gerrit in the voltha-system-tests repo, example value: "refs/changes/79/18779/13"'

      - string:
          name: volthaHelmChartsChange
          default: ''
          description: 'Download a change for gerrit in the voltha-helm-charts repo, example value: "refs/changes/79/18779/13"'

      - string:
          name: branch
          default: '{code-branch}'
          description: 'Name of the branch to use'

      - string:
          name: onosImg
          default: ''
          description: 'ONOS Image to use'

      - string:
          name: aaaVer
          default: '{aaa-version}'
          description: 'ONOS AAA App Version to Test Upgrade'

      - string:
          name: aaaOarUrl
          default: '{aaa-oar-url}'
          description: 'ONOS AAA App OAR File Url'

      - string:
          name: oltVer
          default: '{olt-version}'
          description: 'ONOS OLT App Version to Test Upgrade'

      - string:
          name: oltOarUrl
          default: '{olt-oar-url}'
          description: 'ONOS OLT App OAR File Url'

      - string:
          name: dhcpl2relayVer
          default: '{dhcpl2relay-version}'
          description: 'ONOS DHCP L2 Relay App Version to Test Upgrade'

      - string:
          name: dhcpl2relayOarUrl
          default: '{dhcpl2relay-oar-url}'
          description: 'ONOS DHCP L2 Relay App OAR File Url'

      - string:
          name: igmpproxyVer
          default: '{igmpproxy-version}'
          description: 'ONOS Igmp Proxy App Version to Test Upgrade'

      - string:
          name: igmpproxyOarUrl
          default: '{igmpproxy-oar-url}'
          description: 'ONOS Igmp Proxy App OAR File Url'

      - string:
          name: sadisVer
          default: '{sadis-version}'
          description: 'ONOS Sadis App Version to Test Upgrade'

      - string:
          name: sadisOarUrl
          default: '{sadis-oar-url}'
          description: 'ONOS Sadis App OAR File Url'

      - string:
          name: mcastVer
          default: '{mcast-version}'
          description: 'ONOS MCast App Version to Test Upgrade'

      - string:
          name: mcastOarUrl
          default: '{mcast-oar-url}'
          description: 'ONOS MCast App OAR File Url'

      - string:
          name: kafkaVer
          default: '{kafka-version}'
          description: 'ONOS Kafka App Version to Test Upgrade'

      - string:
          name: kafkaOarUrl
          default: '{kafka-oar-url}'
          description: 'ONOS Kafka App OAR File Url'

      - string:
          name: openoltAdapterDeployBaseTag
          default: '{openolt-adapter-deploy-base-tag}'
          description: 'Minimum Version of OpenOLT Adapter to be used for Deployment'

      - string:
          name: openonuAdapterDeployBaseTag
          default: '{openonu-adapter-deploy-base-tag}'
          description: 'Minimum Version of OpenONU Adapter to be used for Deployment'

      - string:
          name: rwCoreDeployBaseTag
          default: '{rw-core-deploy-base-tag}'
          description: 'Minimum Version of RW Core to be used for Deployment'

      - string:
          name: ofagentDeployBaseTag
          default: '{ofagent-deploy-base-tag}'
          description: 'Minimum Version of Ofagent to be used for Deployment'

      - string:
          name: onuImageVersion
          default: '{onu-image-version}'
          description: 'Version of ONU Image to Upgrade'

      - string:
          name: onuImageUrl
          default: '{onu-image-url}'
          description: 'Url of ONU Image to Upgrade'

      - string:
          name: onuImageVendor
          default: '{onu-image-vendor}'
          description: 'Vendor of ONU Image to Upgrade'

      - string:
          name: onuImageActivateOnSuccess
          default: '{onu-image-activate-on-success}'
          description: 'Activate ONU Image'

      - string:
          name: onuImageCommitOnSuccess
          default: '{onu-image-commit-on-success}'
          description: 'Commit ONU Image'

      - string:
          name: onuImageCrc
          default: '{onu-image-crc}'
          description: 'CRC of ONU Image to Upgrade'

      - string:
          name: logLevel
          default: '{logLevel}'
          description: 'Log level for all the components'

      - bool:
          name: logging
          default: '{logging}'
          description: 'Option to collect voltha components logs per test case'

    project-type: pipeline
    concurrent: true

    pipeline-scm:
      scm:
        - git:
            url: https://gerrit.lfbroadband.org/ci-management
            branches:
              - origin/{pipeline-branch}
      script-path: jjb/pipeline/{pipeline-script}

    triggers:
      - timed: |
                 TZ=America/Los_Angeles
                 {time-trigger}

# [EOF]
