aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
authorJuan Vidal <juan.vidal.allende@ericsson.com>2017-02-20 10:29:29 +0000
committerJuan Vidal <juan.vidal.allende@ericsson.com>2017-02-20 10:40:40 +0000
commit5807f2c7d8eb73b11331147de9a240f53b329693 (patch)
tree0bfdf03905272f78e42c67962f17b5ab1bf605d3 /functest/utils
parent0b5f01779a50b36d775a5ed8fed53106d04c450c (diff)
[odl-sfc] Add timeout to get_vnf_id and create_vnf functions
create_vnf function could end up in and endless loop if it is not able to retrieve the VNF id. Also, a timeout could help to detect problems when instantiation is too slow. Change-Id: I21744338a73f122d0c7a8fbe699738b11a7e2b76 Signed-off-by: Juan Vidal <juan.vidal.allende@ericsson.com>
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/openstack_tacker.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index d745f105..1c02e040 100644
--- a/functest/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
@@ -45,8 +45,17 @@ def get_vnfd_id(tacker_client, vnfd_name):
return get_id_from_name(tacker_client, 'vnfd', vnfd_name)
-def get_vnf_id(tacker_client, vnf_name):
- return get_id_from_name(tacker_client, 'vnf', vnf_name)
+def get_vnf_id(tacker_client, vnf_name, timeout=5):
+ vnf_id = None
+ while vnf_id is None and timeout >= 0:
+ try:
+ vnf_id = get_id_from_name(tacker_client, 'vnf', vnf_name)
+ except:
+ logger.info("Could not retrieve ID for vnf with name [%s]."
+ " Retrying." % vnf_name)
+ time.sleep(1)
+ timeout -= 1
+ return vnf_id
def get_sfc_id(tacker_client, sfc_name):
@@ -136,28 +145,23 @@ def create_vnf(tacker_client, vnf_name, vnfd_id=None,
return None
-def wait_for_vnf(t
# jenkins job templates for Daisy
# TODO
# [ ] enable baremetal jobs after baremetal deployment finish
# [ ] enable jobs in danuble
# [ ] add more scenarios
# [ ] integration with yardstick

- project:

    name: 'daisy'
    project: '{name}'
    installer: '{name}'

#--------------------------------
# BRANCH ANCHORS
#--------------------------------
    master: &master
        stream: master
        branch: '{stream}'
        disabled: false
        gs-pathname: ''
#--------------------------------
# POD, INSTALLER, AND BRANCH MAPPING
#--------------------------------
#        CI PODs
#--------------------------------
    pod:
        - baremetal:
            slave-label: daisy-baremetal
            <<: *master
        - virtual:
            slave-label: daisy-virtual
            <<: *master
#--------------------------------
#        None-CI PODs
#--------------------------------

#--------------------------------
#       scenarios
#--------------------------------
    scenario:
        # HA scenarios
        - 'os-nosdn-nofeature-ha':
            auto-trigger-name: 'daisy-{scenario}-{pod}-daily-{stream}-trigger'
        # NOHA scenarios
        - 'os-nosdn-nofeature-noha':
            auto-trigger-name: 'daisy-{scenario}-{pod}-daily-{stream}-trigger'
        # ODL_L3 scenarios
        - 'os-odl-nofeature-ha':
            auto-trigger-name: 'daisy-{scenario}-{pod}-daily-{stream}-trigger'

    jobs:
        - '{project}-{scenario}-{pod}-daily-{stream}'
        - '{project}-deploy-{pod}-daily-{stream}'

########################
# job templates
########################
- job-template:
    name: '{project}-{scenario}-{pod}-daily-{stream}'

    disabled: '{obj:disabled}'

    concurrent: false

    properties:
        - logrotate-default
        - throttle:
            enabled: true
            max-total: 4
            max-per-node: 1
            option: 'project'
        - build-blocker:
            use-build-blocker: true
            blocking-jobs:
                - 'daisy-daily-.*'
            block-level: 'NODE'

    wrappers:
        - build-name:
            name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'

    triggers:
        - '{auto-trigger-name}'

    parameters:
        - project-parameter:
            project: '{project}'
            branch: '{branch}'
        - '{installer}-defaults'
        - '{slave-label}-defaults':
            installer: '{installer}'
        - string:
            name: DEPLOY_SCENARIO
            default: '{scenario}'
        - 'daisy-project-parameter':
            gs-pathname: '{gs-pathname}'

    builders:
        - description-setter:
            description: "POD: $NODE_NAME"
        - trigger-builds:
            - project: 'daisy-deploy-{pod}-daily-{stream}'
              current-parameters: false
              predefined-parameters:
                DEPLOY_SCENARIO={scenario}
              same-node: true
              block: true
        - trigger-builds:
            - project: 'functest-daisy-{pod}-daily-{stream}'
              current-parameters: false
              predefined-parameters:
                DEPLOY_SCENARIO={scenario}
              same-node: true
              block: true
              block-thresholds:
                build-step-failure-threshold: 'never'
                failure-threshold: 'never'
                unstable-threshold: 'FAILURE'

- job-template:
    name: '{project}-deploy-{pod}-daily-{stream}'

    disabled: '{obj:disabled}'

    concurrent: true

    properties:
        - logrotate-default
        - throttle:
            enabled: true
            max-total: 4
            max-per-node: 1
            option: 'project'
        - build-blocker:
            use-build-blocker: true
            blocking-jobs:
                - 'daisy.*-deploy-({pod})?-daily-.*'
            block-level: 'NODE'

    parameters:
        - project-parameter:
            project: '{project}'
            branch: '{branch}'
        - '{installer}-defaults'
        - '{slave-label}-defaults':
            installer: '{installer}'
        - string:
            name: DEPLOY_SCENARIO
            default: 'os-nosdn-nofeature-ha'
        - 'daisy-project-parameter':
            gs-pathname: '{gs-pathname}'
        - string:
            name: DEPLOY_TIMEOUT
            default: '150'
            description: 'Deployment timeout in minutes'

    scm:
        - git-scm

    wrappers:
        - build-name:
            name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO'

    builders:
        - description-setter:
            description: "POD: $NODE_NAME"
        - shell:
            !include-raw-escape: ./daisy4nfv-download-artifact.sh
        - shell:
            !include-raw-escape: ./daisy-deploy.sh


########################
# trigger macros
########################
#-----------------------------------------------
# Triggers for job running on daisy-baremetal against master branch
#-----------------------------------------------
# Basic HA Scenarios
- trigger:
    name: 'daisy-os-nosdn-nofeature-ha-baremetal-daily-master-trigger'
    triggers:
        - timed: '0 16 * * *'
# Basic NOHA Scenarios
- trigger:
    name: 'daisy-os-nosdn-nofeature-noha-baremetal-daily-master-trigger'
    triggers:
        - timed: ''
# ODL Scenarios
- trigger:
    name: 'daisy-os-odl-nofeature-ha-baremetal-daily-master-trigger'
    triggers:
        - timed: '0 12 * * *'
#-----------------------------------------------
# Triggers for job running on daisy-virtual against master branch
#-----------------------------------------------
# Basic HA Scenarios
- trigger:
    name: 'daisy-os-nosdn-nofeature-ha-virtual-daily-master-trigger'
    triggers:
        - timed: '0 16 * * *'
# Basic NOHA Scenarios
- trigger:
    name: 'daisy-os-nosdn-nofeature-noha-virtual-daily-master-trigger'
    triggers:
        - timed: ''
# ODL Scenarios
- trigger:
    name: 'daisy-os-odl-nofeature-ha-virtual-daily-master-trigger'
    triggers:
        - timed: '0 12 * * *'