All the Interesting Things

This is a personal web log. All information posted here does not represent my employer. I do not speak for my employer.
Sunday Feb 15, 2009

Storage 7000 (Amber Road) Automated CLI Tool

When I was working on a POC for a customer, I found that I needed a tool to change some configuration of a Storage 7000(aka Amber Road) device automatically. There are two kinds of interfaces provided by the Storage 7000: BUI and CLI. BUI is for a user to manage the device in a browser. S7000's CLI is a shell like command line interface. CLI can be accessed by a SSH client.

The CLI is good way for repetitive administration tasks. However, there is one shortcoming on this CLI. Though Stroage 7000 has OpenSolaris as its OS, it does not allow administrators to access its underlying OS directly. Therefore, unlike other CLI interfaces, this is no way to start the S7000's CLI automatically on its OS. This implies we must login remotely(via SSH) to S7000 and then perform the CLI tasks.

There is a tool called "Expect" can help us in automating the CLI tasks. However, it is written in Tcl and need to know some syntax of Tcl. It may also has cross platform issues. My customer did not know Tcl well. They also had a Java application that needed to invoke the CLI features. So I wrote a Java program to allow automatic execution of S7000's CLI commands. It can be used on any plaftform that supports Java, such as Solaris, Windows, Linux. This program basically connects to a S7000 via SSH and issues a sequence of pre-defined commands. The commands to send are contained in a text file. By running a script on a normal Solaris box, we can change the configuration of the S7000. Some examples of functions can be achieved by using this tool:

1) Enable/disable NFS/CIFS/FTP/HTTP services during a period of time in a day
2) Retrieval of Analytics report and log
3) Automatic user provisioning
4) User password synchronization or reset

Here is an example of how to use this tool to disable ftp service on a SS7410(129.208.91.11). First we create a file called ftp.txt. The content of the file contains the commands we are going to issue to the SS7410:


bash-3.0# cat ftp.txt

##########################################
## lines start with ## will be ignored
##
## disable ftp service
##
##########################################
configuration services ftp
disable
commit

Suppose the admin userid and password on the SS7410 is root/password, then on a remote Solaris machine, we run this tool as followed:

bash-3.0# java -jar amberroad.jar 129.208.91.11 root password ftp.txt

Connecting to 129.208.91.11 ...
Authenticating with userName: root ...
Connected to 129.208.91.11 ...

Starting to send commands ...

Last login: Fri Feb 13 23:00:35 2009 from 129.208.91.88
ss7410:> configuration services ftp
ss7410:configuration services ftp> disable
ss7410:configuration services ftp> commit
ss7410:configuration services ftp>
Connection closed.
bash-3.0#

Another advantage of this tool is that it can be integrated into a Java application. For example, my customer has a web page that allows a user to change his/her LDAP password. They modified their java code to update a local user's password in S7000 at the same time the LDAP password is changed. In this way, CIFS service can "authenticate" via LDAP user id.

In my opinion, the next release of S7000 may need to consider a standard API( such as WS-RPC call, java api) for the ease of automated use of CLI.

This tool can be downloaded here. JDK 1.5+ is support, and possibly works for JDK1.4 or 1.3.



other articles:
NASCAR Diecast
US Citizenship Interview Test Question and Application

Comments:

The principle looks similar to the "expect" command. Did you hit a limitation of expect or prefer a clean specialized implementation?

Posted by Marc on February 15, 2009 at 09:06 PM PST #

Dear Marc,

Expect is written in Tcl. My customer does not know Tcl well and they need this tool on Windows platform. Besides, they want to have a programmatic way to control the device in Java. Therefore, we came up with this small java program to help them.

Posted by Morningstar on February 15, 2009 at 09:34 PM PST #

[Trackback] ClubOrlov: Saturday, February 14, 2009 Social Collapse Best Practices (tags: mustread) Storage 7000 (Amber Road) Automated CLI Tool : All the Interesting Things ...

Posted by c0t0d0s0.org on February 16, 2009 at 03:00 AM PST #

Post a Comment:
Comments are closed for this entry.

Archives
Links
Referrers