What is DataPower and Why DataPower?

Straight from the IBM site, this is the definition of DataPower -

IBM® WebSphere® DataPower® SOA Appliances are purpose-built, easy-to-deploy network devices that simplify, help secure, and accelerate your XML and Web services deployments while extending your SOA infrastructure.

Lets stop with that and talk a little bit about SOA, the current architecture and how DataPower fits in.

The middleware infrastructure of an enterprise need to support XML and Web Services, since its emergence and popularity. This meant that the ESB or enterprise service bus had to support the emerging technology. This was proving to be an problem because of -

  1. Traditional middleware installation has increased installation and maintenance costs
  2. Operational costs involved in supporting the new data format (XML) and the existing formats (flatfile, cobol copybook etc)
  3. Security – New forms of attack on the infrastructure

[1]DataPower SOA appliances address these three challenges with the creation of specialized, purpose-built, consumable SOA appliances that redefine the boundaries of middleware. As the “hardware ESB,” DataPower SOA appliances are an increasingly important part of the IBM ESB family.

As mentioned earlier DataPower is an appliance. So why exactly do we need an appliance what can it do?. Lets looks a typical infrastructure  – (this is not how it is but helps to explain the situation icon biggrin What is DataPower and Why DataPower? )

Continue reading

Useful Python Snippets

My love for Python has indeed grown with the constant usage. Each day i find something that is really interesting with that. By interesting i mean, C will complain and whine if i do that, PERL say ‘lets give it a try‘ and Python is like, ‘C’mon baby, i’m ready!!!’.

My advice to good C/C++ programmers is that, stay the way you are, picking up PERL / Python will screw up you skill. C is like the wife with whom you have to be loyal, Python is like the liberal girlfriend, who lets you flirt with other girls and wouldn’t mind.

Coming back to the purpose of this post, here are some of the snippets that proved useful to me and could also help you out with in your scripts -

File to List – Move the contents of the file in to an list, line by line

list = ([line for line in open ( "names.txt", "r")])

Pattern Matching – the only thing that i miss in Python is the regexp usability that PERL gave me. Some how i feel that using regexp was a lot more easier with Perl, than with Python

# import the regex pacakge
import re
#create the regex object
pattern = re.compile("error")
# search for pattern
re.search(pattern, sampleString)

re.search return TRUE / FALSE depending on the result, so that it can be used along with if <> : clause

Detecting the OS and creating directories – this helps to solve the variation in the Windows directory navigation (..\\..\\) and the Unix style navigation (../../)

# import OS packages and time package
import os, time, sys, os.path
# create a unique directory name based on the time
dirName="Run-"+time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
# detect the OS
if os.name == "posix":
    logPath = "../../logs/"
    resultsPath = "../../results/"
else:
    logPath = "..\\..\logs\\"
    resultsPath = "..\\..\\results\\"
# create the directories
os.mkdir(logPath+dirName)
os.mkdir(resultsPath+dirName)

String is like a List – the best part of Python

str = "Hello"
# will print H
print str[0]

Happy scripting, and i hope this will be helpful to some … icon smile Useful Python Snippets

Script for Telnetting with PERL and Python

75 logo Script for Telnetting with PERL and PythonLets just say that PERL made me a crazy programmer. Then came Python, it made me an insane one. In my previous job, it was all PERL, PERL and PERL. But this current job has made me pick up Python.

Python was picked up because the STAF/STAX automation work required scripts and Python was the candidate. So one fine day i found myself writing this -

python logo Script for Telnetting with PERL and Python#!/usr/bin/python
print "Hello world"

instead of this -

#!/usr/bin/perl
print "Hello World";

Then i actually looked back and thought, what was the first real purpose for which i wrote a PERL script – telnetting. Even today i find that telnetting to workstations to retrieve stats, is one thing that i do a zillions times day. The usual telnet script with PERL/Python has to be used along with the Expect module. That guarantees that the session time-outs and failure scenarios are properly taken care of.

But there is one place where you can just avoid Expect module all together. Its when you use the script within the same network and you are 70% sure that the pain-in-the-butt scenario rarely happens. So here it is a minimal telnet script that i have made in both PERL and Python.

PERL

#!/usr/bin/perl
use Telnet;
$host = "192.168.1.100";
$port = "2300";
$uid = "jerry";
$pwd = "password";
open $inputLog,  ">in.log";
$box = new Net::Telnet();
$box->open(     Host => $host,
                Port => $port,
        );
$iLog = $box->input_log($inputLog);
$flag = $box->login(    Name => $uid,
                        Password => $pwd,
                );
$box->print("show log");
$box->waitfor('/# $/i');
$box->close;
exit

PYTHON

#!/usr/bin/python
import os, telnetlib
HOST = "192.168.1.100"
PORT = "2300"
user = "jerry"
password = "password"
f = open(sLog, "in.log")
tn = telnetlib.Telnet(HOST, PORT)
tn.read_until("login: ")
tn.write(uid + "\n")
tn.read_until("Password: ")
tn.write(pwd + "\n")
tn.read_until("]#")
tn.write("show log\n")
f.write(tn.read_until("]#"))
f.close()
tn.write("exit\n")
tn.read_until("#")
tn.close()

Happy scripting. icon smile Script for Telnetting with PERL and Python

Telnet Scripting Tool a.k.a TST10.exe

