2 min read

Easy management access to network devices

Some time ago I had troubles with the backspace key while configuring a Brocade device.

It did not do anything. The problem is, that my terminal (Konsole) does not send "Ctrl-H", but the Brocade terminal expects it to delete a character before the cursor. To solve this problem, I have a small expect script, which intercepts the backspace key and sends the correct character to the device.

eval spawn -noecho $argv
interact {
 \177        {send "\010"}
 "\033\[3~"  {send "\177"}

This file is saved under /usr/local/bin/brocade-kbdfix and made executable.

As I'm lazy and want to have quick access to the devices I have to configure, I've created two scripts which helps me to connect
to the device with the correct method (telnet or ssh):

brocade-kbdfix ssh $(basename $0)
brocade-kbdfix telnet $(basename $0)

They are saved as /usr/local/bin/brocade-ssh and /usr/local/bin/brocade-telnet. Now comes the "magic": For every device I create a symlink with the name of the device pointing to the apropriate connection method. F.e.:

user@server:~ # ls -Alh /usr/local/bin/           
total 60M
lrwxrwxrwx 1 root   root       26 Jan 14 09:26 router1 -> /usr/local/bin/brocade-ssh
-rwxr-xr-x 1 root   root      174 Jan 14 09:24 brocade-kbdfix
-rwxr-xr-x 1 root   root       74 Jan 14 09:24 brocade-ssh
-rwxr-xr-x 1 root   root       77 Jan 14 09:27 brocade-telnet
lrwxrwxrwx 1 root   root       29 Jan 14 09:27 router2 -> /usr/local/bin/brocade-telnet

If /usr/local/bin/ is in your path, you can now just enter the name of the device and your connected to it, including the correct connection method and the keyboard fix (assuming you have a DNS or hosts entry, or even a .ssh/config).


Here is an example how I manage the configuration above with a small Puppet manifest:

class router_tools {
    File {
        mode   => '0755',
        owner  => root,
        group  => root,
    file {
            source => 'puppet:///modules/router_tools/brocade-kbdfix';
            source => 'puppet:///modules/router_tools/brocade-ssh';
            source => 'puppet:///modules/router_tools/brocade-telnet';
    # create symlinks for router access
    file {
            ensure => link,
            target => '/usr/local/bin/brocade-ssh';
            ensure => link,
            target => '/usr/local/bin/brocade-telnet';