summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-09-22 12:49:09 -0700
committerAshlee Young <ashlee@onosfw.com>2015-09-22 12:49:09 -0700
commit81391595dca425ae58e2294898f09f11d9a32dbc (patch)
treef5d65c39a732150b2b29daa8de98a35d1236d3fb /framework/src/onos/tools
parent0aa37e73dcb3a55b8d889b0c32ff74055551b1f3 (diff)
bringing src to commit tag 65d551b50e782b0c1ea76c1a9ed1c5a801a5a7e4
Change-Id: Ib2da78962eaef856f418636c31b0f5c84286244f
Diffstat (limited to 'framework/src/onos/tools')
-rw-r--r--framework/src/onos/tools/build/envDefaults4
-rwxr-xr-xframework/src/onos/tools/build/onos-package102
-rwxr-xr-xframework/src/onos/tools/build/onosUploadBits.py2
-rw-r--r--framework/src/onos/tools/package/archetypes/api/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/bundle/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/cli/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/ui/pom.xml2
-rw-r--r--framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml2
-rw-r--r--framework/src/onos/tools/package/branding/pom.xml2
-rw-r--r--framework/src/onos/tools/package/deb/control8
-rw-r--r--framework/src/onos/tools/package/deb/copyright20
-rwxr-xr-xframework/src/onos/tools/package/deb/postinst16
-rwxr-xr-xframework/src/onos/tools/package/deb/postrm5
-rwxr-xr-xframework/src/onos/tools/package/deb/prerm23
-rw-r--r--framework/src/onos/tools/package/init/onos.conf37
-rw-r--r--framework/src/onos/tools/package/rpm/onos.spec71
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-archetypes-test2
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-check-intent2
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-check-logs20
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-install2
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-start-network26
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-topo-cfg3
-rwxr-xr-xframework/src/onos/tools/test/bin/onos-uninstall10
-rwxr-xr-xframework/src/onos/tools/test/bin/stc16
-rw-r--r--framework/src/onos/tools/test/cells/office3
-rw-r--r--framework/src/onos/tools/test/configs/office-dhcp.json22
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/curl-with-retry23
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py54
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py34
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/query-cluster.py37
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/query-topo.py35
-rwxr-xr-xframework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py51
-rw-r--r--framework/src/onos/tools/test/scenarios/net-link-down-up.xml14
-rw-r--r--framework/src/onos/tools/test/scenarios/net-pingall.xml4
-rw-r--r--framework/src/onos/tools/test/scenarios/net-rest.xml19
-rw-r--r--framework/src/onos/tools/test/scenarios/net-setup.xml6
-rw-r--r--framework/src/onos/tools/test/scenarios/net-smoke.xml6
-rw-r--r--framework/src/onos/tools/test/scenarios/net-topo.xml76
-rw-r--r--framework/src/onos/tools/test/scenarios/prerequisites.xml2
-rwxr-xr-xframework/src/onos/tools/test/topos/onos.py2
-rw-r--r--framework/src/onos/tools/test/topos/opticalUtils.py74
45 files changed, 724 insertions, 127 deletions
diff --git a/framework/src/onos/tools/build/envDefaults b/framework/src/onos/tools/build/envDefaults
index 57c1f677..34fcccb2 100644
--- a/framework/src/onos/tools/build/envDefaults
+++ b/framework/src/onos/tools/build/envDefaults
@@ -18,8 +18,8 @@ export PATH="$PATH:$ONOS_ROOT/tools/build"
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}
+export ONOS_POM_VERSION="1.4.0-SNAPSHOT"
+export ONOS_VERSION=${ONOS_VERSION:-1.4.0.$BUILD_NUMBER}
# ONOS production bits (onos.tar.gz, onos.zip, onos.deb, onos.rpm) staging environment
export ONOS_BITS=onos-${ONOS_VERSION%~*}
diff --git a/framework/src/onos/tools/build/onos-package b/framework/src/onos/tools/build/onos-package
index 8f6127da..32794457 100755
--- a/framework/src/onos/tools/build/onos-package
+++ b/framework/src/onos/tools/build/onos-package
@@ -30,7 +30,7 @@ function build_stage_dir() {
# 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/init $ONOS_STAGE/init
cp -r $ONOS_ROOT/tools/package/etc/* $ONOS_STAGE/$KARAF_DIST/etc
# Stage all builtin ONOS apps for factory install
@@ -49,7 +49,7 @@ function build_stage_dir() {
# 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' \
+ \( -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/*}
@@ -93,25 +93,19 @@ function build_compressed_package() {
# Build a DEB package
function build_deb() {
- echo "You need to be root in order to generate a proper DEB package."
+ echo "This command may ask for your password to run commands as sudo,"
+ echo " because 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
+ # Copy the debian directory and fill in version
+ cp -r $ONOS_ROOT/tools/package/deb/* $ONOS_DEB_ROOT/DEBIAN/
+ sed -i'' -E "s/@ONOS_POM_VERSION/$ONOS_POM_VERSION/" $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/
+ cp $ONOS_ROOT/tools/package/init/onos.conf $ONOS_DEB_ROOT/etc/init/
mkdir -p $ONOS_DEB_ROOT/opt/onos/var/
@@ -119,69 +113,33 @@ function build_deb() {
sudo dpkg-deb --build $ONOS_DEB_ROOT > /dev/null &&
sudo mv $ONOS_STAGE_ROOT/deb.deb $ONOS_DEB && ls -l $ONOS_DEB
+
+ #TODO run lintian on .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
+ [[ "$response" =~ ^[Nn] ]] && 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/init/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
+
+ cp $ONOS_ROOT/tools/package/rpm/onos.spec $ONOS_RPM_ROOT/SPECS/
+ sed -i'' -E "s/@ONOS_RPM_VERSION/$ONOS_RPM_VERSION/g" $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
}
# Script entry point
diff --git a/framework/src/onos/tools/build/onosUploadBits.py b/framework/src/onos/tools/build/onosUploadBits.py
index b86f45d0..dc2f0a4a 100755
--- a/framework/src/onos/tools/build/onosUploadBits.py
+++ b/framework/src/onos/tools/build/onosUploadBits.py
@@ -16,7 +16,7 @@ bitsPath = '/tmp'
prefix = 'onos-(\d+\.\d+\.\d+)'
buildNum = '\.?([\w-]*)'
-ext = '\.(?:tar\.gz|zip)'
+ext = '\.(?:tar\.gz|zip|deb|noarch\.rpm)'
def findBits( path ):
for file in listdir( path ):
diff --git a/framework/src/onos/tools/package/archetypes/api/pom.xml b/framework/src/onos/tools/package/archetypes/api/pom.xml
index d34db1f0..8deaada9 100644
--- a/framework/src/onos/tools/package/archetypes/api/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/api/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-api-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
index f29a327a..a0e54f3f 100644
--- a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
</properties>
<dependencies>
diff --git a/framework/src/onos/tools/package/archetypes/bundle/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/pom.xml
index ff6aa52e..65b55b2b 100644
--- a/framework/src/onos/tools/package/archetypes/bundle/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/bundle/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-bundle-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
index c9e747c9..222e8b03 100644
--- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.origin>Foo, Inc.</onos.app.origin>
diff --git a/framework/src/onos/tools/package/archetypes/cli/pom.xml b/framework/src/onos/tools/package/archetypes/cli/pom.xml
index 1ab9c1f2..a071eed1 100644
--- a/framework/src/onos/tools/package/archetypes/cli/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/cli/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-cli-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
index cb3862c3..f4602692 100644
--- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
</properties>
<dependencies>
diff --git a/framework/src/onos/tools/package/archetypes/pom.xml b/framework/src/onos/tools/package/archetypes/pom.xml
index 2fd5f874..525a2f68 100644
--- a/framework/src/onos/tools/package/archetypes/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>ONOS archetypes project</description>
diff --git a/framework/src/onos/tools/package/archetypes/ui/pom.xml b/framework/src/onos/tools/package/archetypes/ui/pom.xml
index ca7b2d87..8dd3a8e0 100644
--- a/framework/src/onos/tools/package/archetypes/ui/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/ui/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-archetypes</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-ui-archetype</artifactId>
diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
index a6beae99..2e1f091e 100644
--- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
+++ b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<url>http://onosproject.org</url>
<properties>
- <onos.version>1.3.0-SNAPSHOT</onos.version>
+ <onos.version>1.4.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.origin>Foo, Inc.</onos.app.origin>
diff --git a/framework/src/onos/tools/package/branding/pom.xml b/framework/src/onos/tools/package/branding/pom.xml
index 452a03c9..be9c4165 100644
--- a/framework/src/onos/tools/package/branding/pom.xml
+++ b/framework/src/onos/tools/package/branding/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/framework/src/onos/tools/package/deb/control b/framework/src/onos/tools/package/deb/control
new file mode 100644
index 00000000..c581ac25
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/control
@@ -0,0 +1,8 @@
+Package: onos
+Architecture: all
+Maintainer: ONOS Project
+Depends: debconf (>= 0.5.00), default-jre-headless (>= 1.8) | openjdk-8-jre | oracle-java8-installer
+Priority: optional
+Version: @ONOS_POM_VERSION
+Description: Open Network Operating System (ONOS)
+ Open Network Operating System (ONOS) is an opensource SDN controller.
diff --git a/framework/src/onos/tools/package/deb/copyright b/framework/src/onos/tools/package/deb/copyright
new file mode 100644
index 00000000..09ec05e3
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/copyright
@@ -0,0 +1,20 @@
+Upstream-Name: onos
+Source: http://github.com/opennetworkinglab/onos
+
+Files: *
+Copyright: 2014-2015 Open Networking Laboratory
+License: Apache 2.0
+ 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.
+ .
+ On Debian systems, the complete text of the Apache License 2.0 can
+ be found in "/usr/share/common-licenses/Apache-2.0"
diff --git a/framework/src/onos/tools/package/deb/postinst b/framework/src/onos/tools/package/deb/postinst
new file mode 100755
index 00000000..60de14a7
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/postinst
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+ONOS_USER=sdn
+
+# Check to see if user exists, and if not, create a service account
+getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER )
+
+# Create ONOS options file
+[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options
+export ONOS_OPTS=server
+export ONOS_USER="$ONOS_USER"
+EOF
+
+# Change permissions for onos directory
+[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos
+
diff --git a/framework/src/onos/tools/package/deb/postrm b/framework/src/onos/tools/package/deb/postrm
new file mode 100755
index 00000000..90dd6164
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/postrm
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# FIXME dpkg will remove /opt if it is empty after removing onos
+# We should recreate /opt if it was deleted.
+sudo mkdir -p /opt
diff --git a/framework/src/onos/tools/package/deb/prerm b/framework/src/onos/tools/package/deb/prerm
new file mode 100755
index 00000000..2a1633da
--- /dev/null
+++ b/framework/src/onos/tools/package/deb/prerm
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Check if onos is running; if it is, stop onos
+[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || (
+ stop onos
+
+ # Wait for onos to stop up to 5 seconds
+ for i in $(seq 1 5); do
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break
+ sleep 1
+ done
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos'
+)
+
+# Clean up onos runtime directories
+# TODO don't hardcode karaf version
+rm -rf /opt/onos/apache-karaf-3.0.3/
+rm -rf /opt/onos/var/*
+rm -rf /opt/onos/config
+rm -rf /opt/onos/options
+rm -rf /opt/onos/log
+
+#TODO consider removing the sdn user if we created it
diff --git a/framework/src/onos/tools/package/init/onos.conf b/framework/src/onos/tools/package/init/onos.conf
new file mode 100644
index 00000000..779df905
--- /dev/null
+++ b/framework/src/onos/tools/package/init/onos.conf
@@ -0,0 +1,37 @@
+description "Open Network Operating System"
+author "ON.Lab"
+
+start on (net-device-up
+ and local-filesystems
+ and runlevel [2345])
+stop on runlevel [016]
+
+console output
+kill timeout 60
+respawn
+
+env LANG=en_US.UTF-8
+
+pre-start script
+ [ -f /opt/onos/options ] && . /opt/onos/options
+ ONOS_USER=${ONOS_USER:-root}
+
+ # Ensure that the environment is initialized
+ [ -d /opt/onos ] && mkdir /opt/onos/var 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/var
+ [ -d /opt/onos ] && mkdir /opt/onos/config 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/config
+ # TODO make karaf version configurable
+ [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \
+ && ln -s /opt/onos/apache-karaf-3.0.3/data/log /opt/onos/log || :
+end script
+
+pre-stop script
+ /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log
+ sleep 1
+end script
+
+script
+ [ -f /opt/onos/options ] && . /opt/onos/options
+ start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
+ --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
+ >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
+end script
diff --git a/framework/src/onos/tools/package/rpm/onos.spec b/framework/src/onos/tools/package/rpm/onos.spec
new file mode 100644
index 00000000..df0a05d5
--- /dev/null
+++ b/framework/src/onos/tools/package/rpm/onos.spec
@@ -0,0 +1,71 @@
+Name: onos
+Version: @ONOS_RPM_VERSION
+Release: 1
+Summary: Open Networking Operating System (ONOS)
+Vendor: ONOS Project
+Packager: ONOS Project
+
+Group: Applications/Engineering
+License: Apache 2.0
+Requires: jre >= 1:8
+URL: http://www.onosproject.org
+Source0: %{name}-@ONOS_RPM_VERSION.tar.gz
+
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-buildroot
+
+%description
+Open Network Operating System (ONOS) is an open source SDN controller.
+
+%prep
+%setup -q
+
+%install
+mkdir -p %{buildroot}
+cp -R * %{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+/etc/init/onos.conf
+/opt/onos/
+
+%post
+ONOS_USER=sdn
+
+# Check to see if user exists, and if not, create a service account
+getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER )
+
+# Create ONOS options file
+[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options
+export ONOS_OPTS=server
+export ONOS_USER="$ONOS_USER"
+EOF
+
+# Change permissions for onos directory
+[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos
+
+echo ONOS successfully installed at /opt/onos
+
+%preun
+# Check if onos is running; if it is, stop onos
+[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || (
+ stop onos
+
+ # Wait for onos to stop up to 5 seconds
+ for i in $(seq 1 5); do
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break
+ sleep 1
+ done
+ [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos'
+)
+
+%postun
+#TODO this should be less brute-force
+rm -rf /opt/onos
+
+%changelog
+# TODO
+
diff --git a/framework/src/onos/tools/test/bin/onos-archetypes-test b/framework/src/onos/tools/test/bin/onos-archetypes-test
index 55f40e76..7ae00332 100755
--- a/framework/src/onos/tools/test/bin/onos-archetypes-test
+++ b/framework/src/onos/tools/test/bin/onos-archetypes-test
@@ -6,7 +6,7 @@
set -e
export AROOT=/tmp/foo
-export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -DarchetypeVersion=1.3.0-SNAPSHOT"
+export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -DarchetypeVersion=1.4.0-SNAPSHOT"
mkdir -p $AROOT
for an in api bundle cli ui; do
diff --git a/framework/src/onos/tools/test/bin/onos-check-intent b/framework/src/onos/tools/test/bin/onos-check-intent
index e332dc5b..760afafe 100755
--- a/framework/src/onos/tools/test/bin/onos-check-intent
+++ b/framework/src/onos/tools/test/bin/onos-check-intent
@@ -13,7 +13,7 @@ target=${1:-$OCI}
echo onos-check-intent: $*
set -x
-for i in {1..10}; do
+for i in {1..15}; do
onos $target "onos:intents" | tee $aux
( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0
sleep 1
diff --git a/framework/src/onos/tools/test/bin/onos-check-logs b/framework/src/onos/tools/test/bin/onos-check-logs
index ec1013ab..40e3e106 100755
--- a/framework/src/onos/tools/test/bin/onos-check-logs
+++ b/framework/src/onos/tools/test/bin/onos-check-logs
@@ -3,6 +3,25 @@
# Checks the logs of the remote ONOS instance and makes sure they are clean.
# -----------------------------------------------------------------------------
+function __usage() {
+cat << _EOM_
+
+usage:
+ $(basename $0) [node] ['old']
+
+options:
+ - [node] : The node whose logs to inspect. The default is \$OCI.
+ - ['old'] : If 'old' is specified, the logs are simply searched for errors
+ and exceptions, and they are displayed.
+
+summary:
+ Checks the logs of the remote ONOS instance and makes sure they are clean.
+
+_EOM_
+}
+
+[ "$1" = "-h" ] && __usage && exit 0
+
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
@@ -17,6 +36,7 @@ if [ "$2" = "old" ]; then
else
ssh $remote "
+ [ "'`uname`'" != "'"Linux"'" ] && alias tac='tail -r'
tac $LOG | awk '
BEGIN { off = 0; fail = 0; }
/ org.apache.karaf.main.lock.SimpleFileLock lock/ {
diff --git a/framework/src/onos/tools/test/bin/onos-install b/framework/src/onos/tools/test/bin/onos-install
index 0f4cc9dd..7384c2e3 100755
--- a/framework/src/onos/tools/test/bin/onos-install
+++ b/framework/src/onos/tools/test/bin/onos-install
@@ -43,7 +43,7 @@ ssh $remote "
mkdir -p -- $ONOS_INSTALL_DIR/$KARAF_DIST/data/raft
# Install the upstart configuration file and setup options for debugging
- [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf
+ [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/init/onos.conf /etc/init/onos.conf
echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options
# Setup correct user to run onos-service
diff --git a/framework/src/onos/tools/test/bin/onos-start-network b/framework/src/onos/tools/test/bin/onos-start-network
index 1e162fb4..5412e096 100755
--- a/framework/src/onos/tools/test/bin/onos-start-network
+++ b/framework/src/onos/tools/test/bin/onos-start-network
@@ -1,17 +1,39 @@
#!/bin/bash
# -----------------------------------------------------------------------------
-# Verifies connectivity to each node in ONOS cell.
+# Starts a Mininet network topology connected to all nodes in a cell.
# -----------------------------------------------------------------------------
+function __usage() {
+cat << _EOM_
+
+usage:
+ $(basename $0) [file]
+
+options:
+ - [file] : a Mininet topology file. Default is *sol.py* .
+
+summary:
+ Starts a Mininet network topology connected to all nodes in a cell.
+
+ Currently, all topology files are assumed to be found in
+ \$OCN's ~/topos directory. Therefore [file] must be specified as
+ topos/filename.
+
+_EOM_
+}
+
+[ "$1" = "-h" ] && __usage && exit 0
+
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
SSHCMD="ssh -o PasswordAuthentication=no"
SCPCMD="scp -q -o PasswordAuthentication=no"
+topo=${1:-topos/sol.py}
echo "Copying topology files to mininet vm."
$SSHCMD -n $ONOS_USER@$OCN mkdir -p topos
$SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/
echo "Starting Network."
-$SSHCMD -t $ONOS_USER@$OCN sudo python topos/sol.py $(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
+$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
diff --git a/framework/src/onos/tools/test/bin/onos-topo-cfg b/framework/src/onos/tools/test/bin/onos-topo-cfg
index 5f40d8e7..489083f7 100755
--- a/framework/src/onos/tools/test/bin/onos-topo-cfg
+++ b/framework/src/onos/tools/test/bin/onos-topo-cfg
@@ -8,7 +8,8 @@
node="${1:-$OCI}"
file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}"
+url="${3:-config/topology}"
curl -sS --fail -L --user $ONOS_WEB_USER:$ONOS_WEB_PASS \
-X POST -H 'Content-Type:application/json' \
- http://$node:8181/onos/v1/config/topology -d@$file
+ http://$node:8181/onos/v1/${url} -d@$file
diff --git a/framework/src/onos/tools/test/bin/onos-uninstall b/framework/src/onos/tools/test/bin/onos-uninstall
index c04db7ac..7a8b9a5f 100755
--- a/framework/src/onos/tools/test/bin/onos-uninstall
+++ b/framework/src/onos/tools/test/bin/onos-uninstall
@@ -10,5 +10,15 @@ remote=$ONOS_USER@${1:-$OCI}
ssh $remote "
sudo stop onos 1>/dev/null 2>/dev/null
+
+ # Wait for onos to stop up to 5 seconds
+ for i in \$(seq 1 5); do
+ [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] && break
+ sleep 1
+ done
+ [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] || echo 'ONOS failed to stop.'
+
+ # Remove onos directory and init file
sudo rm -fr $ONOS_INSTALL_DIR
+ [ -f /etc/init/onos.conf ] && sudo rm /etc/init/onos.conf
"
diff --git a/framework/src/onos/tools/test/bin/stc b/framework/src/onos/tools/test/bin/stc
index fe8a5afe..8737cf3f 100755
--- a/framework/src/onos/tools/test/bin/stc
+++ b/framework/src/onos/tools/test/bin/stc
@@ -3,7 +3,7 @@
# System Test Coordinator
#-------------------------------------------------------------------------------
-VER=1.3.0-SNAPSHOT
+VER=1.4.0-SNAPSHOT
JAR=~/.m2/repository/org/onosproject/onlab-stc/$VER/onlab-stc-$VER.jar
SCENARIOS=$ONOS_ROOT/tools/test/scenarios
@@ -15,9 +15,19 @@ scenario=${1:-smoke}
[ ! -f $scenario ] && scenario=$scenario.xml
[ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1
+# Remove the test name from the list of parameters, if one is specified
[ $# -ge 1 ] && shift
-[ -t 1 ] && stcColor=true || unset stcColor
+# If stcColor is not set, we will enable color if this is an interactive session
+[ -t 1 ] && interactive=true || interactive=false
+# stc requires that ONOS_USE_SSH=true, but we will store the old value and reset it after
+sshSet=$([ -z ${ONOS_USE_SSH+x} ]) && oldSSH=$ONOS_USE_SSH
+export ONOS_USE_SSH=true
+
+# Run stc
[ -z "$stcDebug" ] && DEBUG_OPTS=""
-java $DEBUG_OPTS -jar $JAR $scenario "$@"
+stcColor=${stcColor:-$interactive} java $DEBUG_OPTS -jar $JAR $scenario "$@"
+
+# Reset the old value of ONOS_USE_SSH
+[ $sshSet ] && export ONOS_USE_SSH=oldSSH || unset ONOS_USE_SSH
diff --git a/framework/src/onos/tools/test/cells/office b/framework/src/onos/tools/test/cells/office
index 2cd933e2..c8dc5997 100644
--- a/framework/src/onos/tools/test/cells/office
+++ b/framework/src/onos/tools/test/cells/office
@@ -3,5 +3,6 @@
export ONOS_NIC="10.1.10.*"
export OC1="10.1.10.223"
-export ONOS_APPS="drivers,openflow,fwd,proxyarp,mobility"
+unset ONOS_USE_SSH
+export ONOS_APPS="drivers,openflow,fwd,proxyarp,mobility,dhcp"
diff --git a/framework/src/onos/tools/test/configs/office-dhcp.json b/framework/src/onos/tools/test/configs/office-dhcp.json
new file mode 100644
index 00000000..f0cf3fb0
--- /dev/null
+++ b/framework/src/onos/tools/test/configs/office-dhcp.json
@@ -0,0 +1,22 @@
+{
+ "apps": {
+ "org.onosproject.dhcp" : {
+ "dhcp" : {
+ "ip": "10.1.11.50",
+ "mac": "ca:fe:ca:fe:ca:fe",
+ "subnet": "255.255.252.0",
+ "broadcast": "10.1.11.255",
+ "router": "10.1.8.1",
+ "domain": "8.8.8.8",
+ "ttl": "63",
+ "lease": "300",
+ "renew": "150",
+ "rebind": "200",
+ "delay": "2",
+ "timeout": "150",
+ "startip": "10.1.11.51",
+ "endip": "10.1.11.100"
+ }
+ }
+ }
+}
diff --git a/framework/src/onos/tools/test/scenarios/bin/curl-with-retry b/framework/src/onos/tools/test/scenarios/bin/curl-with-retry
new file mode 100755
index 00000000..c9546aea
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/curl-with-retry
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+aux=/tmp/stc-$$.log
+trap "rm -f $aux 2>/dev/null" EXIT
+
+url=$1
+
+
+echo curl-with-retry: $*
+
+set -x
+for i in {1..3}; do
+ curl -f -uonos:rocks ${url} >$aux
+ if [ $? = 0 ]; then
+ cat $aux
+ exit 0
+ fi
+ sleep 1
+done
+
+cat $aux
+exit 1
+
diff --git a/framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py b/framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py
new file mode 100755
index 00000000..928531fd
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/find-link-in-cluster.py
@@ -0,0 +1,54 @@
+#! /usr/bin/env python
+
+import requests
+import sys
+
+from requests.auth import HTTPBasicAuth
+
+if len(sys.argv) != 9:
+ print "usage: find-link-in-cluster onos-node name cluster-id expected-length src-device-id src-port dst-device-id dst-port"
+ sys.exit(1)
+
+node = sys.argv[1]
+name = sys.argv[2]
+cluster = sys.argv[3]
+length = int(sys.argv[4])
+srcDeviceId = sys.argv[5]
+srcPort = sys.argv[6]
+dstDeviceId = sys.argv[7]
+dstPort = sys.argv[8]
+
+
+linksRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/'
+ + cluster + '/links',
+ auth=HTTPBasicAuth('onos', 'rocks'))
+
+if linksRequest.status_code != 200:
+ print linksRequest.text
+ sys.exit(1)
+
+linksJson = linksRequest.json()
+linksLength = len(linksJson["links"])
+
+if linksLength != length:
+ print "Expected length {} but got {}".format(length, linksLength)
+ sys.exit(1)
+
+for link in linksJson["links"]:
+ if srcDeviceId == link["src"]["device"] and srcPort == link["src"]["port"]:
+ if dstDeviceId == link["dst"]["device"] and dstPort == link["dst"]["port"]:
+ print "@stc " + name + "SrcDevice=" + link["src"]["device"]
+ print "@stc " + name + "SrcPort=" + link["src"]["port"]
+ print "@stc " + name + "DstDevice=" + link["dst"]["device"]
+ print "@stc " + name + "DstPort=" + link["dst"]["port"]
+ print "@stc " + name + "Type=" + link["type"]
+ print "@stc " + name + "State=" + link["state"]
+ sys.exit(0)
+
+print "Could not find link from {}:{} to {}:{}"\
+ .format(srcDeviceId, srcPort, dstDeviceId, dstPort)
+sys.exit(1)
+
+
+
+
diff --git a/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py b/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py
new file mode 100755
index 00000000..6d1970f7
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/find-topo-infrastructure.py
@@ -0,0 +1,34 @@
+#! /usr/bin/env python
+
+import requests
+import sys
+import urllib
+
+from requests.auth import HTTPBasicAuth
+
+if len(sys.argv) != 4:
+ print "usage: find-topo-infrastructure onos-node name connect-point"
+ sys.exit(1)
+
+node = sys.argv[1]
+name = sys.argv[2]
+id = sys.argv[3]
+
+infrastructureRequest = requests.get('http://' + node + ':8181/onos/v1/topology/infrastructure/' +
+ urllib.quote_plus(id),
+ auth=HTTPBasicAuth('onos', 'rocks'))
+
+if infrastructureRequest.status_code != 200:
+ print infrastructureRequest.text
+ sys.exit(1)
+
+infrastructureJson = infrastructureRequest.json()
+
+print "@stc " + name + "Infrastructure=" + str(infrastructureJson["infrastructure"])
+
+sys.exit(0)
+
+
+
+
+
diff --git a/framework/src/onos/tools/test/scenarios/bin/query-cluster.py b/framework/src/onos/tools/test/scenarios/bin/query-cluster.py
new file mode 100755
index 00000000..0cac7ac3
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/query-cluster.py
@@ -0,0 +1,37 @@
+#! /usr/bin/env python
+
+import requests
+import sys
+import urllib
+
+from requests.auth import HTTPBasicAuth
+
+if len(sys.argv) != 4:
+ print "usage: query-cluster onos-node name cluster-number"
+ sys.exit(1)
+
+node = sys.argv[1]
+name = sys.argv[2]
+cluster = sys.argv[3]
+
+topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/'
+ + cluster,
+ auth=HTTPBasicAuth('onos', 'rocks'))
+
+if topoRequest.status_code != 200:
+ print topoRequest.text
+ sys.exit(1)
+
+topoJson = topoRequest.json()
+
+print "@stc " + name + "Id=" + str(topoJson["id"])
+print "@stc " + name + "DeviceCount=" + str(topoJson["deviceCount"])
+print "@stc " + name + "LinkCount=" + str(topoJson["linkCount"])
+print "@stc " + name + "Root=" + topoJson["root"]
+
+sys.exit(0)
+
+
+
+
+
diff --git a/framework/src/onos/tools/test/scenarios/bin/query-topo.py b/framework/src/onos/tools/test/scenarios/bin/query-topo.py
new file mode 100755
index 00000000..9b81b4ee
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/query-topo.py
@@ -0,0 +1,35 @@
+#! /usr/bin/env python
+
+import requests
+import sys
+import urllib
+
+from requests.auth import HTTPBasicAuth
+
+if len(sys.argv) != 3:
+ print "usage: query-topo onos-node name"
+ sys.exit(1)
+
+node = sys.argv[1]
+name = sys.argv[2]
+
+topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/',
+ auth=HTTPBasicAuth('onos', 'rocks'))
+
+if topoRequest.status_code != 200:
+ print topoRequest.text
+ sys.exit(1)
+
+topoJson = topoRequest.json()
+
+print "@stc " + name + "Time=" + str(topoJson["time"])
+print "@stc " + name + "Devices=" + str(topoJson["devices"])
+print "@stc " + name + "Links=" + str(topoJson["links"])
+print "@stc " + name + "Clusters=" + str(topoJson["clusters"])
+
+sys.exit(0)
+
+
+
+
+
diff --git a/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py b/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py
new file mode 100755
index 00000000..be834b9b
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/bin/verify-topo-devices.py
@@ -0,0 +1,51 @@
+#! /usr/bin/env python
+
+import requests
+import sys
+import urllib
+
+from requests.auth import HTTPBasicAuth
+
+if len(sys.argv) != 5:
+ print "usage: verify-topo-links onos-node cluster-id first-index last-index"
+ sys.exit(1)
+
+node = sys.argv[1]
+cluster = sys.argv[2]
+first = int(sys.argv[3])
+last = int(sys.argv[4])
+
+found = 0
+
+topoRequest = requests.get('http://' + node + ':8181/onos/v1/topology/clusters/'
+ + cluster
+ + "/devices",
+ auth=HTTPBasicAuth('onos', 'rocks'))
+
+if topoRequest.status_code != 200:
+ print topoRequest.text
+ sys.exit(1)
+
+topoJson = topoRequest.json()
+
+for deviceIndex in range(first, last+1):
+ lookingFor = "of:" + format(deviceIndex, '016x')
+ print lookingFor
+ for arrayIndex in range(0, len(topoJson["devices"])):
+ device = topoJson["devices"][arrayIndex]
+ if device == lookingFor:
+ found = found + 1
+ print "Match found for " + device
+ break
+
+
+if found == last - first:
+ sys.exit(0)
+
+print "Found " + str(found) + " matches, need " + str(last - first)
+sys.exit(2)
+
+
+
+
+
diff --git a/framework/src/onos/tools/test/scenarios/net-link-down-up.xml b/framework/src/onos/tools/test/scenarios/net-link-down-up.xml
index 8bcbfa7f..eb4727bd 100644
--- a/framework/src/onos/tools/test/scenarios/net-link-down-up.xml
+++ b/framework/src/onos/tools/test/scenarios/net-link-down-up.xml
@@ -20,7 +20,9 @@
exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
<step name="Link-1-Down" requires="~Ping-1"
exec="onos-mininet sendAndExpect link s4 s7 down --expect ."/>
- <step name="Ping-2" requires="~Link-1-Down"
+ <step name="Ping-2-Prep" requires="~Link-1-Down"
+ exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+ <step name="Ping-2" requires="~Ping-2-Prep"
exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
<step name="Link-2-Down" requires="~Ping-2"
exec="onos-mininet sendAndExpect link s4 s5 down --expect ."/>
@@ -28,11 +30,15 @@
exec="onos-mininet sendAndExpect h1 ping -c1 -w1 h4 --expect 100% packet loss"/>
<step name="Link-1-Up" requires="~Ping-3"
exec="onos-mininet sendAndExpect link s4 s7 up --expect ."/>
- <step name="Ping-4" requires="~Link-1-Up"
+ <step name="Ping-4-Prep" requires="~Link-1-Up"
+ exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+ <step name="Ping-4" requires="~Ping-4-Prep"
exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
<step name="Link-2-Up" requires="~Ping-4"
exec="onos-mininet sendAndExpect link s4 s5 up --expect ."/>
- <step name="Ping-5" requires="~Link-2-Up"
+ <step name="Ping-5-Prep" requires="~Link-2-Up"
+ exec="onos-mininet sendAndExpect h1 ping -c5 h4 --expect ."/>
+ <step name="Ping-5" requires="~Ping-5-Prep"
exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/>
</group>
-</scenario> \ No newline at end of file
+</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/net-pingall.xml b/framework/src/onos/tools/test/scenarios/net-pingall.xml
index 8968e0dc..87c13227 100644
--- a/framework/src/onos/tools/test/scenarios/net-pingall.xml
+++ b/framework/src/onos/tools/test/scenarios/net-pingall.xml
@@ -23,7 +23,7 @@
<!-- TODO: take this out when initial pingall sweep is 100% -->
<step name="Initial-Ping-All" requires="Check-Apps"
- exec="onos-mininet sendAndExpect py net.pingAll(1) --expect 600 received"/>
+ exec="onos-mininet sendAndExpect py net.pingAll(1) --expect received"/>
<step name="Ping-All-And-Verify" requires="Check-Apps,Initial-Ping-All"
exec="onos-mininet sendAndExpect py net.pingAll(1) --expect 600/600 received"/>
@@ -34,4 +34,4 @@
<step name="Config-Topo" requires="~Check-Summary-For-Hosts"
exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/>
</group>
-</scenario> \ No newline at end of file
+</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/net-rest.xml b/framework/src/onos/tools/test/scenarios/net-rest.xml
index fc7b1d08..ab7804df 100644
--- a/framework/src/onos/tools/test/scenarios/net-rest.xml
+++ b/framework/src/onos/tools/test/scenarios/net-rest.xml
@@ -101,10 +101,10 @@
<!-- Check that the intents can be fetched via the REST API -->
<step name="Net-REST.Validate-Intent-XY-Installed"
requires="Net-REST.Create-Intent-YX"
- exec="curl -f -uonos:rocks ${xyLocation}"/>
+ exec="curl-with-retry ${xyLocation}"/>
<step name="Net-REST.Validate-Intent-YX-Installed"
requires="^"
- exec="curl -f -uonos:rocks ${yxLocation}"/>
+ exec="curl-with-retry ${yxLocation}"/>
<!-- Use REST API to query flows created by the intents -->
<step name="Net-REST.Validate-Intent-XY-Flow-Installed"
@@ -120,7 +120,7 @@
<step name="Net-REST.Validate-YX-Flow-State" requires="^"
exec="test '${dev4outFlowState}' == 'ADDED' -o '${dev4outFlowState}' == 'PENDING_ADD'"/>
<step name="Net-REST.Validate-YX-Flow-Port" requires="^"
- exec="test '${dev4outFlowPort}' == '3'"/>
+ exec="test ${dev4outFlowPort} -ge 1 -a ${dev4outFlowPort} -le 5"/>
<!-- Check that connectivity was established -->
<step name="Net-REST.Ping-XY" requires="Net-REST.Create-Intent-XY,Net-REST.Create-Intent-YX"
@@ -139,22 +139,23 @@
exec="curl -f -X DELETE -uonos:rocks ${xyLocation}"/>
<step name="Net-REST.Delete-Intent-YX" requires="^"
exec="curl -f -X DELETE -uonos:rocks ${yxLocation}"/>
+ <step name="Net-REST.Allow-Intents-To-Purge"
+ exec="onos-check-intent ${OC1} xy INSTALLED" env="!"
+ requires="Net-REST.Delete-Intent-XY,Net-REST.Delete-Intent-YX"/>
<!-- Use REST API to be sure that flows are no longer installed -->
- <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Delete-Intent-XY"
+ <step name="Net-REST.Validate-XY-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
exec="find-flow.py ${OC1} dev1out of:0000000000000001"
env="!"/>
- <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Delete-Intent-YX"
+ <step name="Net-REST.Validate-YX-Flows-Removed" requires="Net-REST.Allow-Intents-To-Purge"
exec="find-flow.py ${OC1} dev4out of:0000000000000004"
env="!"/>
<!-- Check that the deleted intents no longer appear in the REST API -->
- <step name="Net-REST.Allow-Intents-To-Purge" requires="Net-REST.Delete-Intent-XY"
- exec="sleep 1"/>
<step name="Net-REST.Validate-Intent-XY-Removed" requires="Net-REST.Allow-Intents-To-Purge"
- exec="curl -f -uonos:rocks ${xyLocation}" env="!"/>
+ exec="curl-with-retry ${xyLocation}" env="!"/>
<step name="Net-REST.Validate-Intent-YX-Removed" requires="Net-REST.Allow-Intents-To-Purge"
- exec="curl -f -uonos:rocks ${yxLocation}" env="!"/>
+ exec="curl-with-retry ${yxLocation}" env="!"/>
</group>
</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/net-setup.xml b/framework/src/onos/tools/test/scenarios/net-setup.xml
index e179ec5a..13252d0f 100644
--- a/framework/src/onos/tools/test/scenarios/net-setup.xml
+++ b/framework/src/onos/tools/test/scenarios/net-setup.xml
@@ -17,9 +17,9 @@
<!-- TODO: parametrize this via recipes -->
<group name="Net-Setup">
<step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
- <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/>
- <step name="Wipe-Out-Data-Before" exec="onos-wipe-out"/>
+ <step name="Stop-Mininet-If-Needed" env="~" exec="onos-mininet stop"/>
+ <step name="Wipe-Out-Data-Before" exec="onos-wipe-out" requires="^"/>
<step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before"
exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
@@ -43,4 +43,4 @@
<step name="Check-Flows" requires="~Pause-For-Masters,~Check-Summary"
exec="onos-check-flows ${OC1}"/>
</group>
-</scenario> \ No newline at end of file
+</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/net-smoke.xml b/framework/src/onos/tools/test/scenarios/net-smoke.xml
index 53a5729c..91131c62 100644
--- a/framework/src/onos/tools/test/scenarios/net-smoke.xml
+++ b/framework/src/onos/tools/test/scenarios/net-smoke.xml
@@ -35,10 +35,14 @@
<import file="${ONOS_SCENARIOS}/net-create-flows.xml"/>
<dependency name="Net-Create-Flows" requires="Net-Setup,P2P-Intent-Connectivity,Net-REST"/>
+ <import file="${ONOS_SCENARIOS}/net-topo.xml"/>
+ <dependency name="Net-topo" requires="Net-Setup,Net-Create-Flows"/>
+
<import file="${ONOS_SCENARIOS}/net-teardown.xml"/>
<dependency name="Net-Teardown" requires="~Host-Intent-Connectivity,
~P2P-Intent-Connectivity,
~Net-REST,
- ~Net-Create-Flows"/>
+ ~Net-Create-Flows,
+ ~Net-topo"/>
</group>
</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/net-topo.xml b/framework/src/onos/tools/test/scenarios/net-topo.xml
new file mode 100644
index 00000000..e8e23997
--- /dev/null
+++ b/framework/src/onos/tools/test/scenarios/net-topo.xml
@@ -0,0 +1,76 @@
+<!--
+ ~ Copyright 2015 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.
+ -->
+<scenario name="net-topo"
+ description="Network topology test">
+ <!-- TODO: parametrize this via recipes -->
+ <group name="Net-topo">
+
+ <!-- Verify the overall topology using the REST API -->
+ <step name="Net-topo.Query-Topo"
+ exec="query-topo.py ${OC1} topo"/>
+ <step name="Net-topo.Verify-Topo-Devices" requires="Net-topo.Query-Topo"
+ exec="test ${topoDevices} == 25"/>
+ <step name="Net-topo.Verify-Topo-Links" requires="Net-topo.Query-Topo"
+ exec="test ${topoLinks} == 140"/>
+ <step name="Net-topo.Verify-Topo-Clusters" requires="Net-topo.Query-Topo"
+ exec="test ${topoClusters} == 1"/>
+
+ <!-- Verify the cluster topology using the REST API -->
+ <step name="Net-topo.Query-Cluster0"
+ exec="query-cluster.py ${OC1} clusterTopo0 0"/>
+ <step name="Net-topo.Verify-Cluster0-Id" requires="Net-topo.Query-Cluster0"
+ exec="test ${clusterTopo0Id} == 0"/>
+ <step name="Net-topo.Verify-Cluster0-DeviceCount" requires="Net-topo.Query-Cluster0"
+ exec="test ${clusterTopo0DeviceCount} == 25"/>
+ <step name="Net-topo.Verify-Cluster0-LinkCount" requires="Net-topo.Query-Cluster0"
+ exec="test ${clusterTopo0LinkCount} == 140"/>
+ <step name="Net-topo.Verify-Cluster0-Root" requires="Net-topo.Query-Cluster0"
+ exec="test '${clusterTopo0Root}' == 'of:000000000000000a'"/>
+
+ <!-- Verify the list of devices for the cluster -->
+ <step name="Net-topo.Verify-Cluster0-Devices"
+ exec="verify-topo-devices.py ${OC1} 0 0 24"/>
+
+ <!-- Spot check some known links in the topology -->
+ <step name="Net-topo.Verify-Cluster0-Link1"
+ exec="find-link-in-cluster.py ${OC1} link1 0 140 of:000000000000000f 8 of:0000000000000015 3"/>
+ <step name="Net-topo.Verify-Cluster0-Link2"
+ exec="find-link-in-cluster.py ${OC1} link2 0 140 of:0000000000000008 3 of:0000000000000005 4"/>
+ <step name="Net-topo.Verify-Cluster0-Link3"
+ exec="find-link-in-cluster.py ${OC1} link3 0 140 of:0000000000000011 2 of:0000000000000002 9"/>
+ <step name="Net-topo.Verify-Cluster0-Link4"
+ exec="find-link-in-cluster.py ${OC1} link4 0 140 of:000000000000000f 3 of:000000000000000d 10"/>
+ <step name="Net-topo.Verify-Cluster0-Link5"
+ exec="find-link-in-cluster.py ${OC1} link5 0 140 of:000000000000000d 13 of:0000000000000010 6"/>
+
+ <!-- Verify the topology infrastructure query -->
+ <step name="Net-topo.Query-Cluster0-Infra1"
+ exec="find-topo-infrastructure.py ${OC1} infra1 of:000000000000000f:8"/>
+ <step name="Net-topo.Verify-Cluster0-Infra1" requires="Net-topo.Query-Cluster0-Infra1"
+ exec="test '${infra1Infrastructure}' == 'True'"/>
+
+ <step name="Net-topo.Query-Cluster0-Infra2"
+ exec="find-topo-infrastructure.py ${OC1} infra2 of:000000000000000d:8"/>
+ <step name="Net-topo.Verify-Cluster0-Infra2" requires="Net-topo.Query-Cluster0-Infra2"
+ exec="test '${infra2Infrastructure}' == 'True'"/>
+
+ <step name="Net-topo.Query-Cluster0-Infra3"
+ exec="find-topo-infrastructure.py ${OC1} infra3 of:0000000000000012:8"/>
+ <step name="Net-topo.Verify-Cluster0-Infra3" requires="Net-topo.Query-Cluster0-Infra3"
+ exec="test '${infra3Infrastructure}' == 'False'"/>
+
+ </group>
+</scenario>
diff --git a/framework/src/onos/tools/test/scenarios/prerequisites.xml b/framework/src/onos/tools/test/scenarios/prerequisites.xml
index 650aa411..2c541d5b 100644
--- a/framework/src/onos/tools/test/scenarios/prerequisites.xml
+++ b/framework/src/onos/tools/test/scenarios/prerequisites.xml
@@ -15,7 +15,7 @@
-->
<scenario name="prerequisites" description="ONOS test pre-requisites">
<group name="Prerequisites">
- <step name="Check-Environment" exec="test -n ${ONOS_ROOT} -a -n ${ONOS_NIC} -a -n ${OC1}"/>
+ <step name="Check-Environment" exec="test -n ${ONOS_ROOT} -a -n ${ONOS_NIC} -a -n ${OC1} -a '${ONOS_USE_SSH}' == 'true'"/>
<step name="Check-ONOS-Bits" exec="onos-check-bits"/>
<parallel var="${OC#}">
diff --git a/framework/src/onos/tools/test/topos/onos.py b/framework/src/onos/tools/test/topos/onos.py
index 3e5bff7c..ae6045e3 100755
--- a/framework/src/onos/tools/test/topos/onos.py
+++ b/framework/src/onos/tools/test/topos/onos.py
@@ -62,7 +62,7 @@ class ONOS( Controller ):
def start( self ):
if self.inNamespace:
- instanceOpts = ( '-furl mvn:org.onosproject/onos-features/1.3.0-SNAPSHOT/xml/features '
+ instanceOpts = ( '-furl mvn:org.onosproject/onos-features/1.4.0-SNAPSHOT/xml/features '
'-s 8101' )
if self.ip is not None:
instanceOpts += (' -a %s' % self.IP() )
diff --git a/framework/src/onos/tools/test/topos/opticalUtils.py b/framework/src/onos/tools/test/topos/opticalUtils.py
index bef9deca..a1ae834b 100644
--- a/framework/src/onos/tools/test/topos/opticalUtils.py
+++ b/framework/src/onos/tools/test/topos/opticalUtils.py
@@ -70,9 +70,6 @@ from mininet.cli import CLI
SLEEP_TIME = 2
TIMEOUT = 60
-REST_USER = 'onos'
-REST_PW = 'rocks'
-
class OpticalSwitch(Switch):
"""
For now, same as Switch class.
@@ -152,6 +149,17 @@ class LINCSwitch(OpticalSwitch):
error('Please set ONOS_ROOT environment variable!\n')
else:
os.environ[ 'ONOS_ROOT' ] = onosDir
+ ### REST USER/PASS ###
+ try:
+ restUser = os.environ[ 'ONOS_WEB_USER' ]
+ restPass = os.environ[ 'ONOS_WEB_PASS' ]
+ except:
+ error('***WARNING: $ONOS_WEB_USER and $ONOS_WEB_PASS aren\'t set!\n')
+ error('***WARNING: Setting (probably) sane WEB user/pass values\n')
+ restUser = 'onos'
+ restPass = 'rocks'
+ os.environ[ 'ONOS_WEB_USER' ] = restUser
+ os.environ[ 'ONOS_WEB_PASS' ] = restPass
### LINC-directory
lincDir = findDir.__func__('linc-oe', user)
if not lincDir:
@@ -283,7 +291,7 @@ class LINCSwitch(OpticalSwitch):
json.dump(crossConnectJSON, fd, indent=4, separators=(',', ': '))
info('*** Pushing crossConnect.json to ONOS\n')
output = quietRun('%s/tools/test/bin/onos-topo-cfg %s\
- Topology.json' % (self.onosDir, self.controllers[ 0 ].ip), shell=True)
+ Topology.json network/configuration/' % (self.onosDir, self.controllers[ 0 ].ip), shell=True)
def stop_oe(self):
'''
@@ -366,16 +374,17 @@ class LINCSwitch(OpticalSwitch):
LINCSwitch.opticalJSON[ 'links' ] = linkConfig
info('*** Writing Topology.json file\n')
+ topoJSON = LINCSwitch.makeTopoJSON()
with open('Topology.json', 'w') as outfile:
- json.dump(LINCSwitch.opticalJSON, outfile, indent=4, separators=(',', ': '))
+ json.dump(topoJSON, outfile, indent=4, separators=(',', ': '))
info('*** Converting Topology.json to linc-oe format (TopoConfig.json) file (no oecfg) \n')
- topoConfigJson = {};
- dpIdToName = {};
+ topoConfigJson = {}
+ dpIdToName = {}
- topoConfigJson["switchConfig"] = LINCSwitch.getSwitchConfig(dpIdToName);
- topoConfigJson["linkConfig"] = LINCSwitch.getLinkConfig(dpIdToName);
+ topoConfigJson["switchConfig"] = LINCSwitch.getSwitchConfig(dpIdToName)
+ topoConfigJson["linkConfig"] = LINCSwitch.getLinkConfig(dpIdToName)
#Writing to TopoConfig.json
with open( 'TopoConfig.json', 'w' ) as outfile:
@@ -433,7 +442,7 @@ class LINCSwitch(OpticalSwitch):
time = 0
# Set up password authentication
pw_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
- pw_mgr.add_password(None, url, REST_USER, REST_PW)
+ pw_mgr.add_password(None, url, LINCSwitch.restUser, LINCSwitch.restPass)
handler = urllib2.HTTPBasicAuthHandler(pw_mgr)
opener = urllib2.build_opener(handler)
opener.open(url)
@@ -462,7 +471,8 @@ class LINCSwitch(OpticalSwitch):
info('*** Pushing Topology.json to ONOS\n')
for index in range(len(LINCSwitch.controllers)):
- output = quietRun('%s/tools/test/bin/onos-topo-cfg %s Topology.json &' % (LINCSwitch.onosDir, LINCSwitch.controllers[ index ].ip), shell=True)
+ output = quietRun('%s/tools/test/bin/onos-topo-cfg %s Topology.json network/configuration/ &'\
+ % (LINCSwitch.onosDir, LINCSwitch.controllers[ index ].ip), shell=True)
# successful output contains the two characters '{}'
# if there is more output than this, there is an issue
if output.strip('{}'):
@@ -478,6 +488,48 @@ class LINCSwitch(OpticalSwitch):
return nodeDpid[0:-1];
@staticmethod
+ def makeTopoJSON():
+ """
+ Builds ONOS network conifg system compatible dicts to be written as Topology.json file.
+ """
+ topology = {}
+ links = {}
+ devices = {}
+ ports = {}
+
+ for switch in LINCSwitch.opticalJSON[ 'devices' ]:
+ # build device entries - keyed on uri (DPID) and config key 'basic'
+ devDict = {}
+ devDict[ 'driver' ] = switch[ 'hw' ]
+ devDict[ 'mfr' ] = switch[ 'mfr' ]
+ devDict[ 'mac' ] = switch[ 'mac' ]
+ devDict[ 'type' ] = switch[ 'type' ]
+ devDict.update(switch[ 'annotations' ])
+
+ devSubj = switch[ 'uri' ]
+ devices[ devSubj ] = { 'basic': devDict }
+
+ # build port entries - keyed on "uri/port" and config key 'optical'
+ for port in switch[ 'ports' ]:
+ portSubj = devSubj + '/' + str(port[ 'port' ])
+ ports[ portSubj ] = { 'optical': port }
+
+ # build link entries - keyed on "uri/port-uri/port" and config key 'basic'
+ for link in LINCSwitch.opticalJSON[ 'links' ]:
+ linkDict = {}
+ linkDict[ 'type' ] = link[ 'type' ]
+ linkDict.update(link[ 'annotations' ])
+
+ linkSubj = link[ 'src' ] + '-' + link[ 'dst' ]
+ links[ linkSubj ] = { 'basic': linkDict }
+
+ topology[ 'links' ] = links
+ topology[ 'devices' ] = devices
+ topology[ 'ports' ] = ports
+
+ return topology
+
+ @staticmethod
def getSwitchConfig (dpIdToName):
switchConfig = [];
#Iterate through all switches and convert the ROADM switches to linc-oe format