diff options
-rw-r--r-- | jjb/bottlenecks/bottlenecks-run-suite.sh | 14 | ||||
-rw-r--r-- | jjb/compass4nfv/compass-ci-jobs.yml | 4 | ||||
-rw-r--r-- | jjb/compass4nfv/compass-dovetail-jobs.yml | 4 | ||||
-rw-r--r-- | jjb/container4nfv/container4nfv-project.yml | 40 | ||||
-rw-r--r-- | jjb/daisy4nfv/daisy-daily-jobs.yml | 23 | ||||
-rw-r--r-- | jjb/dovetail/dovetail-ci-jobs.yml | 2 | ||||
-rw-r--r-- | jjb/global/installer-params.yml | 4 | ||||
-rw-r--r-- | jjb/global/releng-macros.yml | 14 | ||||
-rw-r--r-- | jjb/global/slave-params.yml | 6 | ||||
-rw-r--r-- | jjb/kvmfornfv/kvmfornfv.yml | 2 | ||||
-rw-r--r-- | jjb/opnfvdocs/docs-rtd.yaml | 2 | ||||
-rw-r--r-- | jjb/pharos/pharos.yml | 8 | ||||
-rw-r--r-- | jjb/qtip/qtip-experimental-jobs.yml | 2 | ||||
-rw-r--r-- | jjb/qtip/qtip-validate-jobs.yml | 8 | ||||
-rw-r--r-- | jjb/vswitchperf/vswitchperf.yml | 26 | ||||
-rw-r--r-- | jjb/yardstick/yardstick-daily-jobs.yml | 36 | ||||
-rw-r--r-- | modules/opnfv/utils/ovs_logger.py | 4 | ||||
-rw-r--r-- | modules/requirements.txt | 2 | ||||
-rw-r--r-- | modules/setup.py | 2 | ||||
-rw-r--r-- | modules/test-requirements.txt | 2 | ||||
-rw-r--r-- | utils/test/reporting/reporting/utils/reporting_utils.py | 7 | ||||
-rw-r--r-- | utils/test/testapi/.gitignore | 5 | ||||
-rw-r--r-- | utils/test/testapi/docs/Makefile | 20 | ||||
-rw-r--r-- | utils/test/testapi/docs/conf.py | 165 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/api.rst | 10 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/framework.rst (renamed from utils/test/testapi/README.rst) | 14 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/index.rst | 18 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/overview.rst | 98 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/swagger-ui.rst | 10 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/testapi-client.rst | 10 | ||||
-rw-r--r-- | utils/test/testapi/docs/developer/devguide/web-portal.rst | 10 | ||||
-rw-r--r-- | utils/test/testapi/docs/index.rst | 20 | ||||
-rw-r--r-- | utils/test/testapi/etc/config.ini | 3 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/cmd/server.py | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/check.py | 3 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/config.py | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/__init__.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/base_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/handlers.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/pod_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/pod_handlers.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/project_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/project_handlers.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/result_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/result_handlers.py) | 12 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/root_handlers.py (renamed from utils/test/testapi/opnfv_testapi/ui/root.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/scenario_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/sign_handlers.py (renamed from utils/test/testapi/opnfv_testapi/ui/auth/sign.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/testcase_handlers.py (renamed from utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/handlers/user_handlers.py | 25 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/__init__.py (renamed from utils/test/testapi/opnfv_testapi/resources/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/base_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/models.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/pod_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/pod_models.py) | 8 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/project_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/project_models.py) | 10 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/result_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/result_models.py) | 14 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/scenario_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/scenario_models.py) | 22 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/testcase_models.py (renamed from utils/test/testapi/opnfv_testapi/resources/testcase_models.py) | 10 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/models/user_models.py | 9 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/router/url_mappings.py | 31 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/common/test_config.py | 3 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/executor.py | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/__init__.py (renamed from utils/test/testapi/opnfv_testapi/ui/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c1.json (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c1.json) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c2.json (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_base.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_base.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_project.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_result.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py) | 8 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_scenario.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py) | 4 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_testcase.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_token.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py) | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_version.py (renamed from utils/test/testapi/opnfv_testapi/tests/unit/resources/test_version.py) | 6 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/resources/test_fake_pymongo.py | 123 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/about/about.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/about/about.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/auth-failure/authFailureController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/auth-failure/authFailureController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/auth/__init__.py | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/auth/user.py | 26 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/home/home.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/home/home.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/logout/logout.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logout.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/logout/logoutController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logoutController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/pods/pods.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/pods/podsController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/profile/importPubKeyModal.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/profile/profile.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profile.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/profile/profileController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profileController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/profile/showPubKeyModal.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results-report/partials/editTestModal.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results-report/partials/fullTestListModal.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results-report/partials/reportDetails.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results-report/resultsReport.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReport.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results-report/resultsReportController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results/results.html (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/ui/results/resultsController.js (renamed from utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/setup.cfg | 3 | ||||
-rw-r--r-- | utils/test/testapi/tox.ini | 4 |
92 files changed, 686 insertions, 302 deletions
diff --git a/jjb/bottlenecks/bottlenecks-run-suite.sh b/jjb/bottlenecks/bottlenecks-run-suite.sh index cdcf0f05a..ebd905e98 100644 --- a/jjb/bottlenecks/bottlenecks-run-suite.sh +++ b/jjb/bottlenecks/bottlenecks-run-suite.sh @@ -32,16 +32,12 @@ if [[ $SUITE_NAME == *posca* ]]; then # Preparing OpenStack RC and Cacert files echo "BOTTLENECKS INFO: fetching os credentials from $INSTALLER_TYPE" if [[ $INSTALLER_TYPE == 'compass' ]]; then - if [[ ${BRANCH} == 'master' ]]; then - ${RELENG_REPO}/utils/fetch_os_creds.sh -d ${OPENRC} -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} -o ${OS_CACERT} >${redirect} - if [[ -f ${OS_CACERT} ]]; then - echo "BOTTLENECKS INFO: successfully fetching os_cacert for openstack: ${OS_CACERT}" - else - echo "BOTTLENECKS ERROR: couldn't find os_cacert file: ${OS_CACERT}, please check if the it's been properly provided." - exit 1 - fi + ${RELENG_REPO}/utils/fetch_os_creds.sh -d ${OPENRC} -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} -o ${OS_CACERT} >${redirect} + if [[ -f ${OS_CACERT} ]]; then + echo "BOTTLENECKS INFO: successfully fetching os_cacert for openstack: ${OS_CACERT}" else - ${RELENG_REPO}/utils/fetch_os_creds.sh -d ${OPENRC} -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} >${redirect} + echo "BOTTLENECKS ERROR: couldn't find os_cacert file: ${OS_CACERT}, please check if the it's been properly provided." + exit 1 fi fi diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml index 5100787d7..4adfc2a3f 100644 --- a/jjb/compass4nfv/compass-ci-jobs.yml +++ b/jjb/compass4nfv/compass-ci-jobs.yml @@ -768,7 +768,7 @@ - trigger: name: 'compass-k8-nosdn-nofeature-ha-virtual-master-trigger' triggers: - - timed: '0 12 * * *' + - timed: '5 2 * * *' - trigger: name: 'compass-os-odl-sfc-ha-virtual-master-trigger' triggers: @@ -852,7 +852,7 @@ - trigger: name: 'compass-k8-nosdn-nofeature-ha-virtual-euphrates-trigger' triggers: - - timed: '0 13 * * *' + - timed: '5 1 * * *' # ------------------- # noha-virtual-euphrates diff --git a/jjb/compass4nfv/compass-dovetail-jobs.yml b/jjb/compass4nfv/compass-dovetail-jobs.yml index f0e1c2d3f..c09086348 100644 --- a/jjb/compass4nfv/compass-dovetail-jobs.yml +++ b/jjb/compass4nfv/compass-dovetail-jobs.yml @@ -184,9 +184,9 @@ - trigger: name: 'compass-os-nosdn-nofeature-ha-baremetal-weekly-danube-trigger' triggers: - - timed: 'H H * * 0' + - timed: '' # 'H H * * 0' - trigger: name: 'dovetail-weekly-trigger' triggers: - - timed: 'H H * * 0' + - timed: '' # 'H H * * 0' diff --git a/jjb/container4nfv/container4nfv-project.yml b/jjb/container4nfv/container4nfv-project.yml index 70a3cc5cf..ffdbf9551 100644 --- a/jjb/container4nfv/container4nfv-project.yml +++ b/jjb/container4nfv/container4nfv-project.yml @@ -10,6 +10,7 @@ jobs: - 'container4nfv-verify-{stream}' + - 'container4nfv-daily-{stream}' stream: - master: @@ -61,4 +62,41 @@ builders: - shell: | - echo "Nothing to verify!" + cd $WORKSPACE/ci + ./build.sh + + +- job-template: + name: 'container4nfv-daily-{stream}' + + project-type: freestyle + + disabled: '{obj:disabled}' + + concurrent: false + + properties: + - logrotate-default + + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - huawei-virtual6 + default-slaves: + - huawei-virtual6 + + scm: + - git-scm + + triggers: + - timed: '@midnight' + + builders: + - shell: + cd $WORKSPACE/ci + ./deploy.sh diff --git a/jjb/daisy4nfv/daisy-daily-jobs.yml b/jjb/daisy4nfv/daisy-daily-jobs.yml index b3c37b88f..f2626db1c 100644 --- a/jjb/daisy4nfv/daisy-daily-jobs.yml +++ b/jjb/daisy4nfv/daisy-daily-jobs.yml @@ -137,6 +137,27 @@ build-step-failure-threshold: 'never' failure-threshold: 'never' unstable-threshold: 'FAILURE' + - conditional-step: + condition-kind: and + condition-operands: + - condition-kind: regex-match + regex: 'baremetal' + label: '{pod}' + - condition-kind: regex-match + regex: 'master' + label: '{stream}' + steps: + - trigger-builds: + - project: 'yardstick-daisy-{pod}-daily-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' - job-template: name: '{project}-deploy-{pod}-daily-{stream}' @@ -200,7 +221,7 @@ - trigger: name: 'daisy-os-nosdn-nofeature-ha-baremetal-daily-master-trigger' triggers: - - timed: '0 16 * * *' + - timed: '0 18 * * *' # Basic NOHA Scenarios - trigger: name: 'daisy-os-nosdn-nofeature-noha-baremetal-daily-master-trigger' diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index 9fde120f8..6efe12820 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -25,7 +25,7 @@ branch: 'stable/{stream}' dovetail-branch: master gs-pathname: '/{stream}' - docker-tag: 'cvp.0.7.0' + docker-tag: 'cvp.0.8.0' # ---------------------------------- # POD, PLATFORM, AND BRANCH MAPPING diff --git a/jjb/global/installer-params.yml b/jjb/global/installer-params.yml index 1415a6e86..916db808d 100644 --- a/jjb/global/installer-params.yml +++ b/jjb/global/installer-params.yml @@ -118,6 +118,10 @@ name: BRIDGE default: 'br7' description: 'pxe bridge for booting of Daisy master' + - string: + name: EXTERNAL_NETWORK + default: 'admin_external' + description: 'external network for test' - parameter: name: 'infra-defaults' diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index deac20858..5b9331b78 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -136,6 +136,20 @@ pattern: '{files}' - trigger: + name: gerrit-trigger-tag-created + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + trigger-on: + - ref-updated + projects: + - project-compare-type: 'ANT' + project-pattern: '{project}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: 'refs/tags/**' + +- trigger: name: 'experimental' triggers: - gerrit: diff --git a/jjb/global/slave-params.yml b/jjb/global/slave-params.yml index 5b94607e5..0ea37d941 100644 --- a/jjb/global/slave-params.yml +++ b/jjb/global/slave-params.yml @@ -742,15 +742,15 @@ description: 'pxe bridge for booting of Daisy master' - parameter: - name: zte-pod4-defaults + name: zte-virtual5-defaults parameters: - node: name: SLAVE_NAME description: 'Slave name on Jenkins' allowed-slaves: - - zte-pod4 + - zte-virtual5 default-slaves: - - zte-pod4 + - zte-virtual5 - string: name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT diff --git a/jjb/kvmfornfv/kvmfornfv.yml b/jjb/kvmfornfv/kvmfornfv.yml index ad497e97d..aae6e028e 100644 --- a/jjb/kvmfornfv/kvmfornfv.yml +++ b/jjb/kvmfornfv/kvmfornfv.yml @@ -8,7 +8,7 @@ - master: branch: '{stream}' gs-pathname: '' - disabled: false + disabled: true - euphrates: branch: 'stable/{stream}' gs-pathname: '/{stream}' diff --git a/jjb/opnfvdocs/docs-rtd.yaml b/jjb/opnfvdocs/docs-rtd.yaml index a8b9bef7b..28f9354fa 100644 --- a/jjb/opnfvdocs/docs-rtd.yaml +++ b/jjb/opnfvdocs/docs-rtd.yaml @@ -8,6 +8,8 @@ stream: - master: branch: 'master' + - danube: + branch: 'stable/{stream}' - euphrates: branch: 'stable/{stream}' diff --git a/jjb/pharos/pharos.yml b/jjb/pharos/pharos.yml index 0c104c0c0..7af4f0fa6 100644 --- a/jjb/pharos/pharos.yml +++ b/jjb/pharos/pharos.yml @@ -6,10 +6,12 @@ - project: name: pharos - project: '{name}' + project: + - '{name}' + - '{name}-tools' jobs: - - 'pharos-verify-{stream}' + - '{project}-verify-{stream}' stream: - master: @@ -22,7 +24,7 @@ disabled: false - job-template: - name: 'pharos-verify-{stream}' + name: '{project}-verify-{stream}' disabled: '{obj:disabled}' diff --git a/jjb/qtip/qtip-experimental-jobs.yml b/jjb/qtip/qtip-experimental-jobs.yml index 4c336d1d5..fdfed2601 100644 --- a/jjb/qtip/qtip-experimental-jobs.yml +++ b/jjb/qtip/qtip-experimental-jobs.yml @@ -33,7 +33,7 @@ branch: '{branch}' # Pin the tests on zte-pod4 with apex deployment - apex-defaults - - zte-pod4-defaults + - zte-virtual5-defaults scm: - git-scm-gerrit diff --git a/jjb/qtip/qtip-validate-jobs.yml b/jjb/qtip/qtip-validate-jobs.yml index 42240ed95..febe28619 100644 --- a/jjb/qtip/qtip-validate-jobs.yml +++ b/jjb/qtip/qtip-validate-jobs.yml @@ -26,19 +26,19 @@ qpi: - compute: installer: apex - pod: zte-pod4 + pod: zte-virtual5 <<: *master - storage: installer: apex - pod: zte-pod4 + pod: zte-virtual5 <<: *master - compute: installer: apex - pod: zte-pod4 + pod: zte-virtual5 <<: *euphrates - storage: installer: apex - pod: zte-pod4 + pod: zte-virtual5 <<: *euphrates # ------------------------------- diff --git a/jjb/vswitchperf/vswitchperf.yml b/jjb/vswitchperf/vswitchperf.yml index bab8b24c2..16ceb2e52 100644 --- a/jjb/vswitchperf/vswitchperf.yml +++ b/jjb/vswitchperf/vswitchperf.yml @@ -15,12 +15,10 @@ branch: '{stream}' gs-pathname: '' disabled: false - slave-label: 'opnfv-build-ubuntu' - euphrates: branch: 'stable/{stream}' gs-pathname: '/{stream}' disabled: false - slave-label: 'opnfv-build-ubuntu' - job-template: @@ -74,7 +72,17 @@ - project-parameter: project: '{project}' branch: '{branch}' - - '{slave-label}-defaults' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - ericsson-build4 + default-slaves: + - ericsson-build4 scm: - git-scm-gerrit @@ -136,7 +144,17 @@ - project-parameter: project: '{project}' branch: '{branch}' - - '{slave-label}-defaults' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - ericsson-build4 + default-slaves: + - ericsson-build4 scm: - git-scm diff --git a/jjb/yardstick/yardstick-daily-jobs.yml b/jjb/yardstick/yardstick-daily-jobs.yml index 15686a26a..481af2a42 100644 --- a/jjb/yardstick/yardstick-daily-jobs.yml +++ b/jjb/yardstick/yardstick-daily-jobs.yml @@ -134,6 +134,17 @@ installer: compass auto-trigger-name: 'daily-trigger-disabled' <<: *euphrates + # daisy CI PODs + - baremetal: + slave-label: zte-pod3 + installer: daisy + auto-trigger-name: 'daily-trigger-disabled' + <<: *master + - virtual: + slave-label: daisy-virtual + installer: daisy + auto-trigger-name: 'daily-trigger-disabled' + <<: *master # ------------------------------- # None-CI PODs # ------------------------------- @@ -154,19 +165,14 @@ <<: *euphrates - zte-pod2: slave-label: '{pod}' - installer: fuel + installer: daisy auto-trigger-name: 'daily-trigger-disabled' <<: *master - zte-pod3: slave-label: '{pod}' - installer: fuel + installer: daisy auto-trigger-name: 'daily-trigger-disabled' <<: *master - - zte-pod3: - slave-label: '{pod}' - installer: fuel - auto-trigger-name: 'daily-trigger-disabled' - <<: *euphrates - orange-pod2: slave-label: '{pod}' installer: joid @@ -398,6 +404,22 @@ description: 'Arguments to use in order to choose the backend DB' - parameter: + name: 'yardstick-params-daisy-baremetal' + parameters: + - string: + name: YARDSTICK_DB_BACKEND + default: '-i 104.197.68.199:8086' + description: 'Arguments to use in order to choose the backend DB' + +- parameter: + name: 'yardstick-params-daisy-virtual' + parameters: + - string: + name: YARDSTICK_DB_BACKEND + default: '-i 104.197.68.199:8086' + description: 'Arguments to use in order to choose the backend DB' + +- parameter: name: 'yardstick-params-zte-pod1' parameters: - string: diff --git a/modules/opnfv/utils/ovs_logger.py b/modules/opnfv/utils/ovs_logger.py index eb070e3bd..2107bdc35 100644 --- a/modules/opnfv/utils/ovs_logger.py +++ b/modules/opnfv/utils/ovs_logger.py @@ -70,7 +70,7 @@ class OVSLogger(object): def ofctl_dump_flows(self, ssh_conn, br='br-int', choose_table=None, timestamp=None): try: - cmd = 'ovs-ofctl -OOpenFlow13 dump-flows {0}'.format(br) + cmd = 'sudo ovs-ofctl -OOpenFlow13 dump-flows {0}'.format(br) if choose_table is not None: cmd = '{0} table={1}'.format(cmd, choose_table) output = self.__remote_cmd(ssh_conn, cmd) @@ -85,7 +85,7 @@ class OVSLogger(object): def vsctl_show(self, ssh_conn, timestamp=None): try: - cmd = 'ovs-vsctl show' + cmd = 'sudo ovs-vsctl show' output = self.__remote_cmd(ssh_conn, cmd) operation = 'vsctl_show' host = self.__ssh_host(ssh_conn) diff --git a/modules/requirements.txt b/modules/requirements.txt index 2793dd4cf..0718fa3b0 100644 --- a/modules/requirements.txt +++ b/modules/requirements.txt @@ -1,3 +1,3 @@ paramiko>=2.0 # LGPLv2.1+ mock>=2.0 # BSD -requests!=2.12.2,>=2.10.0 # Apache-2.0 +requests>=2.14.2 # Apache-2.0 diff --git a/modules/setup.py b/modules/setup.py index a1e9b3bb2..46309ef1c 100644 --- a/modules/setup.py +++ b/modules/setup.py @@ -18,5 +18,5 @@ except ImportError: pass setuptools.setup( - setup_requires=['pbr>=1.8'], + setup_requires=['pbr>=2.0.0'], pbr=True) diff --git a/modules/test-requirements.txt b/modules/test-requirements.txt index c264540c0..1ae13c002 100644 --- a/modules/test-requirements.txt +++ b/modules/test-requirements.txt @@ -1,2 +1,2 @@ nose # LGPL -coverage>=4.0 # Apache-2.0 +coverage!=4.4,>=4.0 # Apache-2.0 diff --git a/utils/test/reporting/reporting/utils/reporting_utils.py b/utils/test/reporting/reporting/utils/reporting_utils.py index 8dc4f0933..58a0c6233 100644 --- a/utils/test/reporting/reporting/utils/reporting_utils.py +++ b/utils/test/reporting/reporting/utils/reporting_utils.py @@ -114,7 +114,8 @@ def getScenarios(project, case, installer, version): """ Get the list of Scenarios """ - + test_results = None + scenario_results = None period = get_config('general.period') url_base = get_config('testapi.url') @@ -373,8 +374,8 @@ def getCaseScoreFromBuildTag(testCase, s_results): test_result_indicator += 1 except: print "No results found for this case" - if test_result_indicator > 3: - test_result_indicator = 3 + if test_result_indicator > 2: + test_result_indicator = test_result_indicator - 1 return test_result_indicator diff --git a/utils/test/testapi/.gitignore b/utils/test/testapi/.gitignore index a3d6e01ec..21bb264e4 100644 --- a/utils/test/testapi/.gitignore +++ b/utils/test/testapi/.gitignore @@ -6,3 +6,8 @@ build *.egg-info 3rd_party/static/static *.pyc +.cache +.eggs +.tox +.ven +docs/_build diff --git a/utils/test/testapi/docs/Makefile b/utils/test/testapi/docs/Makefile new file mode 100644 index 000000000..11e9eb6d8 --- /dev/null +++ b/utils/test/testapi/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = OPNFVTestAPI +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file diff --git a/utils/test/testapi/docs/conf.py b/utils/test/testapi/docs/conf.py new file mode 100644 index 000000000..eaf15017d --- /dev/null +++ b/utils/test/testapi/docs/conf.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +# +# OPNFV TestAPI documentation build configuration file, created by +# sphinx-quickstart on Thu Oct 26 10:23:57 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OPNFV TestAPI' +copyright = u'2017, SerenaFeng' +author = u'SerenaFeng' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'v1.0' +# The full version, including alpha/beta/rc tags. +release = u'v1.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# This is required for the alabaster theme +# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars +html_sidebars = { + '**': [ + 'relations.html', # needs 'show_related': True theme option to display + 'searchbox.html', + ] +} + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OPNFVTestAPIdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'OPNFVTestAPI.tex', u'OPNFV TestAPI Documentation', + u'SerenaFeng', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'opnfvtestapi', u'OPNFV TestAPI Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'OPNFVTestAPI', u'OPNFV TestAPI Documentation', + author, 'OPNFVTestAPI', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/utils/test/testapi/docs/developer/devguide/api.rst b/utils/test/testapi/docs/developer/devguide/api.rst new file mode 100644 index 000000000..cd2ca27cf --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/api.rst @@ -0,0 +1,10 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + +============ +Restful APIs +============ + +.. toctree:: + :maxdepth: 2 diff --git a/utils/test/testapi/README.rst b/utils/test/testapi/docs/developer/devguide/framework.rst index 0d18b7e93..f7a760531 100644 --- a/utils/test/testapi/README.rst +++ b/utils/test/testapi/docs/developer/devguide/framework.rst @@ -1,6 +1,14 @@ -============= -opnfv-testapi -============= +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + + +.. toctree:: + :maxdepth: 2 + +========= +Framework +========= **Test Results Collector of OPNFV Test Projects**: diff --git a/utils/test/testapi/docs/developer/devguide/index.rst b/utils/test/testapi/docs/developer/devguide/index.rst new file mode 100644 index 000000000..7afcd96fe --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/index.rst @@ -0,0 +1,18 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + + +*********************** +TestAPI Developer Guide +*********************** + +.. toctree:: + :maxdepth: 2 + + overview.rst + framework.rst + api.rst + swagger-ui.rst + web-portal.rst + testapi-client.rst diff --git a/utils/test/testapi/docs/developer/devguide/overview.rst b/utils/test/testapi/docs/developer/devguide/overview.rst new file mode 100644 index 000000000..b6475f30e --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/overview.rst @@ -0,0 +1,98 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corporation + + +******** +Overview +******** + +TestAPI uses Python as primary programming language and build the framework from the following packages + +======== =============================================================================================================== +Module Package +======== =============================================================================================================== +api `Tornado-Motor`_ - API applications using Motor with tornado +swagger `tornado-swagger`_ - a wrapper for tornado which enables swagger-ui-v1.2 support +web `angular`_ - a superheroic JavaScript MVW framework, the version is AngularJS v1.3.15 +docs `sphinx`_ - a tool that makes it easy to create intelligent and beautiful documentation +testing `pytest`_ - a mature full-featured Python testing tool that helps you write better programs +======== =============================================================================================================== + + +Source Code +=========== + +The structure of repository is based on the recommended sample in `The Hitchhiker's Guide to Python`_ + +========================== ==================================================================================================== +Path Content +========================== ==================================================================================================== +``./3rd_party/`` third part included in TestAPI project +``./docker/`` configuration for building Docker image for TestAPI deployment +``./docs/`` user and developer documentation, design proposals +``./etc/`` configuration files used to install opnfv-testapi +``./opnfv_testapi/`` the actual package +``./opnfv_testapi/tests/`` package functional and unit tests +``./opts/`` optional components, e.g. one click deployment script +========================== ==================================================================================================== + + +Coding Style +============ + +TestAPI follows `OpenStack Style Guidelines`_ for source code and commit message. + +Specially, it is recommended to link each patch set with a JIRA issue. Put:: + + JIRA: RELENG-n + +in commit message to create an automatic link. + + +Testing +======= + +All testing related code are stored in ``./opnfv_testapi/tests/`` + +================== ==================================================================================================== +Path Content +================== ==================================================================================================== +``./tests/unit/`` unit test for each module, follow the same layout as ./opnfv_testapi/ +``./conftest.py`` pytest configuration in project scope +================== ==================================================================================================== + +`tox`_ is used to automate the testing tasks + +.. code-block:: shell + + cd <project_root> + pip install tox + tox + +The test cases are written in `pytest`_. You may run it selectively with + +.. code-block:: shell + + pytest opnfv_testapi/tests/unit/common/test_config.py + + +Branching +========= + +Currently, no branching for TestAPI, only master branch + + +Releasing +========= + +Currently, TestAPI does not follow community's milestones and releases + +.. _Tornado-Motor: https://motor.readthedocs.io/en/stable/tutorial-tornado.html +.. _tornado-swagger: https://github.com/SerenaFeng/tornado-swagger +.. _angular: https://code.angularjs.org/1.3.15/docs/guide +.. _sphinx: http://www.sphinx-doc.org/en/stable/ +.. _pytest: http://doc.pytest.org/ +.. _OpenStack Style Guidelines: http://docs.openstack.org/developer/hacking/ +.. _The Hitchhiker's Guide to Python: http://python-guide-pt-br.readthedocs.io/en/latest/writing/structure/ +.. _tox: https://tox.readthedocs.io/ diff --git a/utils/test/testapi/docs/developer/devguide/swagger-ui.rst b/utils/test/testapi/docs/developer/devguide/swagger-ui.rst new file mode 100644 index 000000000..7f53047e5 --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/swagger-ui.rst @@ -0,0 +1,10 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + +============ +Swagger page +============ + +.. toctree:: + :maxdepth: 2 diff --git a/utils/test/testapi/docs/developer/devguide/testapi-client.rst b/utils/test/testapi/docs/developer/devguide/testapi-client.rst new file mode 100644 index 000000000..ab4c8e802 --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/testapi-client.rst @@ -0,0 +1,10 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + +============== +TestAPI client +============== + +.. toctree:: + :maxdepth: 2 diff --git a/utils/test/testapi/docs/developer/devguide/web-portal.rst b/utils/test/testapi/docs/developer/devguide/web-portal.rst new file mode 100644 index 000000000..62b2f1794 --- /dev/null +++ b/utils/test/testapi/docs/developer/devguide/web-portal.rst @@ -0,0 +1,10 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) 2017 ZTE Corp. + +========== +Web portal +========== + +.. toctree:: + :maxdepth: 2 diff --git a/utils/test/testapi/docs/index.rst b/utils/test/testapi/docs/index.rst new file mode 100644 index 000000000..017282a74 --- /dev/null +++ b/utils/test/testapi/docs/index.rst @@ -0,0 +1,20 @@ +.. OPNFV TestAPI documentation master file, created by + sphinx-quickstart on Thu Oct 26 10:23:57 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to OPNFV TestAPI's documentation! +========================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + +Developer Guide +=============== + +.. toctree:: + :maxdepth: 2 + + developer/devguide/index.rst diff --git a/utils/test/testapi/etc/config.ini b/utils/test/testapi/etc/config.ini index 8d0bde20b..86cb0caa7 100644 --- a/utils/test/testapi/etc/config.ini +++ b/utils/test/testapi/etc/config.ini @@ -16,7 +16,8 @@ results_per_page = 20 # With debug_on set to true, error traces will be shown in HTTP responses debug = True -authenticate = False +token_check = False +authenticate = True [ui] url = http://localhost:8000 diff --git a/utils/test/testapi/opnfv_testapi/cmd/server.py b/utils/test/testapi/opnfv_testapi/cmd/server.py index b7d3caa20..011a6cd6e 100644 --- a/utils/test/testapi/opnfv_testapi/cmd/server.py +++ b/utils/test/testapi/opnfv_testapi/cmd/server.py @@ -42,7 +42,7 @@ def make_app(): return swagger.Application( url_mappings.mappings, debug=CONF.api_debug, - auth=CONF.api_authenticate, + auth=CONF.api_token_check, cookie_secret='opnfv-testapi', ) diff --git a/utils/test/testapi/opnfv_testapi/common/check.py b/utils/test/testapi/opnfv_testapi/common/check.py index 1dff37a67..667578fed 100644 --- a/utils/test/testapi/opnfv_testapi/common/check.py +++ b/utils/test/testapi/opnfv_testapi/common/check.py @@ -14,13 +14,14 @@ from tornado import gen from opnfv_testapi.common import constants from opnfv_testapi.common import message from opnfv_testapi.common import raises +from opnfv_testapi.common.config import CONF from opnfv_testapi.db import api as dbapi def is_authorized(method): @functools.wraps(method) def wrapper(self, *args, **kwargs): - if self.table in ['pods']: + if CONF.api_authenticate and self.table in ['pods']: testapi_id = self.get_secure_cookie(constants.TESTAPI_ID) if not testapi_id: raises.Unauthorized(message.not_login()) diff --git a/utils/test/testapi/opnfv_testapi/common/config.py b/utils/test/testapi/opnfv_testapi/common/config.py index 140e49283..f888b07be 100644 --- a/utils/test/testapi/opnfv_testapi/common/config.py +++ b/utils/test/testapi/opnfv_testapi/common/config.py @@ -44,7 +44,7 @@ class Config(object): def _parse_value(value): try: value = int(value) - except: + except Exception: if str(value).lower() == 'true': value = True elif str(value).lower() == 'false': diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/__init__.py b/utils/test/testapi/opnfv_testapi/handlers/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/__init__.py +++ b/utils/test/testapi/opnfv_testapi/handlers/__init__.py diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/handlers/base_handlers.py index 6c7a819c9..a8ee3db2b 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/base_handlers.py @@ -20,8 +20,8 @@ # feng.xiaowei@zte.com.cn remove DashboardHandler 5-30-2016 ############################################################################## -import json from datetime import datetime +import json from tornado import gen from tornado import web @@ -30,7 +30,7 @@ from opnfv_testapi.common import check from opnfv_testapi.common import message from opnfv_testapi.common import raises from opnfv_testapi.db import api as dbapi -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger DEFAULT_REPRESENTATION = "application/json" @@ -67,7 +67,7 @@ class GenericApiHandler(web.RequestHandler): def _create_response(self, resource): href = self.request.full_url() + '/' + str(resource) - return models.CreateResponse(href=href).format() + return base_models.CreateResponse(href=href).format() def format_data(self, data): cls_data = self.table_cls.from_dict(data) diff --git a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/pod_handlers.py index 502988752..abf5bf9f1 100644 --- a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/pod_handlers.py @@ -6,12 +6,12 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import handlers -from opnfv_testapi.resources import pod_models +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.models import pod_models from opnfv_testapi.tornado_swagger import swagger -class GenericPodHandler(handlers.GenericApiHandler): +class GenericPodHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(GenericPodHandler, self).__init__(application, request, **kwargs) self.table = 'pods' diff --git a/utils/test/testapi/opnfv_testapi/resources/project_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/project_handlers.py index be2950705..30d9ab34a 100644 --- a/utils/test/testapi/opnfv_testapi/resources/project_handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/project_handlers.py @@ -7,12 +7,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import handlers -from opnfv_testapi.resources import project_models +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.models import project_models from opnfv_testapi.tornado_swagger import swagger -class GenericProjectHandler(handlers.GenericApiHandler): +class GenericProjectHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(GenericProjectHandler, self).__init__(application, request, diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/result_handlers.py index a25852856..c4b61ff22 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/result_handlers.py @@ -6,23 +6,23 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +from datetime import datetime +from datetime import timedelta import json import logging from bson import objectid -from datetime import datetime -from datetime import timedelta from opnfv_testapi.common import constants from opnfv_testapi.common import message from opnfv_testapi.common import raises from opnfv_testapi.common.config import CONF -from opnfv_testapi.resources import handlers -from opnfv_testapi.resources import result_models +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.models import result_models from opnfv_testapi.tornado_swagger import swagger -class GenericResultHandler(handlers.GenericApiHandler): +class GenericResultHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(GenericResultHandler, self).__init__(application, request, @@ -33,7 +33,7 @@ class GenericResultHandler(handlers.GenericApiHandler): def get_int(self, key, value): try: value = int(value) - except: + except Exception: raises.BadRequest(message.must_int(key)) return value diff --git a/utils/test/testapi/opnfv_testapi/ui/root.py b/utils/test/testapi/opnfv_testapi/handlers/root_handlers.py index 286a6b097..92920fa85 100644 --- a/utils/test/testapi/opnfv_testapi/ui/root.py +++ b/utils/test/testapi/opnfv_testapi/handlers/root_handlers.py @@ -1,8 +1,8 @@ from opnfv_testapi.common.config import CONF -from opnfv_testapi.resources import handlers +from opnfv_testapi.handlers import base_handlers -class RootHandler(handlers.GenericApiHandler): +class RootHandler(base_handlers.GenericApiHandler): def get_template_path(self): return CONF.ui_static_path diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/scenario_handlers.py index e9c19a7a4..67abcfff6 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/scenario_handlers.py @@ -2,12 +2,12 @@ import functools from opnfv_testapi.common import message from opnfv_testapi.common import raises -from opnfv_testapi.resources import handlers -import opnfv_testapi.resources.scenario_models as models +from opnfv_testapi.handlers import base_handlers +import opnfv_testapi.models.scenario_models as models from opnfv_testapi.tornado_swagger import swagger -class GenericScenarioHandler(handlers.GenericApiHandler): +class GenericScenarioHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(GenericScenarioHandler, self).__init__(application, request, diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py b/utils/test/testapi/opnfv_testapi/handlers/sign_handlers.py index 318473ea2..754066256 100644 --- a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py +++ b/utils/test/testapi/opnfv_testapi/handlers/sign_handlers.py @@ -5,10 +5,10 @@ from tornado import web from opnfv_testapi.common import constants from opnfv_testapi.common.config import CONF from opnfv_testapi.db import api as dbapi -from opnfv_testapi.resources import handlers +from opnfv_testapi.handlers import base_handlers -class SignBaseHandler(handlers.GenericApiHandler): +class SignBaseHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(SignBaseHandler, self).__init__(application, request, **kwargs) self.table = 'users' diff --git a/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/testcase_handlers.py index 9399326f0..c4c3c21f5 100644 --- a/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py +++ b/utils/test/testapi/opnfv_testapi/handlers/testcase_handlers.py @@ -7,12 +7,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import handlers -from opnfv_testapi.resources import testcase_models +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.models import testcase_models from opnfv_testapi.tornado_swagger import swagger -class GenericTestcaseHandler(handlers.GenericApiHandler): +class GenericTestcaseHandler(base_handlers.GenericApiHandler): def __init__(self, application, request, **kwargs): super(GenericTestcaseHandler, self).__init__(application, request, diff --git a/utils/test/testapi/opnfv_testapi/handlers/user_handlers.py b/utils/test/testapi/opnfv_testapi/handlers/user_handlers.py new file mode 100644 index 000000000..5067e358b --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/handlers/user_handlers.py @@ -0,0 +1,25 @@ +from opnfv_testapi.common import constants +from opnfv_testapi.common import raises +from opnfv_testapi.common.config import CONF +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.models.user_models import User + + +class UserHandler(base_handlers.GenericApiHandler): + def __init__(self, application, request, **kwargs): + super(UserHandler, self).__init__(application, request, **kwargs) + self.table = 'users' + self.table_cls = User + + def get(self): + if CONF.api_authenticate: + username = self.get_secure_cookie(constants.TESTAPI_ID) + if username: + self._get_one(query={'user': username}) + else: + raises.Unauthorized('Unauthorized') + else: + self.finish_request(User('anonymous', + 'anonymous@linuxfoundation.com', + 'anonymous lf', + constants.TESTAPI_USERS).format()) diff --git a/utils/test/testapi/opnfv_testapi/resources/__init__.py b/utils/test/testapi/opnfv_testapi/models/__init__.py index 05c0c9392..05c0c9392 100644 --- a/utils/test/testapi/opnfv_testapi/resources/__init__.py +++ b/utils/test/testapi/opnfv_testapi/models/__init__.py diff --git a/utils/test/testapi/opnfv_testapi/resources/models.py b/utils/test/testapi/opnfv_testapi/models/base_models.py index e70a6ed23..27396d116 100644 --- a/utils/test/testapi/opnfv_testapi/resources/models.py +++ b/utils/test/testapi/opnfv_testapi/models/base_models.py @@ -91,10 +91,10 @@ class ModelBase(object): elif isinstance(obj, unicode): try: obj = self._obj_format(ast.literal_eval(obj)) - except: + except Exception: try: obj = str(obj) - except: + except Exception: obj = obj elif isinstance(obj, list): hs = list() diff --git a/utils/test/testapi/opnfv_testapi/resources/pod_models.py b/utils/test/testapi/opnfv_testapi/models/pod_models.py index 415d3d66b..15c283374 100644 --- a/utils/test/testapi/opnfv_testapi/resources/pod_models.py +++ b/utils/test/testapi/opnfv_testapi/models/pod_models.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger @@ -17,7 +17,7 @@ from opnfv_testapi.tornado_swagger import swagger @swagger.model() -class PodCreateRequest(models.ModelBase): +class PodCreateRequest(base_models.ModelBase): def __init__(self, name, mode='', details='', role=""): self.name = name self.mode = mode @@ -26,7 +26,7 @@ class PodCreateRequest(models.ModelBase): @swagger.model() -class Pod(models.ModelBase): +class Pod(base_models.ModelBase): def __init__(self, name='', mode='', details='', role="", _id='', create_date='', owner=''): @@ -40,7 +40,7 @@ class Pod(models.ModelBase): @swagger.model() -class Pods(models.ModelBase): +class Pods(base_models.ModelBase): """ @property pods: @ptype pods: C{list} of L{Pod} diff --git a/utils/test/testapi/opnfv_testapi/resources/project_models.py b/utils/test/testapi/opnfv_testapi/models/project_models.py index 3243882bd..5f280f192 100644 --- a/utils/test/testapi/opnfv_testapi/resources/project_models.py +++ b/utils/test/testapi/opnfv_testapi/models/project_models.py @@ -6,26 +6,26 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger @swagger.model() -class ProjectCreateRequest(models.ModelBase): +class ProjectCreateRequest(base_models.ModelBase): def __init__(self, name, description=''): self.name = name self.description = description @swagger.model() -class ProjectUpdateRequest(models.ModelBase): +class ProjectUpdateRequest(base_models.ModelBase): def __init__(self, name='', description=''): self.name = name self.description = description @swagger.model() -class Project(models.ModelBase): +class Project(base_models.ModelBase): def __init__(self, name=None, _id=None, description=None, create_date=None): self._id = _id @@ -35,7 +35,7 @@ class Project(models.ModelBase): @swagger.model() -class Projects(models.ModelBase): +class Projects(base_models.ModelBase): """ @property projects: @ptype projects: C{list} of L{Project} diff --git a/utils/test/testapi/opnfv_testapi/resources/result_models.py b/utils/test/testapi/opnfv_testapi/models/result_models.py index 890bf8220..97fda08b4 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_models.py +++ b/utils/test/testapi/opnfv_testapi/models/result_models.py @@ -6,12 +6,12 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger @swagger.model() -class TIHistory(models.ModelBase): +class TIHistory(base_models.ModelBase): """ @ptype step: L{float} """ @@ -21,7 +21,7 @@ class TIHistory(models.ModelBase): @swagger.model() -class TI(models.ModelBase): +class TI(base_models.ModelBase): """ @property histories: trust_indicator update histories @ptype histories: C{list} of L{TIHistory} @@ -37,7 +37,7 @@ class TI(models.ModelBase): @swagger.model() -class ResultCreateRequest(models.ModelBase): +class ResultCreateRequest(base_models.ModelBase): """ @property trust_indicator: @ptype trust_indicator: L{TI} @@ -74,7 +74,7 @@ class ResultCreateRequest(models.ModelBase): @swagger.model() -class ResultUpdateRequest(models.ModelBase): +class ResultUpdateRequest(base_models.ModelBase): """ @property trust_indicator: @ptype trust_indicator: L{TI} @@ -84,7 +84,7 @@ class ResultUpdateRequest(models.ModelBase): @swagger.model() -class TestResult(models.ModelBase): +class TestResult(base_models.ModelBase): """ @property trust_indicator: used for long duration test case @ptype trust_indicator: L{TI} @@ -116,7 +116,7 @@ class TestResult(models.ModelBase): @swagger.model() -class TestResults(models.ModelBase): +class TestResults(base_models.ModelBase): """ @property results: @ptype results: C{list} of L{TestResult} diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/models/scenario_models.py index d950ed1d7..0610c6b4c 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py +++ b/utils/test/testapi/opnfv_testapi/models/scenario_models.py @@ -1,4 +1,4 @@ -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger @@ -11,7 +11,7 @@ def dict_default(value): @swagger.model() -class ScenarioTI(models.ModelBase): +class ScenarioTI(base_models.ModelBase): def __init__(self, date=None, status='silver'): self.date = date self.status = status @@ -25,7 +25,7 @@ class ScenarioTI(models.ModelBase): @swagger.model() -class ScenarioScore(models.ModelBase): +class ScenarioScore(base_models.ModelBase): def __init__(self, date=None, score='0'): self.date = date self.score = score @@ -39,7 +39,7 @@ class ScenarioScore(models.ModelBase): @swagger.model() -class ScenarioProject(models.ModelBase): +class ScenarioProject(base_models.ModelBase): """ @property customs: @ptype customs: C{list} of L{string} @@ -83,7 +83,7 @@ class ScenarioProject(models.ModelBase): @swagger.model() -class ScenarioVersion(models.ModelBase): +class ScenarioVersion(base_models.ModelBase): """ @property projects: @ptype projects: C{list} of L{ScenarioProject} @@ -116,7 +116,7 @@ class ScenarioVersion(models.ModelBase): @swagger.model() -class ScenarioInstaller(models.ModelBase): +class ScenarioInstaller(base_models.ModelBase): """ @property versions: @ptype versions: C{list} of L{ScenarioVersion} @@ -146,7 +146,7 @@ class ScenarioInstaller(models.ModelBase): @swagger.model() -class ScenarioCreateRequest(models.ModelBase): +class ScenarioCreateRequest(base_models.ModelBase): """ @property installers: @ptype installers: C{list} of L{ScenarioInstaller} @@ -161,19 +161,19 @@ class ScenarioCreateRequest(models.ModelBase): @swagger.model() -class ScenarioChangeOwnerRequest(models.ModelBase): +class ScenarioChangeOwnerRequest(base_models.ModelBase): def __init__(self, owner=None): self.owner = owner @swagger.model() -class ScenarioUpdateRequest(models.ModelBase): +class ScenarioUpdateRequest(base_models.ModelBase): def __init__(self, name=None): self.name = name @swagger.model() -class Scenario(models.ModelBase): +class Scenario(base_models.ModelBase): """ @property installers: @ptype installers: C{list} of L{ScenarioInstaller} @@ -205,7 +205,7 @@ class Scenario(models.ModelBase): @swagger.model() -class Scenarios(models.ModelBase): +class Scenarios(base_models.ModelBase): """ @property scenarios: @ptype scenarios: C{list} of L{Scenario} diff --git a/utils/test/testapi/opnfv_testapi/resources/testcase_models.py b/utils/test/testapi/opnfv_testapi/models/testcase_models.py index 2379dfc4c..d1b8877f7 100644 --- a/utils/test/testapi/opnfv_testapi/resources/testcase_models.py +++ b/utils/test/testapi/opnfv_testapi/models/testcase_models.py @@ -6,12 +6,12 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tornado_swagger import swagger @swagger.model() -class TestcaseCreateRequest(models.ModelBase): +class TestcaseCreateRequest(base_models.ModelBase): def __init__(self, name, url=None, description=None, catalog_description=None, tier=None, ci_loop=None, criteria=None, blocking=None, dependencies=None, run=None, @@ -33,7 +33,7 @@ class TestcaseCreateRequest(models.ModelBase): @swagger.model() -class TestcaseUpdateRequest(models.ModelBase): +class TestcaseUpdateRequest(base_models.ModelBase): def __init__(self, name=None, description=None, project_name=None, catalog_description=None, tier=None, ci_loop=None, criteria=None, blocking=None, dependencies=None, run=None, @@ -55,7 +55,7 @@ class TestcaseUpdateRequest(models.ModelBase): @swagger.model() -class Testcase(models.ModelBase): +class Testcase(base_models.ModelBase): def __init__(self, _id=None, name=None, project_name=None, description=None, url=None, creation_date=None, catalog_description=None, tier=None, ci_loop=None, @@ -82,7 +82,7 @@ class Testcase(models.ModelBase): @swagger.model() -class Testcases(models.ModelBase): +class Testcases(base_models.ModelBase): """ @property testcases: @ptype testcases: C{list} of L{Testcase} diff --git a/utils/test/testapi/opnfv_testapi/models/user_models.py b/utils/test/testapi/opnfv_testapi/models/user_models.py new file mode 100644 index 000000000..90fbadcd4 --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/models/user_models.py @@ -0,0 +1,9 @@ +from opnfv_testapi.models import base_models + + +class User(base_models.ModelBase): + def __init__(self, user=None, email=None, fullname=None, groups=None): + self.user = user + self.email = email + self.fullname = fullname + self.groups = groups diff --git a/utils/test/testapi/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py index ce0a3eeb3..349d55771 100644 --- a/utils/test/testapi/opnfv_testapi/router/url_mappings.py +++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py @@ -9,19 +9,19 @@ import tornado.web from opnfv_testapi.common.config import CONF -from opnfv_testapi.resources import handlers -from opnfv_testapi.resources import pod_handlers -from opnfv_testapi.resources import project_handlers -from opnfv_testapi.resources import result_handlers -from opnfv_testapi.resources import scenario_handlers -from opnfv_testapi.resources import testcase_handlers -from opnfv_testapi.ui import root -from opnfv_testapi.ui.auth import sign -from opnfv_testapi.ui.auth import user +from opnfv_testapi.handlers import base_handlers +from opnfv_testapi.handlers import pod_handlers +from opnfv_testapi.handlers import project_handlers +from opnfv_testapi.handlers import result_handlers +from opnfv_testapi.handlers import root_handlers +from opnfv_testapi.handlers import scenario_handlers +from opnfv_testapi.handlers import sign_handlers +from opnfv_testapi.handlers import testcase_handlers +from opnfv_testapi.handlers import user_handlers mappings = [ # GET /versions => GET API version - (r"/versions", handlers.VersionHandler), + (r"/versions", base_handlers.VersionHandler), # few examples: # GET /api/v1/pods => Get all pods @@ -74,10 +74,11 @@ mappings = [ tornado.web.StaticFileHandler, {'path': CONF.ui_static_path}), - (r'/', root.RootHandler), - (r'/api/v1/auth/signin', sign.SigninHandler), - (r'/{}'.format(CONF.lfid_signin_return), sign.SigninReturnHandler), - (r'/api/v1/auth/signout', sign.SignoutHandler), - (r'/api/v1/profile', user.UserHandler), + (r'/', root_handlers.RootHandler), + (r'/api/v1/auth/signin', sign_handlers.SigninHandler), + (r'/{}'.format(CONF.lfid_signin_return), + sign_handlers.SigninReturnHandler), + (r'/api/v1/auth/signout', sign_handlers.SignoutHandler), + (r'/api/v1/profile', user_handlers.UserHandler), ] diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/common/test_config.py b/utils/test/testapi/opnfv_testapi/tests/unit/common/test_config.py index ea2297275..6d160ce1d 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/common/test_config.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/common/test_config.py @@ -12,7 +12,8 @@ def test_config_normal(mocker, config_normal): assert CONF.mongo_dbname == 'test_results_collection' assert CONF.api_port == 8000 assert CONF.api_debug is True - assert CONF.api_authenticate is False + assert CONF.api_token_check is False + assert CONF.api_authenticate is True assert CONF.ui_url == 'http://localhost:8000' diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py b/utils/test/testapi/opnfv_testapi/tests/unit/executor.py index aa99b9086..743c07615 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/executor.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/executor.py @@ -14,7 +14,7 @@ import mock O_get_secure_cookie = ( - 'opnfv_testapi.resources.handlers.GenericApiHandler.get_secure_cookie') + 'opnfv_testapi.handlers.base_handlers.GenericApiHandler.get_secure_cookie') def thread_execute(method, *args, **kwargs): diff --git a/utils/test/testapi/opnfv_testapi/ui/__init__.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/testapi/opnfv_testapi/ui/__init__.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/__init__.py diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c1.json b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c1.json index 187802215..187802215 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c1.json +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c1.json diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c2.json index 980051c4f..980051c4f 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/scenario-c2.json +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/scenario-c2.json diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_base.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_base.py index 89cd7e8ed..b7fabb994 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_base.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_base.py @@ -14,8 +14,8 @@ from bson.objectid import ObjectId import mock from tornado import testing -from opnfv_testapi.resources import models -from opnfv_testapi.resources import pod_models +from opnfv_testapi.models import base_models +from opnfv_testapi.models import pod_models from opnfv_testapi.tests.unit import fake_pymongo @@ -25,7 +25,7 @@ class TestBase(testing.AsyncHTTPTestCase): def setUp(self): self._patch_server() self.basePath = '' - self.create_res = models.CreateResponse + self.create_res = base_models.CreateResponse self.get_res = None self.list_res = None self.update_res = None diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py index 5d9da3a86..95ed8bac1 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py @@ -10,10 +10,10 @@ import httplib import unittest from opnfv_testapi.common import message -from opnfv_testapi.resources import pod_models +from opnfv_testapi.models import pod_models from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit import fake_pymongo -from opnfv_testapi.tests.unit.resources import test_base as base +from opnfv_testapi.tests.unit.handlers import test_base as base class TestPodBase(base.TestBase): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_project.py index 0622ba8d4..939cc0d07 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_project.py @@ -2,9 +2,9 @@ import httplib import unittest from opnfv_testapi.common import message -from opnfv_testapi.resources import project_models +from opnfv_testapi.models import project_models from opnfv_testapi.tests.unit import executor -from opnfv_testapi.tests.unit.resources import test_base as base +from opnfv_testapi.tests.unit.handlers import test_base as base class TestProjectBase(base.TestBase): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_result.py index 6c1a07a91..b9f9ede26 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_result.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_result.py @@ -15,12 +15,12 @@ import urllib import unittest from opnfv_testapi.common import message -from opnfv_testapi.resources import project_models -from opnfv_testapi.resources import result_models -from opnfv_testapi.resources import testcase_models +from opnfv_testapi.models import project_models +from opnfv_testapi.models import result_models +from opnfv_testapi.models import testcase_models from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit import fake_pymongo -from opnfv_testapi.tests.unit.resources import test_base as base +from opnfv_testapi.tests.unit.handlers import test_base as base class Details(object): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_scenario.py index 1367fc669..de7777a83 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_scenario.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_scenario.py @@ -6,8 +6,8 @@ import os from datetime import datetime from opnfv_testapi.common import message -import opnfv_testapi.resources.scenario_models as models -from opnfv_testapi.tests.unit.resources import test_base as base +import opnfv_testapi.models.scenario_models as models +from opnfv_testapi.tests.unit.handlers import test_base as base def _none_default(check, default): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_testcase.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py index 4f2bc2ad1..e4c668e7a 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_testcase.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py @@ -11,10 +11,10 @@ import httplib import unittest from opnfv_testapi.common import message -from opnfv_testapi.resources import project_models -from opnfv_testapi.resources import testcase_models +from opnfv_testapi.models import project_models +from opnfv_testapi.models import testcase_models from opnfv_testapi.tests.unit import executor -from opnfv_testapi.tests.unit.resources import test_base as base +from opnfv_testapi.tests.unit.handlers import test_base as base class TestCaseBase(base.TestBase): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_token.py index bd64723be..e8b746dfc 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_token.py @@ -11,7 +11,7 @@ from tornado import web from opnfv_testapi.common import message from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit import fake_pymongo -from opnfv_testapi.tests.unit.resources import test_result +from opnfv_testapi.tests.unit.handlers import test_result class TestTokenCreateResult(test_result.TestResultBase): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_version.py b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_version.py index 51fed11ea..6ef810f0e 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_version.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/handlers/test_version.py @@ -9,15 +9,15 @@ import httplib import unittest -from opnfv_testapi.resources import models +from opnfv_testapi.models import base_models from opnfv_testapi.tests.unit import executor -from opnfv_testapi.tests.unit.resources import test_base as base +from opnfv_testapi.tests.unit.handlers import test_base as base class TestVersionBase(base.TestBase): def setUp(self): super(TestVersionBase, self).setUp() - self.list_res = models.Versions + self.list_res = base_models.Versions self.basePath = '/versions' diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_fake_pymongo.py deleted file mode 100644 index 1ebc96f3b..000000000 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_fake_pymongo.py +++ /dev/null @@ -1,123 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corporation -# feng.xiaowei@zte.com.cn -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -import unittest - -from tornado import gen -from tornado import testing -from tornado import web - -from opnfv_testapi.tests.unit import fake_pymongo - - -class MyTest(testing.AsyncHTTPTestCase): - def setUp(self): - super(MyTest, self).setUp() - self.db = fake_pymongo - self.addCleanup(self._clear) - self.io_loop.run_sync(self.fixture_setup) - - def get_app(self): - return web.Application() - - @gen.coroutine - def fixture_setup(self): - self.test1 = {'_id': '1', 'name': 'test1'} - self.test2 = {'name': 'test2'} - yield self.db.pods.insert({'_id': '1', 'name': 'test1'}) - yield self.db.pods.insert({'name': 'test2'}) - - @testing.gen_test - def test_find_one(self): - user = yield self.db.pods.find_one({'name': 'test1'}) - self.assertEqual(user, self.test1) - self.db.pods.remove() - - @testing.gen_test - def test_find(self): - cursor = self.db.pods.find() - names = [] - while (yield cursor.fetch_next): - ob = cursor.next_object() - names.append(ob.get('name')) - self.assertItemsEqual(names, ['test1', 'test2']) - - @testing.gen_test - def test_update(self): - yield self.db.pods.update({'_id': '1'}, {'name': 'new_test1'}) - user = yield self.db.pods.find_one({'_id': '1'}) - self.assertEqual(user.get('name', None), 'new_test1') - - def test_update_dot_error(self): - self._update_assert({'_id': '1', 'name': {'1. name': 'test1'}}, - 'key 1. name must not contain .') - - def test_update_dot_no_error(self): - self._update_assert({'_id': '1', 'name': {'1. name': 'test1'}}, - None, - check_keys=False) - - def test_update_dollar_error(self): - self._update_assert({'_id': '1', 'name': {'$name': 'test1'}}, - 'key $name must not start with $') - - def test_update_dollar_no_error(self): - self._update_assert({'_id': '1', 'name': {'$name': 'test1'}}, - None, - check_keys=False) - - @testing.gen_test - def test_remove(self): - yield self.db.pods.remove({'_id': '1'}) - user = yield self.db.pods.find_one({'_id': '1'}) - self.assertIsNone(user) - - def test_insert_dot_error(self): - self._insert_assert({'_id': '1', '2. name': 'test1'}, - 'key 2. name must not contain .') - - def test_insert_dot_no_error(self): - self._insert_assert({'_id': '1', '2. name': 'test1'}, - None, - check_keys=False) - - def test_insert_dollar_error(self): - self._insert_assert({'_id': '1', '$name': 'test1'}, - 'key $name must not start with $') - - def test_insert_dollar_no_error(self): - self._insert_assert({'_id': '1', '$name': 'test1'}, - None, - check_keys=False) - - def _clear(self): - self.db.pods.clear() - - def _update_assert(self, docs, error=None, **kwargs): - self._db_assert('update', error, {'_id': '1'}, docs, **kwargs) - - def _insert_assert(self, docs, error=None, **kwargs): - self._db_assert('insert', error, docs, **kwargs) - - @testing.gen_test - def _db_assert(self, method, error, *args, **kwargs): - name_error = None - try: - yield self._eval_pods_db(method, *args, **kwargs) - except NameError as err: - name_error = err.args[0] - finally: - self.assertEqual(name_error, error) - - def _eval_pods_db(self, method, *args, **kwargs): - table_obj = vars(self.db)['pods'] - return table_obj.__getattribute__(method)(*args, **kwargs) - - -if __name__ == '__main__': - unittest.main() diff --git a/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py index e39a9f639..a04de07f7 100644 --- a/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py @@ -26,7 +26,7 @@ def swagger_handlers(): settings.docs_settings, name=settings.API_DOCS_NAME), tornado.web.URLSpec( - _path(r'resources.json$'), + _path(r'models.json$'), views.SwaggerResourcesHandler, settings.docs_settings, name=settings.RESOURCE_LISTING_NAME), diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/about/about.html b/utils/test/testapi/opnfv_testapi/ui/about/about.html index 65860a8cc..65860a8cc 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/about/about.html +++ b/utils/test/testapi/opnfv_testapi/ui/about/about.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/auth-failure/authFailureController.js b/utils/test/testapi/opnfv_testapi/ui/auth-failure/authFailureController.js index 29d1d70fa..29d1d70fa 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/auth-failure/authFailureController.js +++ b/utils/test/testapi/opnfv_testapi/ui/auth-failure/authFailureController.js diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/__init__.py b/utils/test/testapi/opnfv_testapi/ui/auth/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/utils/test/testapi/opnfv_testapi/ui/auth/__init__.py +++ /dev/null diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/user.py b/utils/test/testapi/opnfv_testapi/ui/auth/user.py deleted file mode 100644 index ab86007f1..000000000 --- a/utils/test/testapi/opnfv_testapi/ui/auth/user.py +++ /dev/null @@ -1,26 +0,0 @@ -from opnfv_testapi.common import constants -from opnfv_testapi.common import raises -from opnfv_testapi.resources import handlers -from opnfv_testapi.resources import models - - -class User(models.ModelBase): - def __init__(self, user=None, email=None, fullname=None, groups=None): - self.user = user - self.email = email - self.fullname = fullname - self.groups = groups - - -class UserHandler(handlers.GenericApiHandler): - def __init__(self, application, request, **kwargs): - super(UserHandler, self).__init__(application, request, **kwargs) - self.table = 'users' - self.table_cls = User - - def get(self): - username = self.get_secure_cookie(constants.TESTAPI_ID) - if username: - self._get_one(query={'user': username}) - else: - raises.Unauthorized('Unauthorized') diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/home/home.html b/utils/test/testapi/opnfv_testapi/ui/home/home.html index 47d747fd8..47d747fd8 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/home/home.html +++ b/utils/test/testapi/opnfv_testapi/ui/home/home.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logout.html b/utils/test/testapi/opnfv_testapi/ui/logout/logout.html index 38a5c3698..38a5c3698 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logout.html +++ b/utils/test/testapi/opnfv_testapi/ui/logout/logout.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logoutController.js b/utils/test/testapi/opnfv_testapi/ui/logout/logoutController.js index 1b6d78c63..1b6d78c63 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/logout/logoutController.js +++ b/utils/test/testapi/opnfv_testapi/ui/logout/logoutController.js diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html b/utils/test/testapi/opnfv_testapi/ui/pods/pods.html index 22f29347b..22f29347b 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/pods.html +++ b/utils/test/testapi/opnfv_testapi/ui/pods/pods.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js b/utils/test/testapi/opnfv_testapi/ui/pods/podsController.js index 489fa8a8d..489fa8a8d 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/pods/podsController.js +++ b/utils/test/testapi/opnfv_testapi/ui/pods/podsController.js diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html b/utils/test/testapi/opnfv_testapi/ui/profile/importPubKeyModal.html index 0f55c27fd..0f55c27fd 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html +++ b/utils/test/testapi/opnfv_testapi/ui/profile/importPubKeyModal.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profile.html b/utils/test/testapi/opnfv_testapi/ui/profile/profile.html index 763f5d120..763f5d120 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profile.html +++ b/utils/test/testapi/opnfv_testapi/ui/profile/profile.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profileController.js b/utils/test/testapi/opnfv_testapi/ui/profile/profileController.js index 5dbdf7b1a..5dbdf7b1a 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/profileController.js +++ b/utils/test/testapi/opnfv_testapi/ui/profile/profileController.js diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html b/utils/test/testapi/opnfv_testapi/ui/profile/showPubKeyModal.html index 5f63a5ef6..5f63a5ef6 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html +++ b/utils/test/testapi/opnfv_testapi/ui/profile/showPubKeyModal.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/editTestModal.html index 583c9b92b..583c9b92b 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html +++ b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/editTestModal.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/fullTestListModal.html index 6db198b02..6db198b02 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html +++ b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/fullTestListModal.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/reportDetails.html index 517e569c7..517e569c7 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html +++ b/utils/test/testapi/opnfv_testapi/ui/results-report/partials/reportDetails.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReport.html b/utils/test/testapi/opnfv_testapi/ui/results-report/resultsReport.html index 5527121ba..5527121ba 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReport.html +++ b/utils/test/testapi/opnfv_testapi/ui/results-report/resultsReport.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js b/utils/test/testapi/opnfv_testapi/ui/results-report/resultsReportController.js index 591ad402b..591ad402b 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js +++ b/utils/test/testapi/opnfv_testapi/ui/results-report/resultsReportController.js diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html b/utils/test/testapi/opnfv_testapi/ui/results/results.html index 2ae5339a0..2ae5339a0 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html +++ b/utils/test/testapi/opnfv_testapi/ui/results/results.html diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js b/utils/test/testapi/opnfv_testapi/ui/results/resultsController.js index cc6cc0b6e..cc6cc0b6e 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js +++ b/utils/test/testapi/opnfv_testapi/ui/results/resultsController.js diff --git a/utils/test/testapi/setup.cfg b/utils/test/testapi/setup.cfg index 23341e4b4..b3394d44f 100644 --- a/utils/test/testapi/setup.cfg +++ b/utils/test/testapi/setup.cfg @@ -1,8 +1,6 @@ [metadata] name = opnfv_testapi summary = Test Result Collector -description-file = - README.rst author = SerenaFeng author-email = feng.xiaowei@zte.com.cn #home-page = http://www.opnfv.org/ @@ -28,6 +26,7 @@ packages = data_files = /etc/opnfv_testapi = etc/config.ini /usr/local/share/opnfv_testapi = 3rd_party/static/* + /usr/local/share/opnfv_testapi/testapi-ui/components = opnfv_testapi/ui/* [entry_points] console_scripts = diff --git a/utils/test/testapi/tox.ini b/utils/test/testapi/tox.ini index d300f1a61..13b197c63 100644 --- a/utils/test/testapi/tox.ini +++ b/utils/test/testapi/tox.ini @@ -25,6 +25,10 @@ setenv= HOME = {envtmpdir} PYTHONPATH = {toxinidir} +[testenv:docs] +basepython=python2.7 +commands = sphinx-build -W -b html docs/ docs/_build + [testenv:pep8] deps = flake8 commands = flake8 {toxinidir} |