05 October, 2008

Say my name!

I love having interesting problems to solve.  There is nothing quite like the feeling I get when I finally get a piece of code working the way I want it to work. 
Nerdgasmic
I have learned a few new languages lately (TCL and Expect), and they are surprisingly versatile.
I don’t get a lot of time to fiddle with automation code at work because there are things that need to get done, so I do it in my free time.  I have been having trouble getting a script to work that cleared all the MAC addresses out of the ports of a card.
Right now, they use a menu driven front-end that requires you to clear each port manually. 
That is two key presses.  Not a lot if you only want to clear out one port.
I have almost 400 ports that are terminated.  They have to be cleared each time I want to build a new emulation.  That is a lot of wasted key presses.
I could go get a cup of coffee in that time.
So I’ve been working on a script that drives the menu application.  I don’t have the source code.  But I can use a nifty little language called Expect to ‘press’ the keys for me, and I can use TCL to loop it through as many ports as I want.
While I go get my coffee.
I had everything working except the transition from card to card.  I have twelve cards.  I could run the script twelve times, and it would work fine, but thats 24 key presses.
So I fiddle with it, and I fiddle with it, and I try different tricks and and I finally had a breakthrough.  Starting tomorrow I will never manually clear the MAC addresses ever the hell again. 
Rise up against tyrannical keystrokes!  Today is our Independence Day!
On to the next puzzle.  Maybe some more coffee first…
Namasté,
Sisyphus
  Victory is Mine!    --Stewy

No comments: