Kailash Khalasi | 8831df0 | 2018-05-31 10:11:13 -0700 | [diff] [blame] | 1 | --- |
| 2 | # xos tosca unit test |
| 3 | |
| 4 | - job-template: |
| 5 | id: 'xos-tosca-unit-test' |
| 6 | name: 'verify_{project}_unit-test' |
| 7 | |
| 8 | description: | |
| 9 | Created by {id} job-template from ci-management/jjb/xos-tosca-unit.yaml |
| 10 | |
| 11 | triggers: |
| 12 | - cord-infra-gerrit-trigger-patchset: |
| 13 | gerrit-server-name: '{gerrit-server-name}' |
| 14 | project-regexp: '^{project}$' |
| 15 | branch-regexp: '{branch-regexp}' |
| 16 | dependency-jobs: '{dependency-jobs}' |
| 17 | file-include-regexp: '{all-files-regexp}' |
| 18 | |
| 19 | properties: |
| 20 | - cord-infra-properties: |
| 21 | build-days-to-keep: '{build-days-to-keep}' |
| 22 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 23 | |
| 24 | wrappers: |
| 25 | - lf-infra-wrappers: |
| 26 | build-timeout: 20 |
| 27 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 28 | |
| 29 | scm: |
| 30 | - lf-infra-gerrit-scm: |
| 31 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 32 | refspec: '$GERRIT_REFSPEC' |
| 33 | branch: '$GERRIT_BRANCH' |
| 34 | submodule-recursive: 'false' |
| 35 | choosing-strategy: gerrit |
| 36 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 37 | |
| 38 | node: 'ubuntu16.04-basebuild-1c-2g' |
| 39 | project-type: freestyle |
| 40 | concurrent: true |
| 41 | |
| 42 | builders: |
| 43 | - shell: | |
| 44 | #/usr/bin/env bash |
| 45 | BASEDIR=$(pwd) |
| 46 | |
| 47 | # setup virtual env |
| 48 | virtualenv -q venv-xos --no-site-packages |
| 49 | source $BASEDIR/venv-xos/bin/activate |
| 50 | pip install --upgrade pip setuptools |
| 51 | |
| 52 | # download changeset |
| 53 | mkdir cord && cd cord/ |
| 54 | repo init -u https://gerrit.opencord.org/manifest -b $GERRIT_BRANCH |
| 55 | repo sync |
| 56 | repo download $GERRIT_PROJECT $GERRIT_CHANGE_NUMBER/$GERRIT_PATCHSET_NUMBER |
| 57 | |
| 58 | # Install XOS dependencies |
| 59 | pip install nose2 requests_mock plyxproto jinja2 pattern astunparse pyyaml colorama |
| 60 | pip install pykwalify==1.6.1 |
| 61 | pip install multistructlog==1.5 |
| 62 | pip install networkx==1.11 |
| 63 | pip install netaddr==0.7.19 |
| 64 | pip install ipaddress==1.0.19 |
| 65 | echo "Requirements Installed" |
| 66 | |
| 67 | cd $BASEDIR/cord/orchestration/xos/lib/xos-util; python setup.py install; echo "xos-util Installed" |
| 68 | cd $BASEDIR/cord/orchestration/xos/lib/xos-config; python setup.py install; echo "xos-config Installed" |
| 69 | cd $BASEDIR/cord/orchestration/xos/lib/xos-genx; python setup.py install; echo "xos-genx Installed" |
| 70 | |
| 71 | cp -R $BASEDIR/cord/component/chameleon $BASEDIR/cord/orchestration/xos/xos/xos_client/xosapi/chameleon |
| 72 | cd $BASEDIR/cord/orchestration/xos/xos/xos_client/xosapi/chameleon/protos; VOLTHA_BASE=anything make |
| 73 | cd $BASEDIR/cord/orchestration/xos/xos/xos_client; python setup.py install |
| 74 | chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/gw_gen.py |
| 75 | chmod 777 $BASEDIR/venv-xos/lib/python2.7/site-packages/xosapi/chameleon/protoc_plugins/swagger_gen.py |
| 76 | pip install -r $BASEDIR/cord/orchestration/xos-tosca/pip_requirements.txt |
| 77 | |
| 78 | # Run the tests |
| 79 | cd $BASEDIR/cord/orchestration/xos-tosca |
| 80 | make tests |