mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
We now can use start-stop-daemon (debian), daemon() shell function (centos), or sudo (others) to start onos-service. It should be backward compatible on systemd systems. Tested on Ubuntu 14 and CentOS 6. Should also work on Ubuntu 15/16, CentOS 7, Debian, and Fedora. (Note that we should test this against various OSes, preferably automatically rather than manually!) Addresses at least part of ONOS-2907 Change-Id: I4ded98baf02321a5a9db37fdff19e1ce4a3d23d2
69 lines
2.3 KiB
Bash
Executable File
69 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# -----------------------------------------------------------------------------
|
|
# Remotely configures & starts ONOS for the first time.
|
|
# -----------------------------------------------------------------------------
|
|
|
|
function _usage () {
|
|
cat << _EOF_
|
|
usage:
|
|
$(basename $0) [node]
|
|
|
|
options:
|
|
- [node] : The node to configure
|
|
|
|
summary:
|
|
Remotely configures and starts ONOS for the first time.
|
|
|
|
The procedure for configruing a node include determining base features,
|
|
applications to load at startup, and clustering and logical network view
|
|
configurations, among others.
|
|
|
|
If [node] isn't specified, the defualt target becomes \$OCI.
|
|
|
|
_EOF_
|
|
}
|
|
|
|
[ "$1" = "-h" ] && _usage && exit 0
|
|
|
|
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
|
|
. $ONOS_ROOT/tools/build/envDefaults
|
|
|
|
node=${1:-$OCI}
|
|
remote=$ONOS_USER@$node
|
|
|
|
# ONOS boot features
|
|
export ONOS_BOOT_FEATURES="${ONOS_BOOT_FEATURES:-webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui}"
|
|
|
|
# ONOS builtin apps and providers ignited by default
|
|
export ONOS_APPS="${ONOS_APPS:-drivers,openflow}"
|
|
|
|
ssh -tt $remote "
|
|
echo \"onos.ip = \$(sudo ifconfig | grep $ONOS_NIC | cut -d: -f2 | cut -d\\ -f1)\" \
|
|
>> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties
|
|
|
|
# Drop copycat related log level for the console
|
|
echo "log4j.logger.net.kuujo.copycat= INFO" \
|
|
>> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
|
|
|
|
# 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 cluster.json from the ON* environment variables
|
|
CDEF_FILE=/tmp/${remote}.cluster.json
|
|
onos-gen-partitions $CDEF_FILE
|
|
scp -q $CDEF_FILE $remote:$ONOS_INSTALL_DIR/config/cluster.json
|
|
|
|
# Copy tools/package/config/ to remote
|
|
scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/
|
|
|
|
# Copy the desired initial network configuration to remote if needed
|
|
[ -n "$ONOS_CFG" -a -f "$ONOS_CFG" -a "${1:-$OCI}" = "$OC1" ] && \
|
|
scp $ONOS_CFG $remote:$ONOS_INSTALL_DIR/config/network-cfg.json
|