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


Issue non-interactive Gogo shell command

asked 2014-05-23 08:50:18 -0700

updated 2014-12-10 11:28:31 -0700

From the OSGi console, I can issue the dropAllPacketsRpc on command with no trouble. I need to issue that same command in a non-interactive mode, for a CBench performance test I'm writing.

If I put a gosh_profile file in controller/opendaylight/distribution/opendaylight/src/main/resources/etc, I can do things like change the OSGi prompt successfully. However, simply putting dropAllPacketsRpc on in that gosh_profile (like I would do with other shells) throws an error after build/run (command not found).

My two running theories are that there's another syntax for issuing non-builtin commands, or that the command I'm running hasn't been setup at the time gosh_profile is sourced, so it really doesn't exist.

Obviously I don't know much about Gogo scripts, OSGi and such. I've Googled pretty hard, but I'm having a very tough time finding relevant resources. Links are appreciated, even if you don't have a direct answer.

Update: I'm able to add any valid OSGi console statement (like dropAllPacketsRpc on) to a script, then successfully run source /path/to/ at the console. However, when I add the source command to gosh_profile, keeping the script syntax the same, I get the same consoleCommandNotFoundException: Command not found: dropAllPacketsRpc. That seems to eliminate my syntax theory and support the theory that the commands built by plugins aren't available at the time gosh_profile is sourced. That seems...hard to get around. *frustration*

edit retag flag offensive close merge delete


Do you mean you want to trigger an OSGi command? What do you man by non-builtin commands?

krish7919 ( 2014-05-27 09:24:10 -0700 )edit

I think I mean commands that are not added by plugins, but are shipped with the shell. For example, `dropAllPacketsRpc` is defined in `openflowplugin/<snip>/` while commands like setting the prompt ship with the Gogo shell (and work in gosh_profile).

dfarrell07 ( 2014-05-27 10:56:37 -0700 )edit

Can you work with telnet-ing or ssh-ing into OSGi console? This has more info:

krish7919 ( 2014-05-28 07:14:05 -0700 )edit

Yeah, I was just working on the telnet route (via IRC late yesterday). Seems to be a workable solution, if a bit ugly. Thanks (I would +1, but <5 karma noob)!

dfarrell07 ( 2014-05-28 11:59:31 -0700 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-29 11:24:57 -0700

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 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:

    # Give dropAllPackets command via telnet to OSGi
    # This is a bit of a hack, but it's the only method I know of
    # See:
    if ! command -v telnet &>/dev/null; then
        sudo yum install -y telnet
    echo "dropAllPacketsRpc on" | telnet $OSGI_PORT
edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-05-23 08:50:18 -0700

Seen: 403 times

Last updated: May 29 '14