aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/build
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/tools/build')
-rw-r--r--framework/src/onos/tools/build/conf/pom.xml38
-rw-r--r--framework/src/onos/tools/build/conf/src/main/resources/onos/checkstyle.xml295
-rw-r--r--framework/src/onos/tools/build/conf/src/main/resources/onos/findbugs-suppressions.xml30
-rw-r--r--framework/src/onos/tools/build/conf/src/main/resources/onos/pmd.xml77
-rw-r--r--framework/src/onos/tools/build/conf/src/main/resources/onos/suppressions.xml32
-rw-r--r--framework/src/onos/tools/build/docker/Dockerfile56
-rw-r--r--framework/src/onos/tools/build/envDefaults51
-rwxr-xr-xframework/src/onos/tools/build/onos-build11
-rwxr-xr-xframework/src/onos/tools/build/onos-build-docs44
-rwxr-xr-xframework/src/onos/tools/build/onos-change-version56
-rwxr-xr-xframework/src/onos/tools/build/onos-package210
-rwxr-xr-xframework/src/onos/tools/build/onos-package-test31
-rwxr-xr-xframework/src/onos/tools/build/onos-release41
-rwxr-xr-xframework/src/onos/tools/build/onos-snapshot27
-rwxr-xr-xframework/src/onos/tools/build/onos-test22
-rwxr-xr-xframework/src/onos/tools/build/onos-upload-bits14
-rwxr-xr-xframework/src/onos/tools/build/onos-upload-docs23
-rwxr-xr-xframework/src/onos/tools/build/onosUploadBits.py40
-rw-r--r--framework/src/onos/tools/build/pom.xml123
-rwxr-xr-xframework/src/onos/tools/build/uploadToS3.py67
20 files changed, 1288 insertions, 0 deletions
diff --git a/framework/src/onos/tools/build/conf/pom.xml b/framework/src/onos/tools/build/conf/pom.xml
new file mode 100644
index 00000000..e4f8e9dc
--- /dev/null
+++ b/framework/src/onos/tools/build/conf/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-base</artifactId>
+ <version>1</version>
+ </parent>
+
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-build-conf</artifactId>
+ <version>1.0</version>
+ <description>Various ONOS build settings</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+</project>
+
diff --git a/framework/src/onos/tools/build/conf/src/main/resources/onos/checkstyle.xml b/framework/src/onos/tools/build/conf/src/main/resources/onos/checkstyle.xml
new file mode 100644
index 00000000..2908c891
--- /dev/null
+++ b/framework/src/onos/tools/build/conf/src/main/resources/onos/checkstyle.xml
@@ -0,0 +1,295 @@
+<?xml version="1.0"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+
+<!--
+ The default severity setting in checkstyle is 'error', so some
+ of the rules below are configured to change the severity to
+ 'warning'. Over time, these 'warning' settings should be
+ removed as more of the ONOS source code is modified to
+ follow the recommended rules.
+-->
+
+
+
+<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+ http://checkstyle.sourceforge.net/5.x/config.html#Checker
+
+ <property name="basedir" value="${basedir}"/>
+ -->
+ <!-- Checks that a package-info.java file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
+ <!-- ONOS does not currently supply package level Javadoc information
+ in package-info files -->
+ <!-- <module name="JavadocPackage"/> -->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <module name="NewlineAtEndOfFile"/>
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter"/>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="minimum" value="0"/>
+ <property name="maximum" value="0"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
+ <!-- <property name="fileExtensions" value="java"/> -->
+ <!-- </module> -->
+
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="(CHECKSTYLE\:OFF|Generated by the protocol buffer compiler.)"/>
+ <property name="onCommentFormat" value="CHECKSTYLE:ON"/>
+ </module>
+
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE IGNORE THIS LINE" />
+ <property name="checkFormat" value=".*" />
+ <property name="influenceFormat" value="0" />
+ </module>
+
+ <!-- Example: // CHECKSTYLE IGNORE FinalClass FOR NEXT 1 LINES -->
+ <module name="SuppressWithNearbyCommentFilter">
+ <property name="commentFormat" value="CHECKSTYLE IGNORE (\w+) FOR NEXT (\d+) LINES"/>
+ <property name="checkFormat" value="$1"/>
+ <property name="influenceFormat" value="$2"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <module name="FileContentsHolder"/>
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod">
+ <property name="severity" value="warning"/>
+ <property name="allowUndeclaredRTE" value="true"/>
+ </module>
+ <module name="JavadocType">
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="JavadocVariable">
+ <!-- Suppress check for private member Javadocs.
+ Possibly revist fixing these. -->
+ <property name="scope" value="public"/>
+ <property name="severity" value="warning"/>
+ </module>
+ <module name="JavadocStyle"/>
+ <!-- @author tag should not be used -->
+ <module name="WriteTag">
+ <property name="tag" value="@author"/>
+ <property name="tagFormat" value="\S"/>
+ <property name="severity" value="ignore"/>
+ <property name="tagSeverity" value="error"/>
+ </module>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName">
+ <!-- ONOS allows the name "log" for static final Loggers -->
+ <property name="format"
+ value="^log$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
+ </module>
+ <module name="LocalFinalVariableName"/>
+
+ <module name="LocalVariableName"/>
+
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport">
+ <property name="allowStaticMemberImports" value="true"/>
+ </module>
+ <module name="IllegalImport"/>
+ <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="LineLength">
+ <!-- ONOS standard usage is 80 columns, but we allow up
+ to 120 to not break the build. -->
+ <property name="max" value="120"/>
+ <property name="ignorePattern" value="^import"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="200"/>
+ </module>
+
+ <module name="ParameterNumber">
+ <property name="max" value="15"/>
+ <property name="tokens" value="CTOR_DEF"/>
+ </module>
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="GenericWhitespace"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+
+ <!-- Disabled for ONOS. Default rules specify undesired behavior for the '?' operator -->
+ <!-- <module name="OperatorWrap"/> -->
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround">
+ <property name="allowEmptyConstructors" value="true"/>
+ <property name="allowEmptyMethods" value="true"/>
+ </module>
+
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+
+ <!-- Disabled for ONOS to allow use of public -->
+ <!-- modifiers in interfaces. -->
+ <!-- <module name="RedundantModifier"/> -->
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks">
+ <!-- ONOS alows declarations inside of switch case blocks -->
+ <property name="allowInSwitchCase" value="true"/>
+ </module>
+ <module name="EmptyBlock"/>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!-- ONOS allows conditional operators -->
+ <!-- <module name="AvoidInlineConditionals"/> -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+
+ <module name="HiddenField">
+ <property name="ignoreSetter" value="true"/>
+ <property name="ignoreConstructorParameter" value="true"/>
+ </module>
+
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+
+ <!-- Many violations of this rule present, revist in a
+ subsequent round of cleanups -->
+ <!-- <module name="MagicNumber"/> -->
+ <module name="MissingSwitchDefault"/>
+
+ <module name="RedundantThrows">
+ <property name="allowSubclasses" value="true"/>
+ </module>
+
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!-- ONOS produces many warnings of this type.
+ Fixing all of these is outside the scope of the current cleanup. -->
+ <!-- <module name="DesignForExtension"/> -->
+ <module name="FinalClass"/>
+
+ <module name="HideUtilityClassConstructor"/>
+
+ <module name="InterfaceIsType"/>
+
+ <module name="VisibilityModifier">
+ <property name="severity" value="warning"/>
+ </module>
+
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle"/>
+
+ <!-- Many violations of this rule currently, too many to fix
+ in the current cleanup. -->
+ <!-- <module name="FinalParameters"/> -->
+ <!-- ONOS allows TODO markers in checked in source code -->
+ <!-- <module name="TodoComment"/> -->
+ <module name="UpperEll"/>
+
+
+ </module>
+
+ </module>
diff --git a/framework/src/onos/tools/build/conf/src/main/resources/onos/findbugs-suppressions.xml b/framework/src/onos/tools/build/conf/src/main/resources/onos/findbugs-suppressions.xml
new file mode 100644
index 00000000..2ebfa1de
--- /dev/null
+++ b/framework/src/onos/tools/build/conf/src/main/resources/onos/findbugs-suppressions.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<FindBugsFilter>
+
+ <!-- False positives on calls to CompletableFuture methods with a null
+ parameter -->
+ <Match>
+ <Class name="~org\.onosproject\.store\.service\.impl\..*" />
+ <Bug pattern="NP_NONNULL_PARAM_VIOLATION" />
+ </Match>
+
+ <!-- Filter out testing application -->
+ <Match>
+ <Class name="~org\.onosproject\.foo\..*" />
+ </Match>
+
+</FindBugsFilter>
diff --git a/framework/src/onos/tools/build/conf/src/main/resources/onos/pmd.xml b/framework/src/onos/tools/build/conf/src/main/resources/onos/pmd.xml
new file mode 100644
index 00000000..68d0b219
--- /dev/null
+++ b/framework/src/onos/tools/build/conf/src/main/resources/onos/pmd.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ name="ONOS Rules"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" >
+
+ <description>ONOS PMD rules</description>
+
+ <rule ref="rulesets/java/unnecessary.xml" >
+ <exclude name="UselessParentheses" />
+ </rule>
+ <rule ref="rulesets/java/basic.xml">
+ <exclude name="EmptyCatchBlock"/>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/java/unusedcode.xml">
+ <!-- Explicit public keyword in interface methods is acceptable -->
+ <exclude name="UnusedModifier" />
+ </rule>
+ <rule ref="rulesets/java/imports.xml"/>
+ <rule ref="rulesets/java/optimizations.xml">
+ <exclude name="LocalVariableCouldBeFinal" />
+ <exclude name="MethodArgumentCouldBeFinal" />
+ <exclude name="AvoidInstantiatingObjectsInLoops" />
+ </rule>
+
+ <rule ref="rulesets/java/strings.xml">
+ <exclude name="AvoidDuplicateLiterals" />
+ </rule>
+ <rule ref="rulesets/java/braces.xml"/>
+ <rule ref="rulesets/java/naming.xml">
+ <exclude name="AvoidInstantiatingObjectsInLoops" />
+ <exclude name="ShortClassName" />
+ <exclude name="ShortMethodName" />
+ <exclude name="ShortVariable" />
+ <exclude name="LongVariable" />
+ </rule>
+ <rule ref="rulesets/java/naming.xml/VariableNamingConventions">
+ <properties>
+ <!-- ONOS allows the name "log" for static final Loggers -->
+ <property name="violationSuppressRegex" value=".*'log'.*"/>
+ </properties>
+ </rule>
+
+ <rule ref="rulesets/java/clone.xml"/>
+ <rule ref="rulesets/java/strictexception.xml"/>
+ <rule ref="rulesets/java/design.xml">
+ <exclude name="GodClass" />
+ </rule>
+ <rule ref="rulesets/java/coupling.xml">
+ <exclude name="LawOfDemeter" />
+ <exclude name="ExcessiveImports" />
+ <!-- Suppress Removed misconfigured rule warning -->
+ <exclude name="LoosePackageCoupling" />
+ </rule>
+</ruleset>
+
diff --git a/framework/src/onos/tools/build/conf/src/main/resources/onos/suppressions.xml b/framework/src/onos/tools/build/conf/src/main/resources/onos/suppressions.xml
new file mode 100644
index 00000000..a71d941f
--- /dev/null
+++ b/framework/src/onos/tools/build/conf/src/main/resources/onos/suppressions.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+
+ <suppress files="org.apache.karaf.branding.*" checks="[a-zA-Z0-9]*"/>
+
+ <suppress files=".*" checks="FinalParametersCheck"/>
+ <suppress files=".*" checks="MagicNumbersCheck"/>
+ <suppress files=".*" checks="DesignForExtensionCheck"/>
+ <suppress files=".*" checks="TodoCommentCheck"/>
+ <suppress files=".*" checks="AvoidInlineConditionalsCheck"/>
+ <suppress files=".*" checks="OperatorWrapCheck"/>
+ <suppress files=".*" checks="HiddenField"/>
+ <suppress files=".java" checks="NewlineAtEndOfFile"/>
+
+</suppressions>
diff --git a/framework/src/onos/tools/build/docker/Dockerfile b/framework/src/onos/tools/build/docker/Dockerfile
new file mode 100644
index 00000000..fd61ad86
--- /dev/null
+++ b/framework/src/onos/tools/build/docker/Dockerfile
@@ -0,0 +1,56 @@
+FROM debian
+MAINTAINER Ali Al-Shabibi <ali@onlab.us>
+
+# Add Java 8 repository
+ENV DEBIAN_FRONTEND noninteractive
+RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
+ echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \
+ echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
+
+# Set the environment variables
+ENV HOME /root
+ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
+ENV ONOS_ROOT /src/onos
+ENV KARAF_VERSION 3.0.3
+ENV KARAF_ROOT /root/onos/apache-karaf-3.0.3
+ENV KARAF_LOG /root/onos/apache-karaf-3.0.3/data/log/karaf.log
+ENV BUILD_NUMBER docker
+ENV PATH $PATH:$KARAF_ROOT/bin
+
+#Download and Build ONOS
+WORKDIR /src
+RUN apt-get update && apt-get install -y maven git curl oracle-java8-installer oracle-java8-set-default && \
+ git clone https://github.com/opennetworkinglab/onos.git && cd onos && \
+ mkdir -p /root/Downloads && \
+ mvn clean install && \
+ tools/build/onos-package && \
+ rm -rf /root/.m2 && cd .. && \
+ rm -rf onos && \
+ apt-get remove --purge -y `apt-mark showauto` && \
+ apt-get install oracle-java8-set-default -y && \
+ apt-get clean && apt-get purge -y && apt-get autoremove -y && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /var/cache/oracle-jdk8-installer && \
+ rm -rf /root/Downloads
+
+# Change to /root directory
+WORKDIR /root
+
+#Install ONOS
+RUN mkdir onos && \
+ mv /tmp/onos-*.docker.tar.gz . && \
+ tar -xf onos-*.docker.tar.gz -C onos --strip-components=1 && \
+ rm -rf onos-*.docker.tar.gz
+
+
+# Ports
+# 6633 - OpenFlow
+# 8181 - GUI
+# 8101 - ONOS CLI
+# 9876 - ONOS CLUSTER COMMUNICATION
+EXPOSE 6633 8181 8101 9876
+
+# Get ready to run command
+WORKDIR /root/onos
+ENTRYPOINT ["./bin/onos-service"]
diff --git a/framework/src/onos/tools/build/envDefaults b/framework/src/onos/tools/build/envDefaults
new file mode 100644
index 00000000..57c1f677
--- /dev/null
+++ b/framework/src/onos/tools/build/envDefaults
@@ -0,0 +1,51 @@
+# Environmental defaults for ONOS build, package and test
+
+# Root of the ONOS source tree
+export ONOS_ROOT=${ONOS_ROOT:-~/onos}
+
+# M2 repository and Karaf gold bits
+export M2_REPO=${M2_REPO:-~/.m2/repository}
+export KARAF_VERSION=${KARAF_VERSION:-3.0.3}
+export KARAF_ZIP=${KARAF_ZIP:-~/Downloads/apache-karaf-$KARAF_VERSION.zip}
+export KARAF_TAR=${KARAF_TAR:-~/Downloads/apache-karaf-$KARAF_VERSION.tar.gz}
+export KARAF_DIST=$(basename $KARAF_ZIP .zip)
+
+# Add ONOS-specific directories to the exectable PATH
+export PATH="$PATH:$ONOS_ROOT/tools/dev/bin:$ONOS_ROOT/tools/test/bin"
+export PATH="$PATH:$ONOS_ROOT/tools/build"
+
+# Fallback build number us derived from from the user name & time
+export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)~$(date +'%Y/%m/%d@%H:%M')}
+
+# ONOS Version and onos.tar.gz staging environment
+export ONOS_POM_VERSION="1.3.0-SNAPSHOT"
+export ONOS_VERSION=${ONOS_VERSION:-1.3.0.$BUILD_NUMBER}
+
+# ONOS production bits (onos.tar.gz, onos.zip, onos.deb, onos.rpm) staging environment
+export ONOS_BITS=onos-${ONOS_VERSION%~*}
+export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp}
+export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS
+export ONOS_DEB_ROOT=$ONOS_STAGE_ROOT/deb
+export ONOS_DEB=$ONOS_STAGE.deb
+export ONOS_RPM_ROOT=$ONOS_STAGE_ROOT/rpm
+export ONOS_RPM=$ONOS_STAGE.rpm
+export ONOS_RPM_VERSION=${ONOS_POM_VERSION//-/.}
+export ONOS_TAR=$ONOS_STAGE.tar.gz
+export ONOS_ZIP=$ONOS_STAGE.zip
+
+# ONOS test bits (onos-test.tar.gz) staging environment
+export ONOS_TEST_BITS=onos-test-${ONOS_VERSION%~*}
+export ONOS_TEST_STAGE_ROOT=${ONOS_TEST_STAGE_ROOT:-/tmp}
+export ONOS_TEST_STAGE=$ONOS_STAGE_ROOT/$ONOS_TEST_BITS
+export ONOS_TEST_TAR=$ONOS_TEST_STAGE.tar.gz
+
+# Defaults for ONOS testing using remote machines.
+# if [ -n "${ONOS_CELL}" -a -f $ONOS_ROOT/tools/test/cells/${ONOS_CELL} ]; then
+# . $ONOS_ROOT/tools/test/cells/${ONOS_CELL}
+# fi
+export ONOS_INSTALL_DIR="/opt/onos" # Installation directory on remote
+export OCI="${OCI:-192.168.56.101}" # ONOS Controller Instance
+export ONOS_USER="${ONOS_USER:-sdn}" # ONOS user on remote system
+export ONOS_GROUP="${ONOS_GROUP:-sdn}" # ONOS group on remote system
+export ONOS_PWD="rocks" # ONOS user password on remote system
+export ONOS_SCENARIOS=$ONOS_ROOT/tools/test/scenarios
diff --git a/framework/src/onos/tools/build/onos-build b/framework/src/onos/tools/build/onos-build
new file mode 100755
index 00000000..b9c752e8
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-build
@@ -0,0 +1,11 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Builds the ONOS from source.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+cd $ONOS_ROOT && mvn clean install "$@"
diff --git a/framework/src/onos/tools/build/onos-build-docs b/framework/src/onos/tools/build/onos-build-docs
new file mode 100755
index 00000000..93a73c14
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-build-docs
@@ -0,0 +1,44 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Builds the ONOS Java API docs.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+apidocs=onos-apidocs-${ONOS_VERSION%~*}
+
+function expandList {
+ list="";
+ while read line; do
+ [ -n "$line" ] && list="$list:$line"
+ done < $1
+ echo "${list#:*}"
+}
+
+function processPom {
+ cp $1 aux-$1
+ egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
+ packages="$(expandList $line)"
+ sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
+ mv aux-$1.aux aux-$1
+ done
+}
+
+set -e
+
+trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
+rm -fr $ONOS_ROOT/docs/target
+
+cd $ONOS_ROOT/docs
+processPom external.xml
+mvn -f aux-external.xml javadoc:aggregate
+
+cd target && mv site/apidocs $apidocs
+tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp
+
+cd $ONOS_ROOT/docs
+processPom internal.xml
+mvn -f aux-internal.xml javadoc:aggregate
diff --git a/framework/src/onos/tools/build/onos-change-version b/framework/src/onos/tools/build/onos-change-version
new file mode 100755
index 00000000..a7117429
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-change-version
@@ -0,0 +1,56 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Changes ONOS version in POM files, and other release artifacts.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+export NEW_VERSION=$1
+[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
+
+export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
+
+cd $ONOS_ROOT
+
+# Augment the version of the main pom and the modules nested underneath.
+mvn versions:set -DnewVersion=$NEW_VERSION versions:commit
+
+# Augment the version of the Java API pom files and the overview.html file.
+for pom in docs/internal.xml docs/external.xml; do
+ sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" $pom
+ sed -i "" -E "1,/<doctitle>/s/<doctitle>ONOS Java API[^<]*</<doctitle>ONOS Java API ($NEW_VERSION)</g" $pom
+done
+
+# Augment the version in envDefaults, onos.py and archetypes test
+sed -i "" -E "s/ONOS_VERSION:-[^$]*/ONOS_VERSION:-$NEW_VERSION_SHORT./" $ONOS_ROOT/tools/build/envDefaults
+sed -i "" -E "s/features\/.*\/xml/features\/$NEW_VERSION\/xml/" $ONOS_ROOT/tools/test/topos/onos.py
+sed -i "" -E "s/ -Dversion=.*\"/ -Dversion=$NEW_VERSION\"/" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
+sed -i "" -E "s/ONOS_POM_VERSION=.*\"/ONOS_POM_VERSION=\"$NEW_VERSION\"/" $ONOS_ROOT/tools/build/envDefaults
+
+# Augment the version in jdvue/bin and stc/bin
+sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/utils/jdvue/bin/jdvue
+sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/utils/stc/bin/stc
+sed -i "" -E "s/VER=.*/VER=$NEW_VERSION/" $ONOS_ROOT/tools/test/bin/stc
+
+# Augment fallback version in CoreManager
+sed -i "" -E "s/Version\.version\(\"[^\"]*\"\)/Version.version(\"$NEW_VERSION\")/" \
+ $ONOS_ROOT/core/net/src/main/java/org/onosproject/core/impl/CoreManager.java
+
+# Augment the version in archetypes tree.
+mvn -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
+for atype in api bundle cli ui; do
+ pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
+ sed -i "" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
+done
+sed -i "" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
+
+# Augment the version cord-gui
+perl -i -0pe "s#<artifactId>cord-gui<.*\n.*version>#<artifactId>cord-gui</artifactId>\n <version>$NEW_VERSION</version>#" $ONOS_ROOT/apps/demo/cord-gui/pom.xml
+sed -i "" -E "s#demo/cord-gui/target/cord-gui-.*\.war#demo/cord-gui/target/cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/pullwar.sh
+sed -i "" -E "s#CORD=./cord-gui-.*\.war#CORD=./cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/run.me
+
+# Augment the acl app
+sed -i "" -E "s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $ONOS_ROOT/apps/acl/pom.xml
diff --git a/framework/src/onos/tools/build/onos-package b/framework/src/onos/tools/build/onos-package
new file mode 100755
index 00000000..8f6127da
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-package
@@ -0,0 +1,210 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Packages ONOS distributable into onos.tar.gz, onos.zip or a deb file
+# -----------------------------------------------------------------------------
+
+set -e
+
+# Build the staging directory used to produce the packages
+function build_stage_dir() {
+ # Make sure we have the original apache karaf bits first
+ [ ! -d $M2_REPO ] && echo "M2 repository $M2_REPO not found" && exit 1
+ [ -d $ONOS_STAGE ] && echo "ONOS stage $ONOS_STAGE already exists" && exit 1
+
+ # Create the stage directory and warp into it
+ mkdir -p $ONOS_STAGE
+ cd $ONOS_STAGE
+
+ # Check if Apache Karaf bits are available and if not, fetch them.
+ if [ ! -f $KARAF_ZIP -a ! -f $KARAF_TAR ]; then
+ echo "Downloading $KARAF_TAR..."
+ curl -sL http://downloads.onosproject.org/third-party/apache-karaf-$KARAF_VERSION.tar.gz > $KARAF_TAR
+ fi
+ [ ! -f $KARAF_ZIP -a ! -f $KARAF_TAR ] && \
+ echo "Apache Karaf bits $KARAF_ZIP or $KARAF_TAR not found" && exit 1
+
+ # Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
+ [ -f $KARAF_ZIP ] && unzip -q $KARAF_ZIP && rm -rf $ONOS_STAGE/$KARAF_DIST/demos
+ [ -f $KARAF_TAR ] && tar zxf $KARAF_TAR && rm -rf $ONOS_STAGE/$KARAF_DIST/demos
+ mkdir bin
+
+ # Stage the ONOS admin scripts and patch in Karaf service wrapper extras
+ cp -r $ONOS_ROOT/tools/package/bin .
+ cp -r $ONOS_ROOT/tools/package/debian $ONOS_STAGE/debian
+ cp -r $ONOS_ROOT/tools/package/etc/* $ONOS_STAGE/$KARAF_DIST/etc
+
+ # Stage all builtin ONOS apps for factory install
+ onos-stage-apps $ONOS_STAGE/apps $ONOS_STAGE/$KARAF_DIST/system
+
+ # Mark the org.onosproject.drivers app active by default
+ touch $ONOS_STAGE/apps/org.onosproject.drivers/active
+
+ # Patch-in proper Karaf version into the startup script
+ sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \
+ $ONOS_ROOT/tools/package/bin/onos-service > bin/onos-service
+ sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \
+ $ONOS_ROOT/tools/package/bin/onos-client > bin/onos
+ chmod a+x bin/onos-service bin/onos
+
+ # Stage the ONOS bundles, but only those that match the version
+ mkdir -p $ONOS_STAGE/$KARAF_DIST/system/org/onosproject
+ find $M2_REPO/org/onosproject -type f -path "*/$ONOS_POM_VERSION/*" \
+ -name '*.jar' -o -name '*.pom' -o -name '*-features.xml' \
+ | grep -v -Ee '-tests.jar|-[0-9]{8}.[0-9]{6}-' \
+ | while read src; do
+ dst=$ONOS_STAGE/$KARAF_DIST/system/${src#$M2_REPO/*}
+ mkdir -p $(dirname $dst)
+ cp $src $dst
+ done
+
+ # ONOS Patching ----------------------------------------------------------------
+
+ # Patch the Apache Karaf distribution file to add ONOS features repository
+ perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onosproject/onos-features/$ONOS_POM_VERSION/xml/features|" \
+ $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+
+ # Patch the Apache Karaf distribution file to load default ONOS boot features
+ export BOOT_FEATURES="webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui"
+ perl -pi.old -e "s|^(featuresBoot=.*)|\1,$BOOT_FEATURES|" \
+ $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
+
+ # Patch the Apache Karaf distribution with ONOS branding bundle
+ cp $M2_REPO/org/onosproject/onos-branding/$ONOS_POM_VERSION/onos-branding-*.jar \
+ $ONOS_STAGE/$KARAF_DIST/lib
+
+ # Patch in the ONOS version file
+ echo $ONOS_VERSION > $ONOS_STAGE/VERSION
+}
+
+function build_compressed_package() {
+ # Package up the ONOS tar file
+ cd $ONOS_STAGE_ROOT
+ rm -f $ONOS_TAR $ONOS_ZIP
+ COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS
+
+ # Figure out whether we should build ONOS zip file and if so, build it.
+ which zip >/dev/null && [ -z "$ONOS_TAR_ONLY" ] && buildZip=true || unset buildZip
+ [ -n "$buildZip" ] && zip -rq $ONOS_ZIP $ONOS_BITS
+
+ # Report on the archives that were built and clean-up
+ [ -n "$buildZip" ] && ls -lh $ONOS_TAR $ONOS_ZIP || ls -lh $ONOS_TAR
+ rm -r $ONOS_STAGE
+}
+
+# Build a DEB package
+function build_deb() {
+ echo "You need to be root in order to generate a proper DEB package."
+
+ sudo rm -fr $ONOS_DEB_ROOT
+
+ mkdir -p $ONOS_DEB_ROOT/{DEBIAN,opt,etc/init}
+
+ {
+ echo "Package: ONOS"
+ echo "Architecture: all"
+ echo "Maintainer: ONOS Project"
+ echo "Depends: debconf (>= 0.5.00), default-jre-headless (>= 1.8) | openjdk-8-jre | oracle-java8-installer"
+ echo "Priority: optional"
+ echo "Version: $ONOS_POM_VERSION"
+ echo "Description: Open Network Operating System (ONOS) is an"
+ echo " opensource SDN controller."
+ } > $ONOS_DEB_ROOT/DEBIAN/control
+
+ cp -r $ONOS_STAGE $ONOS_DEB_ROOT/opt/onos
+ cp $ONOS_ROOT/tools/package/debian/onos.conf $ONOS_DEB_ROOT/etc/init/
+
+ mkdir -p $ONOS_DEB_ROOT/opt/onos/var/
+
+ sudo chown -R root:root $ONOS_DEB_ROOT
+
+ sudo dpkg-deb --build $ONOS_DEB_ROOT > /dev/null &&
+ sudo mv $ONOS_STAGE_ROOT/deb.deb $ONOS_DEB && ls -l $ONOS_DEB
+}
+
+# Build an RPM package
+function build_rpm() {
+ read -r -p "WARN: rpm-build utility and root priviledges are need to build the package. Do you want to continue? [Y/n] " response
+ case $response in
+ [nN][oO])
+ exit 0
+ ;;
+ *)
+ sudo rm -fr $ONOS_RPM_ROOT
+
+ sudo yum -y install rpm-build
+
+ mkdir -p $ONOS_RPM_ROOT/{BUILD,RPMS,SOURCES/ONOS-$ONOS_RPM_VERSION/{etc/init,opt},SPECS,SRPMS}
+
+ cp -r $ONOS_STAGE $ONOS_RPM_ROOT/SOURCES/ONOS-$ONOS_RPM_VERSION/opt/onos
+ cp $ONOS_ROOT/tools/package/debian/onos.conf $ONOS_RPM_ROOT/SOURCES/ONOS-$ONOS_RPM_VERSION/etc/init/
+
+ cd $ONOS_RPM_ROOT/SOURCES
+ COPYFILE_DISABLE=1 tar zcf ONOS-$ONOS_RPM_VERSION.tar.gz ONOS-$ONOS_RPM_VERSION
+
+ {
+ echo "Name: ONOS"
+ echo "Version: $ONOS_RPM_VERSION"
+ echo "Release: 1"
+ echo "Summary: Open Networking Operating System (ONOS)"
+ echo "Vendor: ONOS Project"
+ echo "Packager: ONOS Project"
+ echo "Group: Applications/Engineering"
+ echo "Requires: jre >= 1:8"
+ echo "License: Apache 2.0"
+ echo "URL: http://www.onosproject.org"
+ echo "Source0: ONOS-$ONOS_RPM_VERSION.tar.gz"
+ echo "BuildArch: noarch"
+ echo "BuildRoot: %{_tmppath}/%{name}-buildroot"
+ echo "%description"
+ echo "Open Network Operating System (ONOS) is an opensource SDN controller."
+ echo -e "\n"
+ echo "%prep"
+ echo "%setup -q"
+ echo -e "\n"
+ echo "%install"
+ echo "mkdir -p %{buildroot}"
+ echo "cp -R * %{buildroot}"
+ echo -e "\n"
+ echo "%clean"
+ echo "rm -rf %{buildroot}"
+ echo -e "\n"
+ echo "%files"
+ echo "%defattr(-,root,root,-)"
+ echo "/etc/init/onos.conf"
+ echo "/opt/onos/"
+ echo -e "\n"
+ echo "%post"
+ echo "echo ONOS successfully installed at /opt/onos"
+ } > $ONOS_RPM_ROOT/SPECS/onos.spec
+
+ rpmbuild --define "_topdir $ONOS_RPM_ROOT" -bb $ONOS_RPM_ROOT/SPECS/onos.spec
+
+ cp $ONOS_RPM_ROOT/RPMS/noarch/ONOS-$ONOS_RPM_VERSION-1.noarch.rpm $ONOS_STAGE_ROOT && ls -l $ONOS_STAGE_ROOT/ONOS-$ONOS_RPM_VERSION-1.noarch.rpm
+ ;;
+ esac
+}
+
+# Script entry point
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+# Bail on any errors
+set -e
+
+# Before starting make sure the environment is clan - delete onos staging folder
+rm -fr $ONOS_STAGE
+
+# If there are parameters check if we want to build a deb - otherwise build tar.gz
+case ${1:---tar} in
+ "--tar" | "-T") build_stage_dir
+ build_compressed_package
+ ;;
+ "--deb" | "-D") build_stage_dir
+ build_deb
+ ;;
+ "--rpm" | "-R") build_stage_dir
+ build_rpm
+ ;;
+ *) echo "usage: $(basename $0) [--tar|--deb|--rpm]" >&2 && exit 1
+ ;;
+esac
diff --git a/framework/src/onos/tools/build/onos-package-test b/framework/src/onos/tools/build/onos-package-test
new file mode 100755
index 00000000..6328bb81
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-package-test
@@ -0,0 +1,31 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Packages ONOS test facilities into onos-test.tar.gz
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+# Bail on any errors
+set -e
+
+rm -fr $ONOS_TEST_STAGE # Remove this when package script is completed
+
+# Create the stage directory and warp into it
+mkdir -p $ONOS_TEST_STAGE/tools/test \
+ $ONOS_TEST_STAGE/tools/dev \
+ $ONOS_TEST_STAGE/tools/build \
+ $ONOS_TEST_STAGE/tools/package/config
+
+cp -r $ONOS_ROOT/tools/test $ONOS_TEST_STAGE/tools
+cp $ONOS_ROOT/tools/dev/bash_profile $ONOS_TEST_STAGE/tools/dev
+cp $ONOS_ROOT/tools/build/envDefaults $ONOS_TEST_STAGE/tools/build
+
+cd $ONOS_TEST_STAGE_ROOT
+
+# Now package up the ONOS test tools tar file
+COPYFILE_DISABLE=1 tar zcf $ONOS_TEST_TAR $ONOS_TEST_BITS
+cd $ONOS_TEST_STAGE_ROOT
+# rm -r $ONOS_TEST_STAGE
diff --git a/framework/src/onos/tools/build/onos-release b/framework/src/onos/tools/build/onos-release
new file mode 100755
index 00000000..8e7f7fb0
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-release
@@ -0,0 +1,41 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Drives the ONOS release process.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+set -e
+
+export NEW_VERSION=$1
+[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
+
+export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
+[ "$NEW_VERSION" != "$NEW_VERSION_SHORT" ] && echo "Version is a SNAPSHOT" && exit 1;
+
+cd $ONOS_ROOT
+
+# TODO: Create a new branch for this activity?
+
+# Change the version
+onos-change-version $NEW_VERSION
+export ONOS_VERSION=$NEW_VERSION
+
+# Build ONOS & deploy to staging repo using the release profile.
+onos-build && onos-package && mvn -Prelease clean deploy -DskipTests
+
+# Build ONOS docs
+onos-build-docs
+
+# Build ONOS archetypes & deploy to staging repo using the release profile.
+# Note that release of the staging repository is a separate manual step.
+pushd tools/package/archetypes/
+mvn clean install && onos-archetypes-test && mvn -Prelease clean deploy
+popd
+
+# Commit newly versioned artifacts and issue a tag.
+git commit -a -m"Tagging $NEW_VERSION"
+git tag -sm"Tagging $NEW_VERSION" $NEW_VERSION #signed tag
+
+# TODO: push?
diff --git a/framework/src/onos/tools/build/onos-snapshot b/framework/src/onos/tools/build/onos-snapshot
new file mode 100755
index 00000000..e482df92
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-snapshot
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Drives the ONOS snapshot process.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+export NEW_VERSION=$1
+[ -z "$NEW_VERSION" ] && echo "New ONOS version not specified" && exit 1
+
+export NEW_VERSION_SHORT=${NEW_VERSION%-SNAPSHOT}
+[ "$NEW_VERSION" = "$NEW_VERSION_SHORT" ] && echo "Version is not a SNAPSHOT" && exit 1;
+
+cd $ONOS_ROOT
+
+# TODO: Create a new branch for this activity?
+
+# Change the version
+onos-change-version $NEW_VERSION
+
+# Commit newly versioned artifacts.
+git commit -a -m"Starting snapshot $NEW_VERSION"
+
+# TODO: push?
diff --git a/framework/src/onos/tools/build/onos-test b/framework/src/onos/tools/build/onos-test
new file mode 100755
index 00000000..c6819613
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-test
@@ -0,0 +1,22 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Launches the ONOS tests on the current cell environment.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
+
+onos-package
+onos-verify-cell || exit 1
+
+for node in $nodes; do onos-install -f $node 1>/dev/null & done
+
+# Wait for shutdown before waiting for restart
+sleep 3
+
+for node in $nodes; do onos-wait-for-start $node; done
+for node in $nodes; do onos-check-logs $node; done
diff --git a/framework/src/onos/tools/build/onos-upload-bits b/framework/src/onos/tools/build/onos-upload-bits
new file mode 100755
index 00000000..e3bb83cd
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-upload-bits
@@ -0,0 +1,14 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Uploads ONOS distributable bits.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+#FIXME need to export s3Creds
+#TODO we could verify that ONOS_VERSION is set, and only upload that version
+
+onosUploadBits.py
diff --git a/framework/src/onos/tools/build/onos-upload-docs b/framework/src/onos/tools/build/onos-upload-docs
new file mode 100755
index 00000000..f74a13ff
--- /dev/null
+++ b/framework/src/onos/tools/build/onos-upload-docs
@@ -0,0 +1,23 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Uploads ONOS Java API docs.
+# -----------------------------------------------------------------------------
+
+set -e
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+user=${1:-jenkins}
+remote=$user@wiki.onosproject.org
+
+scp $ONOS_ROOT/docs/target/onos-apidocs-$ONOS_VERSION.tar.gz $remote:/tmp
+ssh $remote "
+ mkdir -p /var/www/api/$ONOS_VERSION
+ cd /var/www/api/$ONOS_VERSION
+ tar zxf /tmp/onos-apidocs-$ONOS_VERSION.tar.gz
+ mv onos-apidocs-$ONOS_VERSION/* .
+ rm -rf onos-apidocs-$ONOS_VERSION
+
+ # TODO: optionally bump /var/www/api/index.html
+"
diff --git a/framework/src/onos/tools/build/onosUploadBits.py b/framework/src/onos/tools/build/onosUploadBits.py
new file mode 100755
index 00000000..b86f45d0
--- /dev/null
+++ b/framework/src/onos/tools/build/onosUploadBits.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -----------------------------------------------------------------------------
+# Uploads ONOS distributable bits.
+# -----------------------------------------------------------------------------
+
+#FIXME need to export s3Creds
+
+import re
+from os import listdir
+from os.path import isfile, join
+
+from uploadToS3 import uploadFile
+
+nightlyTag = 'NIGHTLY'
+bitsPath = '/tmp'
+
+prefix = 'onos-(\d+\.\d+\.\d+)'
+buildNum = '\.?([\w-]*)'
+ext = '\.(?:tar\.gz|zip)'
+
+def findBits( path ):
+ for file in listdir( path ):
+ filePath = join( path, file )
+ if not isfile( filePath ):
+ continue
+
+ regex = prefix + buildNum + ext
+ match = re.match( regex, file )
+ if match:
+ version = match.group(1)
+ build = match.group(2)
+ if build:
+ if 'NIGHTLY' in build or 'rc' in build:
+ uploadFile(filePath, dest='nightly/')
+ else:
+ #no build; this is a release
+ uploadFile(filePath, dest='release/')
+
+if __name__ == '__main__':
+ findBits( '/tmp' )
diff --git a/framework/src/onos/tools/build/pom.xml b/framework/src/onos/tools/build/pom.xml
new file mode 100644
index 00000000..ea473ed2
--- /dev/null
+++ b/framework/src/onos/tools/build/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <prerequisites>
+ <maven>3.0.0</maven>
+ </prerequisites>
+
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-base</artifactId>
+ <packaging>pom</packaging>
+ <version>1</version>
+
+ <name>${project.artifactId}</name>
+ <description>Open Network Operating System Base Pom</description>
+
+ <url>http://onosproject.org/</url>
+
+ <scm>
+ <connection>scm:git:https://gerrit.onosproject.org/onos</connection>
+ <developerConnection>scm:git:https://gerrit.onosproject.org/onos</developerConnection>
+ <url>http://gerrit.onosproject.org/</url>
+ </scm>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <organization>Open Networking Lab</organization>
+ <url>http://onlab.us</url>
+ </developer>
+ </developers>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.5</version>
+ <extensions>true</extensions>
+ <configuration>
+ <serverId>ossrh</serverId>
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+ <autoReleaseAfterClose>false</autoReleaseAfterClose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/framework/src/onos/tools/build/uploadToS3.py b/framework/src/onos/tools/build/uploadToS3.py
new file mode 100755
index 00000000..a16235cd
--- /dev/null
+++ b/framework/src/onos/tools/build/uploadToS3.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+"""
+Upload a file to S3
+"""
+
+from sys import argv, stdout
+from time import time
+from os.path import basename
+from optparse import OptionParser
+
+from boto.s3.key import Key
+from boto.s3.connection import S3Connection
+
+
+def uploadFile( filename, dest=None, bucket=None, overwrite=False ):
+ "Upload a file to a bucket"
+ if not bucket:
+ bucket = 'onos'
+ if not dest:
+ key = basename( filename )
+ else:
+ key = dest + basename( filename ) #FIXME add the /
+ print '* Uploading', filename, 'to bucket', bucket, 'as', key
+ stdout.flush()
+ start = time()
+ def callback( transmitted, size ):
+ "Progress callback for set_contents_from_filename"
+ elapsed = time() - start
+ percent = 100.0 * transmitted / size
+ kbps = .001 * transmitted / elapsed
+ print ( '\r%d bytes transmitted of %d (%.2f%%),'
+ ' %.2f KB/sec ' %
+ ( transmitted, size, percent, kbps ) ),
+ stdout.flush()
+ conn = S3Connection()
+ bucket = conn.get_bucket( bucket )
+ k = Key( bucket )
+ k.key = key
+ if overwrite or not k.exists():
+ k.set_contents_from_filename( filename, cb=callback, num_cb=100 )
+ print
+ elapsed = time() - start
+ print "* elapsed time: %.2f seconds" % elapsed
+ else:
+ print 'file', basename( filename ), 'already exists in', bucket.name
+
+if __name__ == '__main__':
+ usage = "Usage: %prog [options] <file to upload>"
+ parser = OptionParser(usage=usage)
+ parser.add_option("-b", "--bucket", dest="bucket",
+ help="Bucket on S3")
+ parser.add_option("-d", "--dest", dest="dest",
+ help="Destination path in bucket")
+ parser.add_option("-k", "--key", dest="awsKey",
+ help="Bucket on S3")
+ parser.add_option("-s", "--secret", dest="awsSecret",
+ help="Bucket on S3")
+ parser.add_option("-f", "--force", dest="overwrite",
+ help="Overwrite existing file")
+ (options, args) = parser.parse_args()
+
+ if len( args ) == 0:
+ parser.error("missing filenames")
+ for file in args:
+ uploadFile( file, options.dest, options.bucket, options.overwrite )
+
+ #FIXME key and secret are unused