I have been thinking for a long time that i need to write about this tool that i found. Its quite interesting that this tool is really helpful in automating many of the routine sessions that i as a tester came across. This is by far the best automation tool that i found for telnet sessions.

Imagine these scenarios :

  • You need to do BSO authentications frequently when you switch networks
  • Get intermittent logs from the server for analysis
  • Run automated tests on remote systems (something which i have started to call as run-and-forget)
  • stuck in traffic…no way

Lets get into what this tool is and how to use it.

The tool is for windows (one of the things that i felt bad). To make use of this tool, u will need the exe file, i.e., tst10.exe and an input commands file. The input file will has the first line as the hostname/IP and port, which is followed by alternating SEND and WAIT commands.

Consider this example. I need to connect to a server of IP – 192.168.1.100, where a telnet service is running at PORT – 2300. This is how my script/input file will look like :

192.168.1.100 2300
SEND "\m"
WAIT "login:"
SEND "admin\m"
WAIT "Password:"
SEND "admin1\m"
WAIT "s1#"
SEND "co\m"
WAIT "s1(config)#"
SEND "show load; show cpu\m"
WAIT "s1(config)#"

“\m” = \n in C/PERL/Java/most programming langunages = CR or in non-techie terms “Enter”. SEND, sends the commands to be executed and the WAIT that follows tried to match the string in the output of the SEND commands before it.

How to run it?. There are 2 ways to do it. You can open up the command prompt navigate to the directory where the files are and then issue this command -

tst10.exe /r:IN /o:OUT

where IN is the input file and OUT stores the complete output of the session, so that you can skim through the file and have a look at what happened. OR, put the command in a batch file and double click it every time you need to run it.

Here is the screen capture -

tst10 Telnet Scripting Tool a.k.a TST10.exe

TST10 Screen Capture

How is it different from Net::Telnet module of Perl or something similar in TCL or Python? Think about it.

  • Time to write the code – 30min to ? depending upon how complex the situation is
  • Trying to match the output to with REGEX, which means that you need to spend time in coming up with the right regex. Now you have 2 problems in hand
  • Testing time to make sure that the script is robust enough

So this is perfect! NO. This doesn’t work for ssh sessions. Since telnet is getting substituted by ssh in most of the servers due to the secure nature of the connection its kind of difficult to fit it in a normal installation of Linux. I’m not sure about the telnet-ssh thingie happening in Solaris or any of the other servers.

Is there something like this for Linux? icon sad Telnet Scripting Tool a.k.a TST10.exe No. Hey, but look at it this way. Its some relief for us on windows platform for scripting.

You can build complex automatons with this combined with a little bit of Perl and Outlook. Here is one typical scenario that i made and which i have presented as a white-paper.

  • Outlook has a setting that detects for incoming mails with a specific subject line.
  • When the mail comes it evokes a Perl script.
  • The Perl script will go ahead an call the TST’s batch file, which initiates the TST10 session, connects to the remote server starts/runs the automation. The output will be stored in OUT file
  • The Perl script will skim the OUT file for any errors reported during the run.
  • Then it calls an FTP script that will go ahead and get the log files from the remote system
  • The log files are read, the results extracted and neatly formatted into mail and send to the required email-ids

icon smile Telnet Scripting Tool a.k.a TST10.exe sounds complex, but this script gave me enough time to hut for a new job and quit the previous employer.

Who wrote this? Someone by the name of Albert Yale. His home page is – http://ay.home.ml.org/, sadly the site is no longer online.

What happened to the white-paper? It got rejected icon wink Telnet Scripting Tool a.k.a TST10.exe , humor was not the order of the day.

Download TST10 : tst10.exe | tst10.zip

Google Chrome – First Impressions

chrome 205 noshadow Google Chrome   First Impressions

What should i comment on this browser. First thing that caught my attention was the cool technology that went into this beautiful little app. Remember the days when we used IE, then Fx came along and just tripped and toppled our whole browsing experience. Fx came up with the idea of tabs, imporved browsing experience, plugins etc. etc. You name it they had it, or rather they were ready to include that in their next realease.

I feel the same when i see Chrome or Google Chrome. Its the coolest idea that we can have for a browser at this point. A browser that doesnt crash or rather does a good crash. It never affects any of your other open sessions.

(Read the Chrome story)

The best fact – its open source. That means that even my granny can get the source code and help Google imporve it or can come out with her own Hare-Rama-Rahe-Krishna Browser for the religious kind.

After the initial interations with other users over twitter. I found that people have some common issues, worries, concerns etc etc and not to mention a funny stuff too.

Prasanth a fellow Mutineer, found the shift to Chrome taking a toll on his mental heath, it was too mentally tiring for him.

Sivaprasad was able to download the online installer, but as he was sitting behing a proxy and had to authenticate the installer didnt finish what it had started. He was kind enough to send in the fix for the problem which he found here.

For all those who need a complete offline installer, i have uploaded the same in my site and is awailable for download at this link – Chrome Download. This was Allajunaki‘s idea

Interestingly Kiruba reported and error thrown by Chrome that read - “Google Chrome has encountered a problem and needs to close. Please tell Microsoft about it”. icon biggrin Google Chrome   First Impressions

Waiting for more reactions…

(first post on/using/with Chrome)

Chrome Offline installer Download