#!/bin/bash
#
# Ryu SDN Framework
# -----------------

# Used by ofagent.
# TODO(yamamoto): Switch to pip_install once the development was settled

# Save trace setting
RYU3_XTRACE=$(set +o | grep xtrace)
set +o xtrace

RYU_DIR=$DEST/ryu

# Make this function idempotent and avoid cloning same repo many times
# with RECLONE=yes
_RYU_INSTALLED=${_RYU_INSTALLED:-False}
function install_ryu {
    if [[ "$_RYU_INSTALLED" == "False" ]]; then
        git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
        export PYTHONPATH=$RYU_DIR:$PYTHONPATH
        pip_install $(cat $RYU_DIR/tools/pip-requires)
        _RYU_INSTALLED=True
    fi
}

# Restore xtrace
$RYU3_XTRACE