Thomas Vachuska
Committed by Gerrit Code Review

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
...@@ -37,7 +37,17 @@ cp -r $ONOS_ROOT/tools/package/bin . ...@@ -37,7 +37,17 @@ cp -r $ONOS_ROOT/tools/package/bin .
37 cp -r $ONOS_ROOT/tools/package/debian $ONOS_STAGE/debian 37 cp -r $ONOS_ROOT/tools/package/debian $ONOS_STAGE/debian
38 cp -r $ONOS_ROOT/tools/package/etc/* $ONOS_STAGE/$KARAF_DIST/etc 38 cp -r $ONOS_ROOT/tools/package/etc/* $ONOS_STAGE/$KARAF_DIST/etc
39 39
40 -# Patch-in proper Karaf version into the startup script. 40 +# Stage all builtin ONOS apps for factory install
41 +mkdir $ONOS_STAGE/apps
42 +find $ONOS_ROOT -name 'app.xml' | egrep -v '/src/test/|/target/|org\.foo\.' | \
43 + xargs grep 'name=' | sed 's/<app name="//g;s/".*//g' | while read line; do
44 + appxml=${line%:*}
45 + app=${line#*:}
46 + mkdir $ONOS_STAGE/apps/$app
47 + cp $appxml $ONOS_STAGE/apps/$app/app.xml
48 + done
49 +
50 +# Patch-in proper Karaf version into the startup script
41 sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \ 51 sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \
42 $ONOS_ROOT/tools/package/bin/onos-service > bin/onos-service 52 $ONOS_ROOT/tools/package/bin/onos-service > bin/onos-service
43 sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \ 53 sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \
...@@ -60,9 +70,9 @@ done ...@@ -60,9 +70,9 @@ done
60 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onosproject/onos-features/$ONOS_POM_VERSION/xml/features|" \ 70 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onosproject/onos-features/$ONOS_POM_VERSION/xml/features|" \
61 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 71 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
62 72
63 -# Patch the Apache Karaf distribution file to load ONOS features 73 +# Patch the Apache Karaf distribution file to load default ONOS boot features
64 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow" 74 +export BOOT_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui"
65 -perl -pi.old -e "s|^(featuresBoot=.*)|\1,$ONOS_FEATURES|" \ 75 +perl -pi.old -e "s|^(featuresBoot=.*)|\1,$BOOT_FEATURES|" \
66 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 76 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
67 77
68 # Patch the Apache Karaf distribution with ONOS branding bundle 78 # Patch the Apache Karaf distribution with ONOS branding bundle
......
...@@ -71,23 +71,32 @@ alias gui='onos-gui' ...@@ -71,23 +71,32 @@ alias gui='onos-gui'
71 alias sshctl='onos-ssh' 71 alias sshctl='onos-ssh'
72 alias sshnet='onos-ssh $OCN' 72 alias sshnet='onos-ssh $OCN'
73 73
74 +
75 +# Sets the primary instance to the specified instance number.
76 +function setPrimaryInstance {
77 + export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2)
78 + echo $OCI
79 +}
80 +
74 # Applies the settings in the specified cell file or lists current cell definition 81 # Applies the settings in the specified cell file or lists current cell definition
75 # if no cell file is given. 82 # if no cell file is given.
76 function cell { 83 function cell {
77 if [ -n "$1" ]; then 84 if [ -n "$1" ]; then
78 [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ 85 [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \
79 echo "No such cell: $1" >&2 && return 1 86 echo "No such cell: $1" >&2 && return 1
80 - unset ONOS_CELL ONOS_NIC ONOS_FEATURES ONOS_USER ONOS_GROUP 87 + unset ONOS_CELL ONOS_NIC ONOS_APPS ONOS_BOOT_FEATURES ONOS_USER ONOS_GROUP
81 - unset OCI OCN 88 + unset OCI OCN OCT
89 + unset ONOS_FEATURES # deprecated
82 unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') 90 unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p')
83 export ONOS_CELL=$1 91 export ONOS_CELL=$1
84 . $ONOS_ROOT/tools/test/cells/$1 92 . $ONOS_ROOT/tools/test/cells/$1
93 + setPrimaryInstance 1 >/dev/null
85 cell 94 cell
86 else 95 else
87 env | egrep "ONOS_CELL" 96 env | egrep "ONOS_CELL"
88 env | egrep "OCI" 97 env | egrep "OCI"
89 env | egrep "OC[0-9]+" | sort 98 env | egrep "OC[0-9]+" | sort
90 - env | egrep "OCN" 99 + env | egrep "OC[NT]"
91 env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL' 100 env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL'
92 fi 101 fi
93 } 102 }
...@@ -97,18 +106,12 @@ cell local >/dev/null # Default cell is the local VMs ...@@ -97,18 +106,12 @@ cell local >/dev/null # Default cell is the local VMs
97 # Lists available cells 106 # Lists available cells
98 function cells { 107 function cells {
99 for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do 108 for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do
100 - printf "%-12s %s\n" \ 109 + printf "%-16s %s\n" \
101 "$([ $cell = $ONOS_CELL ] && echo $cell '*' || echo $cell)" \ 110 "$([ $cell = $ONOS_CELL ] && echo $cell '*' || echo $cell)" \
102 "$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)" 111 "$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)"
103 done 112 done
104 } 113 }
105 114
106 -# Sets the primary instance to the specified instance number.
107 -function setPrimaryInstance {
108 - export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2)
109 - echo $OCI
110 -}
111 -
112 # Miscellaneous 115 # Miscellaneous
113 function spy { 116 function spy {
114 ps -ef | egrep "$@" | grep -v egrep 117 ps -ef | egrep "$@" | grep -v egrep
......
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
8 8
9 remote=$ONOS_USER@${1:-$OCI} 9 remote=$ONOS_USER@${1:-$OCI}
10 10
11 -# Customize features 11 +# ONOS boot features
12 -export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow}" 12 +export ONOS_BOOT_FEATURES="${ONOS_BOOT_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui}"
13 13
14 +# ONOS builtin apps and providers ignited by default
15 +export ONOS_APPS="${ONOS_APPS:-openflow}"
14 16
15 # Generate a cluster.json from the ON* environment variables 17 # Generate a cluster.json from the ON* environment variables
16 CDEF_FILE=/tmp/${remote}.cluster.json 18 CDEF_FILE=/tmp/${remote}.cluster.json
...@@ -40,9 +42,14 @@ ssh $remote " ...@@ -40,9 +42,14 @@ ssh $remote "
40 echo "log4j.logger.com.hazelcast.cluster.impl.MulticastService= ERROR" \ 42 echo "log4j.logger.com.hazelcast.cluster.impl.MulticastService= ERROR" \
41 >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg 43 >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
42 44
43 - # Patch the Apache Karaf distribution file to load ONOS features 45 + # Patch the Apache Karaf distribution file to load ONOS boot features
44 - perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_FEATURES|\" \ 46 + perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_BOOT_FEATURES|\" \
45 $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.apache.karaf.features.cfg 47 $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.apache.karaf.features.cfg
48 +
49 + # Customize which builtin apps should be ignited
50 + for app in $(echo $ONOS_APPS | tr ',' ' '); do
51 + touch $ONOS_INSTALL_DIR/apps/org.onosproject.\$app/active
52 + done
46 " 53 "
47 54
48 # Generate a default tablets.json from the ON* environment variables 55 # 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 ...@@ -52,4 +59,3 @@ scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/tablets.json
52 59
53 # copy tools/package/config/ to remote 60 # copy tools/package/config/ to remote
54 scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/ 61 scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/
55 -
......
...@@ -51,5 +51,7 @@ for n in $( seq 0 ${max} ); do ...@@ -51,5 +51,7 @@ for n in $( seq 0 ${max} ); do
51 fi 51 fi
52 done 52 done
53 echo "OCN=${OCN}" 53 echo "OCN=${OCN}"
54 +echo "OCT=${OCT}"
54 echo "OCI=${OCI}" 55 echo "OCI=${OCI}"
55 -echo "ONOS_FEATURES=${ONOS_FEATURES}" 56 +echo "ONOS_APPS=${ONOS_APPS}"
57 +echo "ONOS_BOOT_FEATURES=${ONOS_BOOT_FEATURES}"
......
1 -# Bare metal cluster 1 +# Bare metal cluster (7-node)
2 2
3 -# Use the 10G NIC for cluster communications 3 +# Use the 1G NIC for cluster communications
4 -export ONOS_NIC="192.168.200.*" 4 +export ONOS_NIC="10.254.1.*"
5 5
6 # ONOS Test proxy 6 # ONOS Test proxy
7 export OCT=10.254.1.200 7 export OCT=10.254.1.200
...@@ -15,6 +15,4 @@ export OC5=10.254.1.205 ...@@ -15,6 +15,4 @@ export OC5=10.254.1.205
15 export OC6=10.254.1.206 15 export OC6=10.254.1.206
16 export OC7=10.254.1.207 16 export OC7=10.254.1.207
17 17
18 -export OCI=${OC1} 18 +export ONOS_APPS=null,intentperf
19 -
20 -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null
......
1 +# Bare metal cluster (1-node)
2 +
3 +# Use the 1G NIC for cluster communications
4 +export ONOS_NIC="10.254.1.*"
5 +
6 +# ONOS Test proxy
7 +export OCT=10.254.1.200
8 +
9 +# Use the 1G NICs for external access
10 +export OC1=10.254.1.201
11 +
12 +export ONOS_APPS=null,intentperf
1 -# Bare metal cluster 1 +# Bare metal cluster (3-node)
2 2
3 -# Use the 10G NIC for cluster communications 3 +# Use the 1G NIC for cluster communications
4 -export ONOS_NIC="192.168.200.*" 4 +export ONOS_NIC="10.254.1.*"
5 5
6 # ONOS Test proxy 6 # ONOS Test proxy
7 export OCT=10.254.1.200 7 export OCT=10.254.1.200
...@@ -11,6 +11,4 @@ export OC1=10.254.1.201 ...@@ -11,6 +11,4 @@ export OC1=10.254.1.201
11 export OC2=10.254.1.202 11 export OC2=10.254.1.202
12 export OC3=10.254.1.203 12 export OC3=10.254.1.203
13 13
14 -export OCI=${OC1} 14 +export ONOS_APPS=null,intentperf
15 -
16 -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null
......
1 -# Bare metal cluster with rearranged nodes 1 +# Bare metal cluster (5-node)
2 2
3 -# Use the 10G NIC for cluster communications 3 +# Use the 1G NIC for cluster communications
4 export ONOS_NIC="10.254.1.*" 4 export ONOS_NIC="10.254.1.*"
5 5
6 # ONOS Test proxy 6 # ONOS Test proxy
7 export OCT=10.254.1.200 7 export OCT=10.254.1.200
8 8
9 # Use the 1G NICs for external access 9 # Use the 1G NICs for external access
10 -export OC1=10.254.1.207 10 +export OC1=10.254.1.201
11 export OC2=10.254.1.202 11 export OC2=10.254.1.202
12 export OC3=10.254.1.203 12 export OC3=10.254.1.203
13 export OC4=10.254.1.204 13 export OC4=10.254.1.204
14 -export OC5=10.254.1.206 14 +export OC5=10.254.1.205
15 15
16 -export OCI=${OC1} 16 +export ONOS_APPS=null,intentperf
17 -
18 -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null
......
1 -# Local VirtualBox-based single ONOS instance & ONOS mininet box
2 -
3 -export ONOS_NIC=192.168.56.*
4 -export OC1="192.168.56.103"
5 -export OCN="192.168.56.103"
6 -export OCI="${OC1}"
7 -
8 -export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd"
1 -# Bare metal cluster 1 +# EC2-based cluster (7-node)
2 2
3 # Use the 10G NIC for cluster communications 3 # Use the 10G NIC for cluster communications
4 export ONOS_NIC="192.168.200.*" 4 export ONOS_NIC="192.168.200.*"
...@@ -15,6 +15,4 @@ export OC5=192.168.200.105 ...@@ -15,6 +15,4 @@ export OC5=192.168.200.105
15 export OC6=192.168.200.106 15 export OC6=192.168.200.106
16 export OC7=192.168.200.107 16 export OC7=192.168.200.107
17 17
18 -export OCI=${OC1} 18 +export ONOS_APPS=null,intentperf
19 -
20 -export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null
......
...@@ -4,6 +4,5 @@ export ONOS_NIC=192.168.56.* ...@@ -4,6 +4,5 @@ export ONOS_NIC=192.168.56.*
4 export OC1="192.168.56.101" 4 export OC1="192.168.56.101"
5 export OC2="192.168.56.102" 5 export OC2="192.168.56.102"
6 export OCN="192.168.56.103" 6 export OCN="192.168.56.103"
7 -export OCI="${OC1}"
8 7
9 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-gui,onos-rest,onos-app-fwd,onos-app-proxyarp" 8 +export ONOS_APPS="openflow,fwd,proxyarp,mobility"
......
1 -# ProxMox-based cell of ONOS instance; no mininet-box 1 +# ONLAB_OF Wifi ProxMox-based cell; single node; no mininet-box
2 2
3 export ONOS_NIC="10.1.10.*" 3 export ONOS_NIC="10.1.10.*"
4 export OC1="10.1.10.223" 4 export OC1="10.1.10.223"
5 -export OCI="${OC1}"
6 5
7 -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" 6 +export ONOS_APPS="openflow,fwd,proxyarp,mobility"
7 +
......
...@@ -4,6 +4,3 @@ export ONOS_NIC="10.1.9.*" ...@@ -4,6 +4,3 @@ export ONOS_NIC="10.1.9.*"
4 export OC1="10.1.9.94" 4 export OC1="10.1.9.94"
5 export OC2="10.1.9.82" 5 export OC2="10.1.9.82"
6 export OCN="10.1.9.93" 6 export OCN="10.1.9.93"
7 -export OCI="${OC1}"
8 -
9 -export ONOS_FEATURES=""
......
1 # SDN-IP ProxMox cell 1 # SDN-IP ProxMox cell
2 2
3 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-app-config,onos-app-proxyarp,onos-gui,onos-rest"
4 -
5 export ONOS_NIC=10.128.4.* 3 export ONOS_NIC=10.128.4.*
6 export OC1="10.128.4.65" 4 export OC1="10.128.4.65"
7 export OC2="10.128.4.66" 5 export OC2="10.128.4.66"
8 export OC3="10.128.4.67" 6 export OC3="10.128.4.67"
9 7
10 -export ONOS_USER=sdn 8 +export ONOS_APPS="openflow,fwd,proxyarp,mobility,config,sdnip"
......
...@@ -3,6 +3,5 @@ ...@@ -3,6 +3,5 @@
3 export ONOS_NIC=192.168.56.* 3 export ONOS_NIC=192.168.56.*
4 export OC1="192.168.56.101" 4 export OC1="192.168.56.101"
5 export OCN="192.168.56.103" 5 export OCN="192.168.56.103"
6 -export OCI="${OC1}"
7 6
8 -export ONOS_FEATURES=webconsole,onos-api,onos-core-trivial,onos-cli,onos-rest,onos-openflow,onos-app-fwd,onos-app-proxyarp,onos-app-gui 7 +export ONOS_APPS="openflow,fwd,proxyarp,mobility"
......
1 -# Local VirtualBox-based single ONOS instance & ONOS mininet box 1 +# Optical use-case VirtualBox-based single ONOS instance & ONOS mininet box
2 2
3 export ONOS_NIC=192.168.56.* 3 export ONOS_NIC=192.168.56.*
4 export OC1="192.168.56.101" 4 export OC1="192.168.56.101"
5 export OCN="192.168.56.103" 5 export OCN="192.168.56.103"
6 6
7 -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 7 +export ONOS_APPS="openflow,fwd,proxyarp,mobility,optical"
......
1 -# Thomas' VirtualBox-based single ONOS instance & ONOS mininet box 1 +# Thomas' VirtualBox-based 3 ONOS instances & ONOS mininet box
2 2
3 export ONOS_NIC=192.168.56.* 3 export ONOS_NIC=192.168.56.*
4 export OC1="192.168.56.11" 4 export OC1="192.168.56.11"
5 -export OCN="192.168.56.7" 5 +export OC2="192.168.56.12"
6 -export OCI="${OC1}" 6 +export OC3="192.168.56.13"
7 - 7 +export OCN="192.168.56.14"
8 -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
......
1 -# Thomas' VirtualBox-based 3 ONOS instances & ONOS mininet box
2 -
3 -export ONOS_NIC=192.168.56.*
4 -export OC1="192.168.56.11"
5 -export OC2="192.168.56.12"
6 -export OC3="192.168.56.13"
7 -export OCN="192.168.56.14"
8 -export OCI="${OC1}"
9 -
10 -unset ONOS_FEATURES
1 -# Local VirtualBox-based ONOS instances 1,2,3 & ONOS mininet box 1 +# Office ProxMox ONOS instances 1,2,3 & ONOS mininet box
2 2
3 export ONOS_NIC=10.128.11.* 3 export ONOS_NIC=10.128.11.*
4 export OC1="10.128.11.1" 4 export OC1="10.128.11.1"
5 export OC2="10.128.11.2" 5 export OC2="10.128.11.2"
6 export OC3="10.128.11.3" 6 export OC3="10.128.11.3"
7 export OCN="10.128.11.4" 7 export OCN="10.128.11.4"
8 -
9 -export OCI="${OC1}"
10 -export OCT="${OC1}"
11 -
12 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow"
13 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-null"
......
...@@ -5,6 +5,5 @@ export OC1="192.168.56.101" ...@@ -5,6 +5,5 @@ export OC1="192.168.56.101"
5 export OC2="192.168.56.102" 5 export OC2="192.168.56.102"
6 export OC3="192.168.56.104" 6 export OC3="192.168.56.104"
7 export OCN="192.168.56.103" 7 export OCN="192.168.56.103"
8 -export OCI="${OC1}"
9 8
10 -export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-gui,onos-rest,onos-app-fwd,onos-app-proxyarp" 9 +export ONOS_APPS="openflow,fwd,proxyarp,mobility"
......