diff options
22 files changed, 512 insertions, 379 deletions
diff --git a/jjb/compass4nfv/compass-verify-jobs.yml b/jjb/compass4nfv/compass-verify-jobs.yml index d656b503d..f016b91c7 100644 --- a/jjb/compass4nfv/compass-verify-jobs.yml +++ b/jjb/compass4nfv/compass-verify-jobs.yml @@ -157,14 +157,14 @@ condition: SUCCESSFUL projects: - name: 'functest-compass-virtual-suite-{stream}' - current-parameters: true + current-parameters: false predefined-parameters: FUNCTEST_SUITE_NAME=healthcheck node-parameters: true kill-phase-on: NEVER abort-all-job: true - name: 'functest-compass-virtual-suite-{stream}' - current-parameters: true + current-parameters: false predefined-parameters: FUNCTEST_SUITE_NAME=vping_ssh node-parameters: true diff --git a/jjb/functest/functest-project-jobs.yml b/jjb/functest/functest-project-jobs.yml index 7036f20c0..353423d59 100644 --- a/jjb/functest/functest-project-jobs.yml +++ b/jjb/functest/functest-project-jobs.yml @@ -9,6 +9,7 @@ jobs: - 'functest-verify-{stream}' + - 'functest-docs-upload-{stream}' stream: - master: @@ -18,7 +19,7 @@ - danube: branch: 'stable/{stream}' gs-pathname: '/{stream}' - disabled: false + disabled: true - job-template: name: 'functest-verify-{stream}' @@ -80,6 +81,41 @@ unhealthy: 40 failing: 30 +- job-template: + name: 'functest-docs-upload-{stream}' + + disabled: '{obj:disabled}' + + parameters: + - project-parameter: + project: '{project}' + branch: '{branch}' + - 'opnfv-build-ubuntu-defaults' + + scm: + - git-scm + + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + 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}' + disable-strict-forbidden-file-verification: 'true' + forbidden-file-paths: + - compare-type: ANT + pattern: 'docs/**|.gitignore' + + builders: + - functest-upload-doc-artifact + ################################ # job builders ################################ @@ -89,3 +125,10 @@ builders: - shell: | cd $WORKSPACE && tox + +- builder: + name: functest-upload-doc-artifact + builders: + - shell: | + cd $WORKSPACE && tox -edocs + wget -O - https://git.opnfv.org/releng/plain/utils/upload-artifact.sh | bash -s "functest/api/_build" "docs" diff --git a/jjb/global/slave-params.yml b/jjb/global/slave-params.yml index 59c5856ca..50859c46f 100644 --- a/jjb/global/slave-params.yml +++ b/jjb/global/slave-params.yml @@ -226,7 +226,7 @@ default: 'daisy-baremetal' - string: name: INSTALLER_IP - default: '10.20.11.2' + default: '10.20.7.3' description: 'IP of the installer' - string: name: GIT_BASE diff --git a/jjb/releng/automate.yml b/jjb/releng/automate.yml index 9eb281de3..73bef3e8b 100644 --- a/jjb/releng/automate.yml +++ b/jjb/releng/automate.yml @@ -82,7 +82,9 @@ builders: - shell: | - bash ./utils/test/{module}/run_test.sh + cd ./utils/test/{module}/ + bash run_test.sh + cp *.xml $WORKSPACE publishers: - junit: @@ -247,7 +249,7 @@ name: 'testapi-automate-docker-deploy-macro' builders: - shell: | - bash ./jjb/releng/docker-deploy.sh 'sudo docker run -dti -p 8082:8000 -e mongodb_url=mongodb://172.17.0.1:27017 -e swagger_url=http://testresults.opnfv.org/test opnfv/testapi' "http://testresults.opnfv.org/test/swagger/APIs" + bash ./jjb/releng/docker-deploy.sh 'sudo docker run -dti -p 8082:8000 -e mongodb_url=mongodb://172.17.0.1:27017 -e base_url=http://testresults.opnfv.org/test opnfv/testapi' "http://testresults.opnfv.org/test/swagger/APIs" - builder: name: 'reporting-automate-docker-deploy-macro' builders: diff --git a/prototypes/xci/xci-deploy.sh b/prototypes/xci/xci-deploy.sh index a72c9274a..d71125651 100755 --- a/prototypes/xci/xci-deploy.sh +++ b/prototypes/xci/xci-deploy.sh @@ -42,7 +42,7 @@ source $XCI_PATH/config/env-vars #------------------------------------------------------------------------------- user_local_dev_vars=(OPNFV_RELENG_DEV_PATH OPNFV_OSA_DEV_PATH OPNFV_BIFROST_DEV_PATH) for local_user_var in ${user_local_dev_vars[@]}; do - [[ -n ${!local_user_var} ]] && export $local_user_var=${!local_user_var%/}/ + [[ -n ${!local_user_var:-} ]] && export $local_user_var=${!local_user_var%/}/ done unset user_local_dev_vars local_user_var diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index 993c0b948..285f838db 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -153,36 +153,40 @@ elif [ "$installer_type" == "apex" ]; then sudo scp $ssh_options root@$installer_ip:/home/stack/overcloudrc.v3 $dest_path elif [ "$installer_type" == "compass" ]; then - verify_connectivity $installer_ip - controller_ip=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \ - 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \ - | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"127.0.0.1\"/) {print $(i+2);break;}}' \ - | grep -oP "\d+.\d+.\d+.\d+") - - if [ -z $controller_ip ]; then - error "The controller $controller_ip is not up. Please check that the POD is correctly deployed." - fi - - info "Fetching rc file from controller $controller_ip..." - sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \ - "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null - sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null + if [ "${BRANCH}" == "master" ]; then + sudo docker cp compass-tasks:/opt/openrc $dest_path &> /dev/null + sudo chown $(whoami):$(whoami) $dest_path + else + verify_connectivity $installer_ip + controller_ip=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \ + 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \ + | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"127.0.0.1\"/) {print $(i+2);break;}}' \ + | grep -oP "\d+.\d+.\d+.\d+") - info "This file contains the mgmt keystone API, we need the public one for our rc file" + if [ -z $controller_ip ]; then + error "The controller $controller_ip is not up. Please check that the POD is correctly deployed." + fi - if grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1 ; then - public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ - "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \ - | grep publicurl | awk '{print $4}') - else - public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ - "ssh ${controller_ip} 'source /opt/admin-openrc.sh; \ - openstack endpoint list --interface public --service identity '" \ - | grep identity | awk '{print $14}') + info "Fetching rc file from controller $controller_ip..." + sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \ + "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null + sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null + + info "This file contains the mgmt keystone API, we need the public one for our rc file" + + if grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1 ; then + public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ + "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \ + | grep publicurl | awk '{print $4}') + else + public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ + "ssh ${controller_ip} 'source /opt/admin-openrc.sh; \ + openstack endpoint list --interface public --service identity '" \ + | grep identity | awk '{print $14}') + fi + info "public_ip: $public_ip" + swap_to_public $public_ip fi - info "public_ip: $public_ip" - swap_to_public $public_ip - elif [ "$installer_type" == "joid" ]; then # do nothing...for the moment diff --git a/utils/test/reporting/docker/reporting.sh b/utils/test/reporting/docker/reporting.sh index 49f4517f7..7fe97a88e 100755 --- a/utils/test/reporting/docker/reporting.sh +++ b/utils/test/reporting/docker/reporting.sh @@ -98,3 +98,5 @@ echo "daemon off;" >> /etc/nginx/nginx.conf cp /home/opnfv/utils/test/reporting/docker/supervisor.conf /etc/supervisor/conf.d/ ln -s /usr/bin/nodejs /usr/bin/node + +cd pages && /bin/bash angular.sh diff --git a/utils/test/reporting/docker/supervisor.conf b/utils/test/reporting/docker/supervisor.conf index 5e315babe..b323dd029 100644 --- a/utils/test/reporting/docker/supervisor.conf +++ b/utils/test/reporting/docker/supervisor.conf @@ -1,22 +1,19 @@ [supervisord] nodaemon = true -[program:reporting_tornado] +[program:tornado] user = root directory = /home/opnfv/utils/test/reporting/api/api command = python server.py --port=800%(process_num)d process_name=%(program_name)s%(process_num)d numprocs=4 numprocs_start=1 -autorestart = true -[program:reporting_nginx] +[program:nginx] user = root command = service nginx restart -autorestart = true -[program:reporting_angular] +[program:configuration] user = root directory = /home/opnfv/utils/test/reporting/pages -command = bash angular.sh -autorestart = true +command = bash config.sh diff --git a/utils/test/reporting/pages/angular.sh b/utils/test/reporting/pages/angular.sh index 080f27bb7..0e00ea635 100755 --- a/utils/test/reporting/pages/angular.sh +++ b/utils/test/reporting/pages/angular.sh @@ -1,8 +1,3 @@ -: ${SERVER_URL:='http://testresults.opnfv.org/reporting/api'} - -echo "var BASE_URL = 'http://${SERVER_URL}/landing-page'" >> app/scripts/app.config.js -echo "var PROJECT_URL = 'http://${SERVER_URL}'" >> app/scripts/app.config.js - apt-get install -y nodejs apt-get install -y npm npm install diff --git a/utils/test/reporting/pages/app/index.html b/utils/test/reporting/pages/app/index.html index f4eb65adf..843a6230e 100644 --- a/utils/test/reporting/pages/app/index.html +++ b/utils/test/reporting/pages/app/index.html @@ -87,10 +87,9 @@ <script src="scripts/controllers/auth.controller.js"></script> <script src="scripts/controllers/admin.controller.js"></script> <script src="scripts/controllers/main.controller.js"></script> - <script src="scripts/app.config.js"></script> <script src="scripts/controllers/testvisual.controller.js"></script> <!-- endbuild --> </body> -</html>
\ No newline at end of file +</html> diff --git a/utils/test/reporting/pages/app/scripts/app.config.js b/utils/test/reporting/pages/app/scripts/app.config.js deleted file mode 100644 index e69de29bb..000000000 --- a/utils/test/reporting/pages/app/scripts/app.config.js +++ /dev/null diff --git a/utils/test/reporting/pages/app/scripts/controllers/table.controller.js b/utils/test/reporting/pages/app/scripts/controllers/table.controller.js index 0f3a17a03..44d9441de 100644 --- a/utils/test/reporting/pages/app/scripts/controllers/table.controller.js +++ b/utils/test/reporting/pages/app/scripts/controllers/table.controller.js @@ -8,378 +8,399 @@ * Controller of the opnfvdashBoardAngularApp */ angular.module('opnfvApp') - .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', function($scope, $state, $stateParams, $http, TableFactory) { - - $scope.filterlist = []; - $scope.selection = []; - $scope.statusList = []; - $scope.projectList = []; - $scope.installerList = []; - $scope.versionlist = []; - $scope.loopci = []; - $scope.time = []; - $scope.tableDataAll = {}; - $scope.tableInfoAll = {}; - $scope.scenario = {}; - - $scope.VersionConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Version', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.VersionOption); - $scope.selection.push(value); - // console.log($scope.selection); - getScenarioData(); + .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', '$timeout', + function($scope, $state, $stateParams, $http, TableFactory, $timeout) { + + $scope.filterlist = []; + $scope.selection = []; + $scope.statusList = []; + $scope.projectList = []; + $scope.installerList = []; + $scope.versionlist = []; + $scope.loopci = []; + $scope.time = []; + $scope.tableDataAll = {}; + $scope.tableInfoAll = {}; + $scope.scenario = {}; + // $scope.selectProjects = []; + + + $scope.VersionConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Version', + onChange: function(value) { + checkElementArrayValue($scope.selection, $scope.VersionOption); + $scope.selection.push(value); + // console.log($scope.selection); + getScenarioData(); + } } - } - $scope.LoopConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Loop', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.LoopOption); - $scope.selection.push(value); - // console.log($scope.selection); - getScenarioData(); + $scope.LoopConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Loop', + onChange: function(value) { + checkElementArrayValue($scope.selection, $scope.LoopOption); + $scope.selection.push(value); + // console.log($scope.selection); + getScenarioData(); + } } - } - $scope.TimeConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Time', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.TimeOption); - $scope.selection.push(value); - // console.log($scope.selection) - getScenarioData(); + $scope.TimeConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Time', + onChange: function(value) { + checkElementArrayValue($scope.selection, $scope.TimeOption); + $scope.selection.push(value); + // console.log($scope.selection) + getScenarioData(); + } } - } - init(); + init(); - function init() { - $scope.toggleSelection = toggleSelection; - getScenarioData(); - // radioSetting(); - getFilters(); - } + function init() { + $scope.toggleSelection = toggleSelection; + getScenarioData(); + getFilters(); + } - function getFilters() { - TableFactory.getFilter().get({ + function getFilters() { + TableFactory.getFilter().get({ + + }).$promise.then(function(response) { + if (response != null) { + $scope.statusList = response.filters.status; + $scope.projectList = response.filters.projects; + $scope.installerList = response.filters.installers; + $scope.versionlist = response.filters.version; + $scope.loopci = response.filters.loops; + $scope.time = response.filters.time; + + $scope.statusListString = $scope.statusList.toString(); + $scope.projectListString = $scope.projectList.toString(); + $scope.installerListString = $scope.installerList.toString(); + $scope.VersionSelected = $scope.versionlist[1]; + $scope.LoopCiSelected = $scope.loopci[0]; + $scope.TimeSelected = $scope.time[0]; + radioSetting($scope.versionlist, $scope.loopci, $scope.time); + + } else { + alert("网络错误"); + } + }) + } + function getScenarioData() { - }).$promise.then(function(response) { - if (response != null) { - $scope.statusList = response.filters.status; - $scope.projectList = response.filters.projects; - $scope.installerList = response.filters.installers; - $scope.versionlist = response.filters.version; - $scope.loopci = response.filters.loops; - $scope.time = response.filters.time; + // var utl = BASE_URL + '/scenarios'; + var data = { + 'status': ['success', 'danger', 'warning'], + 'projects': ['functest', 'yardstick'], + 'installers': ['apex', 'compass', 'fuel', 'joid'], + 'version': $scope.VersionSelected, + 'loops': $scope.LoopCiSelected, + 'time': $scope.TimeSelected + }; - $scope.statusListString = $scope.statusList.toString(); - $scope.projectListString = $scope.projectList.toString(); - $scope.installerListString = $scope.installerList.toString(); - $scope.VersionSelected = $scope.versionlist[1]; - $scope.LoopCiSelected = $scope.loopci[0]; - $scope.TimeSelected = $scope.time[0]; - radioSetting($scope.versionlist, $scope.loopci, $scope.time); + TableFactory.getScenario(data).then(function(response) { + if (response.status == 200) { + $scope.scenario = response.data; - } else { - alert("网络错误"); - } - }) - } + reSettingcolspan(); + } + + }, function(error) { + + }) - function getScenarioData() { - - var utl = BASE_URL + '/scenarios'; - var data = { - 'status': ['success', 'danger', 'warning'], - 'projects': ['functest', 'yardstick'], - 'installers': ['apex', 'compass', 'fuel', 'joid'], - 'version': $scope.VersionSelected, - 'loops': $scope.LoopCiSelected, - 'time': $scope.TimeSelected - }; - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' - } } - $http.post(utl, data, config).then(function(response) { - if (response.status == 200) { - $scope.scenario = response.data; + + function reSettingcolspan() { + if ($scope.selectProjects == undefined || $scope.selectProjects == null) { constructJson(); - } - }) - } + $scope.colspan = $scope.tableDataAll.colspan; - //construct json - function constructJson() { + } else { + constructJson(); + $scope.colspan = $scope.tempColspan; + } + // console.log("test") + } - var colspan; - var InstallerData; - var projectsInfo; - $scope.tableDataAll["scenario"] = []; + //construct json + function constructJson(selectProject) { + var colspan; + var InstallerData; + var projectsInfo; + $scope.tableDataAll["scenario"] = []; - for (var item in $scope.scenario.scenarios) { - var headData = Object.keys($scope.scenario.scenarios[item].installers).sort(); - var scenarioStatus = $scope.scenario.scenarios[item].status; - var scenarioStatusDisplay; - if (scenarioStatus == "success") { - scenarioStatusDisplay = "navy"; - } else if (scenarioStatus == "danger") { - scenarioStatusDisplay = "danger"; - } else if (scenarioStatus == "warning") { - scenarioStatusDisplay = "warning"; - } + for (var item in $scope.scenario.scenarios) { - InstallerData = headData; - var projectData = []; - var datadisplay = []; - var projects = []; + var headData = Object.keys($scope.scenario.scenarios[item].installers).sort(); + var scenarioStatus = $scope.scenario.scenarios[item].status; + var scenarioStatusDisplay; + if (scenarioStatus == "success") { + scenarioStatusDisplay = "navy"; + } else if (scenarioStatus == "danger") { + scenarioStatusDisplay = "danger"; + } else if (scenarioStatus == "warning") { + scenarioStatusDisplay = "warning"; + } - for (var j = 0; j < headData.length; j++) { + InstallerData = headData; + var projectData = []; + var datadisplay = []; + var projects = []; - projectData.push($scope.scenario.scenarios[item].installers[headData[j]]); - } - for (var j = 0; j < projectData.length; j++) { - - for (var k = 0; k < projectData[j].length; k++) { - projects.push(projectData[j][k].project); - var temArray = []; - if (projectData[j][k].score == null) { - temArray.push("null"); - temArray.push(projectData[j][k].project); - temArray.push(headData[j]); - } else { - temArray.push(projectData[j][k].score); - temArray.push(projectData[j][k].project); - temArray.push(headData[j]); - } + for (var j = 0; j < headData.length; j++) { + projectData.push($scope.scenario.scenarios[item].installers[headData[j]]); + } + for (var j = 0; j < projectData.length; j++) { + + for (var k = 0; k < projectData[j].length; k++) { + projects.push(projectData[j][k].project); + var temArray = []; + if (projectData[j][k].score == null) { + temArray.push("null"); + temArray.push(projectData[j][k].project); + temArray.push(headData[j]); + } else { + temArray.push(projectData[j][k].score); + temArray.push(projectData[j][k].project); + temArray.push(headData[j]); + } + + + if (projectData[j][k].status == "platinium") { + temArray.push("primary"); + temArray.push("P"); + } else if (projectData[j][k].status == "gold") { + temArray.push("danger"); + temArray.push("G"); + } else if (projectData[j][k].status == "silver") { + temArray.push("warning"); + temArray.push("S"); + } else if (projectData[j][k].status == null) { + temArray.push("null"); + } + + datadisplay.push(temArray); - if (projectData[j][k].status == "platinium") { - temArray.push("primary"); - temArray.push("P"); - } else if (projectData[j][k].status == "gold") { - temArray.push("danger"); - temArray.push("G"); - } else if (projectData[j][k].status == "silver") { - temArray.push("warning"); - temArray.push("S"); - } else if (projectData[j][k].status == null) { - temArray.push("null"); } - datadisplay.push(temArray); - } - } + colspan = projects.length / headData.length; - colspan = projects.length / headData.length; - - var tabledata = { - scenarioName: item, - Installer: InstallerData, - projectData: projectData, - projects: projects, - datadisplay: datadisplay, - colspan: colspan, - status: scenarioStatus, - statusDisplay: scenarioStatusDisplay - }; + var tabledata = { + scenarioName: item, + Installer: InstallerData, + projectData: projectData, + projects: projects, + datadisplay: datadisplay, + colspan: colspan, + status: scenarioStatus, + statusDisplay: scenarioStatusDisplay + }; - JSON.stringify(tabledata); - $scope.tableDataAll.scenario.push(tabledata); + JSON.stringify(tabledata); + $scope.tableDataAll.scenario.push(tabledata); - // console.log(tabledata); - } + // console.log(tabledata); + + } - projectsInfo = $scope.tableDataAll.scenario[0].projects; + projectsInfo = $scope.tableDataAll.scenario[0].projects; - var tempHeadData = []; + var tempHeadData = []; - for (var i = 0; i < InstallerData.length; i++) { - for (var j = 0; j < colspan; j++) { - tempHeadData.push(InstallerData[i]); + for (var i = 0; i < InstallerData.length; i++) { + for (var j = 0; j < colspan; j++) { + tempHeadData.push(InstallerData[i]); + } } - } - //console.log(tempHeadData); + //console.log(tempHeadData); - var projectsInfoAll = []; + var projectsInfoAll = []; - for (var i = 0; i < projectsInfo.length; i++) { - var tempA = []; - tempA.push(projectsInfo[i]); - tempA.push(tempHeadData[i]); - projectsInfoAll.push(tempA); + for (var i = 0; i < projectsInfo.length; i++) { + var tempA = []; + tempA.push(projectsInfo[i]); + tempA.push(tempHeadData[i]); + projectsInfoAll.push(tempA); - } - //console.log(projectsInfoAll); + } + //console.log(projectsInfoAll); - $scope.tableDataAll["colspan"] = colspan; - $scope.tableDataAll["Installer"] = InstallerData; - $scope.tableDataAll["Projects"] = projectsInfoAll; + $scope.tableDataAll["colspan"] = colspan; + $scope.tableDataAll["Installer"] = InstallerData; + $scope.tableDataAll["Projects"] = projectsInfoAll; - // console.log($scope.tableDataAll); - $scope.colspan = $scope.tableDataAll.colspan; + // console.log($scope.tableDataAll); + $scope.colspan = $scope.tableDataAll.colspan; + console.log($scope.tableDataAll); - } + } - //get json element size - function getSize(jsondata) { - var size = 0; - for (var item in jsondata) { - size++; + //get json element size + function getSize(jsondata) { + var size = 0; + for (var item in jsondata) { + size++; + } + return size; } - return size; - } - $scope.colspan = $scope.tableDataAll.colspan; - // console.log($scope.colspan); + // console.log($scope.colspan); - //find all same element index - function getSameElementIndex(array, element) { - var indices = []; - var idx = array.indexOf(element); - while (idx != -1) { - indices.push(idx); - idx = array.indexOf(element, idx + 1); - } - //return indices; - var result = { element: element, index: indices }; - JSON.stringify(result); - return result; - } - //delete element in array - function deletElement(array, index) { - array.splice(index, 1); + //find all same element index + function getSameElementIndex(array, element) { + var indices = []; + var idx = array.indexOf(element); + while (idx != -1) { + indices.push(idx); + idx = array.indexOf(element, idx + 1); + } + //return indices; + var result = { element: element, index: indices }; + JSON.stringify(result); + return result; + } - } + //delete element in array + function deletElement(array, index) { + array.splice(index, 1); - function radioSetting(array1, array2, array3) { - var tempVersion = []; - var tempLoop = []; - var tempTime = []; - for (var i = 0; i < array1.length; i++) { - var temp = { - title: array1[i] - }; - tempVersion.push(temp); - } - for (var i = 0; i < array2.length; i++) { - var temp = { - title: array2[i] - }; - tempLoop.push(temp); } - for (var i = 0; i < array3.length; i++) { - var temp = { - title: array3[i] - }; - tempTime.push(temp); + + function radioSetting(array1, array2, array3) { + var tempVersion = []; + var tempLoop = []; + var tempTime = []; + for (var i = 0; i < array1.length; i++) { + var temp = { + title: array1[i] + }; + tempVersion.push(temp); + } + for (var i = 0; i < array2.length; i++) { + var temp = { + title: array2[i] + }; + tempLoop.push(temp); + } + for (var i = 0; i < array3.length; i++) { + var temp = { + title: array3[i] + }; + tempTime.push(temp); + } + $scope.VersionOption = tempVersion; + $scope.LoopOption = tempLoop; + $scope.TimeOption = tempTime; } - $scope.VersionOption = tempVersion; - $scope.LoopOption = tempLoop; - $scope.TimeOption = tempTime; - } - //remove element in the array - function removeArrayValue(arr, value) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == value) { - arr.splice(i, 1); - break; + //remove element in the array + function removeArrayValue(arr, value) { + for (var i = 0; i < arr.length; i++) { + if (arr[i] == value) { + arr.splice(i, 1); + break; + } } } - } - //check if exist element - function checkElementArrayValue(arrayA, arrayB) { - for (var i = 0; i < arrayB.length; i++) { - if (arrayA.indexOf(arrayB[i].title) > -1) { - removeArrayValue(arrayA, arrayB[i].title); + //check if exist element + function checkElementArrayValue(arrayA, arrayB) { + for (var i = 0; i < arrayB.length; i++) { + if (arrayA.indexOf(arrayB[i].title) > -1) { + removeArrayValue(arrayA, arrayB[i].title); + } } } - } - function toggleSelection(status) { - var idx = $scope.selection.indexOf(status); + function toggleSelection(status) { + var idx = $scope.selection.indexOf(status); + + if (idx > -1) { + $scope.selection.splice(idx, 1); + filterData($scope.selection) + } else { + $scope.selection.push(status); + filterData($scope.selection) + } + // console.log($scope.selection); - if (idx > -1) { - $scope.selection.splice(idx, 1); - filterData($scope.selection) - } else { - $scope.selection.push(status); - filterData($scope.selection) } - // console.log($scope.selection); - } + //filter function + function filterData(selection) { - //filter function - function filterData(selection) { + $scope.selectInstallers = []; + $scope.selectProjects = []; + $scope.selectStatus = []; + for (var i = 0; i < selection.length; i++) { + if ($scope.statusListString.indexOf(selection[i]) > -1) { + $scope.selectStatus.push(selection[i]); + } + if ($scope.projectListString.indexOf(selection[i]) > -1) { + $scope.selectProjects.push(selection[i]); + } + if ($scope.installerListString.indexOf(selection[i]) > -1) { + $scope.selectInstallers.push(selection[i]); + } + } + + + // $scope.colspan = $scope.selectProjects.length; + //when some selection is empty, we set it full + if ($scope.selectInstallers.length == 0) { + $scope.selectInstallers = $scope.installerList; - $scope.selectInstallers = []; - $scope.selectProjects = []; - $scope.selectStatus = []; - for (var i = 0; i < selection.length; i++) { - if ($scope.statusListString.indexOf(selection[i]) > -1) { - $scope.selectStatus.push(selection[i]); } - if ($scope.projectListString.indexOf(selection[i]) > -1) { - $scope.selectProjects.push(selection[i]); + if ($scope.selectProjects.length == 0) { + $scope.selectProjects = $scope.projectList; + $scope.colspan = $scope.tableDataAll.colspan; + } else { + $scope.colspan = $scope.selectProjects.length; + $scope.tempColspan = $scope.colspan; } - if ($scope.installerListString.indexOf(selection[i]) > -1) { - $scope.selectInstallers.push(selection[i]); + if ($scope.selectStatus.length == 0) { + $scope.selectStatus = $scope.statusList } - } - $scope.colspan = $scope.selectProjects.length; - //when some selection is empty, we set it full - if ($scope.selectInstallers.length == 0) { - $scope.selectInstallers = $scope.installerList; + // console.log($scope.selectStatus); + // console.log($scope.selectProjects); } - if ($scope.selectProjects.length == 0) { - $scope.selectProjects = $scope.projectList; - $scope.colspan = $scope.tableDataAll.colspan; - } - if ($scope.selectStatus.length == 0) { - $scope.selectStatus = $scope.statusList - } - // console.log($scope.selectStatus); - // console.log($scope.selectProjects); } - - - }]);
\ No newline at end of file + ]);
\ No newline at end of file diff --git a/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js b/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js index ae51e4ab0..894e10f77 100644 --- a/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js +++ b/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js @@ -41,25 +41,18 @@ angular.module('opnfvApp') $scope.tableData = null; $scope.modalName = name; - var url = PROJECT_URL + '/projects/' + name + '/cases'; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' - } - } - $http.get(url, config).then(function(response) { + TableFactory.getProjectTestCases(name).then(function(response) { if (response.status == 200) { $scope.tableData = response.data; $scope.tableData = constructObjectArray($scope.tableData); console.log($scope.tableData); $loading.finish('Key'); - - - } + }, function(error) { + }) + } //construct key value for tableData diff --git a/utils/test/reporting/pages/app/scripts/factory/table.factory.js b/utils/test/reporting/pages/app/scripts/factory/table.factory.js index 2a8cbd046..f0af34fb2 100644 --- a/utils/test/reporting/pages/app/scripts/factory/table.factory.js +++ b/utils/test/reporting/pages/app/scripts/factory/table.factory.js @@ -4,11 +4,24 @@ * get data factory */ angular.module('opnfvApp') - .factory('TableFactory', function($resource, $rootScope) { + .factory('TableFactory', function($resource, $rootScope, $http) { + + var BASE_URL = 'http://testresults.opnfv.org/reporting2'; + $.ajax({ + url: 'config.json', + async: false, + dataType: 'json', + success: function (response) { + BASE_URL = response.url; + }, + error: function (response){ + alert('fail to get api url, using default: http://testresults.opnfv.org/reporting2') + } + }); return { getFilter: function() { - return $resource(BASE_URL + '/filters', {}, { + return $resource(BASE_URL + '/landing-page/filters', {}, { 'get': { method: 'GET', @@ -16,33 +29,42 @@ angular.module('opnfvApp') }); }, getScenario: function() { - return $resource(BASE_URL + '/scenarios', {}, { - 'post': { - method: 'POST', + + var config = { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' } - }) + } + + return $http.post(BASE_URL + '/landing-page/scenarios', {}, config); }, + + getProjectUrl: function() { - return $resource(PROJECT_URL + '/projects-page/projects', {}, { + return $resource(BASE_URL + '/projects-page/projects', {}, { 'get': { method: 'GET' } }) }, - getProjectTestCases: function() { - return $resource(PROJECT_URL + '/projects/:project/cases', { project: '@project' }, { - 'get': { - method: 'GET' + getProjectTestCases: function(name) { + var config = { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' } - }) + }; + return $http.get(BASE_URL + '/projects/' + name + '/cases', {}, config) + + }, getProjectTestCaseDetail: function() { - return $resource(PROJECT_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, { + return $resource(BASE_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, { 'get': { method: 'GET' } }) } + }; - });
\ No newline at end of file + }); diff --git a/utils/test/reporting/pages/config.sh b/utils/test/reporting/pages/config.sh new file mode 100755 index 000000000..f9bb89ac8 --- /dev/null +++ b/utils/test/reporting/pages/config.sh @@ -0,0 +1,3 @@ +: ${SERVER_URL:='testresults.opnfv.org/reporting2'} + +echo "{\"url\": \"http://${SERVER_URL}\"}" > dist/config.json diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/config.json b/utils/test/testapi/3rd_party/static/testapi-ui/config.json index 9fdd85fbb..5d48c7b12 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/config.json +++ b/utils/test/testapi/3rd_party/static/testapi-ui/config.json @@ -1 +1 @@ -{"testapiApiUrl": "http://testresults.opnfv.org/test/api/v1"} +{"testapiApiUrl": "http://localhost:8000/api/v1"} diff --git a/utils/test/testapi/deployment/deploy.py b/utils/test/testapi/deployment/deploy.py index 748bd34f8..6433fa6b2 100644 --- a/utils/test/testapi/deployment/deploy.py +++ b/utils/test/testapi/deployment/deploy.py @@ -8,10 +8,10 @@ docker_compose_yml = './docker-compose.yml' docker_compose_template = './docker-compose.yml.template' -def render_docker_compose(port, swagger_url): +def render_docker_compose(port, base_url): vars = { "expose_port": port, - "swagger_url": swagger_url, + "base_url": base_url, } template = env.get_template(docker_compose_template) yml = template.render(vars=vars) @@ -22,7 +22,7 @@ def render_docker_compose(port, swagger_url): def main(args): - render_docker_compose(args.expose_port, args.swagger_url) + render_docker_compose(args.expose_port, args.base_url) os.system('docker-compose -f {} up -d'.format(docker_compose_yml)) @@ -33,8 +33,8 @@ if __name__ == '__main__': required=False, default=8000, help='testapi exposed port') - parser.add_argument('-su', '--swagger-url', + parser.add_argument('-l', '--base-url', type=str, required=True, - help='testapi exposed swagger-url') + help='testapi exposed base-url') main(parser.parse_args()) diff --git a/utils/test/testapi/deployment/docker-compose.yml.template b/utils/test/testapi/deployment/docker-compose.yml.template index 5b131f747..cd684048e 100644 --- a/utils/test/testapi/deployment/docker-compose.yml.template +++ b/utils/test/testapi/deployment/docker-compose.yml.template @@ -8,7 +8,7 @@ services: container_name: opnfv-testapi environment: - mongodb_url=mongodb://mongo:27017/ - - swagger_url={{ vars.swagger_url }} + - base_url={{ vars.base_url }} ports: - "{{ vars.expose_port }}:8000" links: diff --git a/utils/test/testapi/docker/Dockerfile b/utils/test/testapi/docker/Dockerfile index e031e194c..5311f35b8 100644 --- a/utils/test/testapi/docker/Dockerfile +++ b/utils/test/testapi/docker/Dockerfile @@ -9,7 +9,7 @@ # # Execution: # $ docker run -dti -p 8001:8000 \ -# -e "swagger_url=http://10.63.243.17:8001" \ +# -e "base_url=http://10.63.243.17:8001" \ # -e "mongodb_url=mongodb://10.63.243.17:27017/" \ # opnfv/testapi:tag # diff --git a/utils/test/testapi/docker/prepare-env.sh b/utils/test/testapi/docker/prepare-env.sh index 9f07efbd1..4f1be7d6a 100755 --- a/utils/test/testapi/docker/prepare-env.sh +++ b/utils/test/testapi/docker/prepare-env.sh @@ -6,6 +6,10 @@ if [ "$mongodb_url" != "" ]; then sudo crudini --set --existing $FILE mongo url $mongodb_url fi -if [ "$swagger_url" != "" ]; then - sudo crudini --set --existing $FILE swagger base_url $swagger_url +if [ "$base_url" != "" ]; then + sudo crudini --set --existing $FILE api url $base_url/api/v1 + sudo crudini --set --existing $FILE swagger base_url $base_url + sudo crudini --set --existing $FILE ui url $base_url + sudo echo "{\"testapiApiUrl\": \"$base_url/api/v1\"}" > \ + /usr/local/lib/python2.7/dist-packages/opnfv_testapi/static/testapi-ui/config.json fi diff --git a/utils/test/testapi/etc/config.ini b/utils/test/testapi/etc/config.ini index dad59d2d0..9ae25209d 100644 --- a/utils/test/testapi/etc/config.ini +++ b/utils/test/testapi/etc/config.ini @@ -8,7 +8,7 @@ dbname = test_results_collection [api] # Listening port -url = http://testresults.opnfv.org/test/api/v1 +url = http://localhost:8000/api/v1 port = 8000 # Number of results for one page (integer value) @@ -22,7 +22,7 @@ authenticate = False base_url = http://localhost:8000 [ui] -url = http://testresults.opnfv.org/test +url = http://localhost:8000 [osid] diff --git a/utils/upload-artifact.sh b/utils/upload-artifact.sh new file mode 100644 index 000000000..b66cdb7e1 --- /dev/null +++ b/utils/upload-artifact.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Orange and others. +# 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 +############################################################################## +set -e +set -o pipefail + +export PATH=$PATH:/usr/local/bin/ + +# 2 paramters +# - $1: the source directory where the files to be uploaded are located +# - $2: the target on artifact http://artifact.opnfv.org/<project>/$2 +# if not set, default value is <project>/docs +project=$PROJECT +if [ -z "$2" ] + then + artifact_dir="$project/docs" + else + artifact_dir="$project/$2" +fi +DIRECTORY="$1" + + +# check that the API doc directory does exist before pushing it to artifact +if [ ! -d "$DIRECTORY" ]; then + echo "Directory to be uploaded "$DIRECTORY" does not exist" + exit 1 +fi +set +e +gsutil&>/dev/null +if [ $? != 0 ]; then + echo "Not possible to push results to artifact: gsutil not installed" + exit 1 +else + gsutil ls gs://artifacts.opnfv.org/"$project"/ &>/dev/null + if [ $? != 0 ]; then + echo "Not possible to push results to artifact: gsutil not installed." + exit 1 + else + echo "Uploading file(s) to artifact $artifact_dir" + gsutil -m cp -r "$DIRECTORY"/* gs://artifacts.opnfv.org/"$artifact_dir"/ >/dev/null 2>&1 + fi +fi |