From 785f5814082f4ffc138e27e821efcfdfbaaa3532 Mon Sep 17 00:00:00 2001 From: Thomas Vachuska Date: Thu, 19 Mar 2015 01:11:00 -0700 Subject: [PATCH] ONOS-1328 Converted ONOS features to apps. ONOS_FEATURES env. var is now deprecated! Cells are expected to use ONOS_APPS env. var to tailor which builtin apps should be activated by default. All builtin apps are installed by default, but can be uninstalled if desired. Cleaned up cell definitions accordingly. Change-Id: If3bb4691a73543a69197f4bf1855c8368f558450 --- tools/build/onos-package | 18 ++++++++++++++---- tools/dev/bash_profile | 23 +++++++++++++---------- tools/test/bin/onos-config | 16 +++++++++++----- tools/test/bin/onos-show-cell | 4 +++- tools/test/cells/beast | 10 ++++------ tools/test/cells/beast-1 | 12 ++++++++++++ tools/test/cells/beast-3 | 10 ++++------ tools/test/cells/beast-5 | 16 ++++++++++++++++ tools/test/cells/beastMod | 18 ------------------ tools/test/cells/cbench | 8 -------- tools/test/cells/ec2 | 6 ++---- tools/test/cells/local | 3 +-- tools/test/cells/office | 6 +++--- tools/test/cells/prox | 3 --- tools/test/cells/sdnip-pmox | 4 +--- tools/test/cells/single | 3 +-- tools/test/cells/single_optical | 4 ++-- tools/test/cells/tom | 9 ++++----- tools/test/cells/tom3 | 10 ---------- tools/test/cells/tomx | 8 +------- tools/test/cells/triple | 3 +-- 21 files changed, 93 insertions(+), 101 deletions(-) create mode 100644 tools/test/cells/beast-1 create mode 100644 tools/test/cells/beast-5 delete mode 100644 tools/test/cells/beastMod delete mode 100644 tools/test/cells/cbench delete mode 100644 tools/test/cells/tom3 diff --git a/tools/build/onos-package b/tools/build/onos-package index afa98480b0..836ca9db71 100755 --- a/tools/build/onos-package +++ b/tools/build/onos-package @@ -37,7 +37,17 @@ 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 -# Patch-in proper Karaf version into the startup script. +# Stage all builtin ONOS apps for factory install +mkdir $ONOS_STAGE/apps +find $ONOS_ROOT -name 'app.xml' | egrep -v '/src/test/|/target/|org\.foo\.' | \ + xargs grep 'name=' | sed 's/ bin/onos-service sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \ @@ -60,9 +70,9 @@ done 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 ONOS features -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow" -perl -pi.old -e "s|^(featuresBoot=.*)|\1,$ONOS_FEATURES|" \ +# Patch the Apache Karaf distribution file to load default ONOS boot features +export BOOT_FEATURES="webconsole,onos-api,onos-core,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 diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile index 5acb19e083..057e7d3b60 100644 --- a/tools/dev/bash_profile +++ b/tools/dev/bash_profile @@ -71,23 +71,32 @@ alias gui='onos-gui' alias sshctl='onos-ssh' alias sshnet='onos-ssh $OCN' + +# Sets the primary instance to the specified instance number. +function setPrimaryInstance { + export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2) + echo $OCI +} + # Applies the settings in the specified cell file or lists current cell definition # if no cell file is given. function cell { if [ -n "$1" ]; then [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ echo "No such cell: $1" >&2 && return 1 - unset ONOS_CELL ONOS_NIC ONOS_FEATURES ONOS_USER ONOS_GROUP - unset OCI OCN + unset ONOS_CELL ONOS_NIC ONOS_APPS ONOS_BOOT_FEATURES ONOS_USER ONOS_GROUP + unset OCI OCN OCT + unset ONOS_FEATURES # deprecated unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') export ONOS_CELL=$1 . $ONOS_ROOT/tools/test/cells/$1 + setPrimaryInstance 1 >/dev/null cell else env | egrep "ONOS_CELL" env | egrep "OCI" env | egrep "OC[0-9]+" | sort - env | egrep "OCN" + env | egrep "OC[NT]" env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL' fi } @@ -97,18 +106,12 @@ cell local >/dev/null # Default cell is the local VMs # Lists available cells function cells { for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do - printf "%-12s %s\n" \ + printf "%-16s %s\n" \ "$([ $cell = $ONOS_CELL ] && echo $cell '*' || echo $cell)" \ "$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)" done } -# Sets the primary instance to the specified instance number. -function setPrimaryInstance { - export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2) - echo $OCI -} - # Miscellaneous function spy { ps -ef | egrep "$@" | grep -v egrep diff --git a/tools/test/bin/onos-config b/tools/test/bin/onos-config index 082f506c26..178bd2388e 100755 --- a/tools/test/bin/onos-config +++ b/tools/test/bin/onos-config @@ -8,9 +8,11 @@ remote=$ONOS_USER@${1:-$OCI} -# Customize features -export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow}" +# ONOS boot features +export ONOS_BOOT_FEATURES="${ONOS_BOOT_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui}" +# ONOS builtin apps and providers ignited by default +export ONOS_APPS="${ONOS_APPS:-openflow}" # Generate a cluster.json from the ON* environment variables CDEF_FILE=/tmp/${remote}.cluster.json @@ -40,9 +42,14 @@ ssh $remote " echo "log4j.logger.com.hazelcast.cluster.impl.MulticastService= ERROR" \ >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg - # Patch the Apache Karaf distribution file to load ONOS features - perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_FEATURES|\" \ + # Patch the Apache Karaf distribution file to load ONOS boot features + perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_BOOT_FEATURES|\" \ $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.apache.karaf.features.cfg + + # Customize which builtin apps should be ignited + for app in $(echo $ONOS_APPS | tr ',' ' '); do + touch $ONOS_INSTALL_DIR/apps/org.onosproject.\$app/active + done " # Generate a default tablets.json from the ON* environment variables @@ -52,4 +59,3 @@ scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/tablets.json # copy tools/package/config/ to remote scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/ - diff --git a/tools/test/bin/onos-show-cell b/tools/test/bin/onos-show-cell index 3b11a1d69f..f5c7572679 100755 --- a/tools/test/bin/onos-show-cell +++ b/tools/test/bin/onos-show-cell @@ -51,5 +51,7 @@ for n in $( seq 0 ${max} ); do fi done echo "OCN=${OCN}" +echo "OCT=${OCT}" echo "OCI=${OCI}" -echo "ONOS_FEATURES=${ONOS_FEATURES}" +echo "ONOS_APPS=${ONOS_APPS}" +echo "ONOS_BOOT_FEATURES=${ONOS_BOOT_FEATURES}" diff --git a/tools/test/cells/beast b/tools/test/cells/beast index c3ed41e781..aa34e51830 100644 --- a/tools/test/cells/beast +++ b/tools/test/cells/beast @@ -1,7 +1,7 @@ -# Bare metal cluster +# Bare metal cluster (7-node) -# Use the 10G NIC for cluster communications -export ONOS_NIC="192.168.200.*" +# Use the 1G NIC for cluster communications +export ONOS_NIC="10.254.1.*" # ONOS Test proxy export OCT=10.254.1.200 @@ -15,6 +15,4 @@ export OC5=10.254.1.205 export OC6=10.254.1.206 export OC7=10.254.1.207 -export OCI=${OC1} - -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null +export ONOS_APPS=null,intentperf diff --git a/tools/test/cells/beast-1 b/tools/test/cells/beast-1 new file mode 100644 index 0000000000..c6e45e415a --- /dev/null +++ b/tools/test/cells/beast-1 @@ -0,0 +1,12 @@ +# Bare metal cluster (1-node) + +# Use the 1G NIC for cluster communications +export ONOS_NIC="10.254.1.*" + +# ONOS Test proxy +export OCT=10.254.1.200 + +# Use the 1G NICs for external access +export OC1=10.254.1.201 + +export ONOS_APPS=null,intentperf diff --git a/tools/test/cells/beast-3 b/tools/test/cells/beast-3 index c2db173977..fc58137db0 100644 --- a/tools/test/cells/beast-3 +++ b/tools/test/cells/beast-3 @@ -1,7 +1,7 @@ -# Bare metal cluster +# Bare metal cluster (3-node) -# Use the 10G NIC for cluster communications -export ONOS_NIC="192.168.200.*" +# Use the 1G NIC for cluster communications +export ONOS_NIC="10.254.1.*" # ONOS Test proxy export OCT=10.254.1.200 @@ -11,6 +11,4 @@ export OC1=10.254.1.201 export OC2=10.254.1.202 export OC3=10.254.1.203 -export OCI=${OC1} - -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null +export ONOS_APPS=null,intentperf diff --git a/tools/test/cells/beast-5 b/tools/test/cells/beast-5 new file mode 100644 index 0000000000..47342816ac --- /dev/null +++ b/tools/test/cells/beast-5 @@ -0,0 +1,16 @@ +# Bare metal cluster (5-node) + +# Use the 1G NIC for cluster communications +export ONOS_NIC="10.254.1.*" + +# ONOS Test proxy +export OCT=10.254.1.200 + +# Use the 1G NICs for external access +export OC1=10.254.1.201 +export OC2=10.254.1.202 +export OC3=10.254.1.203 +export OC4=10.254.1.204 +export OC5=10.254.1.205 + +export ONOS_APPS=null,intentperf diff --git a/tools/test/cells/beastMod b/tools/test/cells/beastMod deleted file mode 100644 index b0c8a5ae4d..0000000000 --- a/tools/test/cells/beastMod +++ /dev/null @@ -1,18 +0,0 @@ -# Bare metal cluster with rearranged nodes - -# Use the 10G NIC for cluster communications -export ONOS_NIC="10.254.1.*" - -# ONOS Test proxy -export OCT=10.254.1.200 - -# Use the 1G NICs for external access -export OC1=10.254.1.207 -export OC2=10.254.1.202 -export OC3=10.254.1.203 -export OC4=10.254.1.204 -export OC5=10.254.1.206 - -export OCI=${OC1} - -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null diff --git a/tools/test/cells/cbench b/tools/test/cells/cbench deleted file mode 100644 index 86019291b6..0000000000 --- a/tools/test/cells/cbench +++ /dev/null @@ -1,8 +0,0 @@ -# Local VirtualBox-based single ONOS instance & ONOS mininet box - -export ONOS_NIC=192.168.56.* -export OC1="192.168.56.103" -export OCN="192.168.56.103" -export OCI="${OC1}" - -export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd" diff --git a/tools/test/cells/ec2 b/tools/test/cells/ec2 index 204988e9ca..ff7d08db07 100644 --- a/tools/test/cells/ec2 +++ b/tools/test/cells/ec2 @@ -1,4 +1,4 @@ -# Bare metal cluster +# EC2-based cluster (7-node) # Use the 10G NIC for cluster communications export ONOS_NIC="192.168.200.*" @@ -15,6 +15,4 @@ export OC5=192.168.200.105 export OC6=192.168.200.106 export OC7=192.168.200.107 -export OCI=${OC1} - -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null +export ONOS_APPS=null,intentperf diff --git a/tools/test/cells/local b/tools/test/cells/local index 3972f1d595..c99d250154 100644 --- a/tools/test/cells/local +++ b/tools/test/cells/local @@ -4,6 +4,5 @@ export ONOS_NIC=192.168.56.* export OC1="192.168.56.101" export OC2="192.168.56.102" export OCN="192.168.56.103" -export OCI="${OC1}" -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-gui,onos-rest,onos-app-fwd,onos-app-proxyarp" +export ONOS_APPS="openflow,fwd,proxyarp,mobility" diff --git a/tools/test/cells/office b/tools/test/cells/office index 87e06f89a1..dd8a5d517e 100644 --- a/tools/test/cells/office +++ b/tools/test/cells/office @@ -1,7 +1,7 @@ -# ProxMox-based cell of ONOS instance; no mininet-box +# ONLAB_OF Wifi ProxMox-based cell; single node; no mininet-box export ONOS_NIC="10.1.10.*" export OC1="10.1.10.223" -export OCI="${OC1}" -export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-gui,onos-app-proxyarp" +export ONOS_APPS="openflow,fwd,proxyarp,mobility" + diff --git a/tools/test/cells/prox b/tools/test/cells/prox index 28e073f527..8af4198983 100644 --- a/tools/test/cells/prox +++ b/tools/test/cells/prox @@ -4,6 +4,3 @@ export ONOS_NIC="10.1.9.*" export OC1="10.1.9.94" export OC2="10.1.9.82" export OCN="10.1.9.93" -export OCI="${OC1}" - -export ONOS_FEATURES="" diff --git a/tools/test/cells/sdnip-pmox b/tools/test/cells/sdnip-pmox index 9f662652b8..032961657f 100644 --- a/tools/test/cells/sdnip-pmox +++ b/tools/test/cells/sdnip-pmox @@ -1,10 +1,8 @@ # SDN-IP ProxMox cell -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-app-config,onos-app-proxyarp,onos-gui,onos-rest" - export ONOS_NIC=10.128.4.* export OC1="10.128.4.65" export OC2="10.128.4.66" export OC3="10.128.4.67" -export ONOS_USER=sdn +export ONOS_APPS="openflow,fwd,proxyarp,mobility,config,sdnip" diff --git a/tools/test/cells/single b/tools/test/cells/single index 3810482320..19485a9446 100644 --- a/tools/test/cells/single +++ b/tools/test/cells/single @@ -3,6 +3,5 @@ export ONOS_NIC=192.168.56.* export OC1="192.168.56.101" export OCN="192.168.56.103" -export OCI="${OC1}" -export ONOS_FEATURES=webconsole,onos-api,onos-core-trivial,onos-cli,onos-rest,onos-openflow,onos-app-fwd,onos-app-proxyarp,onos-app-gui +export ONOS_APPS="openflow,fwd,proxyarp,mobility" diff --git a/tools/test/cells/single_optical b/tools/test/cells/single_optical index 9eb613cea9..1785bfceca 100644 --- a/tools/test/cells/single_optical +++ b/tools/test/cells/single_optical @@ -1,7 +1,7 @@ -# Local VirtualBox-based single ONOS instance & ONOS mininet box +# Optical use-case VirtualBox-based single ONOS instance & ONOS mininet box export ONOS_NIC=192.168.56.* export OC1="192.168.56.101" export OCN="192.168.56.103" -export ONOS_FEATURES=webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-gui,onos-app-optical +export ONOS_APPS="openflow,fwd,proxyarp,mobility,optical" diff --git a/tools/test/cells/tom b/tools/test/cells/tom index cba30f35e3..a48933b01c 100644 --- a/tools/test/cells/tom +++ b/tools/test/cells/tom @@ -1,8 +1,7 @@ -# Thomas' VirtualBox-based single ONOS instance & ONOS mininet box +# Thomas' VirtualBox-based 3 ONOS instances & ONOS mininet box export ONOS_NIC=192.168.56.* export OC1="192.168.56.11" -export OCN="192.168.56.7" -export OCI="${OC1}" - -export ONOS_FEATURES=webconsole,onos-api,onos-core-trivial,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-fwd,onos-app-proxyarp,onos-app-mobility +export OC2="192.168.56.12" +export OC3="192.168.56.13" +export OCN="192.168.56.14" diff --git a/tools/test/cells/tom3 b/tools/test/cells/tom3 deleted file mode 100644 index c209f8f3fb..0000000000 --- a/tools/test/cells/tom3 +++ /dev/null @@ -1,10 +0,0 @@ -# Thomas' VirtualBox-based 3 ONOS instances & ONOS mininet box - -export ONOS_NIC=192.168.56.* -export OC1="192.168.56.11" -export OC2="192.168.56.12" -export OC3="192.168.56.13" -export OCN="192.168.56.14" -export OCI="${OC1}" - -unset ONOS_FEATURES diff --git a/tools/test/cells/tomx b/tools/test/cells/tomx index 700be439da..48018dea93 100644 --- a/tools/test/cells/tomx +++ b/tools/test/cells/tomx @@ -1,13 +1,7 @@ -# Local VirtualBox-based ONOS instances 1,2,3 & ONOS mininet box +# Office ProxMox ONOS instances 1,2,3 & ONOS mininet box export ONOS_NIC=10.128.11.* export OC1="10.128.11.1" export OC2="10.128.11.2" export OC3="10.128.11.3" export OCN="10.128.11.4" - -export OCI="${OC1}" -export OCT="${OC1}" - -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow" -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-null" diff --git a/tools/test/cells/triple b/tools/test/cells/triple index cd7f174044..5a929f9313 100644 --- a/tools/test/cells/triple +++ b/tools/test/cells/triple @@ -5,6 +5,5 @@ export OC1="192.168.56.101" export OC2="192.168.56.102" export OC3="192.168.56.104" export OCN="192.168.56.103" -export OCI="${OC1}" -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-gui,onos-rest,onos-app-fwd,onos-app-proxyarp" +export ONOS_APPS="openflow,fwd,proxyarp,mobility"