+++ /dev/null
-==================================================
-How to create documentation for your OPNFV project
-==================================================
-
-Directory Structure
-===================
-
-This is the directory structure of the docs/ directory which have to be placed
-in the root of your project directory.
-
-.. code-block:: bash
-
- ./how-to-use-docs/documentation-example.rst
- ./how-to-use-docs/index.rst
-
-To create your own document, create any number of directories (depending
-on your need, e.g. manual) under the docs/ and place an index.rst in each
-directories.
-The depth of all directory should be one, so that you can make sure that
-all directory names are unique. If you want to have set of all documents in
-your repo, create new ``docs/all/index.rst`` and list document links in OPNFV
-artifact server (artifact.opnfv.org) instead of including all other rst files
-or having ``docs/index.rst``, in order to avoid having duplicated contents in
-your documents.
-
-Note:
-You may have "docs/how-to-use-docs/" in you project repo. You can delete it,
-since it is sample and master version is stored in releng repo.
-
-Note:
-During the document build process, 'docs_build' and 'docs_output' will be
-created in the project root directory. To avoid conflict, you should not
-use those names and should add the following entries in '.gitignore' file
-so that git can ignore built files.
-
-.. code-block:: bash
-
- /docs_build/
- /docs_output/
- /releng/
-
-Index File
-==========
-
-This index file must refence your other rst files in that directory.
-
-Here is an example index.rst :
-
-.. code-block:: bash
-
- *******************
- Documentation Title
- *******************
-
- .. toctree::
- :numbered:
- :maxdepth: 2
-
- documentation-example.rst
-
-Source Files
-============
-
-Document source files have to be written in reStructuredText format (rst).
-Each file would be build as an html page and a chapter in PDF.
-
-Here is an example source rst file :
-
-.. code-block:: bash
-
- =============
- Chapter Title
- =============
-
- Section Title
- =============
-
- Hello!
-
-Writing RST Markdown
-====================
-
-See http://sphinx-doc.org/rest.html .
-
-**Hint:**
-Table and its contents won't be adjusted, so you may need to fix your source
-text when your table is truncated in PDF version. Or, you can use 'longtable'
-option that splits your table vertically (by rows) in multiple pages.
-It is useful if you have trouble in rendering table containing many rows.
-
-.. code-block:: bash
-
- .. table::
- :class: longtable
-
- +------------------------+------------+----------+----------+
- | Header row, column 1 | Header 2 | Header 3 | Header 4 |
- +========================+============+==========+==========+
- | body row 1, column 1 | column 2 | column 3 | column 4 |
- +------------------------+------------+----------+----------+
- | body row 2 | ... | ... | |
- +------------------------+------------+----------+----------+
-
-**Hint:**
-You can add dedicated contents by using 'only' directive with build type
-('html' and 'pdf') for OPNFV document. But, this is not encouraged to use
-since this may make different views in HTML and PDF version.
-
-.. code-block:: bash
-
- .. only:: html
- This line will be shown only in html version.
-
-Configuration
-=============
-
-If you need to change the default configuration for document build, create
-new conf.py in the document directory (e.g. 'docs/how-to-use-docs/conf.py')
-that will be used in build process instead of default for OPNFV document
-build. The OPNFV default configuration can be found in releng repo
-(see `docs/etc/conf.py`_).
-
-.. _docs/etc/conf.py:
- https://gerrit.opnfv.org/gerrit/gitweb?p=releng.git;a=blob;f=docs/etc/conf.py;
-
-In the build process, the following parameters are automatically added if they
-are not set in the conf.py .
-
-* **release**, **version** : ``git last tag name`` (``git last commit hash``)
-* **project** : ``git repo name``
-* **copyright** : ``year``, OPNFV
-* **latex_documents** (set of pdf configuration) :
- [('index', '``document directory name``.tex',
- '``document title in index.rst``', 'OPNFV', 'manual'),]
-
-See http://sphinx-doc.org/config.html to learn sphinx configuration.
-
-**Note:**
-You can leave the file path for OPNFV logo image which will be prepared
-before each document build.
-
-**Hint:**
-In PDF, figures will be floated to get better view. If you want to avoid such
-automated fixes, just add this option to your conf.py after copying the default
-configuration in to the document directory.
-
-.. code-block:: bash
-
- latex_elements = {'figure_align': 'H'}
-
-Versioning
-==========
-
-The relevant release and version information will be added to your documents
-by using tags from your project's git repository.
-The tags will be applied by Releng Project.
-
-Testing
-=======
-
-You can test document build in your laptop by using build script which is
-also used in document build jobs below:
-
-.. code-block:: bash
-
- $ cd /local/repo/path/to/project
- $ git clone https://git.opnfv.org/releng
- $ ./releng/utils/docs-build.sh
-
-Then, you can see the docs in 'docs_output' directory if build succeeded.
-
-If you have a problem of missing python package, you can make sure all
-necessary packages are installed as follows:
-
-.. code-block:: bash
-
- $ sudo pip install Sphinx==1.3.1 doc8 sphinxcontrib-httpdomain
-
-Note:
-Developers are encouraged to use "ssh://<username>@gerrit.opnfv.org:29418/releng"
-instead of "https://git.opnfv.org/releng", so that you can quickly start
-development in releng.
-See https://wiki.opnfv.org/developer/getting_started for more detail.
-
-
-Jenkins Jobs
-============
-
-Enabling Jenkins Jobs
----------------------
-
-Jenkins in OPNFV infra performs the jobs to verify and update your documents.
-To make your project repository watched by Jenkins to execute those jobs, you
-have to add your project name in 'project-pattern' of the following jobs by
-sending patch to update `jjb/opnfv/opnfv-docs.yml`_ on gerrit.
-
-.. _jjb/opnfv/opnfv-docs.yml:
- https://gerrit.opnfv.org/gerrit/gitweb?p=releng.git;a=blob;f=jjb/opnfv/opnfv-docs.yml;
-
-Verify Job
-----------
-
-The verify job name is **opnfv-docs-verify**.
-
-When you send document changes to gerrit, jenkins will create your documents
-in HTML and PDF formats to verify that new document can be built successfully.
-Please check the jenkins log and artifact carefully.
-You can improve your document even though if the build job succeeded.
-
-Documents will be uploaded to
-``http://artifacts.opnfv.org/review/<Change Number>/`` for review.
-Those documents will be replaced if you update the change by sending new
-patch set to gerrit, and deleted after the change is merged.
-Document link(s) can be found in your change page on gerrit as a review
-comment.
-
-Note:
-Currently, the job reports 'SUCCESS' as result of document build even if the
-PDF creation failed. This is a provisional workaround, since many projects are
-not ready for PDF creation yet.
-
-Merge Job
-----------
-
-The merge job name is **opnfv-docs-merge**.
-
-Once you are happy with the look of your documentation, you can submit the
-change. Then, the merge job will upload latest build documents to
-``http://artifacts.opnfv.org/<Project Name>/docs/`` .
-You can put links in your project wiki page, so that everyone can see the
-latest document always.
-
-Sphinx Extensions
-=================
-
-You can see available sphinx extension(s) in `docs/etc/requirements.txt`_.
-
-.. _docs/etc/requirements.txt:
- https://gerrit.opnfv.org/gerrit/gitweb?p=releng.git;a=blob;f=docs/etc/requirements.txt;
-
-You can use other sphinx extensions to improve your documents.
-To share such tips, we encourage you to enable the extension in OPNFV infra
-by asking releng and opnfvdocs teams to add new sphinx extension via gerrit
-(proposing change in `docs/etc/conf.py`_ and `docs/etc/requirements.txt`_).
-After quick sanity checks, we'll install python package (if needed) and make
-it available in OPNFV document build.
+++ /dev/null
-..
- This is new template created on Nov 27, 2015.
-
-*********************
-Example Documentation
-*********************
-
-.. toctree::
- :numbered:
- :maxdepth: 2
-
- documentation-example.rst
fi
done
+ # Make sure ipxe-roms-qemu package is updated to latest.
+ # This package is needed for multi virtio nic PXE boot in virtual environment.
+ sudo yum update -y ipxe-roms-qemu
+
if [ -z ${PYTHONPATH:-} ]; then
export PYTHONPATH=${WORKSPACE}/lib/python
else
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
builders:
- trigger-builds:
- project: 'compass-deploy-{pod}-daily-{stream}'
- current-parameters: false
+ current-parameters: true
predefined-parameters: |
DEPLOY_SCENARIO={scenario}
COMPASS_OS_VERSION={os-version}
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
choosing-strategy: 'default'
triggers:
- - gerrit:
- trigger-on:
- - change-merged-event
- - comment-added-contains-event:
- comment-contains-value: 'remerge'
- projects:
- - project-compare-type: 'ANT'
- project-pattern: '{project}'
- branches:
- - branch-compare-type: 'ANT'
- branch-pattern: '**/{branch}'
- forbidden-file-paths:
- - compare-type: ANT
- pattern: 'docs/**'
+ - pollscm:
+ cron: '@midnight'
builders:
- shell: |
cd $WORKSPACE
+# remove the expired items from cache
+./ci/clean_cache.sh $CACHE_DIRECTORY
+
LATEST_ISO_PROPERTIES=$WORKSPACE/latest.iso.properties
if [[ "$JOB_NAME" =~ "daily" ]]; then
# check to see if we already have an artifact on artifacts.opnfv.org
- trigger:
name: 'fuel-os-nosdn-nofeature-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 0 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-odl_l2-nofeature-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 3 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-odl_l3-nofeature-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 6 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-onos-nofeature-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 9 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-odl_l2-bgpvpn-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 12 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-odl_l2-sfc-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 15 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-nosdn-kvm-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 18 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-nosdn-ovs-ha-baremetal-daily-master-trigger'
triggers:
- - timed: '0 21 * * *'
+ - timed: ''
- trigger:
name: 'fuel-os-nosdn-kvm-noha-baremetal-daily-master-trigger'
triggers:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
fi
INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
+ sudo scp root@${INSTALLER_IP}:/home/stack/stackrc .
+ stackrc="-v ./stackrc:/home/opnfv/functest/conf/stackrc"
+
if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
fi
echo "Functest: Pulling image opnfv/functest:${DOCKER_TAG}"
docker pull opnfv/functest:$DOCKER_TAG >/dev/null
-cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} ${custom_params} opnfv/functest:${DOCKER_TAG} /bin/bash"
+cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} ${custom_params} ${stackrc} opnfv/functest:${DOCKER_TAG} /bin/bash"
echo "Functest: Running docker run command: ${cmd}"
${cmd} >${redirect}
sleep 5
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
use-build-blocker: true
blocking-jobs:
- 'joid-os-.*?-{pod}-daily-{stream}'
+ block-level: 'NODE'
wrappers:
- build-name:
- job-template:
name: 'joid-deploy-{pod}-daily-{stream}'
- concurrent: false
+ concurrent: true
properties:
- throttle:
use-build-blocker: true
blocking-jobs:
- 'joid-deploy-{pod}-daily-{stream}'
+ block-level: 'NODE'
wrappers:
- build-name:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
parameters:
- project-parameter:
project: '{project}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- git-scm:
parameters:
- project-parameter:
project: '{project}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
- string:
name: GS_URL
default: '$GS_BASE{gs-pathname}'
description: "Reinstall MAAS and Bootstrap before deploy [true/false]"
- string:
name: UBUNTU_DISTRO
- default: 'trusty'
+ default: 'xenial'
description: "Ubuntu distribution to use for Openstack (trusty|xenial)"
- string:
name: CPU_ARCHITECTURE
name: GIT_BASE
default: https://gerrit.opnfv.org/gerrit/$PROJECT
description: 'Git URL to use on this Jenkins Slave'
-
-- parameter:
- name: 'opnfv-build-defaults'
- parameters:
- - label:
- name: SLAVE_LABEL
- default: 'opnfv-build'
- description: 'Slave label on Jenkins'
- - string:
- name: GIT_BASE
- default: https://gerrit.opnfv.org/gerrit/$PROJECT
- description: 'Git URL to use on this Jenkins Slave'
- - string:
- name: BUILD_DIRECTORY
- default: $WORKSPACE/build_output
- description: "Directory where the build artifact will be located upon the completion of the build."
-
-- parameter:
- name: 'intel-build1-defaults'
- parameters:
- - node:
- name: SLAVE_NAME
- description: 'Slave name on Jenkins'
- allowed-slaves:
- - intel-build1
- default-slaves:
- - intel-build1
- - string:
- name: GIT_BASE
- default: https://gerrit.opnfv.org/gerrit/$PROJECT
- description: 'Git URL to use on this Jenkins Slave'
-
-- parameter:
- name: 'intel-build2-defaults'
- parameters:
- - node:
- name: SLAVE_NAME
- description: 'Slave name on Jenkins'
- allowed-slaves:
- - intel-build2
- default-slaves:
- - intel-build2
- - string:
- name: GIT_BASE
- default: https://gerrit.opnfv.org/gerrit/$PROJECT
- description: 'Git URL to use on this Jenkins Slave'
-
-- parameter:
- name: 'intel-build3-defaults'
- parameters:
- - node:
- name: SLAVE_NAME
- description: 'Slave name on Jenkins'
- allowed-slaves:
- - intel-build3
- default-slaves:
- - intel-build3
- - string:
- name: GIT_BASE
- default: https://gerrit.opnfv.org/gerrit/$PROJECT
- description: 'Git URL to use on this Jenkins Slave'
-
- parameter:
name: 'zte-pod1-defaults'
parameters:
name: LAB_CONFIG_URL
default: ssh://git@git.enea.com/pharos/lab-config
description: 'Base URI to the configuration directory'
+- parameter:
+ name: 'opnfv-build-centos-defaults'
+ parameters:
+ - label:
+ name: SLAVE_LABEL
+ default: 'opnfv-build-centos'
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+ - string:
+ name: BUILD_DIRECTORY
+ default: $WORKSPACE/build_output
+ description: "Directory where the build artifact will be located upon the completion of the build."
+- parameter:
+ name: 'opnfv-build-ubuntu-defaults'
+ parameters:
+ - label:
+ name: SLAVE_LABEL
+ default: 'opnfv-build-ubuntu'
+ description: 'Slave label on Jenkins'
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+ - string:
+ name: BUILD_DIRECTORY
+ default: $WORKSPACE/build_output
+ description: "Directory where the build artifact will be located upon the completion of the build."
- master:
branch: '{stream}'
gs-pathname: ''
+ disabled: false
- brahmaputra:
branch: 'stable/{stream}'
gs-pathname: '/{stream}'
+ disabled: true
- job-template:
name: 'ovsnfv-verify-{stream}'
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'intel-build2-defaults'
+ - 'opnfv-build-centos-defaults'
- string:
name: GS_URL
default: '$GS_BASE{gs-pathname}'
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'intel-build2-defaults'
+ - 'opnfv-build-centos-defaults'
- string:
name: GS_URL
default: '$GS_BASE{gs-pathname}'
- job-template:
name: 'ovsnfv-daily-{stream}'
+ disabled: '{obj:disabled}'
+
parameters:
- project-parameter:
project: '{project}'
- - 'intel-build2-defaults'
+ - 'opnfv-build-centos-defaults'
- string:
name: GS_URL
default: '$GS_BASE{gs-pathname}'
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
installer: joid
<<: *master
auto-trigger-name: 'daily-trigger-disabled'
-# - zte-pod1: #would be confirmed with the ZTE lab by tomorrow
-# installer: fuel
-# <<: *master
+ - zte-pod1:
+ installer: fuel
+ auto-trigger-name: 'qtip-daily-zte-pod1-trigger'
+ <<: *master
#--------------------------------
jobs:
# triggers:
# - timed : ' 0 0 * * *'
-
+- trigger:
+ name: 'qtip-daily-zte-pod1-trigger'
+ triggers:
+ - timed: '0 5 * * *'
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
- job-template:
name: 'storperf-verify-{stream}'
- node: opnfv-build
+ node: opnfv-build-ubuntu
parameters:
- project-parameter:
- job-template:
name: 'storperf-merge-{stream}'
- # builder-merge job to run JJB update
- #
- # This job's purpose is to update all the JJB
-
- node: opnfv-build
+ node: opnfv-build-ubuntu
parameters:
- project-parameter:
# Required Variables:
# stream: branch with - in place of / (eg. stable)
# branch: branch (eg. stable)
- node: opnfv-build
+ node: opnfv-build-ubuntu
disabled: true
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
project: '{project}'
- gerrit-parameter:
branch: '{branch}'
- - 'opnfv-build-defaults'
+ - 'opnfv-build-ubuntu-defaults'
scm:
- gerrit-trigger-scm:
# Check if controller is alive (online='True')
controller_ip=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
- 'fuel node | grep controller | grep True | awk "{print \$10}" | tail -1') &> /dev/null
+ 'fuel node | grep controller | grep "True\| 1" | awk "{print \$10}" | tail -1') &> /dev/null
if [ -z $controller_ip ]; then
error "The controller $controller_ip is not up. Please check that the POD is correctly deployed."
items = ["tests", "Success rate", "duration"]
PERIOD = 7
-
+print "Generate Tempest automatic reporting"
for installer in installers:
# we consider the Tempest results of the last PERIOD days
- url = "http://testresults.opnfv.org/testapi/results?case=Tempest"
+ url = "http://testresults.opnfv.org/test/api/v1/results?case=Tempest"
request = Request(url + '&period=' + str(PERIOD)
+ '&installer=' + installer + '&version=master')
except URLError, e:
print 'No kittez. Got an error code:', e
- test_results = results['test_results']
+ test_results = results['results']
test_results.reverse()
scenario_results = {}
# For each scenario, we build a result object to deal with
# results, criteria and error handling
for result in scenario_results[s]:
- result["creation_date"] = result["creation_date"].split(".")[0]
+ result["start_date"] = result["start_date"].split(".")[0]
# retrieve results
# ****************
items=items,
installer=installer)
- with open("./release/index-tempest-" + installer + ".html", "wb") as fh:
+ with open("./release/master/index-tempest-" +
+ installer + ".html", "wb") as fh:
fh.write(outputText)
+print "Tempest automatic reporting Done"
step_order = ["initialisation", "orchestrator", "vIMS", "sig_test"]
for installer in installers:
- request = Request('http://testresults.opnfv.org/testapi/results?case=vIMS&installer=' + installer)
+ request = Request('http://testresults.opnfv.org/test/api/v1/results?case=vIMS&installer=' + installer)
try:
response = urlopen(request)
except URLError, e:
print 'No kittez. Got an error code:', e
- test_results = results['test_results']
+ test_results = results['results']
test_results.reverse()
scenario_results = {}
for s, s_result in scenario_results.items():
scenario_results[s] = s_result[0:5]
for result in scenario_results[s]:
- result["creation_date"] = result["creation_date"].split(".")[0]
+ result["start_date"] = result["start_date"].split(".")[0]
sig_test = result['details']['sig_test']['result']
if not sig_test == "" and isinstance(sig_test, list):
format_result = sig_test_format(sig_test)
outputText = template.render( scenario_results = scenario_results, step_order = step_order, installer = installer)
- with open("./release/index-vims" + installer + ".html", "wb") as fh:
+ with open("./release/master/index-vims-" + installer + ".html", "wb") as fh:
fh.write(outputText)
# ****************************************************
installers = ["apex", "compass", "fuel", "joid"]
# installers = ["compass"]
-versions = ["brahmaputra", "master"]
-# versions = ["master"]
+# versions = ["brahmaputra", "master"]
+versions = ["master"]
PERIOD = 10
MAX_SCENARIO_CRITERIA = 18
# urllib2.install_opener(opener)
# url = "http://127.0.0.1:8000/results?case=" + case + \
# "&period=30&installer=" + installer
- url = ("http://testresults.opnfv.org/testapi/results?case=" + case +
+ url = ("http://testresults.opnfv.org/test/api/v1/results?case=" + case +
"&period=" + str(reportingConf.PERIOD) + "&installer=" + installer +
"&scenario=" + scenario + "&version=" + version)
request = Request(url)
def getScenarios(case, installer, version):
case = case.getName()
- url = ("http://testresults.opnfv.org/testapi/results?case=" + case +
+ print case
+ url = ("http://testresults.opnfv.org/test/api/v1/results?case=" + case +
"&period=" + str(reportingConf.PERIOD) + "&installer=" + installer +
"&version=" + version)
request = Request(url)
response = urlopen(request)
k = response.read()
results = json.loads(k)
+ test_results = results['results']
except URLError, e:
print 'Got an error code:', e
- test_results = results['test_results']
-
if test_results is not None:
test_results.reverse()
for r in results:
for k, v in r.iteritems():
try:
- if "passed" in v:
+ if "PASS" in v:
nb_test_ok += 1
except:
print "Cannot retrieve test status"
# retrieve raw results
results = getApiResults(testCase, installer, scenario, version)
# let's concentrate on test results only
- test_results = results['test_results']
+ test_results = results['results']
# if results found, analyze them
if test_results is not None:
for r in test_results:
# print r["creation_date"]
# print r["criteria"]
- scenario_results.append({r["creation_date"]: r["criteria"]})
+ scenario_results.append({r["start_date"]: r["criteria"]})
# sort results
scenario_results.sort()
# 4 levels for the results
code, message = error(data)
raise HTTPError(code, message)
- data.creation_date = datetime.now()
- _id = yield self._eval_db(self.table, 'insert', data.format())
+ if self.table != 'results':
+ data.creation_date = datetime.now()
+ _id = yield self._eval_db(self.table, 'insert', data.format(),
+ check_keys=False)
if 'name' in self.json_args:
resource = data.name
else:
edit_request.update(self._update_requests(data))
""" Updating the DB """
- yield self._eval_db(self.table, 'update', query, edit_request)
+ yield self._eval_db(self.table, 'update', query, edit_request,
+ check_keys=False)
edit_request['_id'] = str(data._id)
self.finish_request(edit_request)
query[key] = new
return equal, query
- def _eval_db(self, table, method, *args):
- return eval('self.db.%s.%s(*args)' % (table, method))
+ def _eval_db(self, table, method, *args, **kwargs):
+ return eval('self.db.%s.%s(*args, **kwargs)' % (table, method))
def _eval_db_find_one(self, query, table=None):
if table is None:
return_one = True
docs = [docs]
+ if check_keys:
+ for doc in docs:
+ self._check_keys(doc)
+
ids = []
for doc in docs:
if '_id' not in doc:
doc['_id'] = str(ObjectId())
- if not check_keys or not self._find_one(doc['_id']):
+ if not self._find_one(doc['_id']):
ids.append(doc['_id'])
self.contents.append(doc_or_docs)
def find(self, *args):
return MemCursor(self._find(*args))
- def _update(self, spec, document):
+ def _update(self, spec, document, check_keys=True):
updated = False
+
+ if check_keys:
+ self._check_keys(document)
+
for index in range(len(self.contents)):
content = self.contents[index]
if self._in(content, spec):
self.contents[index] = content
return updated
- def update(self, spec, document):
- return thread_execute(self._update, spec, document)
+ def update(self, spec, document, check_keys=True):
+ return thread_execute(self._update, spec, document, check_keys)
def _remove(self, spec_or_id=None):
if spec_or_id is None:
def clear(self):
self._remove()
+ def _check_keys(self, doc):
+ for key in doc.keys():
+ print('key', key, 'value', doc.get(key))
+ if '.' in key:
+ raise NameError('key {} must not contain .'.format(key))
+ if key.startswith('$'):
+ raise NameError('key {} must not start with $'.format(key))
+ if isinstance(doc.get(key), dict):
+ self._check_keys(doc.get(key))
+
+
pods = MemDb()
projects = MemDb()
testcases = MemDb()
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)
+
@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)
- @gen_test
- def test_insert_check_keys(self):
- yield self.db.pods.insert({'_id': '1', 'name': 'test1'},
- check_keys=False)
- cursor = self.db.pods.find({'_id': '1'})
- names = []
- while (yield cursor.fetch_next):
- ob = cursor.next_object()
- names.append(ob.get('name'))
- self.assertItemsEqual(names, ['test1', 'test1'])
+ 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)
+
+ @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):
+ return eval('self.db.pods.%s(*args, **kwargs)' % method)
+
+
if __name__ == '__main__':
unittest.main()
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import unittest
+import copy
from opnfv_testapi.common.constants import HTTP_OK, HTTP_BAD_REQUEST, \
HTTP_NOT_FOUND
self.assertEqual(code, HTTP_OK)
self.assert_href(body)
+ def test_key_with_doc(self):
+ req = copy.deepcopy(self.req_d)
+ req.details = {'1.name': 'dot_name'}
+ (code, body) = self.create(req)
+ self.assertEqual(code, HTTP_OK)
+ self.assert_href(body)
+
class TestResultGet(TestResultBase):
def test_getOne(self):
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import unittest
+import copy
from test_base import TestBase
from opnfv_testapi.resources.testcase_models import TestcaseCreateRequest, \
self.assertEqual(_id, new_body._id)
self.assert_update_body(self.req_d, new_body, self.update_e)
+ def test_with_dollar(self):
+ self.create_d()
+ update = copy.deepcopy(self.update_d)
+ update.description = {'2. change': 'dollar change'}
+ code, body = self.update(update, self.req_d.name)
+ self.assertEqual(code, HTTP_OK)
+
class TestCaseDelete(TestCaseBase):
def test_notFound(self):