[ONOS-7346] Ver.f
Change-Id: I1e7d2f30876eee53d01baac7558f4563f4fdfaca
diff --git a/jjb/OnosSystemTest/check-style.sh b/jjb/OnosSystemTest/check-style.sh
new file mode 100644
index 0000000..094e896
--- /dev/null
+++ b/jjb/OnosSystemTest/check-style.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+cd $WORKSPACE
+rm -rf OnosSystemTest
+rm -f pep8Result.txt
+git clone https://gerrit.onosproject.org/OnosSystemTest; cd OnosSystemTest
+git review -d ${GERRIT_CHANGE_NUMBER}
+
+cd
+cd $WORKSPACE/OnosSystemTest/
+modifiedFiles=$(git diff-tree --no-commit-id --name-only -r HEAD | grep \.py) || modifiedFiles=""
+if [ -n "$modifiedFiles" ]
+then
+ pep8 --repeat --show-source --show-pep8 --ignore=E251,E201,E302,E202,E126,E127,E203,E226,E501,W391 $modifiedFiles > $WORKSPACE/pep8Result.txt
+else
+ touch $WORKSPACE/pep8Result.txt
+ rm -rf $WORKSPACE/OnosSystemTest/
+ echo "There were no files to code check, failing test so Jenkins doesn't comment."
+ exit 2
+fi
+cat $WORKSPACE/pep8Result.txt
+rm -rf $WORKSPACE/OnosSystemTest/
\ No newline at end of file
diff --git a/jjb/OnosSystemTest/cho-init.sh b/jjb/OnosSystemTest/cho-init.sh
new file mode 100644
index 0000000..7c0e11f
--- /dev/null
+++ b/jjb/OnosSystemTest/cho-init.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+echo -e "\n##### Set TestON Branch #####"
+echo "TestON Branch is set on: $TestONBranch"
+
+cd ~/OnosSystemTest/
+git checkout HEAD~1 # Make sure you aren't pn a branch
+git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
+git branch -D $TestONBranch # just incase there are local changes. This will normally result in a branch not found error
+git clean -df # clean any local files
+git fetch --all # update all caches from remotes
+git reset --hard origin/$TestONBranch # force local index to match remote branch
+git clean -df # clean any local files
+git checkout $TestONBranch #create new local branch
+git branch
+git log -1 --decorate
+# Cherry pick the debugging patch for CHO
+git fetch ssh://you@gerrit.onosproject.org:29418/OnosSystemTest refs/changes/51/14951/5 && git cherry-pick FETCH_HEAD
+
+echo -e "\n##### Set ONOS Branch #####"
+echo "ONOS Branch is set on: $ONOSBranch"
+
+echo -e "\n##### set a branch param for downstream project to use #####"
+echo $ONOSBranch > /tmp/branchToTest #set a param for downstream project to use
+#cat /tmp/branchToTest
+
+cd ~/onos
+git checkout HEAD~1 # Make sure you aren't pn a branch
+git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
+git branch -D $ONOSBranch # just incase there are local changes. This will normally result in a branch not found error
+git clean -df # clean any local files
+git fetch --all # update all caches from remotes
+git reset --hard origin/$ONOSBranch # force local index to match remote branch
+git clean -df # clean any local files
+if [ -z "$ONOSTag" ] #if tag is not specified
+then
+ git checkout $ONOSBranch #create new local branch
+else
+ git checkout $ONOSTag #checkout the tag
+fi
+git branch
+git log -1 --decorate
+# Cherry pick the debugging patch for CHO
+# git fetch ssh://you@gerrit.onosproject.org:29418/onos refs/changes/53/14953/1 && git cherry-pick FETCH_HEAD
+
+
+echo -e "\n##### set jvm heap size to 8G #####"
+echo ${ONOSJVMHeap}
+
+inserted_line="export JAVA_OPTS="${ONOSJVMHeap}""
+sed -i "s/bash/bash\n$inserted_line/" ~/onos/tools/package/bin/onos-service
+
+echo "##### Check onos-service setting..... #####"
+cat ~/onos/tools/package/bin/onos-service
+
+export JAVA_HOME=/usr/local/java/jdk1.8.0_51
+
+#Copy cell file over
+cp ~/choTest3 ~/onos/tools/test/cells/
\ No newline at end of file
diff --git a/jjb/OnosSystemTest/cho-post.sh b/jjb/OnosSystemTest/cho-post.sh
new file mode 100644
index 0000000..586ad1f
--- /dev/null
+++ b/jjb/OnosSystemTest/cho-post.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+export PYTHONPATH=/home/admin/TestON:/home/admin/sts
+
+#Run LogReport
+#/var/lib/jenkins/LogReport.py --nodes '10.128.40.41' '10.128.40.42' '10.128.40.43' --terms 'WARN' 'ERROR' 'Except' > /tmp/LogReport.txt
+
+#Copy generated wiki report file from TestON .rpt to /tmp
+#/var/lib/jenkins/Jenkins_getresult.py > /tmp/CHOresults.txt
+
+cd ~/CHO_Jenkins_Scripts
+# Generate the cvs files for plotting
+bash log-summary
+#source log-summary-cumulative 500
+
+# Refrest the images generated by Monitorix
+#curl http://10.128.40.41:8080/monitorix-cgi/monitorix.cgi?mode=localhost\&graph=all\&when=1week\&color=black > /dev/null
+#curl http://10.128.40.42:8080/monitorix-cgi/monitorix.cgi?mode=localhost\&graph=all\&when=1week\&color=black > /dev/null
+#curl http://10.128.40.43:8080/monitorix-cgi/monitorix.cgi?mode=localhost\&graph=all\&when=1week\&color=black > /dev/null
+#curl http://10.128.40.50:8080/monitorix-cgi/monitorix.cgi?mode=localhost\&graph=all\&when=1week\&color=black > /dev/null
+
+# Download required images to workspace folder
+#curl -o onos1cpu.png http://10.128.40.41:8080/monitorix/imgs/system1z.1week.png
+#curl -o onos1mem.png http://10.128.40.41:8080/monitorix/imgs/system3z.1week.png
+#curl -o onos1net.png http://10.128.40.41:8080/monitorix/imgs/net01z.1week.png
+#curl -o mininetcpu.png http://10.128.40.50:8080/monitorix/imgs/system1z.1week.png
+#curl -o mininetnet.png http://10.128.40.50:8080/monitorix/imgs/net01z.1week.png
\ No newline at end of file
diff --git a/jjb/OnosSystemTest/onos-test-freestyle.yaml b/jjb/OnosSystemTest/onos-test-freestyle.yaml
index 50af7e5..3d2ec67 100644
--- a/jjb/OnosSystemTest/onos-test-freestyle.yaml
+++ b/jjb/OnosSystemTest/onos-test-freestyle.yaml
@@ -40,8 +40,8 @@
cleaning{
if [ $? -eq 0 ]
then
- echo "Checking if there are logs older than ${DAYS_OLD} days...."
- for i in $(find . -mtime +${DAYS_OLD} -type d)
+ echo "Checking if there are logs older than ${{DAYS_OLD}} days...."
+ for i in $(find . -mtime +${{DAYS_OLD}} -type d)
do
echo -e "DIRs older than $DAYS_OLD are: "
echo $i
@@ -52,7 +52,20 @@
echo -e "\n After clean up disk usage:\n"
df -h
builders:
- - shell: !include-raw-escape: vm-bm-clean-up.sh
+ - shell: |
+ #!/bin/bash
+
+ source ./clean-up.sh
+
+ {beforeClean}
+
+ cd /home/{user}/OnosSystemTest/TestON/logs
+
+ {cleaning}
+
+ {additional}
+
+ {afterClean}
# post_Job
- job-template:
@@ -116,7 +129,8 @@
builders:
- clean-up-bash:
- cleanFileName: 'vm-bm-clean-up.sh'
+ user: 'sdn'
+ additional: ''
- job-template:
name: test-station-log-cleanup-BM
@@ -148,7 +162,8 @@
builders:
- clean-up-bash:
- cleanFileName: 'vm-bm-clean-up.sh'
+ user: 'sdn'
+ additional: ''
- job-template:
name: test-station-log-cleanup-CHO
@@ -180,7 +195,17 @@
builders:
- clean-up-bash:
- cleanFileName: 'cho-clean-up.sh'
+ user: 'admin'
+ additional: |
+ cd /var/lib/jenkins/workspace/OnosProdCHOpost
+
+ echo "Checking if there are jenkins-logs older than ${{DAYS_OLD}} days...."
+ for i in $(find . -mtime +${{DAYS_OLD}})
+ do
+ echo -e "logs older than $DAYS_OLD are: "
+ echo $i
+ rm -rf $i
+ done
# haven't done this yet.
- job-template:
@@ -190,13 +215,14 @@
properties:
- build-discarder:
- num-to-keep: 15
+ num-to-keep: 100
parameters:
- string:
- name: 'DAYS_OLD'
- default: '15'
+ name: 'GERRIT_CHANGE_NUMBER'
+ default: ''
+ description: '5-digit number that corresponds to the patch set change on Gerrit.'
- lf-infra-parameters:
project: '{project}'
@@ -204,10 +230,13 @@
stream: '{stream}'
lftools-version: '{lftools-version}'
- node: 'TestStation-CHOs'
+ concurrent: true
-# triggers:
-# - timed: '@daily'
+ node: 'TestStation-Jeremys'
+
+ builders:
+
+ - shell: !include-raw-escape: check-style.sh
- job-template:
name: delta-nightly
@@ -263,6 +292,116 @@
# Todo : add graph and confluence ( use pipeline for post build ..? )
+- job-template:
+ name: init-CHO
+
+ <<: *test-free-job-boiler-plate
+ properties:
+
+ - build-discarder:
+ num-to-keep: 30
+
+ parameters:
+
+ - string:
+ name: 'ONOSBranch'
+ default: 'master'
+ description: |
+ set onos branch to test. default to "master",
+ but can also be set at "onos-1.2", etc.
+ This parameter is also use to trigger where the test results to be posted
+
+ - string:
+ name: 'ONOSJVMHeap'
+ default: "\"${{JAVA_OPTS:--Xms8G -Xmx8G}}\""
+ description: 'onos cell jvm heap size setting'
+
+ - string:
+ name: 'TestONBranch'
+ default: 'master'
+ description: 'sets TestON branch'
+
+ - string:
+ name: 'ONOSTag'
+ default: ''
+
+ - lf-infra-parameters:
+ project: '{project}'
+ branch: '{stream}'
+ stream: '{stream}'
+ lftools-version: '{lftools-version}'
+
+ node: 'TestStation-CHOs'
+
+ wrappers:
+ - inject:
+ properties-file: '/var/lib/jenkins/TestONOS.property'
+ script-content: |
+ echo "ONOSBranch=$ONOSBranch" > /var/lib/jenkins/TestONOS.property
+ echo "TestONBranch=$TestONBranch" >> /var/lib/jenkins/TestONOS.property
+ echo "ONOSTag=$ONOSTag" >> /var/lib/jenkins/TestONOS.property
+
+ override-build-parameters: true
+
+ builders:
+
+ - shell: !include-raw-escape: cho-init.sh
+
+- job-template:
+ name: running-CHO
+
+ <<: *test-free-job-boiler-plate
+ properties:
+
+ - build-discarder:
+ num-to-keep: 30
+
+ parameters:
+
+ - lf-infra-parameters:
+ project: '{project}'
+ branch: '{stream}'
+ stream: '{stream}'
+ lftools-version: '{lftools-version}'
+
+ node: 'TestStation-CHOs'
+ triggers:
+ - reverse:
+ jobs: 'init-CHO'
+ result: 'failure'
+
+ builders:
+
+ - shell: !include-raw-escape: running-cho.sh
+
+- job-template:
+ name: post-CHO-master
+
+ <<: *test-free-job-boiler-plate
+ properties:
+ - lf-infra-properties:
+ project: '{project}'
+ build-days-to-keep: 7
+
+ parameters:
+
+ - lf-infra-parameters:
+ project: '{project}'
+ branch: '{stream}'
+ stream: '{stream}'
+ lftools-version: '{lftools-version}'
+
+ node: 'TestStation-CHOs'
+# triggers:
+# - timed: 'H/60 * * * *'
+ wrappers:
+ - inject:
+ properties-file: '/var/lib/jenkins/TestONOS.property'
+ builders:
+
+ - shell: !include-raw-escape: cho-post.sh
+# plot data needed.
+
#TODO LIST : DELTA -> perhaps change into pipeline?? , CHO_jobs, Check_style, Personal stations : necessary?
@@ -302,12 +441,12 @@
jobs:
- 'delta-nightly'
-#- project:
-# name: cho-tests
-# project-name: cho-tests
-#
-# <<: *test-free-init-procedure-plate
-# jobs:
-# - 'init-CHO'
-# - 'running-CHO'
-# - 'post-CHO-master'
+- project:
+ name: cho-tests
+ project-name: cho-tests
+
+ <<: *test-free-init-procedure-plate
+ jobs:
+ - 'init-CHO'
+ - 'running-CHO'
+ - 'post-CHO-master'
diff --git a/jjb/OnosSystemTest/running-cho.sh b/jjb/OnosSystemTest/running-cho.sh
new file mode 100644
index 0000000..f184bae
--- /dev/null
+++ b/jjb/OnosSystemTest/running-cho.sh
@@ -0,0 +1,23 @@
+#!/bin/bash -i
+echo "hello"
+export PYTHONUNBUFFERED=1
+cd ~
+export PATH=$PATH:onos/tools/test/bin
+echo "Test date: "
+date
+
+source .bash_killcmd
+killTestONall
+
+# Reset csv files for posting
+source /var/lib/jenkins/workspace/OnosProdCHOpost/log-summary-reset
+
+cd ~/OnosSystemTest/TestON/bin
+
+echo "*** copy Apache Karaf log config to onos directory for packaging."
+cp /home/admin/Applications/apache-karaf-3.0.5/etc/org.ops4j.pax.logging.cfg /home/admin/onos/tools/package/etc/
+timeout 240 stc shutdown | head -100
+timeout 240 stc teardown | head -100
+#Start TestON test
+./cleanup.sh
+./cli.py run CHOTestMonkey
\ No newline at end of file