Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

I was able to accomplish the goal, non-interactively sending plugin-built statements (like dropAllPacketsRpc on) to the OSGi console, via a different mechanism.

Giving the -start or -start [port_num] flag to run.sh makes OSGi listen for connections to the shell via telnet (defaults to port 2400), instead of dropping the user into a shell. You can then echo arbitrary commands to a telnet session:

issue_odl_config()
{
    # Give dropAllPackets command via telnet to OSGi
    # This is a bit of a hack, but it's the only method I know of
    # See: https://ask.opendaylight.org/question/146/issue-non-interactive-gogo-shell-command/
    if ! command -v telnet &>/dev/null; then
        sudo yum install -y telnet
    fi
    echo "dropAllPacketsRpc on" | telnet 127.0.0.1 $OSGI_PORT
}