Script to add banner for multiple devices

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
Create Date: May 21 2012 8:03AM

I would like to create script that will ad banner to my devices.

Currentli have issues with diferent commands on XOS and Extremeware.

Also when i add in script something like:

configure banner before-login

************************************************************

UNAUTHORIZED ACCESS

************************************************************



It gets stuck and cannot execute.

(from Davor_Gadanac)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: May 21 2012 4:31PM

Keep in mind that in order to "end" a banner input, you need to hit "enter" twice because hitting it once, will only advance to the next line.

I have absolutely no problem configuring banners. What I can advise you: create a new script, use LF as end lines and after the banner content just add twice LF and it will work properly.

(from Eugen_NAIMAN)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: May 22 2012 1:56AM

Hello,

If i get it right, script should look like this:

configure banner before-login

************************************************************ "LF"

UNAUTHORIZED ACCESS "LF"

************************************************************ "LF"

LF is with<> without quotes, of course.

When i run script i'm getting "%% Invalid input detected at '^' marker." and marker points to nothing.

Also, when i copy command and paste it directly to CLI on SW everything works OK.

Do you have suggestions how to create script that will recognize SW if it is XOS or Extremeware and use diferent commands (Extremeware does not have before-login option).

(from Davor_Gadanac)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: May 27 2012 7:16PM

You're quite right - this is how it should look. Better get my attached file and test that.

The upload failed anyway - I'll try to send you a PM with the script attached.

About your second issue - Ridgeline has a variable called $isExos which returns "True" if the switch is an XOS one; otherwise it returns "False".

An example:

IF (!$match($isExos,true) ) THEN
Echo "$deviceIP is an EXOS switch."
ELSE
Echo "$deviceIP is NOT an EXOS switch"
ENDIF

Good luck,

EDIT: unfortunately I can't attach any files to PM and I can't attach any files to the post here. If you want, you can PM me your email address and I'll do it that way.

(from Eugen_NAIMAN)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Aug 31 2012 12:00PM

Can you send me the file?
william.f.haden@noaa.gov
thanks.

(from Bill_Haden)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Sep 2 2012 4:49PM

I've sent you the script today William.

I think you should remove your email from the above post and maybe change your username too because it will be likely to get gathered by spammers.

(from Eugen_NAIMAN)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Oct 22 2012 5:11PM

I have this same question. I think I'm stuck on the carriage return and linefeed.  How do I send that through to the switch from the script?

Here is what I am trying right now:

configure banner
this is the banner\r\n
\r\n


 

(from Ryan_Moore)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Oct 27 2012 12:08AM

Donno if you guys figured this out. But i have done this before.

This is how it works

line1....<SPACE><Enter>
#blank line <SPACE> <Enter>
line2 <SPACE> <Enter>
end script with two enters

Thanks,
Arpit
(from Arpit_Bhatt)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 26 2013 3:12PM

Hello,

someone have an example with a hit "enter" key ?

Because when I test a script write in Ridgeline and execute on an equipment, it already stay at the first line and causes a timeout.

My script is very simple :

configure banner before-login
bannertest
\r\r


I've tested to replace \r\r with <enter> or with LF command.

Thanks for any help.

(from tristan)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 27 2013 2:16AM

I wonder how did you have the LF added to your text file because that is a non printed character.

I have created a simple script to add that to the file and it worked really well.

Download the attached file (right-click, Save Target As) and remove the "txt" extension, then try it.

Do not modify the file yet - just try it first to see that if works. To modify it, open it in a text editor (SciTe, Notepad + or other editor which allows you to see the end of line characters). Modify the file and keep the LFs at the end. Once you save it - check it again to see if the LFs haven't been replaced with CRLFs, then run it again.

Or easier if you're even a bit familiar with VisualBasic or any other scripting language:
- have the text file ready with the text you want
- write a short VB script to 
        - read the file
        - replace CRLF with LF
        - save the file

job done :)


banner.xsf.txt

(from Eugen_NAIMAN)

This conversation is no longer open for comments or replies.