Netsight TCL Scripting - Modifying Switch Banners
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-26-2017 01:23 PM
I want to be able to make modifications to the after-login banner on my 4,000 switches. I would like to use a TCL script from within Netsight to do it.
I have the entire script working except that I found that the "configure banner" command is uniquely problematic. The command needs to be issued and then the text of the banner typed out in a terminal and finished with a blank line to denote the end of the banner.
The problem within a script is that when I issue the "configure banner after-login" command, there is no response of any kind from the switch. I want to be able to send the text of the banner, and I thought I could do it with:
CLI $bannerText
but that just times out.
In other situations where further input is required the idiom is typically:
SAVE config secondary
regexp {.*overwrite it?.*} ${CLI.OUT} foundit
IF ([info exists foundit]) THEN
CLI yes
ENDIF
So you issue a command and match on the CLI.OUT contents.
In this case it seems like the script just hangs on the banner command and times out.
JUST WONDERING IF ANYBODY HAS FOUND A WAY AROUND THIS.
I have a TCL script outside of Netsight that can do this but it's much better to allow all my colleagues to run the script from inside our management system.
I have the entire script working except that I found that the "configure banner" command is uniquely problematic. The command needs to be issued and then the text of the banner typed out in a terminal and finished with a blank line to denote the end of the banner.
The problem within a script is that when I issue the "configure banner after-login" command, there is no response of any kind from the switch. I want to be able to send the text of the banner, and I thought I could do it with:
CLI $bannerText
but that just times out.
In other situations where further input is required the idiom is typically:
SAVE config secondary
regexp {.*overwrite it?.*} ${CLI.OUT} foundit
IF ([info exists foundit]) THEN
CLI yes
ENDIF
So you issue a command and match on the CLI.OUT contents.
In this case it seems like the script just hangs on the banner command and times out.
JUST WONDERING IF ANYBODY HAS FOUND A WAY AROUND THIS.
I have a TCL script outside of Netsight that can do this but it's much better to allow all my colleagues to run the script from inside our management system.
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-26-2017 06:27 PM
Thanks Stephane. I haven't seen much documentation on the Python scripting but I certainly want to give it a go - want to learn Python anyway ( I know Perl and I learned TCL for the Extreme environment )
I found that even when my script timed out, I wasn't completing the banner command.
I couldn't find a method of sending the command plus the banner text at the switch. Assuming I had a string with the command and banner text in it, how would I use it to issue the command to the switch?
I tried:
configure banner after-login $bannerTextWithLeadingNewline
but that didn't seem to work ( maybe I missed the trailing blank line and newline ? )
There seems to be a command like:
CLI $string
but I can't find documentation beyond its use in some sample scripts.
Thanks for your help with this BTW.
Ed.
I found that even when my script timed out, I wasn't completing the banner command.
I couldn't find a method of sending the command plus the banner text at the switch. Assuming I had a string with the command and banner text in it, how would I use it to issue the command to the switch?
I tried:
configure banner after-login $bannerTextWithLeadingNewline
but that didn't seem to work ( maybe I missed the trailing blank line and newline ? )
There seems to be a command like:
CLI $string
but I can't find documentation beyond its use in some sample scripts.
Thanks for your help with this BTW.
Ed.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-26-2017 06:27 PM
oh, and btw, starting with EMC 8.0.4 you have access to Python scripting too. I tested the dirty trick on an EXOS VM with Python.
