diff options
22 files changed, 564 insertions, 162 deletions
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index a395cf2e5..2b69d59c2 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -13,13 +13,14 @@ - 'apex-csit-promote-daily-{stream}' - 'apex-fdio-promote-daily-{stream}' - 'apex-verify-iso-{stream}' - - 'apex-run-deploy-test-baremetal-{stream}' + - 'apex-{scenario}-baremetal-{scenario_stream}' + - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' - 'apex-upload-snapshot' - 'apex-create-snapshot' # stream: branch with - in place of / (eg. stable-arno) # branch: branch (eg. stable/arno) stream: - - master: + - master: &master branch: 'master' gs-pathname: '' build-slave: 'apex-build-master' @@ -27,8 +28,9 @@ baremetal-slave: 'apex-baremetal-master' verify-scenario: 'os-odl-nofeature-ha' concurrent-builds: 3 + scenario_stream: 'master' - - danube: + - danube: &danube branch: 'stable/danube' gs-pathname: '/danube' build-slave: 'apex-build-danube' @@ -36,7 +38,72 @@ baremetal-slave: 'apex-baremetal-danube' verify-scenario: 'os-odl_l3-nofeature-ha' concurrent-builds: 1 - disabled: false + scenario_stream: 'danube' + disabled: true + + scenario: + - 'os-nosdn-nofeature-noha': + <<: *danube + - 'os-nosdn-nofeature-ha': + <<: *danube + - 'os-nosdn-nofeature-ha-ipv6': + <<: *danube + - 'os-nosdn-ovs-noha': + <<: *danube + - 'os-nosdn-ovs-ha': + <<: *danube + - 'os-nosdn-fdio-noha': + <<: *danube + - 'os-nosdn-fdio-ha': + <<: *danube + - 'os-nosdn-kvm-ha': + <<: *danube + - 'os-nosdn-kvm-noha': + <<: *danube + - 'os-odl_l2-fdio-noha': + <<: *danube + - 'os-odl_l2-fdio-ha': + <<: *danube + - 'os-odl_netvirt-fdio-noha': + <<: *danube + - 'os-odl_l2-sfc-noha': + <<: *danube + - 'os-odl_l3-nofeature-noha': + <<: *danube + - 'os-odl_l3-nofeature-ha': + <<: *danube + - 'os-odl_l3-ovs-noha': + <<: *danube + - 'os-odl_l3-ovs-ha': + <<: *danube + - 'os-odl-bgpvpn-ha': + <<: *danube + - 'os-odl-gluon-noha': + <<: *danube + - 'os-odl_l3-fdio-noha': + <<: *danube + - 'os-odl_l3-fdio-ha': + <<: *danube + - 'os-odl_l3-fdio_dvr-noha': + <<: *danube + - 'os-odl_l3-fdio_dvr-ha': + <<: *danube + - 'os-odl_l3-csit-noha': + <<: *danube + - 'os-onos-nofeature-ha': + <<: *danube + - 'os-ovn-nofeature-noha': + <<: *danube + - 'os-nosdn-nofeature-noha': + <<: *master + - 'os-nosdn-nofeature-ha': + <<: *master + - 'os-odl-nofeature-ha': + <<: *master + - 'os-odl-nofeature-noha': + <<: *master + - 'os-odl-bgpvpn-ha': + <<: *master platform: - 'baremetal' @@ -478,11 +545,6 @@ - job-template: name: 'apex-deploy-{platform}-{stream}' - # Job template for virtual deployment - # - # Required Variables: - # stream: branch with - in place of / (eg. stable) - # branch: branch (eg. stable) node: 'apex-{platform}-{stream}' concurrent: true @@ -498,6 +560,7 @@ fail: true parameters: + - '{project}-{platform}-{stream}-defaults' - project-parameter: project: '{project}' branch: '{branch}' @@ -536,13 +599,8 @@ # Baremetal Deploy and Test - job-template: - name: 'apex-run-deploy-test-baremetal-{stream}' + name: 'apex-{scenario}-baremetal-{scenario_stream}' - # Job template for daily build - # - # Required Variables: - # stream: branch with - in place of / (eg. stable) - # branch: branch (eg. stable) project-type: 'multijob' disabled: false @@ -552,7 +610,7 @@ parameters: - '{project}-defaults' - - '{project}-baremetal-{stream}-defaults' + - '{project}-baremetal-{scenario_stream}-defaults' - project-parameter: project: '{project}' branch: '{branch}' @@ -560,7 +618,7 @@ gs-pathname: '{gs-pathname}' - string: name: DEPLOY_SCENARIO - default: '{verify-scenario}' + default: '{scenario}' description: "Scenario to deploy with." properties: - logrotate-default @@ -572,6 +630,11 @@ - 'apex-runner.*' - 'apex-.*-promote.*' - 'apex-run.*' + - 'apex-.+-baremetal-.+' + - throttle: + max-per-node: 1 + max-total: 10 + option: 'project' builders: - description-setter: description: "Deployed on $NODE_NAME - Scenario: $DEPLOY_SCENARIO" @@ -579,7 +642,7 @@ name: 'Baremetal Deploy' condition: ALWAYS projects: - - name: 'apex-deploy-baremetal-{stream}' + - name: 'apex-deploy-baremetal-{scenario_stream}' node-parameters: true current-parameters: true predefined-parameters: | @@ -591,10 +654,62 @@ abort-all-job: true git-revision: false - multijob: + name: 'OPNFV Test Suite' + condition: SUCCESSFUL + projects: + - name: 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' + node-parameters: true + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO=$DEPLOY_SCENARIO + kill-phase-on: NEVER + abort-all-job: true + git-revision: false + + +# Baremetal test job +- job-template: + name: 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' + + project-type: 'multijob' + + disabled: false + + parameters: + - '{project}-defaults' + - '{project}-baremetal-{scenario_stream}-defaults' + - project-parameter: + project: '{project}' + branch: '{branch}' + - apex-parameter: + gs-pathname: '{gs-pathname}' + - string: + name: DEPLOY_SCENARIO + default: '{scenario}' + description: "Scenario to deploy with." + properties: + - logrotate-default + - build-blocker: + use-build-blocker: true + block-level: 'NODE' + blocking-jobs: + - 'apex-verify.*' + - 'apex-runner.*' + - 'apex-.*-promote.*' + - 'apex-run.*' + - 'apex-testsuite-.+-baremetal-.+' + - throttle: + max-per-node: 1 + max-total: 10 + option: 'project' + builders: + - description-setter: + description: "Testing on $NODE_NAME - Scenario: $DEPLOY_SCENARIO" + - multijob: name: Functest condition: ALWAYS projects: - - name: 'functest-apex-baremetal-daily-{stream}' + - name: 'functest-apex-baremetal-daily-{scenario_stream}' node-parameters: true current-parameters: false predefined-parameters: @@ -606,7 +721,7 @@ name: Yardstick condition: ALWAYS projects: - - name: 'yardstick-apex-baremetal-daily-{stream}' + - name: 'yardstick-apex-baremetal-daily-{scenario_stream}' node-parameters: true current-parameters: false predefined-parameters: @@ -614,6 +729,13 @@ kill-phase-on: NEVER abort-all-job: false git-revision: false + - conditional-step: + condition-kind: current-status + condition-worst: SUCCESS + condtion-best: SUCCESS + on-evaluation-failure: mark-unstable + steps: + - shell: 'echo "Tests Passed"' # danube Daily @@ -686,261 +808,235 @@ condition: SUCCESSFUL projects: - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-nofeature-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-nofeature-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-nofeature-ha-ipv6-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-ha-ipv6 OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-ovs-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-ovs-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-ovs-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-ovs-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-fdio-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-fdio-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-fdio-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-fdio-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-kvm-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-kvm-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-nosdn-kvm-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-kvm-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l2-fdio-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l2-fdio-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l2-fdio-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l2-fdio-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_netvirt-fdio-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_netvirt-fdio-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l2-sfc-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l2-sfc-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-nofeature-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-nofeature-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-nofeature-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-nofeature-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-ovs-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-ovs-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-ovs-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-ovs-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl-bgpvpn-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl-bgpvpn-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl-gluon-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl-gluon-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-fdio-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-fdio-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-fdio-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-fdio-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-fdio_dvr-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-fdio_dvr-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-fdio_dvr-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-fdio_dvr-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-odl_l3-csit-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl_l3-csit-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-onos-nofeature-ha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-onos-nofeature-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-danube' + - name: 'apex-os-ovn-nofeature-noha-baremetal-danube' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-ovn-nofeature-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true @@ -1017,41 +1113,46 @@ condition: SUCCESSFUL projects: - - name: 'apex-run-deploy-test-baremetal-master' + - name: 'apex-os-nosdn-nofeature-noha-baremetal-master' + node-parameters: false + current-parameters: false + predefined-parameters: | + OPNFV_CLEAN=yes + kill-phase-on: NEVER + abort-all-job: true + git-revision: false + + - name: 'apex-os-nosdn-nofeature-ha-baremetal-master' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-master' + - name: 'apex-os-odl-nofeature-ha-baremetal-master' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-master' + - name: 'apex-os-odl-nofeature-noha-baremetal-master' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl-nofeature-ha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true git-revision: false - - name: 'apex-run-deploy-test-baremetal-master' + - name: 'apex-os-odl-bgpvpn-ha-baremetal-master' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO=os-odl-nofeature-noha OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true @@ -1385,8 +1486,8 @@ - trigger: name: 'apex-master' triggers: - - timed: '0 3 1 1 7' + - timed: '0 12 * * *' - trigger: name: 'apex-danube' triggers: - - timed: '0 12 * * *' + - timed: '0 3 1 1 7' diff --git a/jjb/apex/apex.yml.j2 b/jjb/apex/apex.yml.j2 index 752cf281d..06cc2ca2e 100644 --- a/jjb/apex/apex.yml.j2 +++ b/jjb/apex/apex.yml.j2 @@ -13,13 +13,14 @@ - 'apex-csit-promote-daily-{stream}' - 'apex-fdio-promote-daily-{stream}' - 'apex-verify-iso-{stream}' - - 'apex-run-deploy-test-baremetal-{stream}' + - 'apex-{scenario}-baremetal-{scenario_stream}' + - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' - 'apex-upload-snapshot' - 'apex-create-snapshot' # stream: branch with - in place of / (eg. stable-arno) # branch: branch (eg. stable/arno) stream: - - master: + - master: &master branch: 'master' gs-pathname: '' build-slave: 'apex-build-master' @@ -27,8 +28,9 @@ baremetal-slave: 'apex-baremetal-master' verify-scenario: 'os-odl-nofeature-ha' concurrent-builds: 3 + scenario_stream: 'master' - - danube: + - danube: &danube branch: 'stable/danube' gs-pathname: '/danube' build-slave: 'apex-build-danube' @@ -36,7 +38,16 @@ baremetal-slave: 'apex-baremetal-danube' verify-scenario: 'os-odl_l3-nofeature-ha' concurrent-builds: 1 - disabled: false + scenario_stream: 'danube' + disabled: true + + scenario: + {%- for stream in scenarios %} + {%- for scenario in scenarios[stream] %} + - '{{scenario}}': + <<: *{{stream}} + {%- endfor %} + {%- endfor %} platform: - 'baremetal' @@ -478,11 +489,6 @@ - job-template: name: 'apex-deploy-{platform}-{stream}' - # Job template for virtual deployment - # - # Required Variables: - # stream: branch with - in place of / (eg. stable) - # branch: branch (eg. stable) node: 'apex-{platform}-{stream}' concurrent: true @@ -498,6 +504,7 @@ fail: true parameters: + - '{project}-{platform}-{stream}-defaults' - project-parameter: project: '{project}' branch: '{branch}' @@ -536,13 +543,8 @@ # Baremetal Deploy and Test - job-template: - name: 'apex-run-deploy-test-baremetal-{stream}' + name: 'apex-{scenario}-baremetal-{scenario_stream}' - # Job template for daily build - # - # Required Variables: - # stream: branch with - in place of / (eg. stable) - # branch: branch (eg. stable) project-type: 'multijob' disabled: false @@ -552,7 +554,7 @@ parameters: - '{project}-defaults' - - '{project}-baremetal-{stream}-defaults' + - '{project}-baremetal-{scenario_stream}-defaults' - project-parameter: project: '{project}' branch: '{branch}' @@ -560,7 +562,7 @@ gs-pathname: '{gs-pathname}' - string: name: DEPLOY_SCENARIO - default: '{verify-scenario}' + default: '{scenario}' description: "Scenario to deploy with." properties: - logrotate-default @@ -572,6 +574,11 @@ - 'apex-runner.*' - 'apex-.*-promote.*' - 'apex-run.*' + - 'apex-.+-baremetal-.+' + - throttle: + max-per-node: 1 + max-total: 10 + option: 'project' builders: - description-setter: description: "Deployed on $NODE_NAME - Scenario: $DEPLOY_SCENARIO" @@ -579,7 +586,7 @@ name: 'Baremetal Deploy' condition: ALWAYS projects: - - name: 'apex-deploy-baremetal-{stream}' + - name: 'apex-deploy-baremetal-{scenario_stream}' node-parameters: true current-parameters: true predefined-parameters: | @@ -591,10 +598,62 @@ abort-all-job: true git-revision: false - multijob: + name: 'OPNFV Test Suite' + condition: SUCCESSFUL + projects: + - name: 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' + node-parameters: true + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO=$DEPLOY_SCENARIO + kill-phase-on: NEVER + abort-all-job: true + git-revision: false + + +# Baremetal test job +- job-template: + name: 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' + + project-type: 'multijob' + + disabled: false + + parameters: + - '{project}-defaults' + - '{project}-baremetal-{scenario_stream}-defaults' + - project-parameter: + project: '{project}' + branch: '{branch}' + - apex-parameter: + gs-pathname: '{gs-pathname}' + - string: + name: DEPLOY_SCENARIO + default: '{scenario}' + description: "Scenario to deploy with." + properties: + - logrotate-default + - build-blocker: + use-build-blocker: true + block-level: 'NODE' + blocking-jobs: + - 'apex-verify.*' + - 'apex-runner.*' + - 'apex-.*-promote.*' + - 'apex-run.*' + - 'apex-testsuite-.+-baremetal-.+' + - throttle: + max-per-node: 1 + max-total: 10 + option: 'project' + builders: + - description-setter: + description: "Testing on $NODE_NAME - Scenario: $DEPLOY_SCENARIO" + - multijob: name: Functest condition: ALWAYS projects: - - name: 'functest-apex-baremetal-daily-{stream}' + - name: 'functest-apex-baremetal-daily-{scenario_stream}' node-parameters: true current-parameters: false predefined-parameters: @@ -606,7 +665,7 @@ name: Yardstick condition: ALWAYS projects: - - name: 'yardstick-apex-baremetal-daily-{stream}' + - name: 'yardstick-apex-baremetal-daily-{scenario_stream}' node-parameters: true current-parameters: false predefined-parameters: @@ -614,6 +673,13 @@ kill-phase-on: NEVER abort-all-job: false git-revision: false + - conditional-step: + condition-kind: current-status + condition-worst: SUCCESS + condtion-best: SUCCESS + on-evaluation-failure: mark-unstable + steps: + - shell: 'echo "Tests Passed"' {% for stream in scenarios %} # {{ stream }} Daily @@ -686,11 +752,10 @@ condition: SUCCESSFUL projects: {% for scenario in scenarios[stream] %} - - name: 'apex-run-deploy-test-baremetal-{{ stream }}' + - name: 'apex-{{ scenario }}-baremetal-{{ stream }}' node-parameters: false current-parameters: false predefined-parameters: | - DEPLOY_SCENARIO={{scenario}} OPNFV_CLEAN=yes kill-phase-on: NEVER abort-all-job: true @@ -1024,9 +1089,9 @@ - trigger: name: 'apex-master' triggers: - - timed: '0 3 1 1 7' + - timed: '0 12 * * *' - trigger: name: 'apex-danube' triggers: - - timed: '0 12 * * *' + - timed: '0 3 1 1 7' diff --git a/jjb/apex/scenarios.yaml.hidden b/jjb/apex/scenarios.yaml.hidden index dc9107a11..748cd21b8 100644 --- a/jjb/apex/scenarios.yaml.hidden +++ b/jjb/apex/scenarios.yaml.hidden @@ -3,6 +3,7 @@ master: - 'os-nosdn-nofeature-ha' - 'os-odl-nofeature-ha' - 'os-odl-nofeature-noha' + - 'os-odl-bgpvpn-ha' danube: - 'os-nosdn-nofeature-noha' - 'os-nosdn-nofeature-ha' diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml index 3335391ca..467e168bc 100644 --- a/jjb/compass4nfv/compass-ci-jobs.yml +++ b/jjb/compass4nfv/compass-ci-jobs.yml @@ -385,7 +385,7 @@ - trigger: name: 'compass-os-nosdn-kvm-ha-baremetal-master-trigger' triggers: - - timed: '' + - timed: '0 14 * * *' - trigger: name: 'compass-os-nosdn-nofeature-ha-baremetal-danube-trigger' @@ -459,7 +459,7 @@ - trigger: name: 'compass-os-nosdn-kvm-ha-virtual-master-trigger' triggers: - - timed: '' + - timed: '0 23 * * *' - trigger: name: 'compass-os-nosdn-nofeature-ha-virtual-danube-trigger' diff --git a/prototypes/bifrost/playbooks/opnfv-virtual.yaml b/prototypes/bifrost/playbooks/opnfv-virtual.yaml index 94de628a6..3cba98b6b 100644 --- a/prototypes/bifrost/playbooks/opnfv-virtual.yaml +++ b/prototypes/bifrost/playbooks/opnfv-virtual.yaml @@ -48,6 +48,7 @@ dib_os_element: "{{ ipa_dib_os_element|default('debian') }}" dib_os_release: "jessie" dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}" + dib_notmpfs: true when: create_ipa_image | bool == true - role: bifrost-create-dib-image dib_imagetype: "qcow2" @@ -57,6 +58,7 @@ extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}" dib_elements: "vm enable-serial-console simple-init devuser growroot {{ extra_dib_elements }}" dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}" + dib_notmpfs: true when: create_image_via_dib | bool == true and transform_boot_image | bool == false - role: bifrost-keystone-client-config user: "{{ ansible_env.SUDO_USER }}" diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html index 3056e1dbe..2ae5339a0 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html @@ -1,6 +1,23 @@ <h3>{{ctrl.pageHeader}}</h3> <p>{{ctrl.pageParagraph}}</p> - +<form class="form-inline" ng-show="ctrl.isUserResults"> +<h4>Upload Results</h4> +<div class="form-group col-m-3"> + <input class="form-contrl btn btn-default" type = "file" file-model = "resultFile"/> +</div> +<div class="checkbox col-m-1"> + <label> + <input type="checkbox" ng-model="ctrl.isPublic">public + </label> +</div> +<div class="form-group col-m-3"> + <button class="btn btn-primary" ng-click = "ctrl.uploadFile()">upload result</button> +</div> +<div> +<lable>{{ctrl.uploadState}}</label> +</div> +</form> +<div class="row" style="margin-bottom:24px;"></div> <div class="result-filters"> <h4>Filters</h4> <div class="row"> @@ -41,7 +58,6 @@ <div cg-busy="{promise:ctrl.authRequest,message:'Loading'}"></div> <div cg-busy="{promise:ctrl.resultsRequest,message:'Loading'}"></div> - <div ng-show="ctrl.data" class="results-table"> <table ng-data="ctrl.data.result" ng-show="ctrl.data" class="table table-striped table-hover"> <thead> diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js index 9e3540da5..cc6cc0b6e 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js @@ -19,6 +19,24 @@ .module('testapiApp') .controller('ResultsController', ResultsController); + angular + .module('testapiApp') + .directive('fileModel', ['$parse', function ($parse) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var model = $parse(attrs.fileModel); + var modelSetter = model.assign; + + element.bind('change', function(){ + scope.$apply(function(){ + modelSetter(scope, element[0].files[0]); + }); + }); + } + }; + }]); + ResultsController.$inject = [ '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' ]; @@ -32,6 +50,7 @@ raiseAlert) { var ctrl = this; + ctrl.uploadFile=uploadFile; ctrl.update = update; ctrl.open = open; ctrl.clearFilters = clearFilters; @@ -76,6 +95,8 @@ ctrl.format = 'yyyy-MM-dd'; /** Check to see if this page should display user-specific results. */ + // ctrl.isUserResults = $state.current.name === 'userResults'; + // need auth to browse ctrl.isUserResults = $state.current.name === 'userResults'; // Should only be on user-results-page if authenticated. @@ -91,14 +112,49 @@ 'The most recently uploaded community test results are listed ' + 'here.'; + ctrl.uploadState = ''; + + ctrl.isPublic = false; + if (ctrl.isUserResults) { ctrl.authRequest = $scope.auth.doSignCheck() .then(ctrl.update); - ctrl.getUserProducts(); + // ctrl.getUserProducts(); } else { ctrl.update(); } + + function uploadFileToUrl(file, uploadUrl){ + var fd = new FormData(); + fd.append('file', file); + fd.append('public', ctrl.isPublic) + + $http.post(uploadUrl, fd, { + transformRequest: angular.identity, + headers: {'Content-Type': undefined} + }) + + .success(function(data){ + var id = data.href.substr(data.href.lastIndexOf('/')+1); + ctrl.uploadState = "Upload succeed. Result id is " + id; + ctrl.update(); + }) + + .error(function(data, status){ + ctrl.uploadState = "Upload failed. Error code is " + status; + }); + } + + function uploadFile(){ + var file = $scope.resultFile; + console.log('file is ' ); + console.dir(file); + + var uploadUrl = testapiApiUrl + "/results/upload"; + uploadFileToUrl(file, uploadUrl); + }; + /** * This will contact the TestAPI API to get a listing of test run * results. diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/shared/header/header.html b/utils/test/testapi/3rd_party/static/testapi-ui/shared/header/header.html index f2c49e86f..85c33b68d 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/shared/header/header.html +++ b/utils/test/testapi/3rd_party/static/testapi-ui/shared/header/header.html @@ -33,6 +33,7 @@ TestAPI </ul> <ul class="nav navbar-nav navbar-right"> <li ng-class="{ active: header.isActive('/user_results')}" ng-if="auth.isAuthenticated"><a ui-sref="userResults">My Results</a></li> + <!-- <li ng-if="auth.isAuthenticated" ng-class="{ active: header.isCatalogActive('user')}" class="dropdown" uib-dropdown> <a role="button" class="dropdown-toggle" uib-dropdown-toggle> My Catalog <strong class="caret"></strong> @@ -42,6 +43,7 @@ TestAPI <li><a ui-sref="userProducts">My Products</a></li> </ul> </li> + --> <li ng-class="{ active: header.isActive('/profile')}" ng-if="auth.isAuthenticated"><a ui-sref="profile">Profile</a></li> <li ng-if="auth.isAuthenticated"><a href="" ng-click="auth.doSignOut()">Sign Out</a></li> <li ng-if="!auth.isAuthenticated"><a href="" ng-click="auth.doSignIn()">Sign In / Sign Up</a></li> diff --git a/utils/test/testapi/etc/config.ini b/utils/test/testapi/etc/config.ini index 9ae25209d..435188df7 100644 --- a/utils/test/testapi/etc/config.ini +++ b/utils/test/testapi/etc/config.ini @@ -12,7 +12,7 @@ url = http://localhost:8000/api/v1 port = 8000 # Number of results for one page (integer value) -#results_per_page = 20 +results_per_page = 20 # With debug_on set to true, error traces will be shown in HTTP responses debug = True diff --git a/utils/test/testapi/opnfv_testapi/common/message.py b/utils/test/testapi/opnfv_testapi/common/message.py index 98536ff4b..951cbaf9c 100644 --- a/utils/test/testapi/opnfv_testapi/common/message.py +++ b/utils/test/testapi/opnfv_testapi/common/message.py @@ -10,6 +10,10 @@ not_found_base = 'Could Not Found' exist_base = 'Already Exists' +def key_error(key): + return "KeyError: '{}'".format(key) + + def no_body(): return 'No Body' diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index c7fed8f17..f23cc57ee 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -107,12 +107,15 @@ class GenericApiHandler(web.RequestHandler): per_page = kwargs.get('per_page', 0) if query is None: query = {} - cursor = self._eval_db(self.table, 'find', query) - records_count = yield cursor.count() - total_pages = self._calc_total_pages(records_count, - last, - page, - per_page) + + total_pages = 0 + if page > 0: + cursor = self._eval_db(self.table, 'find', query) + records_count = yield cursor.count() + total_pages = self._calc_total_pages(records_count, + last, + page, + per_page) pipelines = self._set_pipelines(query, sort, last, page, per_page) cursor = self._eval_db(self.table, 'aggregate', @@ -125,7 +128,7 @@ class GenericApiHandler(web.RequestHandler): res = {self.table: data} else: res = res_op(data, *args) - if total_pages > 0: + if page > 0: res.update({ 'pagination': { 'current_page': kwargs.get('page'), @@ -140,12 +143,10 @@ class GenericApiHandler(web.RequestHandler): if (records_count > last) and (last > 0): records_nr = last - total_pages = 0 - if page > 0: - total_pages, remainder = divmod(records_nr, per_page) - if remainder > 0: - total_pages += 1 - if page > total_pages: + total_pages, remainder = divmod(records_nr, per_page) + if remainder > 0: + total_pages += 1 + if page > 1 and page > total_pages: raises.BadRequest( 'Request page > total_pages [{}]'.format(total_pages)) return total_pages diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 1773216c0..5eb1b925c 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -6,8 +6,10 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import logging from datetime import datetime from datetime import timedelta +import json from bson import objectid @@ -17,6 +19,7 @@ from opnfv_testapi.common import raises from opnfv_testapi.resources import handlers from opnfv_testapi.resources import result_models from opnfv_testapi.tornado_swagger import swagger +from opnfv_testapi.ui.auth import constants as auth_const CONF = config.Config() @@ -40,6 +43,7 @@ class GenericResultHandler(handlers.GenericApiHandler): query = dict() date_range = dict() + query['public'] = {'$not': {'$eq': 'false'}} for k in self.request.query_arguments.keys(): v = self.get_query_argument(k) if k == 'project' or k == 'pod' or k == 'case': @@ -56,10 +60,24 @@ class GenericResultHandler(handlers.GenericApiHandler): date_range.update({'$gte': str(v)}) elif k == 'to': date_range.update({'$lt': str(v)}) + elif k == 'signed': + openid = self.get_secure_cookie(auth_const.OPENID) + role = self.get_secure_cookie(auth_const.ROLE) + logging.info('role:%s', role) + if role: + del query['public'] + if role != "reviewer": + query['user'] = openid elif k != 'last' and k != 'page': query[k] = v if date_range: query['start_date'] = date_range + + # if $lt is not provided, + # empty/None/null/'' start_date will also be returned + if 'start_date' in query and '$lt' not in query['start_date']: + query['start_date'].update({'$lt': str(datetime.now())}) + return query @@ -84,9 +102,10 @@ class ResultsCLHandler(GenericResultHandler): - criteria : the global criteria status passed or failed - trust_indicator : evaluate the stability of the test case to avoid running systematically long and stable test case + - signed : get logined user result GET /results/project=functest&case=vPing&version=Arno-R1 \ - &pod=pod_name&period=15 + &pod=pod_name&period=15&signed @return 200: all test results consist with query, empty list if no result is found @rtype: L{TestResults} @@ -146,8 +165,12 @@ class ResultsCLHandler(GenericResultHandler): @type trust_indicator: L{float} @in trust_indicator: query @required trust_indicator: False + @param signed: user results or all results + @type signed: L{string} + @in signed: query + @required signed: False """ - limitations = {'sort': {'start_date': -1}} + limitations = {'sort': {'_id': -1}} last = self.get_query_argument('last', 0) if last is not None: last = self.get_int('last', last) @@ -173,6 +196,9 @@ class ResultsCLHandler(GenericResultHandler): @raise 404: pod/project/testcase not exist @raise 400: body/pod_name/project_name/case_name not provided """ + self._post() + + def _post(self): def pod_query(): return {'name': self.json_args.get('pod_name')} @@ -187,9 +213,39 @@ class ResultsCLHandler(GenericResultHandler): carriers = [('pods', pod_query), ('projects', project_query), ('testcases', testcase_query)] + self._create(miss_fields=miss_fields, carriers=carriers) +class ResultsUploadHandler(ResultsCLHandler): + @swagger.operation(nickname="uploadTestResult") + def post(self): + """ + @description: upload and create a test result + @param body: result to be created + @type body: L{ResultCreateRequest} + @in body: body + @rtype: L{CreateResponse} + @return 200: result is created. + @raise 404: pod/project/testcase not exist + @raise 400: body/pod_name/project_name/case_name not provided + """ + logging.info('file upload') + fileinfo = self.request.files['file'][0] + is_public = self.get_body_argument('public') + logging.warning('public:%s', is_public) + logging.info('results is :%s', fileinfo['filename']) + logging.info('results is :%s', fileinfo['body']) + self.json_args = json.loads(fileinfo['body']).copy() + self.json_args['public'] = is_public + + openid = self.get_secure_cookie(auth_const.OPENID) + if openid: + self.json_args['user'] = openid + + super(ResultsUploadHandler, self)._post() + + class ResultsGURHandler(GenericResultHandler): @swagger.operation(nickname='getTestResultById') def get(self, result_id): diff --git a/utils/test/testapi/opnfv_testapi/resources/result_models.py b/utils/test/testapi/opnfv_testapi/resources/result_models.py index 62a6dacff..890bf8220 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_models.py @@ -54,6 +54,8 @@ class ResultCreateRequest(models.ModelBase): build_tag=None, scenario=None, criteria=None, + user=None, + public="true", trust_indicator=None): self.pod_name = pod_name self.project_name = project_name @@ -66,6 +68,8 @@ class ResultCreateRequest(models.ModelBase): self.build_tag = build_tag self.scenario = scenario self.criteria = criteria + self.user = user + self.public = public self.trust_indicator = trust_indicator if trust_indicator else TI(0) @@ -89,7 +93,7 @@ class TestResult(models.ModelBase): pod_name=None, installer=None, version=None, start_date=None, stop_date=None, details=None, build_tag=None, scenario=None, criteria=None, - trust_indicator=None): + user=None, public="true", trust_indicator=None): self._id = _id self.case_name = case_name self.project_name = project_name @@ -102,6 +106,8 @@ class TestResult(models.ModelBase): self.build_tag = build_tag self.scenario = scenario self.criteria = criteria + self.user = user + self.public = public self.trust_indicator = trust_indicator @staticmethod diff --git a/utils/test/testapi/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py index a2312de09..37e719b65 100644 --- a/utils/test/testapi/opnfv_testapi/router/url_mappings.py +++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py @@ -48,6 +48,7 @@ mappings = [ # Push results with mandatory request payload parameters # (project, case, and pod) (r"/api/v1/results", result_handlers.ResultsCLHandler), + (r'/api/v1/results/upload', result_handlers.ResultsUploadHandler), (r"/api/v1/results/([^/]+)", result_handlers.ResultsGURHandler), # scenarios @@ -64,4 +65,5 @@ mappings = [ (r'/api/v1/auth/signin_return', sign.SigninReturnHandler), (r'/api/v1/auth/signout', sign.SignoutHandler), (r'/api/v1/profile', user.ProfileHandler), + ] diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py b/utils/test/testapi/opnfv_testapi/tests/unit/executor.py index b30c3258b..b8f696caf 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/executor.py @@ -10,6 +10,20 @@ import functools import httplib +def upload(excepted_status, excepted_response): + def _upload(create_request): + @functools.wraps(create_request) + def wrap(self): + request = create_request(self) + status, body = self.upload(request) + if excepted_status == httplib.OK: + getattr(self, excepted_response)(body) + else: + self.assertIn(excepted_response, body) + return wrap + return _upload + + def create(excepted_status, excepted_response): def _create(create_request): @functools.wraps(create_request) diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py index adaf6f7c3..d95ff372e 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py @@ -119,10 +119,14 @@ class MemDb(object): @staticmethod def _compare_date(spec, value): + gte = True + lt = False for k, v in spec.iteritems(): - if k == '$gte' and value >= v: - return True - return False + if k == '$gte' and value < v: + gte = False + elif k == '$lt' and value < v: + lt = True + return gte and lt def _in(self, content, *args): if self.name == 'scenarios': @@ -185,9 +189,8 @@ class MemDb(object): elif k == 'trust_indicator.current': if content.get('trust_indicator').get('current') != v: return False - elif content.get(k, None) != v: + elif not isinstance(v, dict) and content.get(k, None) != v: return False - return True def _find(self, *args): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py index c8463cb02..f199bc7d5 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py @@ -10,6 +10,7 @@ import copy import httplib import unittest from datetime import datetime, timedelta +import json from opnfv_testapi.common import message from opnfv_testapi.resources import pod_models @@ -131,6 +132,22 @@ class TestResultBase(base.TestBase): _, res = self.create_d() return res.href.split('/')[-1] + def upload(self, req): + if req and not isinstance(req, str) and hasattr(req, 'format'): + req = req.format() + res = self.fetch(self.basePath + '/upload', + method='POST', + body=json.dumps(req), + headers=self.headers) + + return self._get_return(res, self.create_res) + + +class TestResultUpload(TestResultBase): + @executor.upload(httplib.BAD_REQUEST, message.key_error('file')) + def test_filenotfind(self): + return None + class TestResultCreate(TestResultBase): @executor.create(httplib.BAD_REQUEST, message.no_body()) @@ -208,9 +225,9 @@ class TestResultCreate(TestResultBase): class TestResultGet(TestResultBase): def setUp(self): super(TestResultGet, self).setUp() + self.req_10d_before = self._create_changed_date(days=-10) self.req_d_id = self._create_d() self.req_10d_later = self._create_changed_date(days=10) - self.req_10d_before = self._create_changed_date(days=-10) @executor.get(httplib.OK, 'assert_res') def test_getOne(self): @@ -256,9 +273,9 @@ class TestResultGet(TestResultBase): def test_queryPeriodNotInt(self): return self._set_query('period=a') - @executor.query(httplib.OK, '_query_last_one', 1) + @executor.query(httplib.OK, '_query_period_one', 1) def test_queryPeriodSuccess(self): - return self._set_query('period=1') + return self._set_query('period=11') @executor.query(httplib.BAD_REQUEST, message.must_int('last')) def test_queryLastNotInt(self): @@ -268,7 +285,17 @@ class TestResultGet(TestResultBase): def test_queryLast(self): return self._set_query('last=1') - @executor.query(httplib.OK, '_query_last_one', 1) + @executor.query(httplib.OK, '_query_success', 4) + def test_queryPublic(self): + self._create_public_data() + return self._set_query('') + + @executor.query(httplib.OK, '_query_success', 1) + def test_queryPrivate(self): + self._create_private_data() + return self._set_query('public=false') + + @executor.query(httplib.OK, '_query_period_one', 1) def test_combination(self): return self._set_query('pod', 'project', @@ -279,7 +306,7 @@ class TestResultGet(TestResultBase): 'scenario', 'trust_indicator', 'criteria', - 'period=1') + 'period=11') @executor.query(httplib.OK, '_query_success', 0) def test_notFound(self): @@ -294,6 +321,14 @@ class TestResultGet(TestResultBase): 'criteria', 'period=1') + @executor.query(httplib.OK, '_query_success', 1) + def test_filterErrorStartdate(self): + self._create_error_start_date(None) + # self._create_error_start_date('None') + self._create_error_start_date('null') + self._create_error_start_date('') + return self._set_query('period=11') + def _query_success(self, body, number): self.assertEqual(number, len(body.results)) @@ -301,6 +336,16 @@ class TestResultGet(TestResultBase): self.assertEqual(number, len(body.results)) self.assert_res(body.results[0], self.req_10d_later) + def _query_period_one(self, body, number): + self.assertEqual(number, len(body.results)) + self.assert_res(body.results[0], self.req_10d_before) + + def _create_error_start_date(self, start_date): + req = copy.deepcopy(self.req_d) + req.start_date = start_date + self.create(req) + return req + def _create_changed_date(self, **kwargs): req = copy.deepcopy(self.req_d) req.start_date = datetime.now() + timedelta(**kwargs) @@ -309,16 +354,29 @@ class TestResultGet(TestResultBase): self.create(req) return req + def _create_public_data(self, **kwargs): + req = copy.deepcopy(self.req_d) + req.public = 'true' + self.create(req) + return req + + def _create_private_data(self, **kwargs): + req = copy.deepcopy(self.req_d) + req.public = 'false' + self.create(req) + return req + def _set_query(self, *args): def get_value(arg): return self.__getattribute__(arg) \ if arg != 'trust_indicator' else self.trust_indicator.current uri = '' for arg in args: - if '=' in arg: - uri += arg + '&' - else: - uri += '{}={}&'.format(arg, get_value(arg)) + if arg: + if '=' in arg: + uri += arg + '&' + else: + uri += '{}={}&'.format(arg, get_value(arg)) return uri[0: -1] diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/constants.py b/utils/test/testapi/opnfv_testapi/ui/auth/constants.py index 43f69d7f5..44ccb46d7 100644 --- a/utils/test/testapi/opnfv_testapi/ui/auth/constants.py +++ b/utils/test/testapi/opnfv_testapi/ui/auth/constants.py @@ -1,4 +1,6 @@ OPENID = 'openid' +ROLE = 'role' +DEFAULT_ROLE = 'user' # OpenID parameters OPENID_MODE = 'openid.mode' diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py index 6a9d94eb2..5b3622579 100644 --- a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py +++ b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py @@ -1,4 +1,7 @@ from six.moves.urllib import parse +from tornado import gen +from tornado import web +import logging from opnfv_testapi.common import config from opnfv_testapi.ui.auth import base @@ -31,20 +34,31 @@ class SigninHandler(base.BaseHandler): class SigninReturnHandler(base.BaseHandler): + @web.asynchronous + @gen.coroutine def get(self): if self.get_query_argument(const.OPENID_MODE) == 'cancel': self._auth_failure('Authentication canceled.') openid = self.get_query_argument(const.OPENID_CLAIMED_ID) - user_info = { + role = const.DEFAULT_ROLE + new_user_info = { 'openid': openid, 'email': self.get_query_argument(const.OPENID_NS_SREG_EMAIL), - 'fullname': self.get_query_argument(const.OPENID_NS_SREG_FULLNAME) + 'fullname': self.get_query_argument(const.OPENID_NS_SREG_FULLNAME), + const.ROLE: role } + user = yield self.db_find_one({'openid': openid}) + if not user: + self.db_save(self.table, new_user_info) + logging.info('save to db:%s', new_user_info) + else: + role = user.get(const.ROLE) - self.db_save(self.table, user_info) - if not self.get_secure_cookie('openid'): - self.set_secure_cookie('openid', openid) + self.clear_cookie(const.OPENID) + self.clear_cookie(const.ROLE) + self.set_secure_cookie(const.OPENID, openid) + self.set_secure_cookie(const.ROLE, role) self.redirect(url=CONF.ui_url) def _auth_failure(self, message): @@ -57,9 +71,8 @@ class SigninReturnHandler(base.BaseHandler): class SignoutHandler(base.BaseHandler): def get(self): """Handle signout request.""" - openid = self.get_secure_cookie(const.OPENID) - if openid: - self.clear_cookie(const.OPENID) + self.clear_cookie(const.OPENID) + self.clear_cookie(const.ROLE) params = {'openid_logout': CONF.osid_openid_logout_endpoint} url = parse.urljoin(CONF.ui_url, '/#/logout?' + parse.urlencode(params)) diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/user.py b/utils/test/testapi/opnfv_testapi/ui/auth/user.py index 140bca51c..2fca2a8cb 100644 --- a/utils/test/testapi/opnfv_testapi/ui/auth/user.py +++ b/utils/test/testapi/opnfv_testapi/ui/auth/user.py @@ -17,7 +17,7 @@ class ProfileHandler(base.BaseHandler): "openid": user.get('openid'), "email": user.get('email'), "fullname": user.get('fullname'), - "is_admin": False + "role": user.get('role', 'user') }) except Exception: pass diff --git a/utils/test/testapi/requirements.txt b/utils/test/testapi/requirements.txt index d2a45dcd0..4b6f75c10 100644 --- a/utils/test/testapi/requirements.txt +++ b/utils/test/testapi/requirements.txt @@ -2,9 +2,9 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr==2.0.0 -setuptools>=16.0 -tornado>=3.1,<=4.3 +pbr>=2.0.0,!=2.1.0 # Apache-2.0 +setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2 # PSF/ZPL +tornado>=3.1,<=4.3 # Apache-2.0 epydoc>=0.3.1 -six>=1.9.0 -motor +six>=1.9.0 # MIT +motor # Apache-2.0 diff --git a/utils/test/testapi/test-requirements.txt b/utils/test/testapi/test-requirements.txt index 3bead7987..233f4652b 100644 --- a/utils/test/testapi/test-requirements.txt +++ b/utils/test/testapi/test-requirements.txt @@ -2,9 +2,9 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -coverage -mock>=2.0 -nose>=1.3.1 -pytest -pytest-cov -pytest-mock +coverage>=4.0,!=4.4 # Apache-2.0 +mock>=2.0 # BSD +nose # LGPL +pytest # MIT +pytest-cov # MIT +pytest-mock # MIT